fix(ui): finish retail stack selector polish
Keep the horizontal thumb at its raw pointer position so both endpoints are reachable, honor the stack entry's authored right alignment, and preserve PublicWeenieDesc plural names from CreateObject through the object table. Port retail's singular s/es fallback when no plural was sent. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
a20e5c68c7
commit
6005c51c4d
22 changed files with 233 additions and 36 deletions
|
|
@ -145,6 +145,8 @@ public sealed class ClientObject
|
|||
public uint ObjectId { get; init; }
|
||||
public uint WeenieClassId { get; set; } // "blueprint"
|
||||
public string Name { get; set; } = "";
|
||||
/// <summary>Retail <c>PublicWeenieDesc._plural_name</c>; empty falls back to singular.</summary>
|
||||
public string PluralName { get; set; } = "";
|
||||
public ItemType Type { get; set; }
|
||||
public EquipMask ValidLocations { get; set; }
|
||||
public EquipMask CurrentlyEquippedLocation { get; set; }
|
||||
|
|
@ -194,6 +196,19 @@ public sealed class ClientObject
|
|||
public int MaxStructure { get; set; }
|
||||
public float Workmanship { get; set; } // 0..10 (fractional on the wire)
|
||||
public PropertyBundle Properties { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// Ports <c>ACCWeenieObject::GetObjectName(NAME_APPROPRIATE) @ 0x0058E6E0</c>:
|
||||
/// stacked objects prefer <see cref="PluralName"/>; when the wire omitted it,
|
||||
/// retail appends <c>s</c>, or <c>es</c> when the singular already ends in lowercase s.
|
||||
/// </summary>
|
||||
public string GetAppropriateName()
|
||||
{
|
||||
if (StackSize <= 1) return Name;
|
||||
if (!string.IsNullOrEmpty(PluralName)) return PluralName;
|
||||
if (string.IsNullOrEmpty(Name)) return Name;
|
||||
return Name[^1] == 's' ? Name + "es" : Name + "s";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -233,7 +248,8 @@ public readonly record struct WeenieData(
|
|||
byte? RadarBlipColor = null,
|
||||
byte? RadarBehavior = null,
|
||||
uint? PublicWeenieBitfield = null,
|
||||
byte? CombatUse = null);
|
||||
byte? CombatUse = null,
|
||||
string? PluralName = null);
|
||||
|
||||
/// <summary>
|
||||
/// Retail ITEM_USEABLE helpers (acclient.h:6478, ItemUses::* at 0x004fccd0).
|
||||
|
|
|
|||
|
|
@ -366,6 +366,7 @@ public sealed class ClientObjectTable
|
|||
uint oldContainer = obj.ContainerId;
|
||||
|
||||
if (!string.IsNullOrEmpty(d.Name)) obj.Name = d.Name!;
|
||||
if (!string.IsNullOrEmpty(d.PluralName)) obj.PluralName = d.PluralName!;
|
||||
if (d.Type is { } t) obj.Type = t;
|
||||
// WeenieClassId arrives on every CreateObject (fixed prefix) and is never
|
||||
// legitimately 0 for a real weenie; the != 0 guard avoids clobbering a known
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue