public PropertiesGump( Mobile mobile, object o, Stack stack, StackEntry parent ) : base( GumpOffsetX, GumpOffsetY )
		{
			m_Mobile = mobile;
			m_Object = o;
			m_Stack = stack;
			m_List = BuildList();

			if ( parent != null )
			{
				if ( m_Stack == null )
					m_Stack = new Stack();

				m_Stack.Push( parent );
			}

			Initialize( 0 );
		}
Esempio n. 2
0
        public PropertiesGump(Mobile mobile, object o, Stack <StackEntry> stack, StackEntry parent) : base(GumpOffsetX,
                                                                                                           GumpOffsetY)
        {
            m_Mobile = mobile;
            m_Object = o;
            m_Type   = o.GetType();
            m_Stack  = stack;
            m_List   = BuildList();

            if (parent != null)
            {
                m_Stack ??= new Stack <StackEntry>();
                m_Stack.Push(parent);
            }

            Initialize(0);
        }
Esempio n. 3
0
        public static void OnValueChanged(object obj, PropertyInfo prop, Stack <StackEntry> stack)
        {
            if (stack == null || stack.Count == 0)
            {
                return;
            }

            if (!prop.PropertyType.IsValueType)
            {
                return;
            }

            StackEntry peek = stack.Peek();

            if (peek.m_Property.CanWrite)
            {
                peek.m_Property.SetValue(peek.m_Object, obj, null);
            }
        }
Esempio n. 4
0
        public PropertiesGump(Mobile mobile, object o, Stack stack, StackEntry parent) : base(GumpOffsetX, GumpOffsetY)
        {
            m_Mobile = mobile;
            m_Object = o;
            m_Stack  = stack;
            m_List   = BuildList();

            if (parent != null)
            {
                if (m_Stack == null)
                {
                    m_Stack = new Stack();
                }

                m_Stack.Push(parent);
            }

            Initialize(0);
        }
Esempio n. 5
0
        public PropertiesGump(Mobile mobile, object o, Stack stack, StackEntry parent) : base(GumpOffsetX, GumpOffsetY)
        {
            this.m_Mobile = mobile;
            this.m_Object = o;
            this.m_Type   = o.GetType();
            this.m_Stack  = stack;
            this.m_List   = this.BuildList();

            if (parent != null)
            {
                if (this.m_Stack == null)
                {
                    this.m_Stack = new Stack();
                }

                this.m_Stack.Push(parent);
            }

            this.Initialize(0);
        }
Esempio n. 6
0
        public PropertiesGump(Mobile mobile, object o, Stack stack, StackEntry parent)
            : base(GumpOffsetX, GumpOffsetY)
        {
            this.m_Mobile = mobile;
            this.m_Object = o;
            this.m_Type = o.GetType();
            this.m_Stack = stack;
            this.m_List = this.BuildList();

            if (parent != null)
            {
                if (this.m_Stack == null)
                    this.m_Stack = new Stack();

                this.m_Stack.Push(parent);
            }

            this.Initialize(0);
        }
Esempio n. 7
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!BaseCommand.IsAccessible(from, m_Object))
            {
                from.SendMessage("You may no longer access their properties.");
                return;
            }

            switch (info.ButtonID)
            {
            case 0:                     // Closed
            {
                if (m_Stack != null && m_Stack.Count > 0)
                {
                    StackEntry entry = m_Stack.Pop();

                    from.SendGump(new PropertiesGump(from, entry.m_Object, m_Stack, null));
                }

                break;
            }

            case 1:                     // Previous
            {
                if (m_Page > 0)
                {
                    from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1));
                }

                break;
            }

            case 2:                     // Next
            {
                if ((m_Page + 1) * EntryCount < m_List.Count)
                {
                    from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1));
                }

                break;
            }

            default:
            {
                int index = (m_Page * EntryCount) + (info.ButtonID - 3);

                if (index >= 0 && index < m_List.Count)
                {
                    PropertyInfo prop = m_List[index] as PropertyInfo;

                    if (prop == null)
                    {
                        return;
                    }

                    CPA attr = GetCPA(prop);

                    if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel || attr.ReadOnly)
                    {
                        return;
                    }

                    Type type = prop.PropertyType;

                    if (IsType(type, typeofMobile) || IsType(type, typeofItem))
                    {
                        from.SendGump(new SetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List));
                    }
                    else if (IsType(type, typeofType))
                    {
                        from.Target = new SetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List);
                    }
                    else if (IsType(type, typeofPoint3D))
                    {
                        from.SendGump(new SetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofPoint2D))
                    {
                        from.SendGump(new SetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofTimeSpan))
                    {
                        from.SendGump(new SetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsCustomEnum(type))
                    {
                        from.SendGump(new SetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List, GetCustomEnumNames(type)));
                    }
                    else if (IsType(type, typeofEnum))
                    {
                        from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Enum.GetNames(type), GetObjects(Enum.GetValues(type))));
                    }
                    else if (IsType(type, typeofBool))
                    {
                        from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames, m_BoolValues));
                    }
                    else if (IsType(type, typeofString) || IsType(type, typeofReal) || IsType(type, typeofNumeric) || IsType(type, typeofText))
                    {
                        from.SendGump(new SetGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, typeofPoison))
                    {
                        from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues));
                    }
                    else if (IsType(type, typeofMap))
                    {
                        from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), Map.GetMapValues()));
                    }
                    else if (IsType(type, typeofSkills) && m_Object is Mobile)
                    {
                        from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
                        from.SendGump(new SkillsGump(from, (Mobile)m_Object));
                    }
                    else if (HasAttribute(type, typeofPropertyObject, true))
                    {
                        object obj = prop.GetValue(m_Object, null);

                        if (obj != null)
                        {
                            from.SendGump(new PropertiesGump(from, obj, m_Stack, new StackEntry(m_Object, prop)));
                        }
                        else
                        {
                            from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
                        }
                    }
                }

                break;
            }
            }
        }
