Exemple #1
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            var permissions = caller.GetPermissions();

            StringBuilder sb         = new StringBuilder(pluginInstance.Translate("Kits"));
            var           playerKits = pluginInstance.KitsCache.Where(kit => caller.IsAdmin ||
                                                                      permissions.Exists(x => x.Name.Equals("kit." + kit.Name, StringComparison.OrdinalIgnoreCase))).ToList();

            if (playerKits.Count < 1)
            {
                UnturnedChat.Say(caller, pluginInstance.Translate("NoKits"), pluginInstance.MessageColor);
                return;
            }

            foreach (var kit in playerKits)
            {
                string cooldownString = string.Empty;
                var    cooldown       = pluginInstance.Cooldowns.FirstOrDefault(x => x.Kit.Name == kit.Name && x.Player.Id == caller.Id);
                if (cooldown != null && cooldown.Timer.Enabled)
                {
                    cooldownString = "[" + (kit.Cooldown - (DateTime.Now - cooldown.TimeStarted).TotalSeconds).ToString("0") + "s]";
                }

                sb.Append($" {kit.Name}{cooldownString},");
            }

            UnturnedChat.Say(caller, sb.ToString().TrimEnd(','), pluginInstance.MessageColor);
        }
Exemple #2
0
 public static bool CheckPerms(IRocketPlayer caller, List <string> perms)
 {
     if (perms.Count > 0)
     {
         foreach (var i in perms)
         {
             foreach (var t in caller.GetPermissions())
             {
                 if (t.Name == i)
                 {
                     return(true);
                 }
             }
         }
     }
     else
     {
         return(true);
     }
     return(false);
 }
Exemple #3
0
        public void Execute(IRocketPlayer caller, string[] command)
        {
            UnturnedPlayer player = (UnturnedPlayer)caller;

            List <string> availableKits = new List <string>();
            List <Kit>    kits          = Kits.Instance.Configuration.Instance.Kits;

            // Gets all caller's permissions
            List <Permission> callerPerms = caller.GetPermissions().Distinct(new PermissionComparer()).ToList();

            foreach (var item in kits)
            {
                // Adds the kit if it's permission is contained in the caller's permission list
                if (callerPerms.Exists(x => x.Name == $"kit.{item.Name.ToLower()}"))
                {
                    availableKits.Add(item.Name);
                }
            }

            UnturnedChat.Say(caller, Kits.Instance.Translations.Instance.Translate("command_kits", String.Join(", ", availableKits.ToArray())));
        }
 public static bool PlayerHasPermission(IRocketPlayer caller, Restriction restriction)
 {
     return(caller.GetPermissions().Any(p =>
                                        string.Equals(p.Name, restriction.ID, StringComparison.CurrentCultureIgnoreCase)));
 }
