Esempio n. 1
0
        public bool tryHousingProductionMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //1 - Shack (75 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 75)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -75);
                player.inventoryModify(192, 1);
                player.sendMessage(0, "1 [RTS] Shack Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - House (125 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 125)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -125);
                player.inventoryModify(201, 1);
                player.sendMessage(0, "1 [RTS] House Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Villa (175 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 175)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -175);
                player.inventoryModify(202, 1);
                player.sendMessage(0, "1 [RTS] Villa Kit has been added to your inventory");
                player.syncState();
            }
            break;
            }
            return(false);
        }
Esempio n. 2
0
        public bool tryEngineerFort(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //PDB Artillery Kit (8 Iron + $800)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 8)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                if (player.Cash < 800)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough cash for this option");
                    return(false);
                }

                player.inventoryModify(2027, -8);
                player.inventoryModify(163, 1);
                player.Cash -= 800;
                player.sendMessage(0, "1 PDB Artillery has been added to your inventory");
                player.syncState();
            }
            break;

            //PDB Gatling Kit (8 Iron + $800)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 8)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                if (player.Cash < 800)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough cash for this option");
                    return(false);
                }

                player.inventoryModify(2027, -8);
                player.inventoryModify(162, 1);
                player.Cash -= 800;
                player.sendMessage(0, "1 PDB Gatling has been added to your inventory");
                player.syncState();
            }
            break;
            }
            return(false);
        }
Esempio n. 3
0
        public bool playerProduce(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            switch (computer._type.Name)
            {
            case "[RTS] Command Center":
                return(tryCommandCenterMenu(player, computer, product));

            case "[RTS] Shack":
                return(tryCollectionMenu(player, computer, product, ProductionBuilding.Shack));

            case "[RTS] House":
                return(tryCollectionMenu(player, computer, product, ProductionBuilding.House));

            case "[RTS] Villa":
                return(tryCollectionMenu(player, computer, product, ProductionBuilding.Villa));

            case "[RTS] Marine Barracks":
                return(tryBarracksMenu(player, computer, product, DefenseProduction.Marine));

            case "[RTS] Ripper Barracks":
                return(tryBarracksMenu(player, computer, product, DefenseProduction.Ripper));

            case "[RTS] Factory - Housing":
                return(tryHousingProductionMenu(player, computer, product));

            case "[RTS] Refinery - Iron":
                return(tryIronRefinery(player, computer, product));

            case "[RTS] Factory - Defense":
                return(tryDefenseMenu(player, computer, product));

            case "[RTS] Factory - Production":
                return(tryProductionMenu(player, computer, product));

            case "[RTS] Iron Mine":
                return(tryCollectionMenu(player, computer, product, ProductionBuilding.Ironmine));

            case "[RTS] Scrapyard":
                return(tryCollectionMenu(player, computer, product, ProductionBuilding.Scrapyard));
            }
            return(true);
        }
Esempio n. 4
0
        public bool tryProductionMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //1 - Refinery - Iron (200 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 200)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -200);
                player.inventoryModify(197, 1);
                player.sendMessage(0, "1 [RTS] Refinery - Iron Kit has been added to your inventory");
                player.syncState();
            }
            break;
            }
            return(false);
        }
        public bool tryCommandCenterMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //1 - Factory - Production (125 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 125)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -125);
                player.inventoryModify(193, 1);
                player.sendMessage(0, "1 [RTS] Factory - Production Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - Factory - Defense (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(194, 1);
                player.sendMessage(0, "1 [RTS] Factory - Defense Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Factory - Housing (200 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 200)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -200);
                player.inventoryModify(204, 1);
                player.sendMessage(0, "1 [RTS] Factory - Housing Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //4 - Power Station (25 Iron)
            case 4:
            {
                if (player.getInventoryAmount(2027) < 25)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -25);
                player.inventoryModify(200, 1);
                player.sendMessage(0, "1 [RTS] Power Station Kit has been added to your inventory");
                player.syncState();
            }
            break;
            }
            return(false);
        }
Esempio n. 6
0
        public bool playerProduce(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            //Makes sure player is using the right generator and resources are subtracted from the right team

            if (computer._type.Name == "Titan Generator" && //using titan generator
                player._team == computer._team)             //player and generator are on the same team
            //(might have to do == teamOne.arenaTeam instead. Since generators don't have a frquency)
            {
                //If not enough resources...
                if (teamOne.resources < product.Cost)
                {
                    player.sendMessage(0, "Your team does not have enough resources to produce this!");
                    //Don't produce it
                    return(false);
                }
                //But if we do have enough resources...
                else
                {
                    //Make it and subtract from team's resource total
                    teamOne.resources -= product.Cost;
                }

                //Accepts titanium oxide to add to team resources
                if (product.Title.StartsWith("Refine Titanium Oxide"))
                {
                    //How much titanium oxide does the player have?
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Remove all of the player's titanium oxide from his inventory (auto does that from editor)
                    //player.inventoryModify(product.PlayerItemNeededId, -playerItemAmount);

                    //Add the amount taken from player's inventory into team's resource pool
                    teamOne.resources += playerItemAmount;
                }
            }

            if (computer._type.Name == "Collective Generator" && //using collective generator
                player._team == computer._team)                  //player and computer are on the same team
            {
                //If not enough resources...
                if (teamTwo.resources < product.Cost)
                {
                    player.sendMessage(0, "Your team does not have enough resources to produce this!");
                    //Don't produce it
                    return(false);
                }
                //But if we do have enough...
                else
                {
                    //Make it and subtract from total team's resource total
                    teamTwo.resources -= product.Cost;
                }

                //Accepts titanium oxide to add to team resources
                if (product.Title.StartsWith("Refine Titanium Oxide"))
                {
                    //How much titanium oxide does the player have?
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Add the amount taken from player's inventory into team's resource pool
                    teamTwo.resources += playerItemAmount;
                }
            }


            updateTickers();

            return(true);
        }
Esempio n. 7
0
        public bool tryEngineerVehicle(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //Build Exosuit Kit (10 Iron + $1000)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 10)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                if (player.Cash < 1000)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough cash for this option");
                    return(false);
                }

                player.inventoryModify(2027, -10);
                player.inventoryModify(159, 1);
                player.Cash -= 1000;
                player.sendMessage(0, "1 Deploy ExoSuit has been added to your inventory");
                player.syncState();
            }
            break;

            //Build Slick Kit(15 Iron + $2000)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 15)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                if (player.Cash < 2000)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough cash for this option");
                    return(false);
                }

                player.inventoryModify(2027, -15);
                player.inventoryModify(161, 1);
                player.Cash -= 2000;
                player.sendMessage(0, "1 Deploy Slick has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Command Center Kit(150 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 150)
                {
                    player.sendMessage(-1, "Engineer> I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -150);
                player.inventoryModify(191, 1);
                player.sendMessage(0, "1 [RTS] Command Center Kit has been added to your inventory");
                player.syncState();

                player.sendMessage(0, String.Format("&To use this item, you must type ?go [RTS] {0} to start your city. Good luck!", player._alias));
            }
            break;
            }
            return(false);
        }
