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

@ -119,11 +119,11 @@ namespace Server
if (target.Body.IsHuman && (!(target is BaseCreature cret) || !cret.AlwaysAttackable && !cret.AlwaysMurderer))
{
if (reg == null || reg.IsDisabled())
if (reg?.IsDisabled() != true)
{
//Allow honor on blue if Out of guardzone
}
else if (map != null && (map.Rules & MapRules.HarmfulRestrictions) == 0)
else if ((map?.Rules & MapRules.HarmfulRestrictions) == 0)
{
//Allow honor on blue if in Fel
}
@ -406,4 +406,4 @@ namespace Server
}
}
}
}
}

View file

@ -194,8 +194,7 @@ namespace Server
AddImageTiled(15, 15, 365, 190, 2624);
AddAlphaRegion(15, 15, 365, 190);
AddHtmlLocalized(30, 20, 360, 25, 1049365, 0x7FFF, false,
false); // Another player is offering you their <a href="?ForceTopic88">protection</a>:
AddHtmlLocalized(30, 20, 360, 25, 1049365, 0x7FFF); // Another player is offering you their <a href="?ForceTopic88">protection</a>:
AddLabel(90, 55, 1153, protector.Name);
AddImage(50, 45, 9005);
@ -203,12 +202,12 @@ namespace Server
AddImageTiled(95, 82, 200, 1, 9157);
AddRadio(30, 110, 9727, 9730, true, 1);
AddHtmlLocalized(65, 115, 300, 25, 1049444, 0x7FFF, false, false); // Yes, I would like their protection.
AddHtmlLocalized(65, 115, 300, 25, 1049444, 0x7FFF); // Yes, I would like their protection.
AddRadio(30, 145, 9727, 9730, false, 0);
AddHtmlLocalized(65, 148, 300, 25, 1049445, 0x7FFF, false, false); // No thanks, I can take care of myself.
AddHtmlLocalized(65, 148, 300, 25, 1049445, 0x7FFF); // No thanks, I can take care of myself.
AddButton(160, 175, 247, 248, 2, GumpButtonType.Reply, 0);
AddButton(160, 175, 247, 248, 2);
AddImage(215, 0, 50581);
@ -235,4 +234,4 @@ namespace Server
}
}
}
}
}

View file

@ -47,7 +47,7 @@ namespace Server
public static void Valor(Mobile from, object targ)
{
if (!(targ is IdolOfTheChampion idol) || idol.Deleted || idol.Spawn == null || idol.Spawn.Deleted)
if (!(targ is IdolOfTheChampion idol) || idol.Deleted || idol.Spawn?.Deleted != false)
{
from.SendLocalizedMessage(1054035); // You must target a Champion Idol to challenge the Champion's spawn!
}
@ -139,4 +139,4 @@ namespace Server
}
}
}
}
}

View file

@ -47,8 +47,8 @@ namespace Server
if (m_Beholder == m_Beheld)
{
AddButton(57, 269, 2027, 2027, 1, GumpButtonType.Reply, 0);
AddButton(186, 269, 2071, 2071, 2, GumpButtonType.Reply, 0);
AddButton(57, 269, 2027, 2027, 1);
AddButton(186, 269, 2071, 2071, 2);
}
}

View file

@ -10,12 +10,7 @@ namespace Server
private string m_Page;
private VirtueName m_Virtue;
public VirtueInfoGump(Mobile beholder, VirtueName virtue, int description) : this(beholder, virtue, description,
null)
{
}
public VirtueInfoGump(Mobile beholder, VirtueName virtue, int description, string webPage) : base(0, 0)
public VirtueInfoGump(Mobile beholder, VirtueName virtue, int description, string webPage = null) : base(0, 0)
{
m_Beholder = beholder;
m_Virtue = virtue;
@ -73,16 +68,15 @@ namespace Server
valueDesc = 1052050; // You have achieved the highest path in this Virtue.
AddHtmlLocalized(157, 73, 200, 40, 1051000 + (int)virtue, false, false);
AddHtmlLocalized(75, 95, 220, 140, description, false, false);
AddHtmlLocalized(70, 224, 229, 60, valueDesc, false, false);
AddHtmlLocalized(157, 73, 200, 40, 1051000 + (int)virtue);
AddHtmlLocalized(75, 95, 220, 140, description);
AddHtmlLocalized(70, 224, 229, 60, valueDesc);
AddButton(65, 277, 1209, 1209, 1, GumpButtonType.Reply, 0);
AddButton(65, 277, 1209, 1209, 1);
AddButton(280, 43, 4014, 4014, 2, GumpButtonType.Reply, 0);
AddButton(280, 43, 4014, 4014, 2);
AddHtmlLocalized(83, 275, 400, 40, webPage == null ? 1052055 : 1052052, false,
false); // This virtue is not yet defined. OR -click to learn more (opens webpage)
AddHtmlLocalized(83, 275, 400, 40, webPage == null ? 1052055 : 1052052); // This virtue is not yet defined. OR -click to learn more (opens webpage)
}
public override void OnResponse(NetState state, RelayInfo info)
@ -105,4 +99,4 @@ namespace Server
}
}
}
}
}

View file

@ -22,30 +22,29 @@ namespace Server
AddPage(1);
AddHtml(140, 73, 200, 20, "The Virtues", false, false);
AddHtml(140, 73, 200, 20, "The Virtues");
AddHtmlLocalized(80, 100, 100, 40, 1051000, false, false); // Humility
AddHtmlLocalized(80, 129, 100, 40, 1051001, false, false); // Sacrifice
AddHtmlLocalized(80, 159, 100, 40, 1051002, false, false); // Compassion
AddHtmlLocalized(80, 189, 100, 40, 1051003, false, false); // Spirituality
AddHtmlLocalized(200, 100, 200, 40, 1051004, false, false); // Valor
AddHtmlLocalized(200, 129, 200, 40, 1051005, false, false); // Honor
AddHtmlLocalized(200, 159, 200, 40, 1051006, false, false); // Justice
AddHtmlLocalized(200, 189, 200, 40, 1051007, false, false); // Honesty
AddHtmlLocalized(80, 100, 100, 40, 1051000); // Humility
AddHtmlLocalized(80, 129, 100, 40, 1051001); // Sacrifice
AddHtmlLocalized(80, 159, 100, 40, 1051002); // Compassion
AddHtmlLocalized(80, 189, 100, 40, 1051003); // Spirituality
AddHtmlLocalized(200, 100, 200, 40, 1051004); // Valor
AddHtmlLocalized(200, 129, 200, 40, 1051005); // Honor
AddHtmlLocalized(200, 159, 200, 40, 1051006); // Justice
AddHtmlLocalized(200, 189, 200, 40, 1051007); // Honesty
AddHtmlLocalized(75, 224, 220, 60, 1052062, false,
false); // Click on a blue gem to view your status in that virtue.
AddHtmlLocalized(75, 224, 220, 60, 1052062); // Click on a blue gem to view your status in that virtue.
AddButton(60, 100, 1210, 1210, 1, GumpButtonType.Reply, 0);
AddButton(60, 129, 1210, 1210, 2, GumpButtonType.Reply, 0);
AddButton(60, 159, 1210, 1210, 3, GumpButtonType.Reply, 0);
AddButton(60, 189, 1210, 1210, 4, GumpButtonType.Reply, 0);
AddButton(180, 100, 1210, 1210, 5, GumpButtonType.Reply, 0);
AddButton(180, 129, 1210, 1210, 6, GumpButtonType.Reply, 0);
AddButton(180, 159, 1210, 1210, 7, GumpButtonType.Reply, 0);
AddButton(180, 189, 1210, 1210, 8, GumpButtonType.Reply, 0);
AddButton(60, 100, 1210, 1210, 1);
AddButton(60, 129, 1210, 1210, 2);
AddButton(60, 159, 1210, 1210, 3);
AddButton(60, 189, 1210, 1210, 4);
AddButton(180, 100, 1210, 1210, 5);
AddButton(180, 129, 1210, 1210, 6);
AddButton(180, 159, 1210, 1210, 7);
AddButton(180, 189, 1210, 1210, 8);
AddButton(280, 43, 4014, 4014, 9, GumpButtonType.Reply, 0);
AddButton(280, 43, 4014, 4014, 9);
}
public override void OnResponse(NetState state, RelayInfo info)
@ -105,4 +104,4 @@ namespace Server
}
}
}
}
}