Clean up: Bugs, LINQ, constructors, default values, and null checks (#18)
This commit is contained in:
parent
e748af4430
commit
513e54f70e
1094 changed files with 15913 additions and 21892 deletions
|
|
@ -93,7 +93,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
AddButton( 275, 430, (int)ButtonGraphic.Continue, (int)ButtonGraphic.Continue + 2, 0, GumpButtonType.Page, m_Page + 1 );
|
||||
|
||||
foreach ( ButtonInfo button in m_Buttons )
|
||||
AddButton( button.Position == ButtonPosition.Left ? 95 : 313, 455, (int)button.Graphic, (int)button.Graphic + 2, button.ButtonID, GumpButtonType.Reply, 0 );
|
||||
AddButton( button.Position == ButtonPosition.Left ? 95 : 313, 455, (int)button.Graphic, (int)button.Graphic + 2, button.ButtonID, );
|
||||
|
||||
if ( m_Title != null )
|
||||
AddHtmlLocalized( 130, 68, 220, 48, 1114513, m_Title, 0x2710, false, false ); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
|
||||
|
|
@ -131,7 +131,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
AddImage(379, 60, 0x15A9);
|
||||
AddImage(425, 0, 0x28C9);
|
||||
AddImage(90, 33, 0x232D);
|
||||
AddHtmlLocalized(130, 45, 270, 16, label, 0xFFFFFF, false, false);
|
||||
AddHtmlLocalized(130, 45, 270, 16, label, 0xFFFFFF);
|
||||
AddImageTiled(130, 65, 175, 1, 0x238D);
|
||||
}
|
||||
|
||||
|
|
@ -149,11 +149,10 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
|
||||
foreach (ButtonInfo button in m_Buttons)
|
||||
AddButton(button.Position == ButtonPosition.Left ? 95 : 313, 455, (int)button.Graphic,
|
||||
(int)button.Graphic + 2, button.ButtonID, GumpButtonType.Reply, 0);
|
||||
(int)button.Graphic + 2, button.ButtonID);
|
||||
|
||||
if (m_Title != null)
|
||||
AddHtmlLocalized(130, 68, 220, 48, 1114513, m_Title, 0x2710, false,
|
||||
false); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
|
||||
AddHtmlLocalized(130, 68, 220, 48, 1114513, m_Title, 0x2710); // <DIV ALIGN=CENTER>~1_TOKEN~</DIV>
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -179,16 +178,14 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
|
||||
public void AddDescription(MLQuest quest)
|
||||
{
|
||||
AddHtmlLocalized(98, 140, 312, 16, quest.IsChainTriggered || quest.NextQuest != null ? 1075024 : 1072202, 0x2710,
|
||||
false, false); // Description [(quest chain)]
|
||||
AddHtmlLocalized(98, 140, 312, 16, quest.IsChainTriggered || quest.NextQuest != null ? 1075024 : 1072202, 0x2710); // Description [(quest chain)]
|
||||
TextDefinition.AddHtmlText(this, 98, 156, 312, 240, quest.Description, false, true, 0x15F90, 0xBDE784);
|
||||
}
|
||||
|
||||
public void AddObjectives(MLQuest quest)
|
||||
{
|
||||
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective:
|
||||
AddHtmlLocalized(98, 156, 312, 16, quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209, 0x2710, false,
|
||||
false); // All of the following / Only one of the following
|
||||
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
|
||||
AddHtmlLocalized(98, 156, 312, 16, quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209, 0x2710); // All of the following / Only one of the following
|
||||
|
||||
int y = 172;
|
||||
|
||||
|
|
@ -210,9 +207,8 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
{
|
||||
MLQuest quest = instance.Quest;
|
||||
|
||||
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false); // Objective:
|
||||
AddHtmlLocalized(98, 156, 312, 16, quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209, 0x2710, false,
|
||||
false); // All of the following / Only one of the following
|
||||
AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710); // Objective:
|
||||
AddHtmlLocalized(98, 156, 312, 16, quest.ObjectiveType == ObjectiveType.All ? 1072208 : 1072209, 0x2710); // All of the following / Only one of the following
|
||||
|
||||
int y = 172;
|
||||
|
||||
|
|
@ -222,14 +218,14 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
|
||||
public void AddRewardsPage(MLQuest quest) // For the quest log/offer gumps
|
||||
{
|
||||
AddHtmlLocalized(98, 140, 312, 16, 1072201, 0x2710, false, false); // Reward
|
||||
AddHtmlLocalized(98, 140, 312, 16, 1072201, 0x2710); // Reward
|
||||
|
||||
int y = 162;
|
||||
|
||||
if (quest.Rewards.Count > 1)
|
||||
{
|
||||
// TODO: Is this what this is for? Does "Only one of the following" occur?
|
||||
AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false); // All of the following
|
||||
AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710); // All of the following
|
||||
y += 16;
|
||||
}
|
||||
|
||||
|
|
@ -243,7 +239,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
if (quest.Rewards.Count > 1)
|
||||
{
|
||||
// TODO: Is this what this is for? Does "Only one of the following" occur?
|
||||
AddHtmlLocalized(100, 140, 312, 16, 1072208, 0x2710, false, false); // All of the following
|
||||
AddHtmlLocalized(100, 140, 312, 16, 1072208, 0x2710); // All of the following
|
||||
y += 16;
|
||||
}
|
||||
|
||||
|
|
@ -292,4 +288,4 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
pm.CloseGump<QuestCancelConfirmGump>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,12 +8,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
private bool m_CloseGumps;
|
||||
private MLQuestInstance m_Instance;
|
||||
|
||||
public QuestCancelConfirmGump(MLQuestInstance instance)
|
||||
: this(instance, true)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestCancelConfirmGump(MLQuestInstance instance, bool closeGumps)
|
||||
public QuestCancelConfirmGump(MLQuestInstance instance, bool closeGumps = true)
|
||||
: base(120, 50)
|
||||
{
|
||||
m_Instance = instance;
|
||||
|
|
@ -50,7 +45,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
AddImage(2, 248, 0x2716);
|
||||
AddImage(2, 2, 0x2716);
|
||||
|
||||
AddHtmlLocalized(25, 22, 200, 20, 1049000, 0x7D00, false, false); // Confirm Quest Cancellation
|
||||
AddHtmlLocalized(25, 22, 200, 20, 1049000, 0x7D00); // Confirm Quest Cancellation
|
||||
AddImage(25, 40, 0xBBF);
|
||||
|
||||
/*
|
||||
|
|
@ -60,24 +55,23 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
* <BR>
|
||||
* Are you certain you wish to cancel at this time?
|
||||
*/
|
||||
AddHtmlLocalized(25, 55, 300, 120, 1060836, 0xFFFFFF, false, false);
|
||||
AddHtmlLocalized(25, 55, 300, 120, 1060836, 0xFFFFFF);
|
||||
|
||||
MLQuest quest = instance.Quest;
|
||||
|
||||
if (quest.IsChainTriggered || quest.NextQuest != null)
|
||||
{
|
||||
AddRadio(25, 145, 0x25F8, 0x25FB, false, 2);
|
||||
AddHtmlLocalized(60, 150, 280, 20, 1075023, 0xFFFFFF, false,
|
||||
false); // Yes, I want to quit this entire chain!
|
||||
AddHtmlLocalized(60, 150, 280, 20, 1075023, 0xFFFFFF); // Yes, I want to quit this entire chain!
|
||||
}
|
||||
|
||||
AddRadio(25, 180, 0x25F8, 0x25FB, true, 1);
|
||||
AddHtmlLocalized(60, 185, 280, 20, 1049005, 0xFFFFFF, false, false); // Yes, I really want to quit this quest!
|
||||
AddHtmlLocalized(60, 185, 280, 20, 1049005, 0xFFFFFF); // Yes, I really want to quit this quest!
|
||||
|
||||
AddRadio(25, 215, 0x25F8, 0x25FB, false, 0);
|
||||
AddHtmlLocalized(60, 220, 280, 20, 1049006, 0xFFFFFF, false, false); // No, I don't want to quit.
|
||||
AddHtmlLocalized(60, 220, 280, 20, 1049006, 0xFFFFFF); // No, I don't want to quit.
|
||||
|
||||
AddButton(265, 220, 0xF7, 0xF8, 7, GumpButtonType.Reply, 0);
|
||||
AddButton(265, 220, 0xF7, 0xF8, 7);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -100,4 +94,4 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,12 +9,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
private bool m_CloseGumps;
|
||||
private MLQuestInstance m_Instance;
|
||||
|
||||
public QuestLogDetailedGump(MLQuestInstance instance)
|
||||
: this(instance, true)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestLogDetailedGump(MLQuestInstance instance, bool closeGumps)
|
||||
public QuestLogDetailedGump(MLQuestInstance instance, bool closeGumps = true)
|
||||
: base(1046026) // Quest Log
|
||||
{
|
||||
m_Instance = instance;
|
||||
|
|
@ -39,7 +34,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
AddDescription(quest);
|
||||
|
||||
if (instance.Failed) // only displayed on the first page
|
||||
AddHtmlLocalized(160, 80, 250, 16, 500039, 0x3C00, false, false); // Failed!
|
||||
AddHtmlLocalized(160, 80, 250, 16, 500039, 0x3C00); // Failed!
|
||||
|
||||
BuildPage();
|
||||
AddObjectivesProgress(instance);
|
||||
|
|
|
|||
|
|
@ -10,12 +10,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
private bool m_CloseGumps;
|
||||
private PlayerMobile m_Owner;
|
||||
|
||||
public QuestLogGump(PlayerMobile pm)
|
||||
: this(pm, true)
|
||||
{
|
||||
}
|
||||
|
||||
public QuestLogGump(PlayerMobile pm, bool closeGumps)
|
||||
public QuestLogGump(PlayerMobile pm, bool closeGumps = true)
|
||||
: base(1046026) // Quest Log
|
||||
{
|
||||
m_Owner = pm;
|
||||
|
|
|
|||
|
|
@ -38,16 +38,14 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
AddBackground(0, 0, 240, 135, 0x2422);
|
||||
|
||||
if (targetRace == Race.Human)
|
||||
AddHtmlLocalized(15, 15, 210, 75, 1073643, 0, false,
|
||||
false); // Are you sure you wish to embrace your humanity?
|
||||
AddHtmlLocalized(15, 15, 210, 75, 1073643, 0); // Are you sure you wish to embrace your humanity?
|
||||
else if (targetRace == Race.Elf)
|
||||
AddHtmlLocalized(15, 15, 210, 75, 1073642, 0, false,
|
||||
false); // Are you sure you want to follow the elven ways?
|
||||
AddHtmlLocalized(15, 15, 210, 75, 1073642, 0); // Are you sure you want to follow the elven ways?
|
||||
else
|
||||
AddHtml(15, 15, 210, 75, $"Are you sure you want to change your race to {targetRace.Name}?", false, false);
|
||||
AddHtml(15, 15, 210, 75, $"Are you sure you want to change your race to {targetRace.Name}?");
|
||||
|
||||
AddButton(160, 95, 0xF7, 0xF8, 1, GumpButtonType.Reply, 0);
|
||||
AddButton(90, 95, 0xF2, 0xF1, 0, GumpButtonType.Reply, 0);
|
||||
AddButton(160, 95, 0xF7, 0xF8, 1);
|
||||
AddButton(90, 95, 0xF2, 0xF1, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -186,7 +184,7 @@ namespace Server.Engines.MLQuests.Gumps
|
|||
return;
|
||||
}
|
||||
|
||||
if (!CanChange(pm, targetRace) || owner != null && !owner.CheckComplete(pm))
|
||||
if (!CanChange(pm, targetRace) || owner?.CheckComplete(pm) == false)
|
||||
return;
|
||||
|
||||
int hue = pvSrc.ReadUInt16();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue