Exemplo n.º 1
0
        public static void RecurseExport(XmlTextWriter xml, CategoryEntry ce)
        {
            xml.WriteStartElement("category");

            xml.WriteAttributeString("title", ce.Title);

            List <CategoryEntry> subCats = new List <CategoryEntry>(ce.SubCategories);

            subCats.Sort(new CategorySorter());

            for (int i = 0; i < subCats.Count; ++i)
            {
                RecurseExport(xml, subCats[i]);
            }

            ce.Matched.Sort(new CategoryTypeSorter());

            for (int i = 0; i < ce.Matched.Count; ++i)
            {
                CategoryTypeEntry cte = ce.Matched[i];

                xml.WriteStartElement("object");

                xml.WriteAttributeString("type", cte.Type.ToString());

                if (cte.Object is Item item)
                {
                    int itemID = item.ItemID;

                    if (item is BaseAddon addon && addon.Components.Count == 1)
                    {
                        itemID = addon.Components[0].ItemID;
                    }

                    if (itemID > TileData.MaxItemValue)
                    {
                        itemID = 1;
                    }

                    xml.WriteAttributeString("gfx", XmlConvert.ToString(itemID));

                    int hue = item.Hue & 0x7FFF;

                    if ((hue & 0x4000) != 0)
                    {
                        hue = 0;
                    }

                    if (hue != 0)
                    {
                        xml.WriteAttributeString("hue", XmlConvert.ToString(hue));
                    }

                    item.Delete();
                }
                else if (cte.Object is Mobile mob)
                {
                    int itemID = ShrinkTable.Lookup(mob, 1);

                    xml.WriteAttributeString("gfx", XmlConvert.ToString(itemID));

                    int hue = mob.Hue & 0x7FFF;

                    if ((hue & 0x4000) != 0)
                    {
                        hue = 0;
                    }

                    if (hue != 0)
                    {
                        xml.WriteAttributeString("hue", XmlConvert.ToString(hue));
                    }

                    mob.Delete();
                }

                xml.WriteEndElement();
            }

            xml.WriteEndElement();
        }
Exemplo n.º 2
0
        public virtual void AddPaperdoll(
            int x,
            int y,
            bool bg,
            bool props,
            IEnumerable <Item> list,
            Body body,
            int hue           = 0,
            int solidHue      = -1,
            int hairID        = 0,
            int hairHue       = 0,
            int facialHairID  = 0,
            int facialHairHue = 0)
        {
            if (bg)
            {
                AddBackground(x, y, 200, 250, 2620);
            }

            x += 5;
            y += 5;

            if (solidHue >= 0)
            {
                hue = solidHue;
            }

            int doll = ArtworkSupport.LookupGump(body);

            if (doll <= 0)
            {
                doll = ShrinkTable.Lookup(body, 0);

                if (doll > 0)
                {
                    if (hue > 0 && hue <= 3000)
                    {
                        AddItem(x, y, doll, hue - 1);
                    }
                    else
                    {
                        AddItem(x, y, doll);
                    }

                    return;
                }
            }

            if (doll <= 0)
            {
                return;
            }

            if (hue > 0 && hue <= 3000)
            {
                AddImage(x, y, doll, hue - 1);
            }
            else
            {
                AddImage(x, y, doll);
            }

            var items = list.ToList();

            items.SortLayers();

            bool alive     = !body.IsGhost;
            bool hideHair  = body.IsGhost;
            bool hidePants = false;

            var propsList = props ? new List <Item>(items.Count) : null;

            foreach (Item item in items.TakeWhile(item => item.Layer.IsOrdered()).Where(item => alive || item.ItemID == 8270))
            {
                if (item.ItemID == 0x1411 || item.ItemID == 0x141A)                 // plate legs
                {
                    hidePants = true;
                }
                else if (hidePants && item.Layer == Layer.Pants)
                {
                    continue;
                }

                if (!hideHair && item.Layer == Layer.Helm)
                {
                    hideHair = true;
                }

                var gump = ArtworkSupport.LookupGump(item.ItemID, body.IsFemale);

                if (gump <= 0)
                {
                    continue;
                }

                int iHue = solidHue >= 0 ? solidHue : item.Hue;

                if (iHue > 0 && iHue <= 3000)
                {
                    AddImage(x, y, gump, iHue - 1);
                }
                else
                {
                    AddImage(x, y, gump);
                }

                if (props)
                {
                    propsList.Add(item);
                }
            }

            if (alive && facialHairID > 0)
            {
                var gump = ArtworkSupport.LookupGump(facialHairID, body.IsFemale);

                if (gump > 0)
                {
                    int hHue = solidHue >= 0 ? solidHue : facialHairHue;

                    if (hHue > 0 && hHue <= 3000)
                    {
                        AddImage(x, y, gump, hHue - 1);
                    }
                    else
                    {
                        AddImage(x, y, gump);
                    }
                }
            }

            if (!hideHair && hairID > 0)
            {
                var gump = ArtworkSupport.LookupGump(hairID, body.IsFemale);

                if (gump > 0)
                {
                    int hHue = solidHue >= 0 ? solidHue : hairHue;

                    if (hHue > 0 && hHue <= 3000)
                    {
                        AddImage(x, y, gump, hHue - 1);
                    }
                    else
                    {
                        AddImage(x, y, gump);
                    }
                }
            }

            items.Free(true);

            if (!props)
            {
                return;
            }

            foreach (var item in propsList)
            {
                foreach (var b in item.GetPaperdollBounds())
                {
                    AddLabelCropped(x + b.X, y + b.Y, b.Width, b.Height, 0, " ");
                    AddProperties(item);
                }
            }

            propsList.Free(true);
        }
Exemplo n.º 3
0
        public override void OnCast()
        {
            if (!Caster.CanBeginAction(typeof(MutationSpell)))
            {
                if (Caster is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)Caster;
                    pm.Transformation.OnTransformationChange(0, null, -1, true);
                }
                else
                {
                    Caster.BodyMod = 0;
                    Caster.NameMod = null;
                }

                Caster.EndAction(typeof(MutationSpell));

                Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head);
                Caster.PlaySound(0x3BD);

                if (Caster is PlayerMobile)
                {
                    ((PlayerMobile)Caster).CheckRaceSkin();
                }

                BaseArmor.ValidateMobile(Caster);
            }
            else if (m_NewBody == 0)
            {
                ArrayList entries = new ArrayList();
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Dragonnet", ShrinkTable.Lookup(12), 12, 1015237, 0, 0, 0, 0, 2174));
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Arbre sylvestre", ShrinkTable.Lookup(301), 301, 1015246, 0, 0, 0, 0, 0));
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Golem d'os", ShrinkTable.Lookup(308), 308, 1015246, 0, 0, 0, 0, 0));
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Golem de chaire", ShrinkTable.Lookup(304), 304, 1015237, 0, 0, 0, 0, 0));
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Demonologue", ShrinkTable.Lookup(318), 318, 1015246, 0, 0, 0, 0, 0));
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Mangeur d'âmes", ShrinkTable.Lookup(303), 303, 1015246, 0, 0, 0, 0, 0));

                Caster.SendGump(new MetamorphoseGump(Caster, Scroll, entries, 6));
            }
            else if (!CheckTransformation(Caster, Caster))
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(MutationSpell)))
                {
                    if (m_NewBody != 0)
                    {
                        if (!((Body)m_NewBody).IsHuman)
                        {
                            Mobiles.IMount mt = Caster.Mount;

                            if (mt != null)
                            {
                                mt.Rider = null;
                            }
                        }

                        if (Caster is PlayerMobile)
                        {
                            PlayerMobile pm = (PlayerMobile)Caster;
                            pm.Transformation.OnTransformationChange(m_NewBody, m_NameMod, m_HueMod, true);
                        }
                        else
                        {
                            Caster.BodyMod = m_NewBody;
                            Caster.NameMod = m_NameMod;
                            Caster.HueMod  = m_HueMod;
                        }

                        Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head);
                        Caster.PlaySound(0x3BD);
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 4
0
        public AdvancedBuyInfo(
            AdvancedSBInfo parent,
            Type type,
            int price,
            string name   = null,
            int amount    = 100,
            object[] args = null)
            : base(name, type, price, amount, 0, 0, args)
        {
            Parent = parent;

            var e = GetDisplayEntity();

            if (e is Mobile)
            {
                var m = (Mobile)e;

                if (String.IsNullOrWhiteSpace(name))
                {
                    Name = m.RawName ?? type.Name.SpaceWords();
                }
                else
                {
                    m.RawName = name;
                }

                ItemID = ShrinkTable.Lookup(m);
                Hue    = m.Hue;

                if (m is BaseCreature)
                {
                    Slots = ((BaseCreature)m).ControlSlots;
                }
            }
            else if (e is Item)
            {
                var i = (Item)e;

                if (String.IsNullOrWhiteSpace(name))
                {
                    Name = i.ResolveName();
                }
                else
                {
                    i.Name = name;
                }

                ItemID = i.ItemID;
                Hue    = i.Hue;

                #region IShrinkItem

                /*if (i is IShrinkItem)
                 * {
                 *      var si = (IShrinkItem)i;
                 *
                 *      if (si.Linked)
                 *      {
                 *              Slots = si.Link.ControlSlots;
                 *      }
                 * }*/
                #endregion
            }
            else if (String.IsNullOrWhiteSpace(name))
            {
                Name = type.Name.SpaceWords();
            }
        }
Exemplo n.º 5
0
        public AdvancedBuyInfo(
            AdvancedSBInfo parent,
            Type type,
            int price,
            string name   = null,
            int amount    = 100,
            object[] args = null)
            : base(name, type, price, amount, 0, 0, args)
        {
            Parent = parent;

            var e = GetDisplayEntity();

            if (e is Mobile)
            {
                var m = (Mobile)e;

                if (String.IsNullOrWhiteSpace(name))
                {
                    Name = m.RawName ?? type.Name.SpaceWords();
                }
                else
                {
                    m.RawName = name;
                }

                ItemID = ShrinkTable.Lookup(m);
                Hue    = m.Hue;

                if (m is BaseCreature)
                {
                    Slots = ((BaseCreature)m).ControlSlots;
                }
            }
            else if (e is Item)
            {
                var i = (Item)e;

                if (String.IsNullOrWhiteSpace(name))
                {
                    Name = i.ResolveName();
                }
                else
                {
                    i.Name = name;
                }

                ItemID = i.ItemID;
                Hue    = i.Hue;

                int slots;

                if (i.GetPropertyValue("ControlSlots", out slots))
                {
                    Slots = slots;
                }
            }
            else if (String.IsNullOrWhiteSpace(name))
            {
                Name = type.Name.SpaceWords();
            }
        }
Exemplo n.º 6
0
        private static void LoadLists()
        {
            m_Monster = new ArrayList();
            m_Animal  = new ArrayList();
            m_Sea     = new ArrayList();
            m_Human   = new ArrayList();

            System.Collections.Generic.List <BodyEntry> entries = Docs.LoadBodies();

            for (int i = 0; i < entries.Count; ++i)
            {
                BodyEntry oldEntry = entries[i];
                int       bodyID   = oldEntry.Body.BodyID;

                if (((Body)bodyID).IsEmpty)
                {
                    continue;
                }

                ArrayList list = null;

                switch (oldEntry.BodyType)
                {
                case ModelBodyType.Monsters:
                    list = m_Monster;
                    break;

                case ModelBodyType.Animals:
                    list = m_Animal;
                    break;

                case ModelBodyType.Sea:
                    list = m_Sea;
                    break;

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

                if (list == null)
                {
                    continue;
                }

                int itemID = ShrinkTable.Lookup(bodyID, -1);

                if (itemID != -1)
                {
                    list.Add(new InternalEntry(bodyID, itemID, oldEntry.Name));
                }
            }

            if (m_Monster != null)
            {
                m_Monster.Sort();
            }

            if (m_Animal != null)
            {
                m_Animal.Sort();
            }

            if (m_Sea != null)
            {
                m_Sea.Sort();
            }

            if (m_Human != null)
            {
                m_Human.Sort();
            }
        }
Exemplo n.º 7
0
        public override void AppendTo(IGumpWriter disp)
        {
            disp.AppendLayout(_Layout0);
            disp.AppendLayout(-1);

            var hue = _BodyHue & 0x7FFF;

            if (_SolidHue >= 0)
            {
                hue = _SolidHue;
            }

            var gump = ArtworkSupport.LookupGump(_Body);

            if (gump <= 0)
            {
                gump = ShrinkTable.Lookup(_Body, 0);

                if (gump > 0)
                {
                    if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
                    {
                        disp.AppendLayout(_Layout4);
                    }
                    else
                    {
                        disp.AppendLayout(_Layout3);
                    }

                    disp.AppendLayout(_X);
                    disp.AppendLayout(_Y);
                    disp.AppendLayout(gump);

                    if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
                    {
                        disp.AppendLayout(FixHue(hue));
                    }
                }

                return;
            }

            disp.AppendLayout(_Layout2);
            disp.AppendLayout(_X);
            disp.AppendLayout(_Y);
            disp.AppendLayout(gump);

            if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
            {
                disp.AppendLayout(_Layout2Hue);
                disp.AppendLayoutNS(FixHue(hue));
            }

            var hideHair  = _Body.IsGhost;
            var hidePants = false;
            var props     = String.Empty;

            AppendTo(disp, ref props, ref hidePants, ref hideHair);

            if (!_Body.IsGhost && _FacialHairID > 0)
            {
                gump = ArtworkSupport.LookupGump(_FacialHairID, _Body.IsFemale);

                if (gump > 0)
                {
                    disp.AppendLayout(_Layout2);
                    disp.AppendLayout(_X);
                    disp.AppendLayout(_Y);
                    disp.AppendLayout(gump);

                    hue = _SolidHue >= 0 ? _SolidHue : _FacialHairHue;

                    if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
                    {
                        disp.AppendLayout(_Layout2Hue);
                        disp.AppendLayoutNS(FixHue(hue));
                    }
                }
            }

            if (!hideHair && _HairID > 0)
            {
                gump = ArtworkSupport.LookupGump(_HairID, _Body.IsFemale);

                if (gump > 0)
                {
                    disp.AppendLayout(_Layout2);
                    disp.AppendLayout(_X);
                    disp.AppendLayout(_Y);
                    disp.AppendLayout(gump);

                    hue = _SolidHue >= 0 ? _SolidHue : _HairHue;

                    if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
                    {
                        disp.AppendLayout(_Layout2Hue);
                        disp.AppendLayoutNS(FixHue(hue));
                    }
                }
            }

            if (!_Properties || String.IsNullOrWhiteSpace(props))
            {
                return;
            }

            var noHue  = FixHue(0);
            var noText = Parent.Intern(" ");

            props = props.Trim(',');

            foreach (var item in props.Split(',').Select(Int32.Parse).Select(s => _Items.Find(i => i.Serial.Value == s)))
            {
                foreach (var b in item.GetGumpBounds())
                {
                    disp.AppendLayout(_Layout5);
                    disp.AppendLayout(_X + b.X);
                    disp.AppendLayout(_Y + b.Y);
                    disp.AppendLayout(b.Width);
                    disp.AppendLayout(b.Height);
                    disp.AppendLayout(noHue);
                    disp.AppendLayout(noText);

                    disp.AppendLayout(_Layout6);
                    disp.AppendLayout(item.Serial.Value);
                }
            }
        }
Exemplo n.º 8
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (target == from)
                {
                    from.SendMessage("You cant shrink yourself!");
                }
                else if (target is PlayerMobile)
                {
                    from.SendMessage("That person gives you a dirty look.");
                }
                else if (target is Item)
                {
                    from.SendMessage("You can only shrink pets that you own");
                }
                else if (target is BaseBioCreature)
                {
                    from.SendMessage("Unnatural creatures cannot be shrunk");
                }
                else if (Server.Spells.SpellHelper.CheckCombat(from))
                {
                    from.SendMessage("You cannot shrink your pet while your fighting.");
                }
                else if (target is BaseCreature)
                {
                    BaseCreature c = (BaseCreature)target;

                    bool   packanimal = false;
                    Type   typ        = c.GetType();
                    string nam        = typ.Name;

                    foreach (string ispack in FSATS.PackAnimals)
                    {
                        if (ispack == nam)
                        {
                            packanimal = true;
                        }
                    }

                    if (c.BodyValue == 400 || c.BodyValue == 401 && c.Controlled == false)
                    {
                        from.SendMessage("That person gives you a dirty look.");
                    }
                    else if (c.ControlMaster != from && c.Controlled == false)
                    {
                        from.SendMessage("This is not your pet.");
                    }
                    else if (packanimal == true && (c.Backpack != null && c.Backpack.Items.Count > 0))
                    {
                        from.SendMessage("You must unload your pets backpack first.");
                    }
                    else if (c.IsDeadPet)
                    {
                        from.SendMessage("You cannot shrink the dead.");
                    }
                    else if (c.Summoned)
                    {
                        from.SendMessage("You cannot shrink a summoned creature.");
                    }
                    else if (c.Combatant != null && c.InRange(c.Combatant, 12) && c.Map == c.Combatant.Map)
                    {
                        from.SendMessage("Your pet is fighting, You cannot shrink it yet.");
                    }
                    else if (c.BodyMod != 0)
                    {
                        from.SendMessage("You cannot shrink your pet while its polymorphed.");
                    }
                    //else if ( Server.Spells.LostArts.CharmBeastSpell.IsCharmed( c ) )
                    //{
                    //	from.SendMessage( "Your hold over this pet is not strong enough to shrink it." );
                    //}
                    else if (c.Controlled == true && c.ControlMaster == from)
                    {
                        Type       type = c.GetType();
                        ShrinkItem si   = new ShrinkItem();
                        si.MobType  = type;
                        si.Pet      = c;
                        si.PetOwner = from;
                        if (c is BaseMount)
                        {
                            BaseMount mount = (BaseMount)c;
                            si.MountID = mount.ItemID;
                        }
                        from.AddToBackpack(si);

                        IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                        IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);

                        Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(c), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                        from.PlaySound(492);

                        c.Delete();
                        m_Powder.Charges -= 1;
                        if (m_Powder.Charges == 0)
                        {
                            m_Powder.Delete();
                        }
                    }
                }
            }
