private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource, string name, int amount)
 {
     AddonComponent ac;
     ac = new AddonComponent(item);
     if (name != null && name.Length > 0)
         ac.Name = name;
     if (hue != 0)
         ac.Hue = hue;
     if (amount > 1)
     {
         ac.Stackable = true;
         ac.Amount = amount;
     }
     if (lightsource != -1)
         ac.Light = (LightType) lightsource;
     addon.AddComponent(ac, xoffset, yoffset, zoffset);
 }
 private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset,
     int hue, int lightsource)
 {
     AddComplexComponent(addon, item, xoffset, yoffset, zoffset, hue, lightsource, null, 1);
 }
Example #3
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
                case 1:
                case 0:
                    {
                        m_Addon = reader.ReadItem() as BaseAddon;
                        m_Offset = reader.ReadPoint3D();

                        if (m_Addon != null)
                            m_Addon.OnComponentLoaded(this);

                        ApplyLightTo(this);

                        break;
                    }
            }

            if (version < 1 && Weight == 0)
                Weight = -1;
        }
 private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset, int hue, int lightsource)
 {
     AddComplexComponent(addon, item, xoffset, yoffset, zoffset, hue, lightsource, null, 1);
 }
 private static void AddComplexComponent(BaseAddon addon, int item, int xoffset, int yoffset, int zoffset,
     int hue, int lightsource, string name = null, int amount = 1)
 {
     AddonComponent ac = new AddonComponent(item);
     if (!string.IsNullOrEmpty(name))
     {
         ac.Name = name;
     }
     if (hue != 0)
     {
         ac.Hue = hue;
     }
     if (amount > 1)
     {
         ac.Stackable = true;
         ac.Amount = amount;
     }
     if (lightsource != -1)
     {
         ac.Light = (LightType) lightsource;
     }
     addon.AddComponent(ac, xoffset, yoffset, zoffset);
 }