Esempio n. 8
0
        public bool tryBarracksMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product, DefenseProduction type)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //1 - Train 1 Normal ($500)
            case 1:
            {
                if (player.Cash < 500)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 500;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.Marine, null, null, BotLevel.Normal, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.Ripper, null, null, BotLevel.Normal, player._state);
                    break;
                }
            }
            break;

            //2 - Train 1 Adept ($1000)
            case 2:
            {
                if (player.Cash < 1000)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 1000;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.Marine, null, null, BotLevel.Adept, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.Ripper, null, null, BotLevel.Adept, player._state);
                    break;
                }
            }
            break;

            //3 - Train 1 Elite ($1500)
            case 3:
            {
                if (player.Cash < 1500)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 1500;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.EliteMarine, null, null, BotLevel.Elite, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.EliteHeavy, null, null, BotLevel.Elite, player._state);
                    break;
                }
            }
            break;
            }
            return(false);
        }
Esempio n. 9
0
        /// <summary>
        /// Executes a vehicle produce item
        /// </summary>
        private bool produceItem(Player client, Computer computer, VehInfo.Computer.ComputerProduct product, int ammoUsed)
        {       //Are we spawning an item or a vehicle?
            if (product.ProductToCreate > 0)
            {   //Inventory item, get the item type
                ItemInfo item = _server._assets.getItemByID(product.ProductToCreate);
                if (item == null)
                {
                    Log.write(TLog.Error, "Produce item {0} referenced invalid item id #{1}", product.Title, product.ProductToCreate);
                    return(false);
                }

                //Add the appropriate amount of items to the player's inventory
                int itemsCreated = (product.Quantity < 0) ? (ammoUsed * Math.Abs(product.Quantity)) : product.Quantity;

                //Lets check for a team item first
                if (product.Team > 0)
                {
                    //It is, lets add it to the team's inventory
                    if (client._team.inventoryModify(item, itemsCreated))
                    {
                        //Lets notify the team
                        client.sendTeamMessage(0, item.name + " has been added to your team's inventory.");
                        return(true);
                    }
                    else
                    {
                        client.sendMessage(-1, "Unable to add " + item.name + " to the team's inventory.");
                        return(false);
                    }
                }

                //Not for the team, give to the player instead
                if (client.inventoryModify(item, itemsCreated))
                {
                    client.sendMessage(0, item.name + " has been added to your inventory.");
                    return(true);
                }
                else
                {
                    client.sendMessage(-1, "Unable to add " + item.name + " to your inventory.");
                    return(false);
                }
            }
            else if (product.ProductToCreate < 0)
            {   //It's a vehicle! Get the vehicle type
                VehInfo vehInfo = _server._assets.getVehicleByID(-product.ProductToCreate);
                if (vehInfo == null)
                {
                    Log.write(TLog.Error, "Produce item {0} referenced invalid vehicle id #{1}", product.Title, -product.ProductToCreate);
                    return(false);
                }

                //What sort of vehicle is it?
                switch (vehInfo.Type)
                {
                case VehInfo.Types.Computer:
                {
                    //Lets destroy the vehicle being morphed
                    //      Vehicle ve = client._arena._vehicles.getObjByID(computer._id);
                    //       if (ve != null)
                    //          ve.destroy(true);

                    //Spawn new vehicle
                    Vehicle vehicle = newVehicle(vehInfo, client._team, client, client._state);
                    if (vehicle != null)
                    {
                        return(true);
                    }

                    return(false);
                }

                case VehInfo.Types.Car:
                {               //Create the new vehicle next to the player
                    Vehicle vehicle = newVehicle(vehInfo, client._team, client, client._state);

                    //Lets destroy the morphing vehicle
                    //         Vehicle ve = client._arena._vehicles.getObjByID(computer._id);
                    //         if (ve != null)
                    //             ve.destroy(true);

                    //Place him in the vehicle!
                    return(client.enterVehicle(vehicle));
                }

                default:
                    Log.write(TLog.Error, "Produce item {0} attempted to produce invalid vehicle {1}", product.Title, vehInfo.Name);
                    return(false);
                }
            }
            else
            {
                return(false);
            }
        }
Esempio n. 10
0
        public bool tryHousingProductionMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int       idx       = Convert.ToInt32(product.Title.Substring(0, 2));
            Structure structure = getStructureByVehicleID(computer._id);

            switch (idx)
            {
            //1 - Shack (75 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 75)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -75);
                player.inventoryModify(192, 1);
                player.sendMessage(0, "1 [RTS] Shack Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - House (125 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 125)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -125);
                player.inventoryModify(201, 1);
                player.sendMessage(0, "1 [RTS] House Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Villa (175 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 175)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -175);
                player.inventoryModify(202, 1);
                player.sendMessage(0, "1 [RTS] Villa Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //14 - Sell
            case 14:
            {
                player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity);
                player.syncState();

                player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity));

                structure.destroyed(structure._vehicle, player);
                structure._vehicle.destroy(false);
            }
            break;

            //15 - Repair
            case 15:
            {
                int repairCost = calculateRepairCost(structure._vehicle);

                if (player.getInventoryAmount(2026) < repairCost)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building");
                    return(false);
                }

                structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints;

                player.inventoryModify(2026, -repairCost);
                player.sendMessage(0, "Structure repaired");
                player.syncState();
            }
            break;

            //Info
            case 16:
            {
                player.sendMessage(0, "$ - Factory - Housing");
                int repairCost = calculateRepairCost(structure._vehicle);
                player.sendMessage(0, String.Format("& --- Repair Cost: {0}", repairCost));
                player.sendMessage(0, "& --- Shack (Produces $850/4hrs at Level 1)");
                player.sendMessage(0, "& --- House (Produces $1650/8hrs at Level 1)");
                player.sendMessage(0, "& --- Villa (Produces $3250/24hrs at Level 1)");
                break;
            }
            }
            return(false);
        }
