Ejemplo n.º 1
0
        public static string GetDescription(this FixMeFlags flags)
        {
            var html = new StringBuilder();

            switch (flags)
            {
            case FixMeFlags.Mount:
                html.Append("Attempt to correct your mount if it appears to be glitched.");
                break;

            case FixMeFlags.Pets:
            {
                html.AppendLine("All pets will be stabled or teleported and your follower count will be normalized.");
                html.Append("If mounted, the mount will not be included.");
            }
            break;

            case FixMeFlags.Equip:
                html.Append("All equipment will be validated, any invalid equipment will be unequipped.");
                break;

            case FixMeFlags.Gumps:
                html.Append("All open gumps will be refreshed.");
                break;

            case FixMeFlags.Tags:
                html.Append("All character and equipment attribute tags will be refreshed.");
                break;

            case FixMeFlags.Skills:
                html.Append("All skills will be normalized if they are detected as invalid.");
                break;

            case FixMeFlags.Quests:
                html.Append("All quests will be repaired if they are detected as invalid.");
                break;
            }

            return(html.ToString());
        }
Ejemplo n.º 2
0
        public static string GetDescription(this FixMeFlags flags)
        {
            var html = new StringBuilder();

            switch (flags)
            {
            case FixMeFlags.Mount:
                html.Append("Forcibly dismounts if mounted.");
                break;

            case FixMeFlags.Pets:
            {
                html.AppendLine("All pets will be teleported if not stabled and the follower count will be normalized.");
                html.Append("If mounted, the mount will not be included.");
            }
            break;

            case FixMeFlags.Equip:
                html.Append("Equipment will be validated, any invalid equipment will be unequipped.");
                break;

            case FixMeFlags.Gumps:
                html.Append("All open gumps will be refreshed.");
                break;

            case FixMeFlags.Tags:
                html.Append("The property lists for everything will be invalidated.");
                break;

            case FixMeFlags.Skills:
                html.Append("All skills will be normalized if they are detected as invalid.");
                break;

            case FixMeFlags.Quests:
                html.Append("All quests will be repaired if they are detected as invalid.");
                break;
            }

            return(html.ToString());
        }
Ejemplo n.º 3
0
        public static void FixMe(this Mobile m, FixMeFlags flags)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            var oldFlags = flags;

            if (ResolveFlags != null)
            {
                ResolveFlags(m, ref flags);
            }

            if (flags.HasFlag(FixMeFlags.Mount) && OnFixMount != null)
            {
                OnFixMount(m);
                m.SendMessage(0x55, "Your mount has been validated.");
            }
            else if (oldFlags.HasFlag(FixMeFlags.Mount))
            {
                m.SendMessage(0x22, "Fixing mounts is currently unavailable.");
            }

            if (flags.HasFlag(FixMeFlags.Pets) && OnFixPets != null && m is PlayerMobile)
            {
                OnFixPets((PlayerMobile)m);
                m.SendMessage(
                    0x55,
                    "Your pets have been stabled or teleported to you and your follower count has been normalized, it is now {0}.",
                    m.Followers);
            }
            else if (oldFlags.HasFlag(FixMeFlags.Pets))
            {
                m.SendMessage(0x22, "Fixing pets is currently unavailable.");
            }

            if (flags.HasFlag(FixMeFlags.Equip) && OnFixEquip != null && m is PlayerMobile)
            {
                OnFixEquip((PlayerMobile)m);
                m.SendMessage(0x55, "Your equipment has been validated.");
            }
            else if (oldFlags.HasFlag(FixMeFlags.Equip))
            {
                m.SendMessage(0x22, "Fixing equipment is currently unavailable.");
            }

            if (flags.HasFlag(FixMeFlags.Gumps) && OnFixGumps != null)
            {
                OnFixGumps(m);
                m.SendMessage(0x55, "Your gumps have been refreshed.");
            }
            else if (oldFlags.HasFlag(FixMeFlags.Gumps))
            {
                m.SendMessage(0x22, "Fixing gumps is currently unavailable.");
            }

            if (flags.HasFlag(FixMeFlags.Tags) && OnFixTags != null)
            {
                OnFixTags(m);
                m.SendMessage(0x55, "Your character and equipment tags have been refreshed.");
            }
            else if (oldFlags.HasFlag(FixMeFlags.Tags))
            {
                m.SendMessage(0x22, "Fixing character and equipment tags is currently unavailable.");
            }

            if (flags.HasFlag(FixMeFlags.Skills) && OnFixSkills != null)
            {
                OnFixSkills(m);
                m.SendMessage(0x55, "Your skills have been normalized.");
            }
            else if (oldFlags.HasFlag(FixMeFlags.Skills))
            {
                m.SendMessage(0x22, "Fixing skills is currently unavailable.");
            }

            if (flags.HasFlag(FixMeFlags.Quests) && OnFixQuests != null && m is PlayerMobile)
            {
                OnFixQuests((PlayerMobile)m);
                m.SendMessage(0x55, "Your quests have been validated.");
            }
            else if (oldFlags.HasFlag(FixMeFlags.Quests))
            {
                m.SendMessage(0x22, "Fixing quests is currently unavailable.");
            }

            if (OnFix != null)
            {
                OnFix(m, flags);
            }

            m.SendMessage(0x55, "FixMe completed! If you still have issues, contact a member of staff.");
        }
Ejemplo n.º 4
0
        public static void FixMe(this PlayerMobile m, FixMeFlags flags)
        {
            if (m == null || m.Deleted)
            {
                return;
            }

            if (m.Mounted && flags.HasFlag(FixMeFlags.Mount))
            {
                var mountItem = m.FindItemOnLayer(Layer.Mount) as IMountItem;

                if (mountItem != null)
                {
                    if (mountItem.Mount == null || mountItem.Mount != m.Mount)
                    {
                        m.RemoveItem(mountItem as Item);
                    }
                    else if (mountItem.Mount.Rider == null)
                    {
                        mountItem.Mount.Rider = m;
                    }
                }
                else if (m.Mount != null && m.Mount.Rider == null)
                {
                    m.Mount.Rider = m;
                }

                m.Delta(MobileDelta.Followers);
                m.SendMessage(0x55, "Your mount has been invalidated.");
            }

            if (flags.HasFlag(FixMeFlags.Pets))
            {
                m.Followers = 0;
                m.AllFollowers.ToArray().ForEach(
                    f =>
                {
                    if (f == null || !(f is BaseCreature))
                    {
                        return;
                    }

                    var pet = (BaseCreature)f;

                    if (pet.IsStabled || !pet.Controlled || pet.ControlMaster != m)
                    {
                        return;
                    }

                    if (pet != m.Mount)
                    {
                        pet.MoveToWorld(m.Location, m.Map);
                        pet.ControlTarget = m;
                        pet.ControlOrder  = OrderType.Follow;
                    }

                    m.Followers += pet.ControlSlots;
                });

                m.Followers = Math.Max(0, Math.Min(m.FollowersMax, m.Followers));
                m.Delta(MobileDelta.Followers);

                m.SendMessage(
                    0x55,
                    "Your pets have been teleported to you and your follower count has been normalized, it is now {0}.",
                    m.Followers);
            }

            if (flags.HasFlag(FixMeFlags.Equip))
            {
                m.ValidateEquipment();
            }

            if (m.IsOnline() && flags.HasFlag(FixMeFlags.Gumps))
            {
                foreach (Gump gump in m.NetState.Gumps.ToArray())
                {
                    if (gump is SuperGump)
                    {
                        ((SuperGump)gump).Refresh();
                    }
                    else if (m.HasGump(gump.GetType()))
                    {
                        m.CloseGump(gump.GetType());
                        m.SendGump(gump);
                    }
                }

                m.SendMessage(0x55, "Your gumps have been refreshed.");
            }

            if (flags.HasFlag(FixMeFlags.Tags))
            {
                m.InvalidateProperties();

                m.Items.ForEach(
                    item =>
                {
                    if (item != null && !item.Deleted)
                    {
                        item.InvalidateProperties();
                    }
                });

                if (m.Backpack != null)
                {
                    m.Backpack.InvalidateProperties();
                    m.Backpack.FindItemsByType <Item>(true).ForEach(
                        item =>
                    {
                        if (item != null && !item.Deleted)
                        {
                            item.InvalidateProperties();
                        }
                    });
                }

                m.SendMessage(0x55, "Your tags have been invalidated.");
            }

            if (flags.HasFlag(FixMeFlags.Skills))
            {
                foreach (Skill skill in m.Skills)
                {
                    skill.Normalize();
                }

                m.SendMessage(0x55, "Your skills have been normalized.");
            }

            if (flags.HasFlag(FixMeFlags.Quests))
            {
                if (m.Quest != null)
                {
                    if (m.Quest.From == null)
                    {
                        m.Quest.From = m;
                    }

                    if (m.Quest.Objectives == null || m.Quest.Objectives.Count == 0 || m.Quest.Conversations == null ||
                        m.Quest.Conversations.Count == 0)
                    {
                        m.Quest.Cancel();
                    }
                }

                m.SendMessage(0x55, "Your quests have been validated.");
            }

            if (OnFix != null)
            {
                OnFix(m, flags);
            }

            m.SendMessage(0x55, "FixMe completed! If you still have issues, contact a member of staff.");
        }