public override void OnResponse(NetState sender, RelayInfo info) { if (m_Town.Owner != m_Faction || !m_Faction.IsCommander(m_From)) { m_From.SendLocalizedMessage(1010339); // You no longer control this city return; } switch (info.ButtonID) { case 1: // hire sheriff { if (m_Town.Sheriff != null) { m_From.SendLocalizedMessage(1010342); // You must fire your Sheriff before you can elect a new one } else { m_From.SendLocalizedMessage(1010347); // Who shall be your new sheriff m_From.BeginTarget(12, false, TargetFlags.None, HireSheriff_OnTarget); } break; } case 2: // hire finance minister { if (m_Town.Finance != null) { m_From.SendLocalizedMessage( 1010345); // You must fire your finance minister before you can elect a new one } else { m_From.SendLocalizedMessage(1010348); // Who shall be your new Minister of Finances? m_From.BeginTarget(12, false, TargetFlags.None, HireFinanceMinister_OnTarget); } break; } case 3: // fire sheriff { if (m_Town.Sheriff == null) { m_From.SendLocalizedMessage(1010350); // You need to elect a sheriff before you can fire one } else { m_From.SendLocalizedMessage(1010349); // You have fired your sheriff m_Town.Sheriff.SendLocalizedMessage(1010270); // You have been fired as Sheriff m_Town.Sheriff = null; } break; } case 4: // fire finance minister { if (m_Town.Finance == null) { m_From.SendLocalizedMessage( 1010352); // You need to elect a financial minister before you can fire one } else { m_From.SendLocalizedMessage(1010351); // You have fired your financial Minister m_Town.Finance.SendLocalizedMessage(1010151); // You have been fired as Finance Minister m_Town.Finance = null; } break; } } }
public FactionStoneGump( PlayerMobile from, Faction faction ) : base(20, 30) { m_From = from; m_Faction = faction; AddPage( 0 ); AddBackground( 0, 0, 550, 440, 5054 ); AddBackground( 10, 10, 530, 420, 3000 ); #region General AddPage( 1 ); AddHtmlText( 20, 30, 510, 20, faction.Definition.Header, false, false ); AddHtmlLocalized( 20, 60, 100, 20, 1011429, false, false ); // Led By : AddHtml( 125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody", false, false ); AddHtmlLocalized( 20, 80, 100, 20, 1011457, false, false ); // Tithe rate : if ( faction.Tithe >= 0 && faction.Tithe <= 100 && ( faction.Tithe % 10 ) == 0 ) { AddHtmlLocalized( 125, 80, 350, 20, 1011480 + ( faction.Tithe / 10 ), false, false ); } else { AddHtml( 125, 80, 350, 20, faction.Tithe + "%", false, false ); } AddHtmlLocalized( 20, 100, 100, 20, 1011458, false, false ); // Traps placed : AddHtml( 125, 100, 50, 20, faction.Traps.Count.ToString(), false, false ); AddHtmlLocalized( 55, 225, 200, 20, 1011428, false, false ); // VOTE FOR LEADERSHIP AddButton( 20, 225, 4005, 4007, ToButtonID( 0, 0 ), GumpButtonType.Reply, 0 ); AddHtmlLocalized( 55, 150, 100, 20, 1011430, false, false ); // CITY STATUS AddButton( 20, 150, 4005, 4007, 0, GumpButtonType.Page, 2 ); AddHtmlLocalized( 55, 175, 100, 20, 1011444, false, false ); // STATISTICS AddButton( 20, 175, 4005, 4007, 0, GumpButtonType.Page, 4 ); bool isMerchantQualified = MerchantTitles.HasMerchantQualifications( from ); PlayerState pl = PlayerState.Find( from ); if ( pl != null && pl.MerchantTitle != MerchantTitle.None ) { AddHtmlLocalized( 55, 200, 250, 20, 1011460, false, false ); // UNDECLARE FACTION MERCHANT AddButton( 20, 200, 4005, 4007, ToButtonID( 1, 0 ), GumpButtonType.Reply, 0 ); } else if ( isMerchantQualified ) { AddHtmlLocalized( 55, 200, 250, 20, 1011459, false, false ); // DECLARE FACTION MERCHANT AddButton( 20, 200, 4005, 4007, 0, GumpButtonType.Page, 5 ); } else { AddHtmlLocalized( 55, 200, 250, 20, 1011467, false, false ); // MERCHANT OPTIONS AddImage( 20, 200, 4020 ); } AddHtmlLocalized( 55, 250, 300, 20, 1011461, false, false ); // COMMANDER OPTIONS if ( faction.IsCommander( from ) ) { AddButton( 20, 250, 4005, 4007, 0, GumpButtonType.Page, 6 ); } else { AddImage( 20, 250, 4020 ); } AddHtmlLocalized( 55, 275, 300, 20, 1011426, false, false ); // LEAVE THIS FACTION AddButton( 20, 275, 4005, 4007, ToButtonID( 0, 1 ), GumpButtonType.Reply, 0 ); AddHtmlLocalized( 55, 300, 200, 20, 1011441, false, false ); // EXIT AddButton( 20, 300, 4005, 4007, 0, GumpButtonType.Reply, 0 ); #endregion #region City Status AddPage( 2 ); AddHtmlLocalized( 20, 30, 250, 20, 1011430, false, false ); // CITY STATUS TownCollection towns = Town.Towns; for ( int i = 0; i < towns.Count; ++i ) { Town town = towns[i]; AddHtmlText( 40, 55 + ( i * 30 ), 150, 20, town.Definition.TownName, false, false ); if ( town.Owner == null ) { AddHtmlLocalized( 200, 55 + ( i * 30 ), 150, 20, 1011462, false, false ); // : Neutral } else { AddHtmlLocalized( 200, 55 + ( i * 30 ), 150, 20, town.Owner.Definition.OwnerLabel, false, false ); BaseMonolith monolith = town.Monolith; AddImage( 20, 60 + ( i * 30 ), ( monolith != null && monolith.Sigil != null && monolith.Sigil.IsPurifying ) ? 0x938 : 0x939 ); } } AddImage( 20, 300, 2361 ); AddHtmlLocalized( 45, 295, 300, 20, 1011491, false, false ); // sigil may be recaptured AddImage( 20, 320, 2360 ); AddHtmlLocalized( 45, 315, 300, 20, 1011492, false, false ); // sigil may not be recaptured AddHtmlLocalized( 55, 350, 100, 20, 1011447, false, false ); // BACK AddButton( 20, 350, 4005, 4007, 0, GumpButtonType.Page, 1 ); #endregion #region Statistics AddPage( 4 ); AddHtmlLocalized( 20, 30, 150, 20, 1011444, false, false ); // STATISTICS AddHtmlLocalized( 20, 100, 100, 20, 1011445, false, false ); // Name : AddHtml( 120, 100, 150, 20, from.Name, false, false ); AddHtmlLocalized( 20, 130, 100, 20, 1018064, false, false ); // score : AddHtml( 120, 130, 100, 20, ( pl != null ? pl.KillPoints : 0 ).ToString(), false, false ); AddHtmlLocalized( 20, 160, 100, 20, 1011446, false, false ); // Rank : AddHtml( 120, 160, 100, 20, ( pl != null ? pl.Rank.Rank : 0 ).ToString(), false, false ); AddHtmlLocalized( 55, 250, 100, 20, 1011447, false, false ); // BACK AddButton( 20, 250, 4005, 4007, 0, GumpButtonType.Page, 1 ); #endregion #region Merchant Options if ( ( pl == null || pl.MerchantTitle == MerchantTitle.None ) && isMerchantQualified ) { AddPage( 5 ); AddHtmlLocalized( 20, 30, 250, 20, 1011467, false, false ); // MERCHANT OPTIONS AddHtmlLocalized( 20, 80, 300, 20, 1011473, false, false ); // Select the title you wish to display MerchantTitleInfo[] infos = MerchantTitles.Info; for ( int i = 0; i < infos.Length; ++i ) { MerchantTitleInfo info = infos[i]; if ( MerchantTitles.IsQualified( from, info ) ) { AddButton( 20, 100 + ( i * 30 ), 4005, 4007, ToButtonID( 1, i + 1 ), GumpButtonType.Reply, 0 ); } else { AddImage( 20, 100 + ( i * 30 ), 4020 ); } AddHtmlText( 55, 100 + ( i * 30 ), 200, 20, info.Label, false, false ); } AddHtmlLocalized( 55, 340, 100, 20, 1011447, false, false ); // BACK AddButton( 20, 340, 4005, 4007, 0, GumpButtonType.Page, 1 ); } #endregion #region Commander Options if ( faction.IsCommander( from ) ) { #region General AddPage( 6 ); AddHtmlLocalized( 20, 30, 200, 20, 1011461, false, false ); // COMMANDER OPTIONS AddHtmlLocalized( 20, 70, 120, 20, 1011457, false, false ); // Tithe rate : if ( faction.Tithe >= 0 && faction.Tithe <= 100 && ( faction.Tithe % 10 ) == 0 ) { AddHtmlLocalized( 140, 70, 250, 20, 1011480 + ( faction.Tithe / 10 ), false, false ); } else { AddHtml( 140, 70, 250, 20, faction.Tithe + "%", false, false ); } AddHtmlLocalized( 20, 100, 120, 20, 1011474, false, false ); // Silver available : AddHtml( 140, 100, 50, 20, faction.Silver.ToString( "N0" ), false, false ); // NOTE: Added 'N0' formatting AddHtmlLocalized( 55, 130, 200, 20, 1011478, false, false ); // CHANGE TITHE RATE AddButton( 20, 130, 4005, 4007, 0, GumpButtonType.Page, 8 ); AddHtmlLocalized( 55, 160, 200, 20, 1018301, false, false ); // TRANSFER SILVER if ( faction.Silver >= 10000 ) { AddButton( 20, 160, 4005, 4007, 0, GumpButtonType.Page, 7 ); } else { AddImage( 20, 160, 4020 ); } AddHtmlLocalized( 55, 310, 100, 20, 1011447, false, false ); // BACK AddButton( 20, 310, 4005, 4007, 0, GumpButtonType.Page, 1 ); #endregion #region Town Finance if ( faction.Silver >= 10000 ) { AddPage( 7 ); AddHtmlLocalized( 20, 30, 250, 20, 1011476, false, false ); // TOWN FINANCE AddHtmlLocalized( 20, 50, 400, 20, 1011477, false, false ); // Select a town to transfer 10000 silver to for ( int i = 0; i < towns.Count; ++i ) { Town town = towns[i]; AddHtmlText( 55, 75 + ( i * 30 ), 200, 20, town.Definition.TownName, false, false ); if ( town.Owner == faction ) { AddButton( 20, 75 + ( i * 30 ), 4005, 4007, ToButtonID( 2, i ), GumpButtonType.Reply, 0 ); } else { AddImage( 20, 75 + ( i * 30 ), 4020 ); } } AddHtmlLocalized( 55, 310, 100, 20, 1011447, false, false ); // BACK AddButton( 20, 310, 4005, 4007, 0, GumpButtonType.Page, 1 ); } #endregion #region Change Tithe Rate AddPage( 8 ); AddHtmlLocalized( 20, 30, 400, 20, 1011479, false, false ); // Select the % for the new tithe rate int y = 55; for ( int i = 0; i <= 10; ++i ) { if ( i == 5 ) { y += 5; } AddHtmlLocalized( 55, y, 300, 20, 1011480 + i, false, false ); AddButton( 20, y, 4005, 4007, ToButtonID( 3, i ), GumpButtonType.Reply, 0 ); y += 20; if ( i == 5 ) { y += 5; } } AddHtmlLocalized( 55, 310, 300, 20, 1011447, false, false ); // BACK AddButton( 20, 310, 4005, 4007, 0, GumpButtonType.Page, 1 ); #endregion } #endregion }
private static void EventSink_Speech(SpeechEventArgs e) { Mobile from = e.Mobile; int[] keywords = e.Keywords; for (int i = 0; i < keywords.Length; ++i) { switch (keywords[i]) { case 0x00E4: // *i wish to access the city treasury* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsFinance(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null && from is PlayerMobile) { from.SendGump(new FinanceGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x0ED: // *i am sheriff* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsSheriff(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null) { from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x00EF: // *you are fired* { Town town = Town.FromRegion(from.Region); if (town == null) { break; } if (town.IsFinance(from) || town.IsSheriff(from)) { town.BeginOrderFiring(from); } break; } case 0x00E5: // *i wish to resign as finance minister* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Finance != null) { pl.Finance.Finance = null; from.SendLocalizedMessage(1005081); // You have been fired as Finance Minister } break; } case 0x00EE: // *i wish to resign as sheriff* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Sheriff != null) { pl.Sheriff.Sheriff = null; from.SendLocalizedMessage(1010270); // You have been fired as Sheriff } break; } case 0x00E9: // *what is my faction term status* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.IsLeaving) { if (Faction.CheckLeaveTimer(from)) { break; } TimeSpan remaining = (pl.Leaving + Faction.LeavePeriod) - DateTime.UtcNow; if (remaining.TotalDays >= 1) { from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0")); // Your term of service will come to an end in ~1_DAYS~ days. } else if (remaining.TotalHours >= 1) { from.SendLocalizedMessage(1042741, remaining.TotalHours.ToString("N0")); // Your term of service will come to an end in ~1_HOURS~ hours. } else { from.SendLocalizedMessage(1042742); // Your term of service will come to an end in less than one hour. } } else if (pl != null) { from.SendLocalizedMessage(1042233); // You are not in the process of quitting the faction. } break; } case 0x00EA: // *message faction* { Faction faction = Faction.Find(from); if (faction == null || !faction.IsCommander(from)) { break; } if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady) { from.SendLocalizedMessage(1010264); // The required time has not yet passed since the last message was sent } else { faction.BeginBroadcast(from); } break; } case 0x00EC: // *showscore* { PlayerState pl = PlayerState.Find(from); if (pl != null) { Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(ShowScore_Sandbox), pl); } break; } case 0x0178: // i honor your leadership { Faction faction = Faction.Find(from); if (faction != null) { faction.BeginHonorLeadership(from); } break; } } } }
public override void OnResponse(NetState sender, RelayInfo info) { int type, index; if (!FromButtonID(info.ButtonID, out type, out index)) { return; } switch (type) { case 0: // general { switch (index) { case 0: // vote { m_From.SendGump(new ElectionGump(m_From, m_Faction.Election)); break; } case 1: // leave { m_From.SendGump(new LeaveFactionGump(m_From, m_Faction)); break; } } break; } case 1: // merchant title { if (index >= 0 && index <= MerchantTitles.Info.Length) { PlayerState pl = PlayerState.Find(m_From); MerchantTitle newTitle = (MerchantTitle)index; MerchantTitleInfo mti = MerchantTitles.GetInfo(newTitle); if (mti == null) { m_From.SendAsciiMessage("Your merchant title has been removed."); if (pl != null) { pl.MerchantTitle = newTitle; } } else if (MerchantTitles.IsQualified(m_From, mti)) { m_From.SendLocalizedMessage(mti.Assigned); if (pl != null) { pl.MerchantTitle = newTitle; } } } break; } case 2: // transfer silver { if (!m_Faction.IsCommander(m_From)) { return; } TownCollection towns = Town.Towns; if (index >= 0 && index < towns.Count) { Town town = towns[index]; if (town.Owner == m_Faction) { if (m_Faction.Silver >= 10000) { m_Faction.Silver -= 10000; town.Silver += 10000; m_From.SendAsciiMessage("10k in silver has been received by: " + town.Definition.FriendlyName); } } } break; } case 3: // change tithe { if (!m_Faction.IsCommander(m_From)) { return; } if (index >= 0 && index <= 10) { m_Faction.Tithe = index * 10; } break; } } }
public FactionStoneGump(PlayerMobile from, Faction faction) : base(20, 30) { m_From = from; m_Faction = faction; AddPage(0); AddBackground(0, 0, 550, 440, 5054); AddBackground(10, 10, 530, 420, 3000); #region General AddPage(1); AddHtmlText(20, 30, 510, 20, faction.Definition.Header, false, false); AddHtmlLocalized(20, 60, 100, 20, 1011429, false, false); // Led By : AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody", false, false); AddHtmlLocalized(20, 80, 100, 20, 1011457, false, false); // Tithe rate : if (faction.Tithe >= 0 && faction.Tithe <= 100 && (faction.Tithe % 10) == 0) { AddHtmlLocalized(125, 80, 350, 20, 1011480 + (faction.Tithe / 10), false, false); } else { AddHtml(125, 80, 350, 20, faction.Tithe + "%", false, false); } AddHtmlLocalized(20, 100, 100, 20, 1011458, false, false); // Traps placed : AddHtml(125, 100, 50, 20, faction.Traps.Count.ToString(), false, false); AddHtmlLocalized(55, 225, 200, 20, 1011428, false, false); // VOTE FOR LEADERSHIP AddButton(20, 225, 4005, 4007, ToButtonID(0, 0), GumpButtonType.Reply, 0); AddHtmlLocalized(55, 150, 100, 20, 1011430, false, false); // CITY STATUS AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 2); AddHtmlLocalized(55, 175, 100, 20, 1011444, false, false); // STATISTICS AddButton(20, 175, 4005, 4007, 0, GumpButtonType.Page, 4); bool isMerchantQualified = MerchantTitles.HasMerchantQualifications(from); PlayerState pl = PlayerState.Find(from); if (pl != null && pl.MerchantTitle != MerchantTitle.None) { AddHtmlLocalized(55, 200, 250, 20, 1011460, false, false); // UNDECLARE FACTION MERCHANT AddButton(20, 200, 4005, 4007, ToButtonID(1, 0), GumpButtonType.Reply, 0); } else if (isMerchantQualified) { AddHtmlLocalized(55, 200, 250, 20, 1011459, false, false); // DECLARE FACTION MERCHANT AddButton(20, 200, 4005, 4007, 0, GumpButtonType.Page, 5); } else { AddHtmlLocalized(55, 200, 250, 20, 1011467, false, false); // MERCHANT OPTIONS AddImage(20, 200, 4020); } AddHtmlLocalized(55, 250, 300, 20, 1011461, false, false); // COMMANDER OPTIONS if (faction.IsCommander(from)) { AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 6); } else { AddImage(20, 250, 4020); } AddHtmlLocalized(55, 275, 300, 20, 1011426, false, false); // LEAVE THIS FACTION AddButton(20, 275, 4005, 4007, ToButtonID(0, 1), GumpButtonType.Reply, 0); AddHtmlLocalized(55, 300, 200, 20, 1011441, false, false); // EXIT AddButton(20, 300, 4005, 4007, 0, GumpButtonType.Reply, 0); #endregion #region City Status AddPage(2); AddHtmlLocalized(20, 30, 250, 20, 1011430, false, false); // CITY STATUS TownCollection towns = Town.Towns; for (int i = 0; i < towns.Count; ++i) { Town town = towns[i]; AddHtmlText(40, 55 + (i * 30), 150, 20, town.Definition.TownName, false, false); if (town.Owner == null) { AddHtmlLocalized(200, 55 + (i * 30), 150, 20, 1011462, false, false); // : Neutral } else { AddHtmlLocalized(200, 55 + (i * 30), 150, 20, town.Owner.Definition.OwnerLabel, false, false); BaseMonolith monolith = town.Monolith; AddImage(20, 60 + (i * 30), (monolith != null && monolith.Sigil != null && monolith.Sigil.IsPurifying) ? 0x938 : 0x939); } } AddImage(20, 300, 2361); AddHtmlLocalized(45, 295, 300, 20, 1011491, false, false); // sigil may be recaptured AddImage(20, 320, 2360); AddHtmlLocalized(45, 315, 300, 20, 1011492, false, false); // sigil may not be recaptured AddHtmlLocalized(55, 350, 100, 20, 1011447, false, false); // BACK AddButton(20, 350, 4005, 4007, 0, GumpButtonType.Page, 1); #endregion #region Statistics AddPage(4); AddHtmlLocalized(20, 30, 150, 20, 1011444, false, false); // STATISTICS AddHtmlLocalized(20, 100, 100, 20, 1011445, false, false); // Name : AddHtml(120, 100, 150, 20, from.Name, false, false); AddHtmlLocalized(20, 130, 100, 20, 1018064, false, false); // score : AddHtml(120, 130, 100, 20, (pl != null ? pl.KillPoints : 0).ToString(), false, false); AddHtmlLocalized(20, 160, 100, 20, 1011446, false, false); // Rank : AddHtml(120, 160, 100, 20, (pl != null ? pl.Rank.Rank : 0).ToString(), false, false); AddHtmlLocalized(55, 250, 100, 20, 1011447, false, false); // BACK AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 1); #endregion #region Merchant Options if ((pl == null || pl.MerchantTitle == MerchantTitle.None) && isMerchantQualified) { AddPage(5); AddHtmlLocalized(20, 30, 250, 20, 1011467, false, false); // MERCHANT OPTIONS AddHtmlLocalized(20, 80, 300, 20, 1011473, false, false); // Select the title you wish to display MerchantTitleInfo[] infos = MerchantTitles.Info; for (int i = 0; i < infos.Length; ++i) { MerchantTitleInfo info = infos[i]; if (MerchantTitles.IsQualified(from, info)) { AddButton(20, 100 + (i * 30), 4005, 4007, ToButtonID(1, i + 1), GumpButtonType.Reply, 0); } else { AddImage(20, 100 + (i * 30), 4020); } AddHtmlText(55, 100 + (i * 30), 200, 20, info.Label, false, false); } AddHtmlLocalized(55, 340, 100, 20, 1011447, false, false); // BACK AddButton(20, 340, 4005, 4007, 0, GumpButtonType.Page, 1); } #endregion #region Commander Options if (faction.IsCommander(from)) { #region General AddPage(6); AddHtmlLocalized(20, 30, 200, 20, 1011461, false, false); // COMMANDER OPTIONS AddHtmlLocalized(20, 70, 120, 20, 1011457, false, false); // Tithe rate : if (faction.Tithe >= 0 && faction.Tithe <= 100 && (faction.Tithe % 10) == 0) { AddHtmlLocalized(140, 70, 250, 20, 1011480 + (faction.Tithe / 10), false, false); } else { AddHtml(140, 70, 250, 20, faction.Tithe + "%", false, false); } AddHtmlLocalized(20, 100, 120, 20, 1011474, false, false); // Silver available : AddHtml(140, 100, 50, 20, faction.Silver.ToString("N0"), false, false); // NOTE: Added 'N0' formatting AddHtmlLocalized(55, 130, 200, 20, 1011478, false, false); // CHANGE TITHE RATE AddButton(20, 130, 4005, 4007, 0, GumpButtonType.Page, 8); AddHtmlLocalized(55, 160, 200, 20, 1018301, false, false); // TRANSFER SILVER if (faction.Silver >= 10000) { AddButton(20, 160, 4005, 4007, 0, GumpButtonType.Page, 7); } else { AddImage(20, 160, 4020); } AddHtmlLocalized(55, 310, 100, 20, 1011447, false, false); // BACK AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1); #endregion #region Town Finance if (faction.Silver >= 10000) { AddPage(7); AddHtmlLocalized(20, 30, 250, 20, 1011476, false, false); // TOWN FINANCE AddHtmlLocalized(20, 50, 400, 20, 1011477, false, false); // Select a town to transfer 10000 silver to for (int i = 0; i < towns.Count; ++i) { Town town = towns[i]; AddHtmlText(55, 75 + (i * 30), 200, 20, town.Definition.TownName, false, false); if (town.Owner == faction) { AddButton(20, 75 + (i * 30), 4005, 4007, ToButtonID(2, i), GumpButtonType.Reply, 0); } else { AddImage(20, 75 + (i * 30), 4020); } } AddHtmlLocalized(55, 310, 100, 20, 1011447, false, false); // BACK AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1); } #endregion #region Change Tithe Rate AddPage(8); AddHtmlLocalized(20, 30, 400, 20, 1011479, false, false); // Select the % for the new tithe rate int y = 55; for (int i = 0; i <= 10; ++i) { if (i == 5) { y += 5; } AddHtmlLocalized(55, y, 300, 20, 1011480 + i, false, false); AddButton(20, y, 4005, 4007, ToButtonID(3, i), GumpButtonType.Reply, 0); y += 20; if (i == 5) { y += 5; } } AddHtmlLocalized(55, 310, 300, 20, 1011447, false, false); // BACK AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1); #endregion } #endregion }
public FactionStoneGump(PlayerMobile from, Faction faction) : base(20, 30) { m_From = from; m_Faction = faction; AddPage(0); AddBackground(0, 0, 550, 440, 5054); AddBackground(10, 10, 530, 420, 3000); AddPage(1); AddHtmlText(20, 30, 510, 20, faction.Definition.Header, false, false); AddHtmlLocalized(20, 60, 100, 20, 1011429); // Led By : AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody"); AddHtmlLocalized(20, 80, 100, 20, 1011457); // Tithe rate : if (faction.Tithe >= 0 && faction.Tithe <= 100 && faction.Tithe % 10 == 0) { AddHtmlLocalized(125, 80, 350, 20, 1011480 + faction.Tithe / 10); } else { AddHtml(125, 80, 350, 20, $"{faction.Tithe}%"); } AddHtmlLocalized(20, 100, 100, 20, 1011458); // Traps placed : AddHtml(125, 100, 50, 20, faction.Traps.Count.ToString()); AddHtmlLocalized(55, 225, 200, 20, 1011428); // VOTE FOR LEADERSHIP AddButton(20, 225, 4005, 4007, ToButtonID(0, 0)); AddHtmlLocalized(55, 150, 100, 20, 1011430); // CITY STATUS AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 2); AddHtmlLocalized(55, 175, 100, 20, 1011444); // STATISTICS AddButton(20, 175, 4005, 4007, 0, GumpButtonType.Page, 4); var isMerchantQualified = MerchantTitles.HasMerchantQualifications(from); var pl = PlayerState.Find(from); if (pl != null && pl.MerchantTitle != MerchantTitle.None) { AddHtmlLocalized(55, 200, 250, 20, 1011460); // UNDECLARE FACTION MERCHANT AddButton(20, 200, 4005, 4007, ToButtonID(1, 0)); } else if (isMerchantQualified) { AddHtmlLocalized(55, 200, 250, 20, 1011459); // DECLARE FACTION MERCHANT AddButton(20, 200, 4005, 4007, 0, GumpButtonType.Page, 5); } else { AddHtmlLocalized(55, 200, 250, 20, 1011467); // MERCHANT OPTIONS AddImage(20, 200, 4020); } AddHtmlLocalized(55, 250, 300, 20, 1011461); // COMMANDER OPTIONS if (faction.IsCommander(from)) { AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 6); } else { AddImage(20, 250, 4020); } AddHtmlLocalized(55, 275, 300, 20, 1011426); // LEAVE THIS FACTION AddButton(20, 275, 4005, 4007, ToButtonID(0, 1)); AddHtmlLocalized(55, 300, 200, 20, 1011441); // EXIT AddButton(20, 300, 4005, 4007, 0); AddPage(2); AddHtmlLocalized(20, 30, 250, 20, 1011430); // CITY STATUS var towns = Town.Towns; for (var i = 0; i < towns.Count; ++i) { var town = towns[i]; AddHtmlText(40, 55 + i * 30, 150, 20, town.Definition.TownName, false, false); if (town.Owner == null) { AddHtmlLocalized(200, 55 + i * 30, 150, 20, 1011462); // : Neutral } else { AddHtmlLocalized(200, 55 + i * 30, 150, 20, town.Owner.Definition.OwnerLabel); BaseMonolith monolith = town.Monolith; AddImage(20, 60 + i * 30, monolith?.Sigil?.IsPurifying == true ? 0x938 : 0x939); } } AddImage(20, 300, 2361); AddHtmlLocalized(45, 295, 300, 20, 1011491); // sigil may be recaptured AddImage(20, 320, 2360); AddHtmlLocalized(45, 315, 300, 20, 1011492); // sigil may not be recaptured AddHtmlLocalized(55, 350, 100, 20, 1011447); // BACK AddButton(20, 350, 4005, 4007, 0, GumpButtonType.Page, 1); AddPage(4); AddHtmlLocalized(20, 30, 150, 20, 1011444); // STATISTICS AddHtmlLocalized(20, 100, 100, 20, 1011445); // Name : AddHtml(120, 100, 150, 20, from.Name); AddHtmlLocalized(20, 130, 100, 20, 1018064); // score : AddHtml(120, 130, 100, 20, (pl?.KillPoints ?? 0).ToString()); AddHtmlLocalized(20, 160, 100, 20, 1011446); // Rank : AddHtml(120, 160, 100, 20, (pl?.Rank.Rank ?? 0).ToString()); AddHtmlLocalized(55, 250, 100, 20, 1011447); // BACK AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 1); if ((pl == null || pl.MerchantTitle == MerchantTitle.None) && isMerchantQualified) { AddPage(5); AddHtmlLocalized(20, 30, 250, 20, 1011467); // MERCHANT OPTIONS AddHtmlLocalized(20, 80, 300, 20, 1011473); // Select the title you wish to display var infos = MerchantTitles.Info; for (var i = 0; i < infos.Length; ++i) { var info = infos[i]; if (MerchantTitles.IsQualified(from, info)) { AddButton(20, 100 + i * 30, 4005, 4007, ToButtonID(1, i + 1)); } else { AddImage(20, 100 + i * 30, 4020); } AddHtmlText(55, 100 + i * 30, 200, 20, info.Label, false, false); } AddHtmlLocalized(55, 340, 100, 20, 1011447); // BACK AddButton(20, 340, 4005, 4007, 0, GumpButtonType.Page, 1); } if (faction.IsCommander(from)) { AddPage(6); AddHtmlLocalized(20, 30, 200, 20, 1011461); // COMMANDER OPTIONS AddHtmlLocalized(20, 70, 120, 20, 1011457); // Tithe rate : if (faction.Tithe >= 0 && faction.Tithe <= 100 && faction.Tithe % 10 == 0) { AddHtmlLocalized(140, 70, 250, 20, 1011480 + faction.Tithe / 10); } else { AddHtml(140, 70, 250, 20, $"{faction.Tithe}%"); } AddHtmlLocalized(20, 100, 120, 20, 1011474); // Silver available : AddHtml(140, 100, 50, 20, faction.Silver.ToString("N0")); // NOTE: Added 'N0' formatting AddHtmlLocalized(55, 130, 200, 20, 1011478); // CHANGE TITHE RATE AddButton(20, 130, 4005, 4007, 0, GumpButtonType.Page, 8); AddHtmlLocalized(55, 160, 200, 20, 1018301); // TRANSFER SILVER if (faction.Silver >= 10000) { AddButton(20, 160, 4005, 4007, 0, GumpButtonType.Page, 7); } else { AddImage(20, 160, 4020); } AddHtmlLocalized(55, 310, 100, 20, 1011447); // BACK AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1); if (faction.Silver >= 10000) { AddPage(7); AddHtmlLocalized(20, 30, 250, 20, 1011476); // TOWN FINANCE AddHtmlLocalized(20, 50, 400, 20, 1011477); // Select a town to transfer 10000 silver to for (var i = 0; i < towns.Count; ++i) { var town = towns[i]; AddHtmlText(55, 75 + i * 30, 200, 20, town.Definition.TownName, false, false); if (town.Owner == faction) { AddButton(20, 75 + i * 30, 4005, 4007, ToButtonID(2, i)); } else { AddImage(20, 75 + i * 30, 4020); } } AddHtmlLocalized(55, 310, 100, 20, 1011447); // BACK AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1); } AddPage(8); AddHtmlLocalized(20, 30, 400, 20, 1011479); // Select the % for the new tithe rate var y = 55; for (var i = 0; i <= 10; ++i) { if (i == 5) { y += 5; } AddHtmlLocalized(55, y, 300, 20, 1011480 + i); AddButton(20, y, 4005, 4007, ToButtonID(3, i)); y += 20; if (i == 5) { y += 5; } } AddHtmlLocalized(55, 310, 300, 20, 1011447); // BACK AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1); } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_Town.Owner != m_Faction || !m_Faction.IsCommander(m_From)) { m_From.SendAsciiMessage("You no longer control this city."); return; } switch (info.ButtonID) { case 1: // hire sheriff { if (m_Town.Sheriff != null) { m_From.SendAsciiMessage("You must fire your Sheriff before you can elect a new one."); } else { m_From.SendAsciiMessage("Who shall be your new sheriff."); m_From.BeginTarget(12, false, TargetFlags.None, new TargetCallback(HireSheriff_OnTarget)); } break; } case 2: // hire finance minister { if (m_Town.Finance != null) { m_From.SendAsciiMessage("You must fire your finance minister before you can elect a new one."); } else { m_From.SendAsciiMessage("Who shall be your new Minister of Finances?"); m_From.BeginTarget(12, false, TargetFlags.None, new TargetCallback(HireFinanceMinister_OnTarget)); } break; } case 3: // fire sheriff { if (m_Town.Sheriff == null) { m_From.SendAsciiMessage("You need to elect a sheriff before you can fire one."); } else { m_From.SendAsciiMessage("You have fired your sheriff."); m_Town.Sheriff.SendAsciiMessage("You have been fired as Sheriff."); m_Town.Sheriff = null; } break; } case 4: // fire finance minister { if (m_Town.Finance == null) { m_From.SendAsciiMessage("You need to elect a financial minister before you can fire one."); } else { m_From.SendAsciiMessage("You have fired your financial Minister."); m_Town.Finance.SendAsciiMessage("You have been fired as Finance Minister."); m_Town.Finance = null; } break; } } }
private static void EventSink_Speech(SpeechEventArgs e) { Mobile from = e.Mobile; // jakob, added 2 new commands if (e.Speech.ToLower().IndexOf("i wish to appoint a deputy commander") > -1) { Faction faction = Faction.Find(from); if (faction != null && faction.IsCommander(from) && !faction.IsDeputyCommander(from)) { faction.BeginAppointDeputyCommander(from); } } else if (e.Speech.ToLower().IndexOf("i wish to demote the deputy commander") > -1) { Faction faction = Faction.Find(from); if (faction != null && faction.IsCommander(from) && !faction.IsDeputyCommander(from) && faction.DeputyCommander != null) { faction.DeputyCommander = null; from.SendMessage("You have fired the deputy commander."); } } // Kamron, added this else if (e.Speech.ToLower().IndexOf("i wish to renew my spirit") > -1) { PlayerState ps = PlayerState.Find(from); if (ps != null && from is PlayerMobile) { PlayerMobile pm = (PlayerMobile)from; if (ps.KillPoints <= 1) { from.SendMessage("Your spirit cannot be cleansed."); } else if (Faction.InSkillLoss(pm)) { ps.KillPoints--; Faction.ClearSkillLoss(pm); from.SendMessage("You cleanse your spirit and remove your sins."); } else { from.SendMessage("Your spirit does not need cleansing."); } } } // end int[] keywords = e.Keywords; for (int i = 0; i < keywords.Length; ++i) { switch (keywords[i]) { case 0x00E4: // *i wish to access the city treasury* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsFinance(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null && from is PlayerMobile) { from.SendGump(new FinanceGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x0ED: // *i am sheriff* { Town town = Town.FromRegion(from.Region); if (town == null || !town.IsSheriff(from) || !from.Alive) { break; } if (FactionGump.Exists(from)) { from.SendLocalizedMessage(1042160); // You already have a faction menu open. } else if (town.Owner != null) { from.SendGump(new SheriffGump((PlayerMobile)from, town.Owner, town)); } break; } case 0x00EF: // *you are fired* { Town town = Town.FromRegion(from.Region); if (town == null) { break; } if (town.IsFinance(from) || town.IsSheriff(from)) { town.BeginOrderFiring(from); } break; } case 0x00E5: // *i wish to resign as finance minister* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Finance != null) { pl.Finance.Finance = null; from.SendLocalizedMessage(1005081); // You have been fired as Finance Minister } break; } case 0x00EE: // *i wish to resign as sheriff* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.Sheriff != null) { pl.Sheriff.Sheriff = null; from.SendLocalizedMessage(1010270); // You have been fired as Sheriff } break; } case 0x00E9: // *what is my faction term status* { PlayerState pl = PlayerState.Find(from); if (pl != null && pl.IsLeaving) { if (Faction.CheckLeaveTimer(from)) { break; } TimeSpan remaining = (pl.Leaving + Faction.LeavePeriod) - DateTime.Now; if (remaining.TotalDays >= 1) { from.SendLocalizedMessage(1042743, remaining.TotalDays.ToString("N0")); // Your term of service will come to an end in ~1_DAYS~ days. } else if (remaining.TotalHours >= 1) { from.SendLocalizedMessage(1042741, remaining.TotalHours.ToString("N0")); // Your term of service will come to an end in ~1_HOURS~ hours. } else { from.SendLocalizedMessage(1042742); // Your term of service will come to an end in less than one hour. } } else if (pl != null) { from.SendLocalizedMessage(1042233); // You are not in the process of quitting the faction. } break; } case 0x00EA: // *message faction* { Faction faction = Faction.Find(from); if (faction == null || !faction.IsCommander(from)) { break; } if (from.AccessLevel == AccessLevel.Player && !faction.FactionMessageReady) { from.SendLocalizedMessage(1010264); // The required time has not yet passed since the last message was sent } else { faction.BeginBroadcast(from); } break; } case 0x00EC: // *showscore* { PlayerState pl = PlayerState.Find(from); if (pl != null) { Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(ShowScore_Sandbox), pl); } break; } /* * case 0x0178: // i honor your leadership * { * Faction faction = Faction.Find( from ); * * if ( faction != null ) * faction.BeginHonorLeadership( from ); * * break; * } */ } } }