Esempio n. 1
0
 public ActionHandler GetHandler(string action)
 {
     for (int i = 0; i < this.m_Handlers.Count; i++)
     {
         ActionHandler handler = (ActionHandler)this.m_Handlers[i];
         if (handler.Action == action)
         {
             return(handler);
         }
     }
     return(null);
 }
Esempio n. 2
0
 public GParamMenu(ParamNode param, ActionHandler handler, Client.Action action) : base(param.Name)
 {
     this.m_Param   = param;
     this.m_Handler = handler;
     this.m_Action  = action;
     if (this.m_Action == null)
     {
         base.Tooltip = new Tooltip(string.Format("Click here to add the instruction:\n{0} {1}", handler.Name, param.Name), true);
     }
     else
     {
         base.Tooltip = new Tooltip("Click here to change the parameter", true);
     }
     base.Tooltip.Delay = 3f;
 }
Esempio n. 3
0
 public GNewActionMenu(GMacroEditorPanel panel, Macro macro, ActionHandler action) : base(action.Name)
 {
     this.m_Panel  = panel;
     this.m_Macro  = macro;
     this.m_Action = action;
     if ((this.m_Action.Params != null) && (this.m_Action.Params.Length > 0))
     {
         base.Tooltip = new Tooltip("Choose a parameter from the menu to the right, or just click here to add the instruction with a default parameter.", false, 200);
     }
     else
     {
         base.Tooltip = new Tooltip("Click here to add this instruction.", false, 200);
     }
     base.Tooltip.Delay = 2f;
 }
Esempio n. 4
0
        public static void Register(string action, ParamNode[] parms, Client.Plugin plugin)
        {
            string str;

            if (m_Table == null)
            {
                m_Table = new Hashtable();
            }
            if (m_List == null)
            {
                m_List = new ArrayList();
            }
            if (m_RootNode == null)
            {
                m_RootNode = new ActionNode("-root-");
            }
            string[]   strArray = action.Split(new char[] { '|' });
            ActionNode rootNode = m_RootNode;

            for (int i = 0; i < (strArray.Length - 1); i++)
            {
                ActionNode node = rootNode.GetNode(strArray[i]);
                if (node == null)
                {
                    rootNode.Nodes.Add(node = new ActionNode(strArray[i]));
                    rootNode.Nodes.Sort();
                }
                rootNode = node;
            }
            action = strArray[strArray.Length - 1];
            int index = action.IndexOf('@');

            if (index >= 0)
            {
                str    = action.Substring(index + 1);
                action = action.Substring(0, index);
            }
            else
            {
                str = action;
            }
            ActionHandler handler = new ActionHandler(action, str, parms, plugin);

            rootNode.Handlers.Add(handler);
            rootNode.Handlers.Sort();
            m_Table[action] = handler;
            m_List.Add(handler);
        }
Esempio n. 5
0
 public GParamMenu(ParamNode param, ActionHandler handler, Client.Action action)
     : base(param.Name)
 {
     this.m_Param = param;
     this.m_Handler = handler;
     this.m_Action = action;
     if (this.m_Action == null)
     {
         base.Tooltip = new Tooltip(string.Format("Click here to add the instruction:\n{0} {1}", handler.Name, param.Name), true);
     }
     else
     {
         base.Tooltip = new Tooltip("Click here to change the parameter", true);
     }
     base.Tooltip.Delay = 3f;
 }
Esempio n. 6
0
 public GNewActionMenu(GMacroEditorPanel panel, Macro macro, ActionHandler action)
     : base(action.Name)
 {
     this.m_Panel = panel;
     this.m_Macro = macro;
     this.m_Action = action;
     if ((this.m_Action.Params != null) && (this.m_Action.Params.Length > 0))
     {
         base.Tooltip = new Tooltip("Choose a parameter from the menu to the right, or just click here to add the instruction with a default parameter.", false, 200);
     }
     else
     {
         base.Tooltip = new Tooltip("Click here to add this instruction.", false, 200);
     }
     base.Tooltip.Delay = 2f;
 }
Esempio n. 7
0
 public Action(string line)
 {
     string str;
     string str2;
     this.m_Line = line;
     int index = line.IndexOf(' ');
     if (index >= 0)
     {
         str = line.Substring(0, index);
         str2 = line.Substring(index + 1);
     }
     else
     {
         str = line;
         str2 = "";
     }
     this.m_Action = ActionHandler.Find(str);
     this.m_Param = str2;
 }
