Skip to content

Commit

Permalink
Add handling of the expireStop appearance flag (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
giuinktse7 authored Jul 24, 2022
1 parent fb4b3b7 commit e3da126
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Backend/Appearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
13 changes: 13 additions & 0 deletions LapisItemEditor/ViewModels/Main/ItemPropertiesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -427,6 +428,7 @@ public ItemPropertiesViewModel()
HasMarketProfession = false;
HasWearout = false;
HasExpire = false;
HasExpireStop = false;
HasTradeAs = false;
HasShowAs = false;
HasMinimumLevel = false;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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); }
Expand Down
5 changes: 5 additions & 0 deletions LapisItemEditor/Views/Main/ItemPropertiesView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,11 @@
<PathIcon Classes="question-mark" ToolTip.Tip="If the thing expires (has a duration)"/>
</StackPanel>

<StackPanel Orientation="Horizontal" Margin="0,4,0,0">
<CheckBox IsChecked="{Binding HasExpireStop, Mode=TwoWay}" VerticalAlignment="Center" Margin="0,0,4,0">Expire stop</CheckBox>
<PathIcon Classes="question-mark" ToolTip.Tip="If the thing has a stop expire"/>
</StackPanel>

</StackPanel>

</StackPanel>
Expand Down

0 comments on commit e3da126

Please sign in to comment.