예제 #1
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                StringStream      text           = trigger.Text;
                string            str            = text.NextModifiers();
                List <ItemRecord> itemRecordList = new List <ItemRecord>();
                uint cod   = 0;
                uint money = 0;

                if (str.Contains("i"))
                {
                    ItemTemplate template = ItemMgr.GetTemplate(trigger.Text.NextEnum(Asda2ItemId.None));
                    if (template == null)
                    {
                        trigger.Reply("Invalid ItemId.");
                        return;
                    }

                    ItemRecord record = ItemRecord.CreateRecord(template);
                    itemRecordList.Add(record);
                    record.SaveLater();
                }

                if (str.Contains("c"))
                {
                    cod = text.NextUInt();
                }
                string recipientName = trigger.Text.NextWord();

                if (recipientName.Length == 0)
                {
                    trigger.Reply("Could not send mail - Unknown Recipient: " + recipientName);
                }
                else
                {
                    string    subject   = trigger.Text.NextWord(",");
                    string    remainder = trigger.Text.Remainder;
                    MailError mailError = MailMgr.SendMail(recipientName, subject, remainder, MailStationary.GM,
                                                           itemRecordList, money, cod, trigger.Args.User);
                    if (mailError == MailError.OK)
                    {
                        trigger.Reply("Done.");
                    }
                    else
                    {
                        trigger.Reply("Could not send mail: " + mailError);
                    }
                }
            }