RynthSuite as of 2026-09-27 (internal 1816d05): AutoVendor (UtilityBelt port), missile/magic facing and arc line of sight, nav waypoint skipping, rebuff batch and item-enchant fixes, crafting fallback, Loot Editor AutoVendor folder and command-line open, release 2026.9.27.2
This commit is contained in:
parent
a19ee1904e
commit
d55ffda4ed
33 changed files with 4364 additions and 207 deletions
|
|
@ -18,7 +18,7 @@ public partial class App : Application
|
|||
};
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
desktop.MainWindow = new MainWindow();
|
||||
desktop.MainWindow = new MainWindow(desktop.Args is { Length: > 0 } a ? a[0] : null);
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,9 @@ namespace RynthCore.LootEditor;
|
|||
public class MainViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private const string DefaultFolder = @"C:\Games\RynthSuite\RynthAi\LootProfiles";
|
||||
// RynthAi's AutoVendor reads <Vendor Name>.utl / default.utl from here (and from
|
||||
// AutoVendor folders per server and per character, which IsAutoVendorPath also covers).
|
||||
private const string AutoVendorFolder = @"C:\Games\RynthSuite\RynthAi\AutoVendor";
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
private void Set<T>(ref T field, T value, [CallerMemberName] string? name = null)
|
||||
|
|
@ -172,6 +175,42 @@ public class MainViewModel : INotifyPropertyChanged
|
|||
{
|
||||
string baseName = string.IsNullOrEmpty(_filePath) ? "untitled.utl" : Path.GetFileName(_filePath);
|
||||
WindowTitle = $"RynthCore Loot Editor — {baseName}{(_dirty ? "*" : "")}";
|
||||
|
||||
// The folder switch follows the open file, so Save As lands next to it.
|
||||
if (!string.IsNullOrEmpty(_filePath))
|
||||
UseAutoVendorFolder = IsAutoVendorPath(_filePath);
|
||||
Notify(nameof(IsAutoVendorProfile));
|
||||
}
|
||||
|
||||
// ── Profile folder (Loot / AutoVendor) ───────────────────────────────────
|
||||
|
||||
private bool _useAutoVendorFolder;
|
||||
/// <summary>Open / Save start in the AutoVendor folder instead of LootProfiles.</summary>
|
||||
public bool UseAutoVendorFolder
|
||||
{
|
||||
get => _useAutoVendorFolder;
|
||||
set
|
||||
{
|
||||
Set(ref _useAutoVendorFolder, value);
|
||||
Notify(nameof(UseLootFolder));
|
||||
Notify(nameof(ProfileFolderHint));
|
||||
Notify(nameof(IsAutoVendorProfile));
|
||||
}
|
||||
}
|
||||
public bool UseLootFolder => !_useAutoVendorFolder;
|
||||
public string ProfileFolderHint => $"Open and Save start in {(_useAutoVendorFolder ? AutoVendorFolder : DefaultFolder)}";
|
||||
|
||||
/// <summary>An AutoVendor profile is open (or, for an unsaved one, the AutoVendor folder is picked).</summary>
|
||||
public bool IsAutoVendorProfile =>
|
||||
string.IsNullOrEmpty(_filePath) ? _useAutoVendorFolder : IsAutoVendorPath(_filePath);
|
||||
|
||||
private static bool IsAutoVendorPath(string path)
|
||||
{
|
||||
string? dir = Path.GetDirectoryName(Path.GetFullPath(path));
|
||||
for (; !string.IsNullOrEmpty(dir); dir = Path.GetDirectoryName(dir))
|
||||
if (string.Equals(Path.GetFileName(dir), "AutoVendor", StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
// ── Picker option lists ──────────────────────────────────────────────────
|
||||
|
|
@ -207,6 +246,7 @@ public class MainViewModel : INotifyPropertyChanged
|
|||
public RelayCommand RuleMoveUp { get; }
|
||||
public RelayCommand RuleMoveDown { get; }
|
||||
public RelayCommand SetActionFilter { get; }
|
||||
public RelayCommand SetProfileFolder { get; }
|
||||
public RelayCommand CondAdd { get; }
|
||||
public RelayCommand CondDelete { get; }
|
||||
public RelayCommand CondMoveUp { get; }
|
||||
|
|
@ -239,6 +279,8 @@ public class MainViewModel : INotifyPropertyChanged
|
|||
_ => null,
|
||||
};
|
||||
});
|
||||
SetProfileFolder = new RelayCommand(arg =>
|
||||
UseAutoVendorFolder = string.Equals(arg as string, "AutoVendor", StringComparison.OrdinalIgnoreCase));
|
||||
CondAdd = new RelayCommand(_ => DoCondAdd());
|
||||
CondDelete = new RelayCommand(_ => DoCondDelete(), _ => _selectedCondition != null);
|
||||
CondMoveUp = new RelayCommand(_ => DoCondMove(-1), _ => CanMoveCond(-1));
|
||||
|
|
@ -273,6 +315,40 @@ public class MainViewModel : INotifyPropertyChanged
|
|||
LoadProfile(new VTankLootProfile());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Opens the profile named on the command line (RynthAi's dashboard Edit button passes
|
||||
/// the loot profile in use, or the open vendor's AutoVendor profile). A path that doesn't
|
||||
/// exist yet starts an empty profile that saves there - how a vendor gets its first one.
|
||||
/// </summary>
|
||||
public void OpenFromCommandLine(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
path = Path.GetFullPath(path);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
VTankLootProfile loaded = path.EndsWith(".json", StringComparison.OrdinalIgnoreCase)
|
||||
? ConvertFromJson(path)
|
||||
: VTankLootParser.Load(path);
|
||||
_filePath = path;
|
||||
SearchText = "";
|
||||
LoadProfile(loaded);
|
||||
Status($"Opened {Path.GetFileName(path)} ({loaded.Rules.Count} rules)");
|
||||
}
|
||||
else
|
||||
{
|
||||
_filePath = path;
|
||||
SearchText = "";
|
||||
LoadProfile(new VTankLootProfile());
|
||||
Status($"New profile - Save writes {path}");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Status($"Could not open {path}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private async Task DoOpenAsync()
|
||||
{
|
||||
if (!ConfirmDiscard()) return;
|
||||
|
|
@ -685,8 +761,13 @@ public class MainViewModel : INotifyPropertyChanged
|
|||
|
||||
private async Task<IStorageFolder?> GetFolderAsync()
|
||||
{
|
||||
if (Directory.Exists(DefaultFolder))
|
||||
return await _window.StorageProvider.TryGetFolderFromPathAsync(DefaultFolder);
|
||||
string folder = _useAutoVendorFolder ? AutoVendorFolder : DefaultFolder;
|
||||
if (_useAutoVendorFolder && !Directory.Exists(folder))
|
||||
{
|
||||
try { Directory.CreateDirectory(folder); } catch { }
|
||||
}
|
||||
if (Directory.Exists(folder))
|
||||
return await _window.StorageProvider.TryGetFolderFromPathAsync(folder);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,31 @@
|
|||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<!-- Profile folder switch: which folder Open / Save start in. Follows the open file. -->
|
||||
<Border DockPanel.Dock="Top" Background="#080C10" Padding="8,4">
|
||||
<StackPanel Orientation="Horizontal" Spacing="4">
|
||||
<TextBlock Text="Profiles:" VerticalAlignment="Center" Margin="0,0,4,0"
|
||||
Foreground="{StaticResource FgMuted}" FontSize="11"/>
|
||||
<ToggleButton Content="Loot"
|
||||
IsChecked="{Binding UseLootFolder, Mode=OneWay}"
|
||||
Command="{Binding SetProfileFolder}" CommandParameter="Loot"
|
||||
Padding="8,2"/>
|
||||
<ToggleButton Content="AutoVendor"
|
||||
IsChecked="{Binding UseAutoVendorFolder, Mode=OneWay}"
|
||||
Command="{Binding SetProfileFolder}" CommandParameter="AutoVendor"
|
||||
Padding="8,2"/>
|
||||
<TextBlock Text="{Binding ProfileFolderHint}" VerticalAlignment="Center" Margin="8,0,0,0"
|
||||
Foreground="{StaticResource FgMuted}" FontSize="11"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Shown while an AutoVendor profile is open: the same actions mean buy/sell here. -->
|
||||
<Border DockPanel.Dock="Top" Background="#1A2A1A" BorderBrush="#2E4A2E" BorderThickness="0,0,0,1"
|
||||
Padding="8,4" IsVisible="{Binding IsAutoVendorProfile}">
|
||||
<TextBlock TextWrapping="Wrap" FontSize="11" Foreground="#CFE8CF"
|
||||
Text="AutoVendor profile: Keep = buy all it can afford · Keep # = buy until you have N · Sell = sell matching items from your pack. Name the file after the vendor (exactly as shown in game), or default.utl for any vendor without its own profile."/>
|
||||
</Border>
|
||||
|
||||
<!-- Keyboard shortcuts -->
|
||||
<DockPanel.KeyBindings>
|
||||
<KeyBinding Gesture="Ctrl+N" Command="{Binding FileNew}"/>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,16 @@ public partial class MainWindow : Window
|
|||
private readonly MainViewModel _vm;
|
||||
private bool _forceClose;
|
||||
|
||||
public MainWindow()
|
||||
public MainWindow() : this(null) { }
|
||||
|
||||
/// <param name="openPath">A profile to open at startup (from the command line), or null.</param>
|
||||
public MainWindow(string? openPath)
|
||||
{
|
||||
InitializeComponent();
|
||||
_vm = new MainViewModel(this);
|
||||
DataContext = _vm;
|
||||
if (!string.IsNullOrWhiteSpace(openPath))
|
||||
_vm.OpenFromCommandLine(openPath);
|
||||
|
||||
// (Confirm-on-close was disabled when the dirty-flag was made private during
|
||||
// the VTank model migration. Re-add via a public IsDirty later if desired.)
|
||||
|
|
|
|||
Loading…
Reference in a new issue