Exemplo n.º 9
0
 public override int GetPreviewIcon(TMobile t)
 {
     return(t == null ? HueSelector.DefaultIcon : ShrinkTable.Lookup(t));
 }
Exemplo n.º 10
0
        public override string Compile()
        {
            var compiled = String.Format(_Format0, _X, _Y, Width, Height, " ".WrapUOHtmlBG(Color.Transparent));

            var hue = _BodyHue & 0x7FFF;

            if (_SolidHue >= 0)
            {
                hue = _SolidHue;
            }

            var gump = ArtworkSupport.LookupGump(_Body);

            if (gump <= 0)
            {
                gump = ShrinkTable.Lookup(_Body, 0);

                if (gump > 0)
                {
                    if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
                    {
                        compiled += String.Format(_Format3, _X, _Y, gump, FixHue(hue));
                    }
                    else
                    {
                        compiled += String.Format(_Format2, _X, _Y, gump);
                    }
                }

                return(compiled);
            }

            if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
            {
                compiled += String.Format(_Format1B, _X, _Y, gump, FixHue(hue));
            }
            else
            {
                compiled += String.Format(_Format1A, _X, _Y, gump);
            }

            var hideHair  = _Body.IsGhost;
            var hidePants = false;
            var props     = String.Empty;

            compiled += Compile(ref props, ref hidePants, ref hideHair);

            if (!_Body.IsGhost && _FacialHairID > 0)
            {
                gump = ArtworkSupport.LookupGump(_FacialHairID, _Body.IsFemale);

                if (gump > 0)
                {
                    hue = _SolidHue >= 0 ? _SolidHue : _FacialHairHue;

                    if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
                    {
                        compiled += String.Format(_Format1B, _X, _Y, gump, FixHue(hue));
                    }
                    else
                    {
                        compiled += String.Format(_Format1A, _X, _Y, gump);
                    }
                }
            }

            if (!hideHair && _HairID > 0)
            {
                gump = ArtworkSupport.LookupGump(_HairID, _Body.IsFemale);

                if (gump > 0)
                {
                    hue = _SolidHue >= 0 ? _SolidHue : _HairHue;

                    if (hue > 0 || (_SolidHue >= 0 && hue == _SolidHue))
                    {
                        compiled += String.Format(_Format1B, _X, _Y, gump, FixHue(hue));
                    }
                    else
                    {
                        compiled += String.Format(_Format1A, _X, _Y, gump);
                    }
                }
            }

            return(compiled + props);
        }
Exemplo n.º 11
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (Server.Spells.SpellHelper.CheckCombat(from))
                {
                    from.SendMessage("You cannot shrink your pet while your in combat.");
                }
                else if (target is BaseCreature)
                {
                    BaseCreature bc = (BaseCreature)target;

                    if (Server.Spells.SpellHelper.CheckCombat(bc))
                    {
                        from.SendMessage("You cannont shrink your pet while its in combat.");
                    }
                    else if (bc.Summoned)
                    {
                        from.SendMessage("You cannont shrink a summoned pet.");
                    }
                    else if (!from.InRange(bc, 5))
                    {
                        from.SendMessage("You need to be closer to shrink that pet.");
                    }
                    else if (bc.BodyMod != 0)
                    {
                        from.SendMessage("You cannont shrink your pet while its polymorphed.");
                    }
                    else if (bc.IsDeadPet)
                    {
                        from.SendMessage("That pet is dead.");
                    }
                    else if ((bc is PackLlama || bc is PackHorse || bc is Beetle) && (bc.Backpack != null && bc.Backpack.Items.Count > 0))
                    {
                        from.SendMessage("You must unload your pets pack before you shrink it.");
                    }
                    else if (!bc.Controlled)
                    {
                        from.SendMessage("You have to tame the creature first before you can shrink it.");
                    }
                    else if (bc.Controlled && bc.ControlMaster == from)
                    {
                        #region Creation
                        ShrinkItem si = new ShrinkItem();
                        si.Creature = bc;
                        si.Owner    = from;

                        if (bc.Hue != 0)
                        {
                            si.Hue = bc.Hue;
                        }
                        #endregion

                        #region Effect
                        IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                        IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);
                        Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(bc), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                        from.PlaySound(492);
                        #endregion

                        #region Internalize
                        bc.Controlled    = true;
                        bc.ControlMaster = null;
                        bc.Internalize();
                        bc.OwnerAbandonTime = DateTime.MinValue;
                        bc.IsStabled        = true;
                        #endregion

                        #region Uses
                        m_Shrinker.Uses -= 1;

                        if (m_Shrinker.Uses == 0)
                        {
                            m_Shrinker.Delete();
                        }
                        #endregion

                        from.AddToBackpack(si);
                    }
                    else
                    {
                        from.SendMessage("Thats not your pet you may not shrink it.");
                    }
                }
                else
                {
                    from.SendMessage("You cannont shrink that.");
                }
            }
