## 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.
234 lines
6.6 KiB
C#
234 lines
6.6 KiB
C#
using System;
|
|
using ModernUO.Serialization;
|
|
using Server.Collections;
|
|
using Server.ContextMenus;
|
|
using Server.Engines.VeteranRewards;
|
|
using Server.Gumps;
|
|
using Server.Mobiles;
|
|
using Server.Network;
|
|
|
|
namespace Server.Items;
|
|
|
|
[SerializationGenerator(0, false)]
|
|
public partial class AnkhOfSacrificeComponent : AddonComponent
|
|
{
|
|
public AnkhOfSacrificeComponent(int itemID) : base(itemID)
|
|
{
|
|
}
|
|
|
|
public override bool ForceShowProperties => ObjectPropertyList.Enabled;
|
|
public override int LabelNumber => 1027772; // Ankh of Sacrifice
|
|
|
|
public override void GetContextMenuEntries(Mobile from, ref PooledRefList<ContextMenuEntry> list)
|
|
{
|
|
base.GetContextMenuEntries(from, ref list);
|
|
|
|
if (Core.UOTD && !Core.AOS && from is PlayerMobile mobile)
|
|
{
|
|
list.Add(new Ankhs.LockKarmaEntry(mobile.KarmaLocked));
|
|
}
|
|
|
|
list.Add(new ResurrectEntry());
|
|
}
|
|
|
|
public static void Resurrect(PlayerMobile m, AnkhOfSacrificeAddon ankh)
|
|
{
|
|
if (m == null)
|
|
{
|
|
}
|
|
else if (!m.InRange(ankh.GetWorldLocation(), 2))
|
|
{
|
|
m.SendLocalizedMessage(500446); // That is too far away.
|
|
}
|
|
else if (m.Alive)
|
|
{
|
|
m.SendLocalizedMessage(1060197); // You are not dead, and thus cannot be resurrected!
|
|
}
|
|
else if (m.AnkhNextUse > Core.Now)
|
|
{
|
|
var delay = m.AnkhNextUse - Core.Now;
|
|
|
|
if (delay.TotalMinutes > 0)
|
|
{
|
|
// You must wait ~1_minutes~ minutes before you can use this item.
|
|
m.SendLocalizedMessage(1079265, Math.Round(delay.TotalMinutes).ToString());
|
|
}
|
|
else
|
|
{
|
|
// You must wait ~1_seconds~ seconds before you can use this item.
|
|
m.SendLocalizedMessage(1079263, Math.Round(delay.TotalSeconds).ToString());
|
|
}
|
|
}
|
|
else
|
|
{
|
|
m.SendGump(new AnkhResurrectGump(m, ResurrectMessage.VirtueShrine));
|
|
}
|
|
}
|
|
|
|
private class ResurrectEntry : ContextMenuEntry
|
|
{
|
|
public ResurrectEntry() : base(6195, 2)
|
|
{
|
|
}
|
|
|
|
public override void OnClick(Mobile from, IEntity target)
|
|
{
|
|
if (target is AnkhOfSacrificeAddon { Deleted: false } ankh)
|
|
{
|
|
Resurrect(from as PlayerMobile, ankh);
|
|
}
|
|
}
|
|
}
|
|
|
|
private class AnkhResurrectGump : ResurrectGump
|
|
{
|
|
public AnkhResurrectGump(Mobile owner, ResurrectMessage msg) : base(owner, msg)
|
|
{
|
|
}
|
|
|
|
public override void OnResponse(NetState state, in RelayInfo info)
|
|
{
|
|
if (info.ButtonID is not 1 and not 2)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var from = state.Mobile;
|
|
|
|
if (from.Map?.CanFit(from.Location, 16, false, false) != true)
|
|
{
|
|
from.SendLocalizedMessage(502391); // Thou can not be resurrected there!
|
|
return;
|
|
}
|
|
|
|
if (from is PlayerMobile mobile)
|
|
{
|
|
mobile.AnkhNextUse = Core.Now + TimeSpan.FromHours(1);
|
|
}
|
|
|
|
base.OnResponse(state, info);
|
|
}
|
|
}
|
|
}
|
|
|
|
[SerializationGenerator(0)]
|
|
public partial class AnkhOfSacrificeAddon : BaseAddon, IRewardItem
|
|
{
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _isRewardItem;
|
|
|
|
[Constructible]
|
|
public AnkhOfSacrificeAddon(bool east)
|
|
{
|
|
if (east)
|
|
{
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1D98), 0, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1D97), 0, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD6), 1, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD4), 1, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD0), 2, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CCE), 2, 1, 0);
|
|
}
|
|
else
|
|
{
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1E5D), 0, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1E5C), 1, 0, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD2), 0, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CD8), 1, 1, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CCD), 0, 2, 0);
|
|
AddComponent(new AnkhOfSacrificeComponent(0x1CCE), 1, 2, 0);
|
|
}
|
|
}
|
|
|
|
public override bool HandlesOnMovement => true;
|
|
|
|
public override BaseAddonDeed Deed =>
|
|
new AnkhOfSacrificeDeed
|
|
{
|
|
IsRewardItem = _isRewardItem
|
|
};
|
|
|
|
public override void OnMovement(Mobile m, Point3D oldLocation)
|
|
{
|
|
if (!m.Alive && Utility.InRange(Location, m.Location, 1) && !Utility.InRange(Location, oldLocation, 1))
|
|
{
|
|
AnkhOfSacrificeComponent.Resurrect(m as PlayerMobile, this);
|
|
}
|
|
}
|
|
}
|
|
|
|
[SerializationGenerator(0)]
|
|
public partial class AnkhOfSacrificeDeed : BaseAddonDeed, IRewardItem, IRewardOption
|
|
{
|
|
private bool _east;
|
|
|
|
[InvalidateProperties]
|
|
[SerializableField(0)]
|
|
[SerializedCommandProperty(AccessLevel.GameMaster)]
|
|
private bool _isRewardItem;
|
|
|
|
[Constructible]
|
|
public AnkhOfSacrificeDeed(bool isRewardItem = false)
|
|
{
|
|
LootType = LootType.Blessed;
|
|
_isRewardItem = isRewardItem;
|
|
}
|
|
|
|
public override int LabelNumber => 1080397; // Deed For An Ankh Of Sacrifice
|
|
|
|
public override BaseAddon Addon =>
|
|
new AnkhOfSacrificeAddon(_east)
|
|
{
|
|
IsRewardItem = _isRewardItem
|
|
};
|
|
|
|
public void GetOptions(RewardOptionList list)
|
|
{
|
|
list.Add(1, 1080398); // Ankh of Sacrifice South
|
|
list.Add(2, 1080399); // Ankh of Sacrifice East
|
|
}
|
|
|
|
public void OnOptionSelected(Mobile from, int option)
|
|
{
|
|
_east = option switch
|
|
{
|
|
1 => false,
|
|
2 => true,
|
|
_ => _east
|
|
};
|
|
|
|
if (!Deleted)
|
|
{
|
|
base.OnDoubleClick(from);
|
|
}
|
|
}
|
|
|
|
public override void OnDoubleClick(Mobile from)
|
|
{
|
|
if (_isRewardItem && !RewardSystem.CheckIsUsableBy(from, this))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (IsChildOf(from.Backpack))
|
|
{
|
|
RewardOptionGump.DisplayTo(from, this);
|
|
}
|
|
else
|
|
{
|
|
from.SendLocalizedMessage(1062334); // This item must be in your backpack to be used.
|
|
}
|
|
}
|
|
|
|
public override void GetProperties(IPropertyList list)
|
|
{
|
|
base.GetProperties(list);
|
|
|
|
if (_isRewardItem)
|
|
{
|
|
list.Add(1080457); // 10th Year Veteran Reward
|
|
}
|
|
}
|
|
}
|