Ejemplo n.º 1
0
        public override void OnCast()
        {
            if (!CheckSequence())
            {
                return;
            }
            else if (Caster.Mounted)
            {
                Caster.SendLocalizedMessage(1042561); //Please dismount first.
            }
            else if (!Caster.CanBeginAction(typeof(AncientPeerSpell)))
            {
                Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
            }
            else if (Server.Spells.TransformationSpellHelper.UnderTransformation(Caster))
            {
                Caster.SendMessage("Your eyes stay firmly inside your body.");
            }
            else if (DisguiseGump.IsDisguised(Caster))
            {
                Caster.SendMessage("Your eyes stay firmly inside your body.");
            }
            else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
            {
                Caster.SendMessage("Your eyes stay firmly inside your body.");
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod)
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(AncientPeerSpell)))
                {
                    if (this.Scroll != null)
                    {
                        Scroll.Consume();
                    }
                    Caster.PlaySound(0x2DF);

                    Caster.SendMessage("Your sight leaves your body.");

                    Souless dg = new Souless(this);

                    dg.Body = Caster.Body;

                    dg.Hue         = Caster.Hue;
                    dg.Name        = Caster.Name;
                    dg.SpeechHue   = Caster.SpeechHue;
                    dg.Fame        = Caster.Fame;
                    dg.Karma       = Caster.Karma;
                    dg.EmoteHue    = Caster.EmoteHue;
                    dg.Title       = Caster.Title;
                    dg.Criminal    = (Caster.Criminal);
                    dg.AccessLevel = Caster.AccessLevel;
                    dg.Str         = Caster.Str;
                    dg.Int         = Caster.Int;
                    dg.Hits        = Caster.Hits;
                    dg.Dex         = Caster.Dex;
                    dg.Mana        = Caster.Mana;
                    dg.Stam        = Caster.Stam;

                    dg.VirtualArmor = (Caster.VirtualArmor);
                    dg.SetSkill(SkillName.Wrestling, Caster.Skills[SkillName.Wrestling].Value);
                    dg.SetSkill(SkillName.Tactics, Caster.Skills[SkillName.Tactics].Value);
                    dg.SetSkill(SkillName.Anatomy, Caster.Skills[SkillName.Anatomy].Value);

                    dg.SetSkill(SkillName.Magery, Caster.Skills[SkillName.Magery].Value);
                    dg.SetSkill(SkillName.MagicResist, Caster.Skills[SkillName.MagicResist].Value);
                    dg.SetSkill(SkillName.Meditation, Caster.Skills[SkillName.Meditation].Value);
                    dg.SetSkill(SkillName.EvalInt, Caster.Skills[SkillName.EvalInt].Value);

                    dg.SetSkill(SkillName.Archery, Caster.Skills[SkillName.Archery].Value);
                    dg.SetSkill(SkillName.Macing, Caster.Skills[SkillName.Macing].Value);
                    dg.SetSkill(SkillName.Swords, Caster.Skills[SkillName.Swords].Value);
                    dg.SetSkill(SkillName.Fencing, Caster.Skills[SkillName.Fencing].Value);
                    dg.SetSkill(SkillName.Lumberjacking, Caster.Skills[SkillName.Lumberjacking].Value);
                    dg.SetSkill(SkillName.Alchemy, Caster.Skills[SkillName.Alchemy].Value);
                    dg.SetSkill(SkillName.Parry, Caster.Skills[SkillName.Parry].Value);
                    dg.SetSkill(SkillName.Focus, Caster.Skills[SkillName.Focus].Value);
                    dg.SetSkill(SkillName.Necromancy, Caster.Skills[SkillName.Necromancy].Value);
                    dg.SetSkill(SkillName.Chivalry, Caster.Skills[SkillName.Chivalry].Value);
                    dg.SetSkill(SkillName.ArmsLore, Caster.Skills[SkillName.ArmsLore].Value);
                    dg.SetSkill(SkillName.Poisoning, Caster.Skills[SkillName.Poisoning].Value);
                    dg.SetSkill(SkillName.SpiritSpeak, Caster.Skills[SkillName.SpiritSpeak].Value);
                    dg.SetSkill(SkillName.Stealing, Caster.Skills[SkillName.Stealing].Value);
                    dg.SetSkill(SkillName.Inscribe, Caster.Skills[SkillName.Inscribe].Value);
                    dg.Kills = (Caster.Kills);

                    m_PeerMod = new ArrayList();
                    double   loss = (0 - Caster.Skills[SkillName.AnimalTaming].Base);
                    SkillMod sk   = new DefaultSkillMod(SkillName.AnimalTaming, true, loss);
                    Caster.AddSkillMod(sk);
                    m_PeerMod.Add(sk);
                    double   loss1 = (0 - Caster.Skills[SkillName.AnimalLore].Base);
                    SkillMod sk1   = new DefaultSkillMod(SkillName.AnimalLore, true, loss1);// Druidry
                    Caster.AddSkillMod(sk1);
                    m_PeerMod.Add(sk1);

                    double   loss3 = (0 - Caster.Skills[SkillName.Necromancy].Base);
                    SkillMod sk3   = new DefaultSkillMod(SkillName.Necromancy, true, loss3);
                    Caster.AddSkillMod(sk3);
                    m_PeerMod.Add(sk3);
                    double   loss4 = (0 - Caster.Skills[SkillName.TasteID].Base);
                    SkillMod sk4   = new DefaultSkillMod(SkillName.TasteID, true, loss4);
                    Caster.AddSkillMod(sk4);
                    m_PeerMod.Add(sk4);
                    // Clear Items
                    RemoveFromAllLayers(dg);

                    // Then copy
                    CopyFromLayer(Caster, dg, Layer.FirstValid);
                    CopyFromLayer(Caster, dg, Layer.OneHanded);
                    CopyFromLayer(Caster, dg, Layer.TwoHanded);
                    CopyFromLayer(Caster, dg, Layer.Shoes);
                    CopyFromLayer(Caster, dg, Layer.Pants);
                    CopyFromLayer(Caster, dg, Layer.Shirt);
                    CopyFromLayer(Caster, dg, Layer.Helm);
                    CopyFromLayer(Caster, dg, Layer.Gloves);
                    CopyFromLayer(Caster, dg, Layer.Ring);
                    CopyFromLayer(Caster, dg, Layer.Talisman);
                    CopyFromLayer(Caster, dg, Layer.Neck);
                    CopyFromLayer(Caster, dg, Layer.Hair);
                    CopyFromLayer(Caster, dg, Layer.Waist);
                    CopyFromLayer(Caster, dg, Layer.InnerTorso);
                    CopyFromLayer(Caster, dg, Layer.Bracelet);
                    CopyFromLayer(Caster, dg, Layer.Unused_xF);
                    CopyFromLayer(Caster, dg, Layer.FacialHair);
                    CopyFromLayer(Caster, dg, Layer.MiddleTorso);
                    CopyFromLayer(Caster, dg, Layer.Earrings);
                    CopyFromLayer(Caster, dg, Layer.Arms);
                    CopyFromLayer(Caster, dg, Layer.Cloak);
                    CopyFromLayer(Caster, dg, Layer.Backpack);
                    CopyFromLayer(Caster, dg, Layer.OuterTorso);
                    CopyFromLayer(Caster, dg, Layer.OuterLegs);
                    CopyFromLayer(Caster, dg, Layer.InnerLegs);
                    CopyFromLayer(Caster, dg, Layer.LastUserValid);
                    CopyFromLayer(Caster, dg, Layer.Mount);

                    dg.Owner    = Caster;
                    dg.OldBody  = m_OldBody;
                    m_Fake      = dg;
                    dg.Map      = Caster.Map;
                    dg.Location = Caster.Location;
                    BaseArmor.ValidateMobile(Caster);
                    m_OldBody        = Caster.Body;
                    Caster.BodyValue = 903;
                    Caster.Blessed   = true;
                    StopTimer(Caster);

                    Timer t = new InternalTimer(Caster, m_OldBody, m_Fake, this);

                    m_Timers[Caster] = t;

                    t.Start();
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559); // This spell is already in effect.
                }
            }

            FinishSequence();
        }
Ejemplo n.º 2
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

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

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                       // Both hands must be free to steal.
                }
                else if (root is Mobile && ((Mobile)root).IsPlayer && 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).IsPlayer && 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 || (!toSteal.Stackable && !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);

                    Sigil 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 (DisguiseGump.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 (TransformationSpell.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                               // You cannot steal the sigil while in that form.
                        }
                        else if (Spells.Ninjitsu.AnimalForm.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1063222);                               // You cannot steal the sigil while mimicking an animal.
                        }
                        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, 80.0, 80.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.Now;                                     // begin grace period
                                }
                                m_Thief.SendLocalizedMessage(1010586);                                 // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                if (sig.LastMonolith != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                }

                                sig.LastStolen = DateTime.Now;

                                sig.OnStolen(m_Thief);

                                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 (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) && !(root is FillableContainer)))
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (si == null && toSteal is Container)
                {
                    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.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.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 equiped.
                }
                else if (root == 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))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                       // You can't steal that!
                }
                else if (root is BaseCreature && ((BaseCreature)root).ControlMaster == null && ((BaseCreature)root).StolenFrom)
                {
                    m_Thief.SendLocalizedMessage(1094948);                       // That creature has already been stolen from. There is nothing left to steal.
                }
                else if (root is BaseCreature && SpecialDropChance(m_Thief, (BaseCreature)root) > Utility.RandomDouble())
                {
                    try
                    {
                        stolen = (Item)Activator.CreateInstance(m_SpecialDrops[Utility.Random(m_SpecialDrops.Length)]);
                    }
                    catch
                    {
                    }

                    if (stolen != null)
                    {
                        m_Thief.SendLocalizedMessage(1094947);                           // You successfully steal a special item from the creature!
                        ((BaseCreature)root).StolenFrom = true;
                    }
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

                            Utility.FixMinMax(ref maxAmount, 1, toSteal.Amount);

                            int amount = Utility.RandomMinMax(1, maxAmount);

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

                                if (m_Thief.CheckTargetSkill(SkillName.Stealing, toSteal, pileWeight - 22.5, pileWeight + 27.5))
                                {
                                    if (!m_Thief.Backpack.CheckHold(m_Thief, toSteal, false, true))
                                    {
                                        m_Thief.SendLocalizedMessage(1048147);                                           // Your backpack can't hold anything else.
                                    }
                                    else
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                            else
                            {
                                int 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);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }

                                    if (!m_Thief.Backpack.CheckHold(m_Thief, stolen, false, true))
                                    {
                                        stolen.Delete();
                                        stolen = null;
                                        m_Thief.SendLocalizedMessage(1048147);                                           // Your backpack can't hold anything else.
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

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

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

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

                            if (root is BaseCreature)
                            {
                                ((BaseCreature)root).StolenFrom = true;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                               // You fail to steal the item.
                        }

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

                return(stolen);
            }
Ejemplo n.º 3
0
        public override void OnCast()
        {
            if (Factions.Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1010445);                   // You cannot incognito if you have a sigil
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
            {
                Caster.SendLocalizedMessage(1005559);                   // This spell is already in effect.
            }
            else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
            {
                Caster.SendLocalizedMessage(1042402);                   // You cannot use incognito while wearing body paint
            }
            else if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod)
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(IncognitoSpell)))
                {
                    DisguiseGump.StopTimer(Caster);

                    Race race = Caster.Race;

                    Caster.BodyMod = Utility.RandomList(race.MaleBody, race.FemaleBody);
                    Caster.HueMod  = race.RandomSkinHue();
                    Caster.NameMod = Caster.Body.IsFemale ? NameList.RandomName("female") : NameList.RandomName("male");

                    PlayerMobile pm = Caster as PlayerMobile;

                    if (pm != null)
                    {
                        pm.SetHairMods(race.RandomHair(pm.Body.IsFemale), race.RandomFacialHair(pm.Body.IsFemale));

                        pm.HairHue       = race.RandomHairHue();
                        pm.FacialHairHue = race.RandomHairHue();
                    }

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

                    BaseArmor.ValidateMobile(Caster);
                    BaseClothing.ValidateMobile(Caster);

                    StopTimer(Caster);

                    int timeVal = ((6 * Caster.Skills.Magery.Fixed) / 50) + 1;

                    Utility.FixMax(ref timeVal, 144);

                    TimeSpan length = TimeSpan.FromSeconds(timeVal);

                    Timer t = new InternalTimer(Caster, length);

                    m_Timers[Caster] = t;

                    t.Start();

                    BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Incognito, 1075819, length, Caster));
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559);                       // This spell is already in effect.
                }
            }

            FinishSequence();
        }