Esempio n. 8
0
 public bool Slice()
 {
     m_Current = this;
     if (this.m_Index < this.m_Actions.Length)
     {
         Action        action  = this.m_Actions[this.m_Index];
         ActionHandler handler = action.Handler;
         if ((handler == null) || handler.Plugin.OnMacroAction(action.Param))
         {
             this.m_Index++;
         }
     }
     if (this.m_Index >= this.m_Actions.Length)
     {
         this.m_Index = -1;
     }
     m_Current = null;
     return(this.Running);
 }
Esempio n. 9
0
        private GMenuItem GetMenuFrom(ActionNode n)
        {
            GMenuItem mi = new GMenuItem(n.Name);

            for (int i = 0; i < n.Nodes.Count; i++)
            {
                mi.Add(this.GetMenuFrom((ActionNode)n.Nodes[i]));
            }
            for (int j = 0; j < n.Handlers.Count; j++)
            {
                ActionHandler action = (ActionHandler)n.Handlers[j];
                GMenuItem     item2  = new GNewActionMenu(this, this.m_Macro, action);
                for (int k = 0; (action.Params != null) && (k < action.Params.Length); k++)
                {
                    item2.Add(this.GetMenuFrom(action.Params[k], null, action));
                }
                mi.Add(this.FormatMenu(item2));
            }
            return(this.FormatMenu(mi));
        }
Esempio n. 10
0
        private GMenuItem GetMenuFrom(ParamNode n, Action a, ActionHandler ah)
        {
            GMenuItem item;

            if (n.Param != null)
            {
                item = new GParamMenu(n, ah, a);
            }
            else
            {
                item = new GMenuItem(n.Name);
            }
            if (n.Nodes != null)
            {
                for (int i = 0; i < n.Nodes.Length; i++)
                {
                    item.Add(this.GetMenuFrom(n.Nodes[i], a, ah));
                }
            }
            return(this.FormatMenu(item));
        }
Esempio n. 11
0
        public Action(string line)
        {
            string str;
            string str2;

            this.m_Line = line;
            int index = line.IndexOf(' ');

            if (index >= 0)
            {
                str  = line.Substring(0, index);
                str2 = line.Substring(index + 1);
            }
            else
            {
                str  = line;
                str2 = "";
            }
            this.m_Action = ActionHandler.Find(str);
            this.m_Param  = str2;
        }
Esempio n. 12
0
 public static void Register(string action, ParamNode[] parms, Client.Plugin plugin)
 {
     string str;
     if (m_Table == null)
     {
         m_Table = new Hashtable();
     }
     if (m_List == null)
     {
         m_List = new ArrayList();
     }
     if (m_RootNode == null)
     {
         m_RootNode = new ActionNode("-root-");
     }
     string[] strArray = action.Split(new char[] { '|' });
     ActionNode rootNode = m_RootNode;
     for (int i = 0; i < (strArray.Length - 1); i++)
     {
         ActionNode node = rootNode.GetNode(strArray[i]);
         if (node == null)
         {
             rootNode.Nodes.Add(node = new ActionNode(strArray[i]));
             rootNode.Nodes.Sort();
         }
         rootNode = node;
     }
     action = strArray[strArray.Length - 1];
     int index = action.IndexOf('@');
     if (index >= 0)
     {
         str = action.Substring(index + 1);
         action = action.Substring(0, index);
     }
     else
     {
         str = action;
     }
     ActionHandler handler = new ActionHandler(action, str, parms, plugin);
     rootNode.Handlers.Add(handler);
     rootNode.Handlers.Sort();
     m_Table[action] = handler;
     m_List.Add(handler);
 }
Esempio n. 13
0
 public void RegisterAsMacro(string action, params ParamNode[] options)
 {
     ActionHandler.Register(action, options, this.m_Plugin);
 }
Esempio n. 14
0
        public GMacroEditorPanel(Client.Macro m) : base(0, 0, 0x103, 230)
        {
            GMainMenu menu;
            GMenuItem menuFrom;

            this.m_Macro   = m;
            base.m_CanDrag = false;
            base.m_NonRestrictivePicking = true;
            base.ShouldHitTest           = false;
            this.m_Ctrl          = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Ctrl", Engine.GetUniFont(2));
            this.m_Alt           = new GSystemButton(0x31, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Alt", Engine.GetUniFont(2));
            this.m_Shift         = new GSystemButton(0x58, 10, 0x2a, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Shift", Engine.GetUniFont(2));
            this.m_Ctrl.OnClick  = new OnClick(this.Ctrl_OnClick);
            this.m_Alt.OnClick   = new OnClick(this.Alt_OnClick);
            this.m_Shift.OnClick = new OnClick(this.Shift_OnClick);
            this.m_Ctrl.Tooltip  = new Tooltip("Toggles the control key modifier", true);
            this.m_Alt.Tooltip   = new Tooltip("Toggles the alt key modifier", true);
            this.m_Shift.Tooltip = new Tooltip("Toggles the shift key modifier", true);
            base.m_Children.Add(this.m_Ctrl);
            base.m_Children.Add(this.m_Alt);
            base.m_Children.Add(this.m_Shift);
            this.UpdateModifiers();
            GAlphaBackground toAdd = new GAlphaBackground(0x81, 10, 0x4a, 20)
            {
                FillAlpha = 1f,
                FillColor = GumpColors.Window
            };

            base.m_Children.Add(toAdd);
            GMacroKeyEntry entry = new GMacroKeyEntry(GetKeyName(m.Key), 0x81, 10, 0x4a, 20)
            {
                Tooltip = new Tooltip("Press any key here to change the macro", true)
            };

            base.m_Children.Add(entry);
            GSystemButton button = new GSystemButton(10, 10, 40, 20, GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f), SystemColors.ControlText, "Delete", Engine.GetUniFont(2));

            button.SetBackColor(GumpPaint.Blend(Color.SteelBlue, SystemColors.Control, (float)0.25f));
            button.InactiveColor = GumpPaint.Blend(Color.WhiteSmoke, SystemColors.Control, (float)0.5f);
            button.Tooltip       = new Tooltip("Deletes the entire macro", true);
            button.OnClick       = new OnClick(this.Delete_OnClick);
            button.X             = (this.Width - 10) - button.Width;
            base.m_Children.Add(button);
            base.FillAlpha = 0.15f;
            for (int i = 0; i < m.Actions.Length; i++)
            {
                try
                {
                    Action action = m.Actions[i];
                    if (action.Handler != null)
                    {
                        ActionHandler ah = action.Handler;
                        menu     = new GMainMenu(10, 0x23 + (i * 0x17));
                        menuFrom = new GActionMenu(this, m, action);
                        menu.Add(this.FormatMenu(menuFrom));
                        if (ah.Params == null)
                        {
                            GAlphaBackground background2 = new GAlphaBackground(0x81, 0x23 + (i * 0x17), 120, 0x18)
                            {
                                FillAlpha = 1f,
                                FillColor = GumpColors.Window
                            };
                            base.m_Children.Add(background2);
                            IHue     windowText = GumpHues.WindowText;
                            GTextBox box        = new GMacroParamEntry(action, action.Param, background2.X, background2.Y, background2.Width, background2.Height)
                            {
                                MaxChars = 0xef
                            };
                            base.m_Children.Add(box);
                        }
                        else if (ah.Params.Length != 0)
                        {
                            string name = Find(action.Param, ah.Params);
                            if (name == null)
                            {
                                name = action.Param;
                            }
                            menuFrom          = this.GetMenuFrom(new ParamNode(name, ah.Params), action, ah);
                            menuFrom.DropDown = i == (m.Actions.Length - 1);
                            menu.Add(menuFrom);
                        }
                        menu.LeftToRight = true;
                        base.m_Children.Add(menu);
                    }
                }
                catch
                {
                }
            }
            menu              = new GMainMenu(10, 0x23 + (m.Actions.Length * 0x17));
            menuFrom          = this.GetMenuFrom(ActionHandler.Root);
            menuFrom.Tooltip  = new Tooltip("To create a new instruction pick one from the menu below", false, 200);
            menuFrom.Text     = "New...";
            menuFrom.DropDown = true;
            menu.Add(this.FormatMenu(menuFrom));
            menu.LeftToRight = true;
            base.m_Children.Add(menu);
        }
Esempio n. 15
0
 private GMenuItem GetMenuFrom(ParamNode n, Action a, ActionHandler ah)
 {
     GMenuItem item;
     if (n.Param != null)
     {
         item = new GParamMenu(n, ah, a);
     }
     else
     {
         item = new GMenuItem(n.Name);
     }
     if (n.Nodes != null)
     {
         for (int i = 0; i < n.Nodes.Length; i++)
         {
             item.Add(this.GetMenuFrom(n.Nodes[i], a, ah));
         }
     }
     return this.FormatMenu(item);
 }