Prefer typed item keys in runtime commits
This commit is contained in:
parent
95bd76ee91
commit
d2996bc072
8 changed files with 90 additions and 33 deletions
|
|
@ -94,8 +94,8 @@ public class ActionBarConsumableBinding : ActionBarBinding
|
|||
else Slot.Fill.fillAmount = instance.RemainingDuration / instance.Duration;
|
||||
}
|
||||
|
||||
private string TargetItemKey =>
|
||||
Guid.TryParse(Target.LegacyId, out var legacyId) ? AetheriaRuntimeItemReference.FromLegacyId(legacyId) : "";
|
||||
public string TargetItemKey =>
|
||||
Guid.TryParse(Target?.LegacyId, out var legacyId) ? AetheriaRuntimeItemReference.FromLegacyId(legacyId) : "";
|
||||
|
||||
public string TargetItemDefinitionLegacyId => Target?.LegacyId ?? "";
|
||||
|
||||
|
|
@ -116,14 +116,14 @@ public class ActionBarGearBinding : ActionBarBinding
|
|||
{
|
||||
get
|
||||
{
|
||||
var itemKey = Item?.EquippableItem?.ItemKey ?? "";
|
||||
const string legacyPrefix = "aetheria.item_definition:legacy:";
|
||||
return itemKey.StartsWith(legacyPrefix, StringComparison.OrdinalIgnoreCase)
|
||||
? itemKey.Substring(legacyPrefix.Length)
|
||||
return AetheriaRuntimeItemReference.ToLegacyId(TargetItemKey) is var legacyId && legacyId != Guid.Empty
|
||||
? legacyId.ToString("D")
|
||||
: "";
|
||||
}
|
||||
}
|
||||
|
||||
public string TargetItemKey => Item?.EquippableItem?.ItemKey ?? "";
|
||||
|
||||
public ActionBarGearBinding(Entity entity, ActionBarSlot slot, EquippedItem item, IActivatedBehavior behavior) : base(entity, slot)
|
||||
{
|
||||
Item = item;
|
||||
|
|
|
|||
Loading…
Reference in a new issue