Ejemplo n.º 1
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
		{
			if(from.InRange(c.Location, 3) && from.Backpack != null)
			{
				foreach(WispOrb orb in WispOrb.Orbs)
				{
					if(orb.Owner == from)
					{
						LabelTo(from, 1153357); // Thou can guide but one of us.
						return;
					}
				}
				
				Alignment alignment = Alignment.Neutral;
				
				if(from.Karma > 0 && m_Alignment == Alignment.Good)
					alignment = Alignment.Good;
				else if (from.Karma < 0 && m_Alignment == Alignment.Evil)
					alignment = Alignment.Evil;
					
				if(alignment != Alignment.Neutral)
				{
                    WispOrb orb = new WispOrb(from, alignment);
					from.Backpack.DropItem(orb);

                    Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(SendMessage_Callback), new object[] { orb, from } );
				}
				else
					LabelTo(from, 1153350); // Thy spirit be not compatible with our goals!
			}
		}
Ejemplo n.º 2
0
 public void TryAddToArmy(WispOrb orb)
 {
     if (orb != null && orb.Owner != null && m_Sequencing && orb.Alignment == m_SequenceAlignment && !m_ToTransport.Contains(orb.Owner))
     {
         m_ToTransport.Add(orb.Owner);
     }
 }
Ejemplo n.º 3
0
        public static void OnEnterRegion(OnEnterRegionEventArgs e)
        {
            WispOrb orb = GetWispOrb(e.From);

            if (orb != null && !Region.Find(e.From.Location, e.From.Map).IsPartOf(typeof(DespiseRegion)))
            {
                Timer.DelayCall(orb.Delete);
            }
        }
Ejemplo n.º 4
0
            public ConscriptEntry(Mobile from, WispOrb orb) : base(1153285, -1) // Conscript
            {
                m_From = from;
                m_Orb  = orb;

                if (m_Orb.Pet == null || m_Orb.Conscripted || m_Orb.Pet.Alignment != m_Orb.Alignment)
                {
                    Flags |= Server.Network.CMEFlags.Disabled;
                }
            }
Ejemplo n.º 5
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            m_Orb      = reader.ReadItem() as WispOrb;
            m_Power    = reader.ReadInt();
            m_MaxPower = reader.ReadInt();
            m_Progress = reader.ReadInt();
        }
Ejemplo n.º 6
0
            public ReleaseEntry(Mobile from, WispOrb orb) : base(1153284, -1) // Release
            {
                m_From = from;
                m_Orb  = orb;

                if (m_Orb.Pet == null /* || !m_Orb.Conscripted*/)
                {
                    Flags |= Server.Network.CMEFlags.Disabled;
                }
            }
Ejemplo n.º 7
0
        private void SendMessage_Callback(object o)
        {
            object[] obj = o as object[];

            WispOrb orb  = obj[0] as WispOrb;
            Mobile  from = obj[1] as Mobile;

            if (orb != null && orb.IsChildOf(from.Backpack))
            {
                orb.LabelTo(from, 1153355); // I will follow thy guidance.
            }
        }
Ejemplo n.º 8
0
        public static void OnEnterRegion(OnEnterRegionEventArgs e)
        {
            WispOrb orb = GetWispOrb(e.From);

            if (orb != null && !Region.Find(e.From.Location, e.From.Map).IsPartOf <DespiseRegion>())
            {
                Timer.DelayCall(() =>
                {
                    e.From.SendLocalizedMessage(1153233);     // The Wisp Orb vanishes to whence it came...
                    orb.Delete();
                });
            }
        }
Ejemplo n.º 9
0
        public void Unlink()
        {
            RangeHome = 10;
            SetControlMaster(null);
            PublicOverheadMessage(MessageType.Regular, 0x59, 1153296); // * This creature is no longer influenced by a Wisp Orb *

            if (m_Orb != null)
            {
                m_Orb.Conscripted = false;
                m_Orb.OnUnlinkPet();
                m_Orb.InvalidateHue();

                m_Orb = null;
            }
        }
