Ejemplo n.º 1
0
            protected override void OnTick()
            {
                ++m_Count;

                if (m_Count == 1 && target != null)
                {
                    target.Frozen           = false;
                    target.SolidHueOverride = -1;
                    target.Blessed          = false;
                    m_Medusa.RemoveAffectedMobiles(target);

                    if (target is BaseCreature && !((BaseCreature)target).Summoned && ((BaseCreature)target).GetMaster() != null)
                    {
                        ((BaseCreature)target).GetMaster().SendLocalizedMessage(1113285, null, 43); // Beware! A statue of your pet has been created!
                    }
                    BuffInfo.RemoveBuff(target, BuffIcon.MedusaStone);
                }
                else if (m_Count == 2 && clone != null)
                {
                    clone.SolidHueOverride = -1;
                    clone.Frozen           = clone.Blessed = false;
                    int    dist    = 12;
                    Mobile closest = null;

                    IPooledEnumerable eable = clone.GetMobilesInRange(12);
                    foreach (Mobile m in eable)
                    {
                        int d = (int)clone.GetDistanceToSqrt(m.Location);

                        if (m != null && m is PlayerMobile || (m is BaseCreature && ((BaseCreature)m).GetMaster() is PlayerMobile))
                        {
                            if (m.NetState != null)
                            {
                                m.Send(new RemoveMobile(clone));
                                m.NetState.Send(MobileIncoming.Create(m.NetState, m, clone));
                                m.SendLocalizedMessage(1112767); // Medusa releases one of the petrified creatures!!
                            }

                            if (d < dist)
                            {
                                dist    = d;
                                closest = m;
                            }
                        }
                    }
                    eable.Free();

                    if (closest != null)
                    {
                        clone.Combatant = closest;
                    }
                }
                else
                {
                    Stop();
                }
            }
Ejemplo n.º 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from is PlayerMobile pm && targeted is Mobile targ)
                {
                    if (targ.AccessLevel <= pm.AccessLevel)
                    {
                        List <Mobile> list = pm.VisibilityList;

                        if (list.Contains(targ))
                        {
                            list.Remove(targ);
                            pm.SendMessage("{0} has been removed from your visibility list.", targ.Name);
                        }
                        else
                        {
                            list.Add(targ);
                            pm.SendMessage("{0} has been added to your visibility list.", targ.Name);
                        }

                        if (Utility.InUpdateRange(targ, from))
                        {
                            NetState ns = targ.NetState;

                            if (ns != null)
                            {
                                if (targ.CanSee(pm))
                                {
                                    ns.Send(MobileIncoming.Create(ns, targ, pm));

                                    if (ObjectPropertyList.Enabled)
                                    {
                                        ns.Send(pm.OPLPacket);

                                        foreach (Item item in pm.Items)
                                        {
                                            ns.Send(item.OPLPacket);
                                        }
                                    }
                                }
                                else
                                {
                                    ns.Send(pm.RemovePacket);
                                }
                            }
                        }
                    }
                    else
                    {
                        pm.SendMessage("They can already see you!");
                    }
                }
Ejemplo n.º 3
0
        public static void PushNotoriety(Mobile from, Mobile to, bool aggressor)
        {
            BaseCreature bc_From = from as BaseCreature;
            PlayerMobile pm_From = from as PlayerMobile;

            BaseCreature bc_To = to as BaseCreature;
            PlayerMobile pm_To = to as PlayerMobile;

            PlayerMobile pm_First  = null;
            PlayerMobile pm_Second = null;

            if (from == null || to == null)
            {
                return;
            }

            if (pm_From != null)
            {
                pm_First = pm_From;
            }

            if (bc_From != null)
            {
                if (bc_From.Controlled && bc_From.ControlMaster is PlayerMobile)
                {
                    pm_First = bc_From.ControlMaster as PlayerMobile;
                }
            }

            if (pm_To != null)
            {
                pm_Second = pm_To;
            }

            if (bc_To != null)
            {
                if (bc_To.Controlled && bc_To.ControlMaster is PlayerMobile)
                {
                    pm_Second = bc_To.ControlMaster as PlayerMobile;
                }
            }

            //First Player is Online
            if (pm_First != null)
            {
                if (pm_First.NetState != null)
                {
                    List <Mobile> m_Viewables = new List <Mobile>();

                    if (pm_First.AllFollowers.Count > 0)
                    {
                        foreach (Mobile follower in pm_First.AllFollowers)
                        {
                            if (follower != null)
                            {
                                m_Viewables.Add(follower);
                            }
                        }
                    }

                    if (pm_Second != null)
                    {
                        m_Viewables.Add(pm_Second);

                        if (pm_Second.AllFollowers.Count > 0)
                        {
                            foreach (Mobile follower in pm_Second.AllFollowers)
                            {
                                if (follower != null)
                                {
                                    m_Viewables.Add(follower);
                                }
                            }
                        }
                    }

                    if (bc_To != null)
                    {
                        m_Viewables.Add(bc_To);
                    }

                    //Update Data for All Things Viewable By This Player
                    foreach (Mobile mobile in m_Viewables)
                    {
                        if (mobile != null)
                        {
                            if (pm_First.CanSee(mobile))
                            {
                                pm_First.NetState.Send(MobileIncoming.Create(pm_First.NetState, pm_First, mobile));
                            }
                        }
                    }
                }
            }

            //Second Player is Online:
            if (pm_Second != null && pm_Second != pm_First)
            {
                if (pm_Second.NetState != null)
                {
                    List <Mobile> m_Viewables = new List <Mobile>();

                    if (pm_Second.AllFollowers.Count > 0)
                    {
                        foreach (Mobile follower in pm_Second.AllFollowers)
                        {
                            if (follower != null)
                            {
                                m_Viewables.Add(follower);
                            }
                        }
                    }

                    if (pm_First != null)
                    {
                        m_Viewables.Add(pm_First);

                        if (pm_First.AllFollowers.Count > 0)
                        {
                            foreach (Mobile follower in pm_First.AllFollowers)
                            {
                                if (follower != null)
                                {
                                    m_Viewables.Add(follower);
                                }
                            }
                        }
                    }

                    if (bc_From != null)
                    {
                        m_Viewables.Add(bc_From);
                    }

                    //Update Data for All Things Viewable By This Player
                    foreach (Mobile mobile in m_Viewables)
                    {
                        if (mobile != null)
                        {
                            if (pm_Second.CanSee(mobile))
                            {
                                pm_Second.NetState.Send(MobileIncoming.Create(pm_Second.NetState, pm_Second, mobile));
                            }
                        }
                    }
                }
            }
        }