Exemplo n.º 12
0
        public AnimalLoreGump(PlayerMobile player, BaseCreature creature, AnimalLoreGumpPage page, List <TraitSelectionType> traitSelections) : base(50, 50)
        {
            if (player == null || creature == null)
            {
                return;
            }

            pm_Player   = player;
            bc_Creature = creature;
            m_Page      = page;

            m_TraitGumpSelections.Clear();

            //Populate Trait Gump Selections
            if (traitSelections.Count == 0)
            {
                for (int a = 0; a < BaseCreature.MaxExperienceLevel; a++)
                {
                    m_TraitGumpSelections.Add(TraitSelectionType.None);
                }
            }

            else
            {
                for (int a = 0; a < traitSelections.Count; a++)
                {
                    m_TraitGumpSelections.Add(traitSelections[a]);
                }
            }

            Closable   = true;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);

            int HeaderTextHue      = 2603;
            int WhiteTextHue       = 2655; //2036;
            int GreyTextHue        = 2036;
            int MainTextHue        = 149;  // 149; //2036
            int BlueTextHue        = 2603;
            int GreenTextHue       = 0x3F;
            int RedTextHue         = 0x22;
            int ValueTextHue       = 2655; // 2036; //2610
            int DifficultyTextHue  = 2114;
            int SlayerGroupTextHue = 2606;

            AddImage(8, 4, 1250, 2499); //Background

            string creatureDisplayName = bc_Creature.GetTamedDisplayName();

            AddLabel(Utility.CenteredTextOffset(170, creatureDisplayName), 15, HeaderTextHue, creatureDisplayName);

            int traitsAvailable = FollowerTraits.GetFollowerTraitsAvailable(bc_Creature);

            AddLabel(10, 0, 149, "Guide");
            AddButton(14, 15, 2094, 2095, 1, GumpButtonType.Reply, 0);

            switch (m_Page)
            {
            //Main
            case AnimalLoreGumpPage.Stats:
                if (bc_Creature.Tameable)
                {
                    AddLabel(78, 370, WhiteTextHue, "Traits");
                    AddButton(45, 369, 4011, 4013, 2, GumpButtonType.Reply, 0);

                    if (traitsAvailable > 0)
                    {
                        AddLabel(123, 370, GreenTextHue, "(" + traitsAvailable.ToString() + " Available)");
                    }

                    AddButton(221, 369, 4029, 4031, 3, GumpButtonType.Reply, 0);
                    AddLabel(259, 370, WhiteTextHue, "Info");
                }

                #region Main

                int shrinkTableIcon = ShrinkTable.Lookup(bc_Creature);

                if (shrinkTableIcon == 6256)
                {
                    shrinkTableIcon = 7960;
                }

                if (bc_Creature.IsHenchman)
                {
                    Custom.BaseHenchman henchman = bc_Creature as Custom.BaseHenchman;

                    int henchmanIcon = 8454;
                    int henchmanHue  = 0;

                    if (bc_Creature.Female)
                    {
                        henchmanIcon = 8455;
                    }

                    if (!henchman.HenchmanHumanoid)
                    {
                        henchmanIcon = bc_Creature.TamedItemId;
                        henchmanHue  = bc_Creature.TamedItemHue;
                    }

                    AddItem(74 + bc_Creature.TamedItemXOffset, 62 + bc_Creature.TamedItemYOffset, henchmanIcon, henchmanHue);
                }

                else
                {
                    if (bc_Creature.TamedItemId != -1)     //Creature Icon
                    {
                        AddItem(74 + bc_Creature.TamedItemXOffset, 62 + bc_Creature.TamedItemYOffset, bc_Creature.TamedItemId, bc_Creature.TamedItemHue);
                    }

                    else
                    {
                        AddItem(74 + bc_Creature.TamedItemXOffset, 62 + bc_Creature.TamedItemYOffset, shrinkTableIcon, 0);
                    }
                }

                string creatureDifficulty = Utility.CreateDecimalString(bc_Creature.InitialDifficulty, 1);
                string slayerGroup        = bc_Creature.SlayerGroup.ToString();

                int level         = bc_Creature.ExperienceLevel;
                int experience    = bc_Creature.Experience;
                int maxExperience = 0;

                if (bc_Creature.ExperienceLevel < BaseCreature.MaxExperienceLevel)
                {
                    maxExperience = BaseCreature.ExperiencePerLevel[bc_Creature.ExperienceLevel];
                }

                double passiveTamingSkillGainRemaining = player.m_PassiveSkillGainRemaining;

                if (!bc_Creature.InPassiveTamingSkillGainRange(player))
                {
                    passiveTamingSkillGainRemaining = 0;
                }

                string passiveTamingSkillGainRemainingText = Utility.CreateDecimalString(passiveTamingSkillGainRemaining, 1);

                if (!(bc_Creature.Controlled && bc_Creature.ControlMaster == player))
                {
                    passiveTamingSkillGainRemainingText = "-";
                }

                int hitsAdjusted    = bc_Creature.Hits;
                int hitsMaxAdjusted = bc_Creature.HitsMax;

                int stamAdjusted    = bc_Creature.Stam;
                int stamMaxAdjusted = bc_Creature.StamMax;

                int manaAdjusted    = bc_Creature.Mana;
                int manaMaxAdjusted = bc_Creature.ManaMax;

                int minDamageAdjusted = bc_Creature.DamageMin;
                int maxDamageAdjusted = bc_Creature.DamageMax;

                double wrestlingAdjusted   = bc_Creature.Skills.Wrestling.Value;
                double evalIntAdjusted     = bc_Creature.Skills.EvalInt.Value;
                double mageryAdjusted      = bc_Creature.Skills.Magery.Value;
                double magicResistAdjusted = bc_Creature.Skills.MagicResist.Value;
                double poisoningAdjusted   = bc_Creature.Skills.Poisoning.Value;

                int virtualArmorAdjusted = bc_Creature.VirtualArmor;

                //Tamed Scalars
                string hitsTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseMaxHitsCreationScalar - 1), 1);
                int    hitsTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseMaxHitsCreationScalar - 1) >= 0)
                {
                    hitsTamedScalar = "+" + hitsTamedScalar;
                    hitsTamedColor  = GreenTextHue;
                }
                if (hitsTamedScalar.Length == 3)
                {
                    hitsTamedScalar = hitsTamedScalar.Insert(2, ".0");
                }

                string stamTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseDexCreationScalar - 1), 1);
                int    stamTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseDexCreationScalar - 1) >= 0)
                {
                    stamTamedScalar = "+" + stamTamedScalar;
                    stamTamedColor  = GreenTextHue;
                }
                if (stamTamedScalar.Length == 3)
                {
                    stamTamedScalar = stamTamedScalar.Insert(2, ".0");
                }

                string manaTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseMaxManaCreationScalar - 1), 1);
                int    manaTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseMaxManaCreationScalar - 1) >= 0)
                {
                    manaTamedScalar = "+" + manaTamedScalar;
                    manaTamedColor  = GreenTextHue;
                }
                if (manaTamedScalar.Length == 3)
                {
                    manaTamedScalar = manaTamedScalar.Insert(2, ".0");
                }

                string damageTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseMaxDamageCreationScalar - 1), 1);
                int    damageTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseMaxDamageCreationScalar - 1) >= 0)
                {
                    damageTamedScalar = "+" + damageTamedScalar;
                    damageTamedColor  = GreenTextHue;
                }
                if (damageTamedScalar.Length == 3)
                {
                    damageTamedScalar = damageTamedScalar.Insert(2, ".0");
                }

                string virtualArmorTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseVirtualArmorCreationScalar - 1), 1);
                int    virtualArmorTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseVirtualArmorCreationScalar - 1) >= 0)
                {
                    virtualArmorTamedScalar = "+" + virtualArmorTamedScalar;
                    virtualArmorTamedColor  = GreenTextHue;
                }
                if (virtualArmorTamedScalar.Length == 3)
                {
                    virtualArmorTamedScalar = virtualArmorTamedScalar.Insert(2, ".0");
                }

                string wrestlingTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseWrestlingCreationScalar - 1), 1);
                int    wrestlingTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseWrestlingCreationScalar - 1) >= 0)
                {
                    wrestlingTamedScalar = "+" + wrestlingTamedScalar;
                    wrestlingTamedColor  = GreenTextHue;
                }
                if (wrestlingTamedScalar.Length == 3)
                {
                    wrestlingTamedScalar = wrestlingTamedScalar.Insert(2, ".0");
                }

                string evalIntTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseEvalIntCreationScalar - 1), 1);
                int    evalIntTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseEvalIntCreationScalar - 1) >= 0)
                {
                    evalIntTamedScalar = "+" + evalIntTamedScalar;
                    evalIntTamedColor  = GreenTextHue;
                }
                if (evalIntTamedScalar.Length == 3)
                {
                    evalIntTamedScalar = evalIntTamedScalar.Insert(2, ".0");
                }

                string mageryTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseMageryCreationScalar - 1), 1);
                int    mageryTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseMageryCreationScalar - 1) >= 0)
                {
                    mageryTamedScalar = "+" + mageryTamedScalar;
                    mageryTamedColor  = GreenTextHue;
                }
                if (mageryTamedScalar.Length == 3)
                {
                    mageryTamedScalar = mageryTamedScalar.Insert(2, ".0");
                }

                string magicResistTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBaseMagicResistCreationScalar - 1), 1);
                int    magicResistTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBaseMagicResistCreationScalar - 1) >= 0)
                {
                    magicResistTamedScalar = "+" + magicResistTamedScalar;
                    magicResistTamedColor  = GreenTextHue;
                }
                if (magicResistTamedScalar.Length == 3)
                {
                    magicResistTamedScalar = magicResistTamedScalar.Insert(2, ".0");
                }

                string poisoningTamedScalar = Utility.CreateDecimalPercentageString((bc_Creature.TamedBasePoisoningCreationScalar - 1), 1);
                int    poisoningTamedColor  = RedTextHue;
                if ((bc_Creature.TamedBasePoisoningCreationScalar - 1) >= 0)
                {
                    poisoningTamedScalar = "+" + poisoningTamedScalar;
                    poisoningTamedColor  = GreenTextHue;
                }
                if (poisoningTamedScalar.Length == 3)
                {
                    poisoningTamedScalar = poisoningTamedScalar.Insert(2, ".0");
                }

                if (bc_Creature.Controlled && bc_Creature.ControlMaster is PlayerMobile)
                {
                    AddLabel(166, 50, MainTextHue, "Level:");
                    if (traitsAvailable > 0)
                    {
                        AddLabel(210, 50, GreenTextHue, level.ToString());
                    }
                    else
                    {
                        AddLabel(210, 50, ValueTextHue, level.ToString());
                    }

                    if (bc_Creature.ExperienceLevel < BaseCreature.MaxExperienceLevel)
                    {
                        AddLabel(175, 70, MainTextHue, "Exp:");
                        AddLabel(210, 70, ValueTextHue, experience.ToString() + " / " + maxExperience.ToString());
                    }

                    else
                    {
                        AddLabel(175, 70, MainTextHue, "Exp:");
                        AddLabel(210, 70, ValueTextHue, "Maxed");
                    }

                    AddLabel(160, 90, MainTextHue, "Passive Taming");
                    AddLabel(130, 105, MainTextHue, "Skill Gain Remaining");
                    if (passiveTamingSkillGainRemaining > 0)
                    {
                        AddLabel(260, 100, GreenTextHue, passiveTamingSkillGainRemainingText);
                    }
                    else
                    {
                        AddLabel(260, 100, WhiteTextHue, passiveTamingSkillGainRemainingText);
                    }
                }

                else
                {
                    AddLabel(170, 45, MainTextHue, "Creature Difficulty");
                    AddLabel(Utility.CenteredTextOffset(220, creatureDifficulty), 65, DifficultyTextHue, creatureDifficulty);

                    AddLabel(185, 85, MainTextHue, "Slayer Group");
                    AddLabel(205, 105, SlayerGroupTextHue, slayerGroup);

                    hitsAdjusted    = (int)((double)bc_Creature.TamedBaseMaxHits * bc_Creature.TamedBaseMaxHitsCreationScalar);
                    hitsMaxAdjusted = hitsAdjusted;

                    stamAdjusted    = (int)((double)bc_Creature.TamedBaseDex * bc_Creature.TamedBaseDexCreationScalar);
                    stamMaxAdjusted = stamAdjusted;

                    manaAdjusted    = (int)((double)bc_Creature.TamedBaseMaxMana * bc_Creature.TamedBaseMaxManaCreationScalar);
                    manaMaxAdjusted = manaAdjusted;

                    minDamageAdjusted = (int)((double)bc_Creature.TamedBaseMinDamage * bc_Creature.TamedBaseMinDamageCreationScalar);
                    maxDamageAdjusted = (int)((double)bc_Creature.TamedBaseMaxDamage * bc_Creature.TamedBaseMaxDamageCreationScalar);

                    virtualArmorAdjusted = (int)((double)bc_Creature.TamedBaseVirtualArmor * bc_Creature.TamedBaseVirtualArmorCreationScalar);

                    wrestlingAdjusted   = bc_Creature.TamedBaseWrestling * bc_Creature.TamedBaseWrestlingCreationScalar;
                    evalIntAdjusted     = bc_Creature.TamedBaseEvalInt * bc_Creature.TamedBaseEvalIntCreationScalar;
                    mageryAdjusted      = bc_Creature.TamedBaseMagery * bc_Creature.TamedBaseMageryCreationScalar;
                    magicResistAdjusted = bc_Creature.TamedBaseMagicResist * bc_Creature.TamedBaseMagicResistCreationScalar;
                    poisoningAdjusted   = bc_Creature.TamedBasePoisoning * bc_Creature.TamedBasePoisoningCreationScalar;
                }

                int labelX        = 45;
                int valuesX       = 140;
                int tamedScalarsX = 245;

                int startY = 125;

                int rowHeight = 18;
                int rowSpacer = 0;

                bool showTamedScalars = false;

                if (bc_Creature.Tameable)
                {
                    showTamedScalars = true;

                    if (bc_Creature.IsHenchman)
                    {
                        AddLabel(labelX, startY, MainTextHue, "Min Begging:");
                    }
                    else
                    {
                        AddLabel(labelX, startY, MainTextHue, "Min Taming:");
                    }

                    AddLabel(valuesX, startY, ValueTextHue, bc_Creature.MinTameSkill.ToString());
                    startY += rowHeight;

                    AddLabel(labelX, startY, MainTextHue, "Control Slots:");
                    AddLabel(valuesX, startY, ValueTextHue, bc_Creature.ControlSlots.ToString());

                    AddLabel(242, startY, MainTextHue, "vs Avg.");

                    startY += rowHeight;
                    startY += rowSpacer;
                }

                AddLabel(labelX, startY, MainTextHue, "Hits:");
                AddLabel(valuesX, startY, ValueTextHue, hitsAdjusted + " / " + hitsMaxAdjusted);
                if (showTamedScalars)
                {
                    AddLabel(tamedScalarsX, startY, hitsTamedColor, hitsTamedScalar);
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Stam:");
                AddLabel(valuesX, startY, ValueTextHue, stamAdjusted + " / " + stamMaxAdjusted);
                if (showTamedScalars)
                {
                    AddLabel(tamedScalarsX, startY, stamTamedColor, stamTamedScalar);
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Mana:");
                AddLabel(valuesX, startY, ValueTextHue, manaAdjusted + " / " + manaMaxAdjusted);
                if (showTamedScalars && manaAdjusted > 0 && manaMaxAdjusted > 0)
                {
                    AddLabel(tamedScalarsX, startY, manaTamedColor, manaTamedScalar);
                }

                startY += rowHeight;
                startY += rowSpacer;

                AddLabel(labelX, startY, MainTextHue, "Damage:");
                AddLabel(valuesX, startY, ValueTextHue, minDamageAdjusted + " - " + maxDamageAdjusted);
                if (showTamedScalars)
                {
                    AddLabel(tamedScalarsX, startY, damageTamedColor, damageTamedScalar);
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Armor:");
                AddLabel(valuesX, startY, ValueTextHue, virtualArmorAdjusted.ToString());
                if (showTamedScalars)
                {
                    AddLabel(tamedScalarsX, startY, virtualArmorTamedColor, virtualArmorTamedScalar);
                }

                startY += rowHeight;
                startY += rowSpacer;

                if (bc_Creature.IsHenchman)
                {
                    AddLabel(labelX, startY, MainTextHue, "Combat Skill:");
                }
                else
                {
                    AddLabel(labelX, startY, MainTextHue, "Wrestling:");
                }
                AddLabel(valuesX, startY, ValueTextHue, RoundToTenth(wrestlingAdjusted).ToString());
                if (showTamedScalars)
                {
                    AddLabel(tamedScalarsX, startY, wrestlingTamedColor, wrestlingTamedScalar);
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Magery:");
                if (mageryAdjusted == 0)
                {
                    AddLabel(valuesX, startY, ValueTextHue, "-");
                }
                else
                {
                    AddLabel(valuesX, startY, ValueTextHue, RoundToTenth(mageryAdjusted).ToString());
                    if (showTamedScalars)
                    {
                        AddLabel(tamedScalarsX, startY, mageryTamedColor, mageryTamedScalar);
                    }
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Eval Int:");
                if (evalIntAdjusted == 0)
                {
                    AddLabel(valuesX, startY, ValueTextHue, "-");
                }
                else
                {
                    AddLabel(valuesX, startY, ValueTextHue, RoundToTenth(evalIntAdjusted).ToString());
                    if (showTamedScalars)
                    {
                        AddLabel(tamedScalarsX, startY, evalIntTamedColor, evalIntTamedScalar);
                    }
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Magic Resist:");
                AddLabel(valuesX, startY, ValueTextHue, RoundToTenth(magicResistAdjusted).ToString());
                if (showTamedScalars)
                {
                    AddLabel(tamedScalarsX, startY, magicResistTamedColor, magicResistTamedScalar);
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Poisoning:");
                if (bc_Creature.HitPoison != null)
                {
                    AddLabel(valuesX, startY, ValueTextHue, RoundToTenth(poisoningAdjusted).ToString() + " (" + bc_Creature.HitPoison.Name + ")");
                    if (showTamedScalars)
                    {
                        AddLabel(tamedScalarsX, startY, poisoningTamedColor, poisoningTamedScalar);
                    }
                }

                else
                {
                    AddLabel(valuesX, startY, ValueTextHue, "-");
                }

                startY += rowHeight;

                AddLabel(labelX, startY, MainTextHue, "Poison Resist:");
                if (bc_Creature.PoisonResistance > 0)
                {
                    if (bc_Creature.PoisonResistance > 1)
                    {
                        AddLabel(valuesX, startY, ValueTextHue, bc_Creature.PoisonResistance.ToString() + " Levels");
                    }
                    else
                    {
                        AddLabel(valuesX, startY, ValueTextHue, bc_Creature.PoisonResistance.ToString() + " Level");
                    }
                }

                else
                {
                    AddLabel(valuesX, startY, ValueTextHue, "-");
                }

                startY += rowHeight;

                #endregion
                break;

            //Traits
            case AnimalLoreGumpPage.Traits:
                AddLabel(78, 370, WhiteTextHue, "Stats");
                AddButton(45, 369, 4011, 4013, 2, GumpButtonType.Reply, 0);

                AddButton(221, 369, 4029, 4031, 3, GumpButtonType.Reply, 0);
                AddLabel(259, 370, WhiteTextHue, "Info");

                #region Traits

                string traitsText = "Traits";

                if (bc_Creature.Controlled && bc_Creature.ControlMaster == pm_Player && traitsAvailable > 0)
                {
                    if (traitsAvailable == 1)
                    {
                        traitsText = traitsAvailable.ToString() + " Trait Available";
                    }

                    else
                    {
                        traitsText = traitsAvailable.ToString() + " Traits Available";
                    }

                    AddLabel(Utility.CenteredTextOffset(175, traitsText), 45, 2606, traitsText);
                }
                else
                {
                    AddLabel(145, 45, 2606, traitsText);
                }

                int traitIndex = 0;

                int iStartY    = 60;
                int rowSpacing = 57;

                for (int a = 0; a < bc_Creature.TraitsSelectionsAvailable.Count; a++)
                {
                    int traitLevel  = (int)(Math.Floor((double)a / 2)) + 1;
                    int buttonIndex = (10 * traitLevel);

                    bool traitAvailable = false;

                    TraitSelectionType gumpSelection = TraitSelectionType.None;

                    if (traitLevel <= m_TraitGumpSelections.Count)
                    {
                        gumpSelection = m_TraitGumpSelections[traitLevel - 1];
                    }

                    FollowerTraitType levelTraitChosen = FollowerTraitType.None;

                    if (traitLevel <= bc_Creature.m_FollowerTraitSelections.Count)
                    {
                        levelTraitChosen = bc_Creature.m_FollowerTraitSelections[traitLevel - 1];

                        if (bc_Creature.ExperienceLevel >= traitLevel && levelTraitChosen == FollowerTraitType.None)
                        {
                            traitAvailable = true;
                        }
                    }

                    FollowerTraitType   traitOption         = bc_Creature.TraitsSelectionsAvailable[a];
                    FollowerTraitDetail followerTraitDetail = FollowerTraits.GetFollowerTraitDetail(traitOption);

                    if (followerTraitDetail != null)
                    {
                        switch (traitIndex)
                        {
                        //Left
                        case 0:
                            bool leftSelected = false;
                            int  leftTextHue  = GreyTextHue;

                            if (traitAvailable)
                            {
                                leftTextHue = WhiteTextHue;
                            }

                            if (gumpSelection == TraitSelectionType.Left || levelTraitChosen == traitOption)
                            {
                                leftSelected = true;
                                leftTextHue  = GreenTextHue;
                            }

                            AddItem(40 + followerTraitDetail.IconOffsetX, iStartY + 20 + followerTraitDetail.IconOffsetY, followerTraitDetail.IconItemId, followerTraitDetail.IconHue);
                            AddLabel(Utility.CenteredTextOffset(85, followerTraitDetail.Name), iStartY, leftTextHue, followerTraitDetail.Name);

                            AddButton(85, iStartY + 33, 2118, 2117, buttonIndex, GumpButtonType.Reply, 0);
                            AddLabel(105, iStartY + 30, 2550, "Info");

                            if (traitAvailable && bc_Creature.Controlled && bc_Creature.ControlMaster == pm_Player)
                            {
                                if (leftSelected)
                                {
                                    AddButton(145, iStartY + 30, 9909, 9910, buttonIndex + 1, GumpButtonType.Reply, 0);
                                }
                                else
                                {
                                    AddButton(145, iStartY + 30, 9910, 9909, buttonIndex + 1, GumpButtonType.Reply, 0);
                                }
                            }
                            break;

                        //Right
                        case 1:
                            bool rightSelected = false;
                            int  rightTextHue  = GreyTextHue;

                            if (traitAvailable)
                            {
                                rightTextHue = WhiteTextHue;
                            }

                            if (gumpSelection == TraitSelectionType.Right || levelTraitChosen == traitOption)
                            {
                                rightSelected = true;
                                rightTextHue  = GreenTextHue;
                            }

                            AddItem(195 + followerTraitDetail.IconOffsetX, iStartY + 20 + followerTraitDetail.IconOffsetY, followerTraitDetail.IconItemId, followerTraitDetail.IconHue);
                            AddLabel(Utility.CenteredTextOffset(240, followerTraitDetail.Name), iStartY, rightTextHue, followerTraitDetail.Name);

                            AddButton(240, iStartY + 33, 2118, 2117, buttonIndex + 2, GumpButtonType.Reply, 0);
                            AddLabel(260, iStartY + 30, 2550, "Info");

                            if (traitAvailable && bc_Creature.Controlled && bc_Creature.ControlMaster == pm_Player)
                            {
                                if (rightSelected)
                                {
                                    AddButton(172, iStartY + 30, 9903, 9904, buttonIndex + 3, GumpButtonType.Reply, 0);
                                }
                                else
                                {
                                    AddButton(172, iStartY + 30, 9904, 9903, buttonIndex + 3, GumpButtonType.Reply, 0);
                                }
                            }
                            break;
                        }
                    }

                    traitIndex++;

                    if (traitIndex >= BaseCreature.TraitsAvailablePerLevel)
                    {
                        traitIndex = 0;
                        iStartY   += rowSpacing;
                    }
                }

                //-----

                bool selectionsMade = false;

                for (int a = 0; a < m_TraitGumpSelections.Count; a++)
                {
                    if (m_TraitGumpSelections[a] != TraitSelectionType.None)
                    {
                        selectionsMade = true;
                    }
                }

                if (selectionsMade && traitsAvailable > 0 && bc_Creature.Controlled && bc_Creature.ControlMaster == pm_Player)
                {
                    AddLabel(90, 345, 68, "Confirm Trait Selection");
                    AddButton(140, 370, 2076, 2075, 9, GumpButtonType.Reply, 0);
                }

                #endregion
                break;

            //Info
            case AnimalLoreGumpPage.Info:
                AddLabel(78, 370, WhiteTextHue, "Traits");
                AddButton(45, 369, 4011, 4013, 2, GumpButtonType.Reply, 0);

                if (traitsAvailable > 0)
                {
                    AddLabel(123, 370, GreenTextHue, "(" + traitsAvailable.ToString() + " Available)");
                }

                AddButton(221, 369, 4029, 4031, 3, GumpButtonType.Reply, 0);
                AddLabel(259, 370, WhiteTextHue, "Stats");

                #region Info
                #endregion
                break;
            }
        }
Exemplo n.º 13
0
        public BinfoGump(Mobile mobile, object o)
            : base(0, 0)
        {
            if (o is Mobile)
            {
                Mobile m_Object = (Mobile)o;
                Mobile m_this   = (Mobile)mobile;

                Closable   = true;
                Disposable = true;
                Dragable   = true;
                Resizable  = false;

                AddPage(0);

                AddImage(277, 444, 2083);
                AddImage(277, 375, 2082);
                AddImage(277, 307, 2081);
                AddImage(262, 273, 2080);
                AddImage(308, 104, 5010);
                AddImage(384, 81, 4500);
                AddImage(377, 247, 9804);
                AddImage(329, 124, 10460);
                AddImage(459, 125, 10460);
                AddImage(328, 254, 10460);
                AddImage(460, 253, 10460);
                AddImage(391, 443, 2642); //warning light off
                if ((m_Object.RawStr + m_Object.RawInt + m_Object.HitsMax) > (m_this.RawStr + m_this.RawInt + m_this.HitsMax + m_this.SkillsTotal))
                {
                    AddImage(391, 443, 2643); //warning light on
                }
                AddImage(483, 179, 4502);
                AddImage(285, 179, 4508);
                AddImage(230, 210, 10440);
                AddImage(505, 210, 10441);
                AddImage(272, 498, 10556);
                AddImageTiled(300, 498, 221, 62, 10557);
                AddImage(521, 498, 10558);
                AddItem(393, 179, (ShrinkTable.Lookup(m_Object)), (m_Object.Hue));
                AddLabel(298, 303, 33, @"Name: " + m_Object.Name);
                AddLabel(299, 318, 0, @"STR: " + m_Object.RawStr);
                AddLabel(299, 334, 0, @"DEX: " + m_Object.RawDex);
                AddLabel(300, 350, 0, @"INT: " + m_Object.RawInt);
                if (m_Object.Female == false)
                {
                    AddLabel(408, 318, 0, @"SEX: M");
                }
                if (m_Object.Female == true)
                {
                    AddLabel(408, 318, 0, @"SEX: F");
                }
                AddLabel(408, 334, 0, @"AR: " + m_Object.VirtualArmor);
                AddLabel(299, 366, 0, @"HITS: " + m_Object.Hits);
                AddLabel(298, 381, 0, @"MANA: " + m_Object.Mana);
                AddLabel(298, 396, 0, @"STAM: " + m_Object.Stam);
                AddLabel(297, 412, 0, @"WGHT: " + (m_Object.TotalWeight + m_Object.RawStr));
                if (Core.AOS == true)
                {
                    AddImage(410, 355, 2360, 50);
                    AddImage(410, 371, 2360);
                    AddImage(410, 387, 2362);
                    AddImage(410, 403, 2361);
                    AddImage(410, 418, 2360, 17);
                    AddLabel(436, 350, 0, @"" + m_Object.PhysicalResistance);
                    AddLabel(435, 366, 0, @"" + m_Object.FireResistance);
                    AddLabel(435, 382, 0, @"" + m_Object.ColdResistance);
                    AddLabel(435, 398, 0, @"" + m_Object.PoisonResistance);
                    AddLabel(435, 414, 0, @"" + m_Object.EnergyResistance);
                }
                if ((m_Object.RawStr + m_Object.RawInt + m_Object.HitsMax) > (m_this.RawStr + m_this.RawInt + m_this.HitsMax + m_this.SkillsTotal))
                {
                    AddLabel(282, 517, 0, @"This mobile seems to be stronger then you.");
                }
                if ((m_Object.RawStr + m_Object.RawInt + m_Object.HitsMax) < (m_this.RawStr + m_this.RawInt + m_this.HitsMax + m_this.SkillsTotal))
                {
                    AddLabel(282, 517, 0, @"This mobile seems to be weaker then you.");
                }

                AddButton(495, 448, 2640, 2641, 1, GumpButtonType.Reply, 0); //close
                AddButton(297, 448, 2640, 2641, 2, GumpButtonType.Reply, 0); //capture
                AddLabel(464, 452, 0, @"Close");
                AddLabel(327, 452, 0, @"Capture");

                AddLabel(343, 554, 0, @"Designed By : Chinook");
            }
        }
Exemplo n.º 14
0
        public static void RecurseExport(XmlTextWriter xml, CategoryEntry ce)
        {
            xml.WriteStartElement("category");

            xml.WriteAttributeString("title", ce.Title);

            ArrayList subCats = new ArrayList(ce.SubCategories);

            subCats.Sort(new CategorySorter());

            for (int i = 0; i < subCats.Count; ++i)
            {
                RecurseExport(xml, (CategoryEntry)subCats[i]);
            }

            ce.Matched.Sort(new CategorySorter());

            for (int i = 0; i < ce.Matched.Count; ++i)
            {
                CategoryTypeEntry cte = (CategoryTypeEntry)ce.Matched[i];

                xml.WriteStartElement("object");

                xml.WriteAttributeString("type", cte.Type.ToString());

                object obj = cte.Object;

                if (obj is Item)
                {
                    Item item = (Item)obj;

                    int itemID = item.ItemID;

                    if (item is BaseAddon && ((BaseAddon)item).Components.Count == 1)
                    {
                        itemID = ((AddonComponent)(((BaseAddon)item).Components[0])).ItemID;
                    }

                    if (itemID > TileData.MaxItemValue)
                    {
                        itemID = 1;
                    }

                    xml.WriteAttributeString("gfx", XmlConvert.ToString(itemID));

                    int hue = item.Hue & 0x7FFF;

                    if ((hue & 0x4000) != 0)
                    {
                        hue = 0;
                    }

                    if (hue != 0)
                    {
                        xml.WriteAttributeString("hue", XmlConvert.ToString(hue));
                    }

                    item.Delete();
                }
                else if (obj is Mobile)
                {
                    Mobile mob = (Mobile)obj;

                    int itemID = ShrinkTable.Lookup(mob, 1);

                    xml.WriteAttributeString("gfx", XmlConvert.ToString(itemID));

                    int hue = mob.Hue & 0x7FFF;

                    if ((hue & 0x4000) != 0)
                    {
                        hue = 0;
                    }

                    if (hue != 0)
                    {
                        xml.WriteAttributeString("hue", XmlConvert.ToString(hue));
                    }

                    mob.Delete();
                }

                xml.WriteEndElement();
            }

            xml.WriteEndElement();
        }
Exemplo n.º 15
0
        public override void OnCast()
        {
            if (!Caster.CanBeginAction(typeof(TransmutationSpell)))
            {
                if (Caster is PlayerMobile)
                {
                    PlayerMobile pm = (PlayerMobile)Caster;
                    pm.Transformation.OnTransformationChange(0, null, -1, true);
                }
                else
                {
                    Caster.BodyMod = 0;
                    Caster.NameMod = null;
                }

                Caster.EndAction(typeof(TransmutationSpell));

                Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head);
                Caster.PlaySound(0x3BD);

                if (Caster is PlayerMobile)
                {
                    ((PlayerMobile)Caster).CheckRaceSkin();
                }

                BaseArmor.ValidateMobile(Caster);
            }
            else if (m_NewBody == 0)
            {
                ArrayList entries = new ArrayList();
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Ours Polaire", ShrinkTable.Lookup(0xD5), 0xD5, 1015237, 0, 0, 0, 0, 0));
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Momie", ShrinkTable.Lookup(0x9A), 0x9A, 1015246, 0, 0, 0, 0, 0));
                entries.Add(new MetamorphoseGump.MetamorphoseEntry("Ophidien", ShrinkTable.Lookup(0x56), 0x56, 1015246, 0, 0, 0, 0, 0));

                Caster.SendGump(new MetamorphoseGump(Caster, Scroll, entries, 4));
            }
            else if (!CheckTransformation(Caster, Caster))
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(TransmutationSpell)))
                {
                    if (m_NewBody != 0)
                    {
                        if (!((Body)m_NewBody).IsHuman)
                        {
                            Mobiles.IMount mt = Caster.Mount;

                            if (mt != null)
                            {
                                mt.Rider = null;
                            }
                        }

                        if (Caster is PlayerMobile)
                        {
                            PlayerMobile pm = (PlayerMobile)Caster;
                            pm.Transformation.OnTransformationChange(m_NewBody, m_NameMod, m_HueMod, true);
                        }
                        else
                        {
                            Caster.BodyMod = m_NewBody;
                            Caster.NameMod = m_NameMod;
                            Caster.HueMod  = m_HueMod;
                        }

                        Effects.SendTargetParticles(Caster, 0x373A, 10, 15, 5036, EffectLayer.Head);
                        Caster.PlaySound(0x3BD);
                    }
                }
            }

            FinishSequence();
        }
Exemplo n.º 16
0
            private static ItemListEntry[] MakeItemList(ArrayList list)
            {
                ArrayList newList = new ArrayList(list.Count);

                for (int i = 0; i < list.Count; i++)
                {
                    Mobile m = (Mobile)list[i];
                    newList.Add(new ItemListEntry(m.Name != null && m.Name.Length > 0 ? m.Name : "-no name-", ShrinkTable.Lookup(m)));
                }
                return((ItemListEntry[])newList.ToArray(typeof(ItemListEntry)));
            }
Exemplo n.º 17
0
        public static void RecurseExport(List <CAGJson> list, CategoryEntry ce, string category)
        {
            category = string.IsNullOrWhiteSpace(category) ? ce.Title : $"{category}{ce.Title}";

            if (ce.Matched.Count > 0)
            {
                list.Add(
                    new CAGJson
                {
                    Category = category,
                    Objects  = ce.Matched.Select(
                        cte =>
                    {
                        if (cte.Object is Item item)
                        {
                            var itemID = item.ItemID;

                            if (item is BaseAddon addon && addon.Components.Count == 1)
                            {
                                itemID = addon.Components[0].ItemID;
                            }

                            if (itemID > TileData.MaxItemValue)
                            {
                                itemID = 1;
                            }

                            int?hue = item.Hue & 0x7FFF;

                            if ((hue & 0x4000) != 0)
                            {
                                hue = 0;
                            }

                            return(new CAGObject
                            {
                                Type = cte.Type,
                                ItemID = itemID,
                                Hue = hue == 0 ? null : hue
                            });
                        }

                        if (cte.Object is Mobile m)
                        {
                            var itemID = ShrinkTable.Lookup(m, 1);

                            int?hue = m.Hue & 0x7FFF;

                            if ((hue & 0x4000) != 0)
                            {
                                hue = 0;
                            }

                            return(new CAGObject
                            {
                                Type = cte.Type,
                                ItemID = itemID,
                                Hue = hue == 0 ? null : hue
                            });
                        }

                        throw new InvalidCastException(
                            $"Categorization Type Entry: {cte.Type.Name} is not a valid type."
                            );
                    }
                        )
                               .ToArray()
                }
Exemplo n.º 18
0
        protected override void OnTarget(Mobile from, object target)
        {
            BaseCreature pet = target as BaseCreature;

            if (target == from)
            {
                from.SendMessage("You cannot shrink yourself!");
            }

            else if (target is Item)
            {
                from.SendMessage("You cannot shrink that!");
            }

            else if (target is PlayerMobile)
            {
                from.SendMessage("That person gives you a dirty look!");
            }

            else if (Server.Spells.SpellHelper.CheckCombat(from))
            {
                from.SendMessage("You cannot shrink your pet while you are fighting.");
            }

            else if (null == pet)
            {
                from.SendMessage("That is not a pet!");
            }

            else if ((pet.BodyValue == 400 || pet.BodyValue == 401) && pet.Controlled == false)
            {
                from.SendMessage("That person gives you a dirty look!");
            }

            else if (pet.IsDeadPet)
            {
                from.SendMessage("You cannot shrink the dead!");
            }

            else if (pet.Summoned)
            {
                from.SendMessage("You cannot shrink a summoned creature!");
            }

            else if (!m_StaffCommand && pet.Combatant != null && pet.InRange(pet.Combatant, 12) && pet.Map == pet.Combatant.Map)
            {
                from.SendMessage("Your pet is fighting; you cannot shrink it yet.");
            }

            else if (pet.BodyMod != 0)
            {
                from.SendMessage("You cannot shrink your pet while it is polymorphed.");
            }

            else if (!m_StaffCommand && pet.Controlled == false)
            {
                from.SendMessage("You cannot not shrink wild creatures.");
            }

            else if (!m_StaffCommand && pet.ControlMaster != from)
            {
                from.SendMessage("That is not your pet.");
            }

            else if (!m_StaffCommand && ShrinkItem.IsPackAnimal(pet) && (null != pet.Backpack && pet.Backpack.Items.Count > 0))
            {
                from.SendMessage("You must unload this pet's pack before it can be shrunk.");
            }

            else
            {
                if (pet.ControlMaster != from && !pet.Controlled)
                {
                    SpawnEntry se = pet.Spawner as SpawnEntry;
                    if (se != null && se.UnlinkOnTaming)
                    {
                        pet.Spawner.Remove(this as ISpawnable);
                        pet.Spawner = null;
                    }

                    pet.CurrentWayPoint = null;
                    pet.ControlMaster   = from;
                    pet.Controlled      = true;
                    pet.ControlTarget   = null;
                    pet.ControlOrder    = OrderType.Come;
                    pet.Guild           = null;
                    pet.Delta(MobileDelta.Noto);
                }

                IEntity p1 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                IEntity p2 = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);

                Effects.SendMovingParticles(p2, p1, ShrinkTable.Lookup(pet), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                from.PlaySound(492);
                from.AddToBackpack(new ShrinkItem(pet));

                if (!m_StaffCommand && null != m_ShrinkTool && m_ShrinkTool.ShrinkCharges > 0)
                {
                    m_ShrinkTool.ShrinkCharges--;
                }
            }
        }
Exemplo n.º 19
0
        public override void OnDoubleClick(Mobile from)
        {
            BaseCreature bc = (BaseCreature)Creature;

            if (this.Owner != from && this.ForSale)
            {
                this.Owner = from;
            }

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
            else if (Creature == null)
            {
                this.Delete();
                from.SendMessage("Nothing was linked to this shrink item. Contact a game master if you feel you got this message in error.");
            }
            else if (!ShrinkSystemCore.Core.Enabled)
            {
                from.SendMessage("The shrink system is currently offline! Contact a game master for details.");
            }
            else if (this.Owner != from)
            {
                from.SendMessage("You are not the owner of this pet you cannot claim it.");
            }
            else if (!bc.CheckControlChance(from))
            {
                from.SendMessage("You lack the required skill to control this pet.");
            }
            else if ((bc.ControlSlots + from.Followers) > from.FollowersMax)
            {
                from.SendMessage("You have to many followers to claim this pet.");
            }
            else if (Server.Spells.SpellHelper.CheckCombat(from))
            {
                from.SendMessage("You cannot claim this pet while in combat.");
            }
            else
            {
                IEntity p1a = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z), from.Map);
                IEntity p2a = new Entity(Serial.Zero, new Point3D(from.X, from.Y, from.Z + 50), from.Map);

                Effects.SendMovingParticles(p1a, p2a, ShrinkTable.Lookup(Creature), 1, 0, true, false, 0, 3, 1153, 1, 0, EffectLayer.Head, 0x100);
                from.PlaySound(492);

                bc.ControlMaster = from;
                bc.ControlTarget = from;
                bc.ControlOrder  = OrderType.Follow;

                if (bc.IsBonded == true && this.ForSale == true)
                {
                    bc.IsBonded = false;
                }

                bc.Direction = Direction.South;
                bc.MoveToWorld(from.Location, from.Map);
                from.SendMessage("You unshrink the animal.");

                this.Delete();
            }
        }