コード例 #1
0
        public static void Spawn(SharpBridge.Player player, object[] param)
        {
            uint weapon = (uint)param[0];

            if (weapon < 1 || weapon == 6 || weapon == 8 || weapon > 18)
            {
                player.sendMsg($"Weapon {weapon} is invalid. Use 1-5, 7, 9-18", ChatColor.ERROR);
                return;
            }

            Models.ItemTypesEF wClass = Game.ItemTypesManager.GetWeaponFromGameWeapon((byte)weapon);
            if (wClass == null)
            {
                player.sendMsg($"Not a database weapon", ChatColor.ERROR);
                return;
            }

            Game.Account acc = Game.AccountManager.Get(player.getID());
            acc.insertItem((short)weapon, 1, false);
            acc.insertItem(wClass.weapon.ammoItem, 200);

            Models.ItemEF bullets = acc.getItem(wClass.weapon.ammoItem);
            if (bullets == null)
            {
                return;                  //Overkill almost
            }
            player.giveWeapon(weapon, (uint)bullets.amount);
        }
コード例 #2
0
        //Skins 1-2 have the most variations for this command
        public static void ChangeProperty(SharpBridge.Player player, object[] param)
        {
            uint id = (uint)param[0];

            if (id < 1 || id > 2)
            {
                player.sendMsg($"{id} is not a valid property, use 1-2", ChatColor.ERROR);
                return;
            }

            uint variation = (uint)param[1];

            if (id < 1 || id > 100)
            {
                player.sendMsg($"{variation} is not a valid variation, use 1-100", ChatColor.ERROR);
                return;
            }
            player.setProperty(id - 1, variation - 1);
        }
コード例 #3
0
        public static void ChangeSkin(SharpBridge.Player player, object[] param)
        {
            uint id = (uint)param[0];

            if (id > 350)
            {
                player.sendMsg($"{id} is not a valid skin ID", ChatColor.ERROR);
                return;
            }
            player.setSkinId(id);
        }
コード例 #4
0
        public static void processCommand(int playerid, ref string cmd)
        {
            SharpBridge.Player player = SharpBridge.Entities.getPlayer(playerid);
            if (player == null)
            {
                return;
            }

            string[] s = cmd.ToLower().Split(' ');
            if (!CommandsManager.commands.ContainsKey(s[0]))
            {
                player.sendMsg($"'{s[0]}' is an invalid command", ChatColor.ERROR);
                return;
            }

            Command command = CommandsManager.commands[s[0]];

            if (command.loggedIn != Game.AccountManager.IsOnline(playerid))
            {
                player.sendMsg(command.loggedIn ? "You must /login first" : "You are already logged in", ChatColor.ERROR);
                return;
            }

            if (command.args == null)
            {
                command.command(player, null); //No need to check
                return;
            }

            object[] obj = new object[command.args.Length];
            try
            {
                for (int i = 0; i < command.args.Length; i++)
                {
                    char c = command.args[i];
                    if (c == 's')
                    {
                        obj[i] = s[i + 1];
                    }
                    else if (c == 'i')
                    {
                        obj[i] = Int32.Parse(s[i + 1]);
                    }
                    else if (c == 'u')
                    {
                        obj[i] = UInt32.Parse(s[i + 1]);
                    }
                    else if (c == 'f')
                    {
                        obj[i] = float.Parse(s[i + 1]);
                    }
                }
                //Invoke command
            }
            catch (Exception)
            {
                //Command parsing failed, show usage
                player.sendMsg(command.usage, ChatColor.ERROR);
                return;
            }
            command.command(player, obj);
        }
コード例 #5
0
 public static void SaveSkin(SharpBridge.Player player, object[] param)
 {
     Game.AccountManager.Get(player.getID()).updateClothes(player);
     player.sendMsg("Saved!", ChatColor.SUCCESS);
 }