Example #1
0
 public bool playerMakeVehicle(Player player, ItemInfo.VehicleMaker item, short posX, short posY)
 {
     return(true);
 }
Example #2
0
 /// <summary>
 /// Triggered when a player attempts to use a vehicle creator
 /// </summary>
 public virtual void handlePlayerMakeVehicle(Player player, ItemInfo.VehicleMaker item, short posX, short posY)
 {
 }
Example #3
0
        public bool playerMakeVehicle(Player player, ItemInfo.VehicleMaker item, short posX, short posY)
        {
            int     count    = _arena.Vehicles.Count(veh => veh._type.Id == item.vehicleID);
            bool    bSuccess = false;
            VehInfo vehicle  = AssetManager.Manager.getVehicleByID(item.vehicleID);

            switch (item.vehicleID)
            {
            //Command Center
            case 414:
            {
                if (count > 0)
                {
                    player.sendMessage(-1, "You may only have one active Command Center.");
                    player.syncState();
                    bSuccess = false;
                }
                else if (!canBuildInArea(posX, posY, vehicle.PhysicalRadius))
                {
                    player.sendMessage(-1, "Cannot construct building, Cannot construct buildings that close to eachother.");
                    bSuccess = false;
                }
                else
                {
                    //Building!
                    bSuccess = true;
                }
            }
            break;

            //Power Station
            case 423:
            {
                if (!canBuildInArea(posX, posY, vehicle.PhysicalRadius))
                {
                    player.sendMessage(-1, "Cannot construct building, Cannot construct buildings that close to eachother.");
                    bSuccess = false;
                }
                else
                {
                    //Building!
                    bSuccess = true;
                }
            }
            break;

            //Catch all
            default:
            {
                if (!canBuildInArea(posX, posY, vehicle.PhysicalRadius))
                {
                    player.sendMessage(-1, "Cannot construct building, Cannot construct buildings that close to eachother.");
                    bSuccess = false;
                }
                else if (!powerStationInArea(posX, posY))
                {
                    player.sendMessage(-1, "Cannot construct building, too far from a power station.");
                    bSuccess = false;
                }
                else
                {
                    //Building...
                    bSuccess = true;
                }
            }
            break;
            }
            //Give them back their kit if it failed.
            if (!bSuccess)
            {
                player.inventoryModify(item, 1);
            }

            return(bSuccess);
        }
Example #4
0
        public bool playerMakeVehicle(Player player, ItemInfo.VehicleMaker item, short posX, short posY)
        {
            int       count         = _arena.Vehicles.Count(veh => veh._type.Id == item.vehicleID);
            int       totalCount    = _structures.Count;
            bool      bSuccess      = false;
            VehInfo   vehicle       = AssetManager.Manager.getVehicleByID(item.vehicleID);
            Structure commandCenter = _structures.Values.FirstOrDefault(st => st._vehicle._type.Id == 414);

            //Max Structures?
            if (totalCount >= c_maxStructures)
            {
                player.sendMessage(-1, "You have met or exceeded the maximum amount of structures allowed. " +
                                   "To build more, you must sell another building");

                player.inventoryModify(item, 1);
                return(false);
            }

            //Do we have a command center even?
            if (commandCenter == null && item.vehicleID != 414)
            {
                player.sendMessage(-1, "You currently do not have a active Command Center, please build one to continue..");
                player.inventoryModify(item, 1);
                return(false);
            }

            switch (item.vehicleID)
            {
            //Command Center
            case 414:
            {
                if (count > 0)
                {
                    player.sendMessage(-1, "You may only have one active Command Center.");
                    player.syncState();
                    bSuccess = false;
                }
                else if (!isAreaOpen(posX, posY, vehicle.PhysicalRadius))
                {
                    player.sendMessage(-1, "Cannot construct building, Cannot construct buildings that close to eachother.");
                    bSuccess = false;
                }
                else
                {
                    //Building!
                    bSuccess = true;
                }
            }
            break;

            //Power Station
            case 423:
            {
                if (!isAreaOpen(posX, posY, vehicle.PhysicalRadius))
                {
                    player.sendMessage(-1, "Cannot construct building, Cannot construct buildings that close to eachother.");
                    bSuccess = false;
                }
                else
                {
                    //Building!
                    bSuccess = true;
                }
            }
            break;

            //House
            case 424:
            {
                int maxCount = commandCenter._productionLevel * 4;
                if (count == maxCount)
                {
                    player.sendMessage(-1, "You must upgrade your command center before you may build more of this building");
                    bSuccess = false;
                }
                else
                {
                    bSuccess = canBuildInArea(player, vehicle);
                }
            }
            break;

            //Iron Mine
            case 427:
            {
                int maxCount = commandCenter._productionLevel * 3;
                if (count == maxCount)
                {
                    player.sendMessage(-1, "You must upgrade your command center before you may build more of this building");
                    bSuccess = false;
                }
                else
                {
                    bSuccess = canBuildInArea(player, vehicle);
                }
            }
            break;

            //Scrapyard
            case 428:
            {
                int maxCount = commandCenter._productionLevel * 3;
                if (count == maxCount)
                {
                    player.sendMessage(-1, "You must upgrade your command center before you may build more of this building");
                    bSuccess = false;
                }
                else
                {
                    bSuccess = canBuildInArea(player, vehicle);
                }
            }
            break;

            //Villa
            case 425:
            {
                int maxCount = commandCenter._productionLevel * 4;
                if (count == maxCount)
                {
                    player.sendMessage(-1, "You must upgrade your command center before you may build more of this building");
                    bSuccess = false;
                }
                else
                {
                    bSuccess = canBuildInArea(player, vehicle);
                }
            }
            break;

            //Shack
            case 415:
            {
                int maxCount = commandCenter._productionLevel * 4;
                if (count == maxCount)
                {
                    player.sendMessage(-1, "You must upgrade your command center before you may build more of this building");
                    bSuccess = false;
                }
                else
                {
                    bSuccess = canBuildInArea(player, vehicle);
                }
            }
            break;

            //Catch all
            default:
            {
                bSuccess = canBuildInArea(player, vehicle);
            }
            break;
            }
            //Give them back their kit if it failed.
            if (!bSuccess)
            {
                player.inventoryModify(item, 1);
            }

            return(bSuccess);
        }