## Summary Migrates 16 player-facing legacy `Gump` subclasses in the Veteran Rewards system to `DynamicGump` or `StaticGump<T>`, renames every nested `InternalGump`/`ConfirmGump` to system-prefixed names, and updates external callers to use new static `DisplayTo` entry points. ### Reward chain (Engines/Veteran Rewards) | Gump | Base type | Reasoning | |---|---|---| | `RewardNoticeGump` | `StaticGump<T>` | Fixed layout | | `RewardChoiceGump` | `DynamicGump` | Layout shape varies (per-player categories, entries, pages) | | `RewardConfirmGump` | `DynamicGump` | `entry.Name` is a dynamic cliloc per reward (cliloc rule) | | `RewardOptionGump` | `DynamicGump` | Title cliloc and per-option clilocs are dynamic (cliloc rule) | | `RewardDemolitionGump` | `DynamicGump` | `question` cliloc is dynamic per caller (cliloc rule) | ### Statue (Engines/Veteran Rewards/Character Statue Maker) | Gump | Base type | Reasoning | |---|---|---| | `CharacterStatueGump` | `DynamicGump` | Pose/Direction/Material labels are dynamic clilocs (cliloc rule) | | `CharacterPlinthGump` | `DynamicGump` | `statue.Name`, sculpted-on date, and statue-type cliloc are dynamic (cliloc rule) | ### Decorations (Items/Special/Veteran Rewards) — every `InternalGump` renamed | Original | New name | Base type | Reasoning | |---|---|---|---| | `Banner.InternalGump` | `BannerGump` | `StaticGump<T>` | Fully fixed item-id picker over `Start..End` range | | `Brazier.InternalGump` | `BrazierGump` | `StaticGump<T>` | Fixed two-item picker | | `Cannon.InternalGump` | `CannonGump` | `DynamicGump` | `keg.Validate()` value passed as `~1_CHARGES~` arg (cliloc-arg rule) | | `DecorativeShield.InternalGump` | `DecorativeShieldGump` | `StaticGump<T>` | Fixed item picker over a constant range | | `DecorativeShield.FacingGump` | `DecorativeShieldFacingGump` | `DynamicGump` | Item ids depend on instance state | | `HangingSkeleton.InternalGump` | `HangingSkeletonGump` | `StaticGump<T>` | Fixed item picker (5 hard-coded ids) | | `PottedCactus.InternalGump` | `PottedCactusGump` | `StaticGump<T>` | Fixed 6-item picker | | `StoneAnkh.InternalGump` | `StoneAnkhGump` | `StaticGump<T>` | Fixed two-direction picker | | `WallBanner.InternalGump` | `WallBannerGump` | `StaticGump<T>` | Fixed 30-banner picker across 5 pages | | `WeaponEngravingTool.InternalGump` | `WeaponEngravingToolGump` | `StaticGump<T>` | Fixed text-entry dialog | | `WeaponEngravingTool.ConfirmGump` | `WeaponEngravingToolConfirmGump` | `DynamicGump` | Layout branches on `guildmaster != null` | ### External callers updated `RewardSystem`, `CharacterStatue`, `FireFliesDeed`, `FlamingHead`, `Banner`, `DecorativeShield`, `HangingSkeleton`, `StoneAnkh` (RewardDemolitionGump callers); `AnkhOfSacrifice`, `Cannon`, `MiningCart`, `MinotaurStatue`, `TreeStump` (RewardOptionGump callers); `TinkerGuildmaster` (engraver confirm gump). The pre-existing `FacingGump` inside `Banner.cs` (already `DynamicGump`) was left as-is — it is private, nested inside `InternalTarget`, and never referenced outside.
339 lines
11 KiB
C#
339 lines
11 KiB
C#
using ModernUO.Serialization;
|
|
using Server.Engines.VeteranRewards;
|
|
using Server.Gumps;
|
|
using Server.Mobiles;
|
|
using Server.Network;
|
|
using Server.Targeting;
|
|
|
|
namespace Server.Items;
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class WeaponEngravingTool : Item, IUsesRemaining, IRewardItem
|
|
{
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private int _usesRemaining;
|
|
|
|
[InvalidateProperties]
|
|
[SerializableField(1)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _isRewardItem;
|
|
|
|
[Constructible]
|
|
public WeaponEngravingTool(int uses = 10) : base(0x32F8)
|
|
{
|
|
LootType = LootType.Blessed;
|
|
_usesRemaining = uses;
|
|
}
|
|
|
|
public override double DefaultWeight => 1.0;
|
|
|
|
public override int LabelNumber => 1076158; // Weapon Engraving Tool
|
|
|
|
public bool ShowUsesRemaining
|
|
{
|
|
get => true;
|
|
set { }
|
|
}
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
if (_isRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (_usesRemaining > 0)
|
|
{
|
|
from.SendLocalizedMessage(1072357); // Select an object to engrave.
|
|
from.Target = new TargetWeapon(this);
|
|
return;
|
|
}
|
|
|
|
if (from.Skills.Tinkering.Value == 0)
|
|
{
|
|
// Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
|
from.SendLocalizedMessage(1076179);
|
|
return;
|
|
}
|
|
|
|
if (from.Skills.Tinkering.Value < 75.0)
|
|
{
|
|
// Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
|
|
from.SendLocalizedMessage(1076178);
|
|
return;
|
|
}
|
|
|
|
if (from.Backpack.FindItemByType<BlueDiamond>() == null)
|
|
{
|
|
// You do not have a blue diamond needed to recharge the engraving tool.
|
|
from.SendLocalizedMessage(1076166);
|
|
return;
|
|
}
|
|
|
|
from.SendLocalizedMessage(1076163); // There are no charges left on this engraving tool.
|
|
WeaponEngravingToolConfirmGump.DisplayTo(from, this, null);
|
|
}
|
|
|
|
public override void GetProperties(IPropertyList list)
|
|
{
|
|
base.GetProperties(list);
|
|
|
|
if (_isRewardItem)
|
|
{
|
|
list.Add(1076224); // 8th Year Veteran Reward
|
|
}
|
|
|
|
if (ShowUsesRemaining)
|
|
{
|
|
list.Add(1060584, _usesRemaining); // uses remaining: ~1_val~
|
|
}
|
|
}
|
|
|
|
public virtual void Recharge(Mobile from, Mobile guildmaster)
|
|
{
|
|
if (from.Backpack == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var diamond = from.Backpack.FindItemByType<BlueDiamond>();
|
|
|
|
if (guildmaster != null)
|
|
{
|
|
if (_usesRemaining > 0)
|
|
{
|
|
// I can only help with this if you are carrying an engraving tool that needs repair.s
|
|
guildmaster.Say(1076164);
|
|
}
|
|
else if (diamond != null && Banker.Withdraw(from, 100000))
|
|
{
|
|
diamond.Consume();
|
|
UsesRemaining = 10;
|
|
guildmaster.Say(1076165); // Your weapon engraver should be good as new!
|
|
}
|
|
else
|
|
{
|
|
// You need a 100,000 gold and a blue diamond to recharge the weapon engraver.
|
|
guildmaster.Say(1076167);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
if (from.Skills.Tinkering.Value == 0)
|
|
{
|
|
// Since you have no tinkering skill, you will need to find an NPC tinkerer to repair this for you.
|
|
from.SendLocalizedMessage(1076179);
|
|
return;
|
|
}
|
|
|
|
if (from.Skills.Tinkering.Value < 75.0)
|
|
{
|
|
// Your tinkering skill is too low to fix this yourself. An NPC tinkerer can help you repair this for a fee.
|
|
from.SendLocalizedMessage(1076178);
|
|
return;
|
|
}
|
|
|
|
if (diamond == null)
|
|
{
|
|
// You do not have a blue diamond needed to recharge the engraving tool.
|
|
from.SendLocalizedMessage(1076166);
|
|
return;
|
|
}
|
|
|
|
diamond.Consume();
|
|
|
|
if (Utility.RandomDouble() < from.Skills.Tinkering.Value / 100)
|
|
{
|
|
UsesRemaining = 10;
|
|
from.SendLocalizedMessage(1076165); // Your weapon engraver should be good as new! ?????
|
|
}
|
|
else
|
|
{
|
|
// You cracked the diamond attempting to fix the weapon engraver.
|
|
from.SendLocalizedMessage(1076175);
|
|
}
|
|
}
|
|
|
|
public static WeaponEngravingTool Find(Mobile from) => from.Backpack?.FindItemByType<WeaponEngravingTool>();
|
|
|
|
private class TargetWeapon : Target
|
|
{
|
|
private readonly WeaponEngravingTool _tool;
|
|
|
|
public TargetWeapon(WeaponEngravingTool tool) : base(-1, true, TargetFlags.None) => _tool = tool;
|
|
|
|
protected override void OnTarget(Mobile from, object targeted)
|
|
{
|
|
if (_tool?.Deleted != false)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (targeted is BaseWeapon item)
|
|
{
|
|
WeaponEngravingToolGump.DisplayTo(from, _tool, item);
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(1072309); // The selected item cannot be engraved by this engraving tool.
|
|
}
|
|
}
|
|
}
|
|
|
|
private class WeaponEngravingToolGump : StaticGump<WeaponEngravingToolGump>
|
|
{
|
|
private readonly BaseWeapon _target;
|
|
private readonly WeaponEngravingTool _tool;
|
|
|
|
public override bool Singleton => true;
|
|
|
|
private WeaponEngravingToolGump(WeaponEngravingTool tool, BaseWeapon target) : base(0, 0)
|
|
{
|
|
_tool = tool;
|
|
_target = target;
|
|
}
|
|
|
|
public static void DisplayTo(Mobile from, WeaponEngravingTool tool, BaseWeapon target)
|
|
{
|
|
if (from?.NetState == null || tool?.Deleted != false || target?.Deleted != false)
|
|
{
|
|
return;
|
|
}
|
|
|
|
from.SendGump(new WeaponEngravingToolGump(tool, target));
|
|
}
|
|
|
|
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
|
{
|
|
builder.AddPage();
|
|
|
|
builder.AddBackground(50, 50, 400, 300, 0xA28);
|
|
|
|
builder.AddHtmlLocalized(50, 70, 400, 20, 1072359, 0x0); // <CENTER>Engraving Tool</CENTER>
|
|
// Please enter the text to add to the selected object. Leave the text area blank to remove any existing text. Removing text does not use a charge.
|
|
builder.AddHtmlLocalized(75, 95, 350, 145, 1076229, 0x0, true, true);
|
|
builder.AddButton(125, 300, 0x81A, 0x81B, (int)Buttons.Okay);
|
|
builder.AddButton(320, 300, 0x819, 0x818, (int)Buttons.Cancel);
|
|
builder.AddImageTiled(75, 245, 350, 40, 0xDB0);
|
|
builder.AddImageTiled(76, 245, 350, 2, 0x23C5);
|
|
builder.AddImageTiled(75, 245, 2, 40, 0x23C3);
|
|
builder.AddImageTiled(75, 285, 350, 2, 0x23C5);
|
|
builder.AddImageTiled(425, 245, 2, 42, 0x23C3);
|
|
|
|
builder.AddTextEntry(75, 245, 350, 40, 0x0, (int)Buttons.Text, "");
|
|
}
|
|
|
|
public override void OnResponse(NetState state, in RelayInfo info)
|
|
{
|
|
if (_tool?.Deleted != false || _target?.Deleted != false)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (info.ButtonID != (int)Buttons.Okay)
|
|
{
|
|
state.Mobile.SendLocalizedMessage(1072363); // The object was not engraved.
|
|
return;
|
|
}
|
|
|
|
var relay = info.GetTextEntry((int)Buttons.Text);
|
|
|
|
if (relay == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (string.IsNullOrEmpty(relay))
|
|
{
|
|
_target.EngravedText = null;
|
|
state.Mobile.SendLocalizedMessage(1072362); // You remove the engraving from the object.
|
|
}
|
|
else
|
|
{
|
|
_target.EngravedText =
|
|
(relay.Length > 64 ? relay[..64] : relay).FixHtml();
|
|
state.Mobile.SendLocalizedMessage(1072361); // You engraved the object.
|
|
_target.InvalidateProperties();
|
|
_tool.UsesRemaining -= 1;
|
|
_tool.InvalidateProperties();
|
|
}
|
|
}
|
|
|
|
private enum Buttons
|
|
{
|
|
Cancel,
|
|
Okay,
|
|
Text
|
|
}
|
|
}
|
|
|
|
public class WeaponEngravingToolConfirmGump : DynamicGump
|
|
{
|
|
private readonly WeaponEngravingTool _engraver;
|
|
private readonly Mobile _guildmaster;
|
|
|
|
public override bool Singleton => true;
|
|
|
|
private WeaponEngravingToolConfirmGump(WeaponEngravingTool engraver, Mobile guildmaster) : base(200, 200)
|
|
{
|
|
_engraver = engraver;
|
|
_guildmaster = guildmaster;
|
|
}
|
|
|
|
public static void DisplayTo(Mobile from, WeaponEngravingTool engraver, Mobile guildmaster)
|
|
{
|
|
if (from?.NetState == null || engraver?.Deleted != false)
|
|
{
|
|
return;
|
|
}
|
|
|
|
from.SendGump(new WeaponEngravingToolConfirmGump(engraver, guildmaster));
|
|
}
|
|
|
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
|
{
|
|
builder.SetNoClose();
|
|
|
|
builder.AddPage();
|
|
|
|
builder.AddBackground(0, 0, 291, 133, 0x13BE);
|
|
builder.AddImageTiled(5, 5, 280, 100, 0xA40);
|
|
|
|
if (_guildmaster != null)
|
|
{
|
|
// It will cost you 100,000 gold and a blue diamond to recharge your weapon engraver with 10 charges.
|
|
builder.AddHtmlLocalized(9, 9, 272, 100, 1076169, 0x7FFF);
|
|
builder.AddHtmlLocalized(195, 109, 120, 20, 1076172, 0x7FFF); // Recharge it
|
|
}
|
|
else
|
|
{
|
|
// You will need a blue diamond to repair the tip of the engraver. A successful repair will give the engraver 10 charges.
|
|
builder.AddHtmlLocalized(9, 9, 272, 100, 1076176, 0x7FFF);
|
|
builder.AddHtmlLocalized(195, 109, 120, 20, 1076177, 0x7FFF); // Replace the tip.
|
|
}
|
|
|
|
builder.AddButton(160, 107, 0xFB7, 0xFB8, (int)Buttons.Confirm);
|
|
builder.AddButton(5, 107, 0xFB1, 0xFB2, (int)Buttons.Cancel);
|
|
builder.AddHtmlLocalized(40, 109, 100, 20, 1060051, 0x7FFF); // CANCEL
|
|
}
|
|
|
|
public override void OnResponse(NetState state, in RelayInfo info)
|
|
{
|
|
if (_engraver?.Deleted != false || info.ButtonID != (int)Buttons.Confirm)
|
|
{
|
|
return;
|
|
}
|
|
|
|
_engraver.Recharge(state.Mobile, _guildmaster);
|
|
}
|
|
|
|
private enum Buttons
|
|
{
|
|
Cancel,
|
|
Confirm
|
|
}
|
|
}
|
|
}
|