Esempio n. 11
0
        public bool tryIronRefinery(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //1 - 1 Iron (2 Scrap Metal)
            case 1:
            {
                if (player.getInventoryAmount(2026) < 2)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 1);
                player.inventoryModify(2026, -2);
                player.sendMessage(0, "1 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - 5 Iron (10 Scrap Metal)
            case 2:
            {
                if (player.getInventoryAmount(2026) < 10)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 5);
                player.inventoryModify(2026, -10);
                player.sendMessage(0, "5 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - 10 Iron (18 Scrap Metal)
            case 3:
            {
                if (player.getInventoryAmount(2026) < 18)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }
                player.inventoryModify(2027, 10);
                player.inventoryModify(2026, -18);
                player.sendMessage(0, "10 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //4 - 35 Iron (25 Scrap Metal)
            case 4:
            {
                if (player.getInventoryAmount(2026) < 25)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 35);
                player.inventoryModify(2026, -25);
                player.sendMessage(0, "35 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //5 - 50 Iron (30 Scrap Metal)
            case 5:
            {
                if (player.getInventoryAmount(2026) < 30)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 50);
                player.inventoryModify(2026, -30);
                player.sendMessage(0, "20 Iron has been added to your inventory");
                player.syncState();
            }
            break;
            }

            return(false);
        }
Esempio n. 12
0
        public bool playerProduce(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            //When Titan Generator is used...
            if (computer._type.Name == "Titan Headquarter" &&
                player._team == computer._team)
            {
                //Refine Titanium Oxide selected...
                if (product.Title.StartsWith("Refine Titanium Oxide"))
                {
                    //Amount of resource player is carrying
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Add resource to team's resource pool (Titanium Oxide id = 2009)
                    player._team.inventoryModify(TITOX_ID, playerItemAmount);
                }

                //Refine Hydrocarbon selected...
                if (product.Title.StartsWith("Refine Hydrocarbon"))
                {
                    //Amount of resource player is carrying
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Add resource to team's resource pool (Hydrocarbon id == 2002)
                    player._team.inventoryModify(HYDROCARB_ID, playerItemAmount);
                }

                //Refine Ore selected...
                if (product.Title.StartsWith("Refine Ore"))
                {
                    //Amount of resource player is carrying
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Add resource to team's resource pool (Ore id == 2004)
                    player._team.inventoryModify(ORE_ID, playerItemAmount);
                }
            }

            //When Collective generator is used...
            if (computer._type.Name == "Collective Headquarter" &&
                player._team == computer._team)
            {
                //Refine Titanium Oxide selected...
                if (product.Title.StartsWith("Refine Titanium Oxide"))
                {
                    //Amount of resource player is carrying
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Add resource to team's resource pool (Titanium Oxide id == 2002)
                    player._team.inventoryModify(TITOX_ID, playerItemAmount);
                }

                //Refine Hydrocarbon selected...
                if (product.Title.StartsWith("Refine Hydrocarbon"))
                {
                    //Amount of resource player is carrying
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Add resource to team's resource pool (Hydrocarbon id == 2002)
                    player._team.inventoryModify(HYDROCARB_ID, playerItemAmount);
                }

                //Refine Ore selected...
                if (product.Title.StartsWith("Refine Ore"))
                {
                    //Amount of resource player is carrying
                    int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                    //Add resource to team's resource pool (Ore id == 2002)
                    player._team.inventoryModify(ORE_ID, playerItemAmount);
                }
            }

            return(true);
        }
        public bool tryProductionMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int       idx       = Convert.ToInt32(product.Title.Substring(0, 2));
            Structure structure = getStructureByVehicleID(computer._id);

            switch (idx)
            {
            //1 - Refinery - Iron (200 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 200)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -200);
                player.inventoryModify(197, 1);
                player.sendMessage(0, "1 [RTS] Refinery - Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - Iron Mine (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(205, 1);
                player.sendMessage(0, "1 [RTS] Iron Mine Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Scrapyard (100 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(206, 1);
                player.sendMessage(0, "1 [RTS] Scrapyard Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //16 - Click For Info
            case 16:
            {
                player.sendMessage(0, "$ - Factory - Production");
                int repairCost = calculateRepairCost(structure._vehicle);
                player.sendMessage(0, String.Format("& --- Repair Cost: {0}", repairCost));
                player.sendMessage(0, "& --- Refinery - Iron (Refines scrap metal into Refined Iron)");
                player.sendMessage(0, "& --- Iron Mine (Produces Refined Iron at hourly intervals)");
                player.sendMessage(0, "& --- Scrapyard (Produces Scrap Metal at hourly intervals)");
            }
            break;

            //15 - Repair
            case 15:
            {
                int repairCost = calculateRepairCost(structure._vehicle);

                if (player.getInventoryAmount(2026) < repairCost)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building");
                    return(false);
                }

                structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints;

                player.inventoryModify(2026, -repairCost);
                player.sendMessage(0, "Structure repaired");
                player.syncState();
            }
            break;

            //14 - Sell
            case 14:
            {
                player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity);
                player.syncState();

                player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity));

                structure.destroyed(structure._vehicle, player);
                structure._vehicle.destroy(false);
            }
            break;
            }
            return(false);
        }