Exemple #5
0
        public void Execute(IRocketPlayer caller, string[] msg)
        {
            bool console = (caller is ConsolePlayer);

            string[] permnames = { "shop.*", "shop.add", "shop.rem", "shop.chng", "shop.buy" };
            bool[]   perms     = { false, false, false, false, false };
            bool     anyuse    = false;
            string   message;

            foreach (Permission s in caller.GetPermissions())
            {
                switch (s.Name)
                {
                case "shop.*":
                    perms[0] = true;
                    anyuse   = true;
                    break;

                case "shop.add":
                    perms[1] = true;
                    anyuse   = true;
                    break;

                case "shop.rem":
                    perms[2] = true;
                    anyuse   = true;
                    break;

                case "shop.chng":
                    perms[3] = true;
                    anyuse   = true;
                    break;

                case "shop.buy":
                    perms[4] = true;
                    anyuse   = true;
                    break;

                case "*":
                    perms[0] = true;
                    perms[1] = true;
                    perms[2] = true;
                    perms[3] = true;
                    perms[4] = true;
                    anyuse   = true;
                    break;
                }
            }
            if (!console)
            {
                if (((UnturnedPlayer)caller).IsAdmin)
                {
                    perms[0] = true;
                    perms[1] = true;
                    perms[2] = true;
                    perms[3] = true;
                    perms[4] = true;
                    anyuse   = true;
                }
            }
            if (!anyuse)
            {
                // Assume this is a player
                UnturnedChat.Say(caller, "You don't have permission to use the /shop command.");
                return;
            }
            if (msg.Length == 0)
            {
                message = ZaupShop.Instance.Translate("shop_command_usage", new object[] {});
                // We are going to print how to use
                this.sendMessage(caller, message, console);
                return;
            }
            if (msg.Length < 2)
            {
                message = ZaupShop.Instance.Translate("no_itemid_given", new object[] {});
                this.sendMessage(caller, message, console);
                return;
            }
            if (msg.Length == 2 && msg[0] != "rem")
            {
                message = ZaupShop.Instance.Translate("no_cost_given", new object[] { });
                this.sendMessage(caller, message, console);
                return;
            }
            else if (msg.Length >= 2)
            {
                string[] type = Parser.getComponentsFromSerial(msg[1], '.');
                if (type.Length > 1 && type[0] != "v")
                {
                    message = ZaupShop.Instance.Translate("v_not_provided", new object[] { });
                    this.sendMessage(caller, message, console);
                    return;
                }
                ushort id;
                if (type.Length > 1)
                {
                    if (!ushort.TryParse(type[1], out id))
                    {
                        message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                        this.sendMessage(caller, message, console);
                        return;
                    }
                }
                else
                {
                    if (!ushort.TryParse(type[0], out id))
                    {
                        message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                        this.sendMessage(caller, message, console);
                        return;
                    }
                }
                // All basic checks complete.  Let's get down to business.
                bool success = false;
                bool change  = false;
                bool pass    = false;
                switch (msg[0])
                {
                case "chng":
                    if (!perms[3] && !perms[0])
                    {
                        message = ZaupShop.Instance.Translate("no_permission_shop_chng", new object[] { });
                        this.sendMessage(caller, message, console);
                        return;
                    }
                    change = true;
                    pass   = true;
                    goto case "add";

                case "add":
                    if (!pass)
                    {
                        if (!perms[1] && !perms[0])
                        {
                            message = ZaupShop.Instance.Translate("no_permission_shop_add", new object[] { });
                            this.sendMessage(caller, message, console);
                            return;
                        }
                    }
                    string ac = (pass) ? ZaupShop.Instance.Translate("changed", new object[] { }) : ZaupShop.Instance.Translate("added", new object[] { });
                    switch (type[0])
                    {
                    case "v":
                        if (!this.IsAsset(id, "v"))
                        {
                            message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                            this.sendMessage(caller, message, console);
                            return;
                        }
                        VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id);
                        message = ZaupShop.Instance.Translate("changed_or_added_to_shop", new object[] {
                            ac,
                            va.Name,
                            msg[2]
                        });
                        success = ZaupShop.Instance.ShopDB.AddVehicle((int)id, va.Name, decimal.Parse(msg[2]), change);
                        if (!success)
                        {
                            message = ZaupShop.Instance.Translate("error_adding_or_changing", new object[] { va.Name });
                        }
                        this.sendMessage(caller, message, console);
                        break;

                    default:
                        if (!this.IsAsset(id, "i"))
                        {
                            message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                            this.sendMessage(caller, message, console);
                            return;
                        }
                        ItemAsset ia = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                        message = ZaupShop.Instance.Translate("changed_or_added_to_shop", new object[] {
                            ac,
                            ia.Name,
                            msg[2]
                        });
                        success = ZaupShop.Instance.ShopDB.AddItem((int)id, ia.Name, decimal.Parse(msg[2]), change);
                        if (!success)
                        {
                            message = ZaupShop.Instance.Translate("error_adding_or_changing", new object[] { ia.Name });
                        }
                        this.sendMessage(caller, message, console);
                        break;
                    }
                    break;

                case "rem":
                    if (!perms[2] && !perms[0])
                    {
                        message = ZaupShop.Instance.Translate("no_permission_shop_rem", new object[] { });
                        this.sendMessage(caller, message, console);
                        return;
                    }
                    switch (type[0])
                    {
                    case "v":
                        if (!this.IsAsset(id, "v"))
                        {
                            message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                            this.sendMessage(caller, message, console);
                            return;
                        }
                        VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id);
                        message = ZaupShop.Instance.Translate("removed_from_shop", new object[] { va.Name });
                        success = ZaupShop.Instance.ShopDB.DeleteVehicle((int)id);
                        if (!success)
                        {
                            message = ZaupShop.Instance.Translate("not_in_shop_to_remove", new object[] { va.Name });
                        }
                        this.sendMessage(caller, message, console);
                        break;

                    default:
                        if (!this.IsAsset(id, "i"))
                        {
                            message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                            this.sendMessage(caller, message, console);
                            return;
                        }
                        ItemAsset ia = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                        message = ZaupShop.Instance.Translate("removed_from_shop", new object[] { ia.Name });
                        success = ZaupShop.Instance.ShopDB.DeleteItem((int)id);
                        if (!success)
                        {
                            message = ZaupShop.Instance.Translate("not_in_shop_to_remove", new object[] { ia.Name });
                        }
                        this.sendMessage(caller, message, console);
                        break;
                    }
                    break;

                case "buy":
                    if (!perms[4] && !perms[0])
                    {
                        message = ZaupShop.Instance.Translate("no_permission_shop_buy", new object[] { });
                        this.sendMessage(caller, message, console);
                        return;
                    }
                    if (!this.IsAsset(id, "i"))
                    {
                        message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                        this.sendMessage(caller, message, console);
                        return;
                    }
                    ItemAsset iab = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                    decimal   buyb;
                    decimal.TryParse(msg[2], out buyb);
                    message = ZaupShop.Instance.Translate("set_buyback_price", new object[] {
                        iab.Name,
                        buyb.ToString()
                    });
                    success = ZaupShop.Instance.ShopDB.SetBuyPrice((int)id, buyb);
                    if (!success)
                    {
                        message = ZaupShop.Instance.Translate("not_in_shop_to_buyback", new object[] { iab.Name });
                    }
                    this.sendMessage(caller, message, console);
                    break;

                default:
                    // We shouldn't get this, but if we do send an error.
                    message = ZaupShop.Instance.Translate("not_in_shop_to_remove", new object[] { });;
                    this.sendMessage(caller, message, console);
                    return;
                }
            }
        }
        // Token: 0x06000020 RID: 32 RVA: 0x00002188 File Offset: 0x00000388
        public void Execute(IRocketPlayer caller, string[] msg)
        {
            bool flag = caller is ConsolePlayer;

            string[] array = new string[]
            {
                "shop.*",
                "shop.add",
                "shop.rem",
                "shop.chng",
                "shop.buy"
            };
            bool[] array2 = new bool[5];
            bool   flag2  = false;

            foreach (var name in caller.GetPermissions().Select(permission => permission.Name)
                     .Where(name => name != null))
            {
                if (name != "shop.*")
                {
                    if (name != "shop.add")
                    {
                        if (name != "shop.rem")
                        {
                            if (name != "shop.chng")
                            {
                                if (name != "shop.buy")
                                {
                                    if (name == "*")
                                    {
                                        array2[0] = true;
                                        array2[1] = true;
                                        array2[2] = true;
                                        array2[3] = true;
                                        array2[4] = true;
                                        flag2     = true;
                                    }
                                }
                                else
                                {
                                    array2[4] = true;
                                    flag2     = true;
                                }
                            }
                            else
                            {
                                array2[3] = true;
                                flag2     = true;
                            }
                        }
                        else
                        {
                            array2[2] = true;
                            flag2     = true;
                        }
                    }
                    else
                    {
                        array2[1] = true;
                        flag2     = true;
                    }
                }
                else
                {
                    array2[0] = true;
                    flag2     = true;
                }
            }

            if (!flag && ((UnturnedPlayer)caller).IsAdmin)
            {
                array2[0] = true;
                array2[1] = true;
                array2[2] = true;
                array2[3] = true;
                array2[4] = true;
                flag2     = true;
            }

            if (!flag2)
            {
                UnturnedChat.Say(caller, "You don't have permission to use the /shop command.");
                return;
            }

            if (msg.Length == 0)
            {
                string message = ZaupShop.Instance.Translate("shop_command_usage");
                sendMessage(caller, message, flag);
                return;
            }

            if (msg.Length < 2)
            {
                string message = ZaupShop.Instance.Translate("no_itemid_given");
                sendMessage(caller, message, flag);
                return;
            }

            if (msg.Length == 2 && msg[0] != "rem")
            {
                string message = ZaupShop.Instance.Translate("no_cost_given");
                sendMessage(caller, message, flag);
                return;
            }

            if (msg.Length >= 2)
            {
                string[] componentsFromSerial = Parser.getComponentsFromSerial(msg[1], '.');
                string   message;
                if (componentsFromSerial.Length > 1 && componentsFromSerial[0] != "v")
                {
                    message = ZaupShop.Instance.Translate("v_not_provided");
                    sendMessage(caller, message, flag);
                    return;
                }

                ushort num;
                if (componentsFromSerial.Length > 1)
                {
                    if (!ushort.TryParse(componentsFromSerial[1], out num))
                    {
                        message = ZaupShop.Instance.Translate("invalid_id_given");
                        sendMessage(caller, message, flag);
                        return;
                    }
                }
                else if (!ushort.TryParse(componentsFromSerial[0], out num))
                {
                    message = ZaupShop.Instance.Translate("invalid_id_given");
                    sendMessage(caller, message, flag);
                    return;
                }

                bool   change = false;
                bool   flag3  = false;
                string text   = msg[0];
                if (text != null)
                {
                    if (!(text == "chng"))
                    {
                        if (!(text == "add"))
                        {
                            if (!(text == "rem"))
                            {
                                if (!(text == "buy"))
                                {
                                    goto IL_85B;
                                }

                                if (!array2[4] && !array2[0])
                                {
                                    message = ZaupShop.Instance.Translate("no_permission_shop_buy");
                                    sendMessage(caller, message, flag);
                                    return;
                                }

                                if (!IsAsset(num, "i"))
                                {
                                    message = ZaupShop.Instance.Translate("invalid_id_given");
                                    sendMessage(caller, message, flag);
                                    return;
                                }

                                ItemAsset itemAsset = (ItemAsset)Assets.find((EAssetType)1, num);
                                decimal   cost;
                                decimal.TryParse(msg[2], out cost);
                                message = ZaupShop.Instance.Translate("set_buyback_price", itemAsset.itemName, cost.ToString());
                                if (!ZaupShop.Instance.ShopDB.SetBuyPrice(num, cost))
                                {
                                    message = ZaupShop.Instance.Translate("not_in_shop_to_buyback", itemAsset.itemName);
                                }

                                sendMessage(caller, message, flag);
                                return;
                            }
                            else
                            {
                                if (!array2[2] && !array2[0])
                                {
                                    message = ZaupShop.Instance.Translate("no_permission_shop_rem");
                                    sendMessage(caller, message, flag);
                                    return;
                                }

                                string text2 = componentsFromSerial[0];
                                if (text2 != null)
                                {
                                    if (text2 == "v")
                                    {
                                        if (!IsAsset(num, "v"))
                                        {
                                            message = ZaupShop.Instance.Translate("invalid_id_given");
                                            sendMessage(caller, message, flag);
                                            return;
                                        }

                                        VehicleAsset vehicleAsset = (VehicleAsset)Assets.find((EAssetType)5, num);
                                        message = ZaupShop.Instance.Translate("removed_from_shop", vehicleAsset.vehicleName);
                                        if (!ZaupShop.Instance.ShopDB.DeleteVehicle(num))
                                        {
                                            message = ZaupShop.Instance.Translate("not_in_shop_to_remove", vehicleAsset.vehicleName);
                                        }

                                        sendMessage(caller, message, flag);
                                        goto IL_759;
                                    }
                                }

                                if (!IsAsset(num, "i"))
                                {
                                    message = ZaupShop.Instance.Translate("invalid_id_given");
                                    sendMessage(caller, message, flag);
                                    return;
                                }

                                ItemAsset itemAsset2 = (ItemAsset)Assets.find((EAssetType)1, num);
                                message = ZaupShop.Instance.Translate("removed_from_shop", itemAsset2.itemName);
                                if (!ZaupShop.Instance.ShopDB.DeleteItem(num))
                                {
                                    message = ZaupShop.Instance.Translate("not_in_shop_to_remove", itemAsset2.itemName);
                                }

                                sendMessage(caller, message, flag);
IL_759:
                                return;
                            }
                        }
                    }
                    else
                    {
                        if (!array2[3] && !array2[0])
                        {
                            message = ZaupShop.Instance.Translate("no_permission_shop_chng");
                            sendMessage(caller, message, flag);
                            return;
                        }

                        change = true;
                        flag3  = true;
                    }

                    if (!flag3 && !array2[1] && !array2[0])
                    {
                        message = ZaupShop.Instance.Translate("no_permission_shop_add");
                        sendMessage(caller, message, flag);
                        return;
                    }

                    string text3 = (!flag3)
                        ? ZaupShop.Instance.Translate("added")
                        : ZaupShop.Instance.Translate("changed");
                    string text4 = componentsFromSerial[0];
                    if (text4 != null)
                    {
                        if (text4 == "v")
                        {
                            if (!IsAsset(num, "v"))
                            {
                                message = ZaupShop.Instance.Translate("invalid_id_given");
                                sendMessage(caller, message, flag);
                                return;
                            }

                            VehicleAsset vehicleAsset2 = (VehicleAsset)Assets.find((EAssetType)5, num);
                            message = ZaupShop.Instance.Translate("changed_or_added_to_shop", text3, vehicleAsset2.vehicleName, msg[2]);
                            if (!ZaupShop.Instance.ShopDB.AddVehicle(num, vehicleAsset2.vehicleName,
                                                                     decimal.Parse(msg[2]), change))
                            {
                                message = ZaupShop.Instance.Translate("error_adding_or_changing", vehicleAsset2.vehicleName);
                            }

                            sendMessage(caller, message, flag);
                            goto IL_5A3;
                        }
                    }

                    if (!IsAsset(num, "i"))
                    {
                        message = ZaupShop.Instance.Translate("invalid_id_given");
                        sendMessage(caller, message, flag);
                        return;
                    }

                    ItemAsset itemAsset3 = (ItemAsset)Assets.find((EAssetType)1, num);
                    message = ZaupShop.Instance.Translate("changed_or_added_to_shop", text3, itemAsset3.itemName, msg[2]);
                    if (!ZaupShop.Instance.ShopDB.AddItem(num, itemAsset3.itemName, decimal.Parse(msg[2]),
                                                          change))
                    {
                        message = ZaupShop.Instance.Translate("error_adding_or_changing", itemAsset3.itemName);
                    }

                    sendMessage(caller, message, flag);
IL_5A3:
                    return;
                }

IL_85B:
                message = ZaupShop.Instance.Translate("not_in_shop_to_remove");
                sendMessage(caller, message, flag);
                return;
            }
        }