Ejemplo n.º 4
0
        public override void OnCast()
        {
            /*if ( Caster.Mounted )
             * {
             *      Caster.SendLocalizedMessage( 1042561 ); //Please dismount first.
             * }
             * else */
            if (Factions.Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1010521);                   // You cannot polymorph while you have a Town Sigil
            }
            else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                if (Core.ML)
                {
                    EndPolymorph(Caster);
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559);                       // This spell is already in effect.
                }
            }
            else if (TransformationSpellHelper.UnderTransformation(Caster))
            {
                Caster.SendLocalizedMessage(1061633);                   // You cannot polymorph while in that form.
            }
            else if (DisguiseGump.IsDisguised(Caster))
            {
                Caster.SendLocalizedMessage(502167);                   // You cannot polymorph while disguised.
            }
            else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
            {
                Caster.SendLocalizedMessage(1042512);                   // You cannot polymorph while wearing body paint
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod)
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(PolymorphSpell)))
                {
                    if (m_NewBody != 0)
                    {
                        if (!((Body)m_NewBody).IsHuman)
                        {
                            Mobiles.IMount mt = Caster.Mount;

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

                        Caster.BodyMod = m_NewBody;

                        if (m_NewBody == 400 || m_NewBody == 401)
                        {
                            Caster.HueMod = Utility.RandomSkinHue();
                        }
                        else
                        {
                            Caster.HueMod = 0;
                        }

                        BaseArmor.ValidateMobile(Caster);
                        BaseClothing.ValidateMobile(Caster);

                        if (!Core.ML)
                        {
                            StopTimer(Caster);

                            Timer t = new InternalTimer(Caster);

                            m_Timers[Caster] = t;

                            t.Start();
                        }
                    }
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559);                       // This spell is already in effect.
                }
            }

            FinishSequence();
        }
