Beispiel #1
0
        public override void OnResponse(NetState sender, RelayInfo info)
        {
            try
            {
                int button = info.ButtonID;

                int page = 0;

                if (button == 998)
                {
                    page = m_Page - 1;
                    if (page < 0)
                    {
                        page = 0;
                    }
                    m_Mobile.SendGump(new TownshipStaffGump(m_Mobile, Sort.DEFAULT, page, m_List));
                }
                else if (button == 999)
                {
                    page = m_Page + 1;
                    m_Mobile.SendGump(new TownshipStaffGump(m_Mobile, Sort.DEFAULT, page, m_List));
                }
                else if (button == 997)
                {
                    m_Mobile.SendGump(new TownshipStaffGump(m_Mobile, Sort.DEFAULT, page, m_List));
                }
                else if (button >= 1000)
                {
                    if (button >= 5000)
                    {
                        int  index = button - 5000;
                        bool moved = false;
                        if (index >= 0 && index < m_List.Count)
                        {
                            TownshipStone ts = m_List[index];
                            if (ts != null)
                            {
                                moved = true;
                                //m_Mobile.MoveToWorld(ts.TownshipCenter, ts.Map);
                                m_Mobile.MoveToWorld(ts.Location, ts.Map);
                            }
                        }
                        if (!moved)
                        {
                            m_Mobile.SendMessage("Error sending you to township stone");
                        }
                        m_Mobile.SendGump(new TownshipStaffGump(m_Mobile, Sort.DEFAULT, page, m_List));
                    }
                    else
                    {
                        m_Mobile.SendGump(new TownshipStaffGump(m_Mobile, Sort.DEFAULT, page, m_List, true, button - 1000));
                    }
                }
            }
            catch (Exception e)
            {
                Scripts.Commands.LogHelper.LogException(e);
            }
        }
Beispiel #2
0
        private void ShowList(int page)
        {
            try
            {
                int perpage = 13;
                int y       = 40;

                AddHtml(50, y, 300, 25, "Guild", false, false);
                AddHtml(100, y, 300, 25, "Size", false, false);
                AddHtml(160, y, 300, 25, "Growth", false, false);
                AddHtml(220, y, 300, 25, "LW#", false, false);
                AddHtml(250, y, 300, 25, "ALCalc", false, false);
                AddHtml(330, y, 300, 25, "Center", false, false);
                y += 30;
                AddHtml(180, y, 300, 25, "<HR>", false, false);
                y += 20;

                int start = page * perpage;
                int end   = start + perpage;
                for (int i = start; i < end && i < m_List.Count; i++)
                {
                    try
                    {
                        TownshipStone ts = m_List[i];

                        AddButton(20, y, 4005, 4007, i + 1000, GumpButtonType.Reply, 0);
                        AddHtml(60, y, 300, 25, ts.Guild.Abbreviation, false, false);
                        AddHtml(100, y, 300, 25, ts.Extended?"(X):":"" + TownshipStone.GetTownshipSizeDesc(ts.ActivityLevel), false, false);
                        AddHtml(160, y, 300, 25, TownshipStone.GetTownshipActivityDesc(ts.LastActivityLevel), false, false);
                        AddHtml(220, y, 300, 25, ts.LastActualWeekNumber.ToString(), false, false);
                        AddHtml(250, y, 200, 25, ts.ALLastCalculated.ToString("MM/dd"), false, false);
                        AddHtml(300, y, 200, 25, ts.TownshipCenter.ToString(), false, false);

                        AddButton(470, y, 4005, 4007, i + 5000, GumpButtonType.Reply, 0);
                        AddHtml(510, y, 20, 25, "Go", false, false);

                        y += 25;
                    }
                    catch (Exception ex)
                    {
                        Scripts.Commands.LogHelper.LogException(ex, "inner");
                    }
                }
            }
            catch (Exception e)
            {
                Scripts.Commands.LogHelper.LogException(e);
            }
        }
Beispiel #3
0
        public void NotifyOfDamager(Mobile damager)
        {
            if (damager == null)
            {
                return;                              //safety
            }
            Point3D      targetPoint = this.Location;
            CustomRegion cr          = CustomRegion.FindDRDTRegion(damager.Map, targetPoint);

            if (cr is TownshipRegion)
            {
                TownshipRegion tsr = cr as TownshipRegion;
                if (tsr != null &&
                    tsr.TStone != null &&
                    tsr.TStone.Guild != null &&
                    tsr.TStone.Guild != damager.Guild)
                {
                    // every 10 minutes we will get a message unless the damager changes.
                    //	also, township members can type .status from within the township to dump the spam queue
                    string text = string.Format("{0} at {1} is damaging your township's wall.", damager.Name, damager.Location.ToString());
                    if (tsr.IsSpam(damager, text) == false)
                    {
                        tsr.QueueSpam(damager, text);
                        tsr.TStone.Guild.GuildMessage(text);
                        try
                        {
                            string allytext = "[" + TownshipStone.GetTownshipSizeDesc(tsr.TStone.ActivityLevel) + " of the " + tsr.TStone.GuildName + "]: " + text;
                            foreach (Server.Guilds.Guild g in tsr.TStone.Guild.Allies)
                            {
                                g.GuildMessage(allytext);
                            }
                        }
                        catch (Exception exc)
                        {
                            Server.Commands.LogHelper.LogException(exc);
                        }
                    }
                    else
                    {
                        tsr.QueueSpam(damager, text);
                    }
                }
            }
        }
        public static int UODayChargePerPet(Mobile from, int slot)
        {
            // base rate increased from OSI 30 gold per real week to 84 gold per real week
            if (slot < GetMaxEconomyStabled(from))
            {
                return(1);                      // 1 gp per UO day
            }
            // township discount?
            if (TownshipStone.TownshipMember(from) != null)
            {
                TownshipStone ts = TownshipStone.TownshipMember(from);
                foreach (Mobile m in ts.TownshipMobiles)
                {
                    if (m is TSAnimalTrainer)
                    {
                        return(5);                              // 5 gp per UO day
                    }
                }
            }

            return(10);                 // 10 gp per UO day
        }
Beispiel #5
0
 public override void OnMovement(Mobile m, Point3D oldLocation)
 {
     if (m is PlayerMobile)
     {
         Regions.TownshipRegion tr = Server.Regions.TownshipRegion.GetTownshipAt(this);
         if (tr != null && tr.TStone != null)
         {
             if (CanSee(m) && InLOS(m) && tr.TStone.IsEnemy(m as PlayerMobile))
             {
                 if (InRange(m, LOOKOUTRANGE))
                 {
                     if (HasntBeenReportedLately(m))                             //hasn't been reported lately
                     {
                         if (tr.TStone.Guild != null)
                         {
                             string message = string.Format("The lookout {0} reports that an enemy named {1} is near {2}.", this.Name, m.Name, this.Female?"her":"him");
                             tr.TStone.Guild.GuildMessage(message);
                             try
                             {
                                 message = "[" + TownshipStone.GetTownshipSizeDesc(tr.TStone.ActivityLevel) + " of the " + tr.TStone.GuildName + "]: " + message;
                                 foreach (Server.Guilds.Guild g in tr.TStone.Guild.Allies)
                                 {
                                     g.GuildMessage(message);
                                 }
                             }
                             catch (Exception exc)
                             {
                                 Scripts.Commands.LogHelper.LogException(exc);
                             }
                         }
                     }
                 }
             }
         }
     }
     base.OnMovement(m, oldLocation);
 }
Beispiel #6
0
		public void Place(Mobile from, Point3D location, bool bCheck)
		{
			Guild g = from.Guild as Guild; ;

			if (!IsChildOf(from.Backpack))
			{
				from.SendLocalizedMessage(1042001); //This must be in your backpack
			}
			else if (g == null)
			{
				from.SendMessage("You must be a member of a guild to use this.");
			}
			else
			{
				BaseHouse house = BaseHouse.FindHouseAt(from);
				Guildstone stone = null;

				if (house != null)
				{
					stone = house.FindGuildstone();
				}
				else
				{
					stone = g.Guildstone as Guildstone;
				}

				//if (house == null || stone == null || stone.Guild != from.Guild)
				if (stone == null || stone.Guild != from.Guild)
				{
					//from.SendMessage("You must be in the house with your guild's guildstone to use this.");
					from.SendMessage("You must be a member of a guild and not be in a building which houses another guildstone to use this.");
				}
				else
				{
					bool bZoneOverlaps = false;
					bZoneOverlaps = DoesTownshipRegionConflict(location, from.Map, TownshipStone.INITIAL_RADIUS, null);

					if (bZoneOverlaps)
					{
						from.SendMessage("You can't create a township that conflicts with another township, guardzone, or other special area.");
						return;
					}

					double guildPercentage = GetPercentageOfGuildedHousesInArea(location, from.Map, TownshipStone.INITIAL_RADIUS, from.Guild as Guild, true);

					if (guildPercentage >= Township.TownshipSettings.GuildHousePercentage)
					{
						if (bCheck)
						{
							from.SendGump(new ConfirmPlacementGump(from, location, this));
						}
						else
						{
							TownshipStone ts = new TownshipStone(stone.Guild);
							ts.GoldHeld = Township.TownshipSettings.InitialFunds; //initial gold :-)
							ts.MoveToWorld(location, from.Map);
							ts.CreateInitialArea(location);

							from.SendMessage("The township has been created.");

							this.Delete();
						}
					}
					else
					{
						from.SendMessage("You can't create a township without owning most of the houses in the area.");
					}

				}
			}
		}
Beispiel #7
0
        public void Place(Mobile from, Point3D location, bool bCheck)
        {
            Guild g = from.Guild as Guild;;

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001);                 //This must be in your backpack
            }
            else if (g == null)
            {
                from.SendMessage("You must be a member of a guild to use this.");
            }
            else
            {
                BaseHouse  house = BaseHouse.FindHouseAt(from);
                Guildstone stone = null;

                if (house != null)
                {
                    stone = house.FindGuildstone();
                }
                else
                {
                    stone = g.Guildstone as Guildstone;
                }

                //if (house == null || stone == null || stone.Guild != from.Guild)
                if (stone == null || stone.Guild != from.Guild)
                {
                    //from.SendMessage("You must be in the house with your guild's guildstone to use this.");
                    from.SendMessage("You must be a member of a guild and not be in a building which houses another guildstone to use this.");
                }
                else
                {
                    bool bZoneOverlaps = false;
                    bZoneOverlaps = DoesTownshipRegionConflict(location, from.Map, TownshipStone.INITIAL_RADIUS, null);

                    if (bZoneOverlaps)
                    {
                        from.SendMessage("You can't create a township that conflicts with another township, guardzone, or other special area.");
                        return;
                    }

                    double guildPercentage = GetPercentageOfGuildedHousesInArea(location, from.Map, TownshipStone.INITIAL_RADIUS, from.Guild as Guild, true);

                    if (guildPercentage >= Township.TownshipSettings.GuildHousePercentage)
                    {
                        if (bCheck)
                        {
                            from.SendGump(new ConfirmPlacementGump(from, location, this));
                        }
                        else
                        {
                            TownshipStone ts = new TownshipStone(stone.Guild);
                            ts.GoldHeld = Township.TownshipSettings.InitialFunds;                             //initial gold :-)
                            ts.MoveToWorld(location, from.Map);
                            ts.CreateInitialArea(location);

                            from.SendMessage("The township has been created.");

                            this.Delete();
                        }
                    }
                    else
                    {
                        from.SendMessage("You can't create a township without owning most of the houses in the area.");
                    }
                }
            }
        }
Beispiel #8
0
        private TownshipStaffGump(Mobile mobile, Sort sort, int page, List <TownshipStone> list, bool tsdetail, int index)
            : base(20, 30)
        {
            try
            {
                mobile.CloseGump(typeof(TownshipStaffGump));
                m_Mobile = mobile;
                m_List   = list;
                m_Page   = page;

                ConfigureGump();

                if (m_List == null)
                {
                    GenerateList();
                }

                if (tsdetail && index >= 0 && index < m_List.Count)
                {
                    //Show detail about township!
                    TownshipStone thisStone = m_List[index];

                    double dHousePercentageFull = 0.0;
                    double dHousePercentageWithAlliedIgnored = 0.0;
                    try
                    {
                        dHousePercentageFull = TownshipDeed.GetPercentageOfGuildedHousesInArea(thisStone.TownshipCenter, thisStone.Map, thisStone.Extended ? TownshipStone.EXTENDED_RADIUS : TownshipStone.INITIAL_RADIUS, thisStone.Guild, false);
                        dHousePercentageWithAlliedIgnored = TownshipDeed.GetPercentageOfGuildedHousesInArea(thisStone.TownshipCenter, thisStone.Map, thisStone.Extended ? TownshipStone.EXTENDED_RADIUS : TownshipStone.INITIAL_RADIUS, thisStone.Guild, true);
                    }
                    catch (Exception cpe)
                    {
                        Scripts.Commands.LogHelper.LogException(cpe);
                    }

                    AddHtml(20, 50, 300, 35, string.Format("{0} of {1}", TownshipStone.GetTownshipSizeDesc(thisStone.ActivityLevel), thisStone.GuildName), false, false);
                    AddHtml(20, 80, 300, 35, string.Format("Last Week Total: {0}", thisStone.LastActualWeekNumber), false, false);
                    AddHtml(20, 110, 300, 35, string.Format("Weeks at current level: {0}", thisStone.WeeksAtThisLevel), false, false);
                    AddHtml(20, 140, 300, 35, string.Format("Last 7 days: {0},{1},{2},{3},{4},{5},{6}", thisStone.Visitors0, thisStone.Visitors1, thisStone.Visitors2, thisStone.Visitors3, thisStone.Visitors4, thisStone.Visitors5, thisStone.Visitors6), false, false);
                    AddHtml(20, 170, 300, 35, string.Format("Current day index: {0}", thisStone.VisitorsIndex), false, false);
                    AddHtml(20, 200, 300, 35, string.Format("Stone Location: ({0}, {1}, {2})", thisStone.X, thisStone.Y, thisStone.Z), false, false);
                    AddHtml(20, 230, 300, 35, string.Format("House Ownership Percentage: all: {0:0.00} -- allies ignored: {1:0.00}", dHousePercentageFull, dHousePercentageWithAlliedIgnored), false, false);

                    AddButton(20, 390, 4005, 4007, 997, GumpButtonType.Reply, 0);
                    AddHtml(55, 390, 470, 30, "Back to Main Page", false, false);                     // EXIT
                }
                else
                {
                    SortList(sort);

                    ShowList(page);

                    int numPages = (m_List.Count / 10) + 1;
                    //need next/back buttons
                    if (page > 0)
                    {
                        AddButton(20, 390, 4005, 4007, 998, GumpButtonType.Reply, 0);
                        AddHtml(55, 390, 470, 30, "Previous", false, false);                         // EXIT
                    }
                    if (page + 1 < numPages)
                    {
                        AddButton(150, 390, 4005, 4007, 999, GumpButtonType.Reply, 0);
                        AddHtml(185, 390, 470, 30, "Next", false, false);                         // EXIT
                    }
                }
            }
            catch (Exception e)
            {
                Scripts.Commands.LogHelper.LogException(e);
            }
        }
 public TownshipRegion(TownshipStone townstone, Map map)
     : base(townstone, map)
 {
     Setup();
 }
		public TownshipRegion(TownshipStone townstone, Map map) : base(townstone, map)
		{
			Setup();
		}
Beispiel #11
0
		private TownshipGump( Mobile mobile, TownshipStone stone, TownshipGump.Pages page ) : base( 20, 30 )
		{
			mobile.CloseGump(typeof(TownshipGump));
			m_Mobile = mobile;
			m_Stone = stone;

			BaseHouse house = BaseHouse.FindHouseAt(stone);
			if (house != null && stone.Guild == mobile.Guild)
			{
				if (house.IsCoOwner(mobile))
				{
					m_AdminAccess = true;
				}

				if (stone != null && stone.Guild != null && stone.Guild.Leader == m_Mobile)
				{
					m_AdminAccess = true;
					m_GuildMasterAccess = true;
				}
			}

			//If the stone isn't in a house, then the only member with Admin/Guildmaster access
			// will be the guildmaster.
			if (house == null && stone.Guild == mobile.Guild)
			{
				if (stone.Guild.Leader == m_Mobile)
				{
					m_AdminAccess = true;
					m_GuildMasterAccess = true;
				}
			}

			if (mobile.AccessLevel >= AccessLevel.Administrator)
			{
				m_AdminAccess = true;
				m_GuildMasterAccess = true;
			}

			ConfigureGump();

			switch (page)
			{
				case Pages.MAIN:
					MainPage();
					break;
				case Pages.BUYNPC:
					BuyNPCPage();
					break;
				case Pages.MANAGENPCS:
					ManageNPCPage();
					break;
				case Pages.LAWLEVEL:
					ManageLawLevelPage();
					break;
				case Pages.TRAVEL:
					TravelPage();
					break;
				case Pages.LASTFEES:
					LastFeesPage();
					break;
				case Pages.DAILYFEES:
					DailyFeesPage();
					break;
				case Pages.LASTDEPOSITS:
					LastDepositsPage();
					break;
				case Pages.DELETETOWNSHIPPAGE:
					DeleteTownshipPage();
					break;
				case Pages.ENEMYLISTPAGE:
					EnemyListPage();
					break;
				default:
					break;
			}

			if (page == Pages.MAIN)
			{
				if (m_Mobile.AccessLevel >= AccessLevel.Administrator)
				{
					AddButton(150, 365, 4005, 4007, (int)Buttons.WORLDSTAFF, GumpButtonType.Reply, 0);
					AddHtml(185, 365, 470, 30, "World Staff region control", false, false);
				}
			}
			else
			{
				AddButton(150, 390, 4005, 4007, (int)Buttons.MAINPAGE, GumpButtonType.Reply, 0);
				AddHtml(185, 390, 470, 30, "Back to Main Page", false, false);
			}

			AddButton( 20, 390, 4005, 4007, (int)Buttons.EXIT, GumpButtonType.Reply, 0 );
			AddHtmlLocalized( 55, 390, 470, 30, 1011441, false, false ); // EXIT
		}
Beispiel #12
0
			public AddTownshipGoldTarget(Mobile mobile, TownshipStone stone)
				: base(11, false, TargetFlags.None)
			{
				m_Mobile = mobile;
				m_Stone = stone;
			}
Beispiel #13
0
		public TownshipGump(Mobile mobile, TownshipStone stone)
			: this(mobile, stone, Pages.MAIN)
		{
		}
Beispiel #14
0
			public MoveTownshipStoneTarget(Mobile mobile, TownshipStone stone)
				: base(8, true, TargetFlags.None)
			{
				m_Mobile = mobile;
				m_Stone = stone;
			}