Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)

This commit is contained in:
Kamron Batman 2019-03-11 14:29:59 -07:00 • committed by GitHub
parent e748af4430
commit 513e54f70e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1094 changed files with 15913 additions and 21892 deletions

View file

@ -550,4 +550,4 @@ namespace Server.Factions
Campaign,
Election
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Accounting;
using Server.Commands;
using Server.Commands.Generic;
@ -239,36 +240,18 @@ namespace Server.Factions
return false;
IPooledEnumerable<IEntity> eable = mob.Map.GetObjectsInRange(mob.Location, range, items, mobs);
foreach (IEntity obj in eable)
if (type.IsInstanceOfType(obj))
{
eable.Free();
return true;
}
bool isInstance = eable.Any(type.IsInstanceOfType);
eable.Free();
return false;
return isInstance;
}
public static bool IsNearType(Mobile mob, Type[] types, int range)
{
IPooledEnumerable<IEntity> eable = mob.GetObjectsInRange(range);
foreach (IEntity obj in eable)
{
Type objType = obj.GetType();
for (int i = 0; i < types.Length; i++)
if (types[i].IsAssignableFrom(objType))
{
eable.Free();
return true;
}
}
bool found = eable.Any(obj => types.Any(t => t.IsInstanceOfType(obj)));
eable.Free();
return false;
return found;
}
public void RemovePlayerState(PlayerState pl)
@ -475,7 +458,7 @@ namespace Server.Factions
pm.SendLocalizedMessage(
1042161); // You cannot join a faction because your guild is an Order or Chaos type.
}
else if (!Guild.NewGuildSystem && guild.Enemies != null && guild.Enemies.Count > 0
else if (!Guild.NewGuildSystem && guild.Enemies?.Count > 0
) //CAN join w/wars in new system
{
pm.SendLocalizedMessage(1005056); // You cannot join a faction with active Wars
@ -1016,7 +999,7 @@ namespace Server.Factions
Player killerEPL = Player.Find(killer);
Player victimEPL = Player.Find(victim);
if (killerEPL != null && victimEPL != null && victimEPL.Power > 0 && victimState.CanGiveSilverTo(killer))
if (killerEPL != null && victimEPL?.Power > 0 && victimState.CanGiveSilverTo(killer))
{
int powerTransfer = Math.Max(1, victimEPL.Power / 5);
@ -1078,7 +1061,7 @@ namespace Server.Factions
Player killerEPL = Player.Find(killer);
Player victimEPL = Player.Find(victim);
if (killerEPL != null && victimEPL != null && victimEPL.Power > 0)
if (killerEPL != null && victimEPL?.Power > 0)
{
int powerTransfer = Math.Max(1, victimEPL.Power / 5);
@ -1385,4 +1368,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -44,7 +44,7 @@ namespace Server.Factions
{
get
{
if (Item == null || Item.Deleted)
if (Item?.Deleted != false)
return true;
return Expiration != DateTime.MinValue && DateTime.UtcNow >= Expiration;
@ -77,7 +77,7 @@ namespace Server.Factions
if (Item is IFactionItem item)
item.FactionItemState = null;
if (Faction != null && Faction.State.FactionItems.Contains(this))
if (Faction?.State.FactionItems.Contains(this) == true)
Faction.State.FactionItems.Remove(this);
}
@ -93,13 +93,7 @@ namespace Server.Factions
{
PlayerState pl = PlayerState.Find(mob);
if (pl == null)
return 0;
if (pl.Faction.IsCommander(mob))
return 9;
return pl.Rank.MaxWearables;
return pl == null ? 0 : pl.Faction.IsCommander(mob) ? 9 : pl.Rank.MaxWearables;
}
public static FactionItem Find(Item item)
@ -140,4 +134,4 @@ namespace Server.Factions
return item;
}
}
}
}

View file

@ -8,7 +8,7 @@ namespace Server.Factions
{
Movable = false;
if (Instance == null || Instance.Deleted)
if (Instance?.Deleted == true)
Instance = this;
else
base.Delete();
@ -87,4 +87,4 @@ namespace Server.Factions
Town
}
}
}
}

View file

@ -136,7 +136,7 @@ namespace Server.Factions
{
return Definition.Sort - other.Definition.Sort;
}
public int CompareTo(object obj)
{
return Definition.Sort - ((Town)obj).Definition.Sort;
@ -386,18 +386,14 @@ namespace Server.Factions
public bool IsSheriff(Mobile mob)
{
if (mob == null || mob.Deleted)
return false;
return mob.AccessLevel >= AccessLevel.GameMaster || mob == Sheriff;
return mob?.Deleted == false &&
(mob.AccessLevel >= AccessLevel.GameMaster || mob == Sheriff);
}
public bool IsFinance(Mobile mob)
{
if (mob == null || mob.Deleted)
return false;
return mob.AccessLevel >= AccessLevel.GameMaster || mob == Finance;
return mob?.Deleted == false &&
(mob.AccessLevel >= AccessLevel.GameMaster || mob == Finance);
}
public void Capture(Faction f)
@ -511,4 +507,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -31,16 +31,16 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.PendingPeriod - DateTime.UtcNow;
int days = (int)(toGo.TotalDays + 0.5);
AddHtmlLocalized(20, 40, 380, 20, 1038034, false, false); // A new election campaign is pending
AddHtmlLocalized(20, 40, 380, 20, 1038034); // A new election campaign is pending
if (days > 0)
{
AddHtmlLocalized(20, 60, 280, 20, 1018062, false, false); // Days until next election :
AddHtmlLocalized(20, 60, 280, 20, 1018062); // Days until next election :
AddLabel(300, 60, 0, days.ToString());
}
else
{
AddHtmlLocalized(20, 60, 280, 20, 1018059, false, false); // Election campaigning begins tonight.
AddHtmlLocalized(20, 60, 280, 20, 1018059); // Election campaigning begins tonight.
}
break;
@ -50,31 +50,29 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.CampaignPeriod - DateTime.UtcNow;
int days = (int)(toGo.TotalDays + 0.5);
AddHtmlLocalized(20, 40, 380, 20, 1018058, false, false); // There is an election campaign in progress.
AddHtmlLocalized(20, 40, 380, 20, 1018058); // There is an election campaign in progress.
if (days > 0)
{
AddHtmlLocalized(20, 60, 280, 20, 1038033, false, false); // Days to go:
AddHtmlLocalized(20, 60, 280, 20, 1038033); // Days to go:
AddLabel(300, 60, 0, days.ToString());
}
else
{
AddHtmlLocalized(20, 60, 280, 20, 1018061, false,
false); // Campaign in progress. Voting begins tonight.
AddHtmlLocalized(20, 60, 280, 20, 1018061); // Campaign in progress. Voting begins tonight.
}
if (m_Election.CanBeCandidate(m_From))
{
AddButton(20, 110, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 110, 350, 20, 1011427, false, false); // CAMPAIGN FOR LEADERSHIP
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, false,
false); // You must have a higher rank to run for office
AddHtmlLocalized(20, 100, 380, 20, 1010118); // You must have a higher rank to run for office
}
break;
@ -84,20 +82,20 @@ namespace Server.Factions
TimeSpan toGo = election.LastStateTime + Election.VotingPeriod - DateTime.UtcNow;
int days = (int)Math.Ceiling(toGo.TotalDays);
AddHtmlLocalized(20, 40, 380, 20, 1018060, false, false); // 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, false, false);
AddHtmlLocalized(20, 60, 280, 20, 1038033);
AddLabel(300, 60, 0, days.ToString());
AddHtmlLocalized(55, 100, 380, 20, 1011428, false, false); // VOTE FOR LEADERSHIP
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 100, 380, 20, 1011428); // VOTE FOR LEADERSHIP
AddButton(20, 100, 4005, 4007, 1);
break;
}
}
AddButton(20, 140, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 140, 350, 20, 1011012, false, false); // CANCEL
AddButton(20, 140, 4005, 4007, 0);
AddHtmlLocalized(55, 140, 350, 20, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -126,4 +124,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -13,11 +13,7 @@ namespace Server.Factions
private Election m_Election;
private int m_Page;
public ElectionManagementGump(Election election) : this(election, null, 0)
{
}
public ElectionManagementGump(Election election, Candidate candidate, int page) : base(40, 40)
public ElectionManagementGump(Election election, Candidate candidate = null, int page = 0) : base(40, 40)
{
m_Election = election;
m_Candidate = candidate;
@ -30,40 +26,39 @@ namespace Server.Factions
AddBackground(0, 0, 448, 354, 9270);
AddAlphaRegion(10, 10, 428, 334);
AddHtml(10, 10, 428, 20, Color(Center("Candidate Management"), LabelColor), false, false);
AddHtml(10, 10, 428, 20, Color(Center("Candidate Management"), LabelColor));
AddHtml(45, 35, 100, 20, Color("Player Name:", LabelColor), false, false);
AddHtml(145, 35, 100, 20, Color(candidate.Mobile == null ? "null" : candidate.Mobile.Name, LabelColor),
false, false);
AddHtml(45, 35, 100, 20, Color("Player Name:", LabelColor));
AddHtml(145, 35, 100, 20, Color(candidate.Mobile == null ? "null" : candidate.Mobile.Name, LabelColor));
AddHtml(45, 55, 100, 20, Color("Vote Count:", LabelColor), false, false);
AddHtml(145, 55, 100, 20, Color(candidate.Votes.ToString(), LabelColor), false, false);
AddHtml(45, 55, 100, 20, Color("Vote Count:", LabelColor));
AddHtml(145, 55, 100, 20, Color(candidate.Votes.ToString(), LabelColor));
AddButton(12, 73, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtml(45, 75, 100, 20, Color("Drop Candidate", LabelColor), false, false);
AddButton(12, 73, 4005, 4007, 1);
AddHtml(45, 75, 100, 20, Color("Drop Candidate", LabelColor));
AddImageTiled(13, 99, 422, 242, 9264);
AddImageTiled(14, 100, 420, 240, 9274);
AddAlphaRegion(14, 100, 420, 240);
AddHtml(14, 100, 420, 20, Color(Center("Voters"), LabelColor), false, false);
AddHtml(14, 100, 420, 20, Color(Center("Voters"), LabelColor));
if (page > 0)
AddButton(397, 104, 0x15E3, 0x15E7, 2, GumpButtonType.Reply, 0);
AddButton(397, 104, 0x15E3, 0x15E7, 2);
else
AddImage(397, 104, 0x25EA);
if ((page + 1) * 10 < candidate.Voters.Count)
AddButton(414, 104, 0x15E1, 0x15E5, 3, GumpButtonType.Reply, 0);
AddButton(414, 104, 0x15E1, 0x15E5, 3);
else
AddImage(414, 104, 0x25E6);
AddHtml(14, 120, 30, 20, Color(Center("DEL"), LabelColor), false, false);
AddHtml(47, 120, 150, 20, Color("Name", LabelColor), false, false);
AddHtml(195, 120, 100, 20, Color(Center("Address"), LabelColor), false, false);
AddHtml(295, 120, 80, 20, Color(Center("Time"), LabelColor), false, false);
AddHtml(355, 120, 60, 20, Color(Center("Legit"), LabelColor), false, false);
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));
AddHtml(295, 120, 80, 20, Color(Center("Time"), LabelColor));
AddHtml(355, 120, 60, 20, Color(Center("Legit"), LabelColor));
int idx = 0;
@ -71,7 +66,7 @@ namespace Server.Factions
{
Voter voter = candidate.Voters[i];
AddButton(13, 138 + idx * 20, 4002, 4004, 4 + i, GumpButtonType.Reply, 0);
AddButton(13, 138 + idx * 20, 4002, 4004, 4 + i);
object[] fields = voter.AcquireFields();
@ -83,23 +78,23 @@ namespace Server.Factions
if (obj is Mobile mobile)
{
AddHtml(x + 2, 140 + idx * 20, 150, 20, Color(mobile.Name, LabelColor), false, false);
AddHtml(x + 2, 140 + idx * 20, 150, 20, Color(mobile.Name, LabelColor));
x += 150;
}
else if (obj is IPAddress)
{
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(obj.ToString()), LabelColor), false, false);
AddHtml(x, 140 + idx * 20, 100, 20, Color(Center(obj.ToString()), LabelColor));
x += 100;
}
else if (obj is DateTime time)
{
AddHtml(x, 140 + idx * 20, 80, 20,
Color(Center(FormatTimeSpan(time - election.LastStateTime)), LabelColor), false, false);
Color(Center(FormatTimeSpan(time - election.LastStateTime)), LabelColor));
x += 80;
}
else if (obj is int i1)
{
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center(i1 + "%"), LabelColor), false, false);
AddHtml(x, 140 + idx * 20, 60, 20, Color(Center(i1 + "%"), LabelColor));
x += 60;
}
}
@ -110,23 +105,23 @@ namespace Server.Factions
AddBackground(0, 0, 288, 334, 9270);
AddAlphaRegion(10, 10, 268, 314);
AddHtml(10, 10, 268, 20, Color(Center("Election Management"), LabelColor), false, false);
AddHtml(10, 10, 268, 20, Color(Center("Election Management"), LabelColor));
AddHtml(45, 35, 100, 20, Color("Current State:", LabelColor), false, false);
AddHtml(145, 35, 100, 20, Color(election.State.ToString(), LabelColor), false, false);
AddHtml(45, 35, 100, 20, Color("Current State:", LabelColor));
AddHtml(145, 35, 100, 20, Color(election.State.ToString(), LabelColor));
AddButton(12, 53, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtml(45, 55, 100, 20, Color("Transition Time:", LabelColor), false, false);
AddHtml(145, 55, 100, 20, Color(FormatTimeSpan(election.NextStateTime), LabelColor), false, false);
AddButton(12, 53, 4005, 4007, 1);
AddHtml(45, 55, 100, 20, Color("Transition Time:", LabelColor));
AddHtml(145, 55, 100, 20, Color(FormatTimeSpan(election.NextStateTime), LabelColor));
AddImageTiled(13, 79, 262, 242, 9264);
AddImageTiled(14, 80, 260, 240, 9274);
AddAlphaRegion(14, 80, 260, 240);
AddHtml(14, 80, 260, 20, Color(Center("Candidates"), LabelColor), false, false);
AddHtml(14, 100, 30, 20, Color(Center("-->"), LabelColor), false, false);
AddHtml(47, 100, 150, 20, Color("Name", LabelColor), false, false);
AddHtml(195, 100, 80, 20, Color(Center("Votes"), LabelColor), false, false);
AddHtml(14, 80, 260, 20, Color(Center("Candidates"), LabelColor));
AddHtml(14, 100, 30, 20, Color(Center("-->"), LabelColor));
AddHtml(47, 100, 150, 20, Color("Name", LabelColor));
AddHtml(195, 100, 80, 20, Color(Center("Votes"), LabelColor));
for (int i = 0; i < election.Candidates.Count; ++i)
{
@ -136,9 +131,9 @@ namespace Server.Factions
if (mob == null)
continue;
AddButton(13, 118 + i * 20, 4005, 4007, 2 + i, GumpButtonType.Reply, 0);
AddHtml(47, 120 + i * 20, 150, 20, Color(mob.Name, LabelColor), false, false);
AddHtml(195, 120 + i * 20, 80, 20, Color(Center(cd.Votes.ToString()), LabelColor), false, false);
AddButton(13, 118 + i * 20, 4005, 4007, 2 + i);
AddHtml(47, 120 + i * 20, 150, 20, Color(mob.Name, LabelColor));
AddHtml(195, 120 + i * 20, 80, 20, Color(Center(cd.Votes.ToString()), LabelColor));
}
}
}
@ -181,7 +176,7 @@ namespace Server.Factions
bid -= 2;
if (bid >= 0 && bid < m_Election.Candidates.Count)
from.SendGump(new ElectionManagementGump(m_Election, m_Election.Candidates[bid], 0));
from.SendGump(new ElectionManagementGump(m_Election, m_Election.Candidates[bid]));
}
}
else
@ -216,4 +211,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -37,10 +37,10 @@ namespace Server.Factions
public void AddHtmlText(int x, int y, int width, int height, TextDefinition text, bool back, bool scroll)
{
if (text != null && text.Number > 0)
if (text?.Number > 0)
AddHtmlLocalized(x, y, width, height, text.Number, back, scroll);
else if (text?.String != null)
AddHtml(x, y, width, height, text.String, back, scroll);
}
}
}
}

View file

@ -32,33 +32,33 @@ namespace Server.Factions
AddBackground(0, 0, 320, 270, 5054);
AddBackground(10, 10, 300, 250, 3000);
AddHtmlLocalized(20, 20, 210, 25, 1011569, false, false); // Imbue with Faction properties?
AddHtmlLocalized(20, 20, 210, 25, 1011569); // Imbue with Faction properties?
AddHtmlLocalized(20, 60, 170, 25, 1018302, false, false); // Item quality:
AddHtmlLocalized(175, 60, 100, 25, 1018305 - quality, false, false); // Exceptional, Average, Low
AddHtmlLocalized(20, 60, 170, 25, 1018302); // Item quality:
AddHtmlLocalized(175, 60, 100, 25, 1018305 - quality); // Exceptional, Average, Low
AddHtmlLocalized(20, 80, 170, 25, 1011572, false, false); // Item Cost :
AddHtmlLocalized(20, 80, 170, 25, 1011572); // Item Cost :
AddLabel(175, 80, 0x34, def.SilverCost.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 100, 170, 25, 1011573, false, false); // Your Silver :
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, false, false); // Primary Color
AddHtmlLocalized(150, 140, 150, 25, 1011570); // Primary Color
AddRadio(20, 160, 210, 211, false, 2);
AddLabel(55, 160, m_Faction.Definition.HueSecondary - 1, "*****");
AddHtmlLocalized(150, 160, 150, 25, 1011571, false, false); // Secondary Color
AddHtmlLocalized(150, 160, 150, 25, 1011571); // Secondary Color
AddHtmlLocalized(55, 200, 200, 25, 1011011, false, false); // CONTINUE
AddButton(20, 200, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 200, 200, 25, 1011011); // CONTINUE
AddButton(20, 200, 4005, 4007, 1);
AddHtmlLocalized(55, 230, 200, 25, 1011012, false, false); // CANCEL
AddButton(20, 230, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 230, 200, 25, 1011012); // CANCEL
AddButton(20, 230, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -89,7 +89,7 @@ namespace Server.Factions
}
}
if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
m_Mobile.SendGump(new CraftGump(m_Mobile, m_CraftSystem, m_Tool, m_Notice));
else if (m_Notice is string s)
m_Mobile.SendMessage(s);
@ -97,4 +97,4 @@ namespace Server.Factions
m_Mobile.SendLocalizedMessage(i);
}
}
}
}

View file

@ -26,25 +26,25 @@ namespace Server.Factions
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, 60, 100, 20, 1011429); // Led By :
AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody");
AddHtmlLocalized(20, 80, 100, 20, 1011457, false, false); // Tithe rate :
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, false, false);
AddHtmlLocalized(125, 80, 350, 20, 1011480 + faction.Tithe / 10);
else
AddHtml(125, 80, 350, 20, faction.Tithe + "%", false, false);
AddHtml(125, 80, 350, 20, faction.Tithe + "%");
AddHtmlLocalized(20, 100, 100, 20, 1011458, false, false); // Traps placed :
AddHtml(125, 100, 50, 20, faction.Traps.Count.ToString(), false, false);
AddHtmlLocalized(20, 100, 100, 20, 1011458); // Traps placed :
AddHtml(125, 100, 50, 20, faction.Traps.Count.ToString());
AddHtmlLocalized(55, 225, 200, 20, 1011428, false, false); // VOTE FOR LEADERSHIP
AddButton(20, 225, 4005, 4007, ToButtonID(0, 0), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 225, 200, 20, 1011428); // VOTE FOR LEADERSHIP
AddButton(20, 225, 4005, 4007, ToButtonID(0, 0));
AddHtmlLocalized(55, 150, 100, 20, 1011430, false, false); // CITY STATUS
AddHtmlLocalized(55, 150, 100, 20, 1011430); // CITY STATUS
AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(55, 175, 100, 20, 1011444, false, false); // STATISTICS
AddHtmlLocalized(55, 175, 100, 20, 1011444); // STATISTICS
AddButton(20, 175, 4005, 4007, 0, GumpButtonType.Page, 4);
bool isMerchantQualified = MerchantTitles.HasMerchantQualifications(from);
@ -53,31 +53,31 @@ namespace Server.Factions
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);
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, false, false); // DECLARE FACTION MERCHANT
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, false, false); // MERCHANT OPTIONS
AddHtmlLocalized(55, 200, 250, 20, 1011467); // MERCHANT OPTIONS
AddImage(20, 200, 4020);
}
AddHtmlLocalized(55, 250, 300, 20, 1011461, false, false); // COMMANDER OPTIONS
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, false, false); // LEAVE THIS FACTION
AddButton(20, 275, 4005, 4007, ToButtonID(0, 1), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 275, 300, 20, 1011426); // LEAVE THIS FACTION
AddButton(20, 275, 4005, 4007, ToButtonID(0, 1));
AddHtmlLocalized(55, 300, 200, 20, 1011441, false, false); // EXIT
AddButton(20, 300, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 300, 200, 20, 1011441); // EXIT
AddButton(20, 300, 4005, 4007, 0);
#endregion
@ -85,7 +85,7 @@ namespace Server.Factions
AddPage(2);
AddHtmlLocalized(20, 30, 250, 20, 1011430, false, false); // CITY STATUS
AddHtmlLocalized(20, 30, 250, 20, 1011430); // CITY STATUS
List<Town> towns = Town.Towns;
@ -97,11 +97,11 @@ namespace Server.Factions
if (town.Owner == null)
{
AddHtmlLocalized(200, 55 + i * 30, 150, 20, 1011462, false, false); // : Neutral
AddHtmlLocalized(200, 55 + i * 30, 150, 20, 1011462); // : Neutral
}
else
{
AddHtmlLocalized(200, 55 + i * 30, 150, 20, town.Owner.Definition.OwnerLabel, false, false);
AddHtmlLocalized(200, 55 + i * 30, 150, 20, town.Owner.Definition.OwnerLabel);
BaseMonolith monolith = town.Monolith;
@ -111,12 +111,12 @@ namespace Server.Factions
AddImage(20, 300, 2361);
AddHtmlLocalized(45, 295, 300, 20, 1011491, false, false); // sigil may be recaptured
AddHtmlLocalized(45, 295, 300, 20, 1011491); // sigil may be recaptured
AddImage(20, 320, 2360);
AddHtmlLocalized(45, 315, 300, 20, 1011492, false, false); // sigil may not be recaptured
AddHtmlLocalized(45, 315, 300, 20, 1011492); // sigil may not be recaptured
AddHtmlLocalized(55, 350, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 350, 100, 20, 1011447); // BACK
AddButton(20, 350, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -125,18 +125,18 @@ namespace Server.Factions
AddPage(4);
AddHtmlLocalized(20, 30, 150, 20, 1011444, false, false); // STATISTICS
AddHtmlLocalized(20, 30, 150, 20, 1011444); // STATISTICS
AddHtmlLocalized(20, 100, 100, 20, 1011445, false, false); // Name :
AddHtml(120, 100, 150, 20, from.Name, false, false);
AddHtmlLocalized(20, 100, 100, 20, 1011445); // Name :
AddHtml(120, 100, 150, 20, from.Name);
AddHtmlLocalized(20, 130, 100, 20, 1018064, false, false); // score :
AddHtml(120, 130, 100, 20, (pl?.KillPoints ?? 0).ToString(), false, false);
AddHtmlLocalized(20, 130, 100, 20, 1018064); // score :
AddHtml(120, 130, 100, 20, (pl?.KillPoints ?? 0).ToString());
AddHtmlLocalized(20, 160, 100, 20, 1011446, false, false); // Rank :
AddHtml(120, 160, 100, 20, (pl?.Rank.Rank ?? 0).ToString(), false, false);
AddHtmlLocalized(20, 160, 100, 20, 1011446); // Rank :
AddHtml(120, 160, 100, 20, (pl?.Rank.Rank ?? 0).ToString());
AddHtmlLocalized(55, 250, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 250, 100, 20, 1011447); // BACK
AddButton(20, 250, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -147,9 +147,9 @@ namespace Server.Factions
{
AddPage(5);
AddHtmlLocalized(20, 30, 250, 20, 1011467, false, false); // MERCHANT OPTIONS
AddHtmlLocalized(20, 30, 250, 20, 1011467); // MERCHANT OPTIONS
AddHtmlLocalized(20, 80, 300, 20, 1011473, false, false); // Select the title you wish to display
AddHtmlLocalized(20, 80, 300, 20, 1011473); // Select the title you wish to display
MerchantTitleInfo[] infos = MerchantTitles.Info;
@ -158,14 +158,14 @@ namespace Server.Factions
MerchantTitleInfo info = infos[i];
if (MerchantTitles.IsQualified(from, info))
AddButton(20, 100 + i * 30, 4005, 4007, ToButtonID(1, i + 1), GumpButtonType.Reply, 0);
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, false, false); // BACK
AddHtmlLocalized(55, 340, 100, 20, 1011447); // BACK
AddButton(20, 340, 4005, 4007, 0, GumpButtonType.Page, 1);
}
@ -179,27 +179,27 @@ namespace Server.Factions
AddPage(6);
AddHtmlLocalized(20, 30, 200, 20, 1011461, false, false); // COMMANDER OPTIONS
AddHtmlLocalized(20, 30, 200, 20, 1011461); // COMMANDER OPTIONS
AddHtmlLocalized(20, 70, 120, 20, 1011457, false, false); // Tithe rate :
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, false, false);
AddHtmlLocalized(140, 70, 250, 20, 1011480 + faction.Tithe / 10);
else
AddHtml(140, 70, 250, 20, faction.Tithe + "%", false, false);
AddHtml(140, 70, 250, 20, faction.Tithe + "%");
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(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, false, false); // CHANGE TITHE RATE
AddHtmlLocalized(55, 130, 200, 20, 1011478); // CHANGE TITHE RATE
AddButton(20, 130, 4005, 4007, 0, GumpButtonType.Page, 8);
AddHtmlLocalized(55, 160, 200, 20, 1018301, false, false); // TRANSFER SILVER
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, false, false); // BACK
AddHtmlLocalized(55, 310, 100, 20, 1011447); // BACK
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -210,9 +210,9 @@ namespace Server.Factions
{
AddPage(7);
AddHtmlLocalized(20, 30, 250, 20, 1011476, false, false); // TOWN FINANCE
AddHtmlLocalized(20, 30, 250, 20, 1011476); // TOWN FINANCE
AddHtmlLocalized(20, 50, 400, 20, 1011477, false, false); // Select a town to transfer 10000 silver to
AddHtmlLocalized(20, 50, 400, 20, 1011477); // Select a town to transfer 10000 silver to
for (int i = 0; i < towns.Count; ++i)
{
@ -221,12 +221,12 @@ namespace Server.Factions
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);
AddButton(20, 75 + i * 30, 4005, 4007, ToButtonID(2, i));
else
AddImage(20, 75 + i * 30, 4020);
}
AddHtmlLocalized(55, 310, 100, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 310, 100, 20, 1011447); // BACK
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
}
@ -236,7 +236,7 @@ namespace Server.Factions
AddPage(8);
AddHtmlLocalized(20, 30, 400, 20, 1011479, false, false); // Select the % for the new tithe rate
AddHtmlLocalized(20, 30, 400, 20, 1011479); // Select the % for the new tithe rate
int y = 55;
@ -245,8 +245,8 @@ namespace Server.Factions
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);
AddHtmlLocalized(55, y, 300, 20, 1011480 + i);
AddButton(20, y, 4005, 4007, ToButtonID(3, i));
y += 20;
@ -254,7 +254,7 @@ namespace Server.Factions
y += 5;
}
AddHtmlLocalized(55, 310, 300, 20, 1011447, false, false); // BACK
AddHtmlLocalized(55, 310, 300, 20, 1011447); // BACK
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -354,4 +354,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -35,20 +35,20 @@ namespace Server.Factions
AddPage(1);
AddHtmlLocalized(20, 30, 260, 25, 1011541, false, false); // FINANCE MINISTER
AddHtmlLocalized(20, 30, 260, 25, 1011541); // FINANCE MINISTER
AddHtmlLocalized(55, 90, 200, 25, 1011539, false, false); // CHANGE PRICES
AddHtmlLocalized(55, 90, 200, 25, 1011539); // CHANGE PRICES
AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(55, 120, 200, 25, 1011540, false, false); // BUY SHOPKEEPERS
AddHtmlLocalized(55, 120, 200, 25, 1011540); // BUY SHOPKEEPERS
AddButton(20, 120, 4005, 4007, 0, GumpButtonType.Page, 3);
AddHtmlLocalized(55, 150, 200, 25, 1011495, false, false); // VIEW FINANCES
AddHtmlLocalized(55, 150, 200, 25, 1011495); // VIEW FINANCES
AddButton(20, 150, 4005, 4007, 0, GumpButtonType.Page, 4);
AddHtmlLocalized(55, 360, 200, 25, 1011441, false, false); // EXIT
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 360, 200, 25, 1011441); // EXIT
AddButton(20, 360, 4005, 4007, 0);
#endregion
@ -56,7 +56,7 @@ namespace Server.Factions
AddPage(2);
AddHtmlLocalized(20, 30, 200, 25, 1011539, false, false); // CHANGE PRICES
AddHtmlLocalized(20, 30, 200, 25, 1011539); // CHANGE PRICES
for (int i = 0; i < m_PriceOffsets.Length; ++i)
{
@ -74,12 +74,12 @@ namespace Server.Factions
}
AddRadio(20, 270, 208, 209, town.Tax == 0, 0);
AddHtmlLocalized(55, 270, 90, 25, 1011542, false, false); // normal
AddHtmlLocalized(55, 270, 90, 25, 1011542); // normal
AddHtmlLocalized(55, 330, 200, 25, 1011509, false, false); // Set Prices
AddButton(20, 330, 4005, 4007, ToButtonID(0, 0), GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 330, 200, 25, 1011509); // Set Prices
AddButton(20, 330, 4005, 4007, ToButtonID(0, 0));
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -88,7 +88,7 @@ namespace Server.Factions
AddPage(3);
AddHtmlLocalized(20, 30, 200, 25, 1011540, false, false); // BUY SHOPKEEPERS
AddHtmlLocalized(20, 30, 200, 25, 1011540); // BUY SHOPKEEPERS
List<VendorList> vendorLists = town.VendorLists;
@ -101,7 +101,7 @@ namespace Server.Factions
AddHtmlText(100, 90 + i * 40, 200, 25, list.Definition.Label, false, false);
}
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -116,24 +116,24 @@ namespace Server.Factions
int netCashFlow = town.NetCashFlow;
AddHtmlLocalized(20, 30, 300, 25, 1011524, false, false); // FINANCE STATEMENT
AddHtmlLocalized(20, 30, 300, 25, 1011524); // FINANCE STATEMENT
AddHtmlLocalized(20, 80, 300, 25, 1011538, false, false); // Current total money for town :
AddHtmlLocalized(20, 80, 300, 25, 1011538); // Current total money for town :
AddLabel(20, 100, 0x44, town.Silver.ToString());
AddHtmlLocalized(20, 130, 300, 25, 1011520, false, false); // Finance Minister Upkeep :
AddHtmlLocalized(20, 130, 300, 25, 1011520); // Finance Minister Upkeep :
AddLabel(20, 150, 0x44, financeUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 300, 25, 1011521, false, false); // Sheriff Upkeep :
AddHtmlLocalized(20, 180, 300, 25, 1011521); // Sheriff Upkeep :
AddLabel(20, 200, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 230, 300, 25, 1011522, false, false); // Town Income :
AddHtmlLocalized(20, 230, 300, 25, 1011522); // Town Income :
AddLabel(20, 250, 0x44, dailyIncome.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 280, 300, 25, 1011523, false, false); // Net Cash flow per day :
AddHtmlLocalized(20, 280, 300, 25, 1011523); // Net Cash flow per day :
AddLabel(20, 300, 0x44, netCashFlow.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -149,31 +149,31 @@ namespace Server.Factions
AddHtmlText(60, 30, 300, 25, vendorList.Definition.Header, false, false);
AddItem(20, 30, vendorList.Definition.ItemID);
AddHtmlLocalized(20, 90, 200, 25, 1011514, false, false); // You have :
AddHtmlLocalized(20, 90, 200, 25, 1011514); // You have :
AddLabel(230, 90, 0x26, vendorList.Vendors.Count.ToString());
AddHtmlLocalized(20, 120, 200, 25, 1011515, false, false); // Maximum :
AddHtmlLocalized(20, 120, 200, 25, 1011515); // Maximum :
AddLabel(230, 120, 0x256, vendorList.Definition.Maximum.ToString());
AddHtmlLocalized(20, 150, 200, 25, 1011516, false, false); // Cost :
AddHtmlLocalized(20, 150, 200, 25, 1011516); // Cost :
AddLabel(230, 150, 0x44, vendorList.Definition.Price.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 200, 25, 1011517, false, false); // Daily Pay :
AddHtmlLocalized(20, 180, 200, 25, 1011517); // Daily Pay :
AddLabel(230, 180, 0x37, vendorList.Definition.Upkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 210, 200, 25, 1011518, false, false); // Current Silver :
AddHtmlLocalized(20, 210, 200, 25, 1011518); // Current Silver :
AddLabel(230, 210, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 240, 200, 25, 1011519, false, false); // Current Payroll :
AddHtmlLocalized(20, 240, 200, 25, 1011519); // Current Payroll :
AddLabel(230, 240, 0x44, financeUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlText(55, 300, 200, 25, vendorList.Definition.Label, false, false);
if (town.Silver >= vendorList.Definition.Price)
AddButton(20, 300, 4005, 4007, ToButtonID(1, i), GumpButtonType.Reply, 0);
AddButton(20, 300, 4005, 4007, ToButtonID(1, i));
else
AddImage(20, 300, 4020);
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
}
@ -289,4 +289,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -22,7 +22,7 @@ namespace Server.Factions
AddHtmlText(20, 30, 300, 25, faction.Definition.Header, false, false);
AddHtmlLocalized(20, 60, 300, 25, 1018306, false, false); // Purchase a Faction War Horse
AddHtmlLocalized(20, 60, 300, 25, 1018306); // Purchase a Faction War Horse
AddItem(70, 120, 0x3FFE);
AddItem(150, 120, 0xEF2);
@ -31,11 +31,11 @@ namespace Server.Factions
AddItem(150, 150, 0xEEF);
AddLabel(190, 152, 0x3E3, FactionWarHorse.GoldPrice.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(55, 210, 200, 25, 1011011, false, false); // CONTINUE
AddButton(20, 210, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 210, 200, 25, 1011011); // CONTINUE
AddButton(20, 210, 4005, 4007, 1);
AddHtmlLocalized(55, 240, 200, 25, 1011012, false, false); // CANCEL
AddButton(20, 240, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 240, 200, 25, 1011012); // CANCEL
AddButton(20, 240, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -88,4 +88,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -24,21 +24,21 @@ namespace Server.Factions
AddHtmlText(20, 130, 510, 100, faction.Definition.About, true, true);
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, 60, 100, 20, 1011429); // Led By :
AddHtml(125, 60, 200, 20, faction.Commander != null ? faction.Commander.Name : "Nobody");
AddHtmlLocalized(20, 80, 100, 20, 1011457, false, false); // Tithe rate :
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, false, false);
AddHtmlLocalized(125, 80, 350, 20, 1011480 + faction.Tithe / 10);
else
AddHtml(125, 80, 350, 20, faction.Tithe + "%", false, false);
AddHtml(125, 80, 350, 20, faction.Tithe + "%");
AddButton(20, 400, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 400, 200, 20, 1011425, false, false); // JOIN THIS FACTION
AddButton(20, 400, 4005, 4007, 1);
AddHtmlLocalized(55, 400, 200, 20, 1011425); // JOIN THIS FACTION
AddButton(300, 400, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(335, 400, 200, 20, 1011012, false, false); // CANCEL
AddButton(300, 400, 4005, 4007, 0);
AddHtmlLocalized(335, 400, 200, 20, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -47,4 +47,4 @@ namespace Server.Factions
m_Faction.OnJoinAccepted(m_From);
}
}
}
}

