Exemple #1
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(this.GetWorldLocation(), 2))
            {
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    ArrayList items = new ArrayList(this.Items);

                    bool gathered = false;
                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = (Item)items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable || !GetRestoreInfo(item, ref loc))
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                robe.Delete();
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        Delete();
                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471); // You quickly gather all of your belongings.
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472); // You gather some of your belongings. The rest remain on the corpse.
                    }
                }

                if (!CheckLoot(from))
                {
                    return;
                }

                TeiravonMobile player = from as TeiravonMobile;

                if (player != null)
                {
                    QuestSystem qs = player.Quest;

                    if (this.Owner is BaseCreature && player.HasFeat(TeiravonMobile.Feats.Scavenger) && !Scavenged)
                    {
                        Scavenged = true;
                        TAVUtilities.ScavengeLoot(player, this.Owner);
                    }

                    if (qs is UzeraanTurmoilQuest)
                    {
                        GetDaemonBoneObjective obj = qs.FindObjective(typeof(GetDaemonBoneObjective)) as GetDaemonBoneObjective;

                        if (obj != null && obj.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
                        {
                            Item bone = new QuestDaemonBone();

                            if (player.PlaceInBackpack(bone))
                            {
                                obj.CorpseWithBone = null;
                                player.SendLocalizedMessage(1049341, "", 0x22); // You rummage through the bones and find a Daemon Bone!  You quickly place the item in your pack.

                                if (!obj.Completed)
                                {
                                    obj.Complete();
                                }
                            }
                            else
                            {
                                bone.Delete();
                                player.SendLocalizedMessage(1049342, "", 0x22); // Rummaging through the bones you find a Daemon Bone, but can't pick it up because your pack is too full.  Come back when you have more room in your pack.
                            }

                            return;
                        }
                    }
                    else if (qs is TheSummoningQuest)
                    {
                        VanquishDaemonObjective obj = qs.FindObjective(typeof(VanquishDaemonObjective)) as VanquishDaemonObjective;

                        if (obj != null && obj.Completed && obj.CorpseWithSkull == this)
                        {
                            GoldenSkull sk = new GoldenSkull();

                            if (player.PlaceInBackpack(sk))
                            {
                                obj.CorpseWithSkull = null;
                                player.SendLocalizedMessage(1050022); // For your valor in combating the devourer, you have been awarded a golden skull.
                                qs.Complete();
                            }
                            else
                            {
                                sk.Delete();
                                player.SendLocalizedMessage(1050023); // You find a golden skull, but your backpack is too full to carry it.
                            }
                        }
                    }
                }

                base.OnDoubleClick(from);

                if (from != m_Owner)
                {
                    from.RevealingAction();
                }
            }
            else
            {
                from.SendLocalizedMessage(500446); // That is too far away.
                return;
            }
        }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            Mobile from = state.Mobile;

            from.CantWalk = false;
            from.CloseGump(typeof(ResurrectGump));

            if (info.ButtonID == 1 || info.ButtonID == 2)
            {
                if (from.Map == null || !from.Map.CanFit(from.Location, 16, false, false))
                {
                    from.SendLocalizedMessage(502391);                       // Thou can not be resurrected there!
                    return;
                }

                if (m_Healer != null && (m_Healer is BaseHealer) && !from.InRange(m_Healer.Location, 5))
                {
                    from.SendMessage("You've strayed too far from the healer!");
                    return;
                }


                if (m_Price > 0)
                {
                    if (info.IsSwitched(1))
                    {
                        if (Banker.Withdraw(from, m_Price))
                        {
                            from.SendLocalizedMessage(1060398, m_Price.ToString());                               // ~1_AMOUNT~ gold has been withdrawn from your bank box.
                            from.SendLocalizedMessage(1060022, Banker.GetBalance(from).ToString());               // You have ~1_AMOUNT~ gold in cash remaining in your bank box.
                        }
                        else
                        {
                            from.SendLocalizedMessage(1060020);                               // Unfortunately, you do not have enough cash in your bank to cover the cost of the healing.
                            return;
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(1060019);                           // You decide against paying the healer, and thus remain dead.
                        return;
                    }
                }

                from.PlaySound(0x214);
                from.FixedEffect(0x376A, 10, 16);

                from.Resurrect();
                TAVUtilities.FindCorpse(from);

                if (m_Healer != null && from != m_Healer)
                {
                    VirtueLevel level = VirtueHelper.GetLevel(m_Healer, VirtueName.Compassion);

                    switch (level)
                    {
                    case VirtueLevel.Seeker: from.Hits = AOS.Scale(from.HitsMax, 20); break;

                    case VirtueLevel.Follower: from.Hits = AOS.Scale(from.HitsMax, 40); break;

                    case VirtueLevel.Knight: from.Hits = AOS.Scale(from.HitsMax, 80); break;
                    }

                    Misc.Titles.AwardFame(m_Healer, 2500, true);
                }

                Mobile m = from;

                Misc.Titles.AwardFame(from, -100, true);                   // TODO: Proper fame loss

                /*
                 * if ( !Core.AOS && from.ShortTermMurders >= 5 )
                 * {
                 *      double loss = (100.0 - ( 4.0 + (from.ShortTermMurders/5.0))) / 100.0;//5 to 15% loss
                 *      if ( loss < 0.85 )
                 *              loss = 0.85;
                 *      else if ( loss > 0.95 )
                 *              loss = 0.95;
                 *
                 *      if ( from.RawStr * loss > 10 )
                 *              from.RawStr = (int)(from.RawStr * loss);
                 *      if ( from.RawInt * loss > 10 )
                 *              from.RawInt = (int)(from.RawInt * loss);
                 *      if ( from.RawDex * loss > 10 )
                 *              from.RawDex = (int)(from.RawDex * loss);
                 *
                 *      for (int s=0;s<from.Skills.Length;s++)
                 *      {
                 *              if ( from.Skills[s].Base * loss > 35 )
                 *                      from.Skills[s].Base *= loss;
                 *      }
                 * }
                 */
            }
        }