Example #6
0
        private void AdjustMobileLocations()
        {
            Item targetitem = AttachedTo as Item;

            if (targetitem == null)
            {
                return;
            }

            // make sure nearby mobiles are in valid locations
            ArrayList         mobilelist = new ArrayList();
            IPooledEnumerable eable      = targetitem.GetMobilesInRange(0);

            foreach (Mobile p in eable)
            {
                mobilelist.Add(p);
            }
            eable.Free();

            if (targetitem is BaseAddon)
            {
                BaseAddon addon = (BaseAddon)targetitem;
                if (addon.Components != null)
                {
                    foreach (AddonComponent i in addon.Components)
                    {
                        if (i != null)
                        {
                            IPooledEnumerable eable2 = i.GetMobilesInRange(0);
                            foreach (Mobile p in eable2)
                            {
                                if (!mobilelist.Contains(p))
                                {
                                    mobilelist.Add(p);
                                }
                            }
                            eable2.Free();
                        }
                    }
                }
            }

            if (targetitem is BaseMulti && targetitem.Map != null)
            {
                // check all locations covered by the multi
                // go through all of the multi components
                MultiComponentList mcl = ((BaseMulti)targetitem).Components;

                if (mcl != null && mcl.List != null)
                {
                    for (int i = 0; i < mcl.List.Length; i++)
                    {
                        MultiTileEntry t = mcl.List[i];

                        int x = t.m_OffsetX + targetitem.X;
                        int y = t.m_OffsetY + targetitem.Y;
                        int z = t.m_OffsetZ + targetitem.Z;
                        IPooledEnumerable eable2 = targetitem.Map.GetMobilesInRange(new Point3D(x, y, z), 0);

                        foreach (Mobile p in eable2)
                        {
                            if (!mobilelist.Contains(p))
                            {
                                mobilelist.Add(p);
                            }
                        }
                        eable2.Free();
                    }
                }
            }

            // relocate all mobiles found
            foreach (Mobile p in mobilelist)
            {
                if (p != null && p.Map != null)
                {
                    int x = p.Location.X;
                    int y = p.Location.Y;
                    int z = p.Location.Z;

                    // check the current location
                    if (!p.Map.CanFit(x, y, z, 16, true, false, true))
                    {
                        bool found = false;


                        for (int dx = 0; dx <= 10 && !found; dx++)
                        {
                            for (int dy = 0; dy <= 10 && !found; dy++)
                            {
                                // try moving it up in z to find a valid spot
                                for (int h = 1; h <= 39; h++)
                                {
                                    if (p.Map.CanFit(x + dx, y + dy, z + h, 16, true, false, true))
                                    {
                                        z    += h;
                                        x    += dx;
                                        y    += dy;
                                        found = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }

                    // move them to the new location
                    p.MoveToWorld(new Point3D(x, y, z), p.Map);
                }
            }
        }
Example #7
0
        public virtual void AssignItemEffect(Item targetitem, int effectid, int hue, int fraction)
        {
            if (targetitem == null || targetitem.Deleted)
            {
                return;
            }

            // deal with addons
            if (targetitem is BaseAddon)
            {
                BaseAddon addon = (BaseAddon)targetitem;
                if (addon.Components != null)
                {
                    int count = 0;
                    // change the ids of all of the components if they dont already have xmlsiege attachments
                    foreach (AddonComponent i in addon.Components)
                    {
                        if (XmlAttach.FindAttachment(i, typeof(XmlSiege)) == null)
                        {
                            // put the effect on a fraction of the components, but make sure you have at least one
                            if (Utility.Random(100) < fraction || count == 0)
                            {
                                Effects.SendLocationEffect(i.Location, i.Map, effectid, DamagedItemEffectDuration, hue, 0);
                                //Effects.SendTargetEffect(i, DamagedItemEffectID, DamagedItemEffectDuration, hue, 0);
                                count++;
                            }
                        }
                    }
                }
            }
            else
            if (targetitem is BaseMulti)
            {
                // place an effect at the location of the target item
                Effects.SendLocationEffect(targetitem.Location, targetitem.Map, effectid, DamagedItemEffectDuration, hue, 0);

                ArrayList tilelist = new ArrayList();
                // go through all of the multi components
                MultiComponentList mcl = ((BaseMulti)targetitem).Components;
                int count = 0;
                if (mcl != null && mcl.List != null)
                {
                    for (int i = 0; i < mcl.List.Length; i++)
                    {
                        MultiTileEntry t = mcl.List[i];

                        int x      = t.m_OffsetX + targetitem.X;
                        int y      = t.m_OffsetY + targetitem.Y;
                        int z      = t.m_OffsetZ + targetitem.Z;
                        int itemID = t.m_ItemID & 0x3FFF;

                        if (Utility.Random(100) < fraction || count == 0)
                        {
                            tilelist.Add(new TileEntry(itemID, x, y, z));
                            count++;
                        }
                    }

                    foreach (TileEntry s in tilelist)
                    {
                        Effects.SendLocationEffect(new Point3D(s.X, s.Y, s.Z), targetitem.Map, effectid, DamagedItemEffectDuration, hue, 0);
                    }
                }
            }
            else
            {
                // place an effect at the location of the target item
                Effects.SendLocationEffect(targetitem.Location, targetitem.Map, effectid, DamagedItemEffectDuration, hue, 0);
                //Effects.SendTargetEffect(targetitem, DamagedItemEffectID, DamagedItemEffectDuration, hue, 0);
            }
        }
Example #8
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();

                Item   stolen = null;
                object root   = null;
                bool   caught = false;

                if (target is Item)
                {
                    root   = ((Item)target).RootParent;
                    stolen = TryStealItem((Item)target, ref caught);
                }
                else if (target is Mobile)
                {
                    Container pack = ((Mobile)target).Backpack;

                    if (pack != null && pack.Items.Count > 0)
                    {
                        int randomIndex = Utility.Random(pack.Items.Count);

                        root   = target;
                        stolen = TryStealItem(pack.Items[randomIndex], ref caught);
                    }

                    #region Monster Stealables
                    if (target is BaseCreature && from is PlayerMobile)
                    {
                        Server.Engines.CreatureStealing.StealingHandler.HandleSteal(target as BaseCreature, from as PlayerMobile);
                    }
                    #endregion
                }
                else
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }

                if (stolen != null)
                {
                    if (stolen is AddonComponent)
                    {
                        BaseAddon addon = ((AddonComponent)stolen).Addon as BaseAddon;
                        from.AddToBackpack(addon.Deed);
                        addon.Delete();
                    }
                    else
                    {
                        from.AddToBackpack(stolen);
                    }

                    if (!(stolen is Container || stolen.Stackable))
                    {
                        // do not return stolen containers or stackable items
                        StolenItem.Add(stolen, m_Thief, root as Mobile);
                    }
                }

                if (caught)
                {
                    if (root == null)
                    {
                        m_Thief.CriminalAction(false);
                    }
                    else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief))
                    {
                        m_Thief.CriminalAction(false);
                    }
                    else if (root is Mobile)
                    {
                        Mobile mobRoot = (Mobile)root;

                        if (!IsInGuild(mobRoot) && IsInnocentTo(m_Thief, mobRoot))
                        {
                            m_Thief.CriminalAction(false);
                        }

                        string message = String.Format("You notice {0} trying to steal from {1}.", m_Thief.Name, mobRoot.Name);

                        foreach (NetState ns in m_Thief.GetClientsInRange(8))
                        {
                            if (ns.Mobile != m_Thief)
                            {
                                ns.Mobile.SendMessage(message);
                            }
                        }
                    }
                }
                else if (root is Corpse && ((Corpse)root).IsCriminalAction(m_Thief))
                {
                    m_Thief.CriminalAction(false);
                }

                if (root is Mobile && ((Mobile)root).Player && m_Thief is PlayerMobile && IsInnocentTo(m_Thief, (Mobile)root) &&
                    !IsInGuild((Mobile)root))
                {
                    PlayerMobile pm = (PlayerMobile)m_Thief;

                    pm.PermaFlags.Add((Mobile)root);
                    pm.Delta(MobileDelta.Noto);
                }
            }
Example #9
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                //Close bank box on steal attempt -Adam
                BankBox box = m_Thief.FindBankNoCreate();

                if (box != null && box.Opened)
                {
                    box.Close();
                    m_Thief.Send(new MobileUpdate(m_Thief));
                }

                Item stolen = null;

                object root = toSteal.RootParent;

                var contParent = toSteal.Parent as Container;

                StealableArtifactsSpawner.StealableInstance si = null;
                if (toSteal.Parent == null || !toSteal.Movable)
                {
                    si = StealableArtifactsSpawner.GetStealableInstance(toSteal);
                }

                BaseAddon addon = null;

                if (toSteal is AddonComponent)
                {
                    addon = ((AddonComponent)toSteal).Addon;
                }

                bool stealflag = (addon != null && addon.GetSavedFlag(ItemFlags.StealableFlag)) ||
                                 toSteal.GetSavedFlag(ItemFlags.StealableFlag);

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                     // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).Player && IsInnocentTo(m_Thief, (Mobile)root) && !IsInGuild(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005596);                     // You must be in the thieves guild to steal from other players.
                }
                else if (SuspendOnMurder && root is Mobile && ((Mobile)root).Player && IsInGuild(m_Thief) && m_Thief.Kills > 0)
                {
                    m_Thief.SendLocalizedMessage(502706);                     // You are currently suspended from the thieves guild.
                }
                else if (root is BaseVendor && ((BaseVendor)root).IsInvulnerable)
                {
                    m_Thief.SendLocalizedMessage(1005598);                     // You can't steal from shopkeepers.
                }
                else if (root is PlayerVendor)
                {
                    m_Thief.SendLocalizedMessage(502709);                     // You can't steal from vendors.
                }
                else if (!m_Thief.CanSee(toSteal))
                {
                    m_Thief.SendLocalizedMessage(500237);                     // Target can not be seen.
                }
                else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                {
                    m_Thief.SendLocalizedMessage(1048147);                     // Your backpack can't hold anything else.
                }
                #region Sigils
                else if (toSteal is Sigil)
                {
                    PlayerState pl      = PlayerState.Find(m_Thief);
                    Faction     faction = (pl == null ? null : pl.Faction);

                    var sig = (Sigil)toSteal;

                    if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                    {
                        m_Thief.SendLocalizedMessage(502703);  // You must be standing next to an item to steal it.
                    }
                    else if (root != null)                     // not on the ground
                    {
                        m_Thief.SendLocalizedMessage(502710);  // You can't steal that!
                    }
                    else if (faction != null)
                    {
                        if (!m_Thief.CanBeginAction(typeof(IncognitoSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010581);                             //	You cannot steal the sigil when you are incognito
                        }
                        else if (DisguiseTimers.IsDisguised(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1010583);                             //	You cannot steal the sigil while disguised
                        }
                        else if (!m_Thief.CanBeginAction(typeof(PolymorphSpell)))
                        {
                            m_Thief.SendLocalizedMessage(1010582);                             //	You cannot steal the sigil while polymorphed
                        }
                        else if (TransformationSpellHelper.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                             // You cannot steal the sigil while in that form.
                        }
                        else if (m_Thief is PlayerMobile && ((PlayerMobile)m_Thief).SavagePaintExpiration > TimeSpan.Zero)
                        {
                            m_Thief.SendLocalizedMessage(1114352);                             // You cannot steal the sigil while disguised in savage paint.
                        }
                        else if (pl.IsLeaving)
                        {
                            m_Thief.SendLocalizedMessage(1005589);                             // You are currently quitting a faction and cannot steal the town sigil
                        }
                        else if (sig.IsBeingCorrupted && sig.LastMonolith.Faction == faction)
                        {
                            m_Thief.SendLocalizedMessage(1005590);                             //	You cannot steal your own sigil
                        }
                        else if (sig.IsPurifying)
                        {
                            m_Thief.SendLocalizedMessage(1005592);                             // You cannot steal this sigil until it has been purified
                        }
                        else if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, 0.0, 0.0))
                        {
                            if (Sigil.ExistsOn(m_Thief))
                            {
                                m_Thief.SendLocalizedMessage(1010258);
                                //	The sigil has gone back to its home location because you already have a sigil.
                            }
                            else if (m_Thief.Backpack == null || !m_Thief.Backpack.CheckHold(m_Thief, sig, false, true))
                            {
                                m_Thief.SendLocalizedMessage(1010259);                                 //	The sigil has gone home because your backpack is full
                            }
                            else
                            {
                                if (sig.IsBeingCorrupted)
                                {
                                    sig.GraceStart = DateTime.UtcNow;                                     // begin grace period
                                }

                                m_Thief.SendLocalizedMessage(1010586);                                 // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                if (sig.LastMonolith != null && sig.LastMonolith.Sigil != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                    sig.LastStolen         = DateTime.UtcNow;
                                }

                                switch (PvPController._SigilAnnounceStolen)
                                {
                                case PvPController.SigilStolenAnnouncing.All:
                                {
                                    foreach (Faction factionToBCast in Faction.Factions)
                                    {
                                        List <PlayerState> members = factionToBCast.Members;

                                        if (sig.Corrupted != null)
                                        {
                                            if (sig.Corrupted == factionToBCast)
                                            {
                                                foreach (PlayerState member in members)
                                                {
                                                    member.Mobile.SendMessage(
                                                        factionToBCast.Definition.HueBroadcast,
                                                        "The {0} have stolen the {1} sigil from your faction stronghold!",
                                                        faction.Definition.FriendlyName,
                                                        sig.Town.Definition.FriendlyName);
                                                }
                                            }
                                            else
                                            {
                                                foreach (PlayerState member in members)
                                                {
                                                    member.Mobile.SendMessage(
                                                        factionToBCast.Definition.HueBroadcast,
                                                        "The {0} have stolen the {1} sigil from the {2} stronghold!",
                                                        faction.Definition.FriendlyName,
                                                        sig.Town.Definition.FriendlyName,
                                                        sig.Corrupted.Definition.FriendlyName);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            foreach (PlayerState member in members)
                                            {
                                                member.Mobile.SendMessage(
                                                    factionToBCast.Definition.HueBroadcast,
                                                    "The {0} have stolen the {1} sigil!",
                                                    faction.Definition.FriendlyName,
                                                    sig.Town.Definition.FriendlyName);
                                            }
                                        }
                                    }
                                }
                                break;

                                case PvPController.SigilStolenAnnouncing.Owner:
                                {
                                    if (sig.Corrupted != null)
                                    {
                                        List <PlayerState> members = sig.Corrupted.Members;

                                        foreach (PlayerState member in members)
                                        {
                                            member.Mobile.SendMessage(
                                                sig.Corrupted.Definition.HueBroadcast,
                                                "The {0} have stolen the {1} sigil from your faction stronghold!",
                                                faction.Definition.FriendlyName,
                                                sig.Town.Definition.FriendlyName);
                                        }
                                    }
                                }
                                break;
                                }

                                return(sig);
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(1005594);                             //	You do not have enough skill to steal the sigil
                        }
                    }
                    else
                    {
                        m_Thief.SendLocalizedMessage(1005588);                         //	You must join a faction to do that
                    }
                }
                #endregion

                else if (!stealflag && si == null && (toSteal.Parent == null || !toSteal.Movable))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) &&
                         !(toSteal.RootParent is FillableContainer) && !stealflag)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal is Spellbook)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal.Nontransferable)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (m_Thief.EraAOS && si == null && toSteal is Container)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (toSteal is IEthicsItem && ((IEthicsItem)toSteal).EthicsItemState != null &&
                         !((IEthicsItem)toSteal).EthicsItemState.HasExpired)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (!m_Thief.InRange(toSteal.GetWorldLocation(), 1))
                {
                    m_Thief.SendLocalizedMessage(502703);                     // You must be standing next to an item to steal it.
                }
                // Alan: commented this out b/c there shouldn't be a required skill level to steal stealflag stuff
                //else if ( ( si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) || ( stealflag ) && m_Thief.Skills[SkillName.Stealing].Value < 100.0 ) ) //&& m_Thief.Skills[SkillName.Stealing].Value < 90.0 ) )
                //	m_Thief.SendLocalizedMessage( 1060025, "", 0x66D ); // You're not skilled enough to attempt the theft of this item.
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);           // You cannot steal items which are equipped.
                }
                else if (toSteal.GetSavedFlag(0x01))                 //Not lootable item
                {
                    m_Thief.SendLocalizedMessage(502710);            // You can't steal that!
                }
                else if (root == m_Thief || (root is BaseCreature && ((BaseCreature)root).GetMaster() == m_Thief))
                {
                    m_Thief.SendLocalizedMessage(502704);                     // You catch yourself red-handed.
                }
                else if (root is Mobile && ((Mobile)root).AccessLevel > AccessLevel.Player)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (root is Mobile && !m_Thief.CanBeHarmful((Mobile)root))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (m_Thief.Spell != null)
                {
                    m_Thief.SendMessage("You are too busy concentrating on your spell to steal that item.");
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (addon != null)
                    {
                        w = addon.Weight = addon.TotalWeight;
                    }

                    if (w > 10 && !stealflag)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        m_Thief.BeginAction(typeof(Hiding));

                        Timer.DelayCall(TimeSpan.FromSeconds(SpecialMovesController._StealingRehideDelay), ReleaseHideLock, m_Thief);

                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            var maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);
                            var minAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 25.0) / toSteal.Weight);                             //added a min amount

                            if (minAmount < 1)
                            {
                                minAmount = 1;
                            }

                            if (maxAmount < 1)
                            {
                                maxAmount = 1;
                            }
                            else if (maxAmount > toSteal.Amount)
                            {
                                maxAmount = toSteal.Amount;
                            }

                            int amount = Utility.RandomMinMax(minAmount, maxAmount);                             //(change from 1, maxamount)

                            if (amount >= toSteal.Amount)
                            {
                                var pileWeight = (int)Math.Ceiling(toSteal.Weight * toSteal.Amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = toSteal;
                                }
                            }
                            else
                            {
                                var pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    stolen = Mobile.LiftItemDupe(toSteal, toSteal.Amount - amount) ?? toSteal;
                                }
                            }
                        }
                        else
                        {
                            var iw = (int)Math.Ceiling(w);
                            iw *= 10;

                            if (stealflag || m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, iw - 22.5, iw + 27.5))
                            {
                                stolen = toSteal;
                            }
                        }

                        if (stolen is PowerScroll)
                        {
                            var  scroll  = (PowerScroll)stolen;
                            bool success = Utility.RandomBool();

                            if (success || Utility.RandomBool())
                            {
                                BaseMount.Dismount(m_Thief);
                                BaseMount.SetMountPrevention(
                                    m_Thief, BlockMountType.DismountRecovery, TimeSpan.FromSeconds(success ? 60.0 : 5.0));
                            }
                        }

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724); // You successfully steal the item.

                            if (stolen is Head2)
                            {
                                ((Head2)stolen).Owner = m_Thief as PlayerMobile;
                            }

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }

                            if (stealflag)
                            {
                                //toSteal.SetSavedFlag( 0x04, false );
                                // ARTEGORDONMOD
                                // set the taken flag to trigger release from any controlling spawner
                                ItemFlags.SetTaken(stolen, true);
                                // clear the stealable flag so that the item can only be stolen once if it is later locked down.
                                ItemFlags.SetStealable(stolen, false);

                                if (addon != null)                                 //deed it up!
                                {
                                    Item deed = addon.Deed;

                                    addon.Delete();
                                    stolen = deed;
                                }
                                else                                 // release it if it was locked down
                                {
                                    toSteal.Movable = true;
                                }

                                if (toSteal.Spawner != null)                                 //its not spawned anymore, its STOLEN!
                                {
                                    toSteal.Spawner.Remove(toSteal);
                                    toSteal.Spawner = null;
                                }
                            }

                            Conquests.CheckProgress <StealingConquest>(m_Thief as PlayerMobile, toSteal);
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                             // You fail to steal the item.
                        }

                        caught = !stealflag && (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }
Example #10
0
        public Addon2StaticGump(Mobile from)
            : base(0, 0)
        {
            m_From   = from;
            Closable = true;
            Dragable = true;

            AddPage(1);

            AddBackground(0, 0, 455, 260, 5054);
            AddLabel(30, 2, 200, "Select Facets to Convert");

            AddImageTiled(10, 20, 425, 210, 3004);

            foreach (object o in World.Items.Values)
            {
                if (o is AddonComponent)
                {
                    BaseAddon design = ((AddonComponent)o).Addon;
                    if (design == null || design.Map == null)
                    {
                        continue;
                    }

                    if (design.Map == Map.Felucca)
                    {
                        if (design.Components.Count > 0)
                        {
                            feluccaAddons.Add(design);
                            addonsFel++;
                            for (int i = 0; i < design.Components.Count; ++i)
                            {
                                compsFel++;
                            }
                        }
                    }
                    else if (design.Map == Map.Trammel)
                    {
                        if (design.Components.Count > 0)
                        {
                            trammelAddons.Add(design);
                            addonsTra++;
                            for (int i = 0; i < design.Components.Count; ++i)
                            {
                                compsTra++;
                            }
                        }
                    }
                    else if (design.Map == Map.Malas)
                    {
                        if (design.Components.Count > 0)
                        {
                            malasAddons.Add(design);
                            addonsMal++;
                            for (int i = 0; i < design.Components.Count; ++i)
                            {
                                compsMal++;
                            }
                        }
                    }
                    else if (design.Map == Map.Ilshenar)
                    {
                        if (design.Components.Count > 0)
                        {
                            ilshenarAddons.Add(design);
                            addonsIls++;
                            for (int i = 0; i < design.Components.Count; ++i)
                            {
                                compsIls++;
                            }
                        }
                    }
                    else if (design.Map == Map.Tokuno)
                    {
                        if (design.Components.Count > 0)
                        {
                            tokunoAddons.Add(design);
                            addonsTok++;
                            for (int i = 0; i < design.Components.Count; ++i)
                            {
                                compsTok++;
                            }
                        }
                    }
                    else if (design.Map == Map.TerMur)
                    {
                        if (design.Components.Count > 0)
                        {
                            termurAddons.Add(design);
                            addonsTer++;
                            for (int i = 0; i < design.Components.Count; ++i)
                            {
                                compsTer++;
                            }
                        }
                    }
                }
            }

            AddLabel(40, 26, 200, String.Format("Felucca - {0} Addons, with {1} Components to process.", addonsFel, compsFel));
            AddLabel(40, 51, 200, String.Format("Trammel - {0} Addons, with {1} Components to process.", addonsTra, compsTra));
            AddLabel(40, 76, 200, String.Format("Malas - {0} Addons, with {1} Components to process.", addonsMal, compsMal));
            AddLabel(40, 101, 200, String.Format("Ilshenar - {0} Addons, with {1} Components to process.", addonsIls, compsIls));
            AddLabel(40, 126, 200, String.Format("Tokuno - {0} Addons, with {1} Components to process.", addonsTok, compsTok));
            AddLabel(40, 151, 200, String.Format("TerMur - {0} Addons, with {1} Components to process.", addonsTer, compsTer));

            AddCheck(20, 23, 210, 211, true, 101);
            AddCheck(20, 48, 210, 211, true, 102);
            AddCheck(20, 73, 210, 211, true, 103);
            AddCheck(20, 98, 210, 211, true, 104);
            AddCheck(20, 123, 210, 211, true, 105);
            AddCheck(20, 148, 210, 211, true, 106);

            AddButton(30, 234, 247, 249, 1, GumpButtonType.Reply, 0);
            AddButton(100, 234, 241, 243, 0, GumpButtonType.Reply, 0);
        }