View file

@ -25,11 +25,11 @@ namespace Server.Factions
else
AddHtmlLocalized(20, 15, 230, 60, 1018063, true, true); // Are you sure you want to leave this faction?
AddHtmlLocalized(55, 80, 75, 20, 1011011, false, false); // CONTINUE
AddButton(20, 80, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 80, 75, 20, 1011011); // CONTINUE
AddButton(20, 80, 4005, 4007, 1);
AddHtmlLocalized(170, 80, 75, 20, 1011012, false, false); // CANCEL
AddButton(135, 80, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(170, 80, 75, 20, 1011012); // CANCEL
AddButton(135, 80, 4005, 4007, 2);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -90,4 +90,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -28,16 +28,16 @@ namespace Server.Factions
AddPage(1);
AddHtmlLocalized(20, 30, 260, 25, 1011431, false, false); // Sheriff
AddHtmlLocalized(20, 30, 260, 25, 1011431); // Sheriff
AddHtmlLocalized(55, 90, 200, 25, 1011494, false, false); // HIRE GUARDS
AddHtmlLocalized(55, 90, 200, 25, 1011494); // HIRE GUARDS
AddButton(20, 90, 4005, 4007, 0, GumpButtonType.Page, 3);
AddHtmlLocalized(55, 120, 200, 25, 1011495, false, false); // VIEW FINANCES
AddHtmlLocalized(55, 120, 200, 25, 1011495); // VIEW FINANCES
AddButton(20, 120, 4005, 4007, 0, GumpButtonType.Page, 2);
AddHtmlLocalized(55, 360, 200, 25, 1011441, false, false); // Exit
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 360, 200, 25, 1011441); // Exit
AddButton(20, 360, 4005, 4007, 0);
#endregion
@ -50,24 +50,24 @@ namespace Server.Factions
int dailyIncome = town.DailyIncome;
int netCashFlow = town.NetCashFlow;
AddHtmlLocalized(20, 30, 300, 25, 1011524, false, false); // FINANCE STATEMENT
AddHtmlLocalized(20, 30, 300, 25, 1011524); // FINANCE STATEMENT
AddHtmlLocalized(20, 80, 300, 25, 1011538, false, false); // Current total money for town :
AddHtmlLocalized(20, 80, 300, 25, 1011538); // Current total money for town :
AddLabel(20, 100, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 130, 300, 25, 1011520, false, false); // Finance Minister Upkeep :
AddHtmlLocalized(20, 130, 300, 25, 1011520); // Finance Minister Upkeep :
AddLabel(20, 150, 0x44, financeUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 300, 25, 1011521, false, false); // Sheriff Upkeep :
AddHtmlLocalized(20, 180, 300, 25, 1011521); // Sheriff Upkeep :
AddLabel(20, 200, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 230, 300, 25, 1011522, false, false); // Town Income :
AddHtmlLocalized(20, 230, 300, 25, 1011522); // Town Income :
AddLabel(20, 250, 0x44, dailyIncome.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 280, 300, 25, 1011523, false, false); // Net Cash flow per day :
AddHtmlLocalized(20, 280, 300, 25, 1011523); // Net Cash flow per day :
AddLabel(20, 300, 0x44, netCashFlow.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -76,7 +76,7 @@ namespace Server.Factions
AddPage(3);
AddHtmlLocalized(20, 30, 300, 25, 1011494, false, false); // HIRE GUARDS
AddHtmlLocalized(20, 30, 300, 25, 1011494); // HIRE GUARDS
List<GuardList> guardLists = town.GuardLists;
@ -90,7 +90,7 @@ namespace Server.Factions
AddHtmlText(120, y, 200, 25, guardList.Definition.Header, false, false);
}
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 1);
#endregion
@ -106,28 +106,28 @@ namespace Server.Factions
AddHtmlText(90, 30, 300, 25, guardList.Definition.Header, false, false);
CenterItem(guardList.Definition.ItemID, 10, 10, 80, 80);
AddHtmlLocalized(20, 90, 200, 25, 1011514, false, false); // You have :
AddHtmlLocalized(20, 90, 200, 25, 1011514); // You have :
AddLabel(230, 90, 0x26, guardList.Guards.Count.ToString());
AddHtmlLocalized(20, 120, 200, 25, 1011515, false, false); // Maximum :
AddHtmlLocalized(20, 120, 200, 25, 1011515); // Maximum :
AddLabel(230, 120, 0x12A, guardList.Definition.Maximum.ToString());
AddHtmlLocalized(20, 150, 200, 25, 1011516, false, false); // Cost :
AddHtmlLocalized(20, 150, 200, 25, 1011516); // Cost :
AddLabel(230, 150, 0x44, guardList.Definition.Price.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 180, 200, 25, 1011517, false, false); // Daily Pay :
AddHtmlLocalized(20, 180, 200, 25, 1011517); // Daily Pay :
AddLabel(230, 180, 0x37, guardList.Definition.Upkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 210, 200, 25, 1011518, false, false); // Current Silver :
AddHtmlLocalized(20, 210, 200, 25, 1011518); // Current Silver :
AddLabel(230, 210, 0x44, town.Silver.ToString("N0")); // NOTE: Added 'N0'
AddHtmlLocalized(20, 240, 200, 25, 1011519, false, false); // Current Payroll :
AddHtmlLocalized(20, 240, 200, 25, 1011519); // Current Payroll :
AddLabel(230, 240, 0x44, sheriffUpkeep.ToString("N0")); // NOTE: Added 'N0'
AddHtmlText(55, 300, 200, 25, guardList.Definition.Label, false, false);
AddButton(20, 300, 4005, 4007, 1 + i, GumpButtonType.Reply, 0);
AddButton(20, 300, 4005, 4007, 1 + i);
AddHtmlLocalized(55, 360, 200, 25, 1011067, false, false); // Previous page
AddHtmlLocalized(55, 360, 200, 25, 1011067); // Previous page
AddButton(20, 360, 4005, 4007, 0, GumpButtonType.Page, 3);
}
@ -185,4 +185,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -24,20 +24,20 @@ namespace Server.Factions
AddHtmlText(25, 30, 250, 25, town.Definition.TownStoneHeader, false, false);
AddHtmlLocalized(55, 60, 150, 25, 1011557, false, false); // Hire Sheriff
AddButton(20, 60, 4005, 4007, 1, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 60, 150, 25, 1011557); // Hire Sheriff
AddButton(20, 60, 4005, 4007, 1);
AddHtmlLocalized(55, 90, 150, 25, 1011559, false, false); // Hire Finance Minister
AddButton(20, 90, 4005, 4007, 2, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 90, 150, 25, 1011559); // Hire Finance Minister
AddButton(20, 90, 4005, 4007, 2);
AddHtmlLocalized(55, 120, 150, 25, 1011558, false, false); // Fire Sheriff
AddButton(20, 120, 4005, 4007, 3, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 120, 150, 25, 1011558); // Fire Sheriff
AddButton(20, 120, 4005, 4007, 3);
AddHtmlLocalized(55, 150, 150, 25, 1011560, false, false); // Fire Finance Minister
AddButton(20, 150, 4005, 4007, 4, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 150, 150, 25, 1011560); // Fire Finance Minister
AddButton(20, 150, 4005, 4007, 4);
AddHtmlLocalized(55, 210, 150, 25, 1011441, false, false); // EXIT
AddButton(20, 210, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 210, 150, 25, 1011441); // EXIT
AddButton(20, 210, 4005, 4007, 0);
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -201,4 +201,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -24,23 +24,23 @@ namespace Server.Factions
AddHtmlText(20, 20, 380, 20, election.Faction.Definition.Header, false, false);
if (canVote)
AddHtmlLocalized(20, 60, 380, 20, 1011428, false, false); // VOTE FOR LEADERSHIP
AddHtmlLocalized(20, 60, 380, 20, 1011428); // VOTE FOR LEADERSHIP
else
AddHtmlLocalized(20, 60, 380, 20, 1038032, false, false); // You have already voted in this election.
AddHtmlLocalized(20, 60, 380, 20, 1038032); // You have already voted in this election.
for (int i = 0; i < election.Candidates.Count; ++i)
{
Candidate cd = election.Candidates[i];
if (canVote)
AddButton(20, 100 + i * 20, 4005, 4007, i + 1, GumpButtonType.Reply, 0);
AddButton(20, 100 + i * 20, 4005, 4007, i + 1);
AddLabel(55, 100 + i * 20, 0, cd.Mobile.Name);
AddLabel(300, 100 + i * 20, 0, cd.Votes.ToString());
}
AddButton(20, 310, 4005, 4007, 0, GumpButtonType.Reply, 0);
AddHtmlLocalized(55, 310, 100, 20, 1011012, false, false); // CANCEL
AddButton(20, 310, 4005, 4007, 0);
AddHtmlLocalized(55, 310, 100, 20, 1011012); // CANCEL
}
public override void OnResponse(NetState sender, RelayInfo info)
@ -63,4 +63,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -8,7 +8,7 @@ namespace Server.Factions
private Sigil m_Sigil;
private Town m_Town;
public BaseMonolith(Town town, Faction faction) : base(0x1183)
public BaseMonolith(Town town = null, Faction faction = null) : base(0x1183)
{
Movable = false;
Town = town;
@ -80,7 +80,7 @@ namespace Server.Factions
public virtual void UpdateSigil()
{
if (m_Sigil == null || m_Sigil.Deleted)
if (m_Sigil?.Deleted != false)
return;
m_Sigil.MoveToWorld(new Point3D(X, Y, Z + 18), Map);
@ -126,4 +126,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -8,12 +8,7 @@ namespace Server.Factions
private Faction m_Faction;
[Constructible]
public FactionStone() : this(null)
{
}
[Constructible]
public FactionStone(Faction faction) : base(0xEDC)
public FactionStone(Faction faction = null) : base(0xEDC)
{
Movable = false;
Faction = faction;
@ -101,4 +96,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -8,12 +8,7 @@ namespace Server.Factions
private Faction m_Faction;
[Constructible]
public JoinStone() : this(null)
{
}
[Constructible]
public JoinStone(Faction faction) : base(0xEDC)
public JoinStone(Faction faction = null) : base(0xEDC)
{
Movable = false;
Faction = faction;
@ -76,4 +71,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Server.Factions;
using Server.Spells;
using Server.Targeting;
@ -34,64 +35,61 @@ namespace Server
Point3D origin = new Point3D(pt);
Map facet = from.Map;
if (facet != null && facet.CanFit(pt.X, pt.Y, pt.Z, 16, false, false))
{
Movable = false;
if (facet?.CanFit(pt.X, pt.Y, pt.Z, 16, false, false) != true)
return;
Effects.SendMovingEffect(
from, new Entity(Serial.Zero, origin, facet),
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
Movable = false;
Effects.SendMovingEffect(
from, new Entity(Serial.Zero, origin, facet),
ItemID & 0x3FFF, 7, 0, false, false, Hue - 1
);
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
{
Delete();
Effects.PlaySound(origin, facet, 530);
Effects.PlaySound(origin, facet, 263);
Effects.SendLocationEffect(
origin, facet,
14284, 96, 1, 0, 2
);
Timer.DelayCall(TimeSpan.FromSeconds(0.5), delegate
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
{
Delete();
List<Mobile> targets = facet.GetMobilesInRange(origin, 12).Where(mob =>
from.CanBeHarmful(mob, false) && mob.InLOS(new Point3D(origin, origin.Z + 1)) &&
Faction.Find(mob) != null).ToList();
Effects.PlaySound(origin, facet, 530);
Effects.PlaySound(origin, facet, 263);
Effects.SendLocationEffect(
origin, facet,
14284, 96, 1, 0, 2
);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), delegate
foreach (Mobile mob in targets)
{
List<Mobile> targets = new List<Mobile>();
int damage = mob.Hits * 6 / 10;
foreach (Mobile mob in facet.GetMobilesInRange(origin, 12))
if (from.CanBeHarmful(mob, false) &&
mob.InLOS(new Point3D(origin, origin.Z + 1)))
if (Faction.Find(mob) != null)
targets.Add(mob);
if (!mob.Player && damage < 10)
damage = 10;
else if (damage > 75)
damage = 75;
foreach (Mobile mob in targets)
{
int damage = mob.Hits * 6 / 10;
Effects.SendMovingEffect(
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
14068, 1, 32, false, false, 1111, 2
);
if (!mob.Player && damage < 10)
damage = 10;
else if (damage > 75) damage = 75;
from.DoHarmful(mob);
Effects.SendMovingEffect(
new Entity(Serial.Zero, new Point3D(origin, origin.Z + 4), facet), mob,
14068, 1, 32, false, false, 1111, 2
);
SpellHelper.Damage(TimeSpan.FromSeconds(0.50), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
from.DoHarmful(mob);
SpellHelper.Damage(TimeSpan.FromSeconds(0.50), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(0.70), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
SpellHelper.Damage(TimeSpan.FromSeconds(1.00), mob, from, damage / 3.0, 0, 0, 0, 0,
100);
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
}
});
Timer.DelayCall(TimeSpan.FromSeconds(0.50), delegate { mob.PlaySound(0x1FB); });
}
});
}
});
}
});
@ -112,4 +110,4 @@ namespace Server
int version = reader.ReadEncodedInt();
}
}
}
}

View file

@ -36,7 +36,7 @@ namespace Server
{
Faction.ClearSkillLoss(mob);
mob.SendGump(new ResurrectGump(mob, from, ResurrectMessage.Generic));
mob.SendGump(new ResurrectGump(mob, from));
used = true;
}
}

View file

@ -425,10 +425,10 @@ namespace Server.Factions
if (monolith == null && m_Town != null)
monolith = m_Town.Monolith;
if (monolith != null && !monolith.Deleted)
if (monolith?.Deleted == false)
monolith.Sigil = this;
return monolith != null && !monolith.Deleted;
return monolith?.Deleted == false;
}
public override void OnParentDeleted(IEntity parent)

View file

@ -2,12 +2,9 @@ namespace Server.Factions
{
public class StrongholdMonolith : BaseMonolith
{
public StrongholdMonolith() : this(null, null)
public StrongholdMonolith(Town town = null, Faction faction = null) : base(town, faction)
{
}
public StrongholdMonolith(Town town, Faction faction) : base(town, faction)
{
}
public StrongholdMonolith(Serial serial) : base(serial)
@ -35,4 +32,4 @@ namespace Server.Factions
int version = reader.ReadInt();
}
}
}
}

View file

@ -2,11 +2,7 @@ namespace Server.Factions
{
public class TownMonolith : BaseMonolith
{
public TownMonolith() : this(null)
{
}
public TownMonolith(Town town) : base(town, null)
public TownMonolith(Town town = null) : base(town)
{
}
@ -35,4 +31,4 @@ namespace Server.Factions
int version = reader.ReadInt();
}
}
}
}

