Example #1
0
        /// <summary>
        /// Called when [double click].
        /// </summary>
        /// <param name="from">From.</param>
        public override void OnDoubleClick(Mobile from)
        {
            if (!(from is PlayerMobile))
            {
                return;
            }
            if (CheckRange(from))
            {
                KinCityRegion region = KinCityRegion.GetKinCityAt(this);
                if (region == null)
                {
                    from.SendMessage("This board is not placed within a Kin City");
                    return;
                }

                if (from.AccessLevel <= AccessLevel.Player)
                {
                    KinCityData data = KinCityManager.GetCityData(region.KinFactionCity);
                    if (data == null)
                    {
                        return;
                    }

                    if (data.ControlingKin == IOBAlignment.None)
                    {
                        from.SendMessage("This city is controlled by the Golem Controller Lord!");
                        return;
                    }

                    if (((PlayerMobile)from).IOBRealAlignment != data.ControlingKin)
                    {
                        from.SendMessage("You are not aligned with {0}", data.ControlingKin.ToString());
                        return;
                    }
                }

                from.CloseGump(typeof(KinCityControlGump));
                from.SendGump(new KinCityControlGump(region.KinFactionCity, from));
            }
            else
            {
                from.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1019045);                 // I can't reach that.
            }
        }
Example #2
0
        public override void OnEnter(Mobile m)
        {
            Region       left = null;
            PlayerMobile pm   = null;

            if (m is PlayerMobile)
            {
                pm   = (PlayerMobile)m;
                left = pm.LastRegionIn;
            }
            // wea: If this is an isolated region, we're going to send sparklies where
            // mobiles will disappear (this happens as part of an IsIsolatedFrom() check,
            // not explicit packet removal here) + a sound effect if we had to do this
            //
            // also send an incoming packet to all players within the region.
            // ____
            // ||
            if (m_Controller.IsIsolated)
            {
                if (m.Map != null)
                {
                    int invissedmobiles = 0;

                    IPooledEnumerable eable = m.GetMobilesInRange(Core.GlobalMaxUpdateRange);

                    foreach (Mobile mir in eable)
                    {
                        // Regardless of whether this is mobile or playermobile,
                        // we need to send an incoming packet to each of the mobiles
                        // in the region

                        if (mir.Region == m.Region)
                        {
                            if (mir is PlayerMobile)
                            {
                                // We've just walked into this mobile's region, so send incoming packet
                                // if they're a playermobile

                                if (Utility.InUpdateRange(m.Location, mir.Location) && mir.CanSee(m))
                                {
                                    // Send incoming packet to player if they're online
                                    if (mir.NetState != null)
                                    {
                                        mir.NetState.Send(new MobileIncoming(mir, m));
                                    }
                                }
                            }
                        }
                        else
                        {
                            // They're in a different region, so localise sparklies
                            // to us if we're a player mobile
                            if (pm != null && mir.AccessLevel <= pm.AccessLevel)
                            {
                                Packet particles = new LocationParticleEffect(EffectItem.Create(mir.Location, mir.Map, EffectItem.DefaultDuration), 0x376A, 10, 10, 0, 0, 2023, 0);

                                if (pm.NetState != null && particles != null)
                                {
                                    pm.Send(particles);
                                    invissedmobiles++;
                                }
                            }
                        }
                    }

                    if (invissedmobiles > 0)
                    {
                        // Play a sound effect to go with it
                        if (pm.NetState != null)
                        {
                            pm.PlaySound(0x3C4);
                        }
                    }

                    if (pm != null)
                    {
                        m.ClearScreen();
                        m.SendEverything();
                    }
                    eable.Free();
                }
            }
            // ||
            // ____

            // if were leaving a house and entering the region(already in it) dont play the enter msg
            if (pm != null && pm.LastRegionIn is HouseRegion)
            {
                return;
            }

            if (m_Controller.ShowEnterMessage)
            {
                m.SendMessage("You have entered {0}", this.Name);

                if (m_Controller.NoMurderZone)
                {
                    m.SendMessage("This is a lawless area; you are freely attackable here.");
                }
            }

            if (m_Controller.OverrideMaxFollowers)
            {
                m.FollowersMax = m_Controller.MaxFollowerSlots;
            }

            if (m_Controller.PlayMusic)
            {
                PlayMusic(m);
            }

            PlayerMobile IOBenemy = null;

            if (m is PlayerMobile)
            {
                IOBenemy = (PlayerMobile)m;
            }

            //if is a iob zone/region and a iob aligned mobile with a differnt alignment then the zone enters
            //find all players of the zones alignment and send them a message
            //plasma: refactored the send message code into its own method within KinSystem
            if (DateTime.Now >= m_Controller.m_Msg && m_Controller.IOBZone && m_Controller.ShowIOBMsg && IOBenemy != null && IOBenemy.IOBAlignment != IOBAlignment.None && IOBenemy.IOBAlignment != m_Controller.IOBAlign && m.AccessLevel == AccessLevel.Player)              //we dont want it announceing staff with iob kinship
            {
                if (m_Controller.RegionName != null && m_Controller.RegionName.Length > 0)
                {
                    KinSystem.SendKinMessage(m_Controller.IOBAlign, string.Format("Come quickly, the {0} are attacking {1}!",
                                                                                  IOBSystem.GetIOBName(IOBenemy.IOBRealAlignment),
                                                                                  m_Controller.RegionName));
                }
                else
                {
                    KinSystem.SendKinMessage(m_Controller.IOBAlign, string.Format("Come quickly, the {0} are attacking your stronghold!",
                                                                                  IOBSystem.GetIOBName(IOBenemy.IOBRealAlignment)));
                }
                m_Controller.m_Msg = DateTime.Now + m_Controller.m_Delay;
            }
            else if (DateTime.Now >= m_Controller.m_Msg && this is Engines.IOBSystem.KinCityRegion && IOBenemy != null && IOBenemy.IOBAlignment != IOBAlignment.None && IOBenemy.IOBAlignment != m_Controller.IOBAlign && m.AccessLevel == AccessLevel.Player)              //we dont want it announceing staff with iob kinship
            {
                KinCityRegion r = KinCityRegion.GetKinCityAt(this.m_Controller);
                if (r != null)
                {
                    KinCityData cd = KinCityManager.GetCityData(r.KCStone.City);
                    if (cd != null && cd.ControlingKin != IOBAlignment.None)
                    {
                        Engines.IOBSystem.KinSystem.SendKinMessage(cd.ControlingKin, string.Format("Come quickly, the {0} are attacking the City of {1}!",
                                                                                                   IOBSystem.GetIOBName(IOBenemy.IOBRealAlignment), cd.City.ToString()));
                        m_Controller.m_Msg = DateTime.Now + m_Controller.m_Delay;
                    }
                }
            }

            base.OnEnter(m);
        }