Exemple #7
0
 public void Execute(IRocketPlayer caller, string[] msg)
 {
     bool console = (caller is ConsolePlayer);
     string[] permnames = { "shop.*", "shop.add", "shop.rem", "shop.chng", "shop.buy" };
     bool[] perms = { false, false, false, false, false };
     bool anyuse = false;
     string message;
     foreach (Permission s in caller.GetPermissions())
     {
         switch (s.Name)
         {
             case "shop.*":
                 perms[0] = true;
                 anyuse = true;
                 break;
             case "shop.add":
                 perms[1] = true;
                 anyuse = true;
                 break;
             case "shop.rem":
                 perms[2] = true;
                 anyuse = true;
                 break;
             case "shop.chng":
                 perms[3] = true;
                 anyuse = true;
                 break;
             case "shop.buy":
                 perms[4] = true;
                 anyuse = true;
                 break;
             case "*":
                 perms[0] = true;
                 perms[1] = true;
                 perms[2] = true;
                 perms[3] = true;
                 perms[4] = true;
                 anyuse = true;
                 break;
         }
     }
     if (!console)
     {
         if (((UnturnedPlayer)caller).IsAdmin)
         {
             perms[0] = true;
             perms[1] = true;
             perms[2] = true;
             perms[3] = true;
             perms[4] = true;
             anyuse = true;
         }
     }
     if (!anyuse)
     {
         // Assume this is a player
         UnturnedChat.Say(caller, "You don't have permission to use the /shop command.");
         return;
     }
     if (msg.Length == 0)
     {
         message = ZaupShop.Instance.Translate("shop_command_usage", new object[] {});
         // We are going to print how to use
         this.sendMessage(caller, message, console);
         return;
     }
     if (msg.Length < 2)
     {
         message = ZaupShop.Instance.Translate("no_itemid_given", new object[] {});
         this.sendMessage(caller, message, console);
         return;
     }
     if (msg.Length == 2 && msg[0] != "rem")
     {
         message = ZaupShop.Instance.Translate("no_cost_given", new object[] { });
         this.sendMessage(caller, message, console);
         return;
     }
     else if (msg.Length >= 2)
     {
         string[] type = Parser.getComponentsFromSerial(msg[1], '.');
         if (type.Length > 1 && type[0] != "v")
         {
             message = ZaupShop.Instance.Translate("v_not_provided", new object[] { });
             this.sendMessage(caller, message, console);
             return;
         }
         ushort id;
         if (type.Length > 1)
         {
             if (!ushort.TryParse(type[1], out id)) {
                 message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                 this.sendMessage(caller, message, console);
                 return;
             }
         } else {
             if (!ushort.TryParse(type[0], out id))
             {
                 message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                 this.sendMessage(caller, message, console);
                 return;
             }
         }
         // All basic checks complete.  Let's get down to business.
         bool success = false;
         bool change = false;
         bool pass = false;
         switch (msg[0])
         {
             case "chng":
                 if (!perms[3] && !perms[0])
                 {
                     message = ZaupShop.Instance.Translate("no_permission_shop_chng", new object[] { });
                     this.sendMessage(caller, message, console);
                     return;
                 }
                 change = true;
                 pass = true;
                 goto case "add";
             case "add":
                 if (!pass)
                 {
                     if (!perms[1] && !perms[0])
                     {
                         message = ZaupShop.Instance.Translate("no_permission_shop_add", new object[] { });
                         this.sendMessage(caller, message, console);
                         return;
                     }
                 }
                 string ac = (pass) ? ZaupShop.Instance.Translate("changed", new object[] { }) : ZaupShop.Instance.Translate("added", new object[] { });
                 switch (type[0])
                 {
                     case "v":
                         if (!this.IsAsset(id, "v"))
                         {
                             message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                             this.sendMessage(caller, message, console);
                             return;
                         }
                         VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id);
                         message = ZaupShop.Instance.Translate("changed_or_added_to_shop", new object[] {
                             ac,
                             va.Name,
                             msg[2]
                         });
                         success = ZaupShop.Instance.ShopDB.AddVehicle((int)id, va.Name, decimal.Parse(msg[2]), change);
                         if (!success)
                         {
                             message = ZaupShop.Instance.Translate("error_adding_or_changing", new object[] { va.Name });
                         }
                         this.sendMessage(caller, message, console);
                         break;
                     default:
                         if (!this.IsAsset(id, "i"))
                         {
                             message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                             this.sendMessage(caller, message, console);
                             return;
                         }
                         ItemAsset ia = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                         message = ZaupShop.Instance.Translate("changed_or_added_to_shop", new object[] {
                             ac,
                             ia.Name,
                             msg[2]
                         });
                         success = ZaupShop.Instance.ShopDB.AddItem((int)id, ia.Name, decimal.Parse(msg[2]), change);
                         if (!success)
                         {
                             message = ZaupShop.Instance.Translate("error_adding_or_changing", new object[] { ia.Name });
                         }
                         this.sendMessage(caller, message, console);
                         break;
                 }
                 break;
             case "rem":
                 if (!perms[2] && !perms[0])
                 {
                     message = ZaupShop.Instance.Translate("no_permission_shop_rem", new object[] { });
                     this.sendMessage(caller, message, console);
                     return;
                 }
                 switch (type[0])
                 {
                     case "v":
                         if (!this.IsAsset(id, "v"))
                         {
                             message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                             this.sendMessage(caller, message, console);
                             return;
                         }
                         VehicleAsset va = (VehicleAsset)Assets.find(EAssetType.VEHICLE, id);
                         message = ZaupShop.Instance.Translate("removed_from_shop", new object[] { va.Name });
                         success = ZaupShop.Instance.ShopDB.DeleteVehicle((int)id);
                         if (!success)
                         {
                             message = ZaupShop.Instance.Translate("not_in_shop_to_remove", new object[] { va.Name });
                         }
                         this.sendMessage(caller, message, console);
                         break;
                     default:
                         if (!this.IsAsset(id, "i"))
                         {
                             message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                             this.sendMessage(caller, message, console);
                             return;
                         }
                         ItemAsset ia = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                         message = ZaupShop.Instance.Translate("removed_from_shop", new object[] { ia.Name });
                         success = ZaupShop.Instance.ShopDB.DeleteItem((int)id);
                         if (!success)
                         {
                             message = ZaupShop.Instance.Translate("not_in_shop_to_remove", new object[] { ia.Name });
                         }
                         this.sendMessage(caller, message, console);
                         break;
                 }
                 break;
             case "buy":
                 if (!perms[4] && !perms[0])
                 {
                     message = ZaupShop.Instance.Translate("no_permission_shop_buy", new object[] { });
                     this.sendMessage(caller, message, console);
                     return;
                 }
                 if (!this.IsAsset(id, "i"))
                 {
                     message = ZaupShop.Instance.Translate("invalid_id_given", new object[] { });
                     this.sendMessage(caller, message, console);
                     return;
                 }
                 ItemAsset iab = (ItemAsset)Assets.find(EAssetType.ITEM, id);
                 decimal buyb;
                 decimal.TryParse(msg[2], out buyb);
                 message = ZaupShop.Instance.Translate("set_buyback_price", new object[] {
                     iab.Name,
                     buyb.ToString()
                 });
                 success = ZaupShop.Instance.ShopDB.SetBuyPrice((int)id, buyb);
                 if (!success)
                 {
                     message = ZaupShop.Instance.Translate("not_in_shop_to_buyback", new object[] { iab.Name });
                 }
                 this.sendMessage(caller, message, console);
                 break;
             default:
                 // We shouldn't get this, but if we do send an error.
                 message = ZaupShop.Instance.Translate("not_in_shop_to_remove", new object[] { });;
                 this.sendMessage(caller, message, console);
                 return;
         }
     }
 }