Esempio n. 8
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            if (!BaseCommand.IsAccessible(from, m_Object))
            {
                from.SendMessage("You may no longer access their properties.");
                return;
            }

            switch (info.ButtonID)
            {
            case 0:     // Closed
            {
                if (m_Stack != null && m_Stack.Count > 0)
                {
                    StackEntry entry = (StackEntry)m_Stack.Pop();

                    from.SendGump(new PropertiesGump(from, entry.m_Object, m_Stack, null));
                }
            }
            break;

            case 1:     // Previous
            {
                if (m_Page > 0)
                {
                    from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page - 1));
                }
            }
            break;

            case 2:     // Next
            {
                if ((m_Page + 1) * EntryCount < m_List.Count)
                {
                    from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page + 1));
                }
            }
            break;

            default:
            {
                int index = (m_Page * EntryCount) + (info.ButtonID - 3);

                if (index >= 0 && index < m_List.Count)
                {
                    PropertyInfo prop = m_List[index] as PropertyInfo;

                    if (prop == null)
                    {
                        return;
                    }

                    CPA attr = GetCPA(prop);

                    if (!prop.CanWrite || attr == null || from.AccessLevel < attr.WriteLevel || attr.ReadOnly)
                    {
                        return;
                    }

                    Type type = prop.PropertyType;

                    if (IsType(type, _TypeOfMobile) || IsType(type, _TypeOfItem) || type.IsAssignableFrom(typeof(IDamageable)))
                    {
                        from.SendGump(new SetObjectGump(prop, from, m_Object, m_Stack, type, m_Page, m_List));
                    }
                    else if (IsType(type, _TypeOfType))
                    {
                        from.Target = new SetObjectTarget(prop, from, m_Object, m_Stack, type, m_Page, m_List);
                    }
                    else if (IsType(type, _TypeOfPoint3D))
                    {
                        from.SendGump(new SetPoint3DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, _TypeOfPoint2D))
                    {
                        from.SendGump(new SetPoint2DGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, _TypeOfTimeSpan))
                    {
                        from.SendGump(new SetTimeSpanGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsCustomEnum(type))
                    {
                        from.SendGump(new SetCustomEnumGump(prop, from, m_Object, m_Stack, m_Page, m_List, GetCustomEnumNames(type)));
                    }
                    else if (_TypeOfIDynamicEnum.IsAssignableFrom(type))
                    {
                        from.SendGump(
                            new SetCustomEnumGump(
                                prop,
                                from,
                                m_Object,
                                m_Stack,
                                m_Page,
                                m_List,
                                ((IDynamicEnum)prop.GetValue(m_Object, null)).Values));
                    }
                    else if (IsType(type, _TypeOfEnum))
                    {
                        from.SendGump(
                            new SetListOptionGump(
                                prop,
                                from,
                                m_Object,
                                m_Stack,
                                m_Page,
                                m_List,
                                Enum.GetNames(type),
                                GetObjects(Enum.GetValues(type))));
                    }
                    else if (IsType(type, _TypeOfBool))
                    {
                        from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_BoolNames, m_BoolValues));
                    }
                    else if (IsType(type, _TypeOfString) || IsType(type, _TypeOfReal) || IsType(type, _TypeOfNumeric) ||
                             IsType(type, _TypeOfText))
                    {
                        from.SendGump(new SetGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, _TypeOfPoison))
                    {
                        from.SendGump(
                            new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, m_PoisonNames, m_PoisonValues));
                    }
                    else if (IsType(type, _TypeofDateTime))
                    {
                        from.SendGump(new SetDateTimeGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, _TypeOfMap))
                    {
                        //Must explicitly cast collection to avoid potential covariant cast runtime exception
                        object[] values = Map.GetMapValues().Cast <object>().ToArray();

                        from.SendGump(new SetListOptionGump(prop, from, m_Object, m_Stack, m_Page, m_List, Map.GetMapNames(), values));
                    }
                    else if (IsType(type, _TypeOfSkills) && m_Object is Mobile)
                    {
                        from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
                        from.SendGump(new SkillsGump(from, (Mobile)m_Object));
                    }
                    else if (IsType(type, _TypeofColor))
                    {
                        from.SendGump(new SetColorGump(prop, from, m_Object, m_Stack, m_Page, m_List));
                    }
                    else if (IsType(type, _TypeofAccount))
                    {
                        from.SendGump(new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
                    }
                    else if (HasAttribute(type, _TypeOfPropertyObject, true))
                    {
                        object obj = prop.GetValue(m_Object, null);

                        from.SendGump(
                            obj != null
                                        ? new PropertiesGump(from, obj, m_Stack, new StackEntry(m_Object, prop))
                                        : new PropertiesGump(from, m_Object, m_Stack, m_List, m_Page));
                    }
                }
            }
            break;
            }
        }
Esempio n. 9
0
 public XmlPropertiesGump(Mobile mobile, object o, Stack <StackEntry> stack, StackEntry parent) : base(GumpOffsetX, GumpOffsetY)