fix: Converts MakersMark gump to static & CraftGumpItem to dynamic (#2095)
This commit is contained in:
parent
6d879e1d22
commit
b5e3f49d06
3 changed files with 331 additions and 325 deletions
|
|
@ -4,333 +4,341 @@ using Server.Items;
|
||||||
using Server.Mobiles;
|
using Server.Mobiles;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Engines.Craft
|
namespace Server.Engines.Craft;
|
||||||
|
|
||||||
|
public class CraftGumpItem : DynamicGump
|
||||||
{
|
{
|
||||||
public class CraftGumpItem : Gump
|
private const int LabelHue = 0x480; // 0x384
|
||||||
|
private const int RedLabelHue = 0x20;
|
||||||
|
|
||||||
|
private const int LabelColor = 0x7FFF;
|
||||||
|
private const int RedLabelColor = 0x6400;
|
||||||
|
|
||||||
|
private const int GreyLabelColor = 0x3DEF;
|
||||||
|
|
||||||
|
private static readonly Type typeofBlankScroll = typeof(BlankScroll);
|
||||||
|
private static readonly Type typeofSpellScroll = typeof(SpellScroll);
|
||||||
|
|
||||||
|
private readonly Mobile _from;
|
||||||
|
private readonly CraftItem _craftItem;
|
||||||
|
private readonly CraftSystem _craftSystem;
|
||||||
|
private readonly BaseTool _tool;
|
||||||
|
|
||||||
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40)
|
||||||
{
|
{
|
||||||
private const int LabelHue = 0x480; // 0x384
|
_from = from;
|
||||||
private const int RedLabelHue = 0x20;
|
_craftSystem = craftSystem;
|
||||||
|
_craftItem = craftItem;
|
||||||
|
_tool = tool;
|
||||||
|
}
|
||||||
|
|
||||||
private const int LabelColor = 0x7FFF;
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
||||||
private const int RedLabelColor = 0x6400;
|
{
|
||||||
|
builder.AddPage();
|
||||||
|
builder.AddBackground(0, 0, 530, 417, 5054);
|
||||||
|
builder.AddImageTiled(10, 10, 510, 22, 2624);
|
||||||
|
builder.AddImageTiled(10, 37, 150, 148, 2624);
|
||||||
|
builder.AddImageTiled(165, 37, 355, 90, 2624);
|
||||||
|
builder.AddImageTiled(10, 190, 155, 22, 2624);
|
||||||
|
builder.AddImageTiled(10, 217, 150, 53, 2624);
|
||||||
|
builder.AddImageTiled(165, 132, 355, 80, 2624);
|
||||||
|
builder.AddImageTiled(10, 275, 155, 22, 2624);
|
||||||
|
builder.AddImageTiled(10, 302, 150, 53, 2624);
|
||||||
|
builder.AddImageTiled(165, 217, 355, 80, 2624);
|
||||||
|
builder.AddImageTiled(10, 360, 155, 22, 2624);
|
||||||
|
builder.AddImageTiled(165, 302, 355, 80, 2624);
|
||||||
|
builder.AddImageTiled(10, 387, 510, 22, 2624);
|
||||||
|
builder.AddAlphaRegion(10, 10, 510, 399);
|
||||||
|
|
||||||
private const int GreyLabelColor = 0x3DEF;
|
builder.AddHtmlLocalized(170, 40, 150, 20, 1044053, LabelColor); // ITEM
|
||||||
|
builder.AddHtmlLocalized(10, 192, 150, 22, 1044054, LabelColor); // <CENTER>SKILLS</CENTER>
|
||||||
|
builder.AddHtmlLocalized(10, 277, 150, 22, 1044055, LabelColor); // <CENTER>MATERIALS</CENTER>
|
||||||
|
builder.AddHtmlLocalized(10, 362, 150, 22, 1044056, LabelColor); // <CENTER>OTHER</CENTER>
|
||||||
|
|
||||||
private static readonly Type typeofBlankScroll = typeof(BlankScroll);
|
if (_craftSystem.GumpTitle.Number > 0)
|
||||||
private static readonly Type typeofSpellScroll = typeof(SpellScroll);
|
|
||||||
private readonly CraftItem m_CraftItem;
|
|
||||||
private readonly CraftSystem m_CraftSystem;
|
|
||||||
private readonly Mobile m_From;
|
|
||||||
private readonly BaseTool m_Tool;
|
|
||||||
|
|
||||||
private int m_OtherCount;
|
|
||||||
|
|
||||||
private bool m_ShowExceptionalChance;
|
|
||||||
|
|
||||||
public override bool Singleton => true;
|
|
||||||
|
|
||||||
public CraftGumpItem(Mobile from, CraftSystem craftSystem, CraftItem craftItem, BaseTool tool) : base(40, 40)
|
|
||||||
{
|
{
|
||||||
m_From = from;
|
builder.AddHtmlLocalized(10, 12, 510, 20, _craftSystem.GumpTitle.Number, LabelColor);
|
||||||
m_CraftSystem = craftSystem;
|
}
|
||||||
m_CraftItem = craftItem;
|
else
|
||||||
m_Tool = tool;
|
{
|
||||||
|
builder.AddHtml(10, 12, 510, 20, _craftSystem.GumpTitle.String);
|
||||||
AddPage(0);
|
|
||||||
AddBackground(0, 0, 530, 417, 5054);
|
|
||||||
AddImageTiled(10, 10, 510, 22, 2624);
|
|
||||||
AddImageTiled(10, 37, 150, 148, 2624);
|
|
||||||
AddImageTiled(165, 37, 355, 90, 2624);
|
|
||||||
AddImageTiled(10, 190, 155, 22, 2624);
|
|
||||||
AddImageTiled(10, 217, 150, 53, 2624);
|
|
||||||
AddImageTiled(165, 132, 355, 80, 2624);
|
|
||||||
AddImageTiled(10, 275, 155, 22, 2624);
|
|
||||||
AddImageTiled(10, 302, 150, 53, 2624);
|
|
||||||
AddImageTiled(165, 217, 355, 80, 2624);
|
|
||||||
AddImageTiled(10, 360, 155, 22, 2624);
|
|
||||||
AddImageTiled(165, 302, 355, 80, 2624);
|
|
||||||
AddImageTiled(10, 387, 510, 22, 2624);
|
|
||||||
AddAlphaRegion(10, 10, 510, 399);
|
|
||||||
|
|
||||||
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.GumpTitle.Number > 0)
|
|
||||||
{
|
|
||||||
AddHtmlLocalized(10, 12, 510, 20, craftSystem.GumpTitle.Number, LabelColor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddHtml(10, 12, 510, 20, craftSystem.GumpTitle.String);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddButton(15, 387, 4014, 4016, 0);
|
|
||||||
AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor); // BACK
|
|
||||||
|
|
||||||
var needsRecipe = craftItem.Recipe != null && from is PlayerMobile mobile &&
|
|
||||||
!mobile.HasRecipe(craftItem.Recipe);
|
|
||||||
|
|
||||||
if (needsRecipe)
|
|
||||||
{
|
|
||||||
AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page);
|
|
||||||
AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor); // MAKE NOW
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddLabel(330, 40, LabelHue, craftItem.NameString);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (craftItem.UseAllRes)
|
|
||||||
{
|
|
||||||
AddHtmlLocalized(
|
|
||||||
170,
|
|
||||||
302 + m_OtherCount++ * 20,
|
|
||||||
310,
|
|
||||||
18,
|
|
||||||
1048176, // Makes as many as possible at once
|
|
||||||
LabelColor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawItem();
|
|
||||||
DrawSkill();
|
|
||||||
DrawResource();
|
|
||||||
|
|
||||||
if (craftItem.RequiredExpansion != Expansion.None)
|
|
||||||
{
|
|
||||||
var supportsEx = from.NetState?.SupportsExpansion(craftItem.RequiredExpansion) == true;
|
|
||||||
RequiredExpansionMessage(craftItem.RequiredExpansion).AddHtmlText(
|
|
||||||
this,
|
|
||||||
170,
|
|
||||||
302 + m_OtherCount++ * 20,
|
|
||||||
310,
|
|
||||||
18,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
supportsEx ? LabelColor : RedLabelColor,
|
|
||||||
supportsEx ? LabelHue : RedLabelHue
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needsRecipe)
|
|
||||||
{
|
|
||||||
AddHtmlLocalized(
|
|
||||||
170,
|
|
||||||
302 + m_OtherCount++ * 20,
|
|
||||||
310,
|
|
||||||
18,
|
|
||||||
1073620, // You have not learned this recipe.
|
|
||||||
RedLabelColor
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static TextDefinition RequiredExpansionMessage(Expansion expansion)
|
builder.AddButton(15, 387, 4014, 4016, 0);
|
||||||
|
builder.AddHtmlLocalized(50, 390, 150, 18, 1044150, LabelColor); // BACK
|
||||||
|
|
||||||
|
var needsRecipe = _craftItem.Recipe != null && _from is PlayerMobile mobile &&
|
||||||
|
!mobile.HasRecipe(_craftItem.Recipe);
|
||||||
|
|
||||||
|
if (needsRecipe)
|
||||||
{
|
{
|
||||||
return expansion switch
|
builder.AddButton(270, 387, 4005, 4007, 0, GumpButtonType.Page);
|
||||||
{
|
builder.AddHtmlLocalized(305, 390, 150, 18, 1044151, GreyLabelColor); // MAKE NOW
|
||||||
Expansion.SE => 1063363, // * Requires the "Samurai Empire" expansion
|
}
|
||||||
Expansion.ML => 1072651, // * Requires the "Mondain's Legacy" expansion
|
else
|
||||||
_ => $"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion"
|
{
|
||||||
};
|
builder.AddButton(270, 387, 4005, 4007, 1);
|
||||||
|
builder.AddHtmlLocalized(305, 390, 150, 18, 1044151, LabelColor); // MAKE NOW
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawItem()
|
if (_craftItem.NameNumber > 0)
|
||||||
{
|
{
|
||||||
var type = m_CraftItem.ItemType;
|
builder.AddHtmlLocalized(330, 40, 180, 18, _craftItem.NameNumber, LabelColor);
|
||||||
|
}
|
||||||
AddItem(20, 50, m_CraftItem.ItemId, m_CraftItem.ItemHue);
|
else
|
||||||
|
{
|
||||||
if (m_CraftItem.IsMarkable(type))
|
builder.AddLabel(330, 40, LabelHue, _craftItem.NameString);
|
||||||
{
|
|
||||||
AddHtmlLocalized(
|
|
||||||
170,
|
|
||||||
302 + m_OtherCount++ * 20,
|
|
||||||
310,
|
|
||||||
18,
|
|
||||||
1044059, // This item may hold its maker's mark
|
|
||||||
LabelColor
|
|
||||||
);
|
|
||||||
m_ShowExceptionalChance = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawSkill()
|
if (_craftItem.UseAllRes)
|
||||||
{
|
{
|
||||||
for (var i = 0; i < m_CraftItem.Skills.Count; i++)
|
builder.AddHtmlLocalized(
|
||||||
{
|
170,
|
||||||
var skill = m_CraftItem.Skills[i];
|
302,
|
||||||
var minSkill = Math.Max(skill.MinSkill, 0);
|
310,
|
||||||
|
18,
|
||||||
|
1048176, // Makes as many as possible at once
|
||||||
|
LabelColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor);
|
var otherCount = 1;
|
||||||
AddLabel(430, 132 + i * 20, LabelHue, $"{minSkill:F1}");
|
|
||||||
}
|
|
||||||
|
|
||||||
var res = m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes;
|
DrawItem(ref builder, ref otherCount, out var showExceptionalChance);
|
||||||
var resIndex = -1;
|
DrawSkill(ref builder, showExceptionalChance);
|
||||||
|
DrawResource(ref builder, ref otherCount);
|
||||||
|
|
||||||
var context = m_CraftSystem.GetContext(m_From);
|
if (_craftItem.RequiredExpansion != Expansion.None)
|
||||||
|
{
|
||||||
if (context != null)
|
var supportsEx = _from.NetState?.SupportsExpansion(_craftItem.RequiredExpansion) == true;
|
||||||
{
|
RequiredExpansionMessage(_craftItem.RequiredExpansion).AddHtmlText(
|
||||||
resIndex = m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
ref builder,
|
||||||
}
|
170,
|
||||||
|
302 + otherCount++ * 20,
|
||||||
var chance = m_CraftItem.GetSuccessChance(
|
310,
|
||||||
m_From,
|
18,
|
||||||
resIndex > -1 ? res.GetAt(resIndex).ItemType : null,
|
|
||||||
m_CraftSystem,
|
|
||||||
false,
|
false,
|
||||||
out _
|
false,
|
||||||
|
supportsEx ? LabelColor : RedLabelColor,
|
||||||
|
supportsEx ? LabelHue : RedLabelHue
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needsRecipe)
|
||||||
|
{
|
||||||
|
builder.AddHtmlLocalized(
|
||||||
|
170,
|
||||||
|
302 + otherCount++ * 20,
|
||||||
|
310,
|
||||||
|
18,
|
||||||
|
1073620, // You have not learned this recipe.
|
||||||
|
RedLabelColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static TextDefinition RequiredExpansionMessage(Expansion expansion)
|
||||||
|
{
|
||||||
|
return expansion switch
|
||||||
|
{
|
||||||
|
Expansion.SE => 1063363, // * Requires the "Samurai Empire" expansion
|
||||||
|
Expansion.ML => 1072651, // * Requires the "Mondain's Legacy" expansion
|
||||||
|
_ => $"* Requires the \"{ExpansionInfo.GetInfo(expansion).Name}\" expansion"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawItem(ref DynamicGumpBuilder builder, ref int otherCount, out bool showExceptionalChance)
|
||||||
|
{
|
||||||
|
var type = _craftItem.ItemType;
|
||||||
|
|
||||||
|
builder.AddItem(20, 50, _craftItem.ItemId, _craftItem.ItemHue);
|
||||||
|
|
||||||
|
if (_craftItem.IsMarkable(type))
|
||||||
|
{
|
||||||
|
builder.AddHtmlLocalized(
|
||||||
|
170,
|
||||||
|
302 + otherCount++ * 20,
|
||||||
|
310,
|
||||||
|
18,
|
||||||
|
1044059, // This item may hold its maker's mark
|
||||||
|
LabelColor
|
||||||
);
|
);
|
||||||
|
|
||||||
AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor); // Success Chance:
|
showExceptionalChance = true;
|
||||||
AddLabel(430, 80, LabelHue, $"{Math.Clamp(chance, 0, 1) * 100:F1}%");
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
showExceptionalChance = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (m_ShowExceptionalChance)
|
public void DrawSkill(ref DynamicGumpBuilder builder, bool showExceptionalChance)
|
||||||
{
|
{
|
||||||
var exceptChance = Math.Clamp(m_CraftItem.GetExceptionalChance(m_CraftSystem, chance, m_From), 0, 1.0);
|
for (var i = 0; i < _craftItem.Skills.Count; i++)
|
||||||
|
{
|
||||||
|
var skill = _craftItem.Skills[i];
|
||||||
|
var minSkill = Math.Max(skill.MinSkill, 0);
|
||||||
|
|
||||||
AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767); // Exceptional Chance:
|
builder.AddHtmlLocalized(170, 132 + i * 20, 200, 18, AosSkillBonuses.GetLabel(skill.SkillToMake), LabelColor);
|
||||||
AddLabel(430, 100, LabelHue, $"{exceptChance * 100:F1}%");
|
builder.AddLabel(430, 132 + i * 20, LabelHue, $"{minSkill:F1}");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawResource()
|
var res = _craftItem.UseSubRes2 ? _craftSystem.CraftSubRes2 : _craftSystem.CraftSubRes;
|
||||||
|
var resIndex = -1;
|
||||||
|
|
||||||
|
var context = _craftSystem.GetContext(_from);
|
||||||
|
|
||||||
|
if (context != null)
|
||||||
{
|
{
|
||||||
var retainedColor = false;
|
resIndex = _craftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
||||||
|
}
|
||||||
|
|
||||||
var context = m_CraftSystem.GetContext(m_From);
|
var chance = _craftItem.GetSuccessChance(
|
||||||
|
_from,
|
||||||
|
resIndex > -1 ? res.GetAt(resIndex).ItemType : null,
|
||||||
|
_craftSystem,
|
||||||
|
false,
|
||||||
|
out _
|
||||||
|
);
|
||||||
|
|
||||||
var res = m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes;
|
builder.AddHtmlLocalized(170, 80, 250, 18, 1044057, LabelColor); // Success Chance:
|
||||||
var resIndex = -1;
|
builder.AddLabel(430, 80, LabelHue, $"{Math.Clamp(chance, 0, 1) * 100:F1}%");
|
||||||
|
|
||||||
if (context != null)
|
if (showExceptionalChance)
|
||||||
|
{
|
||||||
|
var exceptChance = Math.Clamp(_craftItem.GetExceptionalChance(_craftSystem, chance, _from), 0, 1.0);
|
||||||
|
|
||||||
|
builder.AddHtmlLocalized(170, 100, 250, 18, 1044058, 32767); // Exceptional Chance:
|
||||||
|
builder.AddLabel(430, 100, LabelHue, $"{exceptChance * 100:F1}%");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawResource(ref DynamicGumpBuilder builder, ref int otherCount)
|
||||||
|
{
|
||||||
|
var retainedColor = false;
|
||||||
|
|
||||||
|
var context = _craftSystem.GetContext(_from);
|
||||||
|
|
||||||
|
var res = _craftItem.UseSubRes2 ? _craftSystem.CraftSubRes2 : _craftSystem.CraftSubRes;
|
||||||
|
var resIndex = -1;
|
||||||
|
|
||||||
|
if (context != null)
|
||||||
|
{
|
||||||
|
resIndex = _craftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cropScroll = _craftItem.Resources.Count > 1
|
||||||
|
&& _craftItem.Resources[^1].ItemType == typeofBlankScroll
|
||||||
|
&& typeofSpellScroll.IsAssignableFrom(_craftItem.ItemType);
|
||||||
|
|
||||||
|
for (var i = 0; i < _craftItem.Resources.Count - (cropScroll ? 1 : 0) && i < 4; i++)
|
||||||
|
{
|
||||||
|
var craftResource = _craftItem.Resources[i];
|
||||||
|
|
||||||
|
var type = craftResource.ItemType;
|
||||||
|
var nameString = craftResource.Name.String;
|
||||||
|
var nameNumber = craftResource.Name.Number;
|
||||||
|
|
||||||
|
// Resource Mutation
|
||||||
|
if (type == res.ResType && resIndex > -1)
|
||||||
{
|
{
|
||||||
resIndex = m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
var subResource = res.GetAt(resIndex);
|
||||||
|
|
||||||
|
type = subResource.ItemType;
|
||||||
|
|
||||||
|
nameString = subResource.Name.String;
|
||||||
|
nameNumber = subResource.GenericNameNumber;
|
||||||
|
|
||||||
|
if (nameNumber <= 0)
|
||||||
|
{
|
||||||
|
nameNumber = subResource.Name.Number;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
// ******************
|
||||||
|
|
||||||
var cropScroll = m_CraftItem.Resources.Count > 1
|
if (!retainedColor && _craftItem.RetainsColorFrom(_craftSystem, type))
|
||||||
&& m_CraftItem.Resources[^1].ItemType == typeofBlankScroll
|
|
||||||
&& typeofSpellScroll.IsAssignableFrom(m_CraftItem.ItemType);
|
|
||||||
|
|
||||||
for (var i = 0; i < m_CraftItem.Resources.Count - (cropScroll ? 1 : 0) && i < 4; i++)
|
|
||||||
{
|
{
|
||||||
var craftResource = m_CraftItem.Resources[i];
|
retainedColor = true;
|
||||||
|
builder.AddHtmlLocalized(
|
||||||
var type = craftResource.ItemType;
|
|
||||||
var nameString = craftResource.Name.String;
|
|
||||||
var nameNumber = craftResource.Name.Number;
|
|
||||||
|
|
||||||
// Resource Mutation
|
|
||||||
if (type == res.ResType && resIndex > -1)
|
|
||||||
{
|
|
||||||
var subResource = res.GetAt(resIndex);
|
|
||||||
|
|
||||||
type = subResource.ItemType;
|
|
||||||
|
|
||||||
nameString = subResource.Name.String;
|
|
||||||
nameNumber = subResource.GenericNameNumber;
|
|
||||||
|
|
||||||
if (nameNumber <= 0)
|
|
||||||
{
|
|
||||||
nameNumber = subResource.Name.Number;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// ******************
|
|
||||||
|
|
||||||
if (!retainedColor && m_CraftItem.RetainsColorFrom(m_CraftSystem, type))
|
|
||||||
{
|
|
||||||
retainedColor = true;
|
|
||||||
AddHtmlLocalized(
|
|
||||||
170,
|
|
||||||
302 + m_OtherCount++ * 20,
|
|
||||||
310,
|
|
||||||
18,
|
|
||||||
1044152, // * The item retains the color of this material
|
|
||||||
LabelColor
|
|
||||||
);
|
|
||||||
AddLabel(500, 219 + i * 20, LabelHue, "*");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nameNumber > 0)
|
|
||||||
{
|
|
||||||
AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
AddLabel(170, 219 + i * 20, LabelHue, nameString);
|
|
||||||
}
|
|
||||||
|
|
||||||
AddLabel(430, 219 + i * 20, LabelHue, craftResource.Amount.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_CraftItem.NameNumber == 1041267) // runebook
|
|
||||||
{
|
|
||||||
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,
|
170,
|
||||||
302 + m_OtherCount++ * 20,
|
302 + otherCount++ * 20,
|
||||||
360,
|
310,
|
||||||
18,
|
18,
|
||||||
1044379, // Inscribing scrolls also requires a blank scroll and mana.
|
1044152, // * The item retains the color of this material
|
||||||
LabelColor
|
LabelColor
|
||||||
);
|
);
|
||||||
|
builder.AddLabel(500, 219 + i * 20, LabelHue, "*");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nameNumber > 0)
|
||||||
|
{
|
||||||
|
builder.AddHtmlLocalized(170, 219 + i * 20, 310, 18, nameNumber, LabelColor);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
builder.AddLabel(170, 219 + i * 20, LabelHue, nameString);
|
||||||
|
}
|
||||||
|
|
||||||
|
builder.AddLabel(430, 219 + i * 20, LabelHue, craftResource.Amount.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
if (_craftItem.NameNumber == 1041267) // runebook
|
||||||
{
|
{
|
||||||
// Back Button
|
builder.AddHtmlLocalized(170, 219 + _craftItem.Resources.Count * 20, 310, 18, 1044447, LabelColor);
|
||||||
if (info.ButtonID == 0)
|
builder.AddLabel(430, 219 + _craftItem.Resources.Count * 20, LabelHue, "1");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cropScroll)
|
||||||
|
{
|
||||||
|
builder.AddHtmlLocalized(
|
||||||
|
170,
|
||||||
|
302 + otherCount++ * 20,
|
||||||
|
360,
|
||||||
|
18,
|
||||||
|
1044379, // Inscribing scrolls also requires a blank scroll and mana.
|
||||||
|
LabelColor
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||||
|
{
|
||||||
|
var from = sender.Mobile;
|
||||||
|
|
||||||
|
// Back Button
|
||||||
|
if (info.ButtonID == 0)
|
||||||
|
{
|
||||||
|
var craftGump = new CraftGump(from, _craftSystem, _tool, null);
|
||||||
|
from.SendGump(craftGump);
|
||||||
|
}
|
||||||
|
else // Make Button
|
||||||
|
{
|
||||||
|
var num = _craftSystem.CanCraft(from, _tool, _craftItem.ItemType);
|
||||||
|
|
||||||
|
if (num > 0)
|
||||||
{
|
{
|
||||||
var craftGump = new CraftGump(m_From, m_CraftSystem, m_Tool, null);
|
from.SendGump(new CraftGump(from, _craftSystem, _tool, num));
|
||||||
m_From.SendGump(craftGump);
|
|
||||||
}
|
}
|
||||||
else // Make Button
|
else
|
||||||
{
|
{
|
||||||
var num = m_CraftSystem.CanCraft(m_From, m_Tool, m_CraftItem.ItemType);
|
Type type = null;
|
||||||
|
|
||||||
if (num > 0)
|
var context = _craftSystem.GetContext(from);
|
||||||
|
|
||||||
|
if (context != null)
|
||||||
{
|
{
|
||||||
m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, num));
|
var res = _craftItem.UseSubRes2 ? _craftSystem.CraftSubRes2 : _craftSystem.CraftSubRes;
|
||||||
}
|
var resIndex = _craftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
||||||
else
|
|
||||||
{
|
|
||||||
Type type = null;
|
|
||||||
|
|
||||||
var context = m_CraftSystem.GetContext(m_From);
|
if (resIndex > -1)
|
||||||
|
|
||||||
if (context != null)
|
|
||||||
{
|
{
|
||||||
var res = m_CraftItem.UseSubRes2 ? m_CraftSystem.CraftSubRes2 : m_CraftSystem.CraftSubRes;
|
type = res.GetAt(resIndex).ItemType;
|
||||||
var resIndex = m_CraftItem.UseSubRes2 ? context.LastResourceIndex2 : context.LastResourceIndex;
|
|
||||||
|
|
||||||
if (resIndex > -1)
|
|
||||||
{
|
|
||||||
type = res.GetAt(resIndex).ItemType;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_CraftSystem.CreateItem(m_From, m_CraftItem.ItemType, type, m_Tool, m_CraftItem);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_craftSystem.CreateItem(from, _craftItem.ItemType, type, _tool, _craftItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1400,7 +1400,6 @@ namespace Server.Engines.Craft
|
||||||
m_From.SendGump(
|
m_From.SendGump(
|
||||||
new QueryMakersMarkGump(
|
new QueryMakersMarkGump(
|
||||||
quality,
|
quality,
|
||||||
m_From,
|
|
||||||
m_CraftItem,
|
m_CraftItem,
|
||||||
m_CraftSystem,
|
m_CraftSystem,
|
||||||
m_TypeRes,
|
m_TypeRes,
|
||||||
|
|
|
||||||
|
|
@ -3,59 +3,58 @@ using Server.Gumps;
|
||||||
using Server.Items;
|
using Server.Items;
|
||||||
using Server.Network;
|
using Server.Network;
|
||||||
|
|
||||||
namespace Server.Engines.Craft
|
namespace Server.Engines.Craft;
|
||||||
|
|
||||||
|
public class QueryMakersMarkGump : StaticGump<QueryMakersMarkGump>
|
||||||
{
|
{
|
||||||
public class QueryMakersMarkGump : Gump
|
private readonly CraftItem _craftItem;
|
||||||
|
private readonly CraftSystem _craftSystem;
|
||||||
|
private readonly int _quality;
|
||||||
|
private readonly BaseTool _tool;
|
||||||
|
private readonly Type _typeRes;
|
||||||
|
|
||||||
|
public override bool Singleton => true;
|
||||||
|
|
||||||
|
public QueryMakersMarkGump(int quality, CraftItem craftItem, CraftSystem craftSystem, Type typeRes, BaseTool tool)
|
||||||
|
: base(100, 200)
|
||||||
{
|
{
|
||||||
private readonly CraftItem m_CraftItem;
|
_quality = quality;
|
||||||
private readonly CraftSystem m_CraftSystem;
|
_craftItem = craftItem;
|
||||||
private readonly Mobile m_From;
|
_craftSystem = craftSystem;
|
||||||
private readonly int m_Quality;
|
_typeRes = typeRes;
|
||||||
private readonly BaseTool m_Tool;
|
_tool = tool;
|
||||||
private readonly Type m_TypeRes;
|
}
|
||||||
|
|
||||||
public override bool Singleton => true;
|
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
||||||
|
{
|
||||||
|
builder.AddPage();
|
||||||
|
|
||||||
public QueryMakersMarkGump(
|
builder.AddBackground(0, 0, 220, 170, 5054);
|
||||||
int quality, Mobile from, CraftItem craftItem, CraftSystem craftSystem, Type typeRes,
|
builder.AddBackground(10, 10, 200, 150, 3000);
|
||||||
BaseTool tool
|
|
||||||
) : base(100, 200)
|
builder.AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
|
||||||
|
|
||||||
|
builder.AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
|
||||||
|
builder.AddButton(20, 100, 4005, 4007, 1);
|
||||||
|
|
||||||
|
builder.AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
|
||||||
|
builder.AddButton(20, 125, 4005, 4007, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnResponse(NetState sender, in RelayInfo info)
|
||||||
|
{
|
||||||
|
var from = sender.Mobile;
|
||||||
|
var makersMark = info.ButtonID == 1;
|
||||||
|
|
||||||
|
if (makersMark)
|
||||||
{
|
{
|
||||||
m_Quality = quality;
|
from.SendLocalizedMessage(501808); // You mark the item.
|
||||||
m_From = from;
|
}
|
||||||
m_CraftItem = craftItem;
|
else
|
||||||
m_CraftSystem = craftSystem;
|
{
|
||||||
m_TypeRes = typeRes;
|
from.SendLocalizedMessage(501809); // Cancelled mark.
|
||||||
m_Tool = tool;
|
|
||||||
|
|
||||||
AddPage(0);
|
|
||||||
|
|
||||||
AddBackground(0, 0, 220, 170, 5054);
|
|
||||||
AddBackground(10, 10, 200, 150, 3000);
|
|
||||||
|
|
||||||
AddHtmlLocalized(20, 20, 180, 80, 1018317); // Do you wish to place your maker's mark on this item?
|
|
||||||
|
|
||||||
AddHtmlLocalized(55, 100, 140, 25, 1011011); // CONTINUE
|
|
||||||
AddButton(20, 100, 4005, 4007, 1);
|
|
||||||
|
|
||||||
AddHtmlLocalized(55, 125, 140, 25, 1011012); // CANCEL
|
|
||||||
AddButton(20, 125, 4005, 4007, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnResponse(NetState sender, in RelayInfo info)
|
_craftItem.CompleteCraft(_quality, makersMark, from, _craftSystem, _typeRes, _tool, null);
|
||||||
{
|
|
||||||
var makersMark = info.ButtonID == 1;
|
|
||||||
|
|
||||||
if (makersMark)
|
|
||||||
{
|
|
||||||
m_From.SendLocalizedMessage(501808); // You mark the item.
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_From.SendLocalizedMessage(501809); // Cancelled mark.
|
|
||||||
}
|
|
||||||
|
|
||||||
m_CraftItem.CompleteCraft(m_Quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue