Esempio n. 1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            var index = info.ButtonID - 1;

            if (index >= 0 && index < m_Values.Length)
            {
                try
                {
                    var toSet = m_Values[index];

                    var result = Properties.SetDirect(
                        m_Mobile,
                        m_Object,
                        m_Object,
                        m_Property,
                        m_Property.Name,
                        toSet,
                        true
                        );

                    m_Mobile.SendMessage(result);

                    if (result == "Property has been set.")
                    {
                        m_PropertiesGump.OnValueChanged(m_Object, m_Property);
                    }
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            m_PropertiesGump.SendPropertiesGump();
        }
Esempio n. 2
0
 protected override void OnTargetFinish(Mobile from)
 {
     if (m_Type == typeof(Type))
     {
         m_PropertiesGump.SendPropertiesGump();
     }
     else
     {
         from.SendGump(new SetObjectGump(m_Property, m_Mobile, m_Object, m_Type, m_PropertiesGump));
     }
 }
Esempio n. 3
0
            public override void OnResponse(int hue)
            {
                try
                {
                    CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, hue.ToString());
                    m_Property.SetValue(m_Object, hue, null);
                    m_PropertiesGump.OnValueChanged(m_Object, m_Property);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }

                m_PropertiesGump.SendPropertiesGump();
            }
Esempio n. 4
0
 protected override void OnTargetFinish(Mobile from)
 {
     m_PropertiesGump.SendPropertiesGump();
 }
Esempio n. 5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            var index = info.ButtonID - 1;

            if (index == -1)
            {
                m_PropertiesGump.SendPropertiesGump();
            }
            else if (index >= 0 && index < 4)
            {
                if (m_Monster == null)
                {
                    LoadLists();
                }

                ModelBodyType        type;
                List <InternalEntry> list;

                switch (index)
                {
                default:
                    type = ModelBodyType.Monsters;
                    list = m_Monster;
                    break;

                case 1:
                    type = ModelBodyType.Animals;
                    list = m_Animal;
                    break;

                case 2:
                    type = ModelBodyType.Sea;
                    list = m_Sea;
                    break;

                case 3:
                    type = ModelBodyType.Human;
                    list = m_Human;
                    break;
                }

                m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_PropertiesGump, 0, list, type));
            }
            else if (m_OurList != null)
            {
                index -= 4;

                if (index == 0 && m_OurPage > 0)
                {
                    m_Mobile.SendGump(
                        new SetBodyGump(
                            m_Property,
                            m_Mobile,
                            m_Object,
                            m_PropertiesGump,
                            m_OurPage - 1,
                            m_OurList,
                            m_OurType
                            )
                        );
                }
                else if (index == 1 && (m_OurPage + 1) * 12 < m_OurList.Count)
                {
                    m_Mobile.SendGump(
                        new SetBodyGump(
                            m_Property,
                            m_Mobile,
                            m_Object,
                            m_PropertiesGump,
                            m_OurPage + 1,
                            m_OurList,
                            m_OurType
                            )
                        );
                }
                else
                {
                    index -= 2;

                    if (index >= 0 && index < m_OurList.Count)
                    {
                        try
                        {
                            var entry = m_OurList[index];

                            CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, entry.Body.ToString());
                            m_Property.SetValue(m_Object, entry.Body, null);
                            m_PropertiesGump.OnValueChanged(m_Object, m_Property);
                        }
                        catch
                        {
                            m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                        }

                        m_Mobile.SendGump(
                            new SetBodyGump(
                                m_Property,
                                m_Mobile,
                                m_Object,
                                m_PropertiesGump,
                                m_OurPage,
                                m_OurList,
                                m_OurType
                                )
                            );
                    }
                }
            }
        }
Esempio n. 6
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            TimeSpan toSet;
            bool     shouldSet, shouldSend;

            var h = info.GetTextEntry(0);
            var m = info.GetTextEntry(1);
            var s = info.GetTextEntry(2);

            switch (info.ButtonID)
            {
            case 1:     // Zero
            {
                toSet      = TimeSpan.Zero;
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            case 2:     // From H:M:S
            {
                var successfulParse = false;
                if (h != null && m != null && s != null)
                {
                    successfulParse = TimeSpan.TryParse($"{h.Text}:{m.Text}:{s.Text}", out toSet);
                }
                else
                {
                    toSet = TimeSpan.Zero;
                }

                shouldSet = shouldSend = successfulParse;

                break;
            }

            case 3:     // From H
            {
                if (h != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromHours(Utility.ToDouble(h.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                        // ignored
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 4:     // From M
            {
                if (m != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromMinutes(Utility.ToDouble(m.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                        // ignored
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            case 5:     // From S
            {
                if (s != null)
                {
                    try
                    {
                        toSet      = TimeSpan.FromSeconds(Utility.ToDouble(s.Text));
                        shouldSet  = true;
                        shouldSend = true;

                        break;
                    }
                    catch
                    {
                        // ignored
                    }
                }

                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = false;

                break;
            }

            default:
            {
                toSet      = TimeSpan.Zero;
                shouldSet  = false;
                shouldSend = true;

                break;
            }
            }

            if (shouldSet)
            {
                try
                {
                    CommandLogging.LogChangeProperty(m_Mobile, m_Object, m_Property.Name, toSet.ToString());
                    m_Property.SetValue(m_Object, toSet, null);
                    m_PropertiesGump.OnValueChanged(m_Object, m_Property);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_PropertiesGump.SendPropertiesGump();
            }
        }