## 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.
367 lines
11 KiB
C#
367 lines
11 KiB
C#
using ModernUO.Serialization;
|
|
using Server.Engines.VeteranRewards;
|
|
using Server.Gumps;
|
|
using Server.Multis;
|
|
using Server.Network;
|
|
using Server.Targeting;
|
|
|
|
namespace Server.Items;
|
|
|
|
[SerializationGenerator(0)]
|
|
public partial class DecorativeShield : Item, IAddon, IRewardItem
|
|
{
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _isRewardItem;
|
|
|
|
[Constructible]
|
|
public DecorativeShield(int itemID = 0x156C) : base(itemID) => Movable = false;
|
|
|
|
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
|
|
|
public bool FacingSouth
|
|
{
|
|
get
|
|
{
|
|
if (ItemID < 0x1582)
|
|
{
|
|
return (ItemID & 0x1) == 0;
|
|
}
|
|
|
|
return ItemID <= 0x1585;
|
|
}
|
|
}
|
|
|
|
public Item Deed =>
|
|
new DecorativeShieldDeed
|
|
{
|
|
IsRewardItem = _isRewardItem
|
|
};
|
|
|
|
public bool CouldFit(IPoint3D p, Map map) =>
|
|
map?.CanFit(p.X, p.Y, p.Z, ItemData.Height) == true &&
|
|
(FacingSouth && BaseAddon.IsWall(p.X, p.Y - 1, p.Z, map) || BaseAddon.IsWall(p.X - 1, p.Y, p.Z, map));
|
|
|
|
public override void GetProperties(IPropertyList list)
|
|
{
|
|
base.GetProperties(list);
|
|
|
|
if (Core.ML && _isRewardItem)
|
|
{
|
|
list.Add(1076220); // 4th Year Veteran Reward
|
|
}
|
|
}
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
if (!from.InRange(Location, 2))
|
|
{
|
|
from.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
|
return;
|
|
}
|
|
|
|
var house = BaseHouse.FindHouseAt(this);
|
|
|
|
if (house?.IsOwner(from) == true)
|
|
{
|
|
RewardDemolitionGump.DisplayTo(from, this, 1049783); // Do you wish to re-deed this decoration?
|
|
}
|
|
else
|
|
{
|
|
// You can only re-deed this decoration if you are the house owner or originally placed the decoration.
|
|
from.SendLocalizedMessage(1049784);
|
|
}
|
|
}
|
|
}
|
|
|
|
[SerializationGenerator(0)]
|
|
public partial class DecorativeShieldDeed : Item, IRewardItem
|
|
{
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _isRewardItem;
|
|
|
|
[Constructible]
|
|
public DecorativeShieldDeed() : base(0x14F0) => LootType = LootType.Blessed;
|
|
|
|
public override double DefaultWeight => 1.0;
|
|
public override int LabelNumber => 1049771; // deed for a decorative shield wall hanging
|
|
|
|
public override void GetProperties(IPropertyList list)
|
|
{
|
|
base.GetProperties(list);
|
|
|
|
if (_isRewardItem)
|
|
{
|
|
list.Add(1076220); // 4th Year Veteran Reward
|
|
}
|
|
}
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
if (_isRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (IsChildOf(from.Backpack))
|
|
{
|
|
DecorativeShieldGump.DisplayTo(from, this);
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
|
|
}
|
|
}
|
|
|
|
public static int GetWestItemID(int east)
|
|
{
|
|
return east switch
|
|
{
|
|
0x1582 => 0x1635,
|
|
0x1583 => 0x1634,
|
|
0x1584 => 0x1637,
|
|
0x1585 => 0x1636,
|
|
_ => east + 1
|
|
};
|
|
}
|
|
|
|
private class DecorativeShieldGump : StaticGump<DecorativeShieldGump>
|
|
{
|
|
public const int Start = 0x156C;
|
|
public const int End = 0x1585;
|
|
|
|
private readonly DecorativeShieldDeed _shield;
|
|
|
|
public override bool Singleton => true;
|
|
|
|
private DecorativeShieldGump(DecorativeShieldDeed shield) : base(150, 50) => _shield = shield;
|
|
|
|
public static void DisplayTo(Mobile from, DecorativeShieldDeed shield)
|
|
{
|
|
if (from?.NetState == null || shield?.Deleted != false)
|
|
{
|
|
return;
|
|
}
|
|
|
|
from.SendGump(new DecorativeShieldGump(shield));
|
|
}
|
|
|
|
protected override void BuildLayout(ref StaticGumpBuilder builder)
|
|
{
|
|
builder.AddPage();
|
|
|
|
builder.AddBackground(25, 0, 500, 230, 0xA28);
|
|
|
|
var itemID = Start;
|
|
|
|
for (var i = 1; i <= 2; i++)
|
|
{
|
|
builder.AddPage(i);
|
|
|
|
for (var j = 0; j < 9 - i; j++)
|
|
{
|
|
builder.AddItem(40 + j * 60, 70, itemID);
|
|
builder.AddButton(60 + j * 60, 50, 0x845, 0x846, itemID);
|
|
|
|
if (itemID < 0x1582)
|
|
{
|
|
itemID += 2;
|
|
}
|
|
else
|
|
{
|
|
itemID += 1;
|
|
}
|
|
}
|
|
|
|
switch (i)
|
|
{
|
|
case 1:
|
|
{
|
|
builder.AddButton(455, 198, 0x8B0, 0x8B0, 0, GumpButtonType.Page, 2);
|
|
break;
|
|
}
|
|
case 2:
|
|
{
|
|
builder.AddButton(70, 198, 0x8AF, 0x8AF, 0, GumpButtonType.Page, 1);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void OnResponse(NetState sender, in RelayInfo info)
|
|
{
|
|
if (_shield?.Deleted != false ||
|
|
info.ButtonID is < Start or > End ||
|
|
((info.ButtonID & 0x1) != 0 || info.ButtonID >= 0x1582) && info.ButtonID is < 0x1582 or > 0x1585)
|
|
{
|
|
return;
|
|
}
|
|
|
|
sender.Mobile.SendLocalizedMessage(1049780); // Where would you like to place this decoration?
|
|
sender.Mobile.Target = new InternalTarget(_shield, info.ButtonID);
|
|
}
|
|
}
|
|
|
|
private class InternalTarget : Target
|
|
{
|
|
private readonly int _itemID;
|
|
private readonly DecorativeShieldDeed _shield;
|
|
|
|
public InternalTarget(DecorativeShieldDeed shield, int itemID) : base(-1, true, TargetFlags.None)
|
|
{
|
|
_shield = shield;
|
|
_itemID = itemID;
|
|
}
|
|
|
|
protected override void OnTarget(Mobile from, object targeted)
|
|
{
|
|
if (_shield?.Deleted != false)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!_shield.IsChildOf(from.Backpack))
|
|
{
|
|
from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
|
|
return;
|
|
}
|
|
|
|
var house = BaseHouse.FindHouseAt(from);
|
|
|
|
if (house?.IsOwner(from) != true)
|
|
{
|
|
from.SendLocalizedMessage(502092); // You must be in your house to do this.
|
|
return;
|
|
}
|
|
|
|
var p = targeted as IPoint3D;
|
|
var map = from.Map;
|
|
|
|
if (p == null || map == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var p3d = new Point3D(p);
|
|
var id = TileData.ItemTable[_itemID & TileData.MaxItemValue];
|
|
|
|
if (!map.CanFit(p3d, id.Height))
|
|
{
|
|
from.SendLocalizedMessage(500269); // You cannot build that there.
|
|
return;
|
|
}
|
|
|
|
house = BaseHouse.FindHouseAt(p3d, map, id.Height);
|
|
|
|
if (house?.IsOwner(from) != true)
|
|
{
|
|
from.SendLocalizedMessage(1042036); // That location is not in your house.
|
|
return;
|
|
}
|
|
|
|
var north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
|
|
var west = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);
|
|
|
|
if (north && west)
|
|
{
|
|
DecorativeShieldFacingGump.DisplayTo(from, _shield, _itemID, p3d, house);
|
|
}
|
|
else if (north || west)
|
|
{
|
|
var shield = new DecorativeShield(west ? GetWestItemID(_itemID) : _itemID);
|
|
|
|
house.Addons.Add(shield);
|
|
|
|
shield.IsRewardItem = _shield.IsRewardItem;
|
|
shield.MoveToWorld(p3d, map);
|
|
|
|
_shield.Delete();
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(1049781); // This decoration must be placed next to a wall.
|
|
}
|
|
}
|
|
|
|
private class DecorativeShieldFacingGump : DynamicGump
|
|
{
|
|
private readonly BaseHouse _house;
|
|
private readonly int _itemID;
|
|
private readonly Point3D _location;
|
|
private readonly DecorativeShieldDeed _shield;
|
|
|
|
public override bool Singleton => true;
|
|
|
|
private DecorativeShieldFacingGump(DecorativeShieldDeed shield, int itemID, Point3D location, BaseHouse house) : base(150, 50)
|
|
{
|
|
_shield = shield;
|
|
_itemID = itemID;
|
|
_location = location;
|
|
_house = house;
|
|
}
|
|
|
|
public static void DisplayTo(Mobile from, DecorativeShieldDeed shield, int itemID, Point3D location, BaseHouse house)
|
|
{
|
|
if (from?.NetState == null || shield?.Deleted != false || house == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
from.SendGump(new DecorativeShieldFacingGump(shield, itemID, location, house));
|
|
}
|
|
|
|
protected override void BuildLayout(ref DynamicGumpBuilder builder)
|
|
{
|
|
builder.AddPage();
|
|
builder.AddBackground(0, 0, 300, 150, 0xA28);
|
|
|
|
builder.AddItem(90, 30, GetWestItemID(_itemID));
|
|
builder.AddItem(180, 30, _itemID);
|
|
|
|
builder.AddButton(50, 35, 0x867, 0x869, (int)Buttons.East);
|
|
builder.AddButton(145, 35, 0x867, 0x869, (int)Buttons.South);
|
|
}
|
|
|
|
public override void OnResponse(NetState sender, in RelayInfo info)
|
|
{
|
|
if (_shield?.Deleted != false || _house == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
DecorativeShield shield = null;
|
|
|
|
if (info.ButtonID == (int)Buttons.East)
|
|
{
|
|
shield = new DecorativeShield(GetWestItemID(_itemID));
|
|
}
|
|
|
|
if (info.ButtonID == (int)Buttons.South)
|
|
{
|
|
shield = new DecorativeShield(_itemID);
|
|
}
|
|
|
|
if (shield != null)
|
|
{
|
|
_house.Addons.Add(shield);
|
|
|
|
shield.IsRewardItem = _shield.IsRewardItem;
|
|
shield.MoveToWorld(_location, sender.Mobile.Map);
|
|
|
|
_shield.Delete();
|
|
}
|
|
}
|
|
|
|
private enum Buttons
|
|
{
|
|
Cancel,
|
|
South,
|
|
East
|
|
}
|
|
}
|
|
}
|
|
}
|