Example #1
0
 private void ProcessItem(MapClient client, string args)
 {
     if (args == "")
     {
         client.SendSystemMessage(LocalManager.Instance.Strings.ATCOMMAND_ITEM_PARA);
     }
     else
     {
         try
         {
             uint id   = uint.Parse(args);
             Item item = ItemFactory.Instance.GetItem(id);
             if (item != null)
             {
                 InventoryAddResult result = client.Character.Inventory.AddItem(ContainerType.BODY, item);
                 client.SendItemAdd(item, ContainerType.BODY, result, 1);
             }
             else
             {
                 client.SendSystemMessage(LocalManager.Instance.Strings.ATCOMMAND_ITEM_NO_SUCH_ITEM);
             }
         }
         catch (Exception) { }
     }
 }
Example #2
0
        public bool ProcessCommand(MapClient client, string command)
        {
            try
            {
                string[] args = command.Split(" ".ToCharArray(), 2);
                args[0] = args[0].ToLower();

                if (this.commandTable.ContainsKey(args[0]))
                {
                    CommandInfo cInfo = this.commandTable[args[0]];

                    if (client.Character.Account.GMLevel >= cInfo.level)
                    {
                        if (args.Length == 2)
                        {
                            cInfo.func(client, args[1]);
                        }
                        else
                        {
                            cInfo.func(client, "");
                        }
                    }
                    else
                    {
                        client.SendSystemMessage(LocalManager.Instance.Strings.ATCOMMAND_NO_ACCESS);
                    }

                    return(true);
                }
            }
            catch (Exception e) { Logger.ShowError(e, null); }

            return(false);
        }