Skip to content

Commit

Permalink
bugfix: Add handling of flag clockexpire (#2)
Browse files Browse the repository at this point in the history
* Add flag clockexpire

* Formatting
  • Loading branch information
giuinktse7 authored Jul 25, 2022
1 parent e3da126 commit e160922
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 10 deletions.
6 changes: 3 additions & 3 deletions Backend/Appearance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +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");
// All of expire, expireStop and clockExpire map to ClientDuration (as of 12.90).
bool hasExpiryToggle = (flags.Expire || flags.Expirestop || flags.Clockexpire);
handleFlag(change, hasExpiryToggle, ItemTypeFlag.ClientDuration, "expire | expireStop | clockExpire");

return change.changes.Count > 0 ? change : null;
}
Expand Down
2 changes: 1 addition & 1 deletion LapisItemEditor/LapisItemEditor.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<Nullable>enable</Nullable>
<RootNamespace>LapisItemEditor</RootNamespace>
Expand Down
12 changes: 12 additions & 0 deletions LapisItemEditor/ViewModels/Main/ItemPropertiesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public class ItemPropertiesViewModel : ViewModelBase
private bool hasWearout;
private bool hasExpire;
private bool hasExpireStop;
private bool hasClockExpire;
private bool hasTradeAs;
private bool hasShowAs;
private bool hasMinimumLevel;
Expand Down Expand Up @@ -429,6 +430,7 @@ public ItemPropertiesViewModel()
HasWearout = false;
HasExpire = false;
HasExpireStop = false;
HasClockExpire = false;
HasTradeAs = false;
HasShowAs = false;
HasMinimumLevel = false;
Expand Down Expand Up @@ -578,6 +580,7 @@ public ItemPropertiesViewModel()
FullBank = _flags.Fullbank;
HasExpire = _flags.Expire;
HasExpireStop = _flags.Expirestop;
HasClockExpire = _flags.Clockexpire;

HasWearout = _flags.Wearout;

Expand Down Expand Up @@ -922,6 +925,14 @@ public ItemPropertiesViewModel()
}
});

this.WhenAnyValue(x => x.hasClockExpire).Subscribe(value =>
{
if (flags != null)
{
flags.Clockexpire = value;
}
});

this.WhenAnyValue(x => x.IgnoreLook).Subscribe(value =>
{
if (flags != null)
Expand Down Expand Up @@ -1053,6 +1064,7 @@ public ItemPropertiesViewModel()
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 HasClockExpire { get => hasClockExpire; set => this.RaiseAndSetIfChanged(ref hasClockExpire, 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
11 changes: 8 additions & 3 deletions LapisItemEditor/Views/Main/ItemPropertiesView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
</StackPanel>

<!-- Second column -->
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" MinHeight="200">
<StackPanel Grid.Row="1" Grid.Column="1" Orientation="Vertical" MinHeight="200" Margin="20,0,20,0">
<Grid RowDefinitions="*,*" Margin="0 0 9 0">
<TextBlock Grid.Row="0" Padding="4 2 4 2">Hangable Hook Type</TextBlock>
<ComboBox Grid.Row="1" Items="{Binding HangableHookTypes}" SelectedItem="{Binding HangableHookType, Mode=TwoWay}" SelectedIndex="0">
Expand Down Expand Up @@ -189,7 +189,7 @@
</StackPanel>

<!-- Third column -->
<StackPanel Grid.Row="1" Grid.Column="2" Orientation="Vertical" MinHeight="200">
<StackPanel Grid.Row="1" Grid.Column="2" Orientation="Vertical" MinHeight="200" Margin="20,0,20,0">
<StackPanel Orientation="Horizontal">
<CheckBox IsChecked="{Binding Height, Mode=TwoWay}">Height</CheckBox>
<PathIcon Classes="question-mark" ToolTip.Tip="If an object offsets objects that sit on top of it (like a table or a parcel)." />
Expand Down Expand Up @@ -291,7 +291,12 @@

<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"/>
<PathIcon Classes="question-mark" ToolTip.Tip="If the thing has flag expirestop"/>
</StackPanel>

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

</StackPanel>
Expand Down
3 changes: 0 additions & 3 deletions LapisItemEditor/Views/Main/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using System;
using System.Diagnostics;
using System.IO;
using Avalonia.Controls;
using Avalonia.Input;
using Avalonia.Markup.Xaml;
Expand Down

0 comments on commit e160922

Please sign in to comment.