Beispiel #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);
                    }
                }
            }
Beispiel #2
0
            public override void Process(CmdTrigger <C> trigger)
            {
                StringStream text = trigger.Text;

                if (!text.HasNext)
                {
                    trigger.Reply("Invalid arguments - " + this.CreateInfo(trigger));
                }
                else
                {
                    IExecutable executable1;
                    if (text.ConsumeNext('-'))
                    {
                        if (!text.HasNext)
                        {
                            trigger.Reply("Invalid arguments - " + this.CreateInfo(trigger));
                            return;
                        }

                        if (char.ToLower(text.Remainder[0]) == 'l')
                        {
                            ++text.Position;
                            string[] strArray = text.Remainder.Split(new char[1]
                            {
                                ' '
                            }, StringSplitOptions.RemoveEmptyEntries);
                            ToolMgr toolMgr = ((CommandMgr <C> .CallCommand) this.RootCmd).ToolMgr;
                            trigger.Reply("Callable functions ({0}):", (object)toolMgr.Executables.Count);
                            for (int index = 0; index < toolMgr.ExecutableList.Count; ++index)
                            {
                                IExecutable executable2 = toolMgr.ExecutableList[index];
                                if (strArray.Length != 0)
                                {
                                    bool flag = false;
                                    foreach (string str in strArray)
                                    {
                                        if (executable2.Name.IndexOf(str, StringComparison.InvariantCultureIgnoreCase) >
                                            -1)
                                        {
                                            flag = true;
                                            break;
                                        }
                                    }

                                    if (!flag)
                                    {
                                        continue;
                                    }
                                }

                                trigger.Reply(" {0}: {1}", (object)index, (object)executable2);
                            }

                            return;
                        }

                        uint num = text.NextUInt(uint.MaxValue);
                        executable1 = (long)num >= (long)this.ToolMgr.ExecutableList.Count
                            ? (IExecutable)null
                            : this.ToolMgr.ExecutableList[(int)num];
                    }
                    else
                    {
                        executable1 = this.ToolMgr.Get(text.NextWord());
                    }

                    if (executable1 == null)
                    {
                        trigger.Reply("Could not find specified Executable.");
                    }
                    else
                    {
                        int      length   = executable1.ParameterTypes.Length;
                        object[] objArray = new object[length];
                        object   obj      = (object)null;
                        for (int index = 0; index < length; ++index)
                        {
                            Type parameterType = executable1.ParameterTypes[index];
                            StringParser.Parse(index == length - 1 ? text.Remainder : text.NextWord(), parameterType,
                                               ref obj);
                            objArray[index] = obj;
                        }

                        executable1.Exec(objArray);
                    }
                }
            }