Esempio n. 1
0
 public GamePowerup(string packageName, GamePowerupType type, int amount, int cost)
 {
     this.PackageName = packageName;
     this.Type        = type;
     this.Amount      = amount;
     this.Cost        = cost;
 }
        public void Handle(BaseConnection connection, BinaryReader packet)
        {
            APIConnection api = connection as APIConnection;

            if (api != null && api.PrivateAPIUsable)
            {
                Dictionary <string, string> texts = new Dictionary <string, string>();
                byte textsCount = packet.ReadByte();
                for (byte i = 0; i < textsCount; i++)
                {
                    texts.Add(packet.ReadString(), packet.ReadString());
                }

                List <GamePowerup> gamePowerups = new List <GamePowerup>();
                byte gamePowerupsCount          = packet.ReadByte();
                for (byte i = 0; i < gamePowerupsCount; i++)
                {
                    string          packageName = packet.ReadString();
                    GamePowerupType type        = (GamePowerupType)packet.ReadByte();
                    int             amount      = packet.ReadInt32();
                    int             cost        = packet.ReadInt32();

                    gamePowerups.Add(new GamePowerup(packageName, type, amount, cost));
                }

                api.Hotel.Settings = new HotelSettings(texts, gamePowerups);
            }
        }
Esempio n. 3
0
        public void Handle(BaseConnection connection, BinaryReader packet)
        {
            APIConnection api = connection as APIConnection;

            if (api?.PrivateAPIUsable ?? false)
            {
                uint            userId      = packet.ReadUInt32();
                GamePowerupType powerupType = (GamePowerupType)packet.ReadByte();
                int             amount      = packet.ReadInt32();

                FastFoodUser user = api.Hotel.GetUser(userId);
                if (user != null)
                {
                    switch (powerupType)
                    {
                    case GamePowerupType.Missile:
                        user.Missiles = amount;
                        break;

                    case GamePowerupType.Parachute:
                        user.Parachutes = amount;
                        break;

                    case GamePowerupType.Shield:
                        user.Shields = amount;
                        break;
                    }

                    Dictionary <int, int> powerups = new Dictionary <int, int>();
                    if (user.Missiles > 0)
                    {
                        powerups.Add(UserPowerupsOutgoingPacket.Missile, user.Missiles);
                    }

                    if (user.Parachutes > 0)
                    {
                        powerups.Add(UserPowerupsOutgoingPacket.Parachute, user.Parachutes);
                    }

                    if (user.Shields > 0)
                    {
                        powerups.Add(UserPowerupsOutgoingPacket.Shield, user.Shields);
                    }

                    user.GameConnection?.SendPacket(new UserPowerupsOutgoingPacket(powerups));
                }
            }
        }
Esempio n. 4
0
 public UpdateUserPowerupCountOutgoingPacket(uint userId, GamePowerupType powerupType, int amount)
 {
     this.UserID      = userId;
     this.PowerupType = powerupType;
     this.Amount      = amount;
 }
 public PowerupGainedOutgoingPacket(GamePowerupType type, int amount)
 {
     this.Type   = type;
     this.Amount = amount;
 }