Esempio n. 14
0
        public bool tryIronRefinery(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int       idx       = Convert.ToInt32(product.Title.Substring(0, 2));
            Structure structure = getStructureByVehicleID(computer._id);

            switch (idx)
            {
            //1 - 1 Iron (2 Scrap Metal)
            case 1:
            {
                if (player.getInventoryAmount(2026) < 2)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 1);
                player.inventoryModify(2026, -2);
                player.sendMessage(0, "1 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - 5 Iron (10 Scrap Metal)
            case 2:
            {
                if (player.getInventoryAmount(2026) < 10)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 5);
                player.inventoryModify(2026, -10);
                player.sendMessage(0, "5 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - 10 Iron (18 Scrap Metal)
            case 3:
            {
                if (player.getInventoryAmount(2026) < 18)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }
                player.inventoryModify(2027, 10);
                player.inventoryModify(2026, -18);
                player.sendMessage(0, "10 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //4 - 35 Iron (25 Scrap Metal)
            case 4:
            {
                if (player.getInventoryAmount(2026) < 25)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 35);
                player.inventoryModify(2026, -25);
                player.sendMessage(0, "35 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //5 - 50 Iron (30 Scrap Metal)
            case 5:
            {
                if (player.getInventoryAmount(2026) < 30)
                {
                    player.sendMessage(-1, "Refinery Worker> I'm sorry, you don't have enough scrap metal for this option");
                    return(false);
                }

                player.inventoryModify(2027, 50);
                player.inventoryModify(2026, -30);
                player.sendMessage(0, "50 Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //15 - Repair
            case 15:
            {
                int repairCost = calculateRepairCost(structure._vehicle);

                if (player.getInventoryAmount(2026) < repairCost)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building");
                    return(false);
                }

                structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints;

                player.inventoryModify(2026, -repairCost);
                player.sendMessage(0, "Structure repaired");
                player.syncState();
            }
            break;

            //16 - Info
            case 16:
            {
                int repairCost = calculateRepairCost(structure._vehicle);
                player.sendMessage(0, String.Format("&-Repair Cost: {0}", repairCost));
            }
            break;

            //14 - Sell
            case 14:
            {
                player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity);
                player.syncState();

                player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity));

                structure.destroyed(structure._vehicle, player);
                structure._vehicle.destroy(false);
            }
            break;
            }

            return(false);
        }
Esempio n. 15
0
        public bool tryDefenseMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 2));

            switch (idx)
            {
                //1 - Marine Barracks (100 Iron)
                case 1:
                    {
                        if (player.getInventoryAmount(2027) < 100)
                        {
                            player.sendMessage(-1, "&You don't have enough iron for this option");
                            return false;
                        }

                        player.inventoryModify(2027, -100);
                        player.inventoryModify(195, 1);
                        player.sendMessage(0, "1 [RTS] Marine Barracks Kit has been added to your inventory");
                        player.syncState();
                    }
                    break;
                //2 - Ripper Barracks (100 Iron)
                case 2:
                    {
                        if (player.getInventoryAmount(2027) < 100)
                        {
                            player.sendMessage(-1, "&You don't have enough iron for this option");
                            return false;
                        }

                        player.inventoryModify(2027, -100);
                        player.inventoryModify(196, 1);
                        player.sendMessage(0, "1 [RTS] Ripper Barracks Kit has been added to your inventory");
                        player.syncState();
                    }
                    break;
                //3 - Turret - HMG (25 Iron)
                case 3:
                    {
                        if (player.getInventoryAmount(2027) < 25)
                        {
                            player.sendMessage(-1, "&You don't have enough iron for this option");
                            return false;
                        }

                        player.inventoryModify(2027, -25);
                        player.inventoryModify(198, 1);
                        player.sendMessage(0, "1 [RTS] AT HMG Kit has been added to your inventory");
                        player.syncState();
                    }
                    break;
                //4 - Turret - Rocket(25 Iron)
                case 4:
                    {
                        if (player.getInventoryAmount(2027) < 25)
                        {
                            player.sendMessage(-1, "&You don't have enough iron for this option");
                            return false;
                        }

                        player.inventoryModify(2027, -25);
                        player.inventoryModify(199, 1);
                        player.sendMessage(0, "1 [RTS] AT Rocket Kit has been added to your inventory");
                        player.syncState();
                    }
                    break;
                //16 - Click For Info
                case 16:
                    {
                        player.sendMessage(0, "$ - Factory - Defense");
                        player.sendMessage(0, "& --- Marine Barracks (Allows you to train Marine bots)");
                        player.sendMessage(0, "& --- Ripper Barracks (Allows you to train Ripper bots)");
                        player.sendMessage(0, "& --- All other options should be self explanatory");
                    }
                    break;

            }
            return false;
        }
Esempio n. 16
0
        public bool tryBarracksMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product, DefenseProduction type)
        {
            int       idx       = Convert.ToInt32(product.Title.Substring(0, 2));
            Structure structure = getStructureByVehicleID(computer._id);

            if (_units.Count >= _botMax)
            {
                player.sendMessage(-1, "You have reach the maximum amount of units you can train/Have active at one time.");
                return(false);
            }

            switch (idx)
            {
            //1 - Train 1 Normal ($500)
            case 1:
            {
                if (player.Cash < 500)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 500;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.Marine, null, null, BotLevel.Normal, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.Ripper, null, null, BotLevel.Normal, player._state);
                    break;
                }
            }
            break;

            //2 - Train 1 Adept ($1000)
            case 2:
            {
                if (player.Cash < 1000)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 1000;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.Marine, null, null, BotLevel.Adept, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.Ripper, null, null, BotLevel.Adept, player._state);
                    break;
                }
            }
            break;

            //3 - Train 1 Elite ($1500)
            case 3:
            {
                if (player.Cash < 1500)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 1500;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.EliteMarine, null, null, BotLevel.Elite, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.EliteHeavy, null, null, BotLevel.Elite, player._state);
                    break;
                }
            }
            break;

            //14 - Sell
            case 14:
            {
                player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity);
                player.syncState();

                player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity));

                structure.destroyed(structure._vehicle, player);
                structure._vehicle.destroy(false);
            }
            break;

            //15 - Repair
            case 15:
            {
                int repairCost = calculateRepairCost(structure._vehicle);

                if (player.getInventoryAmount(2026) < repairCost)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building");
                    return(false);
                }

                structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints;

                player.inventoryModify(2026, -repairCost);
                player.sendMessage(0, "Structure repaired");
                player.syncState();
            }
            break;

            //16 - Click For Info
            case 16:
            {
                player.sendMessage(0, "$Barracks Info:");
                player.sendMessage(0, "& --- The barracks allows you to train new units (bots) that will guard your city.");
                int repairCost = calculateRepairCost(structure._vehicle);
                player.sendMessage(0, String.Format("& --- Repair Cost: {0}", repairCost));
            }
            break;
            }
            return(false);
        }
