-- fleeties.lua -- Fleeties g_menu = {}; -- Menu Handlers dofile("Scripts/Collective_Command.lua"); dofile("Scripts/Titan_Command.lua"); g_arena = nil; function Arena_OnCreate(arena) g_arena = arena; end function Arena_OnGameStart() g_arena:team_get("Collective Navy"):inventory_add("Build Point", 2500); g_arena:team_get("Titan Navy"):inventory_add("Build Point", 2500); end function Vehicle_OnProduce(veh, pl, menu) if (g_menu[veh.type] == nil) then return false; end if (g_menu[veh.type][menu] == nil) then return false; end return (g_menu[veh.type][menu])(veh, pl, menu); end -- Collective_Command.lua -- Refine Minerals function CCommand_OnRefineMinerals(veh, pl, menu) local count = pl:inventory_find("Eljaycium Ore"); if (count == 0) then return true; end pl:inventory_modify("Eljaycium Ore", -count); pl:team_get():inventory_modify("Build Point", count * 50); pl:score_modify(count * 10); return true; end -- Purchase Defense Drone (50 BP) function CCommand_OnPurchaseDefenseDrone(veh, pl, menu) if (pl:score_get() < 10) then pl:status("You do not have enough score to purchase a Collective Defense Drone"); return true; end if (pl:team_get():inventory_find("Build Point") < 50) then pl:status("Your team does not have enough Build Points to purchase a Collective Defense Drone"); return true; end pl:score_modify(-10); pl:team_get():inventory_modify("Build Point", -50); pl:inventory_modify("Collective Defense Drone", 1); return true; end -- Return Defense Drone function CCommand_OnReturnDefenseDrone(veh, pl, menu) if (pl:inventory_find("Collective Defense Drone") < 1) then pl:status("You do not have a Collective Defense Drone"); return true; end pl:score_modify(10); pl:team_get():inventory_modify("Build Point", 50); pl:inventory_remove("Collective Defense Drone", 1); return true; end -- Purchase Collective GUNSAT (55 BP) function CCommand_OnPurchaseGUNSAT(veh, pl, menu) if (pl:score_get() < 11) then pl:status("You do not have enough score to purchase a Collective GUNSAT"); return true; end if (pl:team_get():inventory_find("Build Point") < 55) then pl:status("Your team does not have enough Build Points to purchase a Collective GUNSAT"); return true; end pl:score_modify(-11); pl:team_get():inventory_modify("Build Point", -55); pl:inventory_modify("Collective GUNSAT", 1); return true; end -- Return GUNSAT function CCommand_OnReturnGUNSAT(veh, pl, menu) if (pl:inventory_find("Collective GUNSAT") < 1) then pl:status("You do not have a Collective GUNSAT"); return true; end pl:score_modify(11); pl:team_get():inventory_modify("Build Point", 55); pl:inventory_modify("Collective GUNSAT", -1); return true; end -- Purchase SupplySat (500 BP) function CCommand_OnPurchaseSupplySat(veh, pl, menu) if (pl:score_get() < 100) then pl:status("You do not have enough score to purchase a Collective SupplySat"); return true; end if (pl:team_get():inventory_find("Build Point") < 500) then pl:status("Your team does not have enough Build Points to purchase a Collective SupplySat"); return true; end pl:score_modify(-100); pl:team_get():inventory_modify("Build Point", -500); pl:inventory_modify("Collective SupplySat", 1); pl:team_get():message(pl.m_name .. " purchased a SupplySat"); return true; end -- Return SupplySat function CCommand_OnReturnSupplySat(veh, pl, menu) if (pl:inventory_find("Collective SupplySat") < 1) then pl:status("You do not have a Collective SupplySat"); return true; end pl:score_modify(100); pl:team_get():inventory_modify("Build Point", 500); pl:inventory_modify("Collective SupplySat", -1); pl:team_get():message(pl.m_name .. " returned a SupplySat"); return true; end -- Load 5 WarShrike Missiles function CCommand_OnLoad5WarShrikeMissiles(veh, pl, menu) -- Let server handle it return false; end -- Collective Command Handlers g_menu[401] = {}; g_menu[401][1] = CCommand_OnRefineMinerals; g_menu[401][2] = CCommand_OnPurchaseDefenseDrone; g_menu[401][3] = CCommand_OnReturnDefenseDrone; g_menu[401][4] = CCommand_OnPurchaseGUNSAT; g_menu[401][5] = CCommand_OnReturnGUNSAT; g_menu[401][6] = CCommand_OnPurchaseSupplySat; g_menu[401][7] = CCommand_OnReturnSupplySat; g_menu[401][8] = CCommand_OnLoad5WarShrikeMissiles; -- Titan_Command.lua -- Refine Minerals function TCommand_OnRefineMinerals(veh, pl, menu) local count = pl:inventory_find("Eljaycium Ore"); if (count == 0) then return true; end pl:inventory_modify("Eljaycium Ore", -count); pl:team_get():inventory_modify("Build Point", count * 50); pl:score_modify(count * 10); return true; end -- Purchase Defense Drone (50 BP) function TCommand_OnPurchaseDefenseDrone(veh, pl, menu) if (pl:score_get() < 10) then pl:status("You do not have enough score to purchase a Titan Defense Drone"); return true; end if (pl:team_get():inventory_find("Build Point") < 50) then pl:status("Your team does not have enough Build Points to purchase a Titan Defense Drone"); return true; end pl:score_modify(-10); pl:team_get():inventory_modify("Build Point", -50); pl:inventory_modify("Titan Defense Drone", 1); return true; end -- Return Defense Drone function TCommand_OnReturnDefenseDrone(veh, pl, menu) if (pl:inventory_find("Titan Defense Drone") < 1) then pl:status("You do not have a Titan Defense Drone"); return true; end pl:score_modify(10); pl:team_get():inventory_modify("Build Point", 50); pl:inventory_remove("Titan Defense Drone", 1); return true; end -- Purchase Titan GUNSAT (55 BP) function TCommand_OnPurchaseGUNSAT(veh, pl, menu) if (pl:score_get() < 11) then pl:status("You do not have enough score to purchase a Titan GUNSAT"); return true; end if (pl:team_get():inventory_find("Build Point") < 55) then pl:status("Your team does not have enough Build Points to purchase a Titan GUNSAT"); return true; end pl:score_modify(-11); pl:team_get():inventory_modify("Build Point", -55); pl:inventory_modify("Titan GUNSAT", 1); return true; end -- Return GUNSAT function TCommand_OnReturnGUNSAT(veh, pl, menu) if (pl:inventory_find("Titan GUNSAT") < 1) then pl:status("You do not have a Titan GUNSAT"); return true; end pl:score_modify(11); pl:team_get():inventory_modify("Build Point", 55); pl:inventory_modify("Titan GUNSAT", -1); return true; end -- Purchase SupplySat (500 BP) function TCommand_OnPurchaseSupplySat(veh, pl, menu) if (pl:score_get() < 100) then pl:status("You do not have enough score to purchase a Titan SupplySat"); return true; end if (pl:team_get():inventory_find("Build Point") < 500) then pl:status("Your team does not have enough Build Points to purchase a Titan SupplySat"); return true; end pl:score_modify(-100); pl:team_get():inventory_modify("Build Point", -500); pl:inventory_modify("Titan SupplySat", 1); pl:team_get():message(pl.m_name .. " purchased a SupplySat"); return true; end -- Return SupplySat function TCommand_OnReturnSupplySat(veh, pl, menu) if (pl:inventory_find("Titan SupplySat") < 1) then pl:status("You do not have a Titan SupplySat"); return true; end pl:score_modify(100); pl:team_get():inventory_modify("Build Point", 500); pl:inventory_modify("Titan SupplySat", -1); pl:team_get():message(pl.m_name .. " returned a SupplySat"); return true; end -- Load 5 WarShrike Missiles function TCommand_OnLoad5WarShrikeMissiles(veh, pl, menu) -- Let server handle it return false; end -- Titan Command Handlers g_menu[411] = {}; g_menu[411][1] = TCommand_OnRefineMinerals; g_menu[411][2] = TCommand_OnPurchaseDefenseDrone; g_menu[411][3] = TCommand_OnReturnDefenseDrone; g_menu[411][4] = TCommand_OnPurchaseGUNSAT; g_menu[411][5] = TCommand_OnReturnGUNSAT; g_menu[411][6] = TCommand_OnPurchaseSupplySat; g_menu[411][7] = TCommand_OnReturnSupplySat; g_menu[411][8] = TCommand_OnLoad5WarShrikeMissiles;