Ejemplo n.º 5
0
        public override void OnCast()
        {
            if (Factions.Sigil.ExistsOn(Caster))
            {
                Caster.SendLocalizedMessage(1010521);                   // You cannot polymorph while you have a Town Sigil
            }
            else if (!Caster.CanBeginAction(typeof(PolymorphSpell)))
            {
                Caster.SendLocalizedMessage(1005559);                   // This spell is already in effect.
            }
            else if (Necromancy.TransformationSpell.UnderTransformation(Caster))
            {
                Caster.SendLocalizedMessage(1061633);                   // You cannot polymorph while in that form.
            }
            else if (DisguiseGump.IsDisguised(Caster))
            {
                Caster.SendLocalizedMessage(502167);                   // You cannot polymorph while disguised.
            }
            else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
            {
                Caster.SendLocalizedMessage(1042512);                   // You cannot polymorph while wearing body paint
            }
            else if (!Caster.CanBeginAction(typeof(IncognitoSpell)) || Caster.IsBodyMod)
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(PolymorphSpell)))
                {
                    if (m_NewBody != 0)
                    {
                        if (!((Body)m_NewBody).IsHuman)
                        {
                            Mobiles.IMount mt = Caster.Mount;

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

                        Caster.BodyMod = m_NewBody;

                        if (m_NewBody == 400 || m_NewBody == 401)
                        {
                            Caster.HueMod = Utility.RandomSkinHue();
                        }
                        else
                        {
                            Caster.HueMod = 0;
                        }

                        BaseArmor.ValidateMobile(Caster);
                        BaseClothing.ValidateMobile(Caster);

                        StopTimer(Caster);

                        Timer t = new InternalTimer(Caster);

                        m_Timers[Caster] = t;

                        BuffInfo.AddBuff(Caster, new BuffInfo(BuffIcon.Polymorph, 1075824, 1075823, t.Delay, Caster, String.Format("{0}\t{1}", GetArticleCliloc(m_NewBody), GetFormCliloc(m_NewBody))));

                        t.Start();
                    }
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559);                       // This spell is already in effect.
                }
            }

            FinishSequence();
        }