Exemple #3
0
        private void MoveNet(object state)
        {
            object[]     states = (object[])state;
            BattleNet    bn     = (BattleNet)states[0];
            PlayerMobile pm     = (PlayerMobile)states[1];


            if ((Math.Abs(bn.Y - m_EndY) == 0 || (Math.Abs(bn.X - m_EndX) / Math.Abs(bn.Y - m_EndY)) >= 2) && bn.Movable)
            {
                if ((bn.X - m_EndX) < 0)
                {
                    bn.X++;
                }
                else if ((bn.X - m_EndX) > 0)
                {
                    bn.X--;
                }
            }
            else if ((Math.Abs(bn.X - m_EndX) == 0 || (Math.Abs(bn.Y - m_EndY) / Math.Abs(bn.X - m_EndX)) > 2) && bn.Movable)
            {
                if ((bn.Y - m_EndY) < 0)
                {
                    bn.Y++;
                }
                else if ((bn.Y - m_EndY) > 0)
                {
                    bn.Y--;
                }
            }
            else if (bn.Movable)
            {
                if ((bn.X - m_EndX) < 0)
                {
                    bn.X++;
                }
                else if ((bn.X - m_EndX) > 0)
                {
                    bn.X--;
                }

                if ((bn.Y - m_EndY) < 0)
                {
                    bn.Y++;
                }
                else if ((bn.Y - m_EndY) > 0)
                {
                    bn.Y--;
                }
            }

            if (bn.Y == m_EndY && bn.X == m_EndX && bn.Movable)
            {
                bn.ItemID = 3530;
            }

            foreach (Mobile m in bn.GetMobilesInRange(0))
            {
                if (m != null && m != pm && m.CantWalk != true && m.AccessLevel <= pm.AccessLevel)
                {
                    if ((m is BaseCreature && TAVUtilities.CalculateLevel(m) < 45) || m is TeiravonMobile)
                    {
                        double duration = 12.0;
                        duration  -= (TAVUtilities.CalculateLevel(m) * .25);
                        m.CantWalk = true;
                        bn.Movable = false;
                        m_Timer    = new ReleaseTimer(m, bn);
                        bn.ItemID  = 7843;
                        m.LocalOverheadMessage(Server.Network.MessageType.Regular, MessageHue, true, "You've been ensnared in a net!");
                        m.Emote("*Struggles under the heavy netting*");
                        //m.Location = bn.Location;
                        m_Timer.Start();
                    }
                    else
                    {
                        m.Emote("*Shreds the netting effortlessly*");
                        bn.Delete();
                    }
                }
            }
        }
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (targeted is BaseCreature)
                {
                    BaseCreature m_Creature = (BaseCreature)targeted;
                    if (!m_Creature.Controled || m_Creature.ControlMaster != from)
                    {
                        m_Trainer.SayTo(from, false, "You've no claim to that animal.");
                    }
                    else if (!m_Creature.Alive || m_Creature == null)
                    {
                        m_Trainer.SayTo(from, false, "They don't look up to the task.");
                    }
                    else if (m_Creature.Female == m_First.Female || m_Creature.GetType() != m_First.GetType())
                    {
                        m_Trainer.SayTo(from, false, "I'm afraid that's biologically impossible.");
                        // DEBUG TEXT
                        //from.SendMessage("{0},{1}",m_First.GetType().ToString(), m_Creature.GetType().ToString());
                    }
                    else if (from.Stabled.Count + 3 >= GetMaxStabled(from))
                    {
                        m_Trainer.SayTo(from, false, "I'm afraid there's no room in the stable to breed these animals.");
                    }
                    else
                    {
                        Type type = m_First.GetType();
                        if (type != null)
                        {
                            try
                            {
                                object o = Activator.CreateInstance(type);

                                if (o is BaseCreature)
                                {
                                    BaseCreature child = (BaseCreature)o;

                                    m_First.ControlTarget = null;
                                    m_First.ControlOrder  = OrderType.Stay;

                                    m_First.SetControlMaster(null);
                                    m_First.SummonMaster = null;

                                    m_First.IsStabled = true;

                                    m_Creature.ControlTarget = null;
                                    m_Creature.ControlOrder  = OrderType.Stay;

                                    m_Creature.SetControlMaster(null);
                                    m_Creature.SummonMaster = null;

                                    m_Creature.IsStabled = true;

                                    child.IsStabled = true;

                                    from.Stabled.Add(child);
                                    from.Stabled.Add(m_First);
                                    from.Stabled.Add(m_Creature);
                                    child.BardEndTime      = DateTime.Now.AddDays(1);
                                    m_First.BardEndTime    = DateTime.Now.AddDays(1);
                                    m_Creature.BardEndTime = DateTime.Now.AddDays(1);
                                    child.Internalize();
                                    m_First.Internalize();
                                    m_Creature.Internalize();
                                    TAVUtilities.Reproduce(m_Creature, m_First, child);
                                    from.SendMessage("The animals have been stabled, neither the new born nor the parents may be removed from the stable for 24 hours.");
                                    m_Trainer.SayTo(from, false, "Very well, the animals will be stored in the stable overnight.");
                                }
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                else if (targeted == from)
                {
                    m_Trainer.SayTo(from, 502672); // HA HA HA! Sorry, I am not an inn.
                }
                else
                {
                    m_Trainer.SayTo(from, false, "I'm afraid I wouldn't know anything about that."); // You can't stable that!
                }
            }
            protected override void OnTick()
            {
                if (m_Item == null)
                {
                    return;
                }

                if (m_End < DateTime.Now)
                {
                    m_Item.Delete();
                }
                else
                {
                    //Effects.SendLocationEffect(m_Item, m_Item.Map, 0x36B0, 13 );
                    for (int i = 0; i < 15; i++)
                    {
                        IPoint2D lo   = new Point2D(TAVUtilities.RandomNormalInt(m_Item.X, 5), TAVUtilities.RandomNormalInt(m_Item.Y, 5));
                        IEntity  from = new Entity(Serial.Zero, new Point3D(lo, m_Item.Z + 5), m_Item.Map);
                        //m_Item.PlacedBy.SendMessage("{0}, {1}, {2}",from.X,from.Y,from.Z);
                        Effects.SendLocationEffect(from, m_Item.Map, Utility.RandomList(0x398C, 0x3996), 0);
                        //Effects.SendMovingEffect(from, too, 0x19AB, 0, 0, true, false);
                    }

                    if (m_Item == null)
                    {
                        return;
                    }

                    if (m_Item.Map == null)
                    {
                        return;
                    }

                    IPooledEnumerable eable = m_Item.Map.GetMobilesInRange(m_Item.Location, 3);

                    if (eable == null)
                    {
                        return;
                    }

                    ArrayList toBurn = new ArrayList();

                    foreach (Mobile m in eable)
                    {
                        if (m.Deleted || m == null)
                        {
                            continue;
                        }

                        if (m.AccessLevel == AccessLevel.Player && m_Item.PlacedBy.CanBeHarmful(m) && Spells.SpellHelper.ValidIndirectTarget(m_Item.PlacedBy, m))
                        {
                            toBurn.Add(m);
                        }
                    }

                    eable.Free();

                    for (int i = 0; i < toBurn.Count; i++)
                    {
                        Mobile m = toBurn[i] as Mobile;

                        if (m == null || m.Deleted)
                        {
                            continue;
                        }

                        if (m_Item.PlacedBy != null)
                        {
                            AOS.Damage(m, m_Item.PlacedBy, m_Item.GetResidueDamage(), 0, 100, 0, 0, 0);
                        }
                        else
                        {
                            AOS.Damage(m, m_Item.GetResidueDamage(), 0, 100, 0, 0, 0);
                        }
                    }

                    m_Item.DamageCount++;
                    if (m_Item.DamageCount > 10)
                    {
                        m_Item.Delete();
                        this.Stop();
                        return;
                    }
                    Timer m_Timer = new InternalTimer(m_Item, m_End);
                    m_Timer.Start();
                }
            }
Exemple #6
0
        public void Target(Mobile m)
        {
            //STARTMOD
            if (m is BaseCreature)
            {
                BaseCreature m_Pet = (BaseCreature)m;

                if (m_Pet.IsDeadBondedPet)
                {
                    m_Pet.PlaySound(0x214);
                    m_Pet.FixedEffect(0x376A, 10, 16);
                    m_Pet.ResurrectPet();
                    Misc.Titles.AwardFame(Caster, 500, true);
                    return;
                }
            }
            //ENDMOD

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (m == Caster)
            {
                Caster.SendLocalizedMessage(501039);                   // Thou can not resurrect thyself.
            }
            else if (!Caster.Alive)
            {
                Caster.SendLocalizedMessage(501040);                   // The resurrecter must be alive.
            }
            else if (m.Alive)
            {
                Caster.SendLocalizedMessage(501041);                   // Target is not dead.
            }
            else if (!Caster.InRange(m, 1))
            {
                Caster.SendLocalizedMessage(501042);                   // Target is not close enough.
            }
            else if (!m.Player)
            {
                Caster.SendLocalizedMessage(501043);                   // Target is not a being.
            }
            else if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
            {
                Caster.SendLocalizedMessage(501042);              // Target can not be resurrected at that location.
                m.SendLocalizedMessage(502391);                   // Thou can not be resurrected there!
            }
            else if (m.Region != null && m.Region.Name == "Khaldun")
            {
                Caster.SendLocalizedMessage(1010395);                   // The veil of death in this area is too strong and resists thy efforts to restore life.
            }
            else if (CheckBSequence(m, true))
            {
                SpellHelper.Turn(Caster, m);

                m.PlaySound(0x214);
                m.FixedEffect(0x376A, 10, 16);

                TAVUtilities.FindCorpse(m);

                if (Caster is TeiravonMobile)
                {
                    TeiravonMobile TAV = (TeiravonMobile)Caster;

                    int expTo = m.HitsMax * TAV.PlayerLevel / 2;

                    if (TAV.HasFeat(TeiravonMobile.Feats.HealersOath))
                    {
                        expTo *= 3;
                    }

                    if (Misc.Titles.AwardExp(TAV, expTo))
                    {
                        TAV.SendMessage("You have gained {0} experience.", expTo);
                    }
                    Misc.Titles.AwardFame(Caster, (int)(m.Fame * .1), true);
                }

                m.Resurrect();
                Misc.Titles.AwardFame(m, -(int)(m.Fame * .1), true);
            }

            FinishSequence();
        }
Exemple #7
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (!from.Alive)
                {
                    from.SendLocalizedMessage(500331);                       // The spirits of the dead are not the province of animal lore.
                }
                else if (targeted is BaseCreature)
                {
                    BaseCreature c = (BaseCreature)targeted;

                    if (!c.IsDeadPet)
                    {
                        if (c.Body.IsAnimal || c.Body.IsMonster || c.Body.IsSea || c.BodyValue == 242)
                        {
                            if ((!c.Controled || !c.Tamable) && from.Skills[SkillName.AnimalLore].Base < 100.0)
                            {
                                from.SendLocalizedMessage(1049674);                                   // At your skill level, you can only lore tamed creatures.
                            }
                            else if (!c.Tamable && from.Skills[SkillName.AnimalLore].Base < 110.0)
                            {
                                from.SendLocalizedMessage(1049675);                                   // At your skill level, you can only lore tamed or tameable creatures.
                            }
                            else if (!from.CheckTargetSkill(SkillName.AnimalLore, c, 0.0, 120.0))
                            {
                                from.SendLocalizedMessage(500334);                                   // You can't think of anything you know offhand.
                            }
                            else
                            {
                                if (c.Tamable)
                                {
                                    TavGenome genome = (TavGenome)XmlAttach.FindAttachment(c, typeof(TavGenome));

                                    if (genome == null)
                                    {
                                        genome = new TavGenome();
                                        XmlAttach.AttachTo(c, genome);
                                        TAVUtilities.ScaleGenetics(c);
                                    }
                                }
                                bool husbandry = false;
                                if (from is TeiravonMobile && ((TeiravonMobile)from).HasFeat(TeiravonMobile.Feats.AnimalHusbandry))
                                {
                                    husbandry = true;
                                }

                                from.CloseGump(typeof(AnimalLoreGump));
                                from.SendGump(new AnimalLoreGump(c, husbandry));
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500329);                               // That's not an animal!
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(500331);                           // The spirits of the dead are not the province of animal lore.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500329);                       // That's not an animal!
                }
            }