Esempio n. 17
0
        public bool tryProductionMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 2));

            switch (idx)
            {
            //1 - Refinery - Iron (200 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 200)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -200);
                player.inventoryModify(197, 1);
                player.sendMessage(0, "1 [RTS] Refinery - Iron has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - Iron Mine (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(205, 1);
                player.sendMessage(0, "1 [RTS] Iron Mine Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Scrapyard (100 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(206, 1);
                player.sendMessage(0, "1 [RTS] Scrapyard Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //16 - Click For Info
            case 16:
            {
                player.sendMessage(0, "$ - Factory - Production");
                player.sendMessage(0, "& --- Refinery - Iron (Refines scrap metal into Refined Iron)");
                player.sendMessage(0, "& --- Iron Mine (Produces Refined Iron at hourly intervals)");
                player.sendMessage(0, "& --- Scrapyard (Produces Scrap Metal at hourly intervals)");
            }
            break;
            }
            return(false);
        }
Esempio n. 18
0
        public bool tryResidentialMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product, ProductionBuilding buildingType)
        {
            int       idx       = Convert.ToInt32(product.Title.Substring(0, 1));
            Structure structure = getStructureByVehicleID(computer._id);

            //Sanity
            if (structure == null)
            {
                return(false);
            }

            int level            = structure._productionLevel;
            int cash             = calculateCashProduction(level, buildingType);
            int cashNextLevel    = calculateCashProduction(level + 1, buildingType);
            int upgradeNextLevel = calculateUpgradeCost(structure._upgradeCost, buildingType);


            switch (idx)
            {
            //1 - Collect
            case 1:
            {
                //Are we ready?
                if (!IsProductionReady(structure))
                {
                    player.sendMessage(0, "&This building is not ready for collection yet.");
                    return(false);
                }

                //Produce!
                structure.produce(player);
            }
            break;

            //2 - Upgrade (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < structure._upgradeCost)
                {
                    player.sendMessage(-1, "&You do not have sufficient iron to upgrade this building");
                    return(false);
                }

                player.inventoryModify(2027, -structure._upgradeCost);
                player.syncState();

                //Up the cost for the next level
                structure._upgradeCost = upgradeNextLevel;
                structure._productionLevel++;
                structure._productionQuantity = cashNextLevel;

                player.sendMessage(0, String.Format("&Structure upgraded, Next collection: ${0}", structure._productionQuantity));
            }
            break;

            //3 More Info
            case 3:
            {
                player.sendMessage(0, String.Format("&Building Info:"));
                player.sendMessage(0, String.Format("Current Level: {0}", structure._productionLevel));
                player.sendMessage(0, String.Format("Upgrade Cost for next level: {0} Iron", structure._upgradeCost));
                player.sendMessage(0, String.Format("Next Collection amount: ${0}", structure._productionQuantity));
                player.sendMessage(0, String.Format("Next Level Collection amount: ${0}", cashNextLevel));

                TimeSpan remaining = _baseScript.timeTo(structure._nextProduction.TimeOfDay);
                player.sendMessage(0, String.Format("Next collection ready in {0} Hour(s) & {1} minute(s)", remaining.Hours, remaining.Minutes));
            }
            break;
            }
            return(false);
        }
Esempio n. 19
0
 public bool playerProduce(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
 {
     return(true);
 }
Esempio n. 20
0
        public bool tryDefenseMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int       idx       = Convert.ToInt32(product.Title.Substring(0, 2));
            Structure structure = getStructureByVehicleID(computer._id);

            switch (idx)
            {
            //1 - Marine Barracks (100 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(195, 1);
                player.sendMessage(0, "1 [RTS] Marine Barracks Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - Ripper Barracks (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(196, 1);
                player.sendMessage(0, "1 [RTS] Ripper Barracks Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Turret - HMG (25 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 25)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -25);
                player.inventoryModify(198, 1);
                player.sendMessage(0, "1 [RTS] AT HMG Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //4 - Turret - Rocket(25 Iron)
            case 4:
            {
                if (player.getInventoryAmount(2027) < 25)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -25);
                player.inventoryModify(199, 1);
                player.sendMessage(0, "1 [RTS] AT Rocket Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //14 - Sell
            case 14:
            {
                player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity);
                player.syncState();

                player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity));

                structure.destroyed(structure._vehicle, player);
                structure._vehicle.destroy(false);
            }
            break;

            //15 - Repair
            case 15:
            {
                int repairCost = calculateRepairCost(structure._vehicle);

                if (player.getInventoryAmount(2026) < repairCost)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building");
                    return(false);
                }

                structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints;

                player.inventoryModify(2026, -repairCost);
                player.sendMessage(0, "Structure repaired");
                player.syncState();
            }
            break;

            //16 - Click For Info
            case 16:
            {
                player.sendMessage(0, "$ - Factory - Defense");
                int repairCost = calculateRepairCost(structure._vehicle);
                player.sendMessage(0, String.Format("& --- Repair Cost: {0}", repairCost));
                player.sendMessage(0, "& --- Marine Barracks (Allows you to train Marine bots)");
                player.sendMessage(0, "& --- Ripper Barracks (Allows you to train Ripper bots)");
                player.sendMessage(0, "& --- All other options should be self explanatory");
            }
            break;
            }
            return(false);
        }
Esempio n. 21
0
        public bool tryHelmetTrade(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //250 Marine Helmets for 10 Dice
            case 1:
            {
                //Not enough!
                if (player.getInventoryAmount(1492) < 250)
                {
                    player.sendMessage(0, "Helmet Trader> You don't have enough Marine helmets for this!!");
                    return(false);
                }

                //Success
                player.inventoryModify(1492, -250);
                player.inventoryModify(2018, 10);
                player.sendMessage(0, "10 Lucky Dice have been added to your inventory");
            }
            break;

            //250 Ripper Helmets for 10 Dice
            case 2:
            {
                //Not enough!
                if (player.getInventoryAmount(2017) < 250)
                {
                    player.sendMessage(0, "Helmet Trader> You don't have enough Ripper helmets for this!!");
                    return(false);
                }

                //Success
                player.inventoryModify(2017, -250);
                player.inventoryModify(2018, 10);
                player.sendMessage(0, "10 Lucky Dice have been added to your inventory");
            }
            break;

            //5000 Ripper Helmets for Tiara
            case 3:
            {
                //Not enough!
                if (player.getInventoryAmount(2017) < 5000)
                {
                    player.sendMessage(0, "Helmet Trader> You don't have enough Ripper helmets for this!!");
                    return(false);
                }

                //Success
                player.inventoryModify(2017, -5000);
                player.inventoryModify(2019, 1);
                player.sendMessage(0, "1 Abbath's Tiara has been added to your inventory");
            }
            break;

            //5000 Marine Helmets for Tiara
            case 4:
            {
                //Not enough!
                if (player.getInventoryAmount(1492) < 5000)
                {
                    player.sendMessage(0, "Helmet Trader> You don't have enough Marine helmets for this!!");
                    return(false);
                }

                //Success
                player.inventoryModify(1492, -5000);
                player.inventoryModify(2019, 1);
                player.sendMessage(0, "1 Abbath's Tiara has been added to your inventory");
            }
            break;

            //500 Ripper Helmets for 2 Iron
            case 5:
            {
                //Not enough!
                if (player.getInventoryAmount(2017) < 500)
                {
                    player.sendMessage(0, "Helmet Trader> You don't have enough Ripper helmets for this!!");
                    return(false);
                }

                //Success
                player.inventoryModify(2017, -500);
                player.inventoryModify(2027, 2);
                player.sendMessage(0, "2 Refined Iron have been added to your inventory");
            }
            break;

            //500 Marine Helmets for 2 Iron
            case 6:
            {
                //Not enough!
                if (player.getInventoryAmount(1492) < 500)
                {
                    player.sendMessage(0, "Helmet Trader> You don't have enough Marine helmets for this!!");
                    return(false);
                }

                //Success
                player.inventoryModify(1492, -500);
                player.inventoryModify(2027, 2);
                player.sendMessage(0, "2 Refined Iron have been added to your inventory");
            }
            break;
            }

            return(false);
        }