Ejemplo n.º 6
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

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

                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);

                    Sigil 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 (DisguiseGump.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 (AnimalForm.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1063222);                             // You cannot steal the sigil while mimicking an animal.
                        }
                        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, 80.0, 80.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.Now;                                     // begin grace period
                                }
                                m_Thief.SendLocalizedMessage(1010586);                                 // YOU STOLE THE SIGIL!!!   (woah, calm down now)

                                if (sig.LastMonolith != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                }

                                sig.LastStolen = DateTime.Now;

                                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
                //ARTEGORDONMOD
                // allow stealing of STEALABLE items on the ground or in containers
                else if (si == null && (toSteal.Parent == null || !toSteal.Movable) && !ItemFlags.GetStealable(toSteal))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                //ARTEGORDONMOD
                // allow stealing of of STEALABLE newbied/blessed items
                else if ((toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root)) && !ItemFlags.GetStealable(toSteal))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                //ARTEGORDONMOD
                // allow stealing of STEALABLE containers
                else if (Core.AOS && si == null && toSteal is Container && !ItemFlags.GetStealable(toSteal))
                {
                    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.
                }
                else if (si != null && m_Thief.Skills[SkillName.Stealing].Value < 100.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 equiped.
                }
                else if (root == 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))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            //ARTEGORDON
                            // fix for zero-weight stackables
                            int maxAmount = toSteal.Amount;
                            if (toSteal.Weight > 0)
                            {
                                maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);
                            }

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

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int 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
                            {
                                int 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);

                                    if (stolen == null)
                                    {
                                        stolen = toSteal;
                                    }
                                }
                            }
                        }
                        else
                        {
                            int iw = (int)Math.Ceiling(w);
                            iw *= 10;

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

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                             // You succesfully steal the item.
                            // 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);
                            // release it if it was locked down
                            stolen.Movable = true;

                            // End mod for stealable rares and other locked down items

                            if (si != null)
                            {
                                toSteal.Movable = true;
                                si.Item         = null;
                            }
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                             // You fail to steal the item.
                        }

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

                return(stolen);
            }
Ejemplo n.º 7
0
        public override void OnCast()
        {
            if (!Caster.CanBeginAction(typeof(IncognitoSpell)))
            {
                Caster.SendLocalizedMessage(1005559);                   // This spell is already in effect.
            }
            else if (Caster.BodyMod == 183 || Caster.BodyMod == 184)
            {
                Caster.SendLocalizedMessage(1042402);                   // You cannot use incognito while wearing body paint
            }
            else if (!Caster.CanBeginAction(typeof(PolymorphSpell)) || Caster.IsBodyMod)
            {
                DoFizzle();
            }
            else if (CheckSequence())
            {
                if (Caster.BeginAction(typeof(IncognitoSpell)))
                {
                    DisguiseGump.StopTimer(Caster);

                    Caster.BodyMod = Utility.RandomList(400, 401);
                    Caster.HueMod  = Utility.RandomSkinHue();
                    Caster.NameMod = Caster.Body.IsFemale ? NameList.RandomName("female") : NameList.RandomName("male");

                    PlayerMobile pm = Caster as PlayerMobile;

                    if (pm != null)
                    {
                        if (pm.Body.IsFemale)
                        {
                            pm.SetHairMods(Utility.RandomList(m_HairIDs), 0);
                        }
                        else
                        {
                            pm.SetHairMods(Utility.RandomList(m_HairIDs), Utility.RandomList(m_BeardIDs));
                        }

                        Item hair = pm.FindItemOnLayer(Layer.Hair);

                        if (hair != null)
                        {
                            hair.Hue = Utility.RandomHairHue();
                        }

                        hair = pm.FindItemOnLayer(Layer.FacialHair);

                        if (hair != null)
                        {
                            hair.Hue = Utility.RandomHairHue();
                        }
                    }

                    Caster.Delta(MobileDelta.Noto);

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

                    BaseArmor.ValidateMobile(Caster);

                    StopTimer(Caster);

                    Timer t = new InternalTimer(Caster);

                    m_Timers[Caster] = t;

                    t.Start();
                }
                else
                {
                    Caster.SendLocalizedMessage(1005559);                       // This spell is already in effect.
                }
            }

            FinishSequence();
        }
Ejemplo n.º 8
0
        public static void WipeMods(Mobile m)
        {
            PlayerMobile pm = m as PlayerMobile;

            m.DisruptiveAction();

            foreach (StatType Stat in Enum.GetValues(typeof(StatType)))
            {
                string name = String.Format("[Magic] {0} Offset", Stat);
                if (m.GetStatMod(name) != null)
                {
                    m.RemoveStatMod(name);
                }
            }

            if (TransformationSpellHelper.UnderTransformation(m))
            {
                TransformationSpellHelper.RemoveContext(m, true);
            }

            m.HueMod  = -1;
            m.NameMod = null;


            PolymorphSpell.StopTimer(m);
            IncognitoSpell.StopTimer(m);
            DisguiseGump.StopTimer(m);


            foreach (Type T in DispelActions)
            {
                m.EndAction(T);
            }

            m.BodyMod = 0;
            m.HueMod  = -1;



            if (pm != null)
            {
                if (pm.BuffTable != null)
                {
                    List <BuffInfo> list = new List <BuffInfo>();

                    foreach (BuffInfo buff in pm.BuffTable.Values)
                    {
                        if (!buff.RetainThroughDeath)
                        {
                            list.Add(buff);
                        }
                    }

                    for (int i = 0; i < list.Count; i++)
                    {
                        pm.RemoveBuff(list[i]);
                    }
                }

                pm.SavagePaintExpiration = TimeSpan.Zero;
                pm.SetHairMods(-1, -1);

                pm.ResendBuffs();
            }



            m.VirtualArmorMod = 0;


            BaseArmor.ValidateMobile(m);
            BaseClothing.ValidateMobile(m);
        }
Ejemplo n.º 9
0
            private Item TryStealItem(Item toSteal, ref bool caught)
            {
                Item stolen = null;

                object root = toSteal.RootParent;

                if (!IsEmptyHanded(m_Thief))
                {
                    m_Thief.SendLocalizedMessage(1005584);                       // Both hands must be free to steal.
                }
                else if (m_Thief.Region.Name == "NonDuelPit" || m_Thief.Region.Name == "DuelPit")
                {
                    m_Thief.SendMessage("You may not steal in this area.");
                }

                /*
                 * 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);

                    Sigil 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 (DisguiseGump.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 (TransformationSpell.UnderTransformation(m_Thief))
                        {
                            m_Thief.SendLocalizedMessage(1061622);                             // You cannot steal the sigil while in that form.
                        }
                        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, 80.0, 80.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.Now;                                     // begin grace period
                                }
                                m_Thief.SendLocalizedMessage(1010586);                                 // YOU STOLE THE SIGIL!!!   (woah, call down now)

                                if (sig.LastMonolith != null)
                                {
                                    sig.LastMonolith.Sigil = null;
                                }

                                sig.LastStolen = DateTime.Now;

                                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 (toSteal.Parent == null || !toSteal.Movable || toSteal.LootType == LootType.Newbied || toSteal.CheckBlessed(root))
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else if (Core.AOS && toSteal is Container)
                {
                    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.
                }
                else if (toSteal.Parent is Mobile)
                {
                    m_Thief.SendLocalizedMessage(1005585);                     // You cannot steal items which are equiped.
                }
                else if (root == 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))
                {
                }
                else if (root is Corpse)
                {
                    m_Thief.SendLocalizedMessage(502710);                     // You can't steal that!
                }
                else
                {
                    double w = toSteal.Weight + toSteal.TotalWeight;

                    if (w > 10)
                    {
                        m_Thief.SendMessage("That is too heavy to steal.");
                    }
                    else
                    {
                        if (toSteal.Stackable && toSteal.Amount > 1)
                        {
                            int maxAmount = (int)((m_Thief.Skills[SkillName.Stealing].Value / 10.0) / toSteal.Weight);

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

                            int amount = Utility.RandomMinMax(1, maxAmount);

                            if (amount >= toSteal.Amount)
                            {
                                int 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
                            {
                                int pileWeight = (int)Math.Ceiling(toSteal.Weight * amount);
                                pileWeight *= 10;

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

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

                        if (stolen != null)
                        {
                            m_Thief.SendLocalizedMessage(502724);                             // You succesfully steal the item.
                        }
                        else
                        {
                            m_Thief.SendLocalizedMessage(502723);                             // You fail to steal the item.
                        }
                        //if (stolen.Weight < 3)
                        //caught = false;
                        //else
                        caught = (m_Thief.Skills[SkillName.Stealing].Value < Utility.Random(150));
                    }
                }

                return(stolen);
            }