From e3da126de4dffa3b38cc14e1480a133658212d30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonathan=20Kr=C3=A4n?= Date: Sun, 24 Jul 2022 23:30:20 +0200 Subject: [PATCH] Add handling of the expireStop appearance flag (#1) --- Backend/Appearance.cs | 4 +++- .../ViewModels/Main/ItemPropertiesViewModel.cs | 13 +++++++++++++ LapisItemEditor/Views/Main/ItemPropertiesView.axaml | 5 +++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Backend/Appearance.cs b/Backend/Appearance.cs index 57d21e4..f557268 100644 --- a/Backend/Appearance.cs +++ b/Backend/Appearance.cs @@ -370,7 +370,6 @@ public Proto.Appearances.AppearanceFlagMarket GetOrCreateMarketFlags() handleFlag(change, flags.IgnoreLook, ItemTypeFlag.IgnoreLook, "ignoreLook"); handleFlag(change, flags.Wearout, ItemTypeFlag.ClientCharges, "wearout"); - handleFlag(change, flags.Expire, ItemTypeFlag.ClientDuration, "expire"); handleFlag(change, flags.Forceuse, ItemTypeFlag.ForceUse, "forceuse"); var hasAnimation = Data.FrameGroup.Count != 0 && Data.FrameGroup[0].SpriteInfo.Animation != null; @@ -401,6 +400,9 @@ public Proto.Appearances.AppearanceFlagMarket GetOrCreateMarketFlags() handleFlag(change, flags.Height.HasElevation, ItemTypeFlag.HasElevation, "Height.HasElevation"); } + // Both expire and expireStop map to ClientDuration. + bool hasExpiryToggle = (flags.Expire || flags.Expirestop); + handleFlag(change, hasExpiryToggle, ItemTypeFlag.ClientDuration, "expire | expireStop"); return change.changes.Count > 0 ? change : null; } diff --git a/LapisItemEditor/ViewModels/Main/ItemPropertiesViewModel.cs b/LapisItemEditor/ViewModels/Main/ItemPropertiesViewModel.cs index 7502478..7ec63b8 100644 --- a/LapisItemEditor/ViewModels/Main/ItemPropertiesViewModel.cs +++ b/LapisItemEditor/ViewModels/Main/ItemPropertiesViewModel.cs @@ -345,6 +345,7 @@ public class ItemPropertiesViewModel : ViewModelBase private bool hasProfession; private bool hasWearout; private bool hasExpire; + private bool hasExpireStop; private bool hasTradeAs; private bool hasShowAs; private bool hasMinimumLevel; @@ -427,6 +428,7 @@ public ItemPropertiesViewModel() HasMarketProfession = false; HasWearout = false; HasExpire = false; + HasExpireStop = false; HasTradeAs = false; HasShowAs = false; HasMinimumLevel = false; @@ -575,6 +577,8 @@ public ItemPropertiesViewModel() LensHelp = _flags.Lenshelp?.HasId ?? false; FullBank = _flags.Fullbank; HasExpire = _flags.Expire; + HasExpireStop = _flags.Expirestop; + HasWearout = _flags.Wearout; IgnoreLook = _flags.IgnoreLook; @@ -910,6 +914,14 @@ public ItemPropertiesViewModel() } }); + this.WhenAnyValue(x => x.hasExpireStop).Subscribe(value => + { + if (flags != null) + { + flags.Expirestop = value; + } + }); + this.WhenAnyValue(x => x.IgnoreLook).Subscribe(value => { if (flags != null) @@ -1040,6 +1052,7 @@ public ItemPropertiesViewModel() public bool HasMarketProfession { get => hasProfession; set => this.RaiseAndSetIfChanged(ref hasProfession, value); } public bool HasWearout { get => hasWearout; set => this.RaiseAndSetIfChanged(ref hasWearout, value); } public bool HasExpire { get => hasExpire; set => this.RaiseAndSetIfChanged(ref hasExpire, value); } + public bool HasExpireStop { get => hasExpireStop; set => this.RaiseAndSetIfChanged(ref hasExpireStop, value); } public bool HasTradeAs { get => hasTradeAs; set => this.RaiseAndSetIfChanged(ref hasTradeAs, value); } public bool HasShowAs { get => hasShowAs; set => this.RaiseAndSetIfChanged(ref hasShowAs, value); } public bool HasMinimumLevel { get => hasMinimumLevel; set => this.RaiseAndSetIfChanged(ref hasMinimumLevel, value); } diff --git a/LapisItemEditor/Views/Main/ItemPropertiesView.axaml b/LapisItemEditor/Views/Main/ItemPropertiesView.axaml index c4d0b29..3123b49 100644 --- a/LapisItemEditor/Views/Main/ItemPropertiesView.axaml +++ b/LapisItemEditor/Views/Main/ItemPropertiesView.axaml @@ -289,6 +289,11 @@ + + Expire stop + + +