Ejemplo n.º 10
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int v = reader.ReadInt();

            m_Orb      = reader.ReadItem() as WispOrb;
            m_Power    = reader.ReadInt();
            m_MaxPower = reader.ReadInt();
            m_Progress = reader.ReadInt();

            if (!NoLootOnDeath)
            {
                NoLootOnDeath = true;
            }
        }
Ejemplo n.º 11
0
        public static void GetArmyPower(ref int good, ref int evil)
        {
            for (var index = 0; index < WispOrb.Orbs.Count; index++)
            {
                WispOrb orb = WispOrb.Orbs[index];

                if (orb.Alignment == Alignment.Good)
                {
                    good += orb.GetArmyPower();
                }
                else if (orb.Alignment == Alignment.Evil)
                {
                    evil += orb.GetArmyPower();
                }
            }
        }
Ejemplo n.º 12
0
        public static void OnEnterRegion(OnEnterRegionEventArgs e)
        {
            WispOrb orb = GetWispOrb(e.From);

            if (orb != null && !Region.Find(e.From.Location, e.From.Map).IsPartOf <DespiseRegion>())
            {
                Timer.DelayCall(() =>
                {
                    if (orb.Pet != null && !orb.Pet.Deleted)
                    {
                        orb.Pet.Delete();
                    }

                    orb.Delete();
                });;
            }
        }
Ejemplo n.º 13
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            if (from.InRange(c.Location, 3) && from.Backpack != null)
            {
                if (WispOrb.Orbs.Any(x => x.Owner == from))
                {
                    LabelTo(from, 1153357); // Thou can guide but one of us.
                    return;
                }

                Alignment alignment = Alignment.Neutral;

                if (from.Karma > 0 && m_Alignment == Alignment.Good)
                {
                    alignment = Alignment.Good;
                }
                else if (from.Karma < 0 && m_Alignment == Alignment.Evil)
                {
                    alignment = Alignment.Evil;
                }

                if (alignment != Alignment.Neutral)
                {
                    WispOrb orb = new WispOrb(from, alignment);
                    from.Backpack.DropItem(orb);
                    from.SendLocalizedMessage(1153355); // I will follow thy guidance.

                    if (from is PlayerMobile && QuestHelper.HasQuest <WhisperingWithWispsQuest>((PlayerMobile)from))
                    {
                        from.SendLocalizedMessage(1158304);             // The Ankh pulses with energy in front of you! You are drawn to it! As you
                                                                        // place your hand on the ankh an inner voice speaks to you as you are joined to your Wisp companion...
                        from.SendLocalizedMessage(1158320, null, 0x23); // You've completed a quest objective!
                        from.PlaySound(0x5B5);

                        Server.Services.TownCryer.TownCryerSystem.CompleteQuest((PlayerMobile)from, 1158303, 1158308, 0x65C);
                    }
                }
                else
                {
                    LabelTo(from, 1153350);                     // Thy spirit be not compatible with our goals!
                }
            }
        }
Ejemplo n.º 14
0
        private void TransportPlayers()
        {
            List <Mobile> list = new List <Mobile>(m_ToTransport);

            foreach (Mobile m in list)
            {
                WispOrb orb = GetWispOrb(m);
                if (orb == null || orb.Deleted || !orb.Conscripted || m.Region == null || !m.Region.IsPartOf <DespiseRegion>())
                {
                    m_ToTransport.Remove(m);
                }
            }

            if (m_ToTransport.Count == 0)
            {
                EndSequenceTimer();
                EndSequence();
            }
            else
            {
                foreach (Mobile m in m_ToTransport)
                {
                    if (m != null && m.Region != null && m.Region.IsPartOf <DespiseRegion>())
                    {
                        WispOrb orb = GetWispOrb(m);

                        if (orb != null && orb.Pet != null && orb.Pet.Alive)
                        {
                            Point3D p = GetRandomLoc(BossEntranceLocation);
                            m.MoveToWorld(p, Map.Trammel);
                            orb.Pet.MoveToWorld(p, Map.Trammel);

                            m.SendLocalizedMessage(1153280, "You!");
                            orb.Anchor            = m;
                            orb.Pet.ControlTarget = m;
                            orb.Pet.ControlOrder  = OrderType.Follow;
                        }
                    }
                }

                m_PlayersInSequence = true;
            }
        }
Ejemplo n.º 15
0
        public override void OnEnter(Mobile m)
        {
            if (m.AccessLevel > AccessLevel.Player)
            {
                return;
            }

            if (!IsInStartRegion(m.Location) && m is BaseCreature && !(m is DespiseCreature) && !(m is CorruptedWisp) && !(m is EnsorcledWisp) && (((BaseCreature)m).Controlled || ((BaseCreature)m).Summoned))
            {
                KickPet(m);
            }

            if (m is PlayerMobile && IsInLowerRegion(m.Location))
            {
                WispOrb orb = DespiseController.GetWispOrb(m);

                if (orb == null)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(1), new TimerStateCallback(Kick_Callback), m);
                }
            }
        }
Ejemplo n.º 16
0
        private void KickFromBossRegion(bool deletepet)
        {
            if (m_LowerRegion == null)
            {
                return;
            }

            List <Mobile> mobiles = m_LowerRegion.GetPlayers();
            Rectangle2D   bounds  = m_SequenceAlignment == Alignment.Evil ? EvilKickBounds : GoodKickBounds;

            foreach (Mobile m in mobiles)
            {
                WispOrb orb = GetWispOrb(m);
                Point3D p   = GetRandomLoc(bounds);

                m.MoveToWorld(p, Map.Trammel);

                if (orb != null && deletepet)
                {
                    if (orb.Pet != null)
                    {
                        orb.Pet.Delete();
                        orb.Pet = null;
                    }

                    orb.Delete();
                    m.SendLocalizedMessage(1153312); // The Wisp Orb dissolves into aether.
                }
                else if (orb != null && orb.Pet != null && orb.Pet.Alive)
                {
                    orb.Pet.MoveToWorld(p, Map.Trammel);
                }

                m.SendLocalizedMessage(1153346); // You are summoned back to your stronghold.
            }

            ColUtility.Free(mobiles);
        }
Ejemplo n.º 17
0
        public void Unlink(bool message = true)
        {
            RangeHome = 10;
            SetControlMaster(null);

            if (Alive && message)
            {
                if (m_Orb != null && m_Orb.Owner != null)
                {
                    m_Orb.Owner.SendLocalizedMessage(1153335, Name);                   // You have released control of ~1_NAME~.
                    NonlocalOverheadMessage(MessageType.Regular, 0x59, 1153296, Name); // * This creature is no longer influenced by a Wisp Orb *
                }
            }

            if (m_Orb != null)
            {
                m_Orb.Conscripted = false;
                m_Orb.OnUnlinkPet();
                m_Orb.InvalidateHue();

                m_Orb = null;
            }
        }
Ejemplo n.º 18
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            if (from.InRange(c.Location, 3) && from.Backpack != null)
            {
                foreach (WispOrb orb in WispOrb.Orbs)
                {
                    if (orb.Owner == from)
                    {
                        LabelTo(from, 1153357);                         // Thou can guide but one of us.
                        return;
                    }
                }

                Alignment alignment = Alignment.Neutral;

                if (from.Karma > 0 && m_Alignment == Alignment.Good)
                {
                    alignment = Alignment.Good;
                }
                else if (from.Karma < 0 && m_Alignment == Alignment.Evil)
                {
                    alignment = Alignment.Evil;
                }

                if (alignment != Alignment.Neutral)
                {
                    WispOrb orb = new WispOrb(from, alignment);
                    from.Backpack.DropItem(orb);

                    Timer.DelayCall(TimeSpan.FromSeconds(0.5), new TimerStateCallback(SendMessage_Callback), new object[] { orb, from });
                }
                else
                {
                    LabelTo(from, 1153350);                     // Thy spirit be not compatible with our goals!
                }
            }
        }
Ejemplo n.º 19
0
        public static void OnLogin(LoginEventArgs e)
        {
            Mobile from = e.Mobile;

            DespiseController controller = m_Instance;

            if (controller != null && controller.LowerRegion != null)
            {
                if (from.Region != null && from.Region.IsPartOf(controller.LowerRegion) && !controller.IsInSequence)
                {
                    WispOrb     orb    = GetWispOrb(from);
                    Rectangle2D bounds = EvilKickBounds;

                    if (orb != null && orb.Alignment == Alignment.Good)
                    {
                        bounds = GoodKickBounds;
                    }

                    while (true)
                    {
                        int x = Utility.RandomMinMax(bounds.X, bounds.X + bounds.Width);
                        int y = Utility.RandomMinMax(bounds.Y, bounds.Y + bounds.Height);
                        int z = Map.Trammel.GetAverageZ(x, y);

                        if (Map.Trammel.CanSpawnMobile(x, y, z))
                        {
                            from.MoveToWorld(new Point3D(x, y, z), Map.Trammel);
                            if (orb != null && orb.Pet != null && orb.Pet.Alive)
                            {
                                orb.Pet.MoveToWorld(new Point3D(x, y, z), Map.Trammel);
                            }
                            break;
                        }
                    }
                }
            }
        }
Ejemplo n.º 20
0
        private void KickFromRegion(Mobile m, bool telepet)
        {
            while (true)
            {
                int     x = Utility.RandomMinMax(m_KickBounds.X, m_KickBounds.X + m_KickBounds.Width);
                int     y = Utility.RandomMinMax(m_KickBounds.Y, m_KickBounds.Y + m_KickBounds.Height);
                int     z = Map.Trammel.GetAverageZ(x, y);
                Point3D p = new Point3D(x, y, z);

                if (this.Map.CanSpawnMobile(p))
                {
                    if (m.Corpse != null)
                    {
                        m.Corpse.MoveToWorld(p, Map.Trammel);
                    }

                    m.MoveToWorld(p, Map.Trammel);

                    if (telepet)
                    {
                        WispOrb.TeleportPet(m);
                    }
                    else
                    {
                        WispOrb orb = DespiseController.GetWispOrb(m);

                        if (orb != null && orb.Pet != null)
                        {
                            orb.Pet.Kill();
                        }
                    }

                    break;
                }
            }
        }
Ejemplo n.º 21
0
        public override void OnComponentUsed(AddonComponent c, Mobile from)
        {
            if (from.InRange(c.Location, 3) && from.Backpack != null)
            {
                foreach (WispOrb orb in WispOrb.Orbs)
                {
                    if (orb.Owner == from)
                    {
                        LabelTo(from, 1153357);                         // Thou can guide but one of us.
                        return;
                    }
                }

                Alignment alignment = Alignment.Neutral;

                if (from.Karma > 0 && m_Alignment == Alignment.Good)
                {
                    alignment = Alignment.Good;
                }
                else if (from.Karma < 0 && m_Alignment == Alignment.Evil)
                {
                    alignment = Alignment.Evil;
                }

                if (alignment != Alignment.Neutral)
                {
                    WispOrb orb = new WispOrb(from, alignment);
                    from.Backpack.DropItem(orb);
                    from.SendLocalizedMessage(1153355); // I will follow thy guidance.
                }
                else
                {
                    LabelTo(from, 1153350);                     // Thy spirit be not compatible with our goals!
                }
            }
        }
Ejemplo n.º 22
0
 public void Link(WispOrb orb)
 {
     m_Orb     = orb;
     RangeHome = 2;
     m_Orb.InvalidateHue();
 }
Ejemplo n.º 23
0
 public void TryAddToArmy(WispOrb orb)
 {
     if (orb != null && orb.Owner != null && m_Sequencing && orb.Alignment == m_SequenceAlignment && !m_ToTransport.Contains(orb.Owner))
         m_ToTransport.Add(orb.Owner);
 }
Ejemplo n.º 24
0
			public ConscriptEntry(Mobile from, WispOrb orb) : base(1153285, -1) // Conscript
			{
				m_From = from;
				m_Orb = orb;

                if (m_Orb.Pet == null || m_Orb.Conscripted || m_Orb.Pet.Alignment != m_Orb.Alignment)
					Flags |= Server.Network.CMEFlags.Disabled;
			}
Ejemplo n.º 25
0
			public ReleaseEntry(Mobile from, WispOrb orb) : base(1153284, -1) // Release
			{
				m_From = from;
				m_Orb = orb;
				
				if(m_Orb.Pet == null/* || !m_Orb.Conscripted*/)
					Flags |= Server.Network.CMEFlags.Disabled;
			}
Ejemplo n.º 26
0
        private void OnTick()
        {
            if (m_NextBossEncounter == DateTime.MinValue || m_NextBossEncounter > DateTime.UtcNow)
            {
                return;
            }

            int       good      = GetArmyPower(Alignment.Good);
            int       evil      = GetArmyPower(Alignment.Evil);
            Alignment strongest = Alignment.Neutral;

            if (good == 0 && evil == 0)
            {
                m_NextBossEncounter = DateTime.UtcNow + EncounterCheckDuration;
            }
            else
            {
                if (good > evil)
                {
                    strongest = Alignment.Good;
                }
                else if (good < evil)
                {
                    strongest = Alignment.Evil;
                }
                else
                {
                    strongest = 0.5 > Utility.RandomDouble() ? Alignment.Good : Alignment.Evil;
                }
            }

            List <Mobile> players = new List <Mobile>();

            players.AddRange(m_GoodRegion.GetPlayers());
            players.AddRange(m_EvilRegion.GetPlayers());
            players.AddRange(m_StartRegion.GetPlayers());

            foreach (Mobile m in players)
            {
                if (!m.Player)
                {
                    continue;
                }

                WispOrb orb = GetWispOrb(m);
                m.PlaySound(0x66C);

                if (orb == null || orb.Alignment != strongest)
                {
                    m.SendLocalizedMessage(strongest != Alignment.Neutral ? 1153334 : 1153333);
                    // The Call to Arms has sounded, but your forces are not yet strong enough to heed it.
                    // Your enemy forces are stronger, and they have been called to battle.
                }
                else if (orb != null && orb.Alignment == strongest)
                {
                    m.SendLocalizedMessage(1153332); // The Call to Arms has sounded. The forces of your alignment are strong, and you have been called to battle!

                    if (orb.Conscripted)
                    {
                        m.SendLocalizedMessage(1153337); // You will be teleported into the depths of the dungeon within 60 seconds to heed the Call to Arms, unless you release your conscripted creature or it dies.
                        m_ToTransport.Add(m);
                    }
                    else
                    {
                        m.SendLocalizedMessage(1153338); // You have under 60 seconds to conscript a creature to answer the Call to Arms, or you will not be summoned for the battle.
                    }
                }
            }

            if (strongest != Alignment.Neutral)
            {
                ColUtility.Free(players);
                m_SequenceAlignment = strongest;

                Timer.DelayCall(TimeSpan.FromSeconds(60), new TimerCallback(BeginSequence));
                m_NextBossEncounter = DateTime.MinValue;
                m_Sequencing        = true;
            }
        }
Ejemplo n.º 27
0
 public InternalTarget(WispOrb orb) : base(8, true, TargetFlags.None)
 {
     m_Orb = orb;
 }
Ejemplo n.º 28
0
			public InternalTarget(WispOrb orb) : base(3, true, TargetFlags.None)
			{
				m_Orb = orb;
			}
Ejemplo n.º 29
0
 public void Link(WispOrb orb)
 {
     m_Orb = orb;
     RangeHome = 2;
     m_Orb.InvalidateHue();
 }
Ejemplo n.º 30
0
        public void Unlink()
        {
            RangeHome = 10;
            SetControlMaster(null);
            PublicOverheadMessage(MessageType.Regular, 0x59, 1153296); // * This creature is no longer influenced by a Wisp Orb *

            if (m_Orb != null)
            {
                m_Orb.Conscripted = false;
                m_Orb.OnUnlinkPet();
                m_Orb.InvalidateHue();

                m_Orb = null;
            }
        }
Ejemplo n.º 31
0
 public override void Deserialize(GenericReader reader)
 {
     base.Deserialize(reader);
     int v = reader.ReadInt();
     m_Orb = reader.ReadItem() as WispOrb;
     m_Power = reader.ReadInt();
     m_MaxPower = reader.ReadInt();
     m_Progress = reader.ReadInt();
 }