Esempio n. 22
0
        public bool tryDefenseMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 1));

            switch (idx)
            {
            //1 - Marine Barracks (100 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(195, 1);
                player.sendMessage(0, "1 [RTS] Marine Barracks Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - Ripper Barracks (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(196, 1);
                player.sendMessage(0, "1 [RTS] Ripper Barracks Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Turret - HMG (25 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 25)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -25);
                player.inventoryModify(198, 1);
                player.sendMessage(0, "1 [RTS] AT HMG Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //4 - Turret - Rocket(25 Iron)
            case 4:
            {
                if (player.getInventoryAmount(2027) < 25)
                {
                    player.sendMessage(-1, "&You don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -25);
                player.inventoryModify(199, 1);
                player.sendMessage(0, "1 [RTS] AT Rocket Kit has been added to your inventory");
                player.syncState();
            }
            break;
            }
            return(false);
        }
Esempio n. 23
0
        public bool tryBarracksMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product, DefenseProduction type)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 2));

            if (_units.Count >= _botMax)
            {
                player.sendMessage(-1, "You have reach the maximum amount of units you can train/Have active at one time.");
                return(false);
            }

            switch (idx)
            {
            //1 - Train 1 Normal ($500)
            case 1:
            {
                if (player.Cash < 500)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 500;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.Marine, null, null, BotLevel.Normal, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.Ripper, null, null, BotLevel.Normal, player._state);
                    break;
                }
            }
            break;

            //2 - Train 1 Adept ($1000)
            case 2:
            {
                if (player.Cash < 1000)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 1000;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.Marine, null, null, BotLevel.Adept, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.Ripper, null, null, BotLevel.Adept, player._state);
                    break;
                }
            }
            break;

            //3 - Train 1 Elite ($1500)
            case 3:
            {
                if (player.Cash < 1500)
                {
                    player.sendMessage(-1, "Insufficient funds for this option");
                    return(false);
                }
                player.Cash -= 1500;
                player.sendMessage(0, "Unit Ready");
                player.syncState();
                switch (type)
                {
                case DefenseProduction.Marine:
                    newUnit(BotType.EliteMarine, null, null, BotLevel.Elite, player._state);
                    break;

                case DefenseProduction.Ripper:
                    newUnit(BotType.EliteHeavy, null, null, BotLevel.Elite, player._state);
                    break;
                }
            }
            break;

            //16 - Click For Info
            case 16:
            {
                player.sendMessage(0, "&Barracks Info:");
                player.sendMessage(0, "The barracks allows you to train new units (bots) that will guard your city.");
            }
            break;
            }
            return(false);
        }