View file

@ -7,12 +7,7 @@ namespace Server.Factions
private Town m_Town;
[Constructible]
public TownStone() : this(null)
{
}
[Constructible]
public TownStone(Town town) : base(0xEDE)
public TownStone(Town town = null) : base(0xEDE)
{
Movable = false;
Town = town;
@ -81,4 +76,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -80,7 +80,7 @@ namespace Server.Factions
{
PlayerState victimState = PlayerState.Find(from);
if (victimState != null && victimState.CanGiveSilverTo(Placer) && victimState.KillPoints > 0)
if (victimState?.CanGiveSilverTo(Placer) == true && victimState.KillPoints > 0)
{
int silverGiven = Faction.AwardSilver(Placer, silverToAward);
@ -236,7 +236,7 @@ namespace Server.Factions
public override void OnDelete()
{
if (Faction != null && Faction.Traps.Contains(this))
if (Faction?.Traps.Contains(this) == true)
Faction.Traps.Remove(this);
base.OnDelete();
@ -261,4 +261,4 @@ namespace Server.Factions
return faction != Faction;
}
}
}
}

View file

@ -8,16 +8,12 @@ namespace Server.Factions
{
private Faction m_Faction;
public BaseFactionTrapDeed(int itemID) : base(itemID)
public BaseFactionTrapDeed(int itemID= 0x14F0) : base(itemID)
{
Weight = 1.0;
LootType = LootType.Blessed;
}
public BaseFactionTrapDeed(bool createdFromDeed) : this(0x14F0)
{
}
public BaseFactionTrapDeed(Serial serial) : base(serial)
{
}
@ -120,4 +116,4 @@ namespace Server.Factions
m_Faction = Faction.ReadReference(reader);
}
}
}
}

View file

@ -4,16 +4,7 @@ namespace Server.Factions
{
public class FactionExplosionTrap : BaseFactionTrap
{
[Constructible]
public FactionExplosionTrap() : this(null)
{
}
public FactionExplosionTrap(Faction f) : this(f, null)
{
}
public FactionExplosionTrap(Faction f, Mobile m) : base(f, m, 0x11C1)
public FactionExplosionTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11C1)
{
}
@ -81,4 +72,4 @@ namespace Server.Factions
int version = reader.ReadInt();
}
}
}
}

View file

@ -4,16 +4,7 @@ namespace Server.Factions
{
public class FactionGasTrap : BaseFactionTrap
{
[Constructible]
public FactionGasTrap() : this(null)
{
}
public FactionGasTrap(Faction f) : this(f, null)
{
}
public FactionGasTrap(Faction f, Mobile m) : base(f, m, 0x113C)
public FactionGasTrap(Faction f = null, Mobile m = null) : base(f, m, 0x113C)
{
}
@ -81,4 +72,4 @@ namespace Server.Factions
int version = reader.ReadInt();
}
}
}
}

View file

@ -4,20 +4,7 @@ namespace Server.Factions
{
public class FactionSawTrap : BaseFactionTrap
{
[Constructible]
public FactionSawTrap() : this(null)
{
}
public FactionSawTrap(Serial serial) : base(serial)
{
}
public FactionSawTrap(Faction f) : this(f, null)
{
}
public FactionSawTrap(Faction f, Mobile m) : base(f, m, 0x11AC)
public FactionSawTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11AC)
{
}
@ -81,4 +68,4 @@ namespace Server.Factions
int version = reader.ReadInt();
}
}
}
}

View file

@ -4,16 +4,7 @@ namespace Server.Factions
{
public class FactionSpikeTrap : BaseFactionTrap
{
[Constructible]
public FactionSpikeTrap() : this(null)
{
}
public FactionSpikeTrap(Faction f) : this(f, null)
{
}
public FactionSpikeTrap(Faction f, Mobile m) : base(f, m, 0x11A0)
public FactionSpikeTrap(Faction f = null, Mobile m = null) : base(f, m, 0x11A0)
{
}
@ -84,4 +75,4 @@ namespace Server.Factions
int version = reader.ReadInt();
}
}
}
}

View file

@ -8,13 +8,8 @@ namespace Server.Factions
public const int GoldPrice = 3000;
private Faction m_Faction;
[Constructible]
public FactionWarHorse() : this(null)
{
}
public FactionWarHorse(Faction faction) : base("a war horse", 0xE2, 0x3EA0, AIType.AI_Melee, FightMode.Aggressor, 10,
1, 0.2, 0.4)
public FactionWarHorse(Faction faction = null)
: base("a war horse", 0xE2, 0x3EA0, AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
{
BaseSoundID = 0xA8;
@ -109,4 +104,4 @@ namespace Server.Factions
}
}
}
}
}

View file

@ -241,68 +241,68 @@ namespace Server.Factions
}
else if (DateTime.UtcNow < m_OrdersEnd)
{
if (m_Town != null && m_Town.IsSheriff(from) && Town.FromRegion(Region) == m_Town)
if (m_Town?.IsSheriff(from) != true || Town.FromRegion(Region) != m_Town)
return;
m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
bool understood = true;
ReactionType newType = 0;
if (Insensitive.Contains(e.Speech, "attack"))
newType = ReactionType.Attack;
else if (Insensitive.Contains(e.Speech, "warn"))
newType = ReactionType.Warn;
else if (Insensitive.Contains(e.Speech, "ignore"))
newType = ReactionType.Ignore;
else
understood = false;
if (understood)
{
m_OrdersEnd = DateTime.UtcNow + TimeSpan.FromSeconds(10.0);
understood = false;
bool understood = true;
ReactionType newType = 0;
if (Insensitive.Contains(e.Speech, "attack"))
newType = ReactionType.Attack;
else if (Insensitive.Contains(e.Speech, "warn"))
newType = ReactionType.Warn;
else if (Insensitive.Contains(e.Speech, "ignore"))
newType = ReactionType.Ignore;
else
understood = false;
if (understood)
if (Insensitive.Contains(e.Speech, "civil"))
{
understood = false;
ChangeReaction(null, newType);
understood = true;
}
if (Insensitive.Contains(e.Speech, "civil"))
List<Faction> factions = Faction.Factions;
for (int i = 0; i < factions.Count; ++i)
{
Faction faction = factions[i];
if (faction != m_Faction && Insensitive.Contains(e.Speech, faction.Definition.Keyword))
{
ChangeReaction(null, newType);
ChangeReaction(faction, newType);
understood = true;
}
List<Faction> factions = Faction.Factions;
for (int i = 0; i < factions.Count; ++i)
{
Faction faction = factions[i];
if (faction != m_Faction && Insensitive.Contains(e.Speech, faction.Definition.Keyword))
{
ChangeReaction(faction, newType);
understood = true;
}
}
}
else if (Insensitive.Contains(e.Speech, "patrol"))
{
Home = Location;
RangeHome = 6;
Combatant = null;
Orders.Movement = MovementType.Patrol;
Say(1005146); // This spot looks like it needs protection! I shall guard it with my life.
understood = true;
}
else if (Insensitive.Contains(e.Speech, "follow"))
{
Home = Location;
RangeHome = 6;
Combatant = null;
Orders.Follow = from;
Orders.Movement = MovementType.Follow;
Say(1005144); // Yes, Sire.
understood = true;
}
if (!understood)
Say(1042183); // I'm sorry, I don't understand your orders...
}
else if (Insensitive.Contains(e.Speech, "patrol"))
{
Home = Location;
RangeHome = 6;
Combatant = null;
Orders.Movement = MovementType.Patrol;
Say(1005146); // This spot looks like it needs protection! I shall guard it with my life.
understood = true;
}
else if (Insensitive.Contains(e.Speech, "follow"))
{
Home = Location;
RangeHome = 6;
Combatant = null;
Orders.Follow = from;
Orders.Movement = MovementType.Follow;
Say(1005144); // Yes, Sire.
understood = true;
}
if (!understood)
Say(1042183); // I'm sorry, I don't understand your orders...
}
}
}
@ -525,4 +525,4 @@ namespace Server.Factions
Delete();
}
}
}
}

View file

@ -27,11 +27,7 @@ namespace Server.Factions
public class ComboEntry
{
public ComboEntry(Type spell) : this(spell, 100, TimeSpan.Zero)
{
}
public ComboEntry(Type spell, int chance) : this(spell, chance, TimeSpan.Zero)
public ComboEntry(Type spell, int chance = 100) : this(spell, chance, TimeSpan.Zero)
{
}
@ -170,7 +166,7 @@ namespace Server.Factions
public bool EquipWeapon()
{
Item weapon = m_Guard.Backpack?.FindItemByType<BaseWeapon>();
return weapon != null && m_Guard.EquipItem(weapon);
}
@ -225,18 +221,18 @@ namespace Server.Factions
switch (Utility.Random(maxCircle * 2))
{
case 0:
case 1: return new MagicArrowSpell(m_Guard, null);
case 1: return new MagicArrowSpell(m_Guard);
case 2:
case 3: return new HarmSpell(m_Guard, null);
case 3: return new HarmSpell(m_Guard);
case 4:
case 5: return new FireballSpell(m_Guard, null);
case 5: return new FireballSpell(m_Guard);
case 6:
case 7: return new LightningSpell(m_Guard, null);
case 8: return new MindBlastSpell(m_Guard, null);
case 9: return new ParalyzeSpell(m_Guard, null);
case 10: return new EnergyBoltSpell(m_Guard, null);
case 11: return new ExplosionSpell(m_Guard, null);
default: return new FlameStrikeSpell(m_Guard, null);
case 7: return new LightningSpell(m_Guard);
case 8: return new MindBlastSpell(m_Guard);
case 9: return new ParalyzeSpell(m_Guard);
case 10: return new EnergyBoltSpell(m_Guard);
case 11: return new ExplosionSpell(m_Guard);
default: return new FlameStrikeSpell(m_Guard);
}
}
@ -255,7 +251,7 @@ namespace Server.Factions
Mobile comb = m_Mobile.Combatant;
if (comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange(comb, 12) &&
if (comb?.Deleted == false && comb.Alive && !comb.IsDeadBondedPet && m_Mobile.InRange(comb, 12) &&
CanDispel(comb))
{
active = comb;
@ -317,7 +313,7 @@ namespace Server.Factions
Mobile comb = m_Mobile.Combatant;
if (comb != null && !comb.Deleted && comb.Alive && !comb.IsDeadBondedPet && CanDispel(comb))
if (comb?.Deleted == false && comb.Alive && !comb.IsDeadBondedPet && CanDispel(comb))
{
active = inactive = comb;
actPrio = inactPrio = m_Mobile.GetDistanceToSqrt(comb);
@ -427,7 +423,7 @@ namespace Server.Factions
Mobile combatant = m_Guard.Combatant;
if (combatant == null || combatant.Deleted || !combatant.Alive || combatant.IsDeadBondedPet ||
if (combatant?.Deleted != false || !combatant.Alive || combatant.IsDeadBondedPet ||
!m_Mobile.CanSee(combatant) || !m_Mobile.CanBeHarmful(combatant, false) || combatant.Map != m_Mobile.Map)
{
// Our combatant is deleted, dead, hidden, or we cannot hurt them
@ -512,10 +508,7 @@ namespace Server.Factions
if (m_Guard.Town != null && m_Guard.Orders.Movement == MovementType.Follow)
{
toFollow = m_Guard.Orders.Follow;
if (toFollow == null)
toFollow = m_Guard.Town.Sheriff;
toFollow = m_Guard.Orders.Follow ?? m_Guard.Town.Sheriff;
}
if (toFollow != null && toFollow.Map == m_Guard.Map &&
@ -577,7 +570,7 @@ namespace Server.Factions
m_Guard.HitsMax - m_Guard.Hits > Utility.Random(250))
{
if (IsAllowed(GuardAI.Bless))
spell = new CureSpell(m_Guard, null);
spell = new CureSpell(m_Guard);
else
UseItemByType(typeof(BaseCurePotion));
}
@ -588,16 +581,16 @@ namespace Server.Factions
m_Guard.Home != Point3D.Zero && !Utility.InRange(m_Guard.Location, m_Guard.Home, 15) &&
m_Guard.Mana >= 11)
{
spell = new RecallSpell(m_Guard, null,
new RunebookEntry(m_Guard.Home, m_Guard.Map, "Guard's Home", null));
spell = new RecallSpell(m_Guard,
new RunebookEntry(m_Guard.Home, m_Guard.Map, "Guard's Home"));
}
else if (IsAllowed(GuardAI.Bless))
{
if (m_Guard.Mana >= 11 && m_Guard.Hits + 30 < m_Guard.HitsMax)
spell = new GreaterHealSpell(m_Guard, null);
spell = new GreaterHealSpell(m_Guard);
else if (m_Guard.Hits + 10 < m_Guard.HitsMax &&
(m_Guard.Mana < 11 || m_Guard.NextCombatTime - Core.TickCount > 2000))
spell = new HealSpell(m_Guard, null);
spell = new HealSpell(m_Guard);
}
else if (m_Guard.CanBeginAction<BaseHealPotion>())
{
@ -608,9 +601,9 @@ namespace Server.Factions
(IsAllowed(GuardAI.Magic) || IsAllowed(GuardAI.Bless) || IsAllowed(GuardAI.Curse)))
{
if (!dispelTarget.Paralyzed && m_Guard.Mana > ManaReserve + 20 && 40 > Utility.Random(100))
spell = new ParalyzeSpell(m_Guard, null);
spell = new ParalyzeSpell(m_Guard);
else
spell = new DispelSpell(m_Guard, null);
spell = new DispelSpell(m_Guard);
}
if (combatant != null)
@ -672,7 +665,7 @@ namespace Server.Factions
if (IsAllowed(GuardAI.Bless))
{
if (types.Count > 1)
spell = new BlessSpell(m_Guard, null);
spell = new BlessSpell(m_Guard);
else if (types.Count == 1)
spell = Activator.CreateInstance(types[0], m_Guard, null) as Spell;
}
@ -690,7 +683,7 @@ namespace Server.Factions
{
if (!combatant.Poisoned && 40 > Utility.Random(100))
{
spell = new PoisonSpell(m_Guard, null);
spell = new PoisonSpell(m_Guard);
}
else
{
@ -710,7 +703,7 @@ namespace Server.Factions
types.Add(typeof(FeeblemindSpell));
if (types.Count > 1)
spell = new CurseSpell(m_Guard, null);
spell = new CurseSpell(m_Guard);
else if (types.Count == 1)
spell = (Spell)Activator.CreateInstance(types[0], m_Guard, null);
}
@ -738,7 +731,7 @@ namespace Server.Factions
if (spell is GreaterHealSpell)
{
if (m_Guard.Hits + 30 > m_Guard.HitsMax && m_Guard.Hits + 10 < m_Guard.HitsMax)
spell = new HealSpell(m_Guard, null);
spell = new HealSpell(m_Guard);
}
else
{
@ -751,7 +744,7 @@ namespace Server.Factions
UseItemByType(typeof(BaseRefreshPotion));
}
if (spell == null || !spell.Cast())
if (spell?.Cast() != true)
EquipWeapon();
}
else if (spell?.State == SpellState.Sequencing)
@ -762,4 +755,4 @@ namespace Server.Factions
return true;
}
}
}
}