示例#1
0
        /// <summary>
        /// called to add the procs to the database
        /// </summary>
        private static void AddProcs()
        {
            for (int i = 0; i < m_IDS.Length; i++)
            {
                RefundProcs proc = new RefundProcs();

                proc.ProcID   = m_IDS[i];
                proc.BPAmount = PROC_BP_AMOUNT;

                GameServer.Database.AddNewObject(proc);
            }
        }
示例#2
0
        public int OnCommand(GameClient client, string[] args)
        {
            if (args.Length == 1)
            {
                DisplaySyntax(client);
                return(0);
            }

            switch (args[1])
            {
            case "item":
            {
                if (args.Length < 5)
                {
                    DisplaySyntax(client);
                    return(0);
                }

                ItemTemplate temp = (ItemTemplate)(GameServer.Database.SelectObject(typeof(ItemTemplate), "Id_Nb = '" + args[3] + "'"));

                if (temp == null)
                {
                    DisplayMessage(client, "Itemtemplate not found");
                    return(0);
                }
                if (temp.Name != args[2])
                {
                    DisplayMessage(client, "Itemname does not match Templatename");
                    return(0);
                }

                RefundItem item = new RefundItem();

                item.ItemName = args[2];
                item.ID_NB    = args[3];
                try
                {
                    item.BPAmount = Convert.ToInt32(args[4]);
                }
                catch (Exception)
                {
                    DisplayMessage(client, "Please enter a valid number");
                    return(0);
                }

                DisplayMessage(client, "Refunditem added to database");
                GameServer.Database.SaveObject(item);
            }
            break;

            case "proc":
            {
                if (args.Length < 4)
                {
                    DisplaySyntax(client);
                    return(0);
                }

                RefundProcs proc = new RefundProcs();

                try
                {
                    proc.ProcID   = Convert.ToInt32(args[2]);
                    proc.BPAmount = Convert.ToInt32(args[3]);
                }
                catch (Exception)
                {
                    DisplayMessage(client, "Please enter a valid number");
                    return(0);
                }

                DisplayMessage(client, "Refundproc added to database");
                GameServer.Database.SaveObject(proc);
            }
            break;
            }

            return(0);
        }