Esempio n. 24
0
        public bool tryCommandCenterMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 2));

            switch (idx)
            {
            //1 - Factory - Production (125 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 125)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -125);
                player.inventoryModify(193, 1);
                player.sendMessage(0, "1 [RTS] Factory - Production Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - Factory - Defense (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(194, 1);
                player.sendMessage(0, "1 [RTS] Factory - Defense Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Factory - Housing (200 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 200)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -200);
                player.inventoryModify(204, 1);
                player.sendMessage(0, "1 [RTS] Factory - Housing Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //4 - Power Station (25 Iron)
            case 4:
            {
                if (player.getInventoryAmount(2027) < 25)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -25);
                player.inventoryModify(200, 1);
                player.sendMessage(0, "1 [RTS] Power Station Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //16 - Click For Info
            case 5:
            {
                player.sendMessage(0, "&Command Center Info:");
                player.sendMessage(0, "The Command Center is the center of operation for any city/base. It also is your warppoint from which you'll spawn when exiting the DS. In it you will find the following options:");
                player.sendMessage(0, "$ - Factory - Production");
                player.sendMessage(0, "& --- Refinery - Iron (Refines scrap metal into Refined Iron)");
                player.sendMessage(0, "& --- Iron Mine (Produces Refined Iron at hourly intervals)");
                player.sendMessage(0, "& --- Scrapyard (Produces Scrap Metal at hourly intervals)");
                player.sendMessage(0, "$ - Factory - Defense");
                player.sendMessage(0, "& --- Marine Barracks (Allows you to train Marine bots)");
                player.sendMessage(0, "& --- Ripper Barracks (Allows you to train Ripper bots)");
                player.sendMessage(0, "& --- All other options should be self explanatory");
                player.sendMessage(0, "$ - Factory - Housing");
                player.sendMessage(0, "& --- Shack (Produces $850/4hrs at Level 1)");
                player.sendMessage(0, "& --- House (Produces $1650/8hrs at Level 1)");
                player.sendMessage(0, "& --- Villa (Produces $3250/24hrs at Level 1)");
                player.sendMessage(0, "$ - Power Station (Power stations are used to power nearby buildings, " +
                                   "these must be placed before any other building is constructed with exception of the Command Center");
                break;
            }

            //Return to DS
            case 6:
            {
                player.warp(1924 * 16, 347 * 16);
            }
            break;
            }
            return(false);
        }
Esempio n. 25
0
        /// <summary>
        /// Attempts to allow a player to use a computer vehicle to produce
        /// </summary>
        public bool produceRequest(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {       //Is the player able to use this production item?
            if (!Logic_Assets.SkillCheck(player, product.SkillLogic))
            {   //The client should prevent this, so let's warn
                Log.write(TLog.Warning, "Player {0} attempted to use vehicle ({1}) produce without necessary skills.", player._alias, computer._type.Name);
                return(false);
            }

            //Do we have everything needed?
            if (player.Cash < product.Cost)
            {
                player.sendMessage(-1, "You do not have enough cash to produce this item.");
                return(false);
            }

            //Are we able to produce in parallel?
            if (product.Time > 0 && !_server._zoneConfig.vehicle.computerProduceInParallel && productionLine.Count > 0)
            {   //We can't do this
                player.sendMessage(-1, "Unable to produce - object is busy.");
                return(false);
            }

            int ammoUsed = 0;

            if (product.PlayerItemNeededId != 0)
            {
                int playerItemAmount = player.getInventoryAmount(product.PlayerItemNeededId);

                if (playerItemAmount == 0 || (product.PlayerItemNeededQuantity != -1 && product.PlayerItemNeededQuantity > playerItemAmount))
                {
                    player.sendMessage(-1, "You do not have the resources to produce this item.");
                    return(false);
                }
                ammoUsed = (product.PlayerItemNeededQuantity == -1) ? playerItemAmount : product.PlayerItemNeededQuantity;
            }

            //Is this for our team?
            if (product.TeamItemNeededId != 0)
            {
                if (!Logic_Assets.BuildingCheck(player, product.TeamBuildingLogic))
                {
                    player.sendMessage(-1, "Your team does not have the required buildings to produce this item.");
                    Log.write(TLog.Warning, "Player {0} attempted to use vehicle ({1}) produce without the necessary buildings.", player._alias, computer._type.Name);
                    return(false);
                }
                int teamItemAmount = player._team.getInventoryAmount(product.TeamItemNeededId);

                //Queue'ing isnt enabled
                if (product.TeamQueueRequest < 1)
                {
                    if (teamItemAmount == 0 || (product.TeamItemNeededId != -1 && product.TeamItemNeededQuantity > teamItemAmount))
                    {
                        player.sendMessage(-1, "Your team does not have the resources to produce this item.");
                        return(false);
                    }
                }
                else if (product.TeamQueueRequest > 0)
                {
                    if (teamItemAmount == 0)
                    {
                        player.sendMessage(-1, "Your team doesn't have the required resources to produce this item.");
                        return(false);
                    }

                    if (product.TeamItemNeededId != -1 && product.TeamItemNeededQuantity > teamItemAmount)
                    {
                        player.sendMessage(-1, "Your team doesn't have enough resources, once your team does, the item will be produced automatically.");
                        //Lets remove the items
                        if (product.TeamItemNeededQuantity == -1)
                        {
                            player._team.removeAllItemFromTeamInventory(product.TeamItemNeededId);
                        }
                        else
                        {
                            if (!player._team.inventoryModify(product.TeamItemNeededId, -product.TeamItemNeededQuantity))
                            {
                                //Shouldn't get here
                                Log.write(TLog.Error, "Unable to take product item payment from player's team after verifying existence.");
                                return(false);
                            }
                        }

                        //Check production line first before creating a new one
                        bool found = false;
                        if (productionLine.Count > 0)
                        {
                            foreach (ProduceRequest check in productionLine.ToList())
                            {
                                if (check.team == player._team)
                                {
                                    found = true;
                                }
                            }
                        }

                        if (!found)
                        {
                            //Lets queue it up
                            lock (productionLine)
                            {
                                ProduceRequest que = new ProduceRequest();

                                que.computer = computer;
                                que.client   = player;
                                que.product  = product;

                                que.tickCompletion = Environment.TickCount + (product.Time * 10);
                                que.teamAmmoUsed   = teamItemAmount;
                                que.ammoUsed       = ammoUsed;
                                que.team           = player._team;

                                productionLine.Add(que);
                            }

                            //Lets take any items needed before returning
                            if (product.PlayerItemNeededId != 0)
                            {
                                if (product.PlayerItemNeededQuantity == -1)
                                {
                                    player.removeAllItemFromInventory(false, product.PlayerItemNeededId);
                                }
                                else
                                {
                                    if (!player.inventoryModify(false, product.PlayerItemNeededId, -product.PlayerItemNeededQuantity))
                                    {   //We shouldn't get here
                                        Log.write(TLog.Error, "Unable to take produce item payment from player after verifying existence.");
                                        return(false);
                                    }
                                }
                            }
                        }

                        return(true);
                    }
                }
            }

            if (product.PlayerItemNeededId != 0)
            {
                if (product.PlayerItemNeededQuantity == -1)
                {
                    player.removeAllItemFromInventory(false, product.PlayerItemNeededId);
                }
                else
                {
                    if (!player.inventoryModify(false, product.PlayerItemNeededId, -product.PlayerItemNeededQuantity))
                    {   //We shouldn't get here
                        Log.write(TLog.Error, "Unable to take produce item payment from player after verifying existence.");
                        return(false);
                    }
                }
            }

            if (product.TeamItemNeededId != 0)
            {
                if (product.TeamItemNeededQuantity == -1)
                {
                    player._team.removeAllItemFromTeamInventory(product.TeamItemNeededId);
                }
                else
                {
                    if (!player._team.inventoryModify(product.TeamItemNeededId, -product.TeamItemNeededQuantity))
                    {
                        //Shouldn't get here
                        Log.write(TLog.Error, "Unable to take product item payment from player's team after verifying existence.");
                        return(false);
                    }
                }
            }

            //Take our payment!
            player.Cash -= product.Cost;

            //Sync up!
            player.syncInventory();

            //Do we need to queue up this request?
            if (product.Time > 0)
            {
                lock (productionLine)
                {       //Queue up the production request
                    ProduceRequest req = new ProduceRequest();

                    req.computer = computer;
                    req.client   = player;
                    req.product  = product;

                    req.tickCompletion = Environment.TickCount + (product.Time * 10);
                    req.ammoUsed       = ammoUsed;

                    productionLine.Add(req);
                }

                return(true);
            }
            else
            {   //Execute it immediately
                return(produceItem(player, computer, product, ammoUsed));
            }
        }
Esempio n. 26
0
        public bool tryCommandCenterMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product)
        {
            int idx = Convert.ToInt32(product.Title.Substring(0, 2));

            Structure structure = getStructureByVehicleID(computer._id);

            //Sanity
            if (structure == null)
            {
                return(false);
            }

            int level            = structure._productionLevel;
            int upgradeNextLevel = calculateUpgradeCost(structure._upgradeCost, ProductionBuilding.CommandCenter);

            switch (idx)
            {
            //1 - Factory - Production (125 Iron)
            case 1:
            {
                if (player.getInventoryAmount(2027) < 125)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -125);
                player.inventoryModify(193, 1);
                player.sendMessage(0, "1 [RTS] Factory - Production Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //2 - Factory - Defense (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < 100)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -100);
                player.inventoryModify(194, 1);
                player.sendMessage(0, "1 [RTS] Factory - Defense Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //3 - Factory - Housing (200 Iron)
            case 3:
            {
                if (player.getInventoryAmount(2027) < 200)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -200);
                player.inventoryModify(204, 1);
                player.sendMessage(0, "1 [RTS] Factory - Housing Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //4 - Power Station (25 Iron)
            case 4:
            {
                if (player.getInventoryAmount(2027) < 25)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough iron for this option");
                    return(false);
                }

                player.inventoryModify(2027, -25);
                player.inventoryModify(200, 1);
                player.sendMessage(0, "1 [RTS] Power Station Kit has been added to your inventory");
                player.syncState();
            }
            break;

            //8 - Repair
            case 8:
            {
                int repairCost = calculateRepairCost(structure._vehicle);

                if (player.getInventoryAmount(2026) < repairCost)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building");
                    return(false);
                }

                structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints;

                player.inventoryModify(2026, -repairCost);
                player.sendMessage(0, "Structure repaired");
                player.syncState();
            }
            break;

            //16 - Click For Info
            case 5:
            {
                player.sendMessage(0, "$Command Center Info:");
                int repairCost = calculateRepairCost(structure._vehicle);
                player.sendMessage(0, String.Format("&-Repair Cost: {0}", repairCost));

                player.sendMessage(0, String.Format("&-Current Level: {0}", structure._productionLevel));
                player.sendMessage(0, String.Format("&-Upgrade Cost for next level: {0} Iron", structure._upgradeCost));

                player.sendMessage(0, "The Command Center is the center of operation for any city/base. It also is your warppoint from which you'll spawn when exiting the DS. In it you will find the following options:");

                player.sendMessage(0, "$ - Factory - Production");
                player.sendMessage(0, "& --- Refinery - Iron (Refines scrap metal into Refined Iron)");
                player.sendMessage(0, "& --- Iron Mine (Produces Refined Iron at hourly intervals)");
                player.sendMessage(0, "& --- Scrapyard (Produces Scrap Metal at hourly intervals)");
                player.sendMessage(0, "$ - Factory - Defense");
                player.sendMessage(0, "& --- Marine Barracks (Allows you to train Marine bots)");
                player.sendMessage(0, "& --- Ripper Barracks (Allows you to train Ripper bots)");
                player.sendMessage(0, "& --- All other options should be self explanatory");
                player.sendMessage(0, "$ - Factory - Housing");
                player.sendMessage(0, "& --- Shack (Produces $850/4hrs at Level 1)");
                player.sendMessage(0, "& --- House (Produces $1650/8hrs at Level 1)");
                player.sendMessage(0, "& --- Villa (Produces $3250/24hrs at Level 1)");
                player.sendMessage(0, "$ - Power Station (Power stations are used to power nearby buildings, " +
                                   "these must be placed before any other building is constructed with exception of the Command Center");
                break;
            }

            //Return to DS
            case 6:
            {
                player.warp(1924 * 16, 347 * 16);
            }
            break;

            //7 - Upgrade
            case 7:
            {
                if (player.getInventoryAmount(2027) < structure._upgradeCost)
                {
                    player.sendMessage(-1, "&You do not have sufficient iron to upgrade this building");
                    return(false);
                }

                player.inventoryModify(2027, -structure._upgradeCost);
                player.syncState();

                //Up the cost for the next level
                structure._upgradeCost = upgradeNextLevel;
                structure._productionLevel++;

                player.sendMessage(0, String.Format("&Structure upgraded"));
            }
            break;

            //14 - Upgrade
            case 14:
            {
                player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity);
                player.syncState();

                player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity));

                structure.destroyed(structure._vehicle, player);
                structure._vehicle.destroy(false);
            }
            break;
            }
            return(false);
        }
Esempio n. 27
0
        public bool tryCollectionMenu(Player player, Computer computer, VehInfo.Computer.ComputerProduct product, ProductionBuilding buildingType)
        {
            int       idx       = Convert.ToInt32(product.Title.Substring(0, 1));
            Structure structure = getStructureByVehicleID(computer._id);

            //Sanity
            if (structure == null)
            {
                return(false);
            }

            int level            = structure._productionLevel;
            int cash             = calculateProduction(level, buildingType);
            int cashNextLevel    = calculateProduction(level + 1, buildingType);
            int upgradeNextLevel = calculateUpgradeCost(structure._upgradeCost, buildingType);


            switch (idx)
            {
            //1 - Collect
            case 1:
            {
                //Are we ready?
                if (!IsProductionReady(structure))
                {
                    player.sendMessage(0, "&This building is not ready for collection yet.");
                    return(false);
                }

                //Produce!
                structure.produce(player);
            }
            break;

            //2 - Upgrade (100 Iron)
            case 2:
            {
                if (player.getInventoryAmount(2027) < structure._upgradeCost)
                {
                    player.sendMessage(-1, "&You do not have sufficient iron to upgrade this building");
                    return(false);
                }

                player.inventoryModify(2027, -structure._upgradeCost);
                player.syncState();

                //Up the cost for the next level
                structure._upgradeCost = upgradeNextLevel;
                structure._productionLevel++;
                structure._productionQuantity = cashNextLevel;

                player.sendMessage(0, String.Format("&Structure upgraded, Next collection: {0}", structure._productionQuantity));
            }
            break;

            //3 More Info
            case 3:
            {
                player.sendMessage(0, String.Format("$Building Info:"));
                int repairCost = calculateRepairCost(structure._vehicle);
                player.sendMessage(0, String.Format("& --- Repair Cost: {0}", repairCost));
                player.sendMessage(0, String.Format("& --- Current Level: {0}", structure._productionLevel));
                player.sendMessage(0, String.Format("& --- Upgrade Cost for next level: {0} Iron", structure._upgradeCost));
                player.sendMessage(0, String.Format("& --- Next Collection amount: {0}", structure._productionQuantity));
                player.sendMessage(0, String.Format("& --- Next Level Collection amount: {0}", cashNextLevel));

                TimeSpan remaining = _baseScript.timeTo(structure._nextProduction.TimeOfDay);
                player.sendMessage(0, String.Format("Next collection ready in {0} Hour(s) & {1} minute(s)", remaining.Hours, remaining.Minutes));
            }
            break;

            //14 - Sell
            case 14:
            {
                player.inventoryModify(2026, structure._vehicle._type.DropItemQuantity);
                player.syncState();

                player.sendMessage(0, String.Format("&Structure sold ({0} Scrap added to your inventory)", structure._type.DropItemQuantity));

                structure.destroyed(structure._vehicle, player);
                structure._vehicle.destroy(false);
            }
            break;

            //15 - Repair
            case 15:
            {
                int repairCost = calculateRepairCost(structure._vehicle);

                if (player.getInventoryAmount(2026) < repairCost)
                {
                    player.sendMessage(-1, "I'm sorry, you don't have enough scrap metal to repair this building");
                    return(false);
                }

                structure._vehicle._state.health = (short)structure._vehicle._type.Hitpoints;

                player.inventoryModify(2026, -repairCost);
                player.sendMessage(0, "Structure repaired");
                player.syncState();
            }
            break;
            }
            return(false);
        }