Ejemplo n.º 1
0
        public override void OnDoubleClick(Mobile from)
        {
            base.OnDoubleClick(from);
            if (!(from is PlayerMobile))
            {
                return;
            }

            PlayerMobile pm = ((PlayerMobile)from);

            if (pm.IOBRealAlignment == IOBAlignment.None)
            {
                return;
            }

            KinCityData cd = KinCityManager.GetCityData(FactionCity);

            if (cd == null)
            {
                return;
            }

            from.SendMessage("Target the silver that you wish to hire the scout party with");
            from.Target = new ScoutingSilverTarget(this);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="city"></param>
        /// <param name="page"></param>
        /// <param name="session"></param>
        private KinCityControlGump(KinFactionCities city, int page, GumpSession session, Mobile from)
            : base(page, session, from)
        {
            //This ctor gets called the first time the gump is opened
            m_Data = KinCityManager.GetCityData(city);
            if (m_Data == null)
            {
                return;
            }

            Session["City"] = city;

            //If in the vote stage, sett page to 5 now
            if (m_Data.IsVotingStage)
            {
                Page = 5;
            }

            SetCurrentPage();
            if (MasterPage != null)
            {
                MasterPage.Create();
                if (CurrentPage != null)
                {
                    this.AddPage(1);
                }
            }
            if (CurrentPage != null)
            {
                CurrentPage.Create();
            }
        }
Ejemplo n.º 3
0
            /// <summary>
            /// Gets the benificary data of the Owner
            /// </summary>
            /// <returns></returns>
            private KinCityData.BeneficiaryData GetBenData()
            {
                KinCityData cityData = KinCityManager.GetCityData(GuardPost.City);

                if (cityData == null)
                {
                    return(null);
                }
                KinCityData.BeneficiaryData benData = cityData.BeneficiaryDataList.Find(delegate(KinCityData.BeneficiaryData bd) { return(bd.Pm == GuardPost.Owner); });
                return(benData);
            }
Ejemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GumpState"/> class.
 /// </summary>
 /// <param name="data">The data.</param>
 public GumpState(KinCityData data)
 {
     SlotsRemaining = new Dictionary <PlayerMobile, int>();
     foreach (KinCityData.BeneficiaryData bd in data.BeneficiaryDataList)
     {
         SlotsRemaining.Add(bd.Pm, bd.UnassignedGuardSlots);
         SlotsRemainingChanged.Add(bd.Pm, bd.UnassignedGuardSlots);
         SlotsAssigned.Add(bd.Pm, CountAssignedSlots(bd));
     }
     RemainingSlots = data.UnassignedGuardPostSlots;
 }
Ejemplo n.º 5
0
				/// <summary>
				/// Initializes a new instance of the <see cref="GumpState"/> class.
				/// </summary>
				/// <param name="data">The data.</param>
				public GumpState(KinCityData data)
				{
					SlotsRemaining = new Dictionary<PlayerMobile, int>();
					foreach (KinCityData.BeneficiaryData bd in data.BeneficiaryDataList)
					{
						SlotsRemaining.Add(bd.Pm, bd.UnassignedGuardSlots);
						SlotsRemainingChanged.Add(bd.Pm, bd.UnassignedGuardSlots);
						SlotsAssigned.Add(bd.Pm, CountAssignedSlots(bd)); 
					}
					RemainingSlots = data.UnassignedGuardPostSlots;
				}
Ejemplo n.º 6
0
            private int GetDaysUntilSpawn()
            {
                KinCityData cd = KinCityManager.GetCityData(m_KinSigil.FactionCity);

                if (cd == null)
                {
                    return(0);
                }
                TimeSpan ts = (DateTime.Now - m_KinSigil.NextEventTime);

                return(Math.Abs(ts.Days));
            }
Ejemplo n.º 7
0
        /// <summary>
        /// Called when [chop].
        /// </summary>
        /// <param name="from">From.</param>
        void IChopable.OnChop(Mobile from)
        {
            KinCityData data = KinCityManager.GetCityData(m_City);

            if (data == null)
            {
                Delete();
            }
            if (from == m_Owner || (data.CityLeader != null && from == data.CityLeader) || from.AccessLevel > AccessLevel.Counselor)
            {
                Delete();
            }
        }
Ejemplo n.º 8
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.
            }
        }
Ejemplo n.º 9
0
        public KinCityStatusGump()
            : base(25, 25)
        {
            this.Closable   = true;
            this.Disposable = true;
            this.Dragable   = true;
            this.Resizable  = false;
            this.AddPage(0);
            this.AddImage(1, 6, 1228);
            this.AddButton(25, 268, 247, 249, (int)Buttons.Ok, GumpButtonType.Reply, 0);

            StringBuilder html = new StringBuilder("<basefont color=gray><p><center>City Status</center></p><p>");

            foreach (KinFactionCities e in Enum.GetValues(typeof(KinFactionCities)))
            {
                KinCityData cd = KinCityManager.GetCityData(e);
                if (cd == null)
                {
                    continue;
                }

                html.Append(string.Format("<P><STRONG>{0}</STRONG> : ", e.ToString()));

                if (cd.ControlingKin == IOBAlignment.None)
                {
                    html.Append("Golem Controller King</P>");
                }
                else
                {
                    html.Append(string.Format("{0}</P>", IOBSystem.GetIOBName(cd.ControlingKin)));
                    if (cd.GuardOption == KinCityData.GuardOptions.LordBritish)
                    {
                        html.Append("<p>Lord British is guarding this city.</p>");
                    }
                    foreach (KinCityData.BeneficiaryData vd in cd.BeneficiaryDataList)
                    {
                        html.Append(string.Format("<P> * {0}</P>", vd.Pm.Name));
                    }
                }
            }
            html.Append("</P></P></basefont>");
            this.AddHtml(26, 40, 348, 214, html.ToString(), (bool)false, (bool)true);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Called when [delete].
        /// </summary>
        public override void OnDelete()
        {
            //Give guard post slots back
            KinCityData data = KinCityManager.GetCityData(m_City);

            if (data == null)
            {
                base.OnDelete();
                return;
            }
            KinCityData.BeneficiaryData bd = data.GetBeneficiary(m_Owner);
            if (bd == null)
            {
                base.OnDelete();
                return;
            }
            bd.UnRegisterGuardPost(this);
            base.OnDelete();
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Called when [double click].
        /// </summary>
        /// <param name="from">From.</param>
        public override void OnDoubleClick(Mobile from)
        {
            if (from.AccessLevel > AccessLevel.Counselor)
            {
                base.OnDoubleClick(from);
            }

            KinCityData data = KinCityManager.GetCityData(m_City);

            if (data == null)
            {
                Delete();
            }

            //Only faction leader and the player assigned to this post should be able to see the gump
            if (from == Owner || (data.CityLeader != null && from == data.CityLeader) || from.AccessLevel > AccessLevel.Counselor)
            {
                from.CloseGump(typeof(KinGuardPostGump));
                from.SendGump(new KinGuardPostGump(this, from));
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Restore data from the session
 /// </summary>
 void ICommitGumpEntity.LoadStateInfo()
 {
     m_State = (m_Gump.Session[((ICommitGumpEntity)this).ID] as DirtyState);
     if (m_State == null)
     {
         m_State = new DirtyState();
         m_Gump.Session[((ICommitGumpEntity)this).ID] = m_State;
         m_State.SetValue("Type", GuardPost.GuardType);
         KinCityData data = KinCityManager.GetCityData(GuardPost.City);
         if (data == null)
         {
             return;
         }
         KinCityData.BeneficiaryData bdata = data.BeneficiaryDataList.Find(delegate(KinCityData.BeneficiaryData b) { return(b.Pm == GuardPost.Owner); });
         if (bdata == null && m_Gump.From.AccessLevel <= AccessLevel.Player)
         {
             return;
         }
         m_State.SetValue("Slots", GetSlotsAvailable());
         m_State.SetValue("Target", GuardPost.FightMode);
         m_State.SetValue("Speed", GuardPost.HireSpeed);
     }
 }
Ejemplo n.º 13
0
 public DailyCitySummary(KinCityData data)
 {
     if (data == null)
     {
         return;
     }
     LogTime = DateTime.Now;
     Kin     = data.ControlingKin.ToString();
     City    = data.City.ToString();
     if (data.CityLeader != null)
     {
         Leader = new Player(data.CityLeader as PlayerMobile);
     }
     data.BeneficiaryDataList.ForEach(delegate(KinCityData.BeneficiaryData bd)
     {
         if (bd.Pm != null)
         {
             Beneficiaries.Add(new Player(bd.Pm));
         }
     });
     Treasury       = data.Treasury;
     TaxRate        = data.TaxRate;
     NPCFlags       = data.NPCCurrentFlags;
     GuardOption    = (int)data.GuardOption;
     GuardPostSlots = string.Format("{0} | {1}", KinSystem.GetCityGuardPostSlots(data.City), data.UnassignedGuardPostSlots);
     foreach (KinCityData.BeneficiaryData bd in data.BeneficiaryDataList)
     {
         foreach (Items.KinGuardPost gp in bd.GuardPosts)
         {
             if (gp != null && !gp.Deleted)
             {
                 GuardPostData.Add(new GuardPost(gp));
             }
         }
     }
 }
Ejemplo n.º 14
0
		/// <summary>
		/// Changes the guards.
		/// </summary>
		/// <param name="city">The city.</param>
		/// <param name="guardOption">The guard option.</param>
		public static void ChangeGuards(KinFactionCities city, KinCityData.GuardOptions guardOption, bool overrideTimeout)
		{
			KinCityData cityData = GetCityData(city);
			if (cityData == null) return;
			if (cityData.GuardOption == guardOption) return;

			if (!overrideTimeout)
			{
				if (DateTime.Now <= cityData.LastGuardChangeTime + TimeSpan.FromHours(KinSystemSettings.GuardChangeTimeHours))
					return;
			}
			cityData.LastGuardChangeTime = DateTime.Now;

			if (guardOption == KinCityData.GuardOptions.LordBritish)
			{
				LBGuardTimer timer = new LBGuardTimer(city);
				timer.Start();
			}
			else
			{
				cityData.GuardOption = guardOption;
				//Switch off patrol npc guard type
				cityData.SetNPCFlag(KinCityData.NPCFlags.Patrol, false);
				if (guardOption == KinCityData.GuardOptions.None)
				{
					cityData.ClearAllGuardPosts();
				}

				//Update existing guards with the new rules
				foreach (KinCityData.BeneficiaryData bd in cityData.BeneficiaryDataList)
					foreach (KinGuardPost kgp in bd.GuardPosts)
						if (kgp != null && !kgp.Deleted)
							kgp.UpdateExisitngGuards();

				//Raise event for the regions to sort themselves out with the new changes
				if (KinCityManager.OnChangeGuards != null)
				{
					KinCityManager.OnChangeGuards(city, guardOption);
				}
			}
		}
Ejemplo n.º 15
0
        protected override void OnTarget(Mobile from, object targeted)
        {
            if( targeted == null || !(targeted  is Item) )
                return;

            if (_guardPost == null)
            {
                //Guard post stage
                if (!(targeted is KinGuardPost))
                {
                    from.SendMessage("You may only fund guard posts");
                    return;
                }

                //Grab guardpost
                KinGuardPost gp = targeted as KinGuardPost;
                if (gp == null) return;

                //Verify owner
                KinCityData data = KinCityManager.GetCityData(gp.City);
                if( data == null )
                {
                    from.SendMessage("That guard post does not appear to be a valid part of a faction city");
                    return;
                }

                //Owner or city leader can fund
                if (gp.Owner != from && gp.Owner != data.CityLeader )
                {
                    from.SendMessage("That guard post does not belong to you");
                    return;
                }

                from.SendMessage("Select the silver you wish to fund it with");

                //Issue new target
                from.Target = new KinGuardPostFundTarget(gp);
            }
            else
            {
                Silver silver = targeted as Silver;
              //Silver stage
                if (silver == null)
                {
                    from.SendMessage("You may only fund the guard post with silver");
                    return;
                }
                if (!from.Backpack.Items.Contains(targeted))
                {
                    from.SendMessage("The silver must be in your backpack");
                }
                if (from.GetDistanceToSqrt(_guardPost.Location) > 3)
                {
                    from.SendMessage("You are not close enough to the guard post");
                    return;
                }

                //Verify owner
                KinCityData data = KinCityManager.GetCityData(_guardPost.City);
                if (data == null)
                {
                    from.SendMessage("That guard post does not appear to be a valid part of a faction city");
                    return;
                }

                //check again that the guard post exists and they are the owner
                if (_guardPost.Deleted || (_guardPost.Owner != from && _guardPost.Owner != data.CityLeader))
                {
                    from.SendMessage("The guard post no longer or exists or you are no longer the rightful owner");
                    return;
                }

                int amount = silver.Amount;

                if (amount <= 0)
                {
                    //should be impossible
                    from.SendMessage("Your guard post was not successfully funded");
                    return;
                }

                //Fund guardpost
                silver.Delete();
                _guardPost.Silver += amount;
                //if( !_guardPost.Running ) _guardPost.Running = true;
                from.SendMessage("Your guard post was successfully funded with {0} silver",amount);
            }
        }
Ejemplo n.º 16
0
		public static void OnLoad()
		{
			try
			{
				Console.WriteLine("KinCityManager Loading...");
				string filePath = Path.Combine("Saves/AngelIsland", "KinCityManager.bin");

				if (!File.Exists(filePath))
				{
					Console.Write("Kin faction city data file not found.  Generating default city data...");
					foreach (int city in Enum.GetValues(typeof(KinFactionCities)))
						_cityData.Add((KinFactionCities)city, new KinCityData((KinFactionCities)city));
					Console.WriteLine("done.");
					return;
				}

				BinaryFileReader datreader = new BinaryFileReader(new BinaryReader(new FileStream(filePath, FileMode.Open, FileAccess.Read)));
				int version = datreader.ReadInt();

				switch (version)
				{
					case 1:
						{
							int cityCount = datreader.ReadInt();
							if (cityCount > 0)
							{
								for (int i = 0; i < cityCount; ++i)
								{
									try
									{
										KinCityData data = new KinCityData(datreader);
										_cityData.Add(data.City, data);
									}
									catch
									{
									}
								}
							}
							break;
						}
				}

				//if any were corrupted and failed to load, create a new set of data.
				foreach (int city in Enum.GetValues(typeof(KinFactionCities)))
					if (!_cityData.ContainsKey((KinFactionCities)city))
					{
						Console.WriteLine("Warning: KinCityData for {0} did not load successfully, and a new blank set of data has been created.", ((KinFactionCities)city).ToString());
						_cityData.Add((KinFactionCities)city, new KinCityData((KinFactionCities)city));
					}

				datreader.Close();
			}
			catch (Exception ex)
			{
				System.Console.WriteLine("Error loading KinCityManager!");
				Scripts.Commands.LogHelper.LogException(ex);
			}
		}
Ejemplo n.º 17
0
		/// <summary>
		/// Changes the guards.
		/// </summary>
		/// <param name="city">The city.</param>
		/// <param name="guardOption">The guard option.</param>
		public static void ChangeGuards(KinFactionCities city, KinCityData.GuardOptions guardOption)
		{
			ChangeGuards(city, guardOption, false);
		}
Ejemplo n.º 18
0
				/// <summary>
				/// Returns the total amount of assigned slots the benficary has
				/// </summary>
				/// <param name="data"></param>
				/// <returns></returns>
				public int CountAssignedSlots(KinCityData.BeneficiaryData data)
				{
					int slots = 0;
					//Add the present slot cost of each guard posts
					if (data.GuardPosts != null && data.GuardPosts.Count > 0)
						foreach (KinGuardPost kgp in data.GuardPosts)
							slots += (int)kgp.CostType;
					return slots;
				}
Ejemplo n.º 19
0
		/// <summary>
		/// Handles the guard change, will switch on/off the guards depending if the new guard option is Lord British
		/// </summary>
		/// <param name="city">The city.</param>
		/// <param name="guardOption">The guard option.</param>
		public void KinCityManager_OnChangeGuards(KinCityData.GuardOptions guardOption)
		{
			if (guardOption == KinCityData.GuardOptions.LordBritish)
			{
				if (IsGuarded == false)
					IsGuarded = true;
			}
			else
			{
				if (IsGuarded == true)
					IsGuarded = false;
			}
		}
Ejemplo n.º 20
0
			private bool GetNPCButtonState(KinCityData.NPCFlags npc)
			{
				return (((m_State.NPCData & (long)npc) != 0));
			}
Ejemplo n.º 21
0
        /// <summary>
        /// Setup mob with owner's IOB alignment, the guard post's and the City's fight settings
        /// </summary>
        /// <param name="bc"></param>
        private void PreapareCreature(BaseCreature bc)
        {
            if (bc == null)
            {
                return;
            }

            //Set the IOBAlignment to that of the owner
            bc.IOBAlignment = Owner.IOBRealAlignment;
            if (!bc.Owners.Contains(Owner))
            {
                bc.Owners.Add(Owner);
            }

            //Set the fight mode and fight style to that the owner chose
            //NAND wipe the strongest, weakest and closest flags
            // 0x7
            bc.FightMode &= ~FightMode.Strongest;
            bc.FightMode &= ~FightMode.Weakest;
            bc.FightMode &= ~FightMode.Closest;

            //OR in the one we care about
            bc.FightMode |= m_FightMode;

            ////////////////////////////////////////////////
            //PLASMA: Fightsyle not being used currently
            ////////////////////////////////////////////////
            //NAND out mage and melee
            //0x3
            //bc.FightStyle &= ~FightStyle.Magic;
            //bc.FightStyle &= ~FightStyle.Melee;

            //OR in the one we care about
            //bc.FightStyle |= m_FightStyle;
            ////////////////////////////////////////////////


            //NAND out the attack settings
            //1F
            bc.FightMode &= ~FightMode.All; bc.FightMode &= ~FightMode.Aggressor;
            bc.FightMode &= ~FightMode.Criminal; bc.FightMode &= ~FightMode.Murderer;
            bc.FightMode &= ~FightMode.Evil;


            //OR in the ones we care about
            KinCityData data = KinCityManager.GetCityData(City);

            if (data != null)
            {
                switch (data.GuardOption)
                {
                case KinCityData.GuardOptions.None:
                case KinCityData.GuardOptions.LordBritish:
                    //These two cases shouldn't be possible
                    break;

                case KinCityData.GuardOptions.FactionOnly:
                {
                    bc.FightMode |= FightMode.Aggressor;
                    break;
                }

                case KinCityData.GuardOptions.FactionAndReds:
                {
                    bc.FightMode |= FightMode.Aggressor;
                    bc.FightMode |= FightMode.Murderer;
                    break;
                }

                case KinCityData.GuardOptions.FactionAndRedsAndCrim:
                {
                    bc.FightMode |= FightMode.Aggressor;
                    bc.FightMode |= FightMode.Murderer;
                    bc.FightMode |= FightMode.Criminal;
                    break;
                }

                case KinCityData.GuardOptions.Everyone:
                {
                    bc.FightMode |= FightMode.Aggressor;
                    bc.FightMode |= FightMode.All;
                    break;
                }

                case KinCityData.GuardOptions.RedsAndCrim:
                {
                    bc.FightMode |= FightMode.Aggressor;
                    bc.FightMode |= FightMode.Murderer;
                    bc.FightMode |= FightMode.Criminal;
                    break;
                }

                case KinCityData.GuardOptions.Crim:
                {
                    bc.FightMode |= FightMode.Aggressor;
                    bc.FightMode |= FightMode.Criminal;
                    break;
                }

                default:
                    break;
                }
            }
            //bc.FightMode |= m_FightStyle;
            bc.AIObject.Think();
        }
Ejemplo n.º 22
0
			private int GetGuardButtonState(KinCityData.GuardOptions guard, bool on)
			{
				if (m_State.GuardOption == guard)
					return 1153;
				else
					return 1150;
			}
Ejemplo n.º 23
0
			private int GetNPCButtonState(KinCityData.NPCFlags npc, bool on)
			{
				if (!((m_State.NPCData & (long)npc) != 0) == on)
					return 1150;
				else
					return 1153;
			}
Ejemplo n.º 24
0
			private void ToggleNPCUndoData(KinCityData.NPCFlags flag)
			{
				//XOR flip!
				m_State.NPCData ^= (int)flag;
			}
Ejemplo n.º 25
0
            /// <summary>
            /// Commit any outstanding changes
            /// </summary>
            /// <param name="sender"></param>
            void ICommitGumpEntity.CommitChanges()
            {
                if (!((ICommitGumpEntity)this).Validate())
                {
                    m_Gump.From.SendMessage("The guard post has been changed since you were modifying it. Please make the changes again.");
                    return;
                }
                if (m_State.IsValueDirty <KinFactionGuardTypes>("Type"))
                {
                    //set guard type

                    //TODO: - check some delay?
                    GuardPost.GuardType = (KinFactionGuardTypes)m_State.GetValue <KinFactionGuardTypes>("Type");
                    m_Gump.From.SendMessage("Guard type changed to {0}.", KinSystem.GetEnumTypeDescription <KinFactionGuardTypes>((KinFactionGuardTypes)m_State.GetValue <KinFactionGuardTypes>("Type")));
                }
                if (m_State.IsValueDirty <KinGuardPost.HireSpeeds>("Speed"))
                {
                    GuardPost.HireSpeed = (KinGuardPost.HireSpeeds)m_State.GetValue <KinGuardPost.HireSpeeds>("Speed");
                    m_Gump.From.SendMessage("Hire rate successfully changed to {0}", KinSystem.GetEnumTypeDescription <KinGuardPost.HireSpeeds>((KinGuardPost.HireSpeeds)m_State.GetValue <KinGuardPost.HireSpeeds>("Speed")));
                    GuardPost.RefreshNextSpawnTime();
                }
                if (m_State.IsValueDirty <int>("Slots"))
                {
                    KinFactionGuardTypes currentType = (KinFactionGuardTypes)m_State.GetOriginalValue <KinFactionGuardTypes>("Type");
                    KinFactionGuardTypes type        = (KinFactionGuardTypes)m_State.GetValue <KinFactionGuardTypes>("Type");
                    int cost        = KinSystem.GetGuardCostType(type);
                    int currentCost = KinSystem.GetGuardCostType(currentType);
                    int slots       = 0;
                    slots += (currentCost - cost);
                    KinCityData data = KinCityManager.GetCityData(GuardPost.City);
                    if (data == null)
                    {
                        return;
                    }
                    KinCityData.BeneficiaryData bd = data.GetBeneficiary(GuardPost.Owner);
                    if (bd == null)
                    {
                        return;
                    }
                    bd.ModifyGuardSlots(slots);
                    m_Gump.From.SendMessage("Unassigned guard slots modified by {0}.", slots);
                }

                /*
                 * if (m_State.StyleChanged)
                 * {
                 *      //Assign new style
                 *      GuardPost.FightStyle = m_State.Style;
                 * }
                 */
                if (m_State.IsValueDirty <FightMode>("Target"))
                {
                    //Dont overwrite this one
                    // 0 the strongest, weakest, closest
                    //NAND out the options so these bits are all 0
                    GuardPost.FightMode &= ~FightMode.Strongest;
                    GuardPost.FightMode &= ~FightMode.Weakest;
                    GuardPost.FightMode &= ~FightMode.Closest;
                    //write new version
                    GuardPost.FightMode |= (FightMode)m_State.GetValue <FightMode>("Target");
                    m_Gump.From.SendMessage("Guard target priority successfully changed.");
                    GuardPost.UpdateExisitngGuards();
                }
            }
Ejemplo n.º 26
0
			private void ChangeGuardUndoData(KinCityData.GuardOptions option)
			{
				m_State.GuardOption = option;
			}
Ejemplo n.º 27
0
		/// <summary>
		/// Handles the guard change, will switch on/off the guards depending if the new guard option is Lord British
		/// </summary>
		/// <param name="city">The city.</param>
		/// <param name="guardOption">The guard option.</param>
		private void KinCityManager_OnChangeGuards(KinFactionCities city, KinCityData.GuardOptions guardOption)
		{
			if (IsControllerGood() && KinFactionCity == city)
			{
				((KinCityRegionStone)m_Controller).KinCityManager_OnChangeGuards(guardOption);
			}
		}
Ejemplo n.º 28
0
				public GumpState(long npcData, KinCityData.GuardOptions guardOption)
				{
					NPCData = OriginalNPCData = npcData;
					GuardOption = OriginalGuardOption = guardOption;
				}
Ejemplo n.º 29
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);
        }
Ejemplo n.º 30
0
		public DailyCitySummary(KinCityData data)
		{
			if (data == null) return;
			LogTime = DateTime.Now;
			Kin = data.ControlingKin.ToString();
			City = data.City.ToString();
			if( data.CityLeader != null ) Leader = new Player(data.CityLeader as PlayerMobile);
			data.BeneficiaryDataList.ForEach(delegate(KinCityData.BeneficiaryData bd)
			{
				if( bd.Pm != null ) Beneficiaries.Add(new Player(bd.Pm));
			});
			Treasury = data.Treasury;
			TaxRate = data.TaxRate;
			NPCFlags = data.NPCCurrentFlags;
			GuardOption = (int)data.GuardOption;
			GuardPostSlots = string.Format("{0} | {1}", KinSystem.GetCityGuardPostSlots(data.City), data.UnassignedGuardPostSlots);
			foreach( KinCityData.BeneficiaryData bd in data.BeneficiaryDataList )
				foreach( Items.KinGuardPost gp in bd.GuardPosts )
					if( gp != null && !gp.Deleted )
						GuardPostData.Add(  new GuardPost(gp));
		}