-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathClient_1_2_0
More file actions
1 lines (1 loc) · 57.5 KB
/
Client_1_2_0
File metadata and controls
1 lines (1 loc) · 57.5 KB
1
{"slots":{"0":{"name":"menudb","type":{"events":[],"methods":[]}},"1":{"name":"screen1","type":{"events":[],"methods":[]}},"2":{"name":"screen2","type":{"events":[],"methods":[]}},"3":{"name":"screen3","type":{"events":[],"methods":[]}},"4":{"name":"factoryDB","type":{"events":[],"methods":[]}},"5":{"name":"commsdb","type":{"events":[],"methods":[]}},"6":{"name":"slot7","type":{"events":[],"methods":[]}},"7":{"name":"slot8","type":{"events":[],"methods":[]}},"8":{"name":"slot9","type":{"events":[],"methods":[]}},"9":{"name":"slot10","type":{"events":[],"methods":[]}},"-1":{"name":"unit","type":{"events":[],"methods":[]}},"-2":{"name":"system","type":{"events":[],"methods":[]}},"-3":{"name":"library","type":{"events":[],"methods":[]}}},"handlers":[{"code":"-- this code goes in the screen.mousedown(*,*) trigger\n\nclickMouseX = x*1920\nclickMouseY = y*1120\nCheckClick(clickMouseX, clickMouseY)\n","filter":{"args":[{"variable":"*"},{"variable":"*"}],"signature":"mouseDown(x,y)","slotKey":"1"},"key":"0"},{"code":"response = commsdb.getStringValue(\"Res\")\n\nif not(response == nil) and not(response == \"\") then\n --system.print(\"Response:\"..response)\n response = string.gsub(response,[[\"in\":]], [[\"nd\":]])\n --system.print(\"Response:\"..response)\n --printResponse(response)\n if reqType == \"R\" then\n --system.print(\"Recipe response\")\n curRecipe = buildRecipe(response)\n reqType = \"C\"\n else\n --system.print(\"Ingred response\")\n curIngred = buildRecipe(response)\n unit.stopTimer(\"sendReq\")\n end\n commsdb.setStringValue(\"Res\",\"\")\n unit.stopTimer(\"sendReq\")\n DrawRecipeList()\nend\n\nif reqType == \"C\" then\n costStr = commsdb.getStringValue(\"oreCost\")\n schemaStr = commsdb.getStringValue(\"schemaCost\")\n --system.print(\"S=\"..schemaStr)\n talentStr = commsdb.getStringValue(\"talentCost\")\n --system.print(\"TL=\"..talentStr)\n if not(costStr == nil) and not(costStr == \"\") then\n --system.print(costStr)\n oreCost = json.decode(costStr)\n commsdb.setStringValue(\"oreCost\",\"\")\n end\n if not(schemaStr == nil) and not(schemaStr == \"\") then\n schemaCost = json.decode(schemaStr)\n commsdb.setStringValue(\"schemaCost\",\"\")\n end\n if not(talentStr == nil) and not(talentStr == \"\") then\n talentCost = json.decode(talentStr)\n commsdb.setStringValue(\"talentStr\",\"\")\n end\n if oreCost and schemaCost and talentCost then\n unit.stopTimer(\"sendReq\")\n end\n \n if s3Filter == \"Ore\" then\n DrawRecipeList()\n DrawCostScreen(oreCost)\n elseif s3Filter == \"Schema\" then\n DrawRecipeList()\n DrawSchemaScreen(schemaCost)\n elseif s3Filter == \"Talent\" then\n DrawRecipeList()\n DrawTalentScreen(talentCost)\n end\nend\n","filter":{"args":[{"value":"sendReq"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"1"},{"code":"\nstringMap={}\nstringMap[\"nm\"]=\"name\"\nstringMap[\"ti\"]=\"tier\"\nstringMap[\"tp\"]=\"type\"\nstringMap[\"ms\"]=\"mass\"\nstringMap[\"vo\"]=\"volume\"\nstringMap[\"op\"]=\"outputQuantity\"\nstringMap[\"tm\"]=\"time\"\nstringMap[\"bp\"]=\"byproducts\"\nstringMap[\"in\"]=\"industries\"\nstringMap[\"ip\"]=\"input\"\nstringMap[\"Pu\"]=\"Pure\"\nstringMap[\"Np\"]=\"Nanopack\"\nstringMap[\"Rc\"]=\"Recycler\"\nstringMap[\"O2P\"]=\"Oxygen Pure\"\nstringMap[\"HP\"]=\"Hydrogen Pure\"\nstringMap[\"Re\"]=\"Refiner\"\nstringMap[\"Ind\"]=\"Industry\"\nstringMap[\"ChI\"]=\"Chemical Industry\"\nstringMap[\"Cat\"]=\"Catalyst\"\nstringMap[\"FeP\"]=\"Iron Pure\"\nstringMap[\"AlP\"]=\"Aluminium Pure\"\nstringMap[\"CP\"]=\"Carbon Pure\"\nstringMap[\"SiP\"]=\"Silicon Pure\"\nstringMap[\"CaP\"]=\"Calcium Pure\"\nstringMap[\"ChP\"]=\"Chromium Pure\"\nstringMap[\"CuP\"]=\"Copper Pure\"\nstringMap[\"NaP\"]=\"Sodium Pure\"\nstringMap[\"LiP\"]=\"Lithium Pure\"\nstringMap[\"NiP\"]=\"Nickel Pure\"\nstringMap[\"AgP\"]=\"Silver Pure\"\nstringMap[\"SP\"]=\"Sulfur Pure\"\nstringMap[\"CoP\"]=\"Cobalt Pure\"\nstringMap[\"FlP\"]=\"Fluorine Pure\"\nstringMap[\"AuP\"]=\"Gold Pure\"\nstringMap[\"ScP\"]=\"Scandium Pure\"\nstringMap[\"MnP\"]=\"Manganese Pure\"\nstringMap[\"NbP\"]=\"Niobium Pure\"\nstringMap[\"TiP\"]=\"Titanium Pure\"\nstringMap[\"VaP\"]=\"Vanadium Pure\"\nstringMap[\"Aly\"]=\"Alloy\"\nstringMap[\"Prd\"]=\"Product\"\nstringMap[\"Bsc\"]=\"Basic\"\nstringMap[\"Unc\"]=\"Uncommon\"\nstringMap[\"Adv\"]=\"Advanced\"\nstringMap[\"Smt\"]=\"Smelter\"\nstringMap[\"Asl\"]=\"Assembly Line\"\nstringMap[\"CaCu\"]=\"Calcium Reinforced Copper\"\nstringMap[\"StSt\"]=\"Stainless Steel\"\nstringMap[\"PlyC\"]=\"Polycarbonate Plastic\"\nstringMap[\"GlF\"]=\"Glass Furnace\"\nstringMap[\"AdvG\"]=\"Advanced Glass\"\nstringMap[\"ReiG\"]=\"Reinforced Glass\"\nstringMap[\"PlyA\"]=\"Polycalcite Plastic\"\nstringMap[\"PlyS\"]=\"Polysulfide Plastic\"\nstringMap[\"Sil\"]=\"Silumin\"\nstringMap[\"Stl\"]=\"Steel\"\nstringMap[\"Com\"]=\"Component\"\nstringMap[\"IntP\"]=\"Intermediary Part\"\nstringMap[\"ElcI\"]=\"Electronics Ind\"\nstringMap[\"Con\"]=\"Connector\"\nstringMap[\"Fix\"]=\"Fixation\"\nstringMap[\"3D\"]=\"3D Printer\"\nstringMap[\"Adv\"]=\"Advanced\"\nstringMap[\"MetI\"]=\"Metalwork Ind\"\nstringMap[\"Dur\"]=\"Duralumin\"\nstringMap[\"CpxP\"]=\"Complex Part\"\nstringMap[\"AtMC\"]=\"Anti-Matter Capsule\"\nstringMap[\"Brn\"]=\"Burner\"\nstringMap[\"Elec\"]=\"Electronics\"\nstringMap[\"ExpM\"]=\"Explosive Module\"\nstringMap[\"Hyd\"]=\"Hydraulics\"\nstringMap[\"Inj\"]=\"Injector\"\nstringMap[\"Scw\"]=\"Screw\"\nstringMap[\"Mgnt\"]=\"Magnet\"\nstringMap[\"PwrS\"]=\"Power System\"\nstringMap[\"Proc\"]=\"Processor\"\nstringMap[\"QCor\"]=\"Quantum Core\"\nstringMap[\"SinC\"]=\"Singularity Container\"\nstringMap[\"SWar\"]=\"Solid Warhead\"\nstringMap[\"AGC\"]=\"Anti-Gravity Core\"\nstringMap[\"QAU\"]=\"Quantum Alignment Unit\"\nstringMap[\"AMCU\"]=\"Anti-Matter Core Unit\"\nstringMap[\"Ant\"]=\"Antenna\"\nstringMap[\"ChmC\"]=\"Chemical Container\"\nstringMap[\"CmbC\"]=\"Combustion Chamber\"\nstringMap[\"FunP\"]=\"Functional Part\"\nstringMap[\"ConS\"]=\"Control System\"\nstringMap[\"CorS\"]=\"Core System\"\nstringMap[\"ElcE\"]=\"Electric Engine\"\nstringMap[\"FirS\"]=\"Firing System\"\nstringMap[\"GasC\"]=\"Gas Cylinder\"\nstringMap[\"IonC\"]=\"Ionic Chamber\"\nstringMap[\"LasC\"]=\"Laser Chamber\"\nstringMap[\"MgtR\"]=\"Magnetic Rail\"\nstringMap[\"MecS\"]=\"Mechanical Sensor\"\nstringMap[\"MslS\"]=\"Missile Silo\"\nstringMap[\"MobP\"]=\"Mobile Panel\"\nstringMap[\"PwrC\"]=\"Power Converter\"\nstringMap[\"RobA\"]=\"Robotic Arm\"\nstringMap[\"Scn\"]=\"Screen\"\nstringMap[\"Cas\"]=\"Casing\"\nstringMap[\"ReiF\"]=\"Reinforced Frame\"\nstringMap[\"StrP\"]=\"Structural Part\"\nstringMap[\"StdF\"]=\"Standard Frame\"\nstringMap[\"Atmo\"]=\"Atmospheric\"\nstringMap[\"HnyR\"]=\"Honeycomb Rey\"\nstringMap[\"Ail\"]=\"Aileron\"\nstringMap[\"Hny\"]=\"Honeycomb\"\nstringMap[\"HnyP\"]=\"Pure Honeycomb\"\nstringMap[\"AtmoE\"]=\"Atmospheric Engine\"\nstringMap[\"SpcE\"]=\"Space Engine\"\nstringMap[\"Rar\"]=\"Rare\"\n\nstoreMap={}\nstoreMap[\"Bsc RobA S\"]=\"sbroboticarm\"\nstoreMap[\"Bsc RobA M\"]=\"mbroboticarm\"\nstoreMap[\"Bsc RobA L\"]=\"lbroboticarm\"\nstoreMap[\"Bsc MobP XS\"]=\"xsbmobilepanel\"\nstoreMap[\"Bsc MobP S\"]=\"sbmobilepanel\"\nstoreMap[\"Bsc MobP M\"]=\"mbmobilepanel\"\nstoreMap[\"Bsc MobP L\"]=\"lbmobilepanel\"\nstoreMap[\"Bsc StdF XS\"]=\"xsbstandard\"\nstoreMap[\"Bsc StdF S\"]=\"sbstandard\"\nstoreMap[\"Bsc StdF M\"]=\"mbstandard\"\nstoreMap[\"Bsc StdF L\"]=\"lbstandard\"\nstoreMap[\"Bsc ReiF\"]=\"xsbreinforced\"\nstoreMap[\"Bsc ReiF\"]=\"sbreinforced\"\nstoreMap[\"Bsc ReiF\"]=\"mbreinforced\"\nstoreMap[\"Bsc ReiF\"]=\"lbreinforced\"\nstoreMap[\"Bsc Com\"]=\"bcomponent\"\nstoreMap[\"Unc Com\"]=\"ucomponent\"\nstoreMap[\"Adv Com\"]=\"acomponent\"\nstoreMap[\"Bsc Con\"]=\"bconnector\"\nstoreMap[\"Unc Con\"]=\"uconnector\"\nstoreMap[\"Adv Con\"]=\"aconnector\"\nstoreMap[\"Bsc Elec\"]=\"belectronic\"\nstoreMap[\"Unc Elec\"]=\"uelectronic\"\nstoreMap[\"Adv Elec\"]=\"aelectronic\"\nstoreMap[\"Bsc Scw\"]=\"bscrew\"\nstoreMap[\"Unc Scw\"]=\"uscrew\"\nstoreMap[\"Adv Scw\"]=\"ascrew\"\nstoreMap[\"Bsc Pipe\"]=\"bpipe\"\nstoreMap[\"Unc Pipe\"]=\"upipe\"\nstoreMap[\"Adv Pipe\"]=\"apipe\"\nstoreMap[\"Bsc LED\"]=\"bled\"\nstoreMap[\"Unc LED\"]=\"uled\"\nstoreMap[\"Adv LED\"]=\"aled\"\nstoreMap[\"Bsc AMCU\"]=\"bantimatter\"\nstoreMap[\"Unc AMCU\"]=\"uantimatter\"\nstoreMap[\"Adv AMCU\"]=\"aantimatter\"\nstoreMap[\"Bsc QAU\"]=\"bquantumcore\"\nstoreMap[\"Umc QAU\"]=\"uquantumcore\"\nstoreMap[\"Adv QAU\"]=\"aquantumcore\"\nstoreMap[\"Bsc Mgnt\"]=\"bmagnet\"\nstoreMap[\"Unc Mgnt\"]=\"umagnet\"\nstoreMap[\"Adv Mgnt\"]=\"amagnet\"\nstoreMap[\"Bsc Hyd\"]=\"bhydraulic\"\nstoreMap[\"Unc Hyd\"]=\"uhydraulic\"\nstoreMap[\"Adv Hyd\"]=\"ahydraulic\"\nstoreMap[\"Bsc SinC\"]=\"bsingularity\"\nstoreMap[\"Unc SinC\"]=\"usingularity\"\nstoreMap[\"Adv SinC\"]=\"asingularity\"\nstoreMap[\"Bsc Brn\"]=\"bburner\"\nstoreMap[\"Unc Brn\"]=\"uburner\"\nstoreMap[\"Adv Brn\"]=\"aburner\"\nstoreMap[\"Bsc PwrS\"]=\"bpowerunit\"\nstoreMap[\"Unc PwrS\"]=\"upowerunit\"\nstoreMap[\"Adv PwrS\"]=\"apowerunit\"\nstoreMap[\"Bsc Inj\"]=\"binjector\"\nstoreMap[\"Unc Inj\"]=\"uinjector\"\nstoreMap[\"Adv Inj\"]=\"ainjector\"\nstoreMap[\"Bsc Fix\"]=\"bfixation\"\nstoreMap[\"Unc Fix\"]=\"ufixation\"\nstoreMap[\"Adv Inj\"]=\"afixation\"\nstoreMap[\"Bsc Proc\"]=\"bprocessor\"\nstoreMap[\"Unc Proc\"]=\"uprocessor\"\nstoreMap[\"Adv Proc\"]=\"aprocessor\"\nstoreMap[\"SiP\"]=\"silicon\"\nstoreMap[\"AlP\"]=\"aluminium\"\nstoreMap[\"FeP\"]=\"iron\"\nstoreMap[\"CP\"]=\"carbon\"\nstoreMap[\"NaP\"]=\"sodium\"\nstoreMap[\"ChP\"]=\"chromium\"\nstoreMap[\"CaP\"]=\"calcium\"\nstoreMap[\"CuP\"]=\"copper\"\nstoreMap[\"AgP\"]=\"silver\"\nstoreMap[\"NiP\"]=\"nickel\"\nstoreMap[\"LiP\"]=\"lithium\"\nstoreMap[\"SP\"]=\"sulfer\"\nstoreMap[\"AuP\"]=\"gold\"\nstoreMap[\"FlP\"]=\"fluorine\"\nstoreMap[\"ScP\"]=\"scandium\"\nstoreMap[\"CoP\"]=\"cobalt\"\nstoreMap[\"MnP\"]=\"manganese\"\nstoreMap[\"NbP\"]=\"niobium\"\nstoreMap[\"TiP\"]=\"titanium\"\nstoreMap[\"VaP\"]=\"vanadium\"\nstoreMap[\"Stl\"]=\"steel\"\nstoreMap[\"AL-FE\"]=\"alfe\"\nstoreMap[\"CaCu\"]=\"cacu\"\nstoreMap[\"StSt\"]=\"stainless\"\nstoreMap[\"Sil\"]=\"silumin\"\nstoreMap[\"Dur\"]=\"duramin\"\nstoreMap[\"PlyA\"]=\"polycalcite\"\nstoreMap[\"PlyC\"]=\"polycarbonate\"\nstoreMap[\"Glass\"]=\"glass\"\nstoreMap[\"AdvG\"]=\"aglass\"\nstoreMap[\"ReiG\"]=\"agliglass\"\nstoreMap[\"Ag-Cu Glass\"]=\"agcu\"\nstoreMap[\"PlyS\"]=\"polysulfide\"\nstoreMap[\"Inconel\"]=\"inconel\"\nstoreMap[\"AL-LI Glass\"]=\"alli\"\nstoreMap[\"Maraging\"]=\"maraging\"\nstoreMap[\"SC-AL\"]=\"scal\"\nstoreMap[\"Red Gold\"]=\"redgold\"\n\nfunction string:map(delimiter,maxLen)\n local result = { }\n local from = 1\n local delim_from, delim_to = string.find( self, delimiter, from )\n local mapped = \"\"\n if maxLen == nil then maxLen=0 end\n while delim_from do\n \n --table.insert( result, string.sub( self, from , delim_from-1 ) )\n subStr = string.sub( self, from , delim_from-1 )\n resultMap = stringMap[subStr]\n if resultMap == nil or resultMap == \"\" then\n resultMap = subStr\n end\n mapped = mapped..resultMap..\" \"\n from = delim_to + 1\n delim_from, delim_to = string.find( self, delimiter, from )\n end\n --table.insert( result, string.sub( self, from ) )\n subStr = string.sub( self, from )\n resultMap = stringMap[subStr]\n if resultMap == nil or resultMap == \"\" then\n resultMap = subStr\n end\n mapped = mapped..resultMap\n-- system.print(\"String: \"..mapped..\" len: \"..string.len(mapped)..\" max: \"..maxLen..\" self:\"..self)\n if maxLen > 0 and string.len(mapped) > maxLen then\n return self\n else\n return mapped\n end\nend","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"2"},{"code":"json = require('dkjson')\n\nversion = \"1_1_1\"\nrecipeIndexList={}\nelementIndexList={}\nconsumableIndexList={}\npartsIndexList={}\nuserFilterIndexList={}\ndisplayIndexList = {}\nlocal UpdateInterval = 1 --export: Interval in seconds between updates of the calculations and (if anything changed) redrawing to the screen(s). You need to restart the script after changing this value.\nlocal BackgroundColor = \"#1e1e1e\"\n--[[ Default colours are 34b1eb and 6e3de3]]\nlocal RecPanelColour = \"34b1eb\" --export Set the background color of the recipe Panel. YOU NEED TO LEAVE THE QUOTATION\nlocal IngPanelColour = \"6e3de3\" --export Set the background color of the Igredients panel. YOU NEED TO LEAVE THE QUOTATION\nlocal RecipeBackgroundColor = \"#\" ..RecPanelColour\nlocal IngredBackgroundColor = \"#\" ..IngPanelColour\nlocal clickAreas = {}\nlocal ingredList={}\nlocal lastRecipeSelected = \"\"\nlocal lastIngredSelected = \"\"\nlocal recipeLines=12\nlocal ingredLines=10\nlocal displayRecipeList={}\nlocal displayIngredList={}\nlocal CurrentIngredPage = 1\nlocal CurrentRecipePage = 1\nlocal indexCount=0\nuserFilter = \"\" --export\n\n-- default ore prices on the market\ncostBauxite = 24 --export\ncostCoal = 26 --export\ncostQuartz = 24 -- export\ncostHematite = 34 -- export\ncostChromite = 40 --export\ncostMalachite = 65 --export\ncostLimestone = 60 -- export\ncostNatron = 40 -- export\ncostPetalite = 120 --export\ncostGarnierite = 80 --export\ncostAcanthite = 140 -- export\ncostPyrite = 90 -- export\ncostCobaltite = 450 --export\ncostCryolite = 450 --export\ncostKolbeckite = 350 -- export\ncostGold = 350 -- export\ncostRhodonite = 400 --export\ncostColumbite = 1000--export\ncostVanadinite = 1000-- export\ncostIllmenite = 1000-- export\n\n\ncurRecipe = {}\ncurIngred = {}\nreqType = \"R\"\n \nfunction commerise(amount)\n local formatted = amount\n while true do \n formatted, k = string.gsub(formatted, \"^(-?%d+)(%d%d%d)\", '%1,%2')\n if (k==0) then\n break\n end\n end\n return formatted\nend\n\nfunction loadRecipeIndex() \n local temp=\"\"\n repeat\n temp = menudb.getStringValue(string.format(\"R%d\",#recipeIndexList + 1))\n if temp and not(temp==\"\") and not(temp==nil) then\n recipeIndexList[#recipeIndexList + 1] = temp\n else\n temp=\"\"\n end\n until (temp == \"\")\n system.print(\"Recipe Menu = \"..#recipeIndexList..\" entries\")\n collectgarbage(\"collect\")\nend\n\nfunction loadElementIndex() \n local temp=0 \n repeat\n temp = menudb.getIntValue(string.format(\"A%d\",#elementIndexList + 1))\n if temp and not(temp==0) and not(temp==nil) then\n elementIndexList[#elementIndexList + 1] = recipeIndexList[temp]\n else\n temp=0\n break\n end\n until (temp == 0)\n system.print(\"Element Menu = \"..#elementIndexList..\" entries\")\n collectgarbage(\"collect\")\nend\n\nfunction loadConsumableIndex() \n local temp=0\n repeat\n temp = menudb.getIntValue(string.format(\"C%d\",#consumableIndexList + 1))\n if temp and not(temp==0) and not(temp==nil) then\n consumableIndexList[#consumableIndexList + 1] = recipeIndexList[temp]\n else\n temp=0\n break\n end\n until (temp == 0)\n system.print(\"Consumable Menu = \"..#consumableIndexList..\" entries\")\n collectgarbage(\"collect\")\nend\n \nfunction loadPartsIndex() \n local temp=0\n repeat\n temp = menudb.getIntValue(string.format(\"P%d\",#partsIndexList + 1))\n if temp and not(temp==0) and not(temp==nil) then\n partsIndexList[#partsIndexList + 1] = recipeIndexList[temp]\n else\n temp=0\n break\n end\n until (temp == 0)\n system.print(\"Parts Menu = \"..#partsIndexList..\" entries\")\n collectgarbage(\"collect\")\nend\n\nfunction buildUserFilterList(filter)\n userFilterIndexList={}\n for i=1,#recipeIndexList do\n if string.match(string.lower(recipeIndexList[i]:map(\" \")),string.lower(filter)) then\n userFilterIndexList[#userFilterIndexList+1]=recipeIndexList[i]\n end\n end\nend\n\nfunction buildRecipe(recipeStr)\n return json.decode(recipeStr)\nend\n\nfunction reqRecipe(recipeName)\n reqType = \"R\"\n commsdb.setStringValue(\"Req\",recipeName)\n unit.setTimer(\"sendReq\",0.5)\nend\nfunction reqIngred(ingredName)\n reqType = \"I\"\n commsdb.setStringValue(\"Req\",ingredName)\n unit.setTimer(\"sendReq\",0.5)\nend\n\nfunction getStoreQty(ingredName)\n local ingred = storeMap[ingredName]\n if not(ingred==nil) and not(ingred==\"\") then\n --system.print(ingredName..\"=\"..ingred)\n return factoryDB.getStringValue(ingred .. \"Volume\")\n else\n return 0\n end\nend\n\nfunction getIndTierDesc(tier)\n if tier == 1 then return \"Basic\"\n elseif tier == 2 then return \"Uncommon\" \n elseif tier == 3 then return \"Advanced\"\n elseif tier == 4 then return \"Rare\"\n elseif tier == 5 then return \"Unique\"\n else\n return \"Unknown\"\n end\nend\n\nfunction DrawSVG(output,screen) screen.setSVG(output) end\n\nfunction AddClickArea(newEntry) table.insert(clickAreas, newEntry) end\n\nfunction RemoveFromClickAreas(candidate)\n for k, v in pairs(clickAreas) do\n if v.id == candidate then\n clickAreas[k] = nil\n break\n end\n end\nend\n\nfunction UpdateClickArea(candidate, newEntry)\n for k, v in pairs(clickAreas) do\n if v.id == candidate then\n clickAreas[k] = newEntry\n break\n end\n end\nend\n\nfunction DisableClickArea(candidate)\n for k, v in pairs(clickAreas) do\n if v.id == candidate then\n UpdateClickArea(candidate, {\n id = candidate,\n x1 = -1,\n x2 = -1,\n y1 = -1,\n y2 = -1\n })\n break\n end\n end\nend\n\nfunction InitiateClickAreas()\n clickAreas = {}\n \n AddClickArea({id = \"Filter1\", x1 = 50, x2 = 200, y1 = 900, y2 = 960})\n AddClickArea({id = \"Filter2\", x1 = 220, x2 = 370, y1 = 900, y2 = 960})\n AddClickArea({id = \"Filter3\", x1 = 390, x2 = 540, y1 = 900, y2 = 960})\n AddClickArea({id = \"Filter4\", x1 = 560, x2 = 710, y1 = 900, y2 = 960})\n AddClickArea({id = \"Filter5\", x1 = 730, x2 = 880, y1 = 900, y2 = 960})\n AddClickArea({id = \"Ore\", x1 = 450, x2 = 600, y1 = 980, y2 = 1040})\n AddClickArea({id = \"Schema\", x1 = 625, x2 = 775, y1 = 980, y2 = 1040})\n AddClickArea({id = \"Talent\", x1 = 800, x2 = 950, y1 = 980, y2 = 1040})\n AddClickArea({id = \"RecipePageDown\", x1 = -1, x2 = -1, y1 = -1, y2 = -1})\n AddClickArea({id = \"RecipePageUp\", x1 = -1, x2 = -1, y1 = -1, y2 = -1})\n AddClickArea({id = \"IngredPageDown\", x1 = -1, x2 = -1, y1 = -1, y2 = -1})\n AddClickArea({id = \"IngredPageUp\", x1 = -1, x2 = -1, y1 = -1, y2 = -1})\n \n for i = 1, recipeLines do\n AddClickArea({id = string.format(\"RList%d\",i), x1 = 90, x2 = 800, y1 = (150 + i * 55), y2 = (205 + i * 55)})\n end\n for i = 1, ingredLines do\n AddClickArea({id = string.format(\"IList%d\",i), x1 = 1030, x2 = 1800, y1 = (500 + i * 55), y2 = (555 + i * 55)})\n end\nend\n\nfunction FlushClickAreas() clickAreas = {} end\n\nfunction clearLocDispList()\n for i=1,pageLines do\n displayLocationList[i] = \"\"\n end\nend\n\nfunction CheckClick(x, y, HitTarget)\n HitTarget = HitTarget or \"\"\n --system.print(\"x=\"..x..\" y=\"..y)\n if HitTarget == \"\" then\n for k, v in pairs(clickAreas) do\n if v and x >= v.x1 and x <= v.x2 and y >= v.y1 and y <= v.y2 then\n HitTarget = v.id\n break\n end\n end\n end\n \n --system.print(\"Target Hit = \"..HitTarget)\n \n if HitTarget == \"RecipePageDown\" then\n CurrentRecipePage = CurrentRecipePage+1\n DrawRecipeList()\n elseif HitTarget == \"RecipePageUp\" then\n CurrentRecipePage = math.max(CurrentRecipePage-1,0)\n DrawRecipeList()\n elseif HitTarget == \"IngredPageDown\" then\n CurrentIngredPage = CurrentIngredPage+1\n DrawRecipeList()\n elseif HitTarget == \"IngredPageUp\" then\n CurrentIngredPage = math.max(CurrentIngredPage-1,0)\n DrawRecipeList()\n elseif HitTarget == \"Filter1\" then\n displayIndexList = recipeIndexList\n indexCount = #recipeIndexList\n CurrentRecipePage = 1\n displayFilter = \"All\"\n DrawRecipeList()\n elseif HitTarget == \"Filter2\" then\n displayIndexList = elementIndexList\n indexCount = #elementIndexList\n CurrentRecipePage = 1\n displayFilter = \"Element\"\n DrawRecipeList() \n elseif HitTarget == \"Filter3\" then\n displayIndexList = consumableIndexList\n indexCount = #consumableIndexList\n CurrentRecipePage = 1\n displayFilter = \"Consumable\"\n DrawRecipeList()\n elseif HitTarget == \"Filter4\" then\n displayIndexList = partsIndexList\n indexCount = #partsIndexList\n CurrentRecipePage = 1\n displayFilter = \"Parts\"\n DrawRecipeList() \n elseif HitTarget == \"Filter5\" and userFilter ~= \"\" then\n buildUserFilterList(userFilter)\n displayIndexList = userFilterIndexList\n indexCount = #userFilterIndexList\n CurrentRecipePage = 1\n displayFilter = \"userFilter\"\n DrawRecipeList() \n elseif HitTarget == \"Ore\" then\n s3Filter = \"Ore\"\n DrawRecipeList() \n DrawCostScreen(oreCost)\n elseif HitTarget == \"Schema\" then\n s3Filter = \"Schema\"\n DrawRecipeList() \n DrawSchemaScreen(schemaCost) \n elseif HitTarget == \"Talent\" then\n s3Filter = \"Talent\"\n DrawRecipeList()\n DrawTalentScreen(talentCost) \n else\n for i = 1,recipeLines do\n if HitTarget == string.format(\"RList%s\",i) then\n if displayRecipeList[i] ~= \"\" then\n lastRecipeSelected = displayRecipeList[i]\n currentIngred = {}\n lastIngredSelected=\"\"\n reqRecipe(lastRecipeSelected) \n DrawCostScreen(nil)\n DrawRecipeList()\n end\n end\n end\n for i = 1,ingredLines do\n if HitTarget == string.format(\"IList%s\",i) then\n if displayIngredList[i] ~= \"\" then\n lastIngredSelected = displayIngredList[i]\n reqIngred(lastIngredSelected)\n DrawRecipeList()\n end\n end\n end\n end\nend\n\n-----------------------------------------------\n-- Code for building screen content and displaying it\n-----------------------------------------------\n\nlocal svgBootstrap = [[<svg class=\"bootstrap\" viewBox=\"0 0 1920 1120\" width=\"1920\" height=\"1120\">\n <defs><style>\n .ftitle { font-size: 60px; text-anchor: start;fill: white; }\n .ftitlew { font-size: 60px; text-anchor: start;fill: red; }\n .ftitle2 { font-size: 60px; text-anchor: start;fill: #565656; }\n .ftopmiddle { font-size: 40px; text-anchor: middle;}\n .ftopend { font-size: 40px; text-anchor: end;}\n .fcapstart { font-size: 30px; text-anchor: start; fill: white;}\n .fcapstarthy { font-size: 30px; text-anchor: start; fill: yellow;}\n .fcapstarthr { font-size: 30px; text-anchor: start; fill: red;}\n .fcapmiddle { font-size: 30px; text-anchor: middle; fill: white;}\n .fcapend { font-size: 30px; text-anchor: end; fill: white;}\n .fmstart { font-size: 25px; text-anchor: start; fill: white;}\n .fmstartr { font-size: 25px; text-anchor: start; fill: red;}\n .fmschema { font-size: 25px; text-anchor: start; fill: #1e1e1e;}\n .fmdesc { font-size: 25px; text-anchor: start; fill: #1e1e1e;}\n .fmstartg { font-size: 25px; text-anchor: start; fill: #1e1e1e;}\n .fmstartp { font-size: 25px; text-anchor: start; fill:]]..RecipeBackgroundColor..[[;}\n .fmstartl { font-size: 25px; text-anchor: start; fill:]]..IngredBackgroundColor..[[;}\n .fmstarty { font-size: 25px; text-anchor: start; fill: #aaaa00;}\n .fmstartr { font-size: 25px; text-anchor: end; fill: #ff0000;}\n .fmmiddle { font-size: 30px; text-anchor: middle; fill: white;}\n .fmmiddleb { font-size: 30px; text-anchor: middle; fill: black;}\n .fmmiddler { font-size: 30px; text-anchor: middle; fill: red;}\n .fmend { font-size: 25px; text-anchor: end; fill: white;}\n .fmendg { font-size: 25px; text-anchor: end; fill: white;}\n .fmendy { font-size: 25px; text-anchor: end; fill: yellow;}\n .fmingreddesc { font-size: 25px; text-anchor: start; fill: #1e1e1e;}\n </style></defs>]]\n\nfunction DrawRecipeList()\n local healthyColor = \"#00aa00\"\n local brokenColor = \"#aa0000\"\n local damagedColor = \"#aaaa00\"\n local integrityColor = \"#aaaaaa\"\n local healthyTextColor = \"white\"\n local brokenTextColor = \"#ff4444\"\n local damagedTextColor = \"#ffff44\"\n local integrityTextColor = \"white\"\n \n\n local screenOutput = \"\"\n\n -- Draw Header\n screenOutput = screenOutput .. svgBootstrap\n \n -- Draw main background\n screenOutput = screenOutput ..\n [[<rect width=\"1920\" height=\"1120\" style=\"fill: #]]..BackgroundColor..[[\"/><g></g>]]\n screenOutput = screenOutput ..\n [[<text x=\"70\" y=\"120\" class=\"ftitle\">Crafting Recipes</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"1900\" y=\"120\" class=\"fmstartr\">Version: ]]..version..[[</text>]]\n screenOutput = screenOutput ..\n [[<rect x=\"70\" y=\"150\" rx=\"10\" ry=\"10\" width=\"900\" height=\"]] ..\n ((recipeLines + 1) * 55) ..\n [[\" style=\"fill:]].. RecipeBackgroundColor .. [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"80\" y=\"160\" rx=\"5\" ry=\"5\" width=\"890\" height=\"40\" style=\"fill:#33331a;\" />]] \n screenOutput = screenOutput ..\n [[<text x=\"90\" y=\"191\" class=\"fcapstart\">Recipes</text>]]\n \n\n local i = 0\n for j = 1 + (CurrentRecipePage - 1) * recipeLines, recipeLines +\n (CurrentRecipePage - 1) * recipeLines, 1 do\n i = i + 1\n if j < #displayIndexList and j>0 then\n if lastRecipeSelected == displayIndexList[j] then\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (180 + i * 55) .. [[\" class=\"fmstarty\">]] ..\n string.format(\"%30s\", displayIndexList[j]:map(\" \",30)) .. [[</text>]]\n else\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (180 + i * 55) .. [[\" class=\"fmstartg\">]] ..\n string.format(\"%30s\", displayIndexList[j]:map(\" \",30)) .. [[</text>]]\n end\n displayRecipeList[i]=displayIndexList[j]\n else\n displayRecipeList[i]=\"\"\n end\n end\n \n if indexCount > recipeLines then\n screenOutput = screenOutput ..\n [[<text x=\"70\" y=\"1000\" class=\"fmstartp\">Page ]] ..\n CurrentRecipePage .. \" of \" ..\n math.ceil(indexCount / recipeLines) ..\n [[</text>]]\n\n if CurrentRecipePage < math.ceil(indexCount / recipeLines) then\n screenOutput = screenOutput .. [[<svg x=\"70\" y=\"1050\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:]]..RecipeBackgroundColor..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n UpdateClickArea(\"RecipePageDown\", {\n id = \"RecipePageDown\",\n x1 = 70,\n x2 = 270,\n y1 = 1050,\n y2 = 1105\n })\n else\n DisableClickArea(\"RecipePageDown\")\n end\n\n if indexCount > 1 and CurrentRecipePage > 1 then\n screenOutput = screenOutput .. [[<svg x=\"280\" y=\"1050\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:]]..RecipeBackgroundColor..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n UpdateClickArea(\"RecipePageUp\", {\n id = \"RecipePageUp\",\n x1 = 280,\n x2 = 480,\n y1 = 1050,\n y2 = 1105\n })\n else\n DisableClickArea(\"RecipePageUp\")\n end\n end\n screenOutput = screenOutput ..\n [[<rect x=\"1000\" y=\"150\" rx=\"10\" ry=\"10\" width=\"900\" height=\"]] ..\n ((5 + 1) * 55) ..\n [[\" style=\"fill:]]..\n RecipeBackgroundColor..\n [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"1010\" y=\"160\" rx=\"5\" ry=\"5\" width=\"890\" height=\"40\" style=\"fill:#33331a;\" />]] \n screenOutput = screenOutput ..\n [[<text x=\"1020\" y=\"191\" class=\"fcapstart\">]].. lastRecipeSelected:map(\" \",30) ..[[ Details</text>]]\n if curRecipe.nm then\n --system.print(\"Cur Recipe: \"..curRecipe.nm)\n ingredList={}\n ingredCList={}\n for i, v in pairs(curRecipe.ip) do\n ingredList[#ingredList+1] = i\n ingredCList[#ingredCList+1] = v\n end\n --system.print(\"Tier: \"..curRecipe.tp)\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (180 + 2 * 35) .. [[\" class=\"fmingreddesc\">Time: ]] ..\n string.format(\"%.1f mins\", (curRecipe.tm/60)) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1500\" y=\"]] ..\n (180 + 2 * 35) .. [[\" class=\"fmingreddesc\">Tier: ]] ..\n string.format(\"%d\", (curRecipe.ti)) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (180 + 3 * 35) .. [[\" class=\"fmingreddesc\">Type: ]] ..\n string.format(\"%s\", curRecipe.tp:map(\" \")) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (180 + 4 * 35) .. [[\" class=\"fmingreddesc\">Mass: ]] ..\n string.format(\"%.2f\", curRecipe.ms) .. [[ kg</text>]]\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (180 + 5 * 35) .. [[\" class=\"fmingreddesc\">Volume: ]] ..\n string.format(\"%.2f\", curRecipe.vo) .. [[ l</text>]]\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (180 + 6 * 35) .. [[\" class=\"fmingreddesc\">Volume: ]] ..\n string.format(\"%.2f\", curRecipe.op) .. [[ l</text>]]\n\n\n i=1\n industries=\"\"\n indTier=getIndTierDesc(curRecipe.ti)\n while curRecipe.nd[i] and not(curRecipe.nd[i]==\"\") do\n if industries == \"\" then\n industries = indTier .. \" \" .. curRecipe.nd[i]:map(\" \",25)\n else\n industries = industries..\", \"..indTier .. \" \" .. curRecipe.nd[i]:map(\" \",25)\n end\n i=i+1\n end\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (180 + 7 * 35) .. [[\" class=\"fmingreddesc\">Industry: ]] ..\n string.format(\"%s\", industries) .. [[</text>]]\n end \n screenOutput = screenOutput ..\n [[<rect x=\"1000\" y=\"500\" rx=\"10\" ry=\"10\" width=\"900\" height=\"]] ..\n ((ingredLines + 1) * 55) ..\n [[\" style=\"fill:]]..\n IngredBackgroundColor..\n [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"1010\" y=\"510\" rx=\"5\" ry=\"5\" width=\"890\" height=\"40\" style=\"fill:#33331a;\" />]] \n screenOutput = screenOutput ..\n [[<text x=\"1020\" y=\"540\" class=\"fcapstart\">Ingredients</text>]]\n screenOutput = screenOutput .. [[<text x=\"1740\" y=\"540\" class=\"fcapend\">Required</text>]]\n screenOutput = screenOutput .. [[<text x=\"1880\" y=\"540\" class=\"fcapend\">Stores</text>]]\n\n\n if not(ingredList == nil) and not(ingredList == \"\") then\n --system.print(\"Ingred: \")\n local i = 0\n for j = 1 + (CurrentIngredPage - 1) * ingredLines, ingredLines +\n (CurrentIngredPage - 1) * ingredLines, 1 do\n --system.print(\"IngredList: \"..ingredList[j])\n i = i + 1\n if j <= #ingredList and j>0 then\n --system.print(\"...\"..ingredList[j])\n if lastIngredSelected == ingredList[j] then\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (530 + i * 55) .. [[\" class=\"fmstarty\">]] ..\n string.format(\"%30s\", ingredList[j]:map(\" \",25)) .. [[</text>]]\n else\n screenOutput = screenOutput .. [[<text x=\"1030\" y=\"]] ..\n (530 + i * 55) .. [[\" class=\"fmstartg\">]] ..\n string.format(\"%30s\", ingredList[j]:map(\" \",25)) .. [[</text>]]\n end\n displayIngredList[i]=ingredList[j]\n screenOutput = screenOutput .. [[<text x=\"1740\" y=\"]] ..\n (530 + i * 55) .. [[\" class=\"fcapend\">]] ..\n string.format(\"%s\", commerise(ingredCList[j])) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1880\" y=\"]] ..\n (530 + i * 55) .. [[\" class=\"fcapend\">]] ..\n string.format(\"%s\", commerise(getStoreQty(ingredList[j]))) .. [[</text>]]\n\n else\n displayIngredList[i]=\"\"\n end\n end\n if #ingredList > ingredLines then\n screenOutput = screenOutput ..\n [[<text x=\"1020\" y=\"1000\" class=\"fmstartl\">Page ]] ..\n CurrentIngredPage .. \" of \" ..\n math.ceil(#ingredList / ingredLines) ..\n [[</text>]]\n\n if CurrentIngredPage < math.ceil(#ingredList / ingredLines) then\n screenOutput = screenOutput .. [[<svg x=\"1070\" y=\"1050\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:]]..IngredBackgroundColor..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M52.48,35.23,69.6,19.4a3.23,3.23,0,0,0-2.19-5.6H32.59a3.23,3.23,0,0,0-2.19,5.6L47.52,35.23A3.66,3.66,0,0,0,52.48,35.23Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n UpdateClickArea(\"IngredPageDown\", {\n id = \"IngredPageDown\",\n x1 = 1070,\n x2 = 1270,\n y1 = 1050,\n y2 = 1105\n })\n else\n DisableClickArea(\"IngredPageDown\")\n end\n\n if #ingredList > 1 and CurrentIngredPage > 1 then\n screenOutput = screenOutput .. [[<svg x=\"1280\" y=\"1050\">\n <rect x=\"0\" y=\"0\" rx=\"10\" ry=\"10\" width=\"200\" height=\"50\" style=\"fill:]]..IngredBackgroundColor..[[;\" />\n <svg x=\"80\" y=\"15\"><path d=\"M47.52,14.77,30.4,30.6a3.23,3.23,0,0,0,2.19,5.6H67.41a3.23,3.23,0,0,0,2.19-5.6L52.48,14.77A3.66,3.66,0,0,0,47.52,14.77Z\" transform=\"translate(-29.36 -13.8)\"/></svg>\n </svg>]]\n UpdateClickArea(\"IngredPageUp\", {\n id = \"IngredPageUp\",\n x1 = 1280,\n x2 = 1480,\n y1 = 1050,\n y2 = 1105\n })\n else\n DisableClickArea(\"IngredPageUp\")\n end\n end\n end\n\n screenOutput = screenOutput ..[[<rect x=\"50\" y=\"900\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if displayFilter == \"All\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:#ff6666;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"125\" y=\"940\" class=\"fmmiddle\">All</text>]]\n \n screenOutput = screenOutput ..[[<rect x=\"220\" y=\"900\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if displayFilter == \"Element\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:#ff6666;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"295\" y=\"940\" class=\"fmmiddle\">Elems</text>]]\n\n screenOutput = screenOutput ..[[<rect x=\"390\" y=\"900\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if displayFilter == \"Consumable\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:#ff6666;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"465\" y=\"940\" class=\"fmmiddle\">Cons</text>]]\n\n screenOutput = screenOutput ..[[<rect x=\"560\" y=\"900\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if displayFilter == \"Parts\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:#ff6666;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"635\" y=\"940\" class=\"fmmiddle\">Parts</text>]]\n\n screenOutput = screenOutput ..[[<rect x=\"730\" y=\"900\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if displayFilter == \"userFilter\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:#ff6666;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"805\" y=\"940\" class=\"fmmiddle\">]]\n ..string.sub(userFilter,1,6)..[[</text>]]\n\n\n -- Screen 3 options\n \n screenOutput = screenOutput ..[[<rect x=\"450\" y=\"980\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if s3Filter == \"Ore\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:blue;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"525\" y=\"1020\" class=\"fmmiddle\">Ore</text>]]\n\n screenOutput = screenOutput ..[[<rect x=\"625\" y=\"980\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if s3Filter == \"Schema\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:blue;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"700\" y=\"1020\" class=\"fmmiddle\">Schema</text>]]\n\n screenOutput = screenOutput ..[[<rect x=\"800\" y=\"980\" rx=\"10\" ry=\"10\" width=\"150\" height=\"60\" ]]\n if s3Filter == \"Talent\" then\n screenOutput = screenOutput .. [[style=\"fill:green;\" />]]\n else\n screenOutput = screenOutput .. [[style=\"fill:blue;\" />]]\n end\n screenOutput = screenOutput .. [[<text x=\"875\" y=\"1020\" class=\"fmmiddle\">Talent</text>]]\n\n\n screenOutput = screenOutput .. [[</svg>]]\n\n DrawSVG(screenOutput,screen1)\n DrawIngredList()\n --DrawCostScreen(nil)\nend\n\nfunction DrawIngredList()\n local screenOutput = \"\"\n\n -- Draw Header\n screenOutput = screenOutput .. svgBootstrap\n \n -- Draw main background\n screenOutput = screenOutput ..\n [[<rect width=\"1920\" height=\"1120\" style=\"fill: #]]..BackgroundColor..[[\"/><g></g>]]\n screenOutput = screenOutput ..\n [[<text x=\"70\" y=\"120\" class=\"ftitle\">Recipe Ingredients</text>]]\n screenOutput = screenOutput ..\n [[<rect x=\"70\" y=\"150\" rx=\"10\" ry=\"10\" width=\"1500\" height=\"]] ..\n ((17) * 55) ..\n [[\" style=\"fill:]].. IngredBackgroundColor .. [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"80\" y=\"160\" rx=\"5\" ry=\"5\" width=\"1480\" height=\"40\" style=\"fill:#33331a;\" />]] \n if curIngred.nm then\n screenOutput = screenOutput ..\n [[<text x=\"90\" y=\"191\" class=\"fcapstart\">]]..curIngred.nm:map(\" \")..[[ Ingredient Details</text>]]\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (180 + 1 * 55) .. [[\" class=\"fmstartg\">Time: ]] ..\n string.format(\"%.1f mins\", (curIngred.tm/60)) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (180 + 2 * 55) .. [[\" class=\"fmstartg\">Type: ]] ..\n string.format(\"%s\", curIngred.tp:map(\" \")) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (180 + 3 * 55) .. [[\" class=\"fmstartg\">Mass: ]] ..\n string.format(\"%.2f\", curIngred.ms) .. [[ kg</text>]]\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (180 + 4 * 55) .. [[\" class=\"fmstartg\">Volume: ]] ..\n string.format(\"%.2f\", curIngred.vo) .. [[ l</text>]]\n local i=1\n local industries=\"\"\n indTier=getIndTierDesc(curIngred.ti)\n while curIngred.nd[i] and not(curIngred.nd[i]==\"\") do\n if industries == \"\" then\n industries = indTier..\" \"..curIngred.nd[i]:map(\" \",25)\n else\n industries = industries..\", \"..indTier..\" \"..curIngred.nd[i]:map(\" \",25)\n end\n i=i+1\n end\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (180 + 5 * 55) .. [[\" class=\"fmstartg\">Industry: ]] ..\n string.format(\"%s\", industries) .. [[</text>]]\n \n local i=0\n screenOutput = screenOutput ..\n [[<rect x=\"70\" y=\"490\" rx=\"10\" ry=\"10\" width=\"1500\" height=\"]] ..\n ((17) * 55) ..\n [[\" style=\"fill:]].. IngredBackgroundColor .. [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"80\" y=\"500\" rx=\"5\" ry=\"5\" width=\"1480\" height=\"40\" style=\"fill:#33331a;\" />]] \n\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (530) .. [[\" class=\"fcapstart\">Ingredient</text>]]\n screenOutput = screenOutput .. [[<text x=\"1040\" y=\"]] ..\n (530) .. [[\" class=\"fcapend\">Required</text>]]\n screenOutput = screenOutput .. [[<text x=\"1280\" y=\"]] ..\n (530) .. [[\" class=\"fcapend\">In Stores</text>]]\n for k,v in pairs(curIngred.ip) do \n i=i+1\n screenOutput = screenOutput .. [[<text x=\"90\" y=\"]] ..\n (530 + i * 55) .. [[\" class=\"fmstartg\">]] ..\n k:map(\" \",25) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1040\" y=\"]] ..\n (530 + i * 55) .. [[\" class=\"fcapend\">]] ..\n string.format(\"%s\", commerise(v)) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1280\" y=\"]] ..\n (530 + i * 55) .. [[\" class=\"fcapend\">]] ..\n string.format(\"%s\", commerise(getStoreQty(k))) .. [[</text>]]\n end\n end \n screenOutput = screenOutput .. [[</svg>]]\n DrawSVG(screenOutput,screen2)\nend\n\nfunction DrawCostScreen(oreCost) \n\n local screenOutput = \"\"\n\n -- Draw Header\n screenOutput = screenOutput .. svgBootstrap\n \n -- Draw main background\n screenOutput = screenOutput ..\n [[<rect width=\"1920\" height=\"1120\" style=\"fill: #]]..BackgroundColor..[[\"/><g></g>]]\n screenOutput = screenOutput ..\n [[<text x=\"70\" y=\"120\" class=\"ftitle\">Recipe Unit Cost</text>]]\n screenOutput = screenOutput ..\n [[<rect x=\"70\" y=\"150\" rx=\"10\" ry=\"10\" width=\"1800\" height=\"]] ..\n ((17) * 55) ..\n [[\" style=\"fill:]].. RecipeBackgroundColor .. [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"80\" y=\"160\" rx=\"5\" ry=\"5\" width=\"1800\" height=\"40\" style=\"fill:#33331a;\" />]] \n screenOutput = screenOutput ..\n [[<text x=\"100\" y=\"191\" class=\"fcapstart\">Ores</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"550\" y=\"191\" class=\"fcapend\">quantity (l)</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"800\" y=\"191\" class=\"fcapend\">cost (q)</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"909\" y=\"191\" class=\"fcapstart\">Ores</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"1450\" y=\"191\" class=\"fcapend\">quantity (l)</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"1700\" y=\"191\" class=\"fcapend\">cost (q)</text>]]\n\n if oreCost and not(oreCost==\"\") then\n local totalCost = 0\n local oreList={}\n local priceList={}\n if oreCost.amount[\"Bauxite\"] > 0 then \n oreList[#oreList+1]=\"Bauxite\"\n priceList[#priceList+1]=costBauxite\n end\n if oreCost.amount[\"Quartz\"] > 0 then \n oreList[#oreList+1]=\"Quartz\" \n priceList[#priceList+1]=costQuartz\n end\n if oreCost.amount[\"Hematite\"] > 0 then \n oreList[#oreList+1]=\"Hematite\" \n priceList[#priceList+1]=costHematite\n end\n if oreCost.amount[\"Coal\"] > 0 then \n oreList[#oreList+1]=\"Coal\" \n priceList[#priceList+1]=costCoal\n end\n \n if oreCost.amount[\"Chromite\"] > 0 then \n oreList[#oreList+1]=\"Chromite\" \n priceList[#priceList+1]=costChromite\n end\n if oreCost.amount[\"Malachite\"] > 0 then \n oreList[#oreList+1]=\"Malachite\" \n priceList[#priceList+1]=costMalachite\n end\n if oreCost.amount[\"Limestone\"] > 0 then \n oreList[#oreList+1]=\"Limestone\" \n priceList[#priceList+1]=costLimestone\n end\n if oreCost.amount[\"Natron\"] > 0 then \n oreList[#oreList+1]=\"Natron\" \n priceList[#priceList+1]=costNatron\n end\n \n if oreCost.amount[\"Petalite\"] > 0 then \n oreList[#oreList+1]=\"Petalite\" \n priceList[#priceList+1]=costPetalite\n end\n if oreCost.amount[\"Garnierite\"] > 0 then \n oreList[#oreList+1]=\"Garnierite\" \n priceList[#priceList+1]=costGarnierite\n end\n if oreCost.amount[\"Acanthite\"] > 0 then \n oreList[#oreList+1]=\"Acanthite\" \n priceList[#priceList+1]=costAcanthite\n end\n if oreCost.amount[\"Pyrite\"] > 0 then \n oreList[#oreList+1]=\"Pyrite\" \n priceList[#priceList+1]=costPyrite\n end\n \n if oreCost.amount[\"Cobaltite\"] > 0 then \n oreList[#oreList+1]=\"Cobaltite\" \n priceList[#priceList+1]=costCobaltite\n end\n if oreCost.amount[\"Cryolite\"] > 0 then \n oreList[#oreList+1]=\"Cryolite\" \n priceList[#priceList+1]=costCryolite\n end\n if oreCost.amount[\"Kolbeckite\"] > 0 then \n oreList[#oreList+1]=\"Kolbeckite\" \n priceList[#priceList+1]=costKolbeckite\n end\n if oreCost.amount[\"Gold Nuggets\"] > 0 then \n oreList[#oreList+1]=\"Gold Nuggets\" \n priceList[#priceList+1]=costGold\n end\n\n if oreCost.amount[\"Rhodonite\"] > 0 then \n oreList[#oreList+1]=\"Rhodonite\" \n priceList[#priceList+1]=costRhodonite\n end\n if oreCost.amount[\"Columbite\"] > 0 then \n oreList[#oreList+1]=\"Columbite\" \n priceList[#priceList+1]=costColumbite\n end\n if oreCost.amount[\"Illmenite\"] > 0 then \n oreList[#oreList+1]=\"Illmenite\" \n priceList[#priceList+1]=costIllmenite\n end\n if oreCost.amount[\"Vanadinite\"] > 0 then \n oreList[#oreList+1]=\"Vanadinite\" \n priceList[#priceList+1]=costVanadinite\n end\n\n local ocost=0\n for i=1,#oreList,2 do\n ocost = oreCost.amount[oreList[i]]*priceList[i]\n totalCost = totalCost + ocost\n screenOutput = screenOutput .. [[<text x=\"100\" y=\"]] ..\n (235 + i/2 * 55) .. [[\" class=\"fmschema\">]] .. oreList[i].. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"550\" y=\"]] ..\n (235 + i/2 * 55) .. [[\" class=\"fmendg\">]] .. commerise(string.format(\"%.2f\", oreCost.amount[oreList[i]])) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"800\" y=\"]] ..\n (235 + i/2 * 55) .. [[\" class=\"fmendy\">]] .. commerise(string.format(\"%.0f\", ocost)) .. [[</text>]]\n\n if i+1 <= #oreList and not(oreList[i+1] == nil) then\n ocost = oreCost.amount[oreList[i+1]]*priceList[i+1]\n totalCost = totalCost + ocost\n screenOutput = screenOutput .. [[<text x=\"900\" y=\"]] ..\n (235 + i/2 * 55) .. [[\" class=\"fmschema\">]] .. oreList[i+1].. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1400\" y=\"]] ..\n (235 + i/2 * 55) .. [[\" class=\"fmendg\">]] .. commerise(string.format(\"%.2f\", oreCost.amount[oreList[i+1]])) .. [[</text>]]\n screenOutput = screenOutput .. [[<text x=\"1700\" y=\"]] ..\n (235 + i/2 * 55) .. [[\" class=\"fmendy\">]] .. commerise(string.format(\"%.0f\", ocost)) .. [[</text>]]\n end\n end\n screenOutput = screenOutput .. [[<text x=\"400\" y=\"]] ..\n (180 + 16 * 55) .. [[\" class=\"ftitle\">TOTAL COST: ]] ..\n commerise(string.format(\"%.0f\", totalCost)) .. [[</text>]]\n\n end \n screenOutput = screenOutput .. [[</svg>]]\n DrawSVG(screenOutput,screen3)\nend\n\nfunction DrawSchemaScreen(schemaList)\n \n if schemaList then\n table.sort(schemaList)\n \n local screenOutput = \"\"\n\n -- Draw Header\n screenOutput = screenOutput .. svgBootstrap\n \n -- Draw main background\n screenOutput = screenOutput ..\n [[<rect width=\"1920\" height=\"1120\" style=\"fill: #]]..BackgroundColor..[[\"/><g></g>]]\n screenOutput = screenOutput ..\n [[<text x=\"70\" y=\"120\" class=\"ftitle\">Schema List</text>]]\n screenOutput = screenOutput ..\n [[<rect x=\"70\" y=\"150\" rx=\"10\" ry=\"10\" width=\"1800\" height=\"]] ..\n ((17) * 55) ..\n [[\" style=\"fill:]].. RecipeBackgroundColor .. [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"80\" y=\"160\" rx=\"5\" ry=\"5\" width=\"1800\" height=\"40\" style=\"fill:#33331a;\" />]] \n screenOutput = screenOutput ..\n [[<text x=\"100\" y=\"191\" class=\"fcapstart\">Schema</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"909\" y=\"191\" class=\"fcapstart\">Schema</text>]]\n for i=1,#schemaList,2 do\n screenOutput = screenOutput .. [[<text x=\"100\" y=\"]] ..\n (235 + i/2 * 35) .. [[\" class=\"fmschema\">]] .. schemaList[i]:map(\" \") .. [[</text>]]\n if i+1 <= #schemaList and not(schemaList[i+1] == nil) then\n screenOutput = screenOutput .. [[<text x=\"900\" y=\"]] ..\n (235 + i/2 * 35) .. [[\" class=\"fmschema\">]] .. schemaList[i+1]:map(\" \") .. [[</text>]]\n end\n end\n screenOutput = screenOutput .. [[</svg>]]\n DrawSVG(screenOutput,screen3)\n end\nend\n\nfunction DrawTalentScreen(talentList)\n \n local screenOutput = \"\"\n if talentList then\n -- Draw Header\n screenOutput = screenOutput .. svgBootstrap\n \n -- Draw main background\n screenOutput = screenOutput ..\n [[<rect width=\"1920\" height=\"1120\" style=\"fill: #]]..BackgroundColor..[[\"/><g></g>]]\n screenOutput = screenOutput ..\n [[<text x=\"70\" y=\"120\" class=\"ftitle\">Talent Proficiency List</text>]]\n screenOutput = screenOutput ..\n [[<rect x=\"70\" y=\"150\" rx=\"10\" ry=\"10\" width=\"1800\" height=\"]] ..\n ((17) * 55) ..\n [[\" style=\"fill:]].. RecipeBackgroundColor .. [[;stroke:#ffff00;stroke-width:3;\" />]]\n screenOutput = screenOutput ..\n [[<rect x=\"80\" y=\"160\" rx=\"5\" ry=\"5\" width=\"1800\" height=\"40\" style=\"fill:#33331a;\" />]] \n screenOutput = screenOutput ..\n [[<text x=\"100\" y=\"191\" class=\"fcapstart\">Talent</text>]]\n screenOutput = screenOutput ..\n [[<text x=\"700\" y=\"191\" class=\"fcapstart\">Proficiency Level</text>]]\n for i=1,#talentList do\n screenOutput = screenOutput .. [[<text x=\"100\" y=\"]] ..\n (235 + i * 55) .. [[\" class=\"fmschema\">]]..talentList[i].ind:map(\" \")..[[</text>]]\n screenOutput = screenOutput .. [[<text x=\"700\" y=\"]] ..\n (235 + i * 55) .. [[\" class=\"fmschema\">]] ..talentList[i].lev .. [[</text>]]\n end\n screenOutput = screenOutput .. [[</svg>]]\n DrawSVG(screenOutput,screen3)\n end\nend\n\n-----------------------------------------------\n-- Execute\n-----------------------------------------------\n\nstartupCycle =0\nunit.setTimer(\"startup\",1)\nunit.hide()\n","filter":{"args":[],"signature":"start()","slotKey":"-1"},"key":"3"},{"code":"startupCycle = startupCycle + 1\n\nif startupCycle == 1 then\n loadRecipeIndex()\nelseif startupCycle == 2 then\n loadElementIndex()\nelseif startupCycle == 3 then\n loadConsumableIndex()\nelseif startupCycle == 4 then\n loadPartsIndex()\nelse\n displayIndexList = recipeIndexList\n unit.stopTimer(\"startup\")\n table.sort(recipeIndexList)\n table.sort(elementIndexList)\n table.sort(consumableIndexList)\n table.sort(partsIndexList)\n displayFilter = \"All\"\n s3Filter = \"Ore\"\n indexCount = #displayIndexList\n system.print(\"Startup Complete\")\n InitiateClickAreas()\n CurrentRecipePage=1\n DrawRecipeList()\n CheckClick(0, 0, \"Filter1\")\nend","filter":{"args":[{"value":"startup"}],"signature":"tick(timerId)","slotKey":"-1"},"key":"4"},{"code":"if string.sub(text,1,6) == \"filter\" then\n userFilter = string.sub(text,8,string.len(text))\n CheckClick(0, 0,\"Filter5\")\nend","filter":{"args":[{"variable":"*"}],"signature":"inputText(text)","slotKey":"-2"},"key":"5"}],"methods":[],"events":[]}