Esempio n. 1
0
        public static void ModProp(CmdTrigger <RealmServerCmdArgs> trigger, object target)
        {
            string     name = trigger.Text.NextWord();
            object     propHolder;
            MemberInfo prop = ReflectUtil.Instance.GetProp((IRoleGroup)trigger.Args.Role, target, name,
                                                           target.GetType(), out propHolder);

            ModPropCommand.ModProp(propHolder, prop, trigger);
        }
Esempio n. 2
0
        public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
        {
            object obj = trigger.EvalNextOrTargetOrUser();

            if (obj is IContextHandler)
            {
                ((IContextHandler)obj).ExecuteInContext((Action)(() => ModPropCommand.ModProp(trigger, obj)));
            }
            else
            {
                ModPropCommand.ModProp(trigger, obj);
            }
        }
Esempio n. 3
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var n    = ((RealmServerNCmdArgs)trigger.Args).N - 1;
                var aura = trigger.Args.Target.Auras.GetAt(n);

                if (aura != null)
                {
                    ModPropCommand.ModProp(aura, aura.GetType().GetProperty("Flags"), trigger);
                }
                else
                {
                    trigger.Reply("There aren't " + n + " Auras.");
                }
            }
Esempio n. 4
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                uint n  = ((RealmServerNCmdArgs)trigger.Args).N - 1U;
                Aura at = trigger.Args.Target.Auras.GetAt(n);

                if (at != null)
                {
                    ModPropCommand.ModProp((object)at, (MemberInfo)at.GetType().GetProperty("Flags"), trigger);
                }
                else
                {
                    trigger.Reply("There aren't " + (object)n + " Auras.");
                }
            }
Esempio n. 5
0
            public override void Process(CmdTrigger <RealmServerCmdArgs> trigger)
            {
                var slot = trigger.Text.NextEnum(InventorySlot.Invalid);

                if (slot == InventorySlot.Invalid)
                {
                    trigger.Reply("Invalid slot.");
                }
                else
                {
                    var item = ((Character)trigger.Args.Target).Inventory[slot];
                    if (item == null)
                    {
                        trigger.Reply("There is no Item in slot " + slot);
                    }
                    else
                    {
                        ModPropCommand.ModProp(trigger, item);
                    }
                }
            }
Esempio n. 6
0
 public static void ModProp(object propHolder, MemberInfo prop, CmdTrigger <RealmServerCmdArgs> trigger)
 {
     if (prop != (MemberInfo)null && ReflectUtil.Instance.CanWrite(prop, (IRoleGroup)trigger.Args.Role))
     {
         Type variableType = prop.GetVariableType();
         if (!variableType.IsInteger())
         {
             trigger.Reply("Can only modify Integer-values.");
         }
         else
         {
             string expr = trigger.Text.Remainder.Trim();
             if (expr.Length == 0)
             {
                 trigger.Reply("No expression given");
             }
             else
             {
                 object error = (object)null;
                 long   int64 = Convert.ToInt64(prop.GetUnindexedValue(propHolder));
                 if (!StringParser.Eval(variableType, ref int64, expr, ref error, true))
                 {
                     trigger.Reply("Invalid expression: " + error);
                 }
                 else
                 {
                     object obj = ModPropCommand.TryParseEnum(int64, variableType);
                     prop.SetUnindexedValue(propHolder, obj);
                     string str = !variableType.IsEnum ? int64.ToString() : Enum.Format(variableType, obj, "g");
                     trigger.Reply("Success: {0} is now {1}.", (object)prop.Name, (object)str);
                 }
             }
         }
     }
     else
     {
         trigger.Reply("Invalid field.");
     }
 }