예제 #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            Point2D toSet;
            bool    shouldSet, shouldSend;

            switch (info.ButtonID)
            {
            case 1:     // Current location
            {
                toSet      = new Point2D(m_Mobile.Location);
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            case 2:     // Pick location
            {
                m_Mobile.Target = new InternalTarget(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List);

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

                break;
            }

            case 3:     // Use values
            {
                TextRelay x = info.GetTextEntry(0);
                TextRelay y = info.GetTextEntry(1);

                toSet      = new Point2D(x == null ? 0 : Utility.ToInt32(x.Text), y == null ? 0 : Utility.ToInt32(y.Text));
                shouldSet  = true;
                shouldSend = true;

                break;
            }

            default:
            {
                toSet      = Point2D.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);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
        }
예제 #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (m_State == null)
            {
                return;
            }

            Mobile focus = m_State.Mobile;
            Mobile from  = state.Mobile;

            if (focus == null)
            {
                from.SendMessage("That character is no longer online.");
                return;
            }
            else if (focus.Deleted)
            {
                from.SendMessage("That character no longer exists.");
                return;
            }
            else if (from != focus && focus.Hidden && from.AccessLevel < focus.AccessLevel && (!(focus is PlayerMobile) || !((PlayerMobile)focus).VisibilityList.Contains(from)))
            {
                from.SendMessage("That character is no longer visible.");
                return;
            }

            switch (info.ButtonID)
            {
            case 1:     // Tell
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    focus.SendMessage(0x482, "{0} tells you:", from.Name);
                    focus.SendMessage(0x482, text.Text);

                    CommandLogging.WriteLine(from, "{0} {1} telling {2} \"{3}\" ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), text.Text);
                }

                from.SendGump(new ClientGump(from, m_State));

                break;
            }

            case 4:     // Props
            {
                Resend(from, info);

                if (!BaseCommand.IsAccessible(from, focus))
                {
                    from.SendMessage("That is not accessible.");
                }
                else
                {
                    from.SendGump(new PropertiesGump(from, focus));
                    CommandLogging.WriteLine(from, "{0} {1} opening properties gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 5:     // Go to
            {
                if (focus.Map == null || focus.Map == Map.Internal)
                {
                    from.SendMessage("That character is not in the world.");
                }
                else
                {
                    from.MoveToWorld(focus.Location, focus.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} going to {2}, Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), focus.Location, focus.Map);
                }

                break;
            }

            case 6:     // Get
            {
                if (from.Map == null || from.Map == Map.Internal)
                {
                    from.SendMessage("You cannot bring that person here.");
                }
                else
                {
                    focus.MoveToWorld(from.Location, from.Map);
                    Resend(from, info);

                    CommandLogging.WriteLine(from, "{0} {1} bringing {2} to Location {3}, Map {4}", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus), from.Location, from.Map);
                }

                break;
            }

            case 7:     // Move
            {
                from.Target = new MoveTarget(focus);
                Resend(from, info);

                break;
            }

            case 8:     // Kick
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Say("I've been kicked!");

                    m_State.Dispose();

                    CommandLogging.WriteLine(from, "{0} {1} kicking {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }

            case 9:     // Kill
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.Kill();
                    CommandLogging.WriteLine(from, "{0} {1} killing {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 10:     //Res
            {
                if (from.AccessLevel >= AccessLevel.GameMaster && from.AccessLevel > focus.AccessLevel)
                {
                    focus.PlaySound(0x214);
                    focus.FixedEffect(0x376A, 10, 16);

                    focus.Resurrect();

                    CommandLogging.WriteLine(from, "{0} {1} resurrecting {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                Resend(from, info);

                break;
            }

            case 11:     // Skills
            {
                Resend(from, info);

                if (from.AccessLevel > focus.AccessLevel)
                {
                    from.SendGump(new SkillsGump(from, (Mobile)focus));
                    CommandLogging.WriteLine(from, "{0} {1} Opening Skills gump of {2} ", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(focus));
                }

                break;
            }
            }
        }
예제 #3
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            object toSet;
            bool   shouldSet, shouldSend = true;

            switch (info.ButtonID)
            {
            case 1:
            {
                TextRelay text = info.GetTextEntry(0);

                if (text != null)
                {
                    try
                    {
                        toSet     = PropertiesGump.GetObjectFromString(m_Property.PropertyType, text.Text);
                        shouldSet = true;
                    }
                    catch
                    {
                        toSet     = null;
                        shouldSet = false;
                        m_Mobile.SendMessage("Bad format");
                    }
                }
                else
                {
                    toSet     = null;
                    shouldSet = false;
                }

                break;
            }

            case 2:     // Null
            {
                toSet     = null;
                shouldSet = true;

                break;
            }

            case 3:     // Hue Picker
            {
                toSet      = null;
                shouldSet  = false;
                shouldSend = false;

                m_Mobile.SendHuePicker(new InternalPicker(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));

                break;
            }

            case 4:     // Body Picker
            {
                toSet      = null;
                shouldSet  = false;
                shouldSend = false;

                m_Mobile.SendGump(new SetBodyGump(m_Property, m_Mobile, m_Object, m_Stack, m_Page, m_List));

                break;
            }

            default:
            {
                toSet     = null;
                shouldSet = false;

                break;
            }
            }

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

            if (shouldSend)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
        }
예제 #4
0
        private void Resend(Mobile to, RelayInfo info)
        {
            TextRelay te = info.GetTextEntry(0);

            to.SendGump(new ClientGump(to, m_State, te == null ? "" : te.Text));
        }
예제 #5
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            TimeSpan toSet;
            bool     shouldSet, shouldSend;

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

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

                break;
            }

            case 2:     // From H:M:S
            {
                bool 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
                    {
                    }
                }

                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
                    {
                    }
                }

                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
                    {
                    }
                }

                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);
                    PropertiesGump.OnValueChanged(m_Object, m_Property, m_Stack);
                }
                catch
                {
                    m_Mobile.SendMessage("An exception was caught. The property may not have changed.");
                }
            }

            if (shouldSend)
            {
                m_Mobile.SendGump(new PropertiesGump(m_Mobile, m_Object, m_Stack, m_List, m_Page));
            }
        }