Example #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            int type, index;

            if (SplitButtonID(info.ButtonID, 1, out type, out index))
            {
                switch (type)
                {
                case 0:
                {
                    if (index < BaseCommandImplementor.Implementors.Count)
                    {
                        BaseCommandImplementor impl = BaseCommandImplementor.Implementors[index];

                        if (m_From.AccessLevel >= impl.AccessLevel)
                        {
                            m_Batch.Scope = impl;
                        }
                    }

                    break;
                }
                }
            }

            m_From.SendGump(new BatchGump(m_From, m_Batch));
        }
Example #2
0
        public void Render()
        {
            AddNewPage();

            /* Header */
            AddEntryHeader(20);
            AddEntryHtml(140, Center("Change Scope"));
            AddEntryHeader(20);

            /* Options */
            for (int i = 0; i < BaseCommandImplementor.Implementors.Count; ++i)
            {
                BaseCommandImplementor impl = BaseCommandImplementor.Implementors[i];

                if (m_From.AccessLevel < impl.AccessLevel)
                {
                    continue;
                }

                AddNewLine();

                AddEntryLabel(20 + OffsetSize + 140, impl.Accessors[0]);
                AddEntryButton(20, ArrowRightID1, ArrowRightID2, GetButtonID(1, 0, i), ArrowRightWidth, ArrowRightHeight);
            }

            FinishPage();
        }
            public override bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
            {
                if (e.Arguments.Length >= 1)
                    return true;

                e.Mobile.SendMessage("Usage: " + Usage);
                return false;
            }
Example #4
0
            public override bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
            {
                if (e.Arguments.Length >= 1)
                {
                    return(true);
                }

                e.Mobile.SendMessage("Usage: " + this.Usage);
                return(false);
            }
 public override bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
 {
   bool retVal = true;
   if (e.Length != 1)
   {
     e.Mobile.SendMessage("You must specify an amount to change the x coord.");
     retVal = false;
   }
   return retVal;
 }
 public override bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
 {
   bool retVal = true;
   if (e.Length < 1 || e.Length > 3)
   {
     e.Mobile.SendMessage("You must specify the Item ID and, optionally a Hue and a Z value");
     retVal = false;
   }
   return retVal;
 }
Example #7
0
        public override bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
        {
            bool retVal = true;

            if (e.Length != 1)
            {
                e.Mobile.SendMessage("You must specify the Item ID");
                retVal = false;
            }
            return(retVal);
        }
Example #8
0
        public static void FillTable()
        {
            List <CommandEntry> commands = new List <CommandEntry>(CommandSystem.Entries.Values);
            List <CommandInfo>  list     = new List <CommandInfo>();

            commands.Sort();
            commands.Reverse();
            Docs.Clean(commands);

            for (int i = 0; i < commands.Count; ++i)
            {
                CommandEntry e = commands[i];

                MethodInfo mi = e.Handler.Method;

                object[] attrs = mi.GetCustomAttributes(typeof(UsageAttribute), false);

                if (attrs.Length == 0)
                {
                    continue;
                }

                UsageAttribute usage = attrs[0] as UsageAttribute;

                attrs = mi.GetCustomAttributes(typeof(DescriptionAttribute), false);

                if (attrs.Length == 0)
                {
                    continue;
                }

                DescriptionAttribute desc = attrs[0] as DescriptionAttribute;

                if (usage == null || desc == null)
                {
                    continue;
                }

                attrs = mi.GetCustomAttributes(typeof(AliasesAttribute), false);

                AliasesAttribute aliases = (attrs.Length == 0 ? null : attrs[0] as AliasesAttribute);

                string descString = desc.Description.Replace("<", "(").Replace(">", ")");

                if (aliases == null)
                {
                    list.Add(new CommandInfo(e.AccessLevel, e.Command, null, usage.Usage, descString));
                }
                else
                {
                    list.Add(new CommandInfo(e.AccessLevel, e.Command, aliases.Aliases, usage.Usage, descString));

                    for (int j = 0; j < aliases.Aliases.Length; j++)
                    {
                        string[] newAliases = new string[aliases.Aliases.Length];

                        aliases.Aliases.CopyTo(newAliases, 0);

                        newAliases[j] = e.Command;

                        list.Add(new CommandInfo(e.AccessLevel, aliases.Aliases[j], newAliases, usage.Usage, descString));
                    }
                }
            }


            for (int i = 0; i < TargetCommands.AllCommands.Count; ++i)
            {
                BaseCommand command = TargetCommands.AllCommands[i];

                string usage = command.Usage;
                string desc  = command.Description;

                if (usage == null || desc == null)
                {
                    continue;
                }

                string[] cmds    = command.Commands;
                string   cmd     = cmds[0];
                string[] aliases = new string[cmds.Length - 1];

                for (int j = 0; j < aliases.Length; ++j)
                {
                    aliases[j] = cmds[j + 1];
                }

                desc = desc.Replace("<", "(").Replace(">", ")");

                if (command.Supports != CommandSupport.Single)
                {
                    StringBuilder sb = new StringBuilder(50 + desc.Length);

                    sb.Append("Modifiers: ");

                    if ((command.Supports & CommandSupport.Global) != 0)
                    {
                        sb.Append("<i>Global</i>, ");
                    }

                    if ((command.Supports & CommandSupport.Online) != 0)
                    {
                        sb.Append("<i>Online</i>, ");
                    }

                    if ((command.Supports & CommandSupport.Region) != 0)
                    {
                        sb.Append("<i>Region</i>, ");
                    }

                    if ((command.Supports & CommandSupport.Contained) != 0)
                    {
                        sb.Append("<i>Contained</i>, ");
                    }

                    if ((command.Supports & CommandSupport.Multi) != 0)
                    {
                        sb.Append("<i>Multi</i>, ");
                    }

                    if ((command.Supports & CommandSupport.Area) != 0)
                    {
                        sb.Append("<i>Area</i>, ");
                    }

                    if ((command.Supports & CommandSupport.Self) != 0)
                    {
                        sb.Append("<i>Self</i>, ");
                    }

                    sb.Remove(sb.Length - 2, 2);
                    sb.Append("<br>");
                    sb.Append(desc);

                    desc = sb.ToString();
                }

                list.Add(new CommandInfo(command.AccessLevel, cmd, aliases, usage, desc));

                for (int j = 0; j < aliases.Length; j++)
                {
                    string[] newAliases = new string[aliases.Length];

                    aliases.CopyTo(newAliases, 0);

                    newAliases[j] = cmd;

                    list.Add(new CommandInfo(command.AccessLevel, aliases[j], newAliases, usage, desc));
                }
            }

            List <BaseCommandImplementor> commandImpls = BaseCommandImplementor.Implementors;

            for (int i = 0; i < commandImpls.Count; ++i)
            {
                BaseCommandImplementor command = commandImpls[i];

                string usage = command.Usage;
                string desc  = command.Description;

                if (usage == null || desc == null)
                {
                    continue;
                }

                string[] cmds    = command.Accessors;
                string   cmd     = cmds[0];
                string[] aliases = new string[cmds.Length - 1];

                for (int j = 0; j < aliases.Length; ++j)
                {
                    aliases[j] = cmds[j + 1];
                }

                desc = desc.Replace("<", ")").Replace(">", ")");

                list.Add(new CommandInfo(command.AccessLevel, cmd, aliases, usage, desc));

                for (int j = 0; j < aliases.Length; j++)
                {
                    string[] newAliases = new string[aliases.Length];

                    aliases.CopyTo(newAliases, 0);

                    newAliases[j] = cmd;

                    list.Add(new CommandInfo(command.AccessLevel, aliases[j], newAliases, usage, desc));
                }
            }

            list.Sort(new CommandInfoSorter());

            m_SortedHelpInfo = list;

            foreach (CommandInfo c in m_SortedHelpInfo)
            {
                if (!m_HelpInfos.ContainsKey(c.Name.ToLower()))
                {
                    m_HelpInfos.Add(c.Name.ToLower(), c);
                }
            }
        }