Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -7,8 +7,8 @@ namespace Server.Factions
|
|||
{
|
||||
public class ElectionGump : FactionGump
|
||||
{
|
||||
private Election m_Election;
|
||||
private PlayerMobile m_From;
|
||||
private readonly Election m_Election;
|
||||
private readonly PlayerMobile m_From;
|
||||
|
||||
public ElectionGump(PlayerMobile from, Election election) : base(50, 50)
|
||||
{
|
||||
|
|
@ -27,71 +27,71 @@ namespace Server.Factions
|
|||
switch (election.State)
|
||||
{
|
||||
case ElectionState.Pending:
|
||||
{
|
||||
TimeSpan toGo = election.LastStateTime + Election.PendingPeriod - DateTime.UtcNow;
|
||||
int days = (int)(toGo.TotalDays + 0.5);
|
||||
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1038034); // A new election campaign is pending
|
||||
|
||||
if (days > 0)
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1018062); // Days until next election :
|
||||
AddLabel(300, 60, 0, days.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1018059); // Election campaigning begins tonight.
|
||||
}
|
||||
TimeSpan toGo = election.LastStateTime + Election.PendingPeriod - DateTime.UtcNow;
|
||||
int days = (int)(toGo.TotalDays + 0.5);
|
||||
|
||||
break;
|
||||
}
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1038034); // A new election campaign is pending
|
||||
|
||||
if (days > 0)
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1018062); // Days until next election :
|
||||
AddLabel(300, 60, 0, days.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1018059); // Election campaigning begins tonight.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ElectionState.Campaign:
|
||||
{
|
||||
TimeSpan toGo = election.LastStateTime + Election.CampaignPeriod - DateTime.UtcNow;
|
||||
int days = (int)(toGo.TotalDays + 0.5);
|
||||
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1018058); // There is an election campaign in progress.
|
||||
|
||||
if (days > 0)
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1038033); // Days to go:
|
||||
AddLabel(300, 60, 0, days.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1018061); // Campaign in progress. Voting begins tonight.
|
||||
}
|
||||
TimeSpan toGo = election.LastStateTime + Election.CampaignPeriod - DateTime.UtcNow;
|
||||
int days = (int)(toGo.TotalDays + 0.5);
|
||||
|
||||
if (m_Election.CanBeCandidate(m_From))
|
||||
{
|
||||
AddButton(20, 110, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 110, 350, 20, 1011427); // CAMPAIGN FOR LEADERSHIP
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(m_From);
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1018058); // There is an election campaign in progress.
|
||||
|
||||
if (pl == null || pl.Rank.Rank < Election.CandidateRank)
|
||||
AddHtmlLocalized(20, 100, 380, 20, 1010118); // You must have a higher rank to run for office
|
||||
}
|
||||
if (days > 0)
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1038033); // Days to go:
|
||||
AddLabel(300, 60, 0, days.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1018061); // Campaign in progress. Voting begins tonight.
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
if (m_Election.CanBeCandidate(m_From))
|
||||
{
|
||||
AddButton(20, 110, 4005, 4007, 2);
|
||||
AddHtmlLocalized(55, 110, 350, 20, 1011427); // CAMPAIGN FOR LEADERSHIP
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(m_From);
|
||||
|
||||
if (pl == null || pl.Rank.Rank < Election.CandidateRank)
|
||||
AddHtmlLocalized(20, 100, 380, 20, 1010118); // You must have a higher rank to run for office
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case ElectionState.Election:
|
||||
{
|
||||
TimeSpan toGo = election.LastStateTime + Election.VotingPeriod - DateTime.UtcNow;
|
||||
int days = (int)Math.Ceiling(toGo.TotalDays);
|
||||
{
|
||||
TimeSpan toGo = election.LastStateTime + Election.VotingPeriod - DateTime.UtcNow;
|
||||
int days = (int)Math.Ceiling(toGo.TotalDays);
|
||||
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1018060); // There is an election vote in progress.
|
||||
AddHtmlLocalized(20, 40, 380, 20, 1018060); // There is an election vote in progress.
|
||||
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1038033);
|
||||
AddLabel(300, 60, 0, days.ToString());
|
||||
AddHtmlLocalized(20, 60, 280, 20, 1038033);
|
||||
AddLabel(300, 60, 0, days.ToString());
|
||||
|
||||
AddHtmlLocalized(55, 100, 380, 20, 1011428); // VOTE FOR LEADERSHIP
|
||||
AddButton(20, 100, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 100, 380, 20, 1011428); // VOTE FOR LEADERSHIP
|
||||
AddButton(20, 100, 4005, 4007, 1);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(20, 140, 4005, 4007, 0);
|
||||
|
|
@ -103,24 +103,24 @@ namespace Server.Factions
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 0: // back
|
||||
{
|
||||
m_From.SendGump(new FactionStoneGump(m_From, m_Election.Faction));
|
||||
break;
|
||||
}
|
||||
{
|
||||
m_From.SendGump(new FactionStoneGump(m_From, m_Election.Faction));
|
||||
break;
|
||||
}
|
||||
case 1: // vote
|
||||
{
|
||||
if (m_Election.State == ElectionState.Election)
|
||||
m_From.SendGump(new VoteGump(m_From, m_Election));
|
||||
{
|
||||
if (m_Election.State == ElectionState.Election)
|
||||
m_From.SendGump(new VoteGump(m_From, m_Election));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // campaign
|
||||
{
|
||||
if (m_Election.CanBeCandidate(m_From))
|
||||
m_Election.AddCandidate(m_From);
|
||||
{
|
||||
if (m_Election.CanBeCandidate(m_From))
|
||||
m_Election.AddCandidate(m_From);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ namespace Server.Factions
|
|||
public class ElectionManagementGump : Gump
|
||||
{
|
||||
public const int LabelColor = 0xFFFFFF;
|
||||
private Candidate m_Candidate;
|
||||
private readonly Candidate m_Candidate;
|
||||
|
||||
private Election m_Election;
|
||||
private int m_Page;
|
||||
private readonly Election m_Election;
|
||||
private readonly int m_Page;
|
||||
|
||||
public ElectionManagementGump(Election election, Candidate candidate = null, int page = 0) : base(40, 40)
|
||||
{
|
||||
|
|
@ -53,7 +53,6 @@ namespace Server.Factions
|
|||
else
|
||||
AddImage(414, 104, 0x25E6);
|
||||
|
||||
|
||||
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor));
|
||||
AddHtml(47, 120, 150, 20, Color("Name", LabelColor));
|
||||
AddHtml(195, 120, 100, 20, Color(Center("Address"), LabelColor));
|
||||
|
|
|
|||
|
|
@ -7,14 +7,14 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionImbueGump : FactionGump
|
||||
{
|
||||
private CraftSystem m_CraftSystem;
|
||||
private readonly CraftSystem m_CraftSystem;
|
||||
|
||||
private FactionItemDefinition m_Definition;
|
||||
private Faction m_Faction;
|
||||
private Item m_Item;
|
||||
private Mobile m_Mobile;
|
||||
private object m_Notice;
|
||||
private BaseTool m_Tool;
|
||||
private readonly FactionItemDefinition m_Definition;
|
||||
private readonly Faction m_Faction;
|
||||
private readonly Item m_Item;
|
||||
private readonly Mobile m_Mobile;
|
||||
private readonly object m_Notice;
|
||||
private readonly BaseTool m_Tool;
|
||||
|
||||
public FactionImbueGump(int quality, Item item, Mobile from, CraftSystem craftSystem, BaseTool tool, object notice,
|
||||
int availableSilver, Faction faction, FactionItemDefinition def) : base(100, 200)
|
||||
|
|
@ -34,9 +34,8 @@ namespace Server.Factions
|
|||
|
||||
AddHtmlLocalized(20, 20, 210, 25, 1011569); // Imbue with Faction properties?
|
||||
|
||||
|
||||
AddHtmlLocalized(20, 60, 170, 25, 1018302); // Item quality:
|
||||
AddHtmlLocalized(175, 60, 100, 25, 1018305 - quality); // Exceptional, Average, Low
|
||||
AddHtmlLocalized(175, 60, 100, 25, 1018305 - quality); // Exceptional, Average, Low
|
||||
|
||||
AddHtmlLocalized(20, 80, 170, 25, 1011572); // Item Cost :
|
||||
AddLabel(175, 80, 0x34, def.SilverCost.ToString("N0")); // NOTE: Added 'N0'
|
||||
|
|
@ -44,7 +43,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(20, 100, 170, 25, 1011573); // Your Silver :
|
||||
AddLabel(175, 100, 0x34, availableSilver.ToString("N0")); // NOTE: Added 'N0'
|
||||
|
||||
|
||||
AddRadio(20, 140, 210, 211, true, 1);
|
||||
AddLabel(55, 140, m_Faction.Definition.HuePrimary - 1, "*****");
|
||||
AddHtmlLocalized(150, 140, 150, 25, 1011570); // Primary Color
|
||||
|
|
@ -53,7 +51,6 @@ namespace Server.Factions
|
|||
AddLabel(55, 160, m_Faction.Definition.HueSecondary - 1, "*****");
|
||||
AddHtmlLocalized(150, 160, 150, 25, 1011571); // Secondary Color
|
||||
|
||||
|
||||
AddHtmlLocalized(55, 200, 200, 25, 1011011); // CONTINUE
|
||||
AddButton(20, 200, 4005, 4007, 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ namespace Server.Factions
|
|||
{
|
||||
public class FactionStoneGump : FactionGump
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private PlayerMobile m_From;
|
||||
private readonly Faction m_Faction;
|
||||
private readonly PlayerMobile m_From;
|
||||
|
||||
public FactionStoneGump(PlayerMobile from, Faction faction) : base(20, 30)
|
||||
{
|
||||
|
|
@ -20,8 +20,6 @@ namespace Server.Factions
|
|||
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);
|
||||
|
|
@ -79,10 +77,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 300, 200, 20, 1011441); // EXIT
|
||||
AddButton(20, 300, 4005, 4007, 0);
|
||||
|
||||
#endregion
|
||||
|
||||
#region City Status
|
||||
|
||||
AddPage(2);
|
||||
|
||||
AddHtmlLocalized(20, 30, 250, 20, 1011430); // CITY STATUS
|
||||
|
|
@ -109,7 +103,6 @@ namespace Server.Factions
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
AddImage(20, 300, 2361);
|
||||
AddHtmlLocalized(45, 295, 300, 20, 1011491); // sigil may be recaptured
|
||||
|
||||
|
|
@ -119,10 +112,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 350, 100, 20, 1011447); // BACK
|
||||
AddButton(20, 350, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Statistics
|
||||
|
||||
AddPage(4);
|
||||
|
||||
AddHtmlLocalized(20, 30, 150, 20, 1011444); // STATISTICS
|
||||
|
|
@ -139,10 +128,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 250, 100, 20, 1011447); // BACK
|
||||
AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Merchant Options
|
||||
|
||||
if ((pl == null || pl.MerchantTitle == MerchantTitle.None) && isMerchantQualified)
|
||||
{
|
||||
AddPage(5);
|
||||
|
|
@ -169,14 +154,8 @@ namespace Server.Factions
|
|||
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); // COMMANDER OPTIONS
|
||||
|
|
@ -202,10 +181,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 310, 100, 20, 1011447); // BACK
|
||||
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Town Finance
|
||||
|
||||
if (faction.Silver >= 10000)
|
||||
{
|
||||
AddPage(7);
|
||||
|
|
@ -230,10 +205,6 @@ namespace Server.Factions
|
|||
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Change Tithe Rate
|
||||
|
||||
AddPage(8);
|
||||
|
||||
AddHtmlLocalized(20, 30, 400, 20, 1011479); // Select the % for the new tithe rate
|
||||
|
|
@ -256,11 +227,7 @@ namespace Server.Factions
|
|||
|
||||
AddHtmlLocalized(55, 310, 300, 20, 1011447); // BACK
|
||||
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public override int ButtonTypes => 4;
|
||||
|
|
@ -273,84 +240,84 @@ namespace Server.Factions
|
|||
switch (type)
|
||||
{
|
||||
case 0: // general
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0: // vote
|
||||
switch (index)
|
||||
{
|
||||
m_From.SendGump(new ElectionGump(m_From, m_Faction.Election));
|
||||
break;
|
||||
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;
|
||||
}
|
||||
}
|
||||
case 1: // leave
|
||||
{
|
||||
m_From.SendGump(new LeaveFactionGump(m_From, m_Faction));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
if (index >= 0 && index <= MerchantTitles.Info.Length)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1010120); // Your merchant title has been removed
|
||||
PlayerState pl = PlayerState.Find(m_From);
|
||||
|
||||
if (pl != null)
|
||||
pl.MerchantTitle = newTitle;
|
||||
}
|
||||
else if (MerchantTitles.IsQualified(m_From, mti))
|
||||
{
|
||||
m_From.SendLocalizedMessage(mti.Assigned);
|
||||
MerchantTitle newTitle = (MerchantTitle)index;
|
||||
MerchantTitleInfo mti = MerchantTitles.GetInfo(newTitle);
|
||||
|
||||
if (pl != null)
|
||||
pl.MerchantTitle = newTitle;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // transfer silver
|
||||
{
|
||||
if (!m_Faction.IsCommander(m_From))
|
||||
return;
|
||||
|
||||
List<Town> towns = Town.Towns;
|
||||
|
||||
if (index >= 0 && index < towns.Count)
|
||||
{
|
||||
Town town = towns[index];
|
||||
|
||||
if (town.Owner == m_Faction)
|
||||
if (m_Faction.Silver >= 10000)
|
||||
if (mti == null)
|
||||
{
|
||||
m_Faction.Silver -= 10000;
|
||||
town.Silver += 10000;
|
||||
m_From.SendLocalizedMessage(1010120); // Your merchant title has been removed
|
||||
|
||||
// 10k in silver has been received by:
|
||||
m_From.SendLocalizedMessage(1042726, true, $" {town.Definition.FriendlyName}");
|
||||
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;
|
||||
|
||||
break;
|
||||
}
|
||||
List<Town> 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;
|
||||
|
||||
// 10k in silver has been received by:
|
||||
m_From.SendLocalizedMessage(1042726, true, $" {town.Definition.FriendlyName}");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // change tithe
|
||||
{
|
||||
if (!m_Faction.IsCommander(m_From))
|
||||
return;
|
||||
{
|
||||
if (!m_Faction.IsCommander(m_From))
|
||||
return;
|
||||
|
||||
if (index >= 0 && index <= 10)
|
||||
m_Faction.Tithe = index * 10;
|
||||
if (index >= 0 && index <= 10)
|
||||
m_Faction.Tithe = index * 10;
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,15 +9,15 @@ namespace Server.Factions
|
|||
{
|
||||
public class FinanceGump : FactionGump
|
||||
{
|
||||
private static int[] m_PriceOffsets =
|
||||
private static readonly int[] m_PriceOffsets =
|
||||
{
|
||||
-30, -25, -20, -15, -10, -5,
|
||||
+50, +100, +150, +200, +250, +300
|
||||
};
|
||||
|
||||
private Faction m_Faction;
|
||||
private PlayerMobile m_From;
|
||||
private Town m_Town;
|
||||
private readonly Faction m_Faction;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly Town m_Town;
|
||||
|
||||
public FinanceGump(PlayerMobile from, Faction faction, Town town) : base(50, 50)
|
||||
{
|
||||
|
|
@ -25,19 +25,15 @@ namespace Server.Factions
|
|||
m_Faction = faction;
|
||||
m_Town = town;
|
||||
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 320, 410, 5054);
|
||||
AddBackground(10, 10, 300, 390, 3000);
|
||||
|
||||
#region General
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddHtmlLocalized(20, 30, 260, 25, 1011541); // FINANCE MINISTER
|
||||
|
||||
|
||||
AddHtmlLocalized(55, 90, 200, 25, 1011539); // CHANGE PRICES
|
||||
AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 2);
|
||||
|
||||
|
|
@ -50,10 +46,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011441); // EXIT
|
||||
AddButton(20, 360, 4005, 4007, 0);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Change Prices
|
||||
|
||||
AddPage(2);
|
||||
|
||||
AddHtmlLocalized(20, 30, 200, 25, 1011539); // CHANGE PRICES
|
||||
|
|
@ -82,10 +74,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Buy Shopkeepers
|
||||
|
||||
AddPage(3);
|
||||
|
||||
AddHtmlLocalized(20, 30, 200, 25, 1011540); // BUY SHOPKEEPERS
|
||||
|
|
@ -101,13 +89,9 @@ namespace Server.Factions
|
|||
AddHtmlText(100, 90 + i * 40, 200, 25, list.Definition.Label, false, false);
|
||||
}
|
||||
|
||||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region View Finances
|
||||
|
||||
AddPage(4);
|
||||
|
||||
int financeUpkeep = town.FinanceUpkeep;
|
||||
|
|
@ -115,7 +99,6 @@ namespace Server.Factions
|
|||
int dailyIncome = town.DailyIncome;
|
||||
int netCashFlow = town.NetCashFlow;
|
||||
|
||||
|
||||
AddHtmlLocalized(20, 30, 300, 25, 1011524); // FINANCE STATEMENT
|
||||
|
||||
AddHtmlLocalized(20, 80, 300, 25, 1011538); // Current total money for town :
|
||||
|
|
@ -136,10 +119,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Shopkeeper Pages
|
||||
|
||||
for (int i = 0; i < vendorLists.Count; ++i)
|
||||
{
|
||||
VendorList vendorList = vendorLists[i];
|
||||
|
|
@ -176,8 +155,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public override int ButtonTypes => 2;
|
||||
|
|
@ -196,96 +173,96 @@ namespace Server.Factions
|
|||
switch (type)
|
||||
{
|
||||
case 0: // general
|
||||
{
|
||||
switch (index)
|
||||
{
|
||||
case 0: // set price
|
||||
switch (index)
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
case 0: // set price
|
||||
{
|
||||
int[] switches = info.Switches;
|
||||
|
||||
if (switches.Length == 0)
|
||||
break;
|
||||
if (switches.Length == 0)
|
||||
break;
|
||||
|
||||
int opt = switches[0];
|
||||
int newTax = 0;
|
||||
int opt = switches[0];
|
||||
int newTax = 0;
|
||||
|
||||
if (opt >= 1 && opt <= m_PriceOffsets.Length)
|
||||
newTax = m_PriceOffsets[opt - 1];
|
||||
if (opt >= 1 && opt <= m_PriceOffsets.Length)
|
||||
newTax = m_PriceOffsets[opt - 1];
|
||||
|
||||
if (m_Town.Tax == newTax)
|
||||
break;
|
||||
if (m_Town.Tax == newTax)
|
||||
break;
|
||||
|
||||
if (m_From.AccessLevel == AccessLevel.Player && !m_Town.TaxChangeReady)
|
||||
{
|
||||
TimeSpan remaining = DateTime.UtcNow - (m_Town.LastTaxChange + Town.TaxChangePeriod);
|
||||
if (m_From.AccessLevel == AccessLevel.Player && !m_Town.TaxChangeReady)
|
||||
{
|
||||
TimeSpan remaining = DateTime.UtcNow - (m_Town.LastTaxChange + Town.TaxChangePeriod);
|
||||
|
||||
if (remaining.TotalMinutes < 4)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042165); // You must wait a short while before changing prices again.
|
||||
else if (remaining.TotalMinutes < 10)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042166); // You must wait several minutes before changing prices again.
|
||||
else if (remaining.TotalHours < 1)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042167); // You must wait up to an hour before changing prices again.
|
||||
else if (remaining.TotalHours < 4)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042168); // You must wait a few hours before changing prices again.
|
||||
else
|
||||
m_From.SendLocalizedMessage(
|
||||
1042169); // You must wait several hours before changing prices again.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Town.Tax = newTax;
|
||||
if (remaining.TotalMinutes < 4)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042165); // You must wait a short while before changing prices again.
|
||||
else if (remaining.TotalMinutes < 10)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042166); // You must wait several minutes before changing prices again.
|
||||
else if (remaining.TotalHours < 1)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042167); // You must wait up to an hour before changing prices again.
|
||||
else if (remaining.TotalHours < 4)
|
||||
m_From.SendLocalizedMessage(
|
||||
1042168); // You must wait a few hours before changing prices again.
|
||||
else
|
||||
m_From.SendLocalizedMessage(
|
||||
1042169); // You must wait several hours before changing prices again.
|
||||
}
|
||||
else
|
||||
{
|
||||
m_Town.Tax = newTax;
|
||||
|
||||
if (m_From.AccessLevel == AccessLevel.Player)
|
||||
m_Town.LastTaxChange = DateTime.UtcNow;
|
||||
}
|
||||
if (m_From.AccessLevel == AccessLevel.Player)
|
||||
m_Town.LastTaxChange = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: // make vendor
|
||||
{
|
||||
List<VendorList> vendorLists = m_Town.VendorLists;
|
||||
|
||||
if (index >= 0 && index < vendorLists.Count)
|
||||
{
|
||||
VendorList vendorList = vendorLists[index];
|
||||
List<VendorList> vendorLists = m_Town.VendorLists;
|
||||
|
||||
if (Town.FromRegion(m_From.Region) != m_Town)
|
||||
if (index >= 0 && index < vendorLists.Count)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1010305); // You must be in your controlled city to buy Items
|
||||
}
|
||||
else if (vendorList.Vendors.Count >= vendorList.Definition.Maximum)
|
||||
{
|
||||
m_From.SendLocalizedMessage(
|
||||
1010306); // You currently have too many of this enhancement type to place another
|
||||
}
|
||||
else if (BaseBoat.FindBoatAt(m_From.Location, m_From.Map) != null)
|
||||
{
|
||||
m_From.SendMessage("You cannot place a vendor here");
|
||||
}
|
||||
else if (m_Town.Silver >= vendorList.Definition.Price)
|
||||
{
|
||||
BaseFactionVendor vendor = vendorList.Construct(m_Town, m_Faction);
|
||||
VendorList vendorList = vendorLists[index];
|
||||
|
||||
if (vendor != null)
|
||||
if (Town.FromRegion(m_From.Region) != m_Town)
|
||||
{
|
||||
m_Town.Silver -= vendorList.Definition.Price;
|
||||
m_From.SendLocalizedMessage(1010305); // You must be in your controlled city to buy Items
|
||||
}
|
||||
else if (vendorList.Vendors.Count >= vendorList.Definition.Maximum)
|
||||
{
|
||||
m_From.SendLocalizedMessage(
|
||||
1010306); // You currently have too many of this enhancement type to place another
|
||||
}
|
||||
else if (BaseBoat.FindBoatAt(m_From.Location, m_From.Map) != null)
|
||||
{
|
||||
m_From.SendMessage("You cannot place a vendor here");
|
||||
}
|
||||
else if (m_Town.Silver >= vendorList.Definition.Price)
|
||||
{
|
||||
BaseFactionVendor vendor = vendorList.Construct(m_Town, m_Faction);
|
||||
|
||||
vendor.MoveToWorld(m_From.Location, m_From.Map);
|
||||
vendor.Home = vendor.Location;
|
||||
if (vendor != null)
|
||||
{
|
||||
m_Town.Silver -= vendorList.Definition.Price;
|
||||
|
||||
vendor.MoveToWorld(m_From.Location, m_From.Map);
|
||||
vendor.Home = vendor.Location;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ namespace Server.Factions
|
|||
{
|
||||
public class HorseBreederGump : FactionGump
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private PlayerMobile m_From;
|
||||
private readonly Faction m_Faction;
|
||||
private readonly PlayerMobile m_From;
|
||||
|
||||
public HorseBreederGump(PlayerMobile from, Faction faction) : base(20, 30)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ namespace Server.Factions
|
|||
{
|
||||
public class JoinStoneGump : FactionGump
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private PlayerMobile m_From;
|
||||
private readonly Faction m_Faction;
|
||||
private readonly PlayerMobile m_From;
|
||||
|
||||
public JoinStoneGump(PlayerMobile from, Faction faction) : base(20, 30)
|
||||
{
|
||||
|
|
@ -19,11 +19,9 @@ namespace Server.Factions
|
|||
AddBackground(0, 0, 550, 440, 5054);
|
||||
AddBackground(10, 10, 530, 420, 3000);
|
||||
|
||||
|
||||
AddHtmlText(20, 30, 510, 20, faction.Definition.Header, false, false);
|
||||
AddHtmlText(20, 130, 510, 100, faction.Definition.About, true, true);
|
||||
|
||||
|
||||
AddHtmlLocalized(20, 60, 100, 20, 1011429); // Led By :
|
||||
AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody");
|
||||
|
||||
|
|
@ -33,7 +31,6 @@ namespace Server.Factions
|
|||
else
|
||||
AddHtml(125, 80, 350, 20, $"{faction.Tithe}%");
|
||||
|
||||
|
||||
AddButton(20, 400, 4005, 4007, 1);
|
||||
AddHtmlLocalized(55, 400, 200, 20, 1011425); // JOIN THIS FACTION
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Server.Factions
|
|||
public class LeaveFactionGump : FactionGump
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private PlayerMobile m_From;
|
||||
private readonly PlayerMobile m_From;
|
||||
|
||||
public LeaveFactionGump(PlayerMobile from, Faction faction) : base(20, 30)
|
||||
{
|
||||
|
|
@ -37,56 +37,56 @@ namespace Server.Factions
|
|||
switch (info.ButtonID)
|
||||
{
|
||||
case 1: // continue
|
||||
{
|
||||
if (!(m_From.Guild is Guild guild))
|
||||
{
|
||||
PlayerState pl = PlayerState.Find(m_From);
|
||||
|
||||
if (pl != null)
|
||||
if (!(m_From.Guild is Guild guild))
|
||||
{
|
||||
pl.Leaving = DateTime.UtcNow;
|
||||
|
||||
if (Faction.LeavePeriod == TimeSpan.FromDays(3.0))
|
||||
m_From.SendLocalizedMessage(1005065); // You will be removed from the faction in 3 days
|
||||
else
|
||||
m_From.SendMessage("You will be removed from the faction in {0} days.",
|
||||
Faction.LeavePeriod.TotalDays);
|
||||
}
|
||||
}
|
||||
else if (guild.Leader != m_From)
|
||||
{
|
||||
m_From.SendLocalizedMessage(
|
||||
1005061); // You cannot quit the faction because you are not the guild master
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1042285); // Your guild is now quitting the faction.
|
||||
|
||||
for (int i = 0; i < guild.Members.Count; ++i)
|
||||
{
|
||||
Mobile mob = guild.Members[i];
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
PlayerState pl = PlayerState.Find(m_From);
|
||||
|
||||
if (pl != null)
|
||||
{
|
||||
pl.Leaving = DateTime.UtcNow;
|
||||
|
||||
if (Faction.LeavePeriod == TimeSpan.FromDays(3.0))
|
||||
mob.SendLocalizedMessage(1005060); // Your guild will quit the faction in 3 days
|
||||
if (TimeSpan.FromDays(3.0) == Faction.LeavePeriod)
|
||||
m_From.SendLocalizedMessage(1005065); // You will be removed from the faction in 3 days
|
||||
else
|
||||
mob.SendMessage("Your guild will quit the faction in {0} days.",
|
||||
m_From.SendMessage("You will be removed from the faction in {0} days.",
|
||||
Faction.LeavePeriod.TotalDays);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (guild.Leader != m_From)
|
||||
{
|
||||
m_From.SendLocalizedMessage(
|
||||
1005061); // You cannot quit the faction because you are not the guild master
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1042285); // Your guild is now quitting the faction.
|
||||
|
||||
break;
|
||||
}
|
||||
for (int i = 0; i < guild.Members.Count; ++i)
|
||||
{
|
||||
Mobile mob = guild.Members[i];
|
||||
PlayerState pl = PlayerState.Find(mob);
|
||||
|
||||
if (pl != null)
|
||||
{
|
||||
pl.Leaving = DateTime.UtcNow;
|
||||
|
||||
if (TimeSpan.FromDays(3.0) == Faction.LeavePeriod)
|
||||
mob.SendLocalizedMessage(1005060); // Your guild will quit the faction in 3 days
|
||||
else
|
||||
mob.SendMessage("Your guild will quit the faction in {0} days.",
|
||||
Faction.LeavePeriod.TotalDays);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // cancel
|
||||
{
|
||||
m_From.SendLocalizedMessage(500737); // Canceled resignation.
|
||||
break;
|
||||
}
|
||||
{
|
||||
m_From.SendLocalizedMessage(500737); // Canceled resignation.
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ namespace Server.Factions
|
|||
{
|
||||
public class SheriffGump : FactionGump
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private PlayerMobile m_From;
|
||||
private Town m_Town;
|
||||
private readonly Faction m_Faction;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly Town m_Town;
|
||||
|
||||
public SheriffGump(PlayerMobile from, Faction faction, Town town) : base(50, 50)
|
||||
{
|
||||
|
|
@ -18,14 +18,11 @@ namespace Server.Factions
|
|||
m_Faction = faction;
|
||||
m_Town = town;
|
||||
|
||||
|
||||
AddPage(0);
|
||||
|
||||
AddBackground(0, 0, 320, 410, 5054);
|
||||
AddBackground(10, 10, 300, 390, 3000);
|
||||
|
||||
#region General
|
||||
|
||||
AddPage(1);
|
||||
|
||||
AddHtmlLocalized(20, 30, 260, 25, 1011431); // Sheriff
|
||||
|
|
@ -39,10 +36,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011441); // Exit
|
||||
AddButton(20, 360, 4005, 4007, 0);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Finances
|
||||
|
||||
AddPage(2);
|
||||
|
||||
int financeUpkeep = town.FinanceUpkeep;
|
||||
|
|
@ -70,10 +63,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Hire Guards
|
||||
|
||||
AddPage(3);
|
||||
|
||||
AddHtmlLocalized(20, 30, 300, 25, 1011494); // HIRE GUARDS
|
||||
|
|
@ -93,10 +82,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Guard Pages
|
||||
|
||||
for (int i = 0; i < guardLists.Count; ++i)
|
||||
{
|
||||
GuardList guardList = guardLists[i];
|
||||
|
|
@ -130,8 +115,6 @@ namespace Server.Factions
|
|||
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
|
||||
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
private void CenterItem(int itemID, int x, int y, int w, int h)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ namespace Server.Factions
|
|||
{
|
||||
public class TownStoneGump : FactionGump
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private PlayerMobile m_From;
|
||||
private Town m_Town;
|
||||
private readonly Faction m_Faction;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly Town m_Town;
|
||||
|
||||
public TownStoneGump(PlayerMobile from, Faction faction, Town town) : base(50, 50)
|
||||
{
|
||||
|
|
@ -51,65 +51,65 @@ namespace Server.Factions
|
|||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@ namespace Server.Factions
|
|||
{
|
||||
public class VoteGump : FactionGump
|
||||
{
|
||||
private Election m_Election;
|
||||
private PlayerMobile m_From;
|
||||
private readonly Election m_Election;
|
||||
private readonly PlayerMobile m_From;
|
||||
|
||||
public VoteGump(PlayerMobile from, Election election) : base(50, 50)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue