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
|
|
@ -17,16 +17,7 @@ namespace Server.Engines.Craft
|
|||
private CraftPage m_Page;
|
||||
private BaseTool m_Tool;
|
||||
|
||||
/*public CraftGump( Mobile from, CraftSystem craftSystem, BaseTool tool ): this( from, craftSystem, -1, -1, tool, null )
|
||||
{
|
||||
}*/
|
||||
|
||||
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice) : this(from, craftSystem, tool,
|
||||
notice, CraftPage.None)
|
||||
{
|
||||
}
|
||||
|
||||
private CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page) : base(40, 40)
|
||||
public CraftGump(Mobile from, CraftSystem craftSystem, BaseTool tool, object notice, CraftPage page = CraftPage.None) : base(40, 40)
|
||||
{
|
||||
m_From = from;
|
||||
m_CraftSystem = craftSystem;
|
||||
|
|
@ -50,57 +41,56 @@ namespace Server.Engines.Craft
|
|||
AddAlphaRegion(10, 10, 510, 417);
|
||||
|
||||
if (craftSystem.GumpTitleNumber > 0)
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
|
||||
else
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
|
||||
|
||||
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor, false, false); // <CENTER>CATEGORIES</CENTER>
|
||||
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor, false, false); // <CENTER>SELECTIONS</CENTER>
|
||||
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor, false, false); // <CENTER>NOTICES</CENTER>
|
||||
AddHtmlLocalized(10, 37, 200, 22, 1044010, LabelColor); // <CENTER>CATEGORIES</CENTER>
|
||||
AddHtmlLocalized(215, 37, 305, 22, 1044011, LabelColor); // <CENTER>SELECTIONS</CENTER>
|
||||
AddHtmlLocalized(10, 302, 150, 25, 1044012, LabelColor); // <CENTER>NOTICES</CENTER>
|
||||
|
||||
AddButton(15, 402, 4017, 4019, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor, false, false); // EXIT
|
||||
AddButton(15, 402, 4017, 4019, 0);
|
||||
AddHtmlLocalized(50, 405, 150, 18, 1011441, LabelColor); // EXIT
|
||||
|
||||
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor, false, false); // MAKE LAST
|
||||
AddButton(270, 402, 4005, 4007, GetButtonID(6, 2));
|
||||
AddHtmlLocalized(305, 405, 150, 18, 1044013, LabelColor); // MAKE LAST
|
||||
|
||||
// Mark option
|
||||
if (craftSystem.MarkOption)
|
||||
{
|
||||
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor,
|
||||
false, false); // MARK ITEM
|
||||
AddButton(270, 362, 4005, 4007, GetButtonID(6, 6));
|
||||
AddHtmlLocalized(305, 365, 150, 18, 1044017 + (context == null ? 0 : (int)context.MarkOption), LabelColor); // MARK ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Resmelt option
|
||||
if (craftSystem.Resmelt)
|
||||
{
|
||||
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor, false, false); // SMELT ITEM
|
||||
AddButton(15, 342, 4005, 4007, GetButtonID(6, 1));
|
||||
AddHtmlLocalized(50, 345, 150, 18, 1044259, LabelColor); // SMELT ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Repair option
|
||||
if (craftSystem.Repair)
|
||||
{
|
||||
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor, false, false); // REPAIR ITEM
|
||||
AddButton(270, 342, 4005, 4007, GetButtonID(6, 5));
|
||||
AddHtmlLocalized(305, 345, 150, 18, 1044260, LabelColor); // REPAIR ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
// Enhance option
|
||||
if (craftSystem.CanEnhance)
|
||||
{
|
||||
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor, false, false); // ENHANCE ITEM
|
||||
AddButton(270, 382, 4005, 4007, GetButtonID(6, 8));
|
||||
AddHtmlLocalized(305, 385, 150, 18, 1061001, LabelColor); // ENHANCE ITEM
|
||||
}
|
||||
// ****************************************
|
||||
|
||||
if (notice is int noticeInt && noticeInt > 0)
|
||||
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 295, 350, 40, noticeInt, LabelColor);
|
||||
else if (notice is string)
|
||||
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>", false, false);
|
||||
AddHtml(170, 295, 350, 40, $"<BASEFONT COLOR=#{FontColor:X6}>{notice}</BASEFONT>");
|
||||
|
||||
// If the system has more than one resource
|
||||
if (craftSystem.CraftSubRes.Init)
|
||||
|
|
@ -131,10 +121,10 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[i].Amount;
|
||||
}
|
||||
|
||||
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 362, 4005, 4007, GetButtonID(6, 0));
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 365, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
|
||||
else
|
||||
AddLabel(50, 362, LabelHue, $"{nameString} ({resourceCount} Available)");
|
||||
}
|
||||
|
|
@ -169,10 +159,10 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[i].Amount;
|
||||
}
|
||||
|
||||
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 382, 4005, 4007, GetButtonID(6, 7));
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 385, 250, 18, nameNumber, resourceCount.ToString(), LabelColor);
|
||||
else
|
||||
AddLabel(50, 385, LabelHue, $"{nameString} ({resourceCount} Available)");
|
||||
}
|
||||
|
|
@ -184,7 +174,7 @@ namespace Server.Engines.Craft
|
|||
CreateResList(false, from);
|
||||
else if (page == CraftPage.PickResource2)
|
||||
CreateResList(true, from);
|
||||
else if (context != null && context.LastGroupIndex > -1)
|
||||
else if (context?.LastGroupIndex > -1)
|
||||
CreateItemList(context.LastGroupIndex);
|
||||
}
|
||||
|
||||
|
|
@ -210,9 +200,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
CraftContext context = m_CraftSystem.GetContext(m_From);
|
||||
|
||||
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 260, 4005, 4007, GetButtonID(6, 4));
|
||||
AddHtmlLocalized(255, 263, 200, 18, context == null || !context.DoNotColor ? 1061591 : 1061590,
|
||||
LabelColor, false, false);
|
||||
LabelColor);
|
||||
}
|
||||
|
||||
int resourceCount = 0;
|
||||
|
|
@ -225,11 +215,11 @@ namespace Server.Engines.Craft
|
|||
resourceCount += items[j].Amount;
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i));
|
||||
|
||||
if (subResource.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 250, 18, subResource.NameNumber, resourceCount.ToString(),
|
||||
LabelColor, false, false);
|
||||
LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, $"{subResource.NameString} ({resourceCount})");
|
||||
}
|
||||
|
|
@ -256,7 +246,7 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage(i / 10 + 1);
|
||||
|
|
@ -264,21 +254,21 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(3, i));
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
|
||||
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i), GumpButtonType.Reply, 0);
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(4, i));
|
||||
}
|
||||
else
|
||||
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor, false, false); // You haven't made anything yet.
|
||||
AddHtmlLocalized(230, 62, 200, 22, 1044165, LabelColor); // You haven't made anything yet.
|
||||
}
|
||||
|
||||
public void CreateItemList(int selectedGroup)
|
||||
|
|
@ -304,7 +294,7 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(370, 260, 4005, 4007, 0, GumpButtonType.Page, i / 10 + 1);
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor, false, false); // NEXT PAGE
|
||||
AddHtmlLocalized(405, 263, 100, 18, 1044045, LabelColor); // NEXT PAGE
|
||||
}
|
||||
|
||||
AddPage(i / 10 + 1);
|
||||
|
|
@ -312,18 +302,18 @@ namespace Server.Engines.Craft
|
|||
if (i > 0)
|
||||
{
|
||||
AddButton(220, 260, 4014, 4015, 0, GumpButtonType.Page, i / 10);
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor, false, false); // PREV PAGE
|
||||
AddHtmlLocalized(255, 263, 100, 18, 1044044, LabelColor); // PREV PAGE
|
||||
}
|
||||
}
|
||||
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i), GumpButtonType.Reply, 0);
|
||||
AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(1, i));
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(255, 63 + index * 20, 220, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(255, 60 + index * 20, LabelHue, craftItem.NameString);
|
||||
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i), GumpButtonType.Reply, 0);
|
||||
AddButton(480, 60 + index * 20, 4011, 4012, GetButtonID(2, i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -331,17 +321,17 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
CraftGroupCol craftGroupCol = m_CraftSystem.CraftGroups;
|
||||
|
||||
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3), GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor, false, false); // LAST TEN
|
||||
AddButton(15, 60, 4005, 4007, GetButtonID(6, 3));
|
||||
AddHtmlLocalized(50, 63, 150, 18, 1044014, LabelColor); // LAST TEN
|
||||
|
||||
for (int i = 0; i < craftGroupCol.Count; i++)
|
||||
{
|
||||
CraftGroup craftGroup = craftGroupCol.GetAt(i);
|
||||
|
||||
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i), GumpButtonType.Reply, 0);
|
||||
AddButton(15, 80 + i * 20, 4005, 4007, GetButtonID(0, i));
|
||||
|
||||
if (craftGroup.NameNumber > 0)
|
||||
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(50, 83 + i * 20, 150, 18, craftGroup.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(50, 80 + i * 20, LabelHue, craftGroup.NameString);
|
||||
}
|
||||
|
|
@ -608,11 +598,11 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
|
||||
private enum CraftPage
|
||||
public enum CraftPage
|
||||
{
|
||||
None,
|
||||
PickResource,
|
||||
PickResource2
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,41 +53,40 @@ namespace Server.Engines.Craft
|
|||
AddImageTiled(10, 387, 510, 22, 2624);
|
||||
AddAlphaRegion(10, 10, 510, 399);
|
||||
|
||||
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor, false, false); // ITEM
|
||||
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor, false, false); // <CENTER>SKILLS</CENTER>
|
||||
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor, false, false); // <CENTER>MATERIALS</CENTER>
|
||||
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor, false, false); // <CENTER>OTHER</CENTER>
|
||||
AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor); // ITEM
|
||||
AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor); // <CENTER>SKILLS</CENTER>
|
||||
AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor); // <CENTER>MATERIALS</CENTER>
|
||||
AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor); // <CENTER>OTHER</CENTER>
|
||||
|
||||
if (craftSystem.GumpTitleNumber > 0)
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitleNumber, LabelColor);
|
||||
else
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString, false, false);
|
||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitleString);
|
||||
|
||||
AddButton(15, 387, 4014, 4016, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor, false, false); // BACK
|
||||
AddButton(15, 387, 4014, 4016, 0);
|
||||
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor); // BACK
|
||||
|
||||
bool needsRecipe = craftItem.Recipe != null && from is PlayerMobile mobile &&
|
||||
!mobile.HasRecipe(craftItem.Recipe);
|
||||
|
||||
if (needsRecipe)
|
||||
{
|
||||
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page, 0);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor, false, false); // MAKE NOW
|
||||
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor); // MAKE NOW
|
||||
}
|
||||
else
|
||||
{
|
||||
AddButton(270, 387, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor, false, false); // MAKE NOW
|
||||
AddButton(270, 387, 4005, 4007, 1);
|
||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor); // MAKE NOW
|
||||
}
|
||||
|
||||
if (craftItem.NameNumber > 0)
|
||||
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(330, 40, 180, 18, craftItem.NameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(330, 40, LabelHue, craftItem.NameString);
|
||||
|
||||
if (craftItem.UseAllRes)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor, false,
|
||||
false); // Makes as many as possible at once
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1048176, LabelColor); // Makes as many as possible at once
|
||||
|
||||
DrawItem();
|
||||
DrawSkill();
|
||||
|
|
@ -100,15 +99,14 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (craftItem.RequiredExpansion != Expansion.None)
|
||||
{
|
||||
bool supportsEx = from.NetState != null && from.NetState.SupportsExpansion(craftItem.RequiredExpansion);
|
||||
bool supportsEx = from.NetState?.SupportsExpansion(craftItem.RequiredExpansion) == true;
|
||||
TextDefinition.AddHtmlText(this, 170, 302 + m_OtherCount++ * 20, 310, 18,
|
||||
RequiredExpansionMessage(craftItem.RequiredExpansion), false, false,
|
||||
supportsEx ? LabelColor : RedLabelColor, supportsEx ? LabelHue : RedLabelHue);
|
||||
}
|
||||
|
||||
if (needsRecipe)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor, false,
|
||||
false); // You have not learned this recipe.
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1073620, RedLabelColor); // You have not learned this recipe.
|
||||
}
|
||||
|
||||
private TextDefinition RequiredExpansionMessage(Expansion expansion)
|
||||
|
|
@ -132,8 +130,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (m_CraftItem.IsMarkable(type))
|
||||
{
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor, false,
|
||||
false); // This item may hold its maker's mark
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044059, LabelColor); // This item may hold its maker's mark
|
||||
m_ShowExceptionalChance = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -148,8 +145,7 @@ namespace Server.Engines.Craft
|
|||
if (minSkill < 0)
|
||||
minSkill = 0;
|
||||
|
||||
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor, false,
|
||||
false);
|
||||
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor);
|
||||
AddLabel(430, 132 + i * 20, LabelHue, $"{minSkill:F1}");
|
||||
}
|
||||
|
||||
|
|
@ -171,7 +167,7 @@ namespace Server.Engines.Craft
|
|||
else if (chance > 1.0)
|
||||
chance = 1.0;
|
||||
|
||||
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor, false, false); // Success Chance:
|
||||
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor); // Success Chance:
|
||||
AddLabel(430, 80, LabelHue, $"{chance * 100:F1}%");
|
||||
|
||||
if (m_ShowExceptionalChance)
|
||||
|
|
@ -181,7 +177,7 @@ namespace Server.Engines.Craft
|
|||
else if (excepChance > 1.0)
|
||||
excepChance = 1.0;
|
||||
|
||||
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767, false, false); // Exceptional Chance:
|
||||
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767); // Exceptional Chance:
|
||||
AddLabel(430, 100, LabelHue, $"{excepChance * 100:F1}%");
|
||||
}
|
||||
}
|
||||
|
|
@ -232,13 +228,12 @@ namespace Server.Engines.Craft
|
|||
if (!retainedColor && m_CraftItem.RetainsColorFrom(m_CraftSystem, type))
|
||||
{
|
||||
retainedColor = true;
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor, false,
|
||||
false); // * The item retains the color of this material
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 310, 18, 1044152, LabelColor); // * The item retains the color of this material
|
||||
AddLabel(500, 219 + i * 20, LabelHue, "*");
|
||||
}
|
||||
|
||||
if (nameNumber > 0)
|
||||
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor);
|
||||
else
|
||||
AddLabel(170, 219 + i * 20, LabelHue, nameString);
|
||||
|
||||
|
|
@ -247,13 +242,12 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (m_CraftItem.NameNumber == 1041267) // runebook
|
||||
{
|
||||
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor, false, false);
|
||||
AddHtmlLocalized(170, 219 + m_CraftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor);
|
||||
AddLabel(430, 219 + m_CraftItem.Resources.Count * 20, LabelHue, "1");
|
||||
}
|
||||
|
||||
if (cropScroll)
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor, false,
|
||||
false); // Inscribing scrolls also requires a blank scroll and mana.
|
||||
AddHtmlLocalized(170, 302 + m_OtherCount++ * 20, 360, 18, 1044379, LabelColor); // Inscribing scrolls also requires a blank scroll and mana.
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -292,4 +286,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Commands;
|
||||
using Server.Factions;
|
||||
using Server.Items;
|
||||
|
|
@ -273,16 +274,12 @@ namespace Server.Engines.Craft
|
|||
return false;
|
||||
|
||||
IPooledEnumerable<Item> eable = map.GetItemsInRange(from.Location, 2);
|
||||
|
||||
foreach (Item item in eable)
|
||||
if (item.Z + 16 > from.Z && from.Z + 16 > item.Z && Find(item.ItemID, itemIDs))
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool found = eable.Any(item => item.Z + 16 > item.Z && item.Z + 16 > item.Z && Find(item.ItemID, itemIDs));
|
||||
eable.Free();
|
||||
|
||||
if (found)
|
||||
return true;
|
||||
|
||||
for (int x = -2; x <= 2; ++x)
|
||||
for (int y = -2; y <= 2; ++y)
|
||||
{
|
||||
|
|
@ -758,7 +755,7 @@ namespace Server.Engines.Craft
|
|||
if (from.BeginAction<CraftSystem>())
|
||||
{
|
||||
if (RequiredExpansion == Expansion.None ||
|
||||
from.NetState != null && from.NetState.SupportsExpansion(RequiredExpansion))
|
||||
from.NetState?.SupportsExpansion(RequiredExpansion) == true)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = GetSuccessChance(from, typeRes, craftSystem, false, ref allRequiredSkills);
|
||||
|
|
@ -860,7 +857,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (badCraft > 0)
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, badCraft));
|
||||
else
|
||||
from.SendLocalizedMessage(badCraft);
|
||||
|
|
@ -876,7 +873,7 @@ namespace Server.Engines.Craft
|
|||
ref checkMessage)
|
||||
&& ConsumeAttributes(from, ref checkMessage, false)))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, checkMessage));
|
||||
else if (checkMessage is int messageInt && messageInt > 0)
|
||||
from.SendLocalizedMessage(messageInt);
|
||||
|
|
@ -905,7 +902,7 @@ namespace Server.Engines.Craft
|
|||
if (!(ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.All, ref message)
|
||||
&& ConsumeAttributes(from, ref message, true)))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, message));
|
||||
else if (message is int messageIn && messageIn > 0)
|
||||
from.SendLocalizedMessage(messageIn);
|
||||
|
|
@ -992,7 +989,7 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
Town town = Town.FromRegion(from.Region);
|
||||
|
||||
if (town != null && town.Owner == faction)
|
||||
if (town?.Owner == faction)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
|
|
@ -1013,14 +1010,14 @@ namespace Server.Engines.Craft
|
|||
if (queryFactionImbue)
|
||||
from.SendGump(new FactionImbueGump(quality, item, from, craftSystem, tool, num, availableSilver, faction,
|
||||
def));
|
||||
else if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
else if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, num));
|
||||
else if (num > 0)
|
||||
from.SendLocalizedMessage(num);
|
||||
}
|
||||
else if (!allRequiredSkills)
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, 1044153));
|
||||
else
|
||||
from.SendLocalizedMessage(1044153); // You don't have the required skills to attempt this item.
|
||||
|
|
@ -1036,7 +1033,7 @@ namespace Server.Engines.Craft
|
|||
// Not enough resource to craft it
|
||||
if (!ConsumeRes(from, typeRes, craftSystem, ref resHue, ref maxAmount, consumeType, ref message, true))
|
||||
{
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, craftSystem, tool, message));
|
||||
else if (message is int messageInt && messageInt > 0)
|
||||
from.SendLocalizedMessage(messageInt);
|
||||
|
|
@ -1104,7 +1101,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (badCraft > 0)
|
||||
{
|
||||
if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0)
|
||||
if (m_Tool?.Deleted == false && m_Tool.UsesRemaining > 0)
|
||||
m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft));
|
||||
else
|
||||
m_From.SendLocalizedMessage(badCraft);
|
||||
|
|
|
|||
|
|
@ -4,14 +4,11 @@ namespace Server.Engines.Craft
|
|||
{
|
||||
public class CraftRes
|
||||
{
|
||||
public CraftRes(Type type, int amount)
|
||||
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message = null)
|
||||
{
|
||||
ItemType = type;
|
||||
Amount = amount;
|
||||
}
|
||||
|
||||
public CraftRes(Type type, TextDefinition name, int amount, TextDefinition message) : this(type, amount)
|
||||
{
|
||||
NameNumber = name;
|
||||
MessageNumber = message;
|
||||
|
||||
|
|
@ -41,4 +38,4 @@ namespace Server.Engines.Craft
|
|||
from.SendLocalizedMessage(502925); // You don't have the resources required to make that item.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,4 +31,4 @@ namespace Server.Engines.Craft
|
|||
|
||||
public double RequiredSkill{ get; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,13 +31,13 @@ namespace Server.Engines.Craft
|
|||
AddBackground(0, 0, 220, 170, 5054);
|
||||
AddBackground(10, 10, 200, 150, 3000);
|
||||
|
||||
AddHtmlLocalized(20, 20, 180, 80, 1018317, false, false); // Do you wish to place your maker's mark on this item?
|
||||
AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
|
||||
|
||||
AddHtmlLocalized(55, 100, 140, 25, 1011011, false, false); // CONTINUE
|
||||
AddButton(20, 100, 4005, 4007, 1, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
|
||||
AddButton(20, 100, 4005, 4007, 1);
|
||||
|
||||
AddHtmlLocalized(55, 125, 140, 25, 1011012, false, false); // CANCEL
|
||||
AddButton(20, 125, 4005, 4007, 0, GumpButtonType.Reply, 0);
|
||||
AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
|
||||
AddButton(20, 125, 4005, 4007, 0);
|
||||
}
|
||||
|
||||
public override void OnResponse(NetState sender, RelayInfo info)
|
||||
|
|
@ -52,4 +52,4 @@ namespace Server.Engines.Craft
|
|||
m_CraftItem.CompleteCraft(m_Quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,16 +34,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public int ID{ get; }
|
||||
|
||||
public TextDefinition TextDefinition
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_TD == null)
|
||||
m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString);
|
||||
|
||||
return m_TD;
|
||||
}
|
||||
}
|
||||
public TextDefinition TextDefinition => m_TD ?? (m_TD = new TextDefinition(CraftItem.NameNumber, CraftItem.NameString));
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
catch
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
return SmeltResult.Invalid;
|
||||
|
|
|
|||
|
|
@ -17,16 +17,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044001;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefAlchemy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefAlchemy());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -35,8 +26,9 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
||||
|
|
@ -180,4 +172,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,16 +30,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044002;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefBlacksmithy();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBlacksmithy());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -111,7 +102,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
@ -801,4 +792,4 @@ namespace Server.Engines.Craft
|
|||
public class AnvilAttribute : Attribute
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044006;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefBowFletching();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefBowFletching());
|
||||
|
||||
public override CraftECA ECA => CraftECA.FiftyPercentChanceMinusTenPercent;
|
||||
|
||||
|
|
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -212,4 +203,4 @@ namespace Server.Engines.Craft
|
|||
Repair = Core.AOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044004;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCarpentry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCarpentry());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -545,4 +536,4 @@ namespace Server.Engines.Craft
|
|||
AddSubRes(typeof(FrostwoodLog), 1072649, 100.0, 1044041, 1072652);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044008;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCartography();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCartography());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -33,7 +24,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -76,4 +67,4 @@ namespace Server.Engines.Craft
|
|||
AddCraft(typeof(WorldMap), 1044448, 1015233, 39.5, 99.5, typeof(BlankMap), 1044449, 1, 1044450);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,16 +15,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044003;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefCooking();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefCooking());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -35,7 +26,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -292,4 +283,4 @@ namespace Server.Engines.Craft
|
|||
/* End Chocolatiering */
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,28 +16,16 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044622;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefGlassblowing();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefGlassblowing());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
if (item.ItemType == typeof(HollowPrism))
|
||||
return 0.5; // 50%
|
||||
|
||||
return 0.0; // 0%
|
||||
return item.ItemType == typeof(HollowPrism) ? 0.5 : 0.0;
|
||||
}
|
||||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
@ -48,10 +36,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
DefBlacksmithy.CheckAnvilAndForge(from, 2, out _, out bool forge);
|
||||
|
||||
if (forge)
|
||||
return 0;
|
||||
|
||||
return 1044628; // You must be near a forge to blow glass.
|
||||
return forge ? 0 : 1044628; // You must be near a forge to blow glass.
|
||||
}
|
||||
|
||||
public override void PlayCraftEffect(Mobile from)
|
||||
|
|
@ -128,4 +113,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,16 +36,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044009;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefInscription();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefInscription());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -54,7 +45,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -65,9 +56,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
if (o is SpellScroll scroll)
|
||||
{
|
||||
Spellbook book = Spellbook.Find(from, scroll.SpellID);
|
||||
|
||||
bool hasSpell = book != null && book.HasSpell(scroll.SpellID);
|
||||
bool hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;
|
||||
|
||||
scroll.Delete();
|
||||
|
||||
|
|
@ -121,7 +110,6 @@ namespace Server.Engines.Craft
|
|||
switch (m_Circle)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
minSkill = -25.0;
|
||||
maxSkill = 25.0;
|
||||
break;
|
||||
|
|
@ -409,4 +397,4 @@ namespace Server.Engines.Craft
|
|||
SpidersSilk
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,16 +16,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044500;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefMasonry();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefMasonry());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -39,7 +30,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckTool(tool, from))
|
||||
return 1048146; // If you have a tool equipped, you must use that tool.
|
||||
|
|
@ -139,4 +130,4 @@ namespace Server.Engines.Craft
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,16 +23,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044005;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefTailoring();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefTailoring());
|
||||
|
||||
public override CraftECA ECA => CraftECA.ChanceMinusSixtyToFourtyFive;
|
||||
|
||||
|
|
@ -43,7 +34,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -427,4 +418,4 @@ namespace Server.Engines.Craft
|
|||
CanEnhance = Core.AOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,16 +31,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int GumpTitleNumber => 1044007;
|
||||
|
||||
public static CraftSystem CraftSystem
|
||||
{
|
||||
get
|
||||
{
|
||||
if (m_CraftSystem == null)
|
||||
m_CraftSystem = new DefTinkering();
|
||||
|
||||
return m_CraftSystem;
|
||||
}
|
||||
}
|
||||
public static CraftSystem CraftSystem => m_CraftSystem ?? (m_CraftSystem = new DefTinkering());
|
||||
|
||||
public override double GetChanceAtMin(CraftItem item)
|
||||
{
|
||||
|
|
@ -52,7 +43,7 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override int CanCraft(Mobile from, BaseTool tool, Type itemType)
|
||||
{
|
||||
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
|
||||
if (tool?.Deleted != false || tool.UsesRemaining < 0)
|
||||
return 1044038; // You have worn out your tool!
|
||||
if (!BaseTool.CheckAccessible(tool, from))
|
||||
return 1044263; // The tool must be on your person to use.
|
||||
|
|
@ -507,7 +498,7 @@ namespace Server.Engines.Craft
|
|||
Mobile from = m_TrapCraft.From;
|
||||
BaseTool tool = m_TrapCraft.Tool;
|
||||
|
||||
if (tool != null && !tool.Deleted && tool.UsesRemaining > 0)
|
||||
if (tool?.Deleted == false && tool.UsesRemaining > 0)
|
||||
from.SendGump(new CraftGump(from, m_TrapCraft.CraftSystem, tool, message));
|
||||
else if (message > 0)
|
||||
from.SendLocalizedMessage(message);
|
||||
|
|
@ -547,4 +538,4 @@ namespace Server.Engines.Craft
|
|||
|
||||
public override TrapType TrapType => TrapType.ExplosionTrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue