RynthSuite as of 2026-09-05 (internal a5ff5c2)
A snapshot of the working tree for aelrynth.com/git/: the code, build files and public docs. Internal review notes and agent instructions are left out. MIT licensed; see LICENSE. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
0a4b611a90
166 changed files with 186537 additions and 0 deletions
265
Tools/RynthCore.CreatureSeed/Program.cs
Normal file
265
Tools/RynthCore.CreatureSeed/Program.cs
Normal file
|
|
@ -0,0 +1,265 @@
|
|||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using MySqlConnector;
|
||||
using RynthCore.Plugin.RynthAi.CreatureData;
|
||||
|
||||
// RynthCore.CreatureSeed
|
||||
// Out-of-process seeder: reads creature MaxHealth from the local ACE world DB and
|
||||
// fills gaps in RynthAi's creatures.json so the dashboard can show an absolute
|
||||
// health number for monsters the player has never appraised.
|
||||
//
|
||||
// Never touches acclient / the plugin / the engine. Re-runnable; additive only.
|
||||
//
|
||||
// dotnet run --project Tools\RynthCore.CreatureSeed [-- options]
|
||||
// --config <path> ACE Config.js (default: C:\Projects\ACE\Source\ACE.Server\Config.js)
|
||||
// --conn <str> explicit MySQL connection string (overrides --config)
|
||||
// --out <path> creatures.json (default: C:\Games\RynthSuite\RynthAi\CreatureData\creatures.json)
|
||||
// --dry-run compute + report, write nothing
|
||||
|
||||
const string DefaultConfig = @"C:\Projects\ACE\Source\ACE.Server\Config.js";
|
||||
const string DefaultOut = @"C:\Games\RynthSuite\RynthAi\CreatureData\creatures.json";
|
||||
|
||||
const int WeenieTypeCreature = 10; // ACE.Entity.Enum.WeenieType.Creature
|
||||
const int PropStringName = 1; // ACE PropertyString.Name
|
||||
const int PropAttr2ndMaxHealth = 1; // ACE PropertyAttribute2nd.MaxHealth
|
||||
|
||||
string configPath = DefaultConfig;
|
||||
string? connOverride = null;
|
||||
string outPath = DefaultOut;
|
||||
bool dryRun = false;
|
||||
string? probe = null;
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
switch (args[i])
|
||||
{
|
||||
case "--config": configPath = args[++i]; break;
|
||||
case "--conn": connOverride = args[++i]; break;
|
||||
case "--out": outPath = args[++i]; break;
|
||||
case "--dry-run": dryRun = true; break;
|
||||
case "--probe": probe = args[++i]; break;
|
||||
default:
|
||||
Console.Error.WriteLine($"unknown arg: {args[i]}");
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
|
||||
string connString;
|
||||
try
|
||||
{
|
||||
connString = connOverride ?? BuildConnFromAceConfig(configPath);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"failed to resolve MySQL connection: {ex.Message}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Diagnostic: show every weenie whose name matches a substring, with its
|
||||
// WeenieType and (LEFT JOINed) MaxHealth attribute row so missing/odd data is visible.
|
||||
if (probe != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
using var c = new MySqlConnection(connString);
|
||||
c.Open();
|
||||
using var cmd = c.CreateCommand();
|
||||
cmd.CommandText = $@"
|
||||
SELECT w.class_Id, w.type, s.value,
|
||||
a.type AS aType, a.init_Level
|
||||
FROM weenie_properties_string s
|
||||
JOIN weenie w ON w.class_Id = s.object_Id
|
||||
LEFT JOIN weenie_properties_attribute_2nd a
|
||||
ON a.object_Id = w.class_Id AND a.type = {PropAttr2ndMaxHealth}
|
||||
WHERE s.type = {PropStringName} AND s.value LIKE @p
|
||||
ORDER BY s.value, w.class_Id
|
||||
LIMIT 60";
|
||||
cmd.Parameters.AddWithValue("@p", "%" + probe + "%");
|
||||
using var r = cmd.ExecuteReader();
|
||||
Console.WriteLine($"probe '{probe}' (wcid | weenieType | name | maxHealthRow)");
|
||||
int n = 0;
|
||||
while (r.Read())
|
||||
{
|
||||
n++;
|
||||
string mh = r.IsDBNull(4) ? "(no MaxHealth attr)" : r.GetInt64(4).ToString();
|
||||
Console.WriteLine($" {r.GetInt64(0),-7} | type={r.GetInt32(1),-3} | {r.GetString(2),-32} | {mh}");
|
||||
}
|
||||
if (n == 0) Console.WriteLine(" (no name matches at all)");
|
||||
}
|
||||
catch (Exception ex) { Console.Error.WriteLine($"probe failed: {ex.Message}"); return 1; }
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 1. Pull every Creature weenie's display name + innate MaxHealth.
|
||||
var rows = new List<(uint Wcid, string Name, uint MaxHealth)>();
|
||||
try
|
||||
{
|
||||
using var conn = new MySqlConnection(connString);
|
||||
conn.Open();
|
||||
using var cmd = conn.CreateCommand();
|
||||
cmd.CommandText = $@"
|
||||
SELECT w.class_Id AS wcid,
|
||||
s.value AS name,
|
||||
a.init_Level AS maxHealth
|
||||
FROM weenie w
|
||||
JOIN weenie_properties_string s
|
||||
ON s.object_Id = w.class_Id AND s.type = {PropStringName}
|
||||
JOIN weenie_properties_attribute_2nd a
|
||||
ON a.object_Id = w.class_Id AND a.type = {PropAttr2ndMaxHealth}
|
||||
WHERE w.type = {WeenieTypeCreature}
|
||||
AND a.init_Level > 0
|
||||
AND s.value IS NOT NULL AND s.value <> ''";
|
||||
using var r = cmd.ExecuteReader();
|
||||
while (r.Read())
|
||||
{
|
||||
uint wcid = (uint)r.GetInt64(0);
|
||||
string name = r.GetString(1).Trim();
|
||||
uint hp = (uint)r.GetInt64(2);
|
||||
if (name.Length == 0 || hp == 0) continue;
|
||||
rows.Add((wcid, name, hp));
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"world DB query failed: {ex.Message}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
Console.WriteLine($"ace_world: {rows.Count} creature rows.");
|
||||
|
||||
// 2. Collapse same-name variants -> keep HIGHEST MaxHealth (user's chosen policy:
|
||||
// stable with CreatureProfileStore.Upsert's raise-only merge).
|
||||
var byName = new Dictionary<string, (uint Wcid, string Name, uint MaxHealth)>(StringComparer.OrdinalIgnoreCase);
|
||||
foreach (var row in rows)
|
||||
{
|
||||
if (!byName.TryGetValue(row.Name, out var cur) || row.MaxHealth > cur.MaxHealth)
|
||||
byName[row.Name] = row;
|
||||
}
|
||||
Console.WriteLine($"collapsed to {byName.Count} distinct names (highest-HP per name).");
|
||||
|
||||
// 3. Load existing creatures.json (preserve every observed record).
|
||||
var jsonOpts = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
IncludeFields = true,
|
||||
PropertyNameCaseInsensitive = true,
|
||||
};
|
||||
|
||||
var store = new Dictionary<string, CreatureProfile>(StringComparer.OrdinalIgnoreCase);
|
||||
int existingCount = 0;
|
||||
if (File.Exists(outPath))
|
||||
{
|
||||
string existingJson = File.ReadAllText(outPath); // strips UTF-8 BOM on read
|
||||
if (!string.IsNullOrWhiteSpace(existingJson))
|
||||
{
|
||||
var loaded = JsonSerializer.Deserialize<Dictionary<string, CreatureProfile>>(existingJson, jsonOpts);
|
||||
if (loaded != null)
|
||||
foreach (var kv in loaded) store[kv.Key] = kv.Value;
|
||||
}
|
||||
existingCount = store.Count;
|
||||
}
|
||||
Console.WriteLine($"existing creatures.json: {existingCount} records.");
|
||||
|
||||
// Names already known from real observation — never seed over these.
|
||||
var observedNames = new HashSet<string>(
|
||||
store.Values.Select(v => v.Name.Trim()), StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
// 4. Additive merge: add a seed record only for names not already present.
|
||||
int added = 0, skipped = 0;
|
||||
foreach (var e in byName.Values)
|
||||
{
|
||||
if (observedNames.Contains(e.Name)) { skipped++; continue; }
|
||||
|
||||
string key = e.Wcid == 0 ? e.Name : $"{e.Name}|{e.Wcid}";
|
||||
if (store.ContainsKey(key)) { skipped++; continue; }
|
||||
|
||||
store[key] = new CreatureProfile
|
||||
{
|
||||
Name = e.Name,
|
||||
Wcid = e.Wcid,
|
||||
MaxHealth = e.MaxHealth,
|
||||
Samples = 0, // 0 == seed; any real observation outranks it
|
||||
Notes = "seeded:ace_world",
|
||||
// resists left at the 1.0 "no data" sentinel via CreatureProfile defaults
|
||||
};
|
||||
added++;
|
||||
}
|
||||
|
||||
Console.WriteLine($"seed: +{added} new, {skipped} skipped (already known), total now {store.Count}.");
|
||||
|
||||
// Spot-check a few well-known mobs so the numbers can be eyeballed.
|
||||
string[] probes = { "Drudge Skulker", "Banderling Guard", "Banderling Crusher",
|
||||
"Banderling Guard Champion", "Olthoi Soldier", "Drudge Bloodletter",
|
||||
"Drudge Biter", "Drudge Cabalist", "Banderling Chief" };
|
||||
Console.WriteLine("spot-check (name -> wcid / MaxHealth):");
|
||||
foreach (var p in probes)
|
||||
{
|
||||
var hit = store.Values.FirstOrDefault(v => string.Equals(v.Name, p, StringComparison.OrdinalIgnoreCase));
|
||||
Console.WriteLine(hit != null
|
||||
? $" {p,-22} -> {hit.Wcid} / {hit.MaxHealth} hp"
|
||||
: $" {p,-22} -> (not in world DB)");
|
||||
}
|
||||
|
||||
if (dryRun)
|
||||
{
|
||||
Console.WriteLine("--dry-run: nothing written.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (added == 0)
|
||||
{
|
||||
Console.WriteLine("no new records to add; creatures.json left unchanged.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 5. Back up, then write UTF-8 WITHOUT BOM (matches existing file; avoids the
|
||||
// JsonDocument-BOM parse pitfall the engine has hit before).
|
||||
try
|
||||
{
|
||||
if (File.Exists(outPath))
|
||||
File.Copy(outPath, outPath + ".bak", overwrite: true);
|
||||
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outPath)!);
|
||||
string outJson = JsonSerializer.Serialize(store, jsonOpts);
|
||||
File.WriteAllText(outPath, outJson, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false));
|
||||
Console.WriteLine($"wrote {outPath} ({store.Count} records). backup: {outPath}.bak");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.Error.WriteLine($"write failed: {ex.Message}");
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
// --- helpers ---
|
||||
|
||||
static string BuildConnFromAceConfig(string configPath)
|
||||
{
|
||||
if (!File.Exists(configPath))
|
||||
throw new FileNotFoundException($"ACE Config.js not found at {configPath} (pass --config or --conn)");
|
||||
|
||||
string text = File.ReadAllText(configPath);
|
||||
using var doc = JsonDocument.Parse(text, new JsonDocumentOptions
|
||||
{
|
||||
CommentHandling = JsonCommentHandling.Skip,
|
||||
AllowTrailingCommas = true,
|
||||
});
|
||||
|
||||
var world = doc.RootElement.GetProperty("MySql").GetProperty("World");
|
||||
string host = world.GetProperty("Host").GetString() ?? "127.0.0.1";
|
||||
int port = world.TryGetProperty("Port", out var pv) ? pv.GetInt32() : 3306;
|
||||
string db = world.GetProperty("Database").GetString() ?? "ace_world";
|
||||
string user = world.GetProperty("Username").GetString() ?? "root";
|
||||
string pass = world.GetProperty("Password").GetString() ?? "";
|
||||
|
||||
return new MySqlConnectionStringBuilder
|
||||
{
|
||||
Server = host,
|
||||
Port = (uint)port,
|
||||
Database = db,
|
||||
UserID = user,
|
||||
Password = pass,
|
||||
ConnectionTimeout = 15,
|
||||
}.ConnectionString;
|
||||
}
|
||||
23
Tools/RynthCore.CreatureSeed/RynthCore.CreatureSeed.csproj
Normal file
23
Tools/RynthCore.CreatureSeed/RynthCore.CreatureSeed.csproj
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AssemblyName>RynthCore.CreatureSeed</AssemblyName>
|
||||
<RootNamespace>RynthCore.CreatureSeed</RootNamespace>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MySqlConnector" Version="2.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Reuse the plugin's real CreatureProfile so the seeded JSON can never drift
|
||||
from the shape CreatureProfileStore deserializes. -->
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Plugins\RynthCore.Plugin.RynthAi\CreatureData\CreatureProfile.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
10
Tools/RynthCore.LootEditor/App.axaml
Normal file
10
Tools/RynthCore.LootEditor/App.axaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="RynthCore.LootEditor.App"
|
||||
RequestedThemeVariant="Dark">
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
<StyleInclude Source="avares://RynthCore.LootEditor/Styles.axaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
24
Tools/RynthCore.LootEditor/App.axaml.cs
Normal file
24
Tools/RynthCore.LootEditor/App.axaml.cs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
Dispatcher.UIThread.UnhandledException += (_, e) =>
|
||||
{
|
||||
Program.Log($"DISPATCHER: {e.Exception}");
|
||||
e.Handled = false;
|
||||
};
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
desktop.MainWindow = new MainWindow();
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
47
Tools/RynthCore.LootEditor/ConfirmDialog.cs
Normal file
47
Tools/RynthCore.LootEditor/ConfirmDialog.cs
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
/// <summary>Simple Yes/No confirmation dialog.</summary>
|
||||
public class ConfirmDialog : Window
|
||||
{
|
||||
public ConfirmDialog(string message)
|
||||
{
|
||||
Title = "Confirm";
|
||||
Width = 360;
|
||||
Height = 150;
|
||||
CanResize = false;
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
Background = new SolidColorBrush(Color.Parse("#171F29"));
|
||||
|
||||
var panel = new StackPanel { Margin = new Thickness(16), Spacing = 16 };
|
||||
|
||||
panel.Children.Add(new TextBlock
|
||||
{
|
||||
Text = message,
|
||||
Foreground = Brushes.White,
|
||||
TextWrapping = TextWrapping.Wrap,
|
||||
});
|
||||
|
||||
var buttons = new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
HorizontalAlignment = HorizontalAlignment.Right,
|
||||
Spacing = 8,
|
||||
};
|
||||
|
||||
var yes = new Button { Content = "Yes", Width = 72 };
|
||||
var no = new Button { Content = "No", Width = 72 };
|
||||
yes.Click += (_, _) => Close(true);
|
||||
no.Click += (_, _) => Close(false);
|
||||
|
||||
buttons.Children.Add(yes);
|
||||
buttons.Children.Add(no);
|
||||
panel.Children.Add(buttons);
|
||||
|
||||
Content = panel;
|
||||
}
|
||||
}
|
||||
700
Tools/RynthCore.LootEditor/MainViewModel.cs
Normal file
700
Tools/RynthCore.LootEditor/MainViewModel.cs
Normal file
|
|
@ -0,0 +1,700 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Platform.Storage;
|
||||
using RynthCore.Loot;
|
||||
using RynthCore.Loot.VTank;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
public class MainViewModel : INotifyPropertyChanged
|
||||
{
|
||||
private const string DefaultFolder = @"C:\Games\RynthSuite\RynthAi\LootProfiles";
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
private void Set<T>(ref T field, T value, [CallerMemberName] string? name = null)
|
||||
{
|
||||
if (EqualityComparer<T>.Default.Equals(field, value)) return;
|
||||
field = value;
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
private void Notify([CallerMemberName] string? name = null) =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
|
||||
// ── State ────────────────────────────────────────────────────────────────
|
||||
|
||||
private VTankLootProfile _profile = new();
|
||||
private string? _filePath;
|
||||
private bool _dirty;
|
||||
private readonly Window _window;
|
||||
|
||||
// ── Rule list ────────────────────────────────────────────────────────────
|
||||
|
||||
public ObservableCollection<VTankRuleVm> Rules { get; } = new();
|
||||
public ObservableCollection<VTankRuleVm> FilteredRules { get; } = new();
|
||||
|
||||
private string _searchText = "";
|
||||
public string SearchText
|
||||
{
|
||||
get => _searchText;
|
||||
set { Set(ref _searchText, value); ApplyFilter(); RefreshMoveCommands(); }
|
||||
}
|
||||
|
||||
/// <summary>Action filter — null means "all actions".</summary>
|
||||
private VTankLootAction? _actionFilter;
|
||||
public VTankLootAction? ActionFilter
|
||||
{
|
||||
get => _actionFilter;
|
||||
set
|
||||
{
|
||||
Set(ref _actionFilter, value);
|
||||
ApplyFilter();
|
||||
// Re-evaluate every IsActionFilterX property so the chip buttons update.
|
||||
Notify(nameof(IsActionFilterAll));
|
||||
Notify(nameof(IsActionFilterKeep));
|
||||
Notify(nameof(IsActionFilterKeepUpTo));
|
||||
Notify(nameof(IsActionFilterSalvage));
|
||||
Notify(nameof(IsActionFilterSell));
|
||||
Notify(nameof(IsActionFilterRead));
|
||||
Notify(nameof(RuleCountLabel));
|
||||
}
|
||||
}
|
||||
public bool IsActionFilterAll => _actionFilter == null;
|
||||
public bool IsActionFilterKeep => _actionFilter == VTankLootAction.Keep;
|
||||
public bool IsActionFilterKeepUpTo => _actionFilter == VTankLootAction.KeepUpTo;
|
||||
public bool IsActionFilterSalvage => _actionFilter == VTankLootAction.Salvage;
|
||||
public bool IsActionFilterSell => _actionFilter == VTankLootAction.Sell;
|
||||
public bool IsActionFilterRead => _actionFilter == VTankLootAction.Read;
|
||||
|
||||
public string RuleCountLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
int total = Rules.Count;
|
||||
int shown = FilteredRules.Count;
|
||||
return shown == total ? $"{total} rules" : $"{shown} of {total} rules";
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyFilter()
|
||||
{
|
||||
FilteredRules.Clear();
|
||||
string q = _searchText.Trim();
|
||||
foreach (var r in Rules)
|
||||
{
|
||||
if (_actionFilter != null && r.Action != _actionFilter) continue;
|
||||
if (q.Length == 0 || r.Name.Contains(q, StringComparison.OrdinalIgnoreCase))
|
||||
FilteredRules.Add(r);
|
||||
}
|
||||
if (_selectedRule != null && !FilteredRules.Contains(_selectedRule))
|
||||
SelectedRule = null;
|
||||
Notify(nameof(RuleCountLabel));
|
||||
}
|
||||
|
||||
private VTankRuleVm? _selectedRule;
|
||||
public VTankRuleVm? SelectedRule
|
||||
{
|
||||
get => _selectedRule;
|
||||
set
|
||||
{
|
||||
Set(ref _selectedRule, value);
|
||||
Notify(nameof(RuleEditorEnabled));
|
||||
Notify(nameof(Conditions));
|
||||
Notify(nameof(KeepCountVisible));
|
||||
SelectedCondition = null;
|
||||
RefreshMoveCommands();
|
||||
}
|
||||
}
|
||||
|
||||
public bool RuleEditorEnabled => _selectedRule != null;
|
||||
public bool KeepCountVisible => _selectedRule?.ShowKeepCount == true;
|
||||
|
||||
// ── Conditions ───────────────────────────────────────────────────────────
|
||||
|
||||
public ObservableCollection<VTankConditionVm>? Conditions => _selectedRule?.Conditions;
|
||||
|
||||
private VTankConditionVm? _selectedCondition;
|
||||
public VTankConditionVm? SelectedCondition
|
||||
{
|
||||
get => _selectedCondition;
|
||||
set
|
||||
{
|
||||
Set(ref _selectedCondition, value);
|
||||
RebuildConditionEditor();
|
||||
CondDelete.RaiseCanExecuteChanged();
|
||||
CondMoveUp.RaiseCanExecuteChanged();
|
||||
CondMoveDown.RaiseCanExecuteChanged();
|
||||
}
|
||||
}
|
||||
|
||||
private object? _conditionEditor;
|
||||
public object? ConditionEditor
|
||||
{
|
||||
get => _conditionEditor;
|
||||
private set => Set(ref _conditionEditor, value);
|
||||
}
|
||||
|
||||
private void RebuildConditionEditor()
|
||||
{
|
||||
ConditionEditor = _selectedCondition == null
|
||||
? null
|
||||
: new VTankConditionEditorView(_selectedCondition, MarkDirty);
|
||||
}
|
||||
|
||||
private void MarkDirty()
|
||||
{
|
||||
_dirty = true;
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
// ── Status / title ───────────────────────────────────────────────────────
|
||||
|
||||
private string _statusMessage = "Ready";
|
||||
public string StatusMessage
|
||||
{
|
||||
get => _statusMessage;
|
||||
private set => Set(ref _statusMessage, value);
|
||||
}
|
||||
private void Status(string msg) => StatusMessage = msg;
|
||||
|
||||
private string _windowTitle = "RynthCore Loot Editor";
|
||||
public string WindowTitle
|
||||
{
|
||||
get => _windowTitle;
|
||||
private set => Set(ref _windowTitle, value);
|
||||
}
|
||||
private void UpdateTitle()
|
||||
{
|
||||
string baseName = string.IsNullOrEmpty(_filePath) ? "untitled.utl" : Path.GetFileName(_filePath);
|
||||
WindowTitle = $"RynthCore Loot Editor — {baseName}{(_dirty ? "*" : "")}";
|
||||
}
|
||||
|
||||
// ── Picker option lists ──────────────────────────────────────────────────
|
||||
|
||||
public IReadOnlyList<VTankLootAction> Actions { get; } = new[]
|
||||
{
|
||||
VTankLootAction.Keep,
|
||||
VTankLootAction.KeepUpTo,
|
||||
VTankLootAction.Salvage,
|
||||
VTankLootAction.Sell,
|
||||
VTankLootAction.Read,
|
||||
};
|
||||
|
||||
public IReadOnlyList<NodeTypeOption> NodeTypeOptions { get; } = BuildNodeTypeOptions();
|
||||
private static List<NodeTypeOption> BuildNodeTypeOptions()
|
||||
{
|
||||
var list = new List<NodeTypeOption>();
|
||||
foreach (int t in VTankNodeTypes.All)
|
||||
list.Add(new NodeTypeOption(t, $"{VTankNodeTypes.DisplayName(t)} (id {t})"));
|
||||
return list;
|
||||
}
|
||||
|
||||
// ── Commands ─────────────────────────────────────────────────────────────
|
||||
|
||||
public RelayCommand FileNew { get; }
|
||||
public RelayCommand FileOpen { get; }
|
||||
public RelayCommand FileSave { get; }
|
||||
public RelayCommand FileSaveAs { get; }
|
||||
public RelayCommand FileExit { get; }
|
||||
public RelayCommand RuleAdd { get; }
|
||||
public RelayCommand RuleDuplicate { get; }
|
||||
public RelayCommand RuleDelete { get; }
|
||||
public RelayCommand RuleMoveUp { get; }
|
||||
public RelayCommand RuleMoveDown { get; }
|
||||
public RelayCommand SetActionFilter { get; }
|
||||
public RelayCommand CondAdd { get; }
|
||||
public RelayCommand CondDelete { get; }
|
||||
public RelayCommand CondMoveUp { get; }
|
||||
public RelayCommand CondMoveDown{ get; }
|
||||
public RelayCommand SalvageRowAdd { get; }
|
||||
public RelayCommand SalvageRowDelete { get; }
|
||||
public RelayCommand SalvageImportUtl { get; }
|
||||
|
||||
public MainViewModel(Window window)
|
||||
{
|
||||
_window = window;
|
||||
|
||||
FileNew = new RelayCommand(_ => DoNew());
|
||||
FileOpen = new RelayCommand(_ => _ = DoOpenAsync());
|
||||
FileSave = new RelayCommand(_ => _ = DoSaveAsync(false));
|
||||
FileSaveAs = new RelayCommand(_ => _ = DoSaveAsync(true));
|
||||
FileExit = new RelayCommand(_ => _window.Close());
|
||||
RuleAdd = new RelayCommand(_ => DoRuleAdd());
|
||||
RuleDuplicate = new RelayCommand(_ => DoRuleDuplicate(), _ => _selectedRule != null);
|
||||
RuleDelete = new RelayCommand(_ => DoRuleDelete(), _ => _selectedRule != null);
|
||||
RuleMoveUp = new RelayCommand(_ => DoRuleMove(-1), _ => CanMoveRule(-1));
|
||||
RuleMoveDown = new RelayCommand(_ => DoRuleMove(1), _ => CanMoveRule(1));
|
||||
SetActionFilter = new RelayCommand(arg =>
|
||||
{
|
||||
// Param is either a VTankLootAction (set the filter) or null (= "All").
|
||||
ActionFilter = arg switch
|
||||
{
|
||||
VTankLootAction a => a,
|
||||
string s when System.Enum.TryParse<VTankLootAction>(s, out var parsed) => parsed,
|
||||
_ => null,
|
||||
};
|
||||
});
|
||||
CondAdd = new RelayCommand(_ => DoCondAdd());
|
||||
CondDelete = new RelayCommand(_ => DoCondDelete(), _ => _selectedCondition != null);
|
||||
CondMoveUp = new RelayCommand(_ => DoCondMove(-1), _ => CanMoveCond(-1));
|
||||
CondMoveDown = new RelayCommand(_ => DoCondMove(1), _ => CanMoveCond(1));
|
||||
SalvageRowAdd = new RelayCommand(_ => DoSalvageRowAdd());
|
||||
SalvageRowDelete = new RelayCommand(_ => DoSalvageRowDelete(), _ => _selectedSalvageRow != null);
|
||||
SalvageImportUtl = new RelayCommand(_ => _ = DoSalvageImportUtlAsync());
|
||||
|
||||
LoadProfile(new VTankLootProfile());
|
||||
}
|
||||
|
||||
// ── Load / save ──────────────────────────────────────────────────────────
|
||||
|
||||
private void LoadProfile(VTankLootProfile p)
|
||||
{
|
||||
_profile = p;
|
||||
Rules.Clear();
|
||||
foreach (var r in p.Rules)
|
||||
Rules.Add(new VTankRuleVm(r));
|
||||
ApplyFilter();
|
||||
SelectedRule = null;
|
||||
LoadSalvageFromProfile(p);
|
||||
_dirty = false;
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
private void DoNew()
|
||||
{
|
||||
if (!ConfirmDiscard()) return;
|
||||
_filePath = null;
|
||||
SearchText = "";
|
||||
LoadProfile(new VTankLootProfile());
|
||||
}
|
||||
|
||||
private async Task DoOpenAsync()
|
||||
{
|
||||
if (!ConfirmDiscard()) return;
|
||||
var opts = new FilePickerOpenOptions
|
||||
{
|
||||
Title = "Open Loot Profile",
|
||||
AllowMultiple = false,
|
||||
FileTypeFilter = new[]
|
||||
{
|
||||
new FilePickerFileType("VTank / LootSnob") { Patterns = new[] { "*.utl" } },
|
||||
new FilePickerFileType("Legacy JSON") { Patterns = new[] { "*.json" } },
|
||||
new FilePickerFileType("All Files") { Patterns = new[] { "*.*" } },
|
||||
},
|
||||
SuggestedStartLocation = await GetFolderAsync(),
|
||||
};
|
||||
var files = await _window.StorageProvider.OpenFilePickerAsync(opts);
|
||||
if (files.Count == 0) return;
|
||||
|
||||
var path = files[0].Path.LocalPath;
|
||||
try
|
||||
{
|
||||
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)");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
await ShowError($"Failed to open profile:\n{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static VTankLootProfile ConvertFromJson(string path)
|
||||
{
|
||||
// Minimal JSON → VTank converter for legacy LootEditor profiles.
|
||||
// Only the rule list is migrated; SalvageCombine carries over directly.
|
||||
var json = LootProfile.TryLoad(path) ?? new LootProfile();
|
||||
var vp = new VTankLootProfile { FileVersion = 1, SalvageCombine = json.SalvageCombine };
|
||||
foreach (var rule in json.Rules)
|
||||
{
|
||||
var vr = new VTankLootRule
|
||||
{
|
||||
Name = rule.Name,
|
||||
CustomExpression = string.Empty,
|
||||
Action = rule.Action switch
|
||||
{
|
||||
LootAction.Keep => VTankLootAction.Keep,
|
||||
LootAction.KeepUpTo => VTankLootAction.KeepUpTo,
|
||||
LootAction.Salvage => VTankLootAction.Salvage,
|
||||
LootAction.Sell => VTankLootAction.Sell,
|
||||
LootAction.Read => VTankLootAction.Read,
|
||||
_ => VTankLootAction.Keep,
|
||||
},
|
||||
KeepCount = rule.Action == LootAction.KeepUpTo ? rule.KeepCount : (int?)null,
|
||||
};
|
||||
// Best-effort condition mapping — typed editor will surface anything
|
||||
// we couldn't map as raw lines.
|
||||
foreach (var c in rule.Conditions)
|
||||
vr.Conditions.Add(MapJsonCondition(c));
|
||||
if (!rule.Enabled) vr.Enabled = false;
|
||||
vp.Rules.Add(vr);
|
||||
}
|
||||
return vp;
|
||||
}
|
||||
|
||||
private static VTankLootCondition MapJsonCondition(LootCondition c) => c switch
|
||||
{
|
||||
ObjectClassCondition o => new(VTankNodeTypes.ObjectClass, "0", new[] { o.ObjectClass.ToString() }),
|
||||
LongValKeyGECondition l => new(VTankNodeTypes.LongValKeyGE, "0", new[] { l.Value.ToString(), l.Key.ToString() }),
|
||||
LongValKeyLECondition l => new(VTankNodeTypes.LongValKeyLE, "0", new[] { l.Value.ToString(), l.Key.ToString() }),
|
||||
LongValKeyECondition l => new(VTankNodeTypes.LongValKeyE, "0", new[] { l.Value.ToString(), l.Key.ToString() }),
|
||||
LongValKeyNECondition l => new(VTankNodeTypes.LongValKeyNE, "0", new[] { l.Value.ToString(), l.Key.ToString() }),
|
||||
LongValKeyFlagCondition l => new(VTankNodeTypes.LongValKeyFlagExists,"0", new[] { l.FlagValue.ToString(), l.Key.ToString() }),
|
||||
DoubleValKeyGECondition d => new(VTankNodeTypes.DoubleValKeyGE, "0", new[] { d.Value.ToString(System.Globalization.CultureInfo.InvariantCulture), d.Key.ToString() }),
|
||||
DoubleValKeyLECondition d => new(VTankNodeTypes.DoubleValKeyLE, "0", new[] { d.Value.ToString(System.Globalization.CultureInfo.InvariantCulture), d.Key.ToString() }),
|
||||
StringValueCondition s => new(VTankNodeTypes.StringValueMatch, "0", new[] { s.Pattern, s.Key.ToString() }),
|
||||
TotalRatingsGECondition t => new(VTankNodeTypes.TotalRatingsGE, "0", new[] { t.Value.ToString() }),
|
||||
MinDamageGECondition m => new(VTankNodeTypes.MinDamageGE, "0", new[] { m.Value.ToString(System.Globalization.CultureInfo.InvariantCulture) }),
|
||||
DamagePercentGECondition d => new(VTankNodeTypes.DamagePercentGE, "0", new[] { d.Value.ToString(System.Globalization.CultureInfo.InvariantCulture) }),
|
||||
CharacterSkillGECondition s => new(VTankNodeTypes.CharacterSkillGE, "0", new[] { s.Value.ToString(), ((int)s.Skill).ToString() }),
|
||||
_ => new(VTankNodeTypes.ObjectClass, "0", new[] { "0" }), // unknown -> harmless placeholder
|
||||
};
|
||||
|
||||
private async Task DoSaveAsync(bool saveAs)
|
||||
{
|
||||
if (!saveAs && _filePath != null) { Save(_filePath); return; }
|
||||
var opts = new FilePickerSaveOptions
|
||||
{
|
||||
Title = "Save Loot Profile",
|
||||
SuggestedFileName = _filePath != null ? Path.GetFileNameWithoutExtension(_filePath) : "profile",
|
||||
DefaultExtension = "utl",
|
||||
FileTypeChoices = new[]
|
||||
{
|
||||
new FilePickerFileType("VTank / LootSnob") { Patterns = new[] { "*.utl" } },
|
||||
new FilePickerFileType("Legacy JSON") { Patterns = new[] { "*.json" } },
|
||||
},
|
||||
SuggestedStartLocation = await GetFolderAsync(),
|
||||
};
|
||||
var file = await _window.StorageProvider.SaveFilePickerAsync(opts);
|
||||
if (file == null) return;
|
||||
_filePath = file.Path.LocalPath;
|
||||
Save(_filePath);
|
||||
}
|
||||
|
||||
private void Save(string path)
|
||||
{
|
||||
// Push edits back into the underlying VTank data.
|
||||
FlushSalvageToProfile();
|
||||
_profile.Rules.Clear();
|
||||
foreach (var rvm in Rules)
|
||||
{
|
||||
rvm.FlushConditionsToData();
|
||||
_profile.Rules.Add(rvm.Data);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (path.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// Lossy export: drop conditions we can't represent and write JSON.
|
||||
var jp = ConvertToJson(_profile);
|
||||
jp.Save(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
VTankLootWriter.Save(_profile, path);
|
||||
}
|
||||
_dirty = false;
|
||||
UpdateTitle();
|
||||
Status($"Saved {Path.GetFileName(path)}");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_ = ShowError($"Save failed:\n{ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static LootProfile ConvertToJson(VTankLootProfile vp)
|
||||
{
|
||||
// Minimal VTank → JSON exporter for backward compat. Conditions we
|
||||
// don't have a JSON class for are skipped — saving as JSON is lossy
|
||||
// by design.
|
||||
var jp = new LootProfile { Name = "", SalvageCombine = vp.SalvageCombine };
|
||||
foreach (var vr in vp.Rules)
|
||||
{
|
||||
var jr = new LootRule
|
||||
{
|
||||
Name = vr.Name,
|
||||
Enabled = vr.Enabled,
|
||||
Action = vr.Action switch
|
||||
{
|
||||
VTankLootAction.Keep => LootAction.Keep,
|
||||
VTankLootAction.KeepUpTo => LootAction.KeepUpTo,
|
||||
VTankLootAction.Salvage => LootAction.Salvage,
|
||||
VTankLootAction.Sell => LootAction.Sell,
|
||||
VTankLootAction.Read => LootAction.Read,
|
||||
_ => LootAction.Keep,
|
||||
},
|
||||
KeepCount = vr.KeepCount ?? 0,
|
||||
};
|
||||
jp.Rules.Add(jr);
|
||||
}
|
||||
return jp;
|
||||
}
|
||||
|
||||
// ── Rule editing ─────────────────────────────────────────────────────────
|
||||
|
||||
private void DoRuleAdd()
|
||||
{
|
||||
var data = new VTankLootRule { Name = "New Rule", CustomExpression = string.Empty, Action = VTankLootAction.Keep };
|
||||
var vm = new VTankRuleVm(data);
|
||||
Rules.Add(vm);
|
||||
ApplyFilter();
|
||||
SelectedRule = vm;
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
private void DoRuleDuplicate()
|
||||
{
|
||||
if (_selectedRule == null) return;
|
||||
var src = _selectedRule.Data;
|
||||
var copy = new VTankLootRule
|
||||
{
|
||||
Name = src.Name + " (copy)",
|
||||
CustomExpression = src.CustomExpression,
|
||||
Priority = src.Priority,
|
||||
Action = src.Action,
|
||||
KeepCount = src.KeepCount,
|
||||
};
|
||||
foreach (var c in src.Conditions)
|
||||
copy.Conditions.Add(new VTankLootCondition(c.NodeType, c.LengthCode, c.DataLines));
|
||||
var vm = new VTankRuleVm(copy);
|
||||
int srcIdx = Rules.IndexOf(_selectedRule);
|
||||
Rules.Insert(srcIdx + 1, vm);
|
||||
ApplyFilter();
|
||||
SelectedRule = vm;
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
private void DoRuleDelete()
|
||||
{
|
||||
if (_selectedRule == null) return;
|
||||
int idx = Rules.IndexOf(_selectedRule);
|
||||
Rules.Remove(_selectedRule);
|
||||
ApplyFilter();
|
||||
SelectedRule = idx < Rules.Count ? Rules[idx] : (Rules.Count > 0 ? Rules[^1] : null);
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
private bool CanMoveRule(int dir)
|
||||
{
|
||||
if (_selectedRule == null) return false;
|
||||
int idx = Rules.IndexOf(_selectedRule);
|
||||
int newIdx = idx + dir;
|
||||
return newIdx >= 0 && newIdx < Rules.Count;
|
||||
}
|
||||
|
||||
private void DoRuleMove(int dir)
|
||||
{
|
||||
if (!CanMoveRule(dir)) return;
|
||||
int idx = Rules.IndexOf(_selectedRule!);
|
||||
Rules.Move(idx, idx + dir);
|
||||
ApplyFilter();
|
||||
MarkDirty();
|
||||
RefreshMoveCommands();
|
||||
}
|
||||
|
||||
private void RefreshMoveCommands()
|
||||
{
|
||||
RuleDelete.RaiseCanExecuteChanged();
|
||||
RuleMoveUp.RaiseCanExecuteChanged();
|
||||
RuleMoveDown.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
// ── Condition editing ────────────────────────────────────────────────────
|
||||
|
||||
private void DoCondAdd()
|
||||
{
|
||||
if (_selectedRule == null) return;
|
||||
var data = new VTankLootCondition(VTankNodeTypes.ObjectClass, "0", new[] { "0" });
|
||||
var vm = new VTankConditionVm(data);
|
||||
_selectedRule.Conditions.Add(vm);
|
||||
SelectedCondition = vm;
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
private void DoCondDelete()
|
||||
{
|
||||
if (_selectedRule == null || _selectedCondition == null) return;
|
||||
int idx = _selectedRule.Conditions.IndexOf(_selectedCondition);
|
||||
_selectedRule.Conditions.Remove(_selectedCondition);
|
||||
SelectedCondition = idx < _selectedRule.Conditions.Count
|
||||
? _selectedRule.Conditions[idx]
|
||||
: (_selectedRule.Conditions.Count > 0 ? _selectedRule.Conditions[^1] : null);
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
private bool CanMoveCond(int dir)
|
||||
{
|
||||
if (_selectedRule == null || _selectedCondition == null) return false;
|
||||
int idx = _selectedRule.Conditions.IndexOf(_selectedCondition);
|
||||
int newIdx = idx + dir;
|
||||
return newIdx >= 0 && newIdx < _selectedRule.Conditions.Count;
|
||||
}
|
||||
|
||||
private void DoCondMove(int dir)
|
||||
{
|
||||
if (!CanMoveCond(dir)) return;
|
||||
int idx = _selectedRule!.Conditions.IndexOf(_selectedCondition!);
|
||||
_selectedRule.Conditions.Move(idx, idx + dir);
|
||||
MarkDirty();
|
||||
CondMoveUp.RaiseCanExecuteChanged();
|
||||
CondMoveDown.RaiseCanExecuteChanged();
|
||||
}
|
||||
|
||||
// ── Salvage Combine tab ──────────────────────────────────────────────────
|
||||
|
||||
public ObservableCollection<SalvagePerMaterialRow> PerMaterialRows { get; } = new();
|
||||
|
||||
public IReadOnlyList<MaterialOption> MaterialOptions { get; } = BuildMaterialOptions();
|
||||
private static List<MaterialOption> BuildMaterialOptions()
|
||||
{
|
||||
var list = new List<MaterialOption>();
|
||||
foreach (var kv in MaterialTypes.ByName)
|
||||
list.Add(new MaterialOption(kv.Key, $"{kv.Key} — {kv.Value}"));
|
||||
list.Sort((a, b) => string.Compare(a.Display, b.Display, StringComparison.OrdinalIgnoreCase));
|
||||
return list;
|
||||
}
|
||||
|
||||
private bool _salvageEnabled = true;
|
||||
public bool SalvageEnabled
|
||||
{
|
||||
get => _salvageEnabled;
|
||||
set { Set(ref _salvageEnabled, value); MarkDirty(); }
|
||||
}
|
||||
|
||||
private string _salvageDefaultBands = "1-6, 7-8, 9, 10";
|
||||
public string SalvageDefaultBands
|
||||
{
|
||||
get => _salvageDefaultBands;
|
||||
set { Set(ref _salvageDefaultBands, value); MarkDirty(); }
|
||||
}
|
||||
|
||||
private SalvagePerMaterialRow? _selectedSalvageRow;
|
||||
public SalvagePerMaterialRow? SelectedSalvageRow
|
||||
{
|
||||
get => _selectedSalvageRow;
|
||||
set { Set(ref _selectedSalvageRow, value); SalvageRowDelete.RaiseCanExecuteChanged(); }
|
||||
}
|
||||
|
||||
private void LoadSalvageFromProfile(VTankLootProfile p)
|
||||
{
|
||||
var sc = p.SalvageCombine;
|
||||
_salvageEnabled = sc?.Enabled ?? true;
|
||||
_salvageDefaultBands = sc?.DefaultBands ?? "1-6, 7-8, 9, 10";
|
||||
Notify(nameof(SalvageEnabled));
|
||||
Notify(nameof(SalvageDefaultBands));
|
||||
PerMaterialRows.Clear();
|
||||
if (sc != null)
|
||||
foreach (var kv in sc.PerMaterial)
|
||||
PerMaterialRows.Add(new SalvagePerMaterialRow(kv.Key, MaterialTypes.Name(kv.Key), kv.Value));
|
||||
}
|
||||
|
||||
private void FlushSalvageToProfile()
|
||||
{
|
||||
// Only emit a SalvageCombine block if the user has configured anything;
|
||||
// empty defaults shouldn't litter freshly-created profiles.
|
||||
bool hasContent = PerMaterialRows.Count > 0 || !string.IsNullOrWhiteSpace(SalvageDefaultBands);
|
||||
if (!hasContent && (_profile.SalvageCombine == null || !_profile.SalvageCombine.Enabled))
|
||||
return;
|
||||
|
||||
var sc = _profile.SalvageCombine ?? new SalvageCombineSettings();
|
||||
sc.Enabled = SalvageEnabled;
|
||||
sc.DefaultBands = SalvageDefaultBands ?? string.Empty;
|
||||
sc.PerMaterial.Clear();
|
||||
foreach (var row in PerMaterialRows)
|
||||
if (row.MaterialId > 0)
|
||||
sc.PerMaterial[row.MaterialId] = row.BandsText ?? string.Empty;
|
||||
_profile.SalvageCombine = sc;
|
||||
}
|
||||
|
||||
private void DoSalvageRowAdd()
|
||||
{
|
||||
int firstFree = 0;
|
||||
foreach (var opt in MaterialOptions)
|
||||
{
|
||||
bool used = false;
|
||||
foreach (var row in PerMaterialRows) if (row.MaterialId == opt.Id) { used = true; break; }
|
||||
if (!used) { firstFree = opt.Id; break; }
|
||||
}
|
||||
if (firstFree == 0 && MaterialOptions.Count > 0) firstFree = MaterialOptions[0].Id;
|
||||
var newRow = new SalvagePerMaterialRow(firstFree, MaterialTypes.Name(firstFree), "1-10");
|
||||
PerMaterialRows.Add(newRow);
|
||||
SelectedSalvageRow = newRow;
|
||||
MarkDirty();
|
||||
}
|
||||
|
||||
private void DoSalvageRowDelete()
|
||||
{
|
||||
if (_selectedSalvageRow == null) return;
|
||||
int idx = PerMaterialRows.IndexOf(_selectedSalvageRow);
|
||||
PerMaterialRows.Remove(_selectedSalvageRow);
|
||||
MarkDirty();
|
||||
if (PerMaterialRows.Count > 0)
|
||||
SelectedSalvageRow = PerMaterialRows[Math.Min(idx, PerMaterialRows.Count - 1)];
|
||||
else
|
||||
SelectedSalvageRow = null;
|
||||
}
|
||||
|
||||
private async Task DoSalvageImportUtlAsync()
|
||||
{
|
||||
var opts = new FilePickerOpenOptions
|
||||
{
|
||||
Title = "Import SalvageCombine from VTank/LootSnob .utl",
|
||||
AllowMultiple = false,
|
||||
FileTypeFilter = new[] { new FilePickerFileType("VTank Loot Profile") { Patterns = new[] { "*.utl" } } },
|
||||
SuggestedStartLocation = await GetFolderAsync(),
|
||||
};
|
||||
var files = await _window.StorageProvider.OpenFilePickerAsync(opts);
|
||||
if (files.Count == 0) return;
|
||||
|
||||
var srcProfile = VTankLootParser.Load(files[0].Path.LocalPath);
|
||||
if (srcProfile.SalvageCombine == null)
|
||||
{
|
||||
await ShowError("That .utl file has no SalvageCombine block.");
|
||||
return;
|
||||
}
|
||||
|
||||
var sc = srcProfile.SalvageCombine;
|
||||
SalvageEnabled = sc.Enabled;
|
||||
SalvageDefaultBands = sc.DefaultBands;
|
||||
PerMaterialRows.Clear();
|
||||
foreach (var kv in sc.PerMaterial)
|
||||
PerMaterialRows.Add(new SalvagePerMaterialRow(kv.Key, MaterialTypes.Name(kv.Key), kv.Value));
|
||||
MarkDirty();
|
||||
Status($"Imported SalvageCombine from {Path.GetFileName(files[0].Path.LocalPath)} ({sc.PerMaterial.Count} per-material rule(s)).");
|
||||
}
|
||||
|
||||
// ── Plumbing helpers ─────────────────────────────────────────────────────
|
||||
|
||||
private bool ConfirmDiscard()
|
||||
{
|
||||
if (!_dirty) return true;
|
||||
// Keep simple — auto-discard. (A confirm dialog can come later.)
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<IStorageFolder?> GetFolderAsync()
|
||||
{
|
||||
if (Directory.Exists(DefaultFolder))
|
||||
return await _window.StorageProvider.TryGetFolderFromPathAsync(DefaultFolder);
|
||||
return null;
|
||||
}
|
||||
|
||||
private async Task ShowError(string msg)
|
||||
{
|
||||
await Task.Yield();
|
||||
Status(msg.Replace('\n', ' '));
|
||||
}
|
||||
}
|
||||
|
||||
public sealed record NodeTypeOption(int Id, string Display);
|
||||
372
Tools/RynthCore.LootEditor/MainWindow.axaml
Normal file
372
Tools/RynthCore.LootEditor/MainWindow.axaml
Normal file
|
|
@ -0,0 +1,372 @@
|
|||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="RynthCore.LootEditor.MainWindow"
|
||||
Title="{Binding WindowTitle}"
|
||||
Width="1280" Height="760"
|
||||
MinWidth="900" MinHeight="540"
|
||||
WindowStartupLocation="CenterScreen">
|
||||
|
||||
<DockPanel>
|
||||
|
||||
<!-- Menu -->
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_New" Command="{Binding FileNew}" InputGesture="Ctrl+N"/>
|
||||
<MenuItem Header="_Open..." Command="{Binding FileOpen}" InputGesture="Ctrl+O"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="_Save" Command="{Binding FileSave}" InputGesture="Ctrl+S"/>
|
||||
<MenuItem Header="Save _As..." Command="{Binding FileSaveAs}" InputGesture="Ctrl+Shift+S"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="E_xit" Command="{Binding FileExit}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Rule">
|
||||
<MenuItem Header="_New rule" Command="{Binding RuleAdd}" InputGesture="Ctrl+R"/>
|
||||
<MenuItem Header="_Duplicate rule" Command="{Binding RuleDuplicate}" InputGesture="Ctrl+D"/>
|
||||
<MenuItem Header="Delete rule" Command="{Binding RuleDelete}" InputGesture="Delete"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="Move up" Command="{Binding RuleMoveUp}" InputGesture="Alt+Up"/>
|
||||
<MenuItem Header="Move down" Command="{Binding RuleMoveDown}" InputGesture="Alt+Down"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
|
||||
<!-- Keyboard shortcuts -->
|
||||
<DockPanel.KeyBindings>
|
||||
<KeyBinding Gesture="Ctrl+N" Command="{Binding FileNew}"/>
|
||||
<KeyBinding Gesture="Ctrl+O" Command="{Binding FileOpen}"/>
|
||||
<KeyBinding Gesture="Ctrl+S" Command="{Binding FileSave}"/>
|
||||
<KeyBinding Gesture="Ctrl+Shift+S" Command="{Binding FileSaveAs}"/>
|
||||
<KeyBinding Gesture="Ctrl+R" Command="{Binding RuleAdd}"/>
|
||||
<KeyBinding Gesture="Ctrl+D" Command="{Binding RuleDuplicate}"/>
|
||||
<KeyBinding Gesture="Alt+Up" Command="{Binding RuleMoveUp}"/>
|
||||
<KeyBinding Gesture="Alt+Down" Command="{Binding RuleMoveDown}"/>
|
||||
</DockPanel.KeyBindings>
|
||||
|
||||
<!-- Status bar -->
|
||||
<Border DockPanel.Dock="Bottom" Background="#080C10" Padding="8,3">
|
||||
<TextBlock Text="{Binding StatusMessage}"
|
||||
Foreground="{StaticResource FgMuted}" FontSize="11"/>
|
||||
</Border>
|
||||
|
||||
<TabControl Background="#0B1015">
|
||||
|
||||
<!-- ─── Rules tab ─────────────────────────────────────────────────── -->
|
||||
<TabItem Header="Rules">
|
||||
<Grid Background="#0B1015">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="340" MinWidth="260"/>
|
||||
<ColumnDefinition Width="6"/>
|
||||
<ColumnDefinition Width="*" MinWidth="320"/>
|
||||
<ColumnDefinition Width="6"/>
|
||||
<ColumnDefinition Width="440" MinWidth="320"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- ── Pane 1 — Rules list ────────────────────────────────── -->
|
||||
<Border Grid.Column="0" Margin="6,6,0,6"
|
||||
Background="#10161D"
|
||||
BorderBrush="#26303A"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="8">
|
||||
<DockPanel>
|
||||
<TextBox DockPanel.Dock="Top"
|
||||
Text="{Binding SearchText}"
|
||||
Watermark="Search rules…"
|
||||
Margin="0,0,0,6"/>
|
||||
|
||||
<!-- Action filter chips -->
|
||||
<WrapPanel DockPanel.Dock="Top" Margin="0,0,0,6">
|
||||
<ToggleButton Content="All"
|
||||
IsChecked="{Binding IsActionFilterAll}"
|
||||
Command="{Binding SetActionFilter}"
|
||||
Padding="8,2" Margin="0,0,3,3"/>
|
||||
<ToggleButton Content="Keep"
|
||||
IsChecked="{Binding IsActionFilterKeep}"
|
||||
Command="{Binding SetActionFilter}" CommandParameter="Keep"
|
||||
Background="#1f6f3a" Foreground="White" Padding="8,2" Margin="0,0,3,3"/>
|
||||
<ToggleButton Content="Keep#"
|
||||
IsChecked="{Binding IsActionFilterKeepUpTo}"
|
||||
Command="{Binding SetActionFilter}" CommandParameter="KeepUpTo"
|
||||
Background="#196e6e" Foreground="White" Padding="8,2" Margin="0,0,3,3"/>
|
||||
<ToggleButton Content="Salv"
|
||||
IsChecked="{Binding IsActionFilterSalvage}"
|
||||
Command="{Binding SetActionFilter}" CommandParameter="Salvage"
|
||||
Background="#a35c15" Foreground="White" Padding="8,2" Margin="0,0,3,3"/>
|
||||
<ToggleButton Content="Sell"
|
||||
IsChecked="{Binding IsActionFilterSell}"
|
||||
Command="{Binding SetActionFilter}" CommandParameter="Sell"
|
||||
Background="#7a1f1f" Foreground="White" Padding="8,2" Margin="0,0,3,3"/>
|
||||
<ToggleButton Content="Read"
|
||||
IsChecked="{Binding IsActionFilterRead}"
|
||||
Command="{Binding SetActionFilter}" CommandParameter="Read"
|
||||
Background="#1f497d" Foreground="White" Padding="8,2" Margin="0,0,3,3"/>
|
||||
</WrapPanel>
|
||||
|
||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,4">
|
||||
<TextBlock Text="{Binding RuleCountLabel}"
|
||||
Foreground="{StaticResource FgMuted}"
|
||||
VerticalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="3">
|
||||
<Button Content="+" Width="24" Padding="0" Command="{Binding RuleAdd}" ToolTip.Tip="New rule (Ctrl+R)"/>
|
||||
<Button Content="⎘" Width="24" Padding="0" Command="{Binding RuleDuplicate}" ToolTip.Tip="Duplicate (Ctrl+D)"/>
|
||||
<Button Content="−" Width="24" Padding="0" Command="{Binding RuleDelete}" ToolTip.Tip="Delete (Del)"/>
|
||||
<Button Content="↑" Width="24" Padding="0" Command="{Binding RuleMoveUp}" ToolTip.Tip="Move up (Alt+↑)"/>
|
||||
<Button Content="↓" Width="24" Padding="0" Command="{Binding RuleMoveDown}" ToolTip.Tip="Move down (Alt+↓)"/>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
<ListBox x:Name="RulesList"
|
||||
ItemsSource="{Binding FilteredRules}"
|
||||
SelectedItem="{Binding SelectedRule}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid ColumnDefinitions="Auto,*,Auto" Margin="0,1">
|
||||
<!-- Action badge -->
|
||||
<Border Grid.Column="0"
|
||||
Background="{Binding ActionBadgeBrush}"
|
||||
CornerRadius="3"
|
||||
Padding="6,1"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,6,0">
|
||||
<TextBlock Text="{Binding ActionLabel}"
|
||||
Foreground="{Binding ActionBadgeForeground}"
|
||||
FontSize="10"
|
||||
FontWeight="Bold"/>
|
||||
</Border>
|
||||
<!-- Name -->
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding Name}"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"/>
|
||||
<TextBlock Grid.Column="1"
|
||||
Text="{Binding Name}"
|
||||
VerticalAlignment="Center"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
TextDecorations="Strikethrough"
|
||||
Opacity="0.45"
|
||||
IsVisible="{Binding !Enabled}"/>
|
||||
<!-- Condition count -->
|
||||
<TextBlock Grid.Column="2"
|
||||
Text="{Binding ConditionCountLabel}"
|
||||
Foreground="{StaticResource FgMuted}"
|
||||
FontSize="10"
|
||||
VerticalAlignment="Center"
|
||||
Margin="6,0,0,0"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
<ListBox.KeyBindings>
|
||||
<KeyBinding Gesture="Delete" Command="{Binding RuleDelete}"/>
|
||||
</ListBox.KeyBindings>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
<GridSplitter Grid.Column="1" Width="6" ResizeDirection="Columns"
|
||||
Background="#26303A"/>
|
||||
|
||||
<!-- ── Pane 2 — Rule meta ─────────────────────────────────── -->
|
||||
<Border Grid.Column="2" Margin="0,6,0,6"
|
||||
Background="#10161D"
|
||||
BorderBrush="#26303A"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="10"
|
||||
IsEnabled="{Binding RuleEditorEnabled}">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Top"
|
||||
Text="Rule"
|
||||
Foreground="{StaticResource FgAccent}"
|
||||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
Margin="0,0,0,8"/>
|
||||
|
||||
<Grid DockPanel.Dock="Top">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="60"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="6"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="6"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="6"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
<RowDefinition Height="6"/>
|
||||
<RowDefinition Height="Auto"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBlock Grid.Row="0" Grid.Column="0" Text="Name"
|
||||
VerticalAlignment="Center" Foreground="{StaticResource FgMuted}"/>
|
||||
<TextBox Grid.Row="0" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
Text="{Binding SelectedRule.Name, Mode=TwoWay}"
|
||||
Watermark="Rule name…"/>
|
||||
|
||||
<TextBlock Grid.Row="2" Grid.Column="0" Text="Action"
|
||||
VerticalAlignment="Center" Foreground="{StaticResource FgMuted}"/>
|
||||
<ComboBox Grid.Row="2" Grid.Column="1"
|
||||
ItemsSource="{Binding Actions}"
|
||||
SelectedItem="{Binding SelectedRule.Action, Mode=TwoWay}"
|
||||
HorizontalAlignment="Stretch"/>
|
||||
<TextBox Grid.Row="2" Grid.Column="2"
|
||||
Text="{Binding SelectedRule.KeepCount, Mode=TwoWay}"
|
||||
IsVisible="{Binding KeepCountVisible}"
|
||||
Margin="4,0,0,0"
|
||||
ToolTip.Tip="Keep count (KeepUpTo)"/>
|
||||
|
||||
<TextBlock Grid.Row="4" Grid.Column="0" Text="Custom Expr"
|
||||
VerticalAlignment="Top" Foreground="{StaticResource FgMuted}"
|
||||
Margin="0,4,0,0"/>
|
||||
<TextBox Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2"
|
||||
Text="{Binding SelectedRule.CustomExpression, Mode=TwoWay}"
|
||||
Watermark="(VTank's custom-key expression — leave blank if unused)"
|
||||
AcceptsReturn="False"/>
|
||||
|
||||
<CheckBox Grid.Row="6" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Content="Enabled"
|
||||
IsChecked="{Binding SelectedRule.Enabled, Mode=TwoWay}"/>
|
||||
|
||||
<Border Grid.Row="8" Grid.Column="0" Grid.ColumnSpan="3"
|
||||
Background="#0A0E13"
|
||||
BorderBrush="#26303A"
|
||||
BorderThickness="1"
|
||||
CornerRadius="3"
|
||||
Padding="8"
|
||||
Margin="0,2,0,0">
|
||||
<StackPanel>
|
||||
<TextBlock Text="Plain English"
|
||||
Foreground="{StaticResource FgMuted}"
|
||||
FontSize="10"/>
|
||||
<TextBlock Text="{Binding SelectedRule.Summary}"
|
||||
TextWrapping="Wrap"
|
||||
Margin="0,2,0,0"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
|
||||
<GridSplitter Grid.Column="3" Width="6" ResizeDirection="Columns"
|
||||
Background="#26303A"/>
|
||||
|
||||
<!-- ── Pane 3 — Conditions list + editor ──────────────────── -->
|
||||
<Border Grid.Column="4" Margin="0,6,6,6"
|
||||
Background="#10161D"
|
||||
BorderBrush="#26303A"
|
||||
BorderThickness="1"
|
||||
CornerRadius="4"
|
||||
Padding="10"
|
||||
IsEnabled="{Binding RuleEditorEnabled}">
|
||||
<DockPanel>
|
||||
|
||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,6">
|
||||
<TextBlock Text="Conditions"
|
||||
Foreground="{StaticResource FgAccent}"
|
||||
FontSize="13"
|
||||
FontWeight="SemiBold"
|
||||
VerticalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="3">
|
||||
<Button Content="+" Width="24" Padding="0" Command="{Binding CondAdd}" ToolTip.Tip="Add condition"/>
|
||||
<Button Content="−" Width="24" Padding="0" Command="{Binding CondDelete}" ToolTip.Tip="Delete"/>
|
||||
<Button Content="↑" Width="24" Padding="0" Command="{Binding CondMoveUp}" ToolTip.Tip="Move up"/>
|
||||
<Button Content="↓" Width="24" Padding="0" Command="{Binding CondMoveDown}" ToolTip.Tip="Move down"/>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
<ListBox DockPanel.Dock="Top"
|
||||
Height="160"
|
||||
ItemsSource="{Binding Conditions}"
|
||||
SelectedItem="{Binding SelectedCondition}"
|
||||
Margin="0,0,0,8">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding DisplayName}" VerticalAlignment="Center"/>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<Border Background="#0A0E13"
|
||||
BorderBrush="#26303A"
|
||||
BorderThickness="1"
|
||||
CornerRadius="3"
|
||||
Padding="10"
|
||||
MinHeight="80">
|
||||
<ScrollViewer VerticalScrollBarVisibility="Auto"
|
||||
HorizontalScrollBarVisibility="Disabled">
|
||||
<ContentControl Content="{Binding ConditionEditor}"/>
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
|
||||
<!-- ─── Salvage Combine tab ───────────────────────────────────────── -->
|
||||
<TabItem Header="Salvage Combine">
|
||||
<DockPanel Margin="10">
|
||||
<Grid DockPanel.Dock="Top" Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="120"/>
|
||||
<ColumnDefinition Width="*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<CheckBox Grid.Column="0"
|
||||
Content="Enable workmanship-band combining"
|
||||
IsChecked="{Binding SalvageEnabled}"
|
||||
VerticalAlignment="Center"
|
||||
Margin="0,0,16,0"/>
|
||||
<TextBlock Grid.Column="1" Text="Default bands"
|
||||
VerticalAlignment="Center" Foreground="{StaticResource FgMuted}"
|
||||
Margin="0,0,4,0"/>
|
||||
<TextBox Grid.Column="2"
|
||||
Text="{Binding SalvageDefaultBands}"
|
||||
Watermark="e.g. 1-6, 7-8, 9, 10"/>
|
||||
<Button Grid.Column="3"
|
||||
Content="Import from .utl…"
|
||||
Command="{Binding SalvageImportUtl}"
|
||||
Margin="8,0,0,0"
|
||||
ToolTip.Tip="Read SalvageCombine block from a LootSnob/VTank .utl file."/>
|
||||
</Grid>
|
||||
|
||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,4">
|
||||
<TextBlock Text="Per-material overrides"
|
||||
Foreground="{StaticResource FgAccent}"
|
||||
FontSize="13"
|
||||
VerticalAlignment="Center"/>
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Spacing="3">
|
||||
<Button Content="+" Width="24" Padding="0" Command="{Binding SalvageRowAdd}" ToolTip.Tip="Add material override"/>
|
||||
<Button Content="−" Width="24" Padding="0" Command="{Binding SalvageRowDelete}" ToolTip.Tip="Remove selected"/>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
|
||||
<DataGrid ItemsSource="{Binding PerMaterialRows}"
|
||||
SelectedItem="{Binding SelectedSalvageRow}"
|
||||
AutoGenerateColumns="False"
|
||||
GridLinesVisibility="Horizontal"
|
||||
IsReadOnly="False"
|
||||
CanUserResizeColumns="True">
|
||||
<DataGrid.Columns>
|
||||
<DataGridTemplateColumn Header="Material" Width="240">
|
||||
<DataGridTemplateColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding $parent[DataGrid].DataContext.MaterialOptions}"
|
||||
DisplayMemberBinding="{Binding Display}"
|
||||
SelectedValueBinding="{Binding Id}"
|
||||
SelectedValue="{Binding MaterialId, Mode=TwoWay}"/>
|
||||
</DataTemplate>
|
||||
</DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
<DataGridTextColumn Header="Bands"
|
||||
Binding="{Binding BandsText}"
|
||||
Width="*"/>
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
21
Tools/RynthCore.LootEditor/MainWindow.axaml.cs
Normal file
21
Tools/RynthCore.LootEditor/MainWindow.axaml.cs
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
private readonly MainViewModel _vm;
|
||||
private bool _forceClose;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_vm = new MainViewModel(this);
|
||||
DataContext = _vm;
|
||||
|
||||
// (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.)
|
||||
_ = _forceClose; // silence unused-field warning
|
||||
}
|
||||
}
|
||||
39
Tools/RynthCore.LootEditor/Program.cs
Normal file
39
Tools/RynthCore.LootEditor/Program.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using Avalonia;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
class Program
|
||||
{
|
||||
internal static readonly string LogPath =
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "LootEditor.log");
|
||||
|
||||
[System.STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||
Log($"UNHANDLED: {e.ExceptionObject}");
|
||||
|
||||
try
|
||||
{
|
||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"FATAL: {ex}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Log(string msg)
|
||||
{
|
||||
try { File.AppendAllText(LogPath, $"[{DateTime.Now:HH:mm:ss}] {msg}\n"); }
|
||||
catch { /* best-effort */ }
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp() =>
|
||||
AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace();
|
||||
}
|
||||
23
Tools/RynthCore.LootEditor/RelayCommand.cs
Normal file
23
Tools/RynthCore.LootEditor/RelayCommand.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using System;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
public class RelayCommand : ICommand
|
||||
{
|
||||
private readonly Action<object?> _execute;
|
||||
private readonly Func<object?, bool>? _canExecute;
|
||||
|
||||
public RelayCommand(Action<object?> execute, Func<object?, bool>? canExecute = null)
|
||||
{
|
||||
_execute = execute;
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
public event EventHandler? CanExecuteChanged;
|
||||
public void RaiseCanExecuteChanged() =>
|
||||
CanExecuteChanged?.Invoke(this, EventArgs.Empty);
|
||||
|
||||
public bool CanExecute(object? parameter) => _canExecute?.Invoke(parameter) ?? true;
|
||||
public void Execute(object? parameter) => _execute(parameter);
|
||||
}
|
||||
25
Tools/RynthCore.LootEditor/RynthCore.LootEditor.csproj
Normal file
25
Tools/RynthCore.LootEditor/RynthCore.LootEditor.csproj
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>RynthCore.LootEditor</AssemblyName>
|
||||
<RootNamespace>RynthCore.LootEditor</RootNamespace>
|
||||
<AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>
|
||||
<UseWpf>false</UseWpf>
|
||||
<UseWindowsForms>false</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Shared\RynthCore.LootSdk\RynthCore.LootSdk.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
51
Tools/RynthCore.LootEditor/SalvageVMs.cs
Normal file
51
Tools/RynthCore.LootEditor/SalvageVMs.cs
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
using RynthCore.Loot;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
/// <summary>One row in the per-material salvage combine table.</summary>
|
||||
public sealed class SalvagePerMaterialRow : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
private void Notify([CallerMemberName] string? n = null) =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
|
||||
|
||||
private int _materialId;
|
||||
public int MaterialId
|
||||
{
|
||||
get => _materialId;
|
||||
set
|
||||
{
|
||||
if (_materialId == value) return;
|
||||
_materialId = value;
|
||||
_materialName = MaterialTypes.Name(value);
|
||||
Notify();
|
||||
Notify(nameof(MaterialName));
|
||||
}
|
||||
}
|
||||
|
||||
private string _materialName;
|
||||
public string MaterialName
|
||||
{
|
||||
get => _materialName;
|
||||
private set { _materialName = value; Notify(); }
|
||||
}
|
||||
|
||||
private string _bandsText;
|
||||
public string BandsText
|
||||
{
|
||||
get => _bandsText;
|
||||
set { if (_bandsText == value) return; _bandsText = value; Notify(); }
|
||||
}
|
||||
|
||||
public SalvagePerMaterialRow(int materialId, string materialName, string bandsText)
|
||||
{
|
||||
_materialId = materialId;
|
||||
_materialName = materialName;
|
||||
_bandsText = bandsText;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>(id, "id - name") pair shown in the material picker ComboBox.</summary>
|
||||
public sealed record MaterialOption(int Id, string Display);
|
||||
139
Tools/RynthCore.LootEditor/Styles.axaml
Normal file
139
Tools/RynthCore.LootEditor/Styles.axaml
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Styles.Resources>
|
||||
<Color x:Key="BgMainColor" >#0A0F14</Color>
|
||||
<Color x:Key="BgPanelColor" >#171F29</Color>
|
||||
<Color x:Key="BgInputColor" >#141C26</Color>
|
||||
<Color x:Key="BgHoverColor" >#1A2E40</Color>
|
||||
<Color x:Key="BgSelectColor" >#264059</Color>
|
||||
<Color x:Key="FgMainColor" >#FFFFFF</Color>
|
||||
<Color x:Key="FgMutedColor" >#7D8FA1</Color>
|
||||
<Color x:Key="FgAccentColor" >#1FC7AB</Color>
|
||||
<Color x:Key="BorderColor" >#264059</Color>
|
||||
|
||||
<SolidColorBrush x:Key="BgMain" Color="{StaticResource BgMainColor}"/>
|
||||
<SolidColorBrush x:Key="BgPanel" Color="{StaticResource BgPanelColor}"/>
|
||||
<SolidColorBrush x:Key="BgInput" Color="{StaticResource BgInputColor}"/>
|
||||
<SolidColorBrush x:Key="BgHover" Color="{StaticResource BgHoverColor}"/>
|
||||
<SolidColorBrush x:Key="BgSelect" Color="{StaticResource BgSelectColor}"/>
|
||||
<SolidColorBrush x:Key="FgMain" Color="{StaticResource FgMainColor}"/>
|
||||
<SolidColorBrush x:Key="FgMuted" Color="{StaticResource FgMutedColor}"/>
|
||||
<SolidColorBrush x:Key="FgAccent" Color="{StaticResource FgAccentColor}"/>
|
||||
<SolidColorBrush x:Key="Border" Color="{StaticResource BorderColor}"/>
|
||||
</Styles.Resources>
|
||||
|
||||
<!-- Window -->
|
||||
<Style Selector="Window">
|
||||
<Setter Property="Background" Value="{StaticResource BgMain}"/>
|
||||
<Setter Property="FontFamily" Value="Segoe UI,sans-serif"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
</Style>
|
||||
|
||||
<!-- TextBlock -->
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
</Style>
|
||||
|
||||
<!-- TextBox -->
|
||||
<Style Selector="TextBox">
|
||||
<Setter Property="Background" Value="{StaticResource BgInput}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="5,3"/>
|
||||
<Setter Property="CaretBrush" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="SelectionBrush" Value="{StaticResource BgSelect}"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
</Style>
|
||||
<Style Selector="TextBox:focus /template/ Border#PART_BorderElement">
|
||||
<Setter Property="BorderBrush" Value="{StaticResource FgAccent}"/>
|
||||
</Style>
|
||||
|
||||
<!-- Button -->
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Background" Value="{StaticResource BgPanel}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="10,3"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Style>
|
||||
<Style Selector="Button:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgHover}"/>
|
||||
</Style>
|
||||
<Style Selector="Button:pressed /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgSelect}"/>
|
||||
</Style>
|
||||
|
||||
<!-- ComboBox -->
|
||||
<Style Selector="ComboBox">
|
||||
<Setter Property="Background" Value="{StaticResource BgInput}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="5,3"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
</Style>
|
||||
<Style Selector="ComboBoxItem">
|
||||
<Setter Property="Background" Value="{StaticResource BgPanel}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="Padding" Value="8,4"/>
|
||||
</Style>
|
||||
<Style Selector="ComboBoxItem:selected /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgSelect}"/>
|
||||
</Style>
|
||||
<Style Selector="ComboBoxItem:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgHover}"/>
|
||||
</Style>
|
||||
|
||||
<!-- ListBox -->
|
||||
<Style Selector="ListBox">
|
||||
<Setter Property="Background" Value="{StaticResource BgMain}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
</Style>
|
||||
<Style Selector="ListBoxItem">
|
||||
<Setter Property="Padding" Value="8,4"/>
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
</Style>
|
||||
<Style Selector="ListBoxItem:selected /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgSelect}"/>
|
||||
</Style>
|
||||
<Style Selector="ListBoxItem:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgHover}"/>
|
||||
</Style>
|
||||
|
||||
<!-- CheckBox -->
|
||||
<Style Selector="CheckBox">
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
</Style>
|
||||
|
||||
<!-- Menu -->
|
||||
<Style Selector="Menu">
|
||||
<Setter Property="Background" Value="{StaticResource BgPanel}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
</Style>
|
||||
<Style Selector="MenuItem">
|
||||
<Setter Property="Background" Value="{StaticResource BgPanel}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
</Style>
|
||||
<Style Selector="MenuItem:pointerover /template/ Border#PART_LayoutRoot">
|
||||
<Setter Property="Background" Value="{StaticResource BgHover}"/>
|
||||
</Style>
|
||||
<Style Selector="Separator">
|
||||
<Setter Property="Background" Value="{StaticResource Border}"/>
|
||||
</Style>
|
||||
|
||||
<!-- GridSplitter -->
|
||||
<Style Selector="GridSplitter">
|
||||
<Setter Property="Background" Value="{StaticResource Border}"/>
|
||||
</Style>
|
||||
|
||||
</Styles>
|
||||
435
Tools/RynthCore.LootEditor/TypedEditors.cs
Normal file
435
Tools/RynthCore.LootEditor/TypedEditors.cs
Normal file
|
|
@ -0,0 +1,435 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
/// <summary>
|
||||
/// Per-NodeType typed editors. Each builder reads/writes the underlying
|
||||
/// VTankConditionVm.Data.DataLines so changes round-trip through the writer.
|
||||
/// </summary>
|
||||
internal static class TypedEditors
|
||||
{
|
||||
private static readonly IBrush MutedBrush = new SolidColorBrush(Color.Parse("#7A8896"));
|
||||
|
||||
// ── ObjectClass ──────────────────────────────────────────────────────────
|
||||
|
||||
public static readonly (int Id, string Name)[] ObjectClasses =
|
||||
{
|
||||
(0, "Unknown"), (1, "MeleeWeapon"), (2, "Armor"), (3, "Clothing"),
|
||||
(4, "Jewelry"), (5, "Monster"), (6, "Food"), (7, "Money"),
|
||||
(8, "Misc"), (9, "MissileWeapon"), (10, "Container"), (11, "Useless"),
|
||||
(12, "Gem"), (13, "SpellComp"), (14, "Key"), (15, "WandStaffOrb"),
|
||||
(16, "Portal"), (17, "TradeNote"), (18, "ManaStone"), (19, "Plant"),
|
||||
(20, "BaseAlchemy"), (21, "BaseCooking"), (22, "BaseFletching"), (23, "Player"),
|
||||
(24, "Vendor"), (25, "Door"), (26, "Corpse"), (27, "Lifestone"),
|
||||
(28, "Foci"), (29, "Salvage"), (30, "Ust"), (31, "Bundle"),
|
||||
(32, "Book"), (33, "Journal"), (34, "Sign"), (35, "Housing"),
|
||||
(36, "Pack"), (37, "Scroll"), (38, "BaseArmorTinker"), (39, "BaseWeaponTinker"),
|
||||
(40, "BaseMagicTinker"), (41, "BaseItemTinker"), (50, "Salvage (legacy)"),
|
||||
};
|
||||
|
||||
public static (int Id, string Name)[] ObjectClassesAccess() => ObjectClasses;
|
||||
|
||||
public static Control ObjectClassEditor(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
return Row("Object Class",
|
||||
Combo(ObjectClasses, vm.Data.DataLines, 0, onChange, vm));
|
||||
}
|
||||
|
||||
// ── Long key conditions (LE/GE/E/NE/Flag) ────────────────────────────────
|
||||
|
||||
public static Control LongKeyEditor(VTankConditionVm vm, Action onChange, string op)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto")
|
||||
};
|
||||
AddCell(grid, Label("Key"), col: 0);
|
||||
AddCell(grid, KeyCombo(LongKeys, vm.Data.DataLines, 1, onChange, vm), col: 1);
|
||||
AddCell(grid, Label(op), col: 2);
|
||||
AddCell(grid, Label("Value"), col: 3);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 0, onChange, vm), col: 4);
|
||||
return grid;
|
||||
}
|
||||
|
||||
public static Control LongFlagEditor(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto")
|
||||
};
|
||||
AddCell(grid, Label("Key"), col: 0);
|
||||
AddCell(grid, KeyCombo(LongKeys, vm.Data.DataLines, 1, onChange, vm), col: 1);
|
||||
AddCell(grid, Label("has flag"), col: 2);
|
||||
AddCell(grid, Label("Value"), col: 3);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 0, onChange, vm), col: 4);
|
||||
return grid;
|
||||
}
|
||||
|
||||
public static Control DoubleKeyEditor(VTankConditionVm vm, Action onChange, string op)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto")
|
||||
};
|
||||
AddCell(grid, Label("Key"), col: 0);
|
||||
AddCell(grid, KeyCombo(DoubleKeys, vm.Data.DataLines, 1, onChange, vm), col: 1);
|
||||
AddCell(grid, Label(op), col: 2);
|
||||
AddCell(grid, Label("Value"), col: 3);
|
||||
AddCell(grid, DoubleBox(vm.Data.DataLines, 0, onChange, vm), col: 4);
|
||||
return grid;
|
||||
}
|
||||
|
||||
public static Control DoubleKeyAsLongEditor(VTankConditionVm vm, Action onChange, string op)
|
||||
{
|
||||
// Buffed-long: the value is stored as a double in slot 0 even though the key indexes a long property.
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto")
|
||||
};
|
||||
AddCell(grid, Label("Key (long)"), col: 0);
|
||||
AddCell(grid, KeyCombo(LongKeys, vm.Data.DataLines, 1, onChange, vm), col: 1);
|
||||
AddCell(grid, Label(op), col: 2);
|
||||
AddCell(grid, Label("Value"), col: 3);
|
||||
AddCell(grid, DoubleBox(vm.Data.DataLines, 0, onChange, vm), col: 4);
|
||||
return grid;
|
||||
}
|
||||
|
||||
// ── String / spell ───────────────────────────────────────────────────────
|
||||
|
||||
public static Control StringValueEditor(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto")
|
||||
};
|
||||
AddCell(grid, Label("String key"), col: 0);
|
||||
AddCell(grid, KeyCombo(StringKeys, vm.Data.DataLines, 1, onChange, vm), col: 1);
|
||||
AddCell(grid, Label("matches"), col: 2);
|
||||
AddCell(grid, StringBox(vm.Data.DataLines, 0, onChange, vm, "regex pattern"), col: 3);
|
||||
return grid;
|
||||
}
|
||||
|
||||
public static Control SingleStringEditor(VTankConditionVm vm, Action onChange, string label)
|
||||
{
|
||||
return Row(label, StringBox(vm.Data.DataLines, 0, onChange, vm, label));
|
||||
}
|
||||
|
||||
public static Control SpellMatchEditor(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto,Auto,Auto"),
|
||||
};
|
||||
AddCell(grid, Label("Match regex"), col: 0, row: 0);
|
||||
AddCell(grid, StringBox(vm.Data.DataLines, 0, onChange, vm), col: 1, row: 0);
|
||||
AddCell(grid, Label("No-match regex"), col: 0, row: 1);
|
||||
AddCell(grid, StringBox(vm.Data.DataLines, 1, onChange, vm), col: 1, row: 1);
|
||||
AddCell(grid, Label("Min count"), col: 0, row: 2);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 2, onChange, vm), col: 1, row: 2);
|
||||
return grid;
|
||||
}
|
||||
|
||||
// ── Single-value editors ────────────────────────────────────────────────
|
||||
|
||||
public static Control SingleIntEditor(VTankConditionVm vm, Action onChange, string label)
|
||||
=> Row(label, IntBox(vm.Data.DataLines, 0, onChange, vm));
|
||||
|
||||
public static Control SingleDoubleEditor(VTankConditionVm vm, Action onChange, string label)
|
||||
=> Row(label, DoubleBox(vm.Data.DataLines, 0, onChange, vm));
|
||||
|
||||
public static Control TwoIntEditor(VTankConditionVm vm, Action onChange, string a, string b)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto"),
|
||||
};
|
||||
AddCell(grid, Label(a), col: 0);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 0, onChange, vm), col: 1);
|
||||
AddCell(grid, Label(b), col: 2);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 1, onChange, vm), col: 3);
|
||||
return grid;
|
||||
}
|
||||
|
||||
public static Control ThreeDoubleEditor(VTankConditionVm vm, Action onChange, string a, string b, string c)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto,Auto,Auto"),
|
||||
};
|
||||
AddCell(grid, Label(a), col: 0, row: 0); AddCell(grid, DoubleBox(vm.Data.DataLines, 0, onChange, vm), col: 1, row: 0);
|
||||
AddCell(grid, Label(b), col: 0, row: 1); AddCell(grid, DoubleBox(vm.Data.DataLines, 1, onChange, vm), col: 1, row: 1);
|
||||
AddCell(grid, Label(c), col: 0, row: 2); AddCell(grid, DoubleBox(vm.Data.DataLines, 2, onChange, vm), col: 1, row: 2);
|
||||
return grid;
|
||||
}
|
||||
|
||||
// ── Skill ────────────────────────────────────────────────────────────────
|
||||
|
||||
public static Control SkillGEEditor(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto"),
|
||||
};
|
||||
AddCell(grid, Label("Skill"), col: 0);
|
||||
AddCell(grid, KeyCombo(Skills, vm.Data.DataLines, 1, onChange, vm), col: 1);
|
||||
AddCell(grid, Label("≥"), col: 2);
|
||||
AddCell(grid, Label("Value"), col: 3);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 0, onChange, vm), col: 4);
|
||||
return grid;
|
||||
}
|
||||
|
||||
public static Control BaseSkillEditor(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*,Auto,*,Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto"),
|
||||
};
|
||||
AddCell(grid, Label("Skill"), col: 0);
|
||||
AddCell(grid, KeyCombo(Skills, vm.Data.DataLines, 0, onChange, vm), col: 1);
|
||||
AddCell(grid, Label("Min"), col: 2);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 1, onChange, vm), col: 3);
|
||||
AddCell(grid, Label("Max"), col: 4);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 2, onChange, vm), col: 5);
|
||||
return grid;
|
||||
}
|
||||
|
||||
// ── Color ────────────────────────────────────────────────────────────────
|
||||
|
||||
public static Control ColorEditor(VTankConditionVm vm, Action onChange, bool hasArmorOrSlot, string trailingLabel = "")
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto,Auto,Auto,Auto,Auto,Auto"),
|
||||
};
|
||||
AddCell(grid, Label("R"), col: 0, row: 0); AddCell(grid, IntBox(vm.Data.DataLines, 0, onChange, vm), col: 1, row: 0);
|
||||
AddCell(grid, Label("G"), col: 0, row: 1); AddCell(grid, IntBox(vm.Data.DataLines, 1, onChange, vm), col: 1, row: 1);
|
||||
AddCell(grid, Label("B"), col: 0, row: 2); AddCell(grid, IntBox(vm.Data.DataLines, 2, onChange, vm), col: 1, row: 2);
|
||||
AddCell(grid, Label("Max ΔH"), col: 0, row: 3); AddCell(grid, IntBox(vm.Data.DataLines, 3, onChange, vm), col: 1, row: 3);
|
||||
AddCell(grid, Label("Max ΔSV"), col: 0, row: 4); AddCell(grid, IntBox(vm.Data.DataLines, 4, onChange, vm), col: 1, row: 4);
|
||||
if (hasArmorOrSlot)
|
||||
{
|
||||
AddCell(grid, Label(trailingLabel), col: 0, row: 5);
|
||||
AddCell(grid, IntBox(vm.Data.DataLines, 5, onChange, vm), col: 1, row: 5);
|
||||
}
|
||||
return grid;
|
||||
}
|
||||
|
||||
// ── DisabledRule ─────────────────────────────────────────────────────────
|
||||
|
||||
public static Control DisabledRuleEditor(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
EnsureLine(vm, 0, "false");
|
||||
var cb = new CheckBox
|
||||
{
|
||||
Content = "Rule disabled",
|
||||
IsChecked = string.Equals(vm.Data.DataLines[0].Trim(), "true", StringComparison.OrdinalIgnoreCase),
|
||||
};
|
||||
cb.IsCheckedChanged += (_, _) =>
|
||||
{
|
||||
string newValue = cb.IsChecked == true ? "true" : "false";
|
||||
if (vm.Data.DataLines[0] != newValue)
|
||||
{
|
||||
vm.Data.DataLines[0] = newValue;
|
||||
vm.NotifyDataChanged();
|
||||
onChange();
|
||||
}
|
||||
};
|
||||
return cb;
|
||||
}
|
||||
|
||||
// ── Building blocks ──────────────────────────────────────────────────────
|
||||
|
||||
private static Control Row(string label, Control editor)
|
||||
{
|
||||
var grid = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*"),
|
||||
RowDefinitions = RowDefinitions.Parse("Auto"),
|
||||
};
|
||||
AddCell(grid, Label(label), col: 0);
|
||||
AddCell(grid, editor, col: 1);
|
||||
return grid;
|
||||
}
|
||||
|
||||
private static TextBlock Label(string text) => new()
|
||||
{
|
||||
Text = text,
|
||||
Foreground = MutedBrush,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
};
|
||||
|
||||
private static void AddCell(Grid grid, Control c, int col, int row = 0)
|
||||
{
|
||||
Grid.SetColumn(c, col);
|
||||
Grid.SetRow(c, row);
|
||||
grid.Children.Add(c);
|
||||
}
|
||||
|
||||
private static TextBox IntBox(IList<string> lines, int idx, Action onChange, VTankConditionVm vm)
|
||||
{
|
||||
EnsureLine(vm, idx, "0");
|
||||
var box = new TextBox { Text = lines[idx] };
|
||||
box.LostFocus += (_, _) => Commit(box, lines, idx, vm, onChange, parseInt: true);
|
||||
return box;
|
||||
}
|
||||
|
||||
private static TextBox DoubleBox(IList<string> lines, int idx, Action onChange, VTankConditionVm vm)
|
||||
{
|
||||
EnsureLine(vm, idx, "0");
|
||||
var box = new TextBox { Text = lines[idx] };
|
||||
box.LostFocus += (_, _) => Commit(box, lines, idx, vm, onChange, parseInt: false);
|
||||
return box;
|
||||
}
|
||||
|
||||
private static TextBox StringBox(IList<string> lines, int idx, Action onChange, VTankConditionVm vm, string? watermark = null)
|
||||
{
|
||||
EnsureLine(vm, idx, string.Empty);
|
||||
var box = new TextBox { Text = lines[idx], Watermark = watermark };
|
||||
box.LostFocus += (_, _) =>
|
||||
{
|
||||
if (lines[idx] != box.Text)
|
||||
{
|
||||
lines[idx] = box.Text ?? string.Empty;
|
||||
vm.NotifyDataChanged();
|
||||
onChange();
|
||||
}
|
||||
};
|
||||
return box;
|
||||
}
|
||||
|
||||
private static ComboBox KeyCombo((int Id, string Name)[] options, IList<string> lines, int idx, Action onChange, VTankConditionVm vm)
|
||||
{
|
||||
EnsureLine(vm, idx, "0");
|
||||
var combo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Stretch };
|
||||
var items = new List<KvOption>();
|
||||
foreach (var (id, name) in options) items.Add(new KvOption(id, $"{id} — {name}"));
|
||||
combo.ItemsSource = items;
|
||||
combo.DisplayMemberBinding = new Avalonia.Data.Binding(nameof(KvOption.Display));
|
||||
int.TryParse(lines[idx].Trim(), out int currentId);
|
||||
foreach (var i in items) if (i.Id == currentId) { combo.SelectedItem = i; break; }
|
||||
combo.SelectionChanged += (_, _) =>
|
||||
{
|
||||
if (combo.SelectedItem is KvOption opt && lines[idx] != opt.Id.ToString(CultureInfo.InvariantCulture))
|
||||
{
|
||||
lines[idx] = opt.Id.ToString(CultureInfo.InvariantCulture);
|
||||
vm.NotifyDataChanged();
|
||||
onChange();
|
||||
}
|
||||
};
|
||||
return combo;
|
||||
}
|
||||
|
||||
private static ComboBox Combo((int Id, string Name)[] options, IList<string> lines, int idx, Action onChange, VTankConditionVm vm)
|
||||
=> KeyCombo(options, lines, idx, onChange, vm);
|
||||
|
||||
private static void Commit(TextBox box, IList<string> lines, int idx, VTankConditionVm vm, Action onChange, bool parseInt)
|
||||
{
|
||||
string text = box.Text ?? "0";
|
||||
if (parseInt)
|
||||
{
|
||||
if (int.TryParse(text, NumberStyles.Integer, CultureInfo.InvariantCulture, out int v))
|
||||
text = v.ToString(CultureInfo.InvariantCulture);
|
||||
else { box.Text = lines[idx]; return; }
|
||||
}
|
||||
else
|
||||
{
|
||||
if (double.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out double d))
|
||||
text = d.ToString(CultureInfo.InvariantCulture);
|
||||
else { box.Text = lines[idx]; return; }
|
||||
}
|
||||
if (lines[idx] != text)
|
||||
{
|
||||
lines[idx] = text;
|
||||
vm.NotifyDataChanged();
|
||||
onChange();
|
||||
}
|
||||
}
|
||||
|
||||
private static void EnsureLine(VTankConditionVm vm, int idx, string defaultValue)
|
||||
{
|
||||
while (vm.Data.DataLines.Count <= idx) vm.Data.DataLines.Add(defaultValue);
|
||||
}
|
||||
|
||||
private sealed record KvOption(int Id, string Display);
|
||||
|
||||
// ── Reference key tables (subset of AC enums; covers what people usually edit) ──
|
||||
|
||||
public static readonly (int Id, string Name)[] LongKeys =
|
||||
{
|
||||
(5, "EncumbVal"),
|
||||
(19, "Value"),
|
||||
(25, "Level"),
|
||||
(28, "ArmorLevel"),
|
||||
(54, "MaxDamage"),
|
||||
(87, "MaxStructure"),
|
||||
(88, "Structure"),
|
||||
(105, "ItemWorkmanship"),
|
||||
(107, "ItemMaxMana"),
|
||||
(131, "MaterialType"),
|
||||
(158, "WieldRequirements"),
|
||||
(159, "WieldSkilltype"),
|
||||
(160, "WieldDifficulty"),
|
||||
(218, "EquippedSlots"),
|
||||
(353, "ImbuedEffect"),
|
||||
(370, "DamageRating"),
|
||||
(371, "DamageResistRating"),
|
||||
(372, "CritRating"),
|
||||
(373, "CritResistRating"),
|
||||
(374, "CritDamageRating"),
|
||||
(375, "CritDamageResistRating"),
|
||||
(376, "HealBoostRating"),
|
||||
(379, "VitalityRating"),
|
||||
};
|
||||
|
||||
public static readonly (int Id, string Name)[] DoubleKeys =
|
||||
{
|
||||
(5, "ApproachDistance"),
|
||||
(22, "DamageVariance"),
|
||||
(29, "WeaponLength"),
|
||||
(62, "WeaponDefense"),
|
||||
(63, "WeaponOffense"),
|
||||
(152, "ElementalDamageVsMonsters"),
|
||||
(167, "ManaRate"),
|
||||
};
|
||||
|
||||
public static readonly (int Id, string Name)[] StringKeys =
|
||||
{
|
||||
(1, "Name"),
|
||||
(5, "Inscription"),
|
||||
(7, "Title"),
|
||||
};
|
||||
|
||||
public static readonly (int Id, string Name)[] Skills =
|
||||
{
|
||||
(1, "Axe"), (2, "Bow"), (3, "Crossbow"), (4, "Dagger"),
|
||||
(5, "Mace"), (6, "MeleeDefense"),(7, "MissileDef."), (8, "Sling"),
|
||||
(9, "Spear"), (10, "Staff"), (11, "Sword"), (12, "ThrownWpn"),
|
||||
(13, "Unarmed"), (14, "ArcaneLore"), (15, "MagicDefense"),(16, "ManaConv."),
|
||||
(18, "Item Tinkering"), (19, "Healing"), (20, "Deception"), (21, "Leadership"),
|
||||
(22, "Lockpick"), (23, "Fletching"), (24, "Alchemy"), (25, "Cooking"),
|
||||
(26, "Salvaging"), (31, "Creature Ench."), (32, "Item Ench."), (33, "Life Magic"),
|
||||
(34, "War Magic"), (35, "Loyalty"), (36, "Jump"), (37, "Run"),
|
||||
(38, "Assess"), (39, "Weapon Tinkering"), (40, "Armor Tinkering"),
|
||||
(41, "Magic Item Tinkering"), (43, "Two Handed"), (44, "Gearcraft"),
|
||||
(45, "Void Magic"), (46, "Heavy Weapons"), (47, "Light Weapons"),
|
||||
(48, "Finesse Weapons"), (49, "Missile Weapons"), (50, "Shield"),
|
||||
(54, "Dual Wield"), (55, "Recklessness"), (56, "Sneak Attack"),
|
||||
};
|
||||
}
|
||||
201
Tools/RynthCore.LootEditor/VTankConditionEditorView.cs
Normal file
201
Tools/RynthCore.LootEditor/VTankConditionEditorView.cs
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
using RynthCore.Loot.VTank;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
/// <summary>
|
||||
/// Editor surface for one VTank loot condition. Composed at runtime per
|
||||
/// condition: a node-type picker on top, then either a typed editor (if we
|
||||
/// have one for the selected NodeType) or a generic raw-lines editor that
|
||||
/// guarantees round-trip safety for any node type.
|
||||
/// </summary>
|
||||
public sealed class VTankConditionEditorView : ContentControl
|
||||
{
|
||||
private readonly VTankConditionVm _vm;
|
||||
private readonly Action _onChange;
|
||||
private readonly Brush _muted = new SolidColorBrush(Color.Parse("#7A8896"));
|
||||
|
||||
public VTankConditionEditorView(VTankConditionVm vm, Action onChange)
|
||||
{
|
||||
_vm = vm;
|
||||
_onChange = onChange;
|
||||
Build();
|
||||
}
|
||||
|
||||
private void Build()
|
||||
{
|
||||
var stack = new StackPanel { Spacing = 6 };
|
||||
|
||||
// ── Node-type picker row ─────────────────────────────────────────────
|
||||
var typeRow = new Grid
|
||||
{
|
||||
ColumnDefinitions = ColumnDefinitions.Parse("Auto,*"),
|
||||
};
|
||||
var typeLabel = new TextBlock
|
||||
{
|
||||
Text = "Node Type",
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Foreground = _muted,
|
||||
};
|
||||
Grid.SetColumn(typeLabel, 0);
|
||||
typeRow.Children.Add(typeLabel);
|
||||
|
||||
var typeCombo = new ComboBox { HorizontalAlignment = HorizontalAlignment.Stretch };
|
||||
var options = new List<NodeTypeOption>();
|
||||
foreach (int t in VTankNodeTypes.All)
|
||||
options.Add(new NodeTypeOption(t, $"{VTankNodeTypes.DisplayName(t)} (id {t})"));
|
||||
typeCombo.ItemsSource = options;
|
||||
typeCombo.DisplayMemberBinding = new Avalonia.Data.Binding(nameof(NodeTypeOption.Display));
|
||||
typeCombo.SelectedItem = FindOption(options, _vm.NodeType);
|
||||
typeCombo.SelectionChanged += (_, _) =>
|
||||
{
|
||||
if (typeCombo.SelectedItem is NodeTypeOption opt && opt.Id != _vm.NodeType)
|
||||
{
|
||||
_vm.NodeType = opt.Id;
|
||||
EnsureDataLineCount(opt.Id);
|
||||
_vm.NotifyDataChanged();
|
||||
_onChange();
|
||||
// Re-build to swap the typed editor underneath.
|
||||
Build();
|
||||
}
|
||||
};
|
||||
Grid.SetColumn(typeCombo, 1);
|
||||
typeRow.Children.Add(typeCombo);
|
||||
stack.Children.Add(typeRow);
|
||||
|
||||
// ── Data lines editor ────────────────────────────────────────────────
|
||||
EnsureDataLineCount(_vm.NodeType);
|
||||
var typed = TryBuildTypedEditor(_vm, _onChange);
|
||||
if (typed != null)
|
||||
{
|
||||
stack.Children.Add(typed);
|
||||
stack.Children.Add(BuildRawHint());
|
||||
}
|
||||
else
|
||||
{
|
||||
stack.Children.Add(BuildRawEditor());
|
||||
}
|
||||
|
||||
Content = stack;
|
||||
}
|
||||
|
||||
private static NodeTypeOption? FindOption(List<NodeTypeOption> options, int id)
|
||||
{
|
||||
foreach (var o in options) if (o.Id == id) return o;
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Pads or trims the condition's data lines to match the documented arity
|
||||
/// for its node type. New lines default to "0".
|
||||
/// </summary>
|
||||
private void EnsureDataLineCount(int nodeType)
|
||||
{
|
||||
int n = VTankNodeTypes.GetDataLineCount(nodeType);
|
||||
if (n < 0) return; // unknown — leave as-is so unparsed bytes survive
|
||||
var d = _vm.Data.DataLines;
|
||||
while (d.Count < n) d.Add("0");
|
||||
while (d.Count > n) d.RemoveAt(d.Count - 1);
|
||||
}
|
||||
|
||||
private Control BuildRawEditor()
|
||||
{
|
||||
var panel = new StackPanel { Spacing = 4 };
|
||||
panel.Children.Add(new TextBlock
|
||||
{
|
||||
Text = "Data lines (one per row, in VTank's order)",
|
||||
Foreground = _muted,
|
||||
FontSize = 11,
|
||||
});
|
||||
|
||||
for (int i = 0; i < _vm.Data.DataLines.Count; i++)
|
||||
{
|
||||
int idx = i;
|
||||
var box = new TextBox { Text = _vm.Data.DataLines[idx], AcceptsReturn = false };
|
||||
box.LostFocus += (_, _) =>
|
||||
{
|
||||
if (_vm.Data.DataLines[idx] != box.Text)
|
||||
{
|
||||
_vm.Data.DataLines[idx] = box.Text ?? string.Empty;
|
||||
_vm.NotifyDataChanged();
|
||||
_onChange();
|
||||
}
|
||||
};
|
||||
panel.Children.Add(box);
|
||||
}
|
||||
|
||||
// Buttons to grow/shrink the data list — only meaningful for unknown
|
||||
// node types where we can't infer the arity.
|
||||
if (VTankNodeTypes.GetDataLineCount(_vm.NodeType) < 0)
|
||||
{
|
||||
var btnRow = new StackPanel { Orientation = Orientation.Horizontal, Spacing = 4 };
|
||||
var add = new Button { Content = "+ line" };
|
||||
add.Click += (_, _) => { _vm.Data.DataLines.Add(""); _onChange(); Build(); };
|
||||
var del = new Button { Content = "− line" };
|
||||
del.Click += (_, _) =>
|
||||
{
|
||||
if (_vm.Data.DataLines.Count > 0)
|
||||
{ _vm.Data.DataLines.RemoveAt(_vm.Data.DataLines.Count - 1); _onChange(); Build(); }
|
||||
};
|
||||
btnRow.Children.Add(add); btnRow.Children.Add(del);
|
||||
panel.Children.Add(btnRow);
|
||||
}
|
||||
|
||||
return panel;
|
||||
}
|
||||
|
||||
private Control BuildRawHint()
|
||||
{
|
||||
return new TextBlock
|
||||
{
|
||||
Text = "Raw values are stored verbatim; round-trip is preserved.",
|
||||
Foreground = _muted,
|
||||
FontSize = 11,
|
||||
Margin = new Thickness(0, 6, 0, 0),
|
||||
};
|
||||
}
|
||||
|
||||
// ── Typed editors for known node types ───────────────────────────────────
|
||||
|
||||
private static Control? TryBuildTypedEditor(VTankConditionVm vm, Action onChange) => vm.NodeType switch
|
||||
{
|
||||
VTankNodeTypes.ObjectClass => TypedEditors.ObjectClassEditor(vm, onChange),
|
||||
VTankNodeTypes.LongValKeyGE => TypedEditors.LongKeyEditor(vm, onChange, "≥"),
|
||||
VTankNodeTypes.LongValKeyLE => TypedEditors.LongKeyEditor(vm, onChange, "≤"),
|
||||
VTankNodeTypes.LongValKeyE => TypedEditors.LongKeyEditor(vm, onChange, "="),
|
||||
VTankNodeTypes.LongValKeyNE => TypedEditors.LongKeyEditor(vm, onChange, "≠"),
|
||||
VTankNodeTypes.LongValKeyFlagExists => TypedEditors.LongFlagEditor(vm, onChange),
|
||||
VTankNodeTypes.DoubleValKeyGE => TypedEditors.DoubleKeyEditor(vm, onChange, "≥"),
|
||||
VTankNodeTypes.DoubleValKeyLE => TypedEditors.DoubleKeyEditor(vm, onChange, "≤"),
|
||||
VTankNodeTypes.BuffedLongValKeyGE => TypedEditors.DoubleKeyAsLongEditor(vm, onChange, "≥ (buffed long)"),
|
||||
VTankNodeTypes.BuffedDoubleValKeyGE => TypedEditors.DoubleKeyEditor(vm, onChange, "≥ (buffed double)"),
|
||||
VTankNodeTypes.StringValueMatch => TypedEditors.StringValueEditor(vm, onChange),
|
||||
VTankNodeTypes.SpellNameMatch => TypedEditors.SingleStringEditor(vm, onChange, "Pattern"),
|
||||
VTankNodeTypes.SpellCountGE => TypedEditors.SingleIntEditor(vm, onChange, "Min count"),
|
||||
VTankNodeTypes.SpellMatch => TypedEditors.SpellMatchEditor(vm, onChange),
|
||||
VTankNodeTypes.MinDamageGE => TypedEditors.SingleDoubleEditor(vm, onChange, "Min damage ≥"),
|
||||
VTankNodeTypes.DamagePercentGE => TypedEditors.SingleDoubleEditor(vm, onChange, "Damage % ≥"),
|
||||
VTankNodeTypes.TotalRatingsGE => TypedEditors.SingleIntEditor(vm, onChange, "Total ratings ≥"),
|
||||
VTankNodeTypes.BuffedMedianDamageGE => TypedEditors.SingleDoubleEditor(vm, onChange, "Median damage ≥"),
|
||||
VTankNodeTypes.BuffedMissileDamageGE => TypedEditors.SingleDoubleEditor(vm, onChange, "Missile damage ≥"),
|
||||
VTankNodeTypes.CalcdBuffedTinkedDamageGE => TypedEditors.SingleDoubleEditor(vm, onChange, "Tinked damage ≥"),
|
||||
VTankNodeTypes.CharacterLevelGE => TypedEditors.SingleIntEditor(vm, onChange, "Char level ≥"),
|
||||
VTankNodeTypes.CharacterLevelLE => TypedEditors.SingleIntEditor(vm, onChange, "Char level ≤"),
|
||||
VTankNodeTypes.CharacterMainPackEmptySlotsGE=> TypedEditors.SingleIntEditor(vm, onChange, "Pack slots ≥"),
|
||||
VTankNodeTypes.CharacterSkillGE => TypedEditors.SkillGEEditor(vm, onChange),
|
||||
VTankNodeTypes.CharacterBaseSkill => TypedEditors.BaseSkillEditor(vm, onChange),
|
||||
VTankNodeTypes.SlotExactPalette => TypedEditors.TwoIntEditor(vm, onChange, "Slot", "Palette ID"),
|
||||
VTankNodeTypes.AnySimilarColor => TypedEditors.ColorEditor(vm, onChange, hasArmorOrSlot: false),
|
||||
VTankNodeTypes.SimilarColorArmorType => TypedEditors.ColorEditor(vm, onChange, hasArmorOrSlot: true, trailingLabel: "Armor group"),
|
||||
VTankNodeTypes.SlotSimilarColor => TypedEditors.ColorEditor(vm, onChange, hasArmorOrSlot: true, trailingLabel: "Slot"),
|
||||
VTankNodeTypes.CalcedBuffedTinkedTargetMeleeGE
|
||||
=> TypedEditors.ThreeDoubleEditor(vm, onChange, "Target DoT", "Target melee def", "Target attack"),
|
||||
VTankNodeTypes.DisabledRule => TypedEditors.DisabledRuleEditor(vm, onChange),
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
292
Tools/RynthCore.LootEditor/VTankRuleVm.cs
Normal file
292
Tools/RynthCore.LootEditor/VTankRuleVm.cs
Normal file
|
|
@ -0,0 +1,292 @@
|
|||
using Avalonia.Media;
|
||||
using RynthCore.Loot.VTank;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
|
||||
namespace RynthCore.LootEditor;
|
||||
|
||||
/// <summary>
|
||||
/// Observable view-model wrapping a VTankLootRule. Edits flow into the
|
||||
/// underlying data so save reproduces them; INPC drives the Avalonia bindings.
|
||||
/// </summary>
|
||||
public sealed class VTankRuleVm : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
private void Notify([CallerMemberName] string? n = null) =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
|
||||
|
||||
public VTankLootRule Data { get; }
|
||||
|
||||
public VTankRuleVm(VTankLootRule data)
|
||||
{
|
||||
Data = data;
|
||||
foreach (var c in data.Conditions)
|
||||
{
|
||||
var vm = new VTankConditionVm(c) { OwnerRule = this };
|
||||
Conditions.Add(vm);
|
||||
}
|
||||
Conditions.CollectionChanged += OnConditionsChanged;
|
||||
}
|
||||
|
||||
/// <summary>Called by a child condition VM when its data changed.</summary>
|
||||
internal void NotifySummaryChanged() => Notify(nameof(Summary));
|
||||
|
||||
private void OnConditionsChanged(object? sender, NotifyCollectionChangedEventArgs e)
|
||||
{
|
||||
// Keep OwnerRule wired so Summary refreshes when descendants edit data.
|
||||
if (e.NewItems != null)
|
||||
foreach (var obj in e.NewItems)
|
||||
if (obj is VTankConditionVm cvm) cvm.OwnerRule = this;
|
||||
Notify(nameof(ConditionCount));
|
||||
Notify(nameof(ConditionCountLabel));
|
||||
Notify(nameof(Summary));
|
||||
Notify(nameof(Enabled));
|
||||
}
|
||||
|
||||
public string Name
|
||||
{
|
||||
get => Data.Name;
|
||||
set { if (Data.Name == value) return; Data.Name = value; Notify(); }
|
||||
}
|
||||
|
||||
public string CustomExpression
|
||||
{
|
||||
get => Data.CustomExpression ?? string.Empty;
|
||||
set
|
||||
{
|
||||
string v = value ?? string.Empty;
|
||||
if ((Data.CustomExpression ?? string.Empty) == v) return;
|
||||
Data.CustomExpression = v;
|
||||
Notify();
|
||||
}
|
||||
}
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get => Data.Priority;
|
||||
set { if (Data.Priority == value) return; Data.Priority = value; Notify(); }
|
||||
}
|
||||
|
||||
public VTankLootAction Action
|
||||
{
|
||||
get => Data.Action;
|
||||
set
|
||||
{
|
||||
if (Data.Action == value) return;
|
||||
Data.Action = value;
|
||||
// Maintain the keep-count line invariant: present iff KeepUpTo.
|
||||
if (value == VTankLootAction.KeepUpTo)
|
||||
Data.KeepCount ??= 1;
|
||||
else
|
||||
Data.KeepCount = null;
|
||||
Notify();
|
||||
Notify(nameof(KeepCount));
|
||||
Notify(nameof(ShowKeepCount));
|
||||
Notify(nameof(ActionLabel));
|
||||
Notify(nameof(ActionBadgeBrush));
|
||||
Notify(nameof(ActionBadgeForeground));
|
||||
}
|
||||
}
|
||||
|
||||
public string ActionLabel => Data.Action switch
|
||||
{
|
||||
VTankLootAction.Keep => "KEEP",
|
||||
VTankLootAction.KeepUpTo => $"KEEP {Data.KeepCount ?? 0}",
|
||||
VTankLootAction.Salvage => "SALVAGE",
|
||||
VTankLootAction.Sell => "SELL",
|
||||
VTankLootAction.Read => "READ",
|
||||
_ => "?",
|
||||
};
|
||||
|
||||
public IBrush ActionBadgeBrush => Data.Action switch
|
||||
{
|
||||
VTankLootAction.Keep => new SolidColorBrush(Color.Parse("#1f6f3a")), // green
|
||||
VTankLootAction.KeepUpTo => new SolidColorBrush(Color.Parse("#196e6e")), // teal
|
||||
VTankLootAction.Salvage => new SolidColorBrush(Color.Parse("#a35c15")), // orange
|
||||
VTankLootAction.Sell => new SolidColorBrush(Color.Parse("#7a1f1f")), // red
|
||||
VTankLootAction.Read => new SolidColorBrush(Color.Parse("#1f497d")), // blue
|
||||
_ => new SolidColorBrush(Color.Parse("#444" )), // gray
|
||||
};
|
||||
|
||||
public IBrush ActionBadgeForeground => new SolidColorBrush(Color.Parse("#FFFFFF"));
|
||||
|
||||
public int ConditionCount => Conditions.Count;
|
||||
public string ConditionCountLabel => ConditionCount == 0
|
||||
? "always"
|
||||
: (ConditionCount == 1 ? "1 cond" : $"{ConditionCount} conds");
|
||||
|
||||
public int KeepCount
|
||||
{
|
||||
get => Data.KeepCount ?? 0;
|
||||
set
|
||||
{
|
||||
if ((Data.KeepCount ?? 0) == value) return;
|
||||
Data.KeepCount = value;
|
||||
Notify();
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowKeepCount => Data.Action == VTankLootAction.KeepUpTo;
|
||||
|
||||
public bool Enabled
|
||||
{
|
||||
get => Data.Enabled;
|
||||
set
|
||||
{
|
||||
if (Data.Enabled == value) return;
|
||||
Data.Enabled = value;
|
||||
Notify();
|
||||
// Enabled toggle adds/removes a DisabledRule condition node — keep
|
||||
// the VM-side condition list in sync so the UI grid updates.
|
||||
SyncConditionsFromData();
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<VTankConditionVm> Conditions { get; } = new();
|
||||
|
||||
/// <summary>One-line plain-English description of all conditions.</summary>
|
||||
public string Summary
|
||||
{
|
||||
get
|
||||
{
|
||||
if (Conditions.Count == 0) return "Matches every item.";
|
||||
var sb = new StringBuilder();
|
||||
for (int i = 0; i < Conditions.Count; i++)
|
||||
{
|
||||
if (i > 0) sb.Append(" AND ");
|
||||
sb.Append(SummarizeCondition(Conditions[i]));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private static string SummarizeCondition(VTankConditionVm c)
|
||||
{
|
||||
var d = c.Data.DataLines;
|
||||
string lk(int i) => LookupName(TypedEditors.LongKeys, Get(d, i));
|
||||
string dk(int i) => LookupName(TypedEditors.DoubleKeys, Get(d, i));
|
||||
string sk(int i) => LookupName(TypedEditors.StringKeys, Get(d, i));
|
||||
string skl(int i) => LookupName(TypedEditors.Skills, Get(d, i));
|
||||
string oc(int i)
|
||||
{
|
||||
if (int.TryParse(Get(d, i), out int n))
|
||||
foreach (var oct in TypedEditors.ObjectClassesAccess())
|
||||
if (oct.Id == n) return oct.Name;
|
||||
return Get(d, i);
|
||||
}
|
||||
|
||||
return c.Data.NodeType switch
|
||||
{
|
||||
VTankNodeTypes.ObjectClass => $"Class is {oc(0)}",
|
||||
VTankNodeTypes.LongValKeyGE => $"{lk(1)} ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.LongValKeyLE => $"{lk(1)} ≤ {Get(d, 0)}",
|
||||
VTankNodeTypes.LongValKeyE => $"{lk(1)} = {Get(d, 0)}",
|
||||
VTankNodeTypes.LongValKeyNE => $"{lk(1)} ≠ {Get(d, 0)}",
|
||||
VTankNodeTypes.LongValKeyFlagExists => $"{lk(1)} has flag {Get(d, 0)}",
|
||||
VTankNodeTypes.DoubleValKeyGE => $"{dk(1)} ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.DoubleValKeyLE => $"{dk(1)} ≤ {Get(d, 0)}",
|
||||
VTankNodeTypes.BuffedLongValKeyGE => $"buffed {lk(1)} ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.BuffedDoubleValKeyGE => $"buffed {dk(1)} ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.StringValueMatch => $"{sk(1)} matches \"{Trunc(Get(d, 0), 30)}\"",
|
||||
VTankNodeTypes.SpellNameMatch => $"spell matches \"{Trunc(Get(d, 0), 30)}\"",
|
||||
VTankNodeTypes.SpellCountGE => $"spell count ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.SpellMatch => $"≥{Get(d, 2)} spells matching \"{Trunc(Get(d, 0), 20)}\"",
|
||||
VTankNodeTypes.MinDamageGE => $"min dmg ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.DamagePercentGE => $"dmg% ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.TotalRatingsGE => $"total ratings ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.BuffedMedianDamageGE => $"median dmg ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.BuffedMissileDamageGE => $"missile dmg ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.CalcdBuffedTinkedDamageGE => $"tinked dmg ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.CharacterLevelGE => $"char level ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.CharacterLevelLE => $"char level ≤ {Get(d, 0)}",
|
||||
VTankNodeTypes.CharacterMainPackEmptySlotsGE=> $"pack slots ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.CharacterSkillGE => $"{skl(1)} skill ≥ {Get(d, 0)}",
|
||||
VTankNodeTypes.CharacterBaseSkill => $"{skl(0)} base in [{Get(d, 1)}, {Get(d, 2)}]",
|
||||
VTankNodeTypes.SlotExactPalette => $"palette slot {Get(d, 0)} = {Get(d, 1)}",
|
||||
VTankNodeTypes.AnySimilarColor => "color (any similar)",
|
||||
VTankNodeTypes.SimilarColorArmorType => "color (armor type)",
|
||||
VTankNodeTypes.SlotSimilarColor => "color (slot)",
|
||||
VTankNodeTypes.CalcedBuffedTinkedTargetMeleeGE => "buffed tinked target melee",
|
||||
VTankNodeTypes.DisabledRule => "(rule disabled)",
|
||||
_ => $"node {c.Data.NodeType}",
|
||||
};
|
||||
|
||||
static string Get(System.Collections.Generic.IList<string> lines, int idx)
|
||||
=> idx < lines.Count ? lines[idx] : "?";
|
||||
static string Trunc(string s, int n) => s.Length > n ? s.Substring(0, n) + "…" : s;
|
||||
|
||||
static string LookupName((int Id, string Name)[] table, string raw)
|
||||
{
|
||||
if (int.TryParse(raw, out int n))
|
||||
foreach (var t in table)
|
||||
if (t.Id == n) return t.Name;
|
||||
return $"key {raw}";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Re-syncs the VM condition list with the underlying data list.</summary>
|
||||
public void SyncConditionsFromData()
|
||||
{
|
||||
Conditions.Clear();
|
||||
foreach (var c in Data.Conditions)
|
||||
Conditions.Add(new VTankConditionVm(c));
|
||||
}
|
||||
|
||||
/// <summary>Push current VM condition order/state back into Data before save.</summary>
|
||||
public void FlushConditionsToData()
|
||||
{
|
||||
Data.Conditions.Clear();
|
||||
foreach (var vm in Conditions)
|
||||
Data.Conditions.Add(vm.Data);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Observable view-model for a single VTankLootCondition.</summary>
|
||||
public sealed class VTankConditionVm : INotifyPropertyChanged
|
||||
{
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
private void Notify([CallerMemberName] string? n = null) =>
|
||||
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(n));
|
||||
|
||||
public VTankLootCondition Data { get; }
|
||||
|
||||
public VTankConditionVm(VTankLootCondition data) { Data = data; }
|
||||
|
||||
public int NodeType
|
||||
{
|
||||
get => Data.NodeType;
|
||||
set
|
||||
{
|
||||
if (Data.NodeType == value) return;
|
||||
Data.NodeType = value;
|
||||
Notify();
|
||||
Notify(nameof(DisplayName));
|
||||
}
|
||||
}
|
||||
|
||||
public string DisplayName => $"{VTankNodeTypes.DisplayName(Data.NodeType)} {Summarize()}";
|
||||
|
||||
/// <summary>One-liner summary of the condition's data for the list view.</summary>
|
||||
private string Summarize()
|
||||
{
|
||||
var d = Data.DataLines;
|
||||
if (d.Count == 0) return string.Empty;
|
||||
if (d.Count == 1) return $"= {d[0]}";
|
||||
// For two-line conditions value/key is the typical shape.
|
||||
if (d.Count == 2) return $"= {d[0]} (key {d[1]})";
|
||||
return $"({d.Count} lines)";
|
||||
}
|
||||
|
||||
/// <summary>Force the list-view summary to re-render after a data-line edit.</summary>
|
||||
public void NotifyDataChanged()
|
||||
{
|
||||
Notify(nameof(DisplayName));
|
||||
OwnerRule?.NotifySummaryChanged();
|
||||
}
|
||||
|
||||
/// <summary>The rule that owns this condition; set by VTankRuleVm at construction.</summary>
|
||||
internal VTankRuleVm? OwnerRule { get; set; }
|
||||
}
|
||||
268
Tools/RynthCore.LootSdkTests/Program.cs
Normal file
268
Tools/RynthCore.LootSdkTests/Program.cs
Normal file
|
|
@ -0,0 +1,268 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using RynthCore.Loot;
|
||||
using RynthCore.Loot.VTank;
|
||||
|
||||
namespace RynthCore.LootSdkTests;
|
||||
|
||||
// Golden-file / unit tests for the pure LootSdk cores. Self-contained: every
|
||||
// test below uses COMMITTED fixtures (embedded strings / programmatic models),
|
||||
// so it runs identically on a clean checkout and in CI — no dependency on
|
||||
// deployed C:\Games files. The old harness SKIPped everything when those files
|
||||
// were absent and still printed "All checks passed" (a vacuous green); this
|
||||
// fails on ZERO assertions so that can't recur. Deployed-file round-trip checks
|
||||
// are kept as an optional bonus pass at the end.
|
||||
//
|
||||
// Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
|
||||
internal static class Program
|
||||
{
|
||||
private static int _asserts;
|
||||
private static int _fails;
|
||||
|
||||
private static void Check(bool cond, string msg)
|
||||
{
|
||||
_asserts++;
|
||||
if (!cond) { _fails++; Console.WriteLine($" [FAIL] {msg}"); }
|
||||
}
|
||||
|
||||
private static void Eq<T>(T actual, T expected, string msg)
|
||||
{
|
||||
_asserts++;
|
||||
if (!EqualityComparer<T>.Default.Equals(actual, expected))
|
||||
{ _fails++; Console.WriteLine($" [FAIL] {msg}: expected <{expected}>, got <{actual}>"); }
|
||||
}
|
||||
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("=== LootSdk golden tests (committed fixtures) ===");
|
||||
TestParseBands();
|
||||
TestGetBandKey();
|
||||
TestNodeArity();
|
||||
TestVTankRoundTripProgrammatic();
|
||||
TestVTankFixtureParse();
|
||||
TestMalformedInputs();
|
||||
|
||||
Console.WriteLine($"\nGolden tests: {_asserts} assertions, {_fails} failed.");
|
||||
|
||||
// ── Vacuous-pass guard ──────────────────────────────────────────────
|
||||
// The whole reason this file was rewritten: a test run that asserts
|
||||
// nothing must NOT report success.
|
||||
if (_asserts == 0)
|
||||
{
|
||||
Console.WriteLine("ABORT: zero assertions ran — the test harness is broken.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// ── Optional: round-trip real deployed profiles if present ───────────
|
||||
RunDeployedRoundTrip(args);
|
||||
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(_fails == 0 ? "ALL GOLDEN TESTS PASSED." : $"{_fails} GOLDEN FAILURE(S).");
|
||||
return _fails == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
// ── Pure: SalvageCombineSettings.ParseBands ─────────────────────────────
|
||||
private static void TestParseBands()
|
||||
{
|
||||
Console.WriteLine("\n-- ParseBands --");
|
||||
void Bands(string? raw, (int, int)[] expected, string label)
|
||||
{
|
||||
var got = SalvageCombineSettings.ParseBands(raw);
|
||||
Eq(got.Count, expected.Length, $"ParseBands('{raw}') count [{label}]");
|
||||
int n = Math.Min(got.Count, expected.Length);
|
||||
for (int i = 0; i < n; i++)
|
||||
Eq((got[i].Min, got[i].Max), expected[i], $"ParseBands('{raw}')[{i}] [{label}]");
|
||||
}
|
||||
|
||||
Bands("1-6, 7-8, 9, 10", new[] { (1, 6), (7, 8), (9, 9), (10, 10) }, "canonical");
|
||||
Bands(null, Array.Empty<(int, int)>(), "null");
|
||||
Bands("", Array.Empty<(int, int)>(), "empty");
|
||||
Bands(" ", Array.Empty<(int, int)>(), "whitespace");
|
||||
Bands("5", new[] { (5, 5) }, "single value");
|
||||
Bands("3-3", new[] { (3, 3) }, "explicit single-range");
|
||||
Bands("1-6,,9", new[] { (1, 6), (9, 9) }, "empty segment skipped");
|
||||
Bands("abc", Array.Empty<(int, int)>(), "non-numeric skipped");
|
||||
Bands("1 - 6", new[] { (1, 6) }, "internal whitespace tolerated");
|
||||
Bands("1-6, junk, 10", new[] { (1, 6), (10, 10) }, "mixed valid/invalid");
|
||||
}
|
||||
|
||||
// ── Pure: SalvageCombineSettings.GetBandKey ─────────────────────────────
|
||||
private static void TestGetBandKey()
|
||||
{
|
||||
Console.WriteLine("\n-- GetBandKey --");
|
||||
var s = new SalvageCombineSettings { DefaultBands = "1-6, 7-8, 9, 10" };
|
||||
Eq(s.GetBandKey(0, 3), "1-6", "default band, wk3");
|
||||
Eq(s.GetBandKey(0, 6), "1-6", "default band, wk6 (upper edge)");
|
||||
Eq(s.GetBandKey(0, 7), "7-8", "default band, wk7");
|
||||
Eq(s.GetBandKey(0, 9), "9-9", "default band, wk9 (single)");
|
||||
Eq(s.GetBandKey(0, 10), "10-10", "default band, wk10");
|
||||
Eq(s.GetBandKey(0, 11), null, "above all bands -> null (do not combine)");
|
||||
Eq(s.GetBandKey(0, 0), null, "below all bands -> null");
|
||||
|
||||
// Per-material override beats the default.
|
||||
s.PerMaterial[5] = "1-10";
|
||||
Eq(s.GetBandKey(5, 10), "1-10", "per-material override applies");
|
||||
Eq(s.GetBandKey(5, 11), null, "per-material override, above range -> null");
|
||||
Eq(s.GetBandKey(99, 10), "10-10", "non-overridden material still uses default");
|
||||
}
|
||||
|
||||
private static void TestNodeArity()
|
||||
{
|
||||
Console.WriteLine("\n-- VTankNodeTypes arity --");
|
||||
Eq(VTankNodeTypes.GetDataLineCount(VTankNodeTypes.ObjectClass), 1, "ObjectClass arity");
|
||||
Eq(VTankNodeTypes.GetDataLineCount(VTankNodeTypes.LongValKeyGE), 2, "LongValKeyGE arity");
|
||||
Eq(VTankNodeTypes.GetDataLineCount(VTankNodeTypes.SpellMatch), 3, "SpellMatch arity");
|
||||
Eq(VTankNodeTypes.GetDataLineCount(VTankNodeTypes.DisabledRule), 1, "DisabledRule arity");
|
||||
Eq(VTankNodeTypes.GetDataLineCount(123456), -1, "unknown node type -> -1");
|
||||
}
|
||||
|
||||
// ── VTank round-trip is byte-idempotent on a programmatically-built model ─
|
||||
private static void TestVTankRoundTripProgrammatic()
|
||||
{
|
||||
Console.WriteLine("\n-- VTank round-trip (programmatic) --");
|
||||
var profile = new VTankLootProfile { FileVersion = 1 };
|
||||
|
||||
var keep = new VTankLootRule { Name = "Keep Coins", Priority = 1, Action = VTankLootAction.Keep };
|
||||
keep.Conditions.Add(new VTankLootCondition(VTankNodeTypes.ObjectClass, "5", new[] { "7" }));
|
||||
profile.Rules.Add(keep);
|
||||
|
||||
var keepUpTo = new VTankLootRule { Name = "Keep Salvage Wk6+", Priority = 2, Action = VTankLootAction.KeepUpTo, KeepCount = 100 };
|
||||
keepUpTo.Conditions.Add(new VTankLootCondition(VTankNodeTypes.LongValKeyGE, "9", new[] { "6", "367" }));
|
||||
profile.Rules.Add(keepUpTo);
|
||||
|
||||
profile.SalvageCombine = new SalvageCombineSettings { Enabled = true, DefaultBands = "1-6, 7-8, 9, 10", RawVersion = "0" };
|
||||
profile.SalvageCombine.PerMaterial[60] = "1-9, 10";
|
||||
|
||||
string s1 = VTankLootWriter.Serialize(profile);
|
||||
var p2 = VTankLootParser.LoadFromText(s1);
|
||||
string s2 = VTankLootWriter.Serialize(p2);
|
||||
Eq(Norm(s2), Norm(s1), "serialize->parse->serialize is byte-idempotent");
|
||||
|
||||
// Structural fidelity of the reparse.
|
||||
Eq(p2.Rules.Count, 2, "round-trip rule count");
|
||||
Eq(p2.Rules[0].Name, "Keep Coins", "rule0 name");
|
||||
Eq(p2.Rules[0].Action, VTankLootAction.Keep, "rule0 action");
|
||||
Eq(p2.Rules[1].Action, VTankLootAction.KeepUpTo, "rule1 action");
|
||||
Eq(p2.Rules[1].KeepCount, 100, "rule1 keepcount");
|
||||
Eq(p2.Rules[1].Conditions.Count, 1, "rule1 condition count");
|
||||
Eq(p2.Rules[1].Conditions[0].NodeType, VTankNodeTypes.LongValKeyGE, "rule1 cond node type");
|
||||
Eq(p2.Rules[1].Conditions[0].DataLines.Count, 2, "rule1 cond data line count");
|
||||
Check(p2.SalvageCombine != null, "salvage block survived");
|
||||
if (p2.SalvageCombine != null)
|
||||
{
|
||||
Eq(p2.SalvageCombine.GetBandKey(60, 10), "10-10", "per-material band reparse (wk10)");
|
||||
Eq(p2.SalvageCombine.GetBandKey(60, 5), "1-9", "per-material band reparse (wk5)");
|
||||
}
|
||||
}
|
||||
|
||||
// ── A hand-written v1 .utl fixture parses to the documented structure ────
|
||||
private static void TestVTankFixtureParse()
|
||||
{
|
||||
Console.WriteLine("\n-- VTank fixture parse (wire format) --");
|
||||
// UTL / version / ruleCount, then per rule: name, customExpr, info
|
||||
// (priority;action;nodeType...), [keepCount if action 10], then per
|
||||
// condition: lengthCode, dataLines.
|
||||
string fixture = string.Join("\n", new[]
|
||||
{
|
||||
"UTL", "1", "2",
|
||||
"Disabled Junk Rule", "",
|
||||
"0;1;9999", // Keep, one DisabledRule node
|
||||
"0", "true", // lengthCode, DisabledRule payload = true
|
||||
"Read Scrolls", "",
|
||||
"5;4;7", // priority 5, action Read(4), ObjectClass node
|
||||
"0", "29", // lengthCode, class id
|
||||
}) + "\n";
|
||||
|
||||
var p = VTankLootParser.LoadFromText(fixture);
|
||||
Eq(p.FileVersion, 1, "fixture FileVersion");
|
||||
Eq(p.Rules.Count, 2, "fixture rule count");
|
||||
Eq(p.Rules[0].Action, VTankLootAction.Keep, "fixture rule0 action");
|
||||
Check(!p.Rules[0].Enabled, "fixture rule0 is disabled (9999 true)");
|
||||
Eq(p.Rules[1].Name, "Read Scrolls", "fixture rule1 name");
|
||||
Eq(p.Rules[1].Action, VTankLootAction.Read, "fixture rule1 action = Read");
|
||||
Eq(p.Rules[1].Priority, 5, "fixture rule1 priority");
|
||||
Eq(p.Rules[1].Conditions[0].NodeType, VTankNodeTypes.ObjectClass, "fixture rule1 node type");
|
||||
Eq(p.Rules[1].Conditions[0].DataLines.Count, 1, "fixture rule1 data line count");
|
||||
}
|
||||
|
||||
// ── Malformed / edge inputs must fail gracefully, never corrupt or hang ──
|
||||
private static void TestMalformedInputs()
|
||||
{
|
||||
Console.WriteLine("\n-- Malformed inputs --");
|
||||
SafeParse("", "empty string");
|
||||
SafeParse("UTL\n1\n0\n", "header with zero rules");
|
||||
SafeParse("UTL\n", "truncated header");
|
||||
SafeParse("garbage\nmore garbage\n\n", "non-UTL garbage");
|
||||
SafeParse("0\n", "v0 header, zero rules");
|
||||
|
||||
// An unknown node type id must not be misread as a known arity.
|
||||
Eq(VTankNodeTypes.GetDataLineCount(2999), -1, "unknown node arity stays -1");
|
||||
}
|
||||
|
||||
private static void SafeParse(string text, string label)
|
||||
{
|
||||
// "Fails gracefully" = the parser either parses the input OR rejects it
|
||||
// with a CLEAN, controlled exception (InvalidOperationException — the
|
||||
// parser's documented bad-file signal, which the plugin's loot loader
|
||||
// catches). What must NEVER happen is an uncontrolled failure
|
||||
// (NullReference, IndexOutOfRange, overflow, hang) — those indicate a
|
||||
// real parsing bug that could destabilize the bot.
|
||||
_asserts++;
|
||||
try
|
||||
{
|
||||
var p = VTankLootParser.LoadFromText(text);
|
||||
_ = VTankLootWriter.Serialize(p); // a successful parse must also re-serialize cleanly
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
// Controlled rejection of malformed input — the desired behavior.
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_fails++;
|
||||
Console.WriteLine($" [FAIL] malformed '{label}' threw UNCONTROLLED {ex.GetType().Name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string Norm(string s) => s.Replace("\r\n", "\n").Replace("\r", "\n");
|
||||
|
||||
// ── Optional bonus: round-trip real deployed .utl files when present ─────
|
||||
private static void RunDeployedRoundTrip(string[] args)
|
||||
{
|
||||
var paths = args.Length > 0 ? args : new[]
|
||||
{
|
||||
@"C:\Games\RynthSuite\RynthAi\LootProfiles\SalvageTest.utl",
|
||||
@"C:\Games\RynthSuite\RynthAi\LootProfiles\Loot Everything.utl",
|
||||
@"C:\Games\RynthSuite\RynthAi\LootProfiles\LootSnobV4.utl",
|
||||
};
|
||||
bool any = false;
|
||||
foreach (string path in paths)
|
||||
{
|
||||
if (!File.Exists(path)) continue;
|
||||
any = true;
|
||||
try
|
||||
{
|
||||
string original = File.ReadAllText(path);
|
||||
var profile = VTankLootParser.LoadFromText(original);
|
||||
string emitted = VTankLootWriter.Serialize(profile);
|
||||
_asserts++;
|
||||
if (Norm(original) != Norm(emitted))
|
||||
{
|
||||
_fails++;
|
||||
Console.WriteLine($" [FAIL] deployed round-trip DIFF: {Path.GetFileName(path)} ({profile.Rules.Count} rules)");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" ok deployed round-trip {Path.GetFileName(path)} ({profile.Rules.Count} rules)");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_asserts++; _fails++;
|
||||
Console.WriteLine($" [FAIL] deployed round-trip {Path.GetFileName(path)} threw {ex.GetType().Name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
if (any) Console.WriteLine("\n-- deployed-profile round-trip (bonus) ran --");
|
||||
}
|
||||
}
|
||||
14
Tools/RynthCore.LootSdkTests/RynthCore.LootSdkTests.csproj
Normal file
14
Tools/RynthCore.LootSdkTests/RynthCore.LootSdkTests.csproj
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<RootNamespace>RynthCore.LootSdkTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Shared\RynthCore.LootSdk\RynthCore.LootSdk.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
10
Tools/RynthCore.MonsterEditor/App.axaml
Normal file
10
Tools/RynthCore.MonsterEditor/App.axaml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="RynthCore.MonsterEditor.App"
|
||||
RequestedThemeVariant="Dark">
|
||||
<Application.Styles>
|
||||
<FluentTheme />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
<StyleInclude Source="avares://RynthCore.MonsterEditor/Styles.axaml"/>
|
||||
</Application.Styles>
|
||||
</Application>
|
||||
25
Tools/RynthCore.MonsterEditor/App.axaml.cs
Normal file
25
Tools/RynthCore.MonsterEditor/App.axaml.cs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
using Avalonia;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Threading;
|
||||
|
||||
namespace RynthCore.MonsterEditor;
|
||||
|
||||
public partial class App : Application
|
||||
{
|
||||
public override void Initialize() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
public override void OnFrameworkInitializationCompleted()
|
||||
{
|
||||
Dispatcher.UIThread.UnhandledException += (_, e) =>
|
||||
{
|
||||
Program.Log($"DISPATCHER: {e.Exception}");
|
||||
e.Handled = false;
|
||||
};
|
||||
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
desktop.MainWindow = new MainWindow();
|
||||
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
}
|
||||
}
|
||||
9
Tools/RynthCore.MonsterEditor/JsonContext.cs
Normal file
9
Tools/RynthCore.MonsterEditor/JsonContext.cs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RynthCore.MonsterEditor;
|
||||
|
||||
[JsonSerializable(typeof(List<MonsterRule>))]
|
||||
[JsonSerializable(typeof(EditorSettings))]
|
||||
[JsonSourceGenerationOptions(WriteIndented = true, IncludeFields = true)]
|
||||
internal partial class EditorJsonContext : JsonSerializerContext { }
|
||||
227
Tools/RynthCore.MonsterEditor/MainWindow.axaml
Normal file
227
Tools/RynthCore.MonsterEditor/MainWindow.axaml
Normal file
|
|
@ -0,0 +1,227 @@
|
|||
<Window xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:RynthCore.MonsterEditor"
|
||||
x:Class="RynthCore.MonsterEditor.MainWindow"
|
||||
Title="RynthAi — Monster Rules Editor"
|
||||
Width="1060" Height="520" MinWidth="800" MinHeight="300">
|
||||
|
||||
<DockPanel LastChildFill="True">
|
||||
|
||||
<!-- Status bar -->
|
||||
<Border DockPanel.Dock="Bottom" Background="#181825" BorderBrush="#45475A"
|
||||
BorderThickness="0,1,0,0" Padding="4,2">
|
||||
<TextBlock Name="StatusText" Foreground="#A6E3A1"/>
|
||||
</Border>
|
||||
|
||||
<!-- Add row -->
|
||||
<Border DockPanel.Dock="Bottom" Background="#252536" BorderBrush="#45475A"
|
||||
BorderThickness="0,1,0,0" Padding="8,5">
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="Add Monster:" VerticalAlignment="Center" Margin="0,0,8,0"/>
|
||||
<TextBox Name="NewMonsterBox" Width="200" VerticalAlignment="Center"
|
||||
KeyDown="NewMonsterBox_KeyDown"/>
|
||||
<Button Content="Add" Margin="4,0,0,0" Click="AddMonster_Click" Width="55"/>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
|
||||
<!-- Main grid -->
|
||||
<DataGrid Name="MonsterGrid"
|
||||
ItemsSource="{Binding Rules}"
|
||||
AutoGenerateColumns="False"
|
||||
CanUserReorderColumns="False"
|
||||
CanUserSortColumns="False"
|
||||
SelectionMode="Single"
|
||||
HeadersVisibility="Column"
|
||||
CellEditEnding="MonsterGrid_CellEditEnding">
|
||||
<DataGrid.Columns>
|
||||
|
||||
<!-- Toggle lights — letter shown inside each button; tooltip on hover -->
|
||||
<DataGridTemplateColumn Header="F" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="F"
|
||||
IsChecked="{Binding Fester, Mode=TwoWay}"
|
||||
ToolTip.Tip="Fester — Decrepitude's Grasp"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="B" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="B"
|
||||
IsChecked="{Binding Broadside, Mode=TwoWay}"
|
||||
ToolTip.Tip="Broadside — Broadside of a Barn"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="G" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="G"
|
||||
IsChecked="{Binding GravityWell, Mode=TwoWay}"
|
||||
ToolTip.Tip="Gravity Well — Vulnerability Other"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="I" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="I"
|
||||
IsChecked="{Binding Imperil, Mode=TwoWay}"
|
||||
ToolTip.Tip="Imperil — Gossamer Flesh"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="Y" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="Y"
|
||||
IsChecked="{Binding Yield, Mode=TwoWay}"
|
||||
ToolTip.Tip="Yield — Magic Yield Other"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="V" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="V"
|
||||
IsChecked="{Binding Vuln, Mode=TwoWay}"
|
||||
ToolTip.Tip="Vuln — Vulnerability (element-matched)"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="A" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="A"
|
||||
IsChecked="{Binding UseArc, Mode=TwoWay}"
|
||||
ToolTip.Tip="Arc — War/Void arc spells"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="Bl" Width="26" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="Bl"
|
||||
IsChecked="{Binding UseBolt, Mode=TwoWay}"
|
||||
ToolTip.Tip="Bolt — War/Void bolt spells (none set = buff bot mode)"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="R" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="R"
|
||||
IsChecked="{Binding UseRing, Mode=TwoWay}"
|
||||
ToolTip.Tip="Ring — Ring spells (uses Ring Range setting)"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<DataGridTemplateColumn Header="S" Width="24" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<ToggleButton Classes="light" Content="S"
|
||||
IsChecked="{Binding UseStreak, Mode=TwoWay}"
|
||||
ToolTip.Tip="Streak — War/Void streak spells"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Name -->
|
||||
<DataGridTemplateColumn Header="Name" Width="*" MinWidth="100">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<TextBlock Text="{Binding Name}"
|
||||
Padding="3,1"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{Binding IsDefault, Converter={x:Static local:DefaultFgConverter.Instance}}"
|
||||
FontWeight="{Binding IsDefault, Converter={x:Static local:DefaultWeightConverter.Instance}}"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate><DataTemplate>
|
||||
<TextBox Text="{Binding Name, Mode=TwoWay}" Padding="3,1"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Priority -->
|
||||
<DataGridTemplateColumn Header="P" Width="32" MinWidth="30">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<TextBlock Text="{Binding Priority}"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate><DataTemplate>
|
||||
<TextBox Text="{Binding Priority, Mode=TwoWay}" Padding="3,1"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Damage Type -->
|
||||
<DataGridTemplateColumn Header="Dmg Type" Width="84" MinWidth="70">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<TextBlock Text="{Binding DamageType}" Padding="3,1" VerticalAlignment="Center"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate><DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding $parent[Window].((local:MainWindow)DataContext).DmgOptions}"
|
||||
SelectedItem="{Binding DamageType, Mode=TwoWay}"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Ex Vuln -->
|
||||
<DataGridTemplateColumn Header="Ex Vuln" Width="84" MinWidth="70">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<TextBlock Text="{Binding ExVuln}" Padding="3,1" VerticalAlignment="Center"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate><DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding $parent[Window].((local:MainWindow)DataContext).VulnOptions}"
|
||||
SelectedItem="{Binding ExVuln, Mode=TwoWay}"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Weapon -->
|
||||
<DataGridTemplateColumn Header="Weapon" Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<TextBlock Text="{Binding WeaponId, Converter={x:Static local:IdToNameConverter.Instance}}"
|
||||
Padding="3,1" VerticalAlignment="Center"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate><DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding $parent[Window].((local:MainWindow)DataContext).WeaponOptions}"
|
||||
SelectedItem="{Binding WeaponId, Converter={x:Static local:OptionFromIdConverter.Instance}, Mode=TwoWay}"
|
||||
ItemTemplate="{x:Null}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="local:WeaponOption">
|
||||
<TextBlock Text="{Binding DisplayName}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate></DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Offhand -->
|
||||
<DataGridTemplateColumn Header="Offhand" Width="140">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<TextBlock Text="{Binding OffhandId, Converter={x:Static local:IdToNameConverter.Instance}}"
|
||||
Padding="3,1" VerticalAlignment="Center"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate><DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding $parent[Window].((local:MainWindow)DataContext).WeaponOptions}"
|
||||
SelectedItem="{Binding OffhandId, Converter={x:Static local:OptionFromIdConverter.Instance}, Mode=TwoWay}">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate DataType="local:WeaponOption">
|
||||
<TextBlock Text="{Binding DisplayName}"/>
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
</DataTemplate></DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Pet Damage -->
|
||||
<DataGridTemplateColumn Header="Pet Dmg" Width="74" MinWidth="60">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<TextBlock Text="{Binding PetDamage}" Padding="3,1" VerticalAlignment="Center"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
<DataGridTemplateColumn.CellEditingTemplate><DataTemplate>
|
||||
<ComboBox ItemsSource="{Binding $parent[Window].((local:MainWindow)DataContext).PetOptions}"
|
||||
SelectedItem="{Binding PetDamage, Mode=TwoWay}"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellEditingTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
<!-- Delete -->
|
||||
<DataGridTemplateColumn Header="Del" Width="34" CanUserResize="False" CanUserSort="False">
|
||||
<DataGridTemplateColumn.CellTemplate><DataTemplate>
|
||||
<Button Content="X" Tag="{Binding}" Click="DeleteRow_Click"
|
||||
Padding="2,0" FontSize="11"
|
||||
IsVisible="{Binding IsDefault, Converter={x:Static local:InvertBoolConverter.Instance}}"/>
|
||||
</DataTemplate></DataGridTemplateColumn.CellTemplate>
|
||||
</DataGridTemplateColumn>
|
||||
|
||||
</DataGrid.Columns>
|
||||
</DataGrid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
326
Tools/RynthCore.MonsterEditor/MainWindow.axaml.cs
Normal file
326
Tools/RynthCore.MonsterEditor/MainWindow.axaml.cs
Normal file
|
|
@ -0,0 +1,326 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Data.Converters;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Media;
|
||||
using Avalonia.Platform.Storage;
|
||||
using Avalonia.Threading;
|
||||
using Avalonia.VisualTree;
|
||||
|
||||
namespace RynthCore.MonsterEditor;
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public ObservableCollection<MonsterRule> Rules { get; } = new();
|
||||
public ObservableCollection<WeaponOption> WeaponOptions { get; } = new();
|
||||
|
||||
public string[] DmgOptions { get; } =
|
||||
{ "Auto", "Slash", "Pierce", "Bludgeon", "Fire", "Cold", "Lightning", "Acid", "Nether" };
|
||||
public string[] VulnOptions { get; } =
|
||||
{ "None", "Slash", "Pierce", "Bludgeon", "Fire", "Cold", "Lightning", "Acid", "Nether" };
|
||||
public string[] PetOptions { get; } =
|
||||
{ "PAuto", "Slash", "Pierce", "Bludgeon", "Fire", "Cold", "Lightning", "Acid", "Nether" };
|
||||
|
||||
private string _charFolder = string.Empty;
|
||||
private string _monstersPath = string.Empty;
|
||||
private bool _initialized;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
DataContext = this;
|
||||
|
||||
Opened += MainWindow_Opened;
|
||||
}
|
||||
|
||||
private void InitializeComponent() => AvaloniaXamlLoader.Load(this);
|
||||
|
||||
private async void MainWindow_Opened(object? sender, EventArgs e)
|
||||
{
|
||||
if (_initialized) return;
|
||||
_initialized = true;
|
||||
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
if (args.Length > 1)
|
||||
OpenCharFolder(args[1].Trim('"'));
|
||||
else
|
||||
await PromptOpenFileAsync();
|
||||
}
|
||||
|
||||
// ── Open / Load ──────────────────────────────────────────────────────────
|
||||
|
||||
private async System.Threading.Tasks.Task PromptOpenFileAsync()
|
||||
{
|
||||
var sp = StorageProvider;
|
||||
if (sp == null) return;
|
||||
|
||||
var pick = await sp.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||
{
|
||||
Title = "Open monsters.json",
|
||||
AllowMultiple = false,
|
||||
FileTypeFilter = new[]
|
||||
{
|
||||
new FilePickerFileType("Monster Rules") { Patterns = new[] { "monsters.json" } },
|
||||
new FilePickerFileType("All Files") { Patterns = new[] { "*" } },
|
||||
}
|
||||
});
|
||||
|
||||
var file = pick.FirstOrDefault();
|
||||
if (file == null)
|
||||
{
|
||||
SetStatus("No file opened.", error: true);
|
||||
return;
|
||||
}
|
||||
|
||||
string? path = file.TryGetLocalPath();
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
OpenCharFolder(Path.GetDirectoryName(path)!);
|
||||
}
|
||||
|
||||
private void OpenCharFolder(string charFolder)
|
||||
{
|
||||
_charFolder = charFolder;
|
||||
_monstersPath = Path.Combine(charFolder, "monsters.json");
|
||||
Title = $"RynthAi — Monster Rules — {Path.GetFileName(charFolder)}";
|
||||
|
||||
LoadWeaponOptions();
|
||||
LoadRules();
|
||||
}
|
||||
|
||||
private void LoadWeaponOptions()
|
||||
{
|
||||
WeaponOptions.Clear();
|
||||
WeaponOptions.Add(new WeaponOption { Id = 0, DisplayName = "<AUTO>" });
|
||||
|
||||
try
|
||||
{
|
||||
string markerPath = Path.Combine(_charFolder, "active_profile.txt");
|
||||
string profile = File.Exists(markerPath) ? File.ReadAllText(markerPath).Trim() : "Default";
|
||||
string profilePath = Path.Combine(_charFolder, profile + ".json");
|
||||
|
||||
if (File.Exists(profilePath))
|
||||
{
|
||||
string json = File.ReadAllText(profilePath);
|
||||
var settings = JsonSerializer.Deserialize(json, EditorJsonContext.Default.EditorSettings);
|
||||
if (settings?.ItemRules != null)
|
||||
{
|
||||
foreach (var item in settings.ItemRules)
|
||||
WeaponOptions.Add(new WeaponOption { Id = item.Id, DisplayName = item.Name });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { /* weapon dropdowns will just show <AUTO> */ }
|
||||
|
||||
IdToNameConverter.Instance.Options = WeaponOptions;
|
||||
OptionFromIdConverter.Instance.Options = WeaponOptions;
|
||||
}
|
||||
|
||||
private void LoadRules()
|
||||
{
|
||||
foreach (var r in Rules) r.PropertyChanged -= Rule_Changed;
|
||||
Rules.Clear();
|
||||
|
||||
if (File.Exists(_monstersPath))
|
||||
{
|
||||
try
|
||||
{
|
||||
string json = File.ReadAllText(_monstersPath);
|
||||
var rules = JsonSerializer.Deserialize(json, EditorJsonContext.Default.ListMonsterRule);
|
||||
if (rules != null)
|
||||
foreach (var r in rules) AddRule(r);
|
||||
}
|
||||
catch (Exception ex) { SetStatus($"Load error: {ex.Message}", error: true); return; }
|
||||
}
|
||||
|
||||
EnsureDefault();
|
||||
|
||||
SetStatus(Rules.Count > 0
|
||||
? $"Loaded {Rules.Count} rule(s) from {_monstersPath}"
|
||||
: $"No monsters.json found — starting empty. Saving will create {_monstersPath}");
|
||||
}
|
||||
|
||||
private void EnsureDefault()
|
||||
{
|
||||
for (int i = Rules.Count - 1; i >= 1; i--)
|
||||
if (Rules[i].IsDefault) { Rules[i].PropertyChanged -= Rule_Changed; Rules.RemoveAt(i); }
|
||||
|
||||
if (Rules.Count > 0 && Rules[0].IsDefault)
|
||||
return;
|
||||
|
||||
int existing = -1;
|
||||
for (int i = 0; i < Rules.Count; i++)
|
||||
if (Rules[i].IsDefault) { existing = i; break; }
|
||||
|
||||
if (existing > 0)
|
||||
Rules.Move(existing, 0);
|
||||
else
|
||||
Rules.Insert(0, new MonsterRule { Name = "Default", Priority = 1 });
|
||||
|
||||
Rules[0].PropertyChanged -= Rule_Changed;
|
||||
Rules[0].PropertyChanged += Rule_Changed;
|
||||
}
|
||||
|
||||
private void AddRule(MonsterRule rule)
|
||||
{
|
||||
rule.PropertyChanged += Rule_Changed;
|
||||
Rules.Add(rule);
|
||||
}
|
||||
|
||||
// ── Save ─────────────────────────────────────────────────────────────────
|
||||
|
||||
private void Rule_Changed(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
|
||||
=> Save();
|
||||
|
||||
private void MonsterGrid_CellEditEnding(object? sender, DataGridCellEditEndingEventArgs e)
|
||||
{
|
||||
Dispatcher.UIThread.Post(Save, DispatcherPriority.Background);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
{
|
||||
if (string.IsNullOrEmpty(_monstersPath)) return;
|
||||
try
|
||||
{
|
||||
Directory.CreateDirectory(_charFolder);
|
||||
string json = JsonSerializer.Serialize(new List<MonsterRule>(Rules), EditorJsonContext.Default.ListMonsterRule);
|
||||
File.WriteAllText(_monstersPath, json);
|
||||
SetStatus($"Saved {Rules.Count} rule(s) — {DateTime.Now:HH:mm:ss}");
|
||||
}
|
||||
catch (Exception ex) { SetStatus($"Save error: {ex.Message}", error: true); }
|
||||
}
|
||||
|
||||
// ── Row actions ──────────────────────────────────────────────────────────
|
||||
|
||||
private void AddMonster_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var nameBox = this.FindControl<TextBox>("NewMonsterBox");
|
||||
if (nameBox == null) return;
|
||||
|
||||
string name = (nameBox.Text ?? string.Empty).Trim();
|
||||
if (string.IsNullOrWhiteSpace(name)) return;
|
||||
|
||||
var rule = new MonsterRule { Name = name };
|
||||
AddRule(rule);
|
||||
|
||||
var grid = this.FindControl<DataGrid>("MonsterGrid");
|
||||
if (grid != null)
|
||||
{
|
||||
grid.ScrollIntoView(rule, null);
|
||||
grid.SelectedItem = rule;
|
||||
}
|
||||
nameBox.Text = string.Empty;
|
||||
Save();
|
||||
}
|
||||
|
||||
private void NewMonsterBox_KeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (e.Key == Key.Enter) AddMonster_Click(sender, e);
|
||||
}
|
||||
|
||||
private void DeleteRow_Click(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is Button { Tag: MonsterRule rule } && !rule.IsDefault)
|
||||
{
|
||||
rule.PropertyChanged -= Rule_Changed;
|
||||
Rules.Remove(rule);
|
||||
Save();
|
||||
}
|
||||
}
|
||||
|
||||
// ── Helpers ──────────────────────────────────────────────────────────────
|
||||
|
||||
private void SetStatus(string msg, bool error = false)
|
||||
{
|
||||
var status = this.FindControl<TextBlock>("StatusText");
|
||||
if (status == null) return;
|
||||
|
||||
status.Foreground = error
|
||||
? new SolidColorBrush(Color.FromRgb(0xF3, 0x8B, 0xA8))
|
||||
: new SolidColorBrush(Color.FromRgb(0xA6, 0xE3, 0xA1));
|
||||
status.Text = msg;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Converters ────────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>int weapon/offhand id → display name (read-only).</summary>
|
||||
public class IdToNameConverter : IValueConverter
|
||||
{
|
||||
public static readonly IdToNameConverter Instance = new();
|
||||
public IReadOnlyList<WeaponOption> Options { get; set; } = Array.Empty<WeaponOption>();
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int id)
|
||||
{
|
||||
if (id == 0) return "<AUTO>";
|
||||
foreach (var opt in Options)
|
||||
if (opt.Id == id) return opt.DisplayName;
|
||||
return $"<ID:{id}>";
|
||||
}
|
||||
return "<AUTO>";
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>int id ↔ WeaponOption. Used for ComboBox SelectedItem on an int-backed property.</summary>
|
||||
public class OptionFromIdConverter : IValueConverter
|
||||
{
|
||||
public static readonly OptionFromIdConverter Instance = new();
|
||||
public IReadOnlyList<WeaponOption> Options { get; set; } = Array.Empty<WeaponOption>();
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is int id)
|
||||
foreach (var opt in Options)
|
||||
if (opt.Id == id) return opt;
|
||||
return null;
|
||||
}
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is WeaponOption opt ? opt.Id : 0;
|
||||
}
|
||||
|
||||
/// <summary>IsDefault → yellow; else default Foreground colour. WPF DataTriggers have no Avalonia equivalent.</summary>
|
||||
public class DefaultFgConverter : IValueConverter
|
||||
{
|
||||
public static readonly DefaultFgConverter Instance = new();
|
||||
private static readonly IBrush DefaultYellow = new SolidColorBrush(Color.FromRgb(0xF9, 0xE2, 0xAF));
|
||||
private static readonly IBrush Normal = new SolidColorBrush(Color.FromRgb(0xCD, 0xD6, 0xF4));
|
||||
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is true ? DefaultYellow : Normal;
|
||||
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public class DefaultWeightConverter : IValueConverter
|
||||
{
|
||||
public static readonly DefaultWeightConverter Instance = new();
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is true ? FontWeight.SemiBold : FontWeight.Normal;
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> throw new NotSupportedException();
|
||||
}
|
||||
|
||||
/// <summary>True → false, False → true (IsVisible on Delete button for the Default row).</summary>
|
||||
public class InvertBoolConverter : IValueConverter
|
||||
{
|
||||
public static readonly InvertBoolConverter Instance = new();
|
||||
public object? Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is not true;
|
||||
public object? ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||
=> value is not true;
|
||||
}
|
||||
68
Tools/RynthCore.MonsterEditor/Models.cs
Normal file
68
Tools/RynthCore.MonsterEditor/Models.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace RynthCore.MonsterEditor;
|
||||
|
||||
public class MonsterRule : INotifyPropertyChanged
|
||||
{
|
||||
private string _name = "New Monster";
|
||||
private int _priority = 1;
|
||||
private string _damageType = "Auto";
|
||||
private int _weaponId;
|
||||
private bool _fester, _broadside, _gravityWell, _imperil, _yield, _vuln;
|
||||
private bool _useArc, _useBolt = true, _useRing, _useStreak;
|
||||
private string _exVuln = "None";
|
||||
private int _offhandId;
|
||||
private string _petDamage = "PAuto";
|
||||
|
||||
public string Name { get => _name; set { _name = value; OnPropertyChanged(); } }
|
||||
public int Priority { get => _priority; set { _priority = value; OnPropertyChanged(); } }
|
||||
public string DamageType { get => _damageType; set { _damageType = value; OnPropertyChanged(); } }
|
||||
public int WeaponId { get => _weaponId; set { _weaponId = value; OnPropertyChanged(); } }
|
||||
public bool Fester { get => _fester; set { _fester = value; OnPropertyChanged(); } }
|
||||
public bool Broadside { get => _broadside; set { _broadside = value; OnPropertyChanged(); } }
|
||||
public bool GravityWell { get => _gravityWell; set { _gravityWell = value; OnPropertyChanged(); } }
|
||||
public bool Imperil { get => _imperil; set { _imperil = value; OnPropertyChanged(); } }
|
||||
public bool Yield { get => _yield; set { _yield = value; OnPropertyChanged(); } }
|
||||
public bool Vuln { get => _vuln; set { _vuln = value; OnPropertyChanged(); } }
|
||||
public bool UseArc { get => _useArc; set { _useArc = value; OnPropertyChanged(); } }
|
||||
public bool UseBolt { get => _useBolt; set { _useBolt = value; OnPropertyChanged(); } }
|
||||
public bool UseRing { get => _useRing; set { _useRing = value; OnPropertyChanged(); } }
|
||||
public bool UseStreak { get => _useStreak; set { _useStreak = value; OnPropertyChanged(); } }
|
||||
public string ExVuln { get => _exVuln; set { _exVuln = value; OnPropertyChanged(); } }
|
||||
public int OffhandId { get => _offhandId; set { _offhandId = value; OnPropertyChanged(); } }
|
||||
public string PetDamage { get => _petDamage; set { _petDamage = value; OnPropertyChanged(); } }
|
||||
|
||||
[JsonIgnore]
|
||||
public bool IsDefault => string.Equals(_name, "Default", System.StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
protected void OnPropertyChanged([CallerMemberName] string? name = null)
|
||||
=> PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(name));
|
||||
}
|
||||
|
||||
public class ItemRule
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public string Action { get; set; } = "Loot";
|
||||
public string Element { get; set; } = "Slash";
|
||||
public bool KeepBuffed { get; set; } = true;
|
||||
}
|
||||
|
||||
/// <summary>Minimal slice of the settings profile — only what the editor needs for dropdowns.</summary>
|
||||
public class EditorSettings
|
||||
{
|
||||
public List<MonsterRule> MonsterRules { get; set; } = new();
|
||||
public List<ItemRule> ItemRules { get; set; } = new();
|
||||
}
|
||||
|
||||
/// <summary>Used by weapon/offhand ComboBoxes: maps weapon ID → display name.</summary>
|
||||
public class WeaponOption
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string DisplayName { get; set; } = string.Empty;
|
||||
public override string ToString() => DisplayName;
|
||||
}
|
||||
39
Tools/RynthCore.MonsterEditor/Program.cs
Normal file
39
Tools/RynthCore.MonsterEditor/Program.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using Avalonia;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace RynthCore.MonsterEditor;
|
||||
|
||||
class Program
|
||||
{
|
||||
internal static readonly string LogPath =
|
||||
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "MonsterEditor.log");
|
||||
|
||||
[STAThread]
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
AppDomain.CurrentDomain.UnhandledException += (_, e) =>
|
||||
Log($"UNHANDLED: {e.ExceptionObject}");
|
||||
|
||||
try
|
||||
{
|
||||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log($"FATAL: {ex}");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Log(string msg)
|
||||
{
|
||||
try { File.AppendAllText(LogPath, $"[{DateTime.Now:HH:mm:ss}] {msg}\n"); }
|
||||
catch { /* best-effort */ }
|
||||
}
|
||||
|
||||
public static AppBuilder BuildAvaloniaApp() =>
|
||||
AppBuilder.Configure<App>()
|
||||
.UsePlatformDetect()
|
||||
.LogToTrace();
|
||||
}
|
||||
21
Tools/RynthCore.MonsterEditor/RynthCore.MonsterEditor.csproj
Normal file
21
Tools/RynthCore.MonsterEditor/RynthCore.MonsterEditor.csproj
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<AssemblyName>RynthCore.MonsterEditor</AssemblyName>
|
||||
<RootNamespace>RynthCore.MonsterEditor</RootNamespace>
|
||||
<AvaloniaUseCompiledBindingsByDefault>false</AvaloniaUseCompiledBindingsByDefault>
|
||||
<UseWpf>false</UseWpf>
|
||||
<UseWindowsForms>false</UseWindowsForms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.2.3" />
|
||||
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.2.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
162
Tools/RynthCore.MonsterEditor/Styles.axaml
Normal file
162
Tools/RynthCore.MonsterEditor/Styles.axaml
Normal file
|
|
@ -0,0 +1,162 @@
|
|||
<Styles xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
|
||||
<Styles.Resources>
|
||||
<SolidColorBrush x:Key="BgMain" Color="#1E1E2E"/>
|
||||
<SolidColorBrush x:Key="BgPanel" Color="#252536"/>
|
||||
<SolidColorBrush x:Key="BgInput" Color="#313244"/>
|
||||
<SolidColorBrush x:Key="BgHover" Color="#252538"/>
|
||||
<SolidColorBrush x:Key="BgSelect" Color="#2D2D44"/>
|
||||
<SolidColorBrush x:Key="BgAltRow" Color="#181825"/>
|
||||
<SolidColorBrush x:Key="FgMain" Color="#CDD6F4"/>
|
||||
<SolidColorBrush x:Key="FgHeader" Color="#89B4FA"/>
|
||||
<SolidColorBrush x:Key="FgDefault" Color="#F9E2AF"/>
|
||||
<SolidColorBrush x:Key="FgStatus" Color="#A6E3A1"/>
|
||||
<SolidColorBrush x:Key="FgError" Color="#F38BA8"/>
|
||||
<SolidColorBrush x:Key="Border" Color="#45475A"/>
|
||||
<SolidColorBrush x:Key="GridLine" Color="#2A2A3A"/>
|
||||
</Styles.Resources>
|
||||
|
||||
<Style Selector="Window">
|
||||
<Setter Property="Background" Value="{StaticResource BgMain}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="FontFamily" Value="Segoe UI,sans-serif"/>
|
||||
<Setter Property="FontSize" Value="12"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBlock">
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="TextBox">
|
||||
<Setter Property="Background" Value="{StaticResource BgInput}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="5,3"/>
|
||||
<Setter Property="CaretBrush" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="SelectionBrush" Value="{StaticResource BgSelect}"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Button">
|
||||
<Setter Property="Background" Value="{StaticResource BgInput}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="8,3"/>
|
||||
<Setter Property="CornerRadius" Value="3"/>
|
||||
<Setter Property="Cursor" Value="Hand"/>
|
||||
</Style>
|
||||
<Style Selector="Button:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgHover}"/>
|
||||
</Style>
|
||||
<Style Selector="Button:pressed /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgSelect}"/>
|
||||
</Style>
|
||||
|
||||
<Style Selector="ComboBox">
|
||||
<Setter Property="Background" Value="{StaticResource BgInput}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="Padding" Value="5,1"/>
|
||||
<Setter Property="CornerRadius" Value="2"/>
|
||||
<Setter Property="MinHeight" Value="22"/>
|
||||
</Style>
|
||||
<Style Selector="ComboBoxItem">
|
||||
<Setter Property="Background" Value="{StaticResource BgPanel}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="Padding" Value="8,4"/>
|
||||
</Style>
|
||||
<Style Selector="ComboBoxItem:selected /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgSelect}"/>
|
||||
</Style>
|
||||
<Style Selector="ComboBoxItem:pointerover /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="{StaticResource BgHover}"/>
|
||||
</Style>
|
||||
|
||||
<!-- Toggle-light: small labeled square button used for each monster flag. -->
|
||||
<Style Selector="ToggleButton.light">
|
||||
<Setter Property="Width" Value="18"/>
|
||||
<Setter Property="Height" Value="16"/>
|
||||
<Setter Property="Margin" Value="1,1"/>
|
||||
<Setter Property="Padding" Value="0"/>
|
||||
<Setter Property="MinWidth" Value="18"/>
|
||||
<Setter Property="MinHeight" Value="16"/>
|
||||
<Setter Property="Background" Value="#404040"/>
|
||||
<Setter Property="Foreground" Value="#909090"/>
|
||||
<Setter Property="BorderBrush" Value="#555555"/>
|
||||
<Setter Property="BorderThickness" Value="1"/>
|
||||
<Setter Property="CornerRadius" Value="2"/>
|
||||
<Setter Property="Focusable" Value="False"/>
|
||||
<Setter Property="FontSize" Value="8"/>
|
||||
<Setter Property="FontWeight" Value="SemiBold"/>
|
||||
<Setter Property="HorizontalContentAlignment" Value="Center"/>
|
||||
<Setter Property="VerticalContentAlignment" Value="Center"/>
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate>
|
||||
<Border Background="{TemplateBinding Background}"
|
||||
BorderBrush="{TemplateBinding BorderBrush}"
|
||||
BorderThickness="{TemplateBinding BorderThickness}"
|
||||
CornerRadius="{TemplateBinding CornerRadius}"
|
||||
ToolTip.Tip="{TemplateBinding ToolTip.Tip}">
|
||||
<ContentPresenter HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Content="{TemplateBinding Content}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="{TemplateBinding FontWeight}"
|
||||
Foreground="{TemplateBinding Foreground}"/>
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
</Style>
|
||||
<Style Selector="ToggleButton.light:checked">
|
||||
<Setter Property="Background" Value="#22AA22"/>
|
||||
<Setter Property="BorderBrush" Value="#44CC44"/>
|
||||
<Setter Property="Foreground" Value="#FFFFFF"/>
|
||||
</Style>
|
||||
<Style Selector="ToggleButton.light:pointerover">
|
||||
<Setter Property="Opacity" Value="0.80"/>
|
||||
</Style>
|
||||
|
||||
<!-- DataGrid styling -->
|
||||
<Style Selector="DataGrid">
|
||||
<Setter Property="Background" Value="{StaticResource BgAltRow}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="GridLinesVisibility" Value="All"/>
|
||||
<Setter Property="VerticalGridLinesBrush" Value="{StaticResource GridLine}"/>
|
||||
<Setter Property="HorizontalGridLinesBrush" Value="{StaticResource GridLine}"/>
|
||||
<Setter Property="RowBackground" Value="{StaticResource BgAltRow}"/>
|
||||
</Style>
|
||||
<Style Selector="DataGridColumnHeader">
|
||||
<Setter Property="Background" Value="{StaticResource BgInput}"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgHeader}"/>
|
||||
<Setter Property="BorderBrush" Value="{StaticResource Border}"/>
|
||||
<Setter Property="BorderThickness" Value="0,0,1,1"/>
|
||||
<Setter Property="Padding" Value="3,2"/>
|
||||
<Setter Property="FontSize" Value="11"/>
|
||||
</Style>
|
||||
<Style Selector="DataGridCell">
|
||||
<Setter Property="Background" Value="Transparent"/>
|
||||
<Setter Property="Foreground" Value="{StaticResource FgMain}"/>
|
||||
<Setter Property="BorderThickness" Value="0"/>
|
||||
<Setter Property="Padding" Value="2,1"/>
|
||||
</Style>
|
||||
<Style Selector="DataGridRow">
|
||||
<Setter Property="Background" Value="{StaticResource BgAltRow}"/>
|
||||
</Style>
|
||||
<Style Selector="DataGridRow:nth-child(2n)">
|
||||
<Setter Property="Background" Value="{StaticResource BgMain}"/>
|
||||
</Style>
|
||||
<Style Selector="DataGridRow:pointerover /template/ Rectangle#BackgroundRectangle">
|
||||
<Setter Property="Fill" Value="{StaticResource BgHover}"/>
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
</Style>
|
||||
<Style Selector="DataGridRow:selected /template/ Rectangle#BackgroundRectangle">
|
||||
<Setter Property="Fill" Value="{StaticResource BgSelect}"/>
|
||||
<Setter Property="Opacity" Value="1"/>
|
||||
</Style>
|
||||
|
||||
</Styles>
|
||||
78
Tools/RynthNav.Baker/ApiDump.cs
Normal file
78
Tools/RynthNav.Baker/ApiDump.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
namespace RynthNav.Baker;
|
||||
|
||||
// Temporary: reflect the exact DotRecast 2026.1.3 public API for the types we
|
||||
// need (build settings, builders, input geom, Detour query). Delete once the
|
||||
// bake/query code is written against confirmed signatures.
|
||||
internal static class ApiDump
|
||||
{
|
||||
public static void Run()
|
||||
{
|
||||
string[] asmNames = { "DotRecast.Core", "DotRecast.Recast", "DotRecast.Recast.Toolset", "DotRecast.Detour" };
|
||||
var asms = new List<Assembly>();
|
||||
foreach (var n in asmNames)
|
||||
{
|
||||
try { asms.Add(Assembly.Load(new AssemblyName(n))); }
|
||||
catch (Exception ex) { Console.WriteLine($"load {n} FAILED: {ex.Message}"); }
|
||||
}
|
||||
Console.WriteLine("Loaded: " + string.Join(", ", asms.Select(a => a.GetName().Name + " " + a.GetName().Version)));
|
||||
|
||||
string[] needles =
|
||||
{
|
||||
"NavMeshBuildSettings", "NavMeshBuilder", "InputGeomProvider", "IInputGeom", "RcInputGeom",
|
||||
"DtNavMeshQuery", "DtNavMeshCreateParams", "NavMeshBuildResult", "DtMeshData", "DtRawTileData",
|
||||
"DtMeshTile", "DtNavMeshParams", "DtMeshHeader", "RcByteOrder", "TileNavMeshBuilder", "RcNavMeshBuildSettings"
|
||||
};
|
||||
|
||||
foreach (var a in asms)
|
||||
{
|
||||
Type[] types;
|
||||
try { types = a.GetExportedTypes(); }
|
||||
catch { continue; }
|
||||
foreach (var t in types.Where(t => t.FullName != null &&
|
||||
(t.Name == "DtNavMesh" || needles.Any(nd => t.Name.Contains(nd, StringComparison.OrdinalIgnoreCase))))
|
||||
.OrderBy(t => t.FullName))
|
||||
Dump(t);
|
||||
}
|
||||
}
|
||||
|
||||
static void Dump(Type t)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
string kind = t.IsInterface ? "interface" : t.IsEnum ? "enum" : t.IsValueType ? "struct" : "class";
|
||||
sb.AppendLine($"\n=== {t.FullName} ({kind}) ===");
|
||||
if (t.IsEnum)
|
||||
{
|
||||
sb.AppendLine(" values: " + string.Join(", ", Enum.GetNames(t)));
|
||||
Console.WriteLine(sb.ToString());
|
||||
return;
|
||||
}
|
||||
foreach (var c in t.GetConstructors(BindingFlags.Public | BindingFlags.Instance))
|
||||
sb.AppendLine(" ctor(" + Params(c.GetParameters()) + ")");
|
||||
foreach (var f in t.GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static))
|
||||
sb.AppendLine($" field {Short(f.FieldType)} {f.Name}");
|
||||
foreach (var p in t.GetProperties(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static))
|
||||
sb.AppendLine($" prop {Short(p.PropertyType)} {p.Name}");
|
||||
foreach (var m in t.GetMethods(BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static).Where(m => !m.IsSpecialName))
|
||||
sb.AppendLine($" {Short(m.ReturnType)} {m.Name}({Params(m.GetParameters())})");
|
||||
Console.WriteLine(sb.ToString());
|
||||
}
|
||||
|
||||
static string Params(ParameterInfo[] ps) =>
|
||||
string.Join(", ", ps.Select(p => (p.IsOut ? "out " : p.ParameterType.IsByRef ? "ref " : "") + Short(p.ParameterType) + " " + p.Name));
|
||||
|
||||
static string Short(Type t)
|
||||
{
|
||||
if (t.IsByRef) t = t.GetElementType()!;
|
||||
if (t.IsGenericType)
|
||||
{
|
||||
var name = t.Name;
|
||||
int tick = name.IndexOf('`');
|
||||
if (tick > 0) name = name[..tick];
|
||||
return name + "<" + string.Join(",", t.GetGenericArguments().Select(Short)) + ">";
|
||||
}
|
||||
return t.Name;
|
||||
}
|
||||
}
|
||||
213
Tools/RynthNav.Baker/NavBake.cs
Normal file
213
Tools/RynthNav.Baker/NavBake.cs
Normal file
|
|
@ -0,0 +1,213 @@
|
|||
using System.Text;
|
||||
using DotRecast.Core;
|
||||
using DotRecast.Core.Numerics;
|
||||
using DotRecast.Recast;
|
||||
using DotRecast.Recast.Geom;
|
||||
using DotRecast.Recast.Toolset;
|
||||
using DotRecast.Recast.Toolset.Builder;
|
||||
using DotRecast.Detour;
|
||||
using DotRecast.Detour.Io;
|
||||
using RynthCore.TerrainData;
|
||||
using RynthCore.Plugin.RynthAi.Raycasting; // LandblockData
|
||||
|
||||
namespace RynthNav.Baker;
|
||||
|
||||
// Bakes AC landblocks into Detour tiles.
|
||||
// - Solo (--lb): one self-contained tile per landblock.
|
||||
// - Tiled (--tiled): a whole region baked as ONE connected tiled navmesh, then
|
||||
// each tile serialized with its ABSOLUTE landblock coords in the header so the
|
||||
// plugin can stream a window of them into a multi-tile navmesh that connects.
|
||||
internal static class NavBake
|
||||
{
|
||||
private const float CL = LandblockData.CellLength; // 24
|
||||
public const int VertsPerPoly = 6;
|
||||
// Tiled tiles align 1:1 to landblocks: tileSize(cells) * cellSize = 192.
|
||||
private const float TiledCellSize = 0.5f;
|
||||
private const int TiledTileSize = 384; // 384 * 0.5 = 192
|
||||
|
||||
private static RcVec3f AcToRec(double ewX, double nsY, double upZ) => new((float)ewX, (float)upZ, (float)nsY);
|
||||
private static (double ew, double ns, double up) RecToAc(RcVec3f v) => (v.X, v.Z, v.Y);
|
||||
|
||||
// ── Geometry: append one landblock's terrain + obstacle triangles (Recast frame) ──
|
||||
public static bool AppendLandblock(TerrainSampler sampler, RynthCore2.Raycast.GeometryLoader? geo, uint lb, List<float> verts, List<int> faces)
|
||||
{
|
||||
LandblockData? land = sampler.LoadLandblock(lb);
|
||||
if (land == null) return false;
|
||||
|
||||
void Tri(int a, int b, int c) { faces.Add(a); faces.Add(c); faces.Add(b); } // reversed winding (+Y up)
|
||||
int AddVtx(double ax, double ay, double az) { RcVec3f r = AcToRec(ax, ay, az); verts.Add(r.X); verts.Add(r.Y); verts.Add(r.Z); return verts.Count / 3 - 1; }
|
||||
|
||||
int[,] vidx = new int[9, 9];
|
||||
for (int iy = 0; iy < 9; iy++)
|
||||
for (int ix = 0; ix < 9; ix++)
|
||||
vidx[ix, iy] = AddVtx(land.WorldOriginX + ix * CL, land.WorldOriginY + iy * CL, land.GetVertexZ(ix, iy));
|
||||
for (int cy = 0; cy < 8; cy++)
|
||||
for (int cx = 0; cx < 8; cx++)
|
||||
{
|
||||
int sw = vidx[cx, cy], se = vidx[cx + 1, cy], nw = vidx[cx, cy + 1], ne = vidx[cx + 1, cy + 1];
|
||||
if (TerrainSampler.SwToNeCut(lb, cx, cy)) { Tri(sw, se, ne); Tri(sw, ne, nw); }
|
||||
else { Tri(sw, se, nw); Tri(se, ne, nw); }
|
||||
}
|
||||
|
||||
if (geo != null)
|
||||
{
|
||||
void Append(List<RynthCore2.Raycast.GeometryLoader.TexTri> tris)
|
||||
{
|
||||
foreach (var t in tris)
|
||||
{
|
||||
if (!Fin(t.A.X, t.A.Y, t.A.Z) || !Fin(t.B.X, t.B.Y, t.B.Z) || !Fin(t.C.X, t.C.Y, t.C.Z)) continue;
|
||||
Tri(AddVtx(t.A.X, t.A.Y, t.A.Z), AddVtx(t.B.X, t.B.Y, t.B.Z), AddVtx(t.C.X, t.C.Y, t.C.Z));
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
Append(geo.GetTexturedStaticObjects(lb));
|
||||
Append(geo.GetTexturedScatter(lb, (wx, wy) => { float z = land.GetTerrainZWorld(wx, wy); return float.IsNaN(z) ? land.GetNearestVertexHeightWorld(wx, wy) : z; }));
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static RcNavMeshBuildSettings Settings(float radius, bool tiled, float cellSize)
|
||||
{
|
||||
float slopeDeg = (float)(Math.Acos(TerrainSampler.FloorZ) * 180.0 / Math.PI);
|
||||
return new RcNavMeshBuildSettings
|
||||
{
|
||||
cellSize = cellSize, cellHeight = 0.20f,
|
||||
agentHeight = 2.0f, agentRadius = radius, agentMaxClimb = 1.0f, agentMaxSlope = slopeDeg,
|
||||
minRegionSize = 8, mergedRegionSize = 20, partitioning = (int)RcPartition.WATERSHED,
|
||||
filterLowHangingObstacles = true, filterLedgeSpans = true, filterWalkableLowHeightSpans = true,
|
||||
edgeMaxLen = 12f, edgeMaxError = 1.3f, vertsPerPoly = VertsPerPoly, detailSampleDist = 6f, detailSampleMaxError = 1f,
|
||||
tiled = tiled, tileSize = tiled ? TiledTileSize : 0, keepInterResults = true, buildAll = true,
|
||||
};
|
||||
}
|
||||
|
||||
private static bool Fin(float a, float b, float c) => float.IsFinite(a) && float.IsFinite(b) && float.IsFinite(c);
|
||||
|
||||
// ── Solo bake (one self-contained tile) ─────────────────────────────────────
|
||||
public static int BakeLandblock(TerrainSampler sampler, RynthCore2.Raycast.GeometryLoader? geo, uint lb, string outDir, bool writeObj, float agentRadius)
|
||||
{
|
||||
var verts = new List<float>(); var faces = new List<int>();
|
||||
if (!AppendLandblock(sampler, geo, lb, verts, faces)) return -1;
|
||||
|
||||
var geom = new RcSampleInputGeomProvider(verts.ToArray(), faces.ToArray());
|
||||
geom.CalculateNormals();
|
||||
var settings = Settings(agentRadius, tiled: false, cellSize: 0.45f);
|
||||
NavMeshBuildResult res = new SoloNavMeshBuilder().Build(geom, settings);
|
||||
if (!res.Success || res.NavMesh == null || res.RecastBuilderResults.Count == 0) return -1;
|
||||
RcBuilderResult rb = res.RecastBuilderResults[0];
|
||||
if (rb.Mesh.npolys == 0) return 0;
|
||||
|
||||
DtMeshData md = new SoloNavMeshBuilder().BuildMeshData(geom, settings.cellSize, settings.cellHeight,
|
||||
settings.agentHeight, settings.agentRadius, settings.agentMaxClimb, rb);
|
||||
WriteTile(Path.Combine(outDir, $"nav_{lb:X4}.tile"), md);
|
||||
if (writeObj) ExportDetailObj(Path.Combine(outDir, $"nav_{lb:X4}.obj"), rb.MeshDetail, lb);
|
||||
return rb.Mesh.npolys;
|
||||
}
|
||||
|
||||
// ── Tiled bake: a region as ONE connected navmesh, serialized per-tile ───────
|
||||
public static void BakeRegionTiled(TerrainSampler sampler, RynthCore2.Raycast.GeometryLoader? geo,
|
||||
int x0, int x1, int y0, int y1, string outDir, float agentRadius, out int tiles, out int empty)
|
||||
{
|
||||
tiles = 0; empty = 0;
|
||||
var verts = new List<float>(); var faces = new List<int>();
|
||||
int gathered = 0;
|
||||
// Gather a 1-landblock BORDER beyond the output rectangle so this chunk's
|
||||
// edge tiles share geometry context with neighbouring chunks — that makes
|
||||
// separately-baked chunks reconnect at their seams when both are loaded.
|
||||
for (int x = x0 - 1; x <= x1 + 1; x++)
|
||||
for (int y = y0 - 1; y <= y1 + 1; y++)
|
||||
{
|
||||
if (x < 0 || x > 255 || y < 0 || y > 255) continue;
|
||||
if (AppendLandblock(sampler, geo, (uint)((x << 8) | y), verts, faces)) gathered++;
|
||||
}
|
||||
if (gathered == 0) return;
|
||||
|
||||
var geom = new RcSampleInputGeomProvider(verts.ToArray(), faces.ToArray());
|
||||
geom.CalculateNormals();
|
||||
var settings = Settings(agentRadius, tiled: true, cellSize: TiledCellSize);
|
||||
NavMeshBuildResult res = new TileNavMeshBuilder().Build(geom, settings);
|
||||
if (!res.Success || res.NavMesh == null) return;
|
||||
|
||||
DtNavMesh nav = res.NavMesh;
|
||||
RcVec3f bmin = geom.GetMeshBoundsMin();
|
||||
int baseLbX = (int)Math.Round(bmin.X / 192.0); // Recast x = world EW = lbX*192
|
||||
int baseLbZ = (int)Math.Round(bmin.Z / 192.0); // Recast z = world NS = lbY*192
|
||||
|
||||
for (int i = 0; i < nav.GetMaxTiles(); i++)
|
||||
{
|
||||
DtMeshTile? tile = nav.GetTile(i);
|
||||
if (tile?.data?.header == null) continue;
|
||||
DtMeshData md = tile.data;
|
||||
if (md.header.polyCount == 0) { empty++; continue; }
|
||||
int absLbX = baseLbX + md.header.x;
|
||||
int absLbY = baseLbZ + md.header.y;
|
||||
if (absLbX < x0 || absLbX > x1 || absLbY < y0 || absLbY > y1) continue; // border tile = context only
|
||||
md.header.x = absLbX; // rewrite to ABSOLUTE landblock coords (world-positioned grid)
|
||||
md.header.y = absLbY;
|
||||
uint lb = (uint)((absLbX << 8) | absLbY);
|
||||
WriteTile(Path.Combine(outDir, $"nav_{lb:X4}.tile"), md);
|
||||
tiles++;
|
||||
}
|
||||
}
|
||||
|
||||
// ── Validation: reload two adjacent tiles like the plugin would, path across ──
|
||||
public static string ValidateConnectivity(string outDir, uint lbA, uint lbB)
|
||||
{
|
||||
var nav = new DtNavMesh();
|
||||
var p = new DtNavMeshParams { orig = new RcVec3f(0, 0, 0), tileWidth = 192f, tileHeight = 192f, maxTiles = 64, maxPolys = 1 << 16 };
|
||||
nav.Init(ref p, VertsPerPoly);
|
||||
foreach (uint lb in new[] { lbA, lbB })
|
||||
{
|
||||
string path = Path.Combine(outDir, $"nav_{lb:X4}.tile");
|
||||
if (!File.Exists(path)) return $"missing tile 0x{lb:X4}";
|
||||
DtMeshData md;
|
||||
using (var fr = File.OpenRead(path)) using (var br = new BinaryReader(fr)) md = new DtMeshDataReader().Read(br, VertsPerPoly);
|
||||
nav.AddTile(md, 0, 0, out _);
|
||||
}
|
||||
var q = new DtNavMeshQuery(nav);
|
||||
var filter = new DtQueryDefaultFilter();
|
||||
var half = new RcVec3f(8, 400, 8);
|
||||
RcVec3f a = new((((lbA >> 8) & 0xFF) * 192f) + 96f, 0, ((lbA & 0xFF) * 192f) + 96f);
|
||||
RcVec3f b = new((((lbB >> 8) & 0xFF) * 192f) + 96f, 0, ((lbB & 0xFF) * 192f) + 96f);
|
||||
q.FindNearestPoly(a, half, filter, out long ra, out RcVec3f pa, out _);
|
||||
q.FindNearestPoly(b, half, filter, out long rb2, out RcVec3f pb, out _);
|
||||
if (ra == 0 || rb2 == 0) return $"poly not found (ra={ra} rb={rb2})";
|
||||
Span<long> path2 = new long[256];
|
||||
var st = q.FindPath(ra, rb2, pa, pb, filter, path2, out int pc, 256);
|
||||
bool crosses = false;
|
||||
for (int i = 0; i < pc; i++) { nav.GetTileAndPolyByRef(path2[i], out DtMeshTile t, out _); if (t?.data?.header != null && (uint)((t.data.header.x << 8) | t.data.header.y) == lbB) { crosses = true; break; } }
|
||||
return $"FindPath {st.Succeeded()} corridor={pc} reaches-0x{lbB:X4}={crosses}";
|
||||
}
|
||||
|
||||
private static void WriteTile(string path, DtMeshData md)
|
||||
{
|
||||
using var fs = File.Create(path);
|
||||
using var bw = new BinaryWriter(fs);
|
||||
new DtMeshDataWriter().Write(bw, md, RcByteOrder.LITTLE_ENDIAN, false);
|
||||
}
|
||||
|
||||
private static void ExportDetailObj(string path, RcPolyMeshDetail d, uint lb)
|
||||
{
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine($"# RynthNav detail mesh, landblock 0x{lb:X4}, AC frame (x=EW, y=NS, z=up)");
|
||||
for (int i = 0; i < d.nverts; i++)
|
||||
{
|
||||
var (ew, ns, up) = RecToAc(new RcVec3f(d.verts[i * 3], d.verts[i * 3 + 1], d.verts[i * 3 + 2]));
|
||||
sb.AppendLine($"v {ew:F3} {ns:F3} {up:F3}");
|
||||
}
|
||||
for (int m = 0; m < d.nmeshes; m++)
|
||||
{
|
||||
int bverts = d.meshes[m * 4 + 0], btris = d.meshes[m * 4 + 2], ntris = d.meshes[m * 4 + 3];
|
||||
for (int t = 0; t < ntris; t++)
|
||||
{
|
||||
int a = bverts + d.tris[(btris + t) * 4 + 0] + 1;
|
||||
int b = bverts + d.tris[(btris + t) * 4 + 1] + 1;
|
||||
int c = bverts + d.tris[(btris + t) * 4 + 2] + 1;
|
||||
sb.AppendLine($"f {a} {b} {c}");
|
||||
}
|
||||
}
|
||||
File.WriteAllText(path, sb.ToString());
|
||||
}
|
||||
}
|
||||
151
Tools/RynthNav.Baker/Program.cs
Normal file
151
Tools/RynthNav.Baker/Program.cs
Normal file
|
|
@ -0,0 +1,151 @@
|
|||
using RynthCore.TerrainData;
|
||||
using RynthNav.Baker;
|
||||
|
||||
// RynthNav.Baker — offline AC navmesh baker.
|
||||
// single: --lb 0xA9B4
|
||||
// region: --region 60,66,40,90 (lbX 0x60..0x66, lbY 0x40..0x90 inclusive, hex)
|
||||
// Options: --ac <dats> --out <dir> --noobs --dumpapi
|
||||
|
||||
if (args.Contains("--dumpapi")) { ApiDump.Run(); return 0; }
|
||||
|
||||
string? GetArg(string name)
|
||||
{
|
||||
for (int i = 0; i < args.Length - 1; i++)
|
||||
if (string.Equals(args[i], name, StringComparison.OrdinalIgnoreCase))
|
||||
return args[i + 1];
|
||||
return null;
|
||||
}
|
||||
|
||||
static uint ParseLb(string s)
|
||||
{
|
||||
s = s.Trim();
|
||||
if (s.StartsWith("0x", StringComparison.OrdinalIgnoreCase)) s = s[2..];
|
||||
return Convert.ToUInt32(s, 16) & 0xFFFF;
|
||||
}
|
||||
|
||||
// Next landblock to bake: prefer stepping toward the target, else rings around the player.
|
||||
static (int, int)? FindNextUnbaked(int pX, int pY, int tX, int tY, string dir, System.Collections.Generic.HashSet<int> attempted)
|
||||
{
|
||||
bool Miss(int x, int y) => x >= 0 && x <= 255 && y >= 0 && y <= 255 && !attempted.Contains((x << 8) | y)
|
||||
&& !File.Exists(Path.Combine(dir, $"nav_{((x << 8) | y):X4}.tile"));
|
||||
int dx = tX - pX, dy = tY - pY, steps = Math.Max(Math.Abs(dx), Math.Abs(dy));
|
||||
for (int s = 1; s <= Math.Min(steps, 14); s++)
|
||||
{
|
||||
int x = pX + (int)Math.Round((double)dx * s / Math.Max(steps, 1));
|
||||
int y = pY + (int)Math.Round((double)dy * s / Math.Max(steps, 1));
|
||||
if (Miss(x, y)) return (x, y);
|
||||
}
|
||||
for (int r = 0; r <= 6; r++)
|
||||
for (int x = pX - r; x <= pX + r; x++)
|
||||
for (int y = pY - r; y <= pY + r; y++)
|
||||
if (Math.Max(Math.Abs(x - pX), Math.Abs(y - pY)) == r && Miss(x, y)) return (x, y);
|
||||
return null;
|
||||
}
|
||||
|
||||
string acFolder = GetArg("--ac") ?? @"C:\Games\ACE\Dats";
|
||||
string outDir = GetArg("--out") ?? @"C:\Games\RynthCore\NavData";
|
||||
bool noObs = args.Contains("--noobs");
|
||||
float radius = float.TryParse(GetArg("--radius"), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out float rr) ? rr : 2.0f;
|
||||
Directory.CreateDirectory(outDir);
|
||||
|
||||
Console.WriteLine($"RynthNav.Baker — dats={acFolder} out={outDir} obstacles={!noObs} radius={radius}");
|
||||
|
||||
using var sampler = new TerrainSampler();
|
||||
if (!sampler.Initialize(acFolder)) { Console.Error.WriteLine($"TerrainSampler init failed: {sampler.Status}"); return 1; }
|
||||
|
||||
RynthCore2.Raycast.GeometryLoader? MakeGeo()
|
||||
{
|
||||
if (noObs) return null;
|
||||
var g = new RynthCore2.Raycast.GeometryLoader();
|
||||
if (g.Initialize(acFolder)) return g;
|
||||
Console.WriteLine($"obstacles: GeometryLoader init failed ({g.StatusMessage}); terrain only");
|
||||
return null;
|
||||
}
|
||||
|
||||
string? region = GetArg("--region");
|
||||
if (region != null)
|
||||
{
|
||||
var p = region.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
if (p.Length != 4) { Console.Error.WriteLine("--region needs minX,maxX,minY,maxY (hex)"); return 1; }
|
||||
int x0 = Convert.ToInt32(p[0], 16), x1 = Convert.ToInt32(p[1], 16);
|
||||
int y0 = Convert.ToInt32(p[2], 16), y1 = Convert.ToInt32(p[3], 16);
|
||||
int total = (x1 - x0 + 1) * (y1 - y0 + 1);
|
||||
Console.WriteLine($"region bake: lbX 0x{x0:X2}..0x{x1:X2} lbY 0x{y0:X2}..0x{y1:X2} ({total} landblocks)…");
|
||||
|
||||
using var geo = MakeGeo();
|
||||
int ok = 0, empty = 0, none = 0, done = 0;
|
||||
for (int x = x0; x <= x1; x++)
|
||||
for (int y = y0; y <= y1; y++)
|
||||
{
|
||||
uint key = (uint)((x << 8) | y);
|
||||
int polys;
|
||||
try { polys = NavBake.BakeLandblock(sampler, geo, key, outDir, false, radius); }
|
||||
catch { polys = -1; }
|
||||
if (polys > 0) ok++; else if (polys == 0) empty++; else none++;
|
||||
if (++done % 50 == 0) Console.WriteLine($" {done}/{total} … (tiles={ok})");
|
||||
}
|
||||
Console.WriteLine($"region bake DONE: {ok} tiles written, {empty} empty, {none} no-terrain (of {total}).");
|
||||
return 0;
|
||||
}
|
||||
|
||||
string? tiled = GetArg("--tiled");
|
||||
if (tiled != null)
|
||||
{
|
||||
var p = tiled.Split(',', StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries);
|
||||
if (p.Length != 4) { Console.Error.WriteLine("--tiled needs minX,maxX,minY,maxY (hex)"); return 1; }
|
||||
int x0 = Convert.ToInt32(p[0], 16), x1 = Convert.ToInt32(p[1], 16), y0 = Convert.ToInt32(p[2], 16), y1 = Convert.ToInt32(p[3], 16);
|
||||
Console.WriteLine($"tiled bake: lbX 0x{x0:X2}..0x{x1:X2} lbY 0x{y0:X2}..0x{y1:X2} (radius={radius})…");
|
||||
using var geoT = MakeGeo();
|
||||
NavBake.BakeRegionTiled(sampler, geoT, x0, x1, y0, y1, outDir, radius, out int tiles, out int empty);
|
||||
Console.WriteLine($"tiled bake DONE: {tiles} tiles written, {empty} empty.");
|
||||
if (x1 > x0) Console.WriteLine("connectivity X: " + NavBake.ValidateConnectivity(outDir, (uint)((x0 << 8) | y0), (uint)(((x0 + 1) << 8) | y0)));
|
||||
if (y1 > y0) Console.WriteLine("connectivity Y: " + NavBake.ValidateConnectivity(outDir, (uint)((x0 << 8) | y0), (uint)((x0 << 8) | (y0 + 1))));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (args.Contains("--watch"))
|
||||
{
|
||||
int R = int.TryParse(GetArg("--chunk"), out int cr) ? cr : 3; // chunk half-size (7x7 default)
|
||||
string posFile = Path.Combine(outDir, "_player.txt");
|
||||
Console.WriteLine($"RynthNav.Baker WATCH — baking ahead of the player (chunk {2 * R + 1}x{2 * R + 1}, radius={radius}). Watching {posFile}. Ctrl+C to stop.");
|
||||
using var geoW = MakeGeo();
|
||||
var attempted = new System.Collections.Generic.HashSet<int>();
|
||||
while (true)
|
||||
{
|
||||
bool didWork = false;
|
||||
try
|
||||
{
|
||||
if (File.Exists(posFile))
|
||||
{
|
||||
var f = File.ReadAllText(posFile).Trim().Split(',');
|
||||
if (f.Length >= 4 && int.TryParse(f[0], out int pX) && int.TryParse(f[1], out int pY) && int.TryParse(f[2], out int tX) && int.TryParse(f[3], out int tY))
|
||||
{
|
||||
var next = FindNextUnbaked(pX, pY, tX, tY, outDir, attempted);
|
||||
if (next.HasValue)
|
||||
{
|
||||
int cx = next.Value.Item1, cy = next.Value.Item2;
|
||||
Console.Write($"[{DateTime.Now:HH:mm:ss}] baking chunk @ 0x{((cx << 8) | cy):X4} … ");
|
||||
NavBake.BakeRegionTiled(sampler, geoW, Math.Max(0, cx - R), Math.Min(255, cx + R), Math.Max(0, cy - R), Math.Min(255, cy + R), outDir, radius, out int t, out _);
|
||||
for (int x = cx - R; x <= cx + R; x++)
|
||||
for (int y = cy - R; y <= cy + R; y++)
|
||||
if (x >= 0 && x <= 255 && y >= 0 && y <= 255) attempted.Add((x << 8) | y);
|
||||
Console.WriteLine($"{t} tiles.");
|
||||
didWork = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex) { Console.WriteLine("watch error: " + ex.Message); }
|
||||
if (!didWork) System.Threading.Thread.Sleep(1500);
|
||||
}
|
||||
}
|
||||
|
||||
// Single landblock.
|
||||
uint lb = ParseLb(GetArg("--lb") ?? "A9B4");
|
||||
using (var geo = MakeGeo())
|
||||
{
|
||||
int polys = NavBake.BakeLandblock(sampler, geo, lb, outDir, writeObj: true, radius);
|
||||
if (polys < 0) { Console.Error.WriteLine($"0x{lb:X4}: no terrain / build failed"); return 1; }
|
||||
Console.WriteLine($"0x{lb:X4}: {polys} polys -> {Path.Combine(outDir, $"nav_{lb:X4}.tile")}");
|
||||
}
|
||||
return 0;
|
||||
29
Tools/RynthNav.Baker/RynthNav.Baker.csproj
Normal file
29
Tools/RynthNav.Baker/RynthNav.Baker.csproj
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<RootNamespace>RynthNav.Baker</RootNamespace>
|
||||
<AssemblyName>RynthNav.Baker</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Shared AC terrain reader (DatDatabase, LandblockData, TerrainSampler) -->
|
||||
<ProjectReference Include="..\..\Shared\RynthCore.TerrainData\RynthCore.TerrainData.csproj" />
|
||||
<!-- AC static/scatter/dungeon geometry reader (GeometryLoader, namespace RynthCore2.Raycast).
|
||||
OutputType=Exe + Silk.NET deps come along; acceptable for an offline baker. -->
|
||||
<ProjectReference Include="..\..\..\AcClientReborn\landblock\AcClientReborn.Landblock.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<!-- Recast/Detour navmesh stack (offline bake uses Recast; runtime plugin will use Detour) -->
|
||||
<PackageReference Include="DotRecast.Core" Version="2026.1.3" />
|
||||
<PackageReference Include="DotRecast.Recast" Version="2026.1.3" />
|
||||
<PackageReference Include="DotRecast.Detour" Version="2026.1.3" />
|
||||
<PackageReference Include="DotRecast.Recast.Toolset" Version="2026.1.3" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
8
Tools/RynthNav.Baker/Start-NavWatcher.cmd
Normal file
8
Tools/RynthNav.Baker/Start-NavWatcher.cmd
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
@echo off
|
||||
REM RynthNav bake-ahead watcher: bakes navmesh tiles around/ahead of the player
|
||||
REM as she roams, reading her position from C:\Games\RynthCore\NavData\_player.txt
|
||||
REM (written by the RynthNav plugin). Leave this window open while you play.
|
||||
cd /d "C:\Projects\RynthSuite\Tools\RynthNav.Baker"
|
||||
echo Starting RynthNav bake-ahead watcher (radius 3.0)...
|
||||
dotnet run -c Debug -- --watch --radius 3.0
|
||||
pause
|
||||
110468
Tools/RynthNav.PortalGraph/Data/GAlocations.xml
Normal file
110468
Tools/RynthNav.PortalGraph/Data/GAlocations.xml
Normal file
File diff suppressed because one or more lines are too long
8274
Tools/RynthNav.PortalGraph/Data/portals.json
Normal file
8274
Tools/RynthNav.PortalGraph/Data/portals.json
Normal file
File diff suppressed because it is too large
Load diff
817
Tools/RynthNav.PortalGraph/Data/portals.tsv
Normal file
817
Tools/RynthNav.PortalGraph/Data/portals.tsv
Normal file
|
|
@ -0,0 +1,817 @@
|
|||
26.3 63.9 -65.9 59.7 Merchant Cellar to High Mountain Valley
|
||||
12.4 2.3 12.2 2.4 Four Towers Entrance
|
||||
12.1 2.3 12.4 2.1 Four Towers Exit
|
||||
36.7 29.1 29.9 26.3 Bandit Camp to Glenden Wood
|
||||
-8.1 74.5 -39.7 -54.1 Portal to East Direlands Swamps
|
||||
-65.2 60.4 -5.6 40 Portal to Desert Ridge Border
|
||||
-66.1 60.1 -61.9 82.5 High Mountain Valley to Mayoi
|
||||
42.4 60.5 65 49.3 Portal to Bandit Castle
|
||||
57.5 37.7 22.1 36.5 Colier to Holtburg
|
||||
59.7 -4 32.8 34.7 Portal to Hilltop
|
||||
52.1 3 25.3 47.7 Northern Pass to Cragstone
|
||||
68.9 -21.4 22.6 37.2 Stonehold to Homeland
|
||||
22.3 51.9 25.3 50 Isle of Tears to Cragstone
|
||||
-21.6 -74.5 -24 -57.8 Walled Fort to Accursed Halls
|
||||
-24.1 -57.7 -21.5 -74.6 Accursed Halls to Walled Fort
|
||||
-62.6 -50.2 -27.9 68.4 Wai Jhou to Sho Roadside
|
||||
-62.2 77.1 -84.3 -34.7 Portal to South Direlands
|
||||
68.6 -23.2 71.6 -29.8 Portal to A Bit More Westward
|
||||
-83.5 47.1 -27.9 68.4 Kara to Sho Roadside
|
||||
20.9 25.9 24.3 -53.8 Portal to the North Direlands
|
||||
64.9 49.4 42.3 60.5 Portal to Eotensfang
|
||||
35 56 41 56 Arwic to Mountain Shortcut
|
||||
40.9 55.8 33.3 57.1 Mountain Shortcut to Arwic
|
||||
-83.6 -34.7 -62.7 81.5 South Direlands to Mayoi
|
||||
54.4 -4.1 -62.7 81.5 Hidden Valley to Mayoi
|
||||
54.3 -4.2 -5.6 40 Hidden Valley to Desert Ridge Border
|
||||
54.2 -4.1 41.6 33.7 Hidden Valley to Holtburg
|
||||
-61.9 40 -65.2 60.3 Ancient Town to High Mountain Valley
|
||||
-61.8 40 22.6 37.2 Ancient Town to Heartland
|
||||
-82.6 -45.6 14.3 1.3 South Direlands to Zaikhal
|
||||
-31.4 37 22.6 37.2 Desert Archmage to the Heartland
|
||||
23.5 -7.7 -38.6 82.1 Wilderness Fort to Hebian-To
|
||||
23.5 -7.7 14.3 1.3 Wilderness Fort to Zaikhal
|
||||
44.4 -43.5 45.3 -44.3 Portal to Plateau Base
|
||||
45.3 -44.2 44.4 -43.5 Portal to Plateau Top
|
||||
64.9 13.6 -27.9 68.4 Portal to Sho Roadside
|
||||
64.8 13.5 32.8 34.7 Crater to Hilltop
|
||||
25.3 49.9 22.5 51.9 Cragstone to Isle of Tears
|
||||
-11.3 37.5 -2.3 63.3 Portal to Riverbend
|
||||
-11.4 37.5 -4.7 -3.1 Portal to North Desert Edge
|
||||
-11.2 37.4 -5.6 40 Portal to Desert Ridge Border
|
||||
61.6 -10.2 -4.7 -3.1 Portal to North Desert Edge
|
||||
61.4 -10.2 24.4 -53.8 Portal to the North Direlands
|
||||
-62.2 -50.5 -62.4 -52.3 Black Hill Portal
|
||||
-62.1 -50.4 -62 -50 Small Hill Base Portal
|
||||
-71 52.3 -21.9 -2.2 High Mountain Valley to Yaraq
|
||||
-61.9 40.2 32.8 34.7 Ancient Town to Hilltop
|
||||
19.6 -3.2 -4.7 -3.1 Gharu'ndim Outpost to North Desert Edge
|
||||
61.7 48.6 -72.5 81.3 Portal to Vesayen Isles
|
||||
-72.3 82.1 18.5 65.8 Portal to Eastham Beach
|
||||
-72.2 90.7 17.6 19.6 Desert Northern Edge Portal
|
||||
72.1 -35.6 -88.3 -64.5 Direland Midlands Portal
|
||||
84.1 47.2 5.5 -87.5 Aerlinthe to Northwest Direlands
|
||||
-18.7 6.8 56.8 12.9 Southern Mount Esper Portal
|
||||
28.8 6.7 55.9 -52.2 Portal to Rivermouth
|
||||
-45.9 90.8 93.5 7.7 Portal to Northern Point
|
||||
79.9 -15.2 5.5 -87.5 Portal to the Northwest Direlands
|
||||
-74.1 -52.4 -49.2 -63.5 South Rim to Direlands Valley
|
||||
-74.1 -52.4 5.8 -91 South Rim to Direlands NW Shore
|
||||
1.7 -71.5 32.8 34.7 Portal to Hilltop
|
||||
3.9 -72.5 4 -73.7 Portal to Lighthouse
|
||||
-80.6 -37.5 -0.4 -80.1 Portal to Slaughterhouse
|
||||
-63.2 -56.7 -83.3 -19.2 Portal to Direlands South Landbridge
|
||||
-60 -59.7 -70.9 -36.3 Portal to Direlands Southeast Shore
|
||||
29.4 -52.2 44.5 -43.1 West Coast to Plateau Village
|
||||
44.5 -41.8 50.5 -68.2 Northern Manumet Plains Portal
|
||||
23.9 -28 56.1 -75.2 Central Tuatara Plains Portal
|
||||
38.3 -75.5 42.1 33.6 Holtburg Portal
|
||||
47.4 -88.9 38.1 -75.9 Bluespire Portal
|
||||
41 -83.6 52.1 -86.2 Northern Ahurenga Plains Portal
|
||||
40.5 -83.7 -52.2 82.5 Nanto Portal
|
||||
42 -77.6 42.2 -77.6 Marescent Plateau Portal
|
||||
42.5 -67.5 -22.2 -2.1 Yaraq Portal
|
||||
55.9 -75 38.1 -77.7 Karab Delta Portal
|
||||
40.2 35.1 61.1 31.2 Holtburg to New Colier Cottages Portal
|
||||
40.2 35.1 43.9 18.4 Holtburg to Woodsbane Cottages Portal
|
||||
40.2 35.1 50.3 35.3 Holtburg to Mountain Keep Cottages Portal
|
||||
40.2 35.1 40.7 47.2 Holtburg to Holtburg Wilderness Cottages Portal
|
||||
-33.6 13.2 -33.2 9.8 Al-Arqas to Al-Kasan Settlement
|
||||
-33.6 13.2 -37.9 16 Al-Arqas to Monument Sands Settlement
|
||||
-33.6 13.2 -34.5 18.1 Al-Arqas to Al-Hatar Settlement
|
||||
-33.6 13.2 -24.7 15.2 Al-Arqas to Arqasanti
|
||||
5.7 4.3 4.3 12.3 Al-Jalima to Musansayn
|
||||
5.7 4.3 12.4 5.6 Al-Jalima to Four Towers Settlement
|
||||
32.9 59.4 32.9 48.4 Arwic to East Span Way Settlement Portal
|
||||
32.9 59.4 28.7 59.7 Arwic to Southeast Arwic Settlement Portal
|
||||
32.9 59.4 30.1 65.8 Arwic to Cape Feirgard Cottages Portal
|
||||
32.9 59.4 52 64 Arwic to Sennon Valley Retreat Portal
|
||||
26.2 46.3 14.1 37.8 Cragstone to Forgotten Hills
|
||||
26.2 46.3 17.4 48.7 Cragstone to South Victory Harbor
|
||||
26.2 46.3 20.1 43.6 Cragstone to Cragstone Farms
|
||||
66.3 14.3 72.5 28 Crater to East Esper Valley Portal
|
||||
66.3 14.3 70.9 23 Crater to Neydisa Village Portal
|
||||
66.3 14.3 56.7 20.2 Crater to Prosper River Headwaters Portal
|
||||
66.3 14.3 87.6 14.5 Crater to Pavanne Vale Freehold Portal
|
||||
66.3 14.3 86.7 29.4 Crater to Celdiseths Beach Settlement Portal
|
||||
17.5 61.5 19.9 57.3 Eastham to Strathelar`s Watch Cottages
|
||||
17.5 61.5 22.9 60.3 Eastham to North Eastham Meadow
|
||||
17.5 61.5 13.4 63.4 Eastham to Filos` Font Cottages
|
||||
17.5 61.5 16.7 57.3 Eastham to Lake Blessed Cottages
|
||||
27.9 29.5 34.5 22.5 Glenden Wood to Mountain Ridge Abodes
|
||||
27.9 29.5 22.7 22.7 Glenden Wood to Zabool Overlook Settlement
|
||||
27.9 29.5 35 26.8 Glenden Wood to Glenden Hills North Settlement
|
||||
27.9 29.5 32.2 31 Glenden Wood to Glenden Hills East Settlement
|
||||
27.9 29.5 32.5 18.5 Glenden Wood to Eaves of Tiofor Settlement
|
||||
27.9 29.5 34.1 13.5 Glenden Wood to Whispering Pines Cottages
|
||||
-41.5 82.1 -20.3 78.5 Hebian-To to Bluewater Cottages
|
||||
-41.5 82.1 -43.1 87.2 Hebian-To to Southwest Hebian-To Settlement
|
||||
-41.5 82.1 -44 80.4 Hebian-To to South Hebian-To Cottages
|
||||
-41.5 82.1 -40.8 76.6 Hebian-To to Shian-To Cottages
|
||||
40.2 35.1 48 29.2 Holtburg to Lilyglen Cottages Portal
|
||||
-82.9 48.2 75.6 52.2 Kara to Norstead Portal
|
||||
-82.9 48.2 -81.5 51.6 Kara to Ishilai Inlet Settlement Portal
|
||||
-82.9 48.2 -80.6 56 Kara to South Adjamaer Cottages Portal
|
||||
-82.9 48.2 -76 53.6 Kara to North Adjamaer Cottages Portal
|
||||
-82.9 48.2 -71.8 47.3 Kara to Yukikaze Portal
|
||||
-49.4 26 -38.7 39.3 Khayyaban to Taklihuan Settlement
|
||||
-49.4 26 -50.5 11.7 Khayyaban to Serpent Hills Settlement
|
||||
-49.4 26 -52.6 27.7 Khayyaban to South Khayyaban Cottages
|
||||
-49.4 26 -47.5 19.9 Khayyaban to Dunes End Cottages
|
||||
-49.4 26 -54.7 40.2 Khayyaban to Spire Hills Settlement
|
||||
-60.8 80.3 -74.5 65.9 Mayoi to Lugian Meadows Settlement
|
||||
-60.8 80.3 -68 78 Mayoi to Vesayan Overlook
|
||||
-60.8 80.3 -49.4 84.8 Mayoi to Meditation Meadow
|
||||
2.2 50.4 -8.9 64.5 Lytelthorpe to Maedew
|
||||
45.4 -42.3 35.8 -39.1 Plateau to Plateau Hollow Settlement
|
||||
45.4 -42.3 53.2 -36.2 Plateau to Lithaenean Cottages
|
||||
45.4 -42.3 57.5 -52.8 Plateau to Adams` Beach Portal
|
||||
-74.8 17.8 -89.5 31 Qalaba'r to Brigands Bay Settlement
|
||||
8.7 60.9 -0.4 68.2 Rithwic to Siege Road Settlement
|
||||
8.7 60.9 6.3 62.9 Rithwic to Gaerwel Edge Settlement
|
||||
8.7 60.9 6.7 54.7 Rithwic to Meridian Cottages
|
||||
8.7 60.9 12.9 52.9 Rithwic to Leafdawning Settlement
|
||||
-0.9 19 -7 22.3 Samsur to Janaa Ridge Settlement
|
||||
-0.9 19 1.6 36.1 Samsur to Adventurer`s Haven Cottages Portal
|
||||
-0.9 19 -12 23.6 Samsur to Yushad Ridge Cottages
|
||||
-0.9 19 -6.5 15.5 Samsur to Samsur Butte Cottages
|
||||
-27.2 59.9 -27.8 46.8 Sawato to Blackmire Edge Cottages Portal
|
||||
-27.2 59.9 -27 43.3 Sawato to Jinianshi Portal
|
||||
-27.2 59.9 -27.6 63.9 Sawato to East Sawato Settlement Portal
|
||||
-27.2 59.9 -31.7 63.3 Sawato to Sawato Foothills Settlement Portal
|
||||
-27.2 59.9 -30.8 53.5 Sawato to East Sawato Cottages Portal
|
||||
-27.2 59.9 -39 55.4 Sawato to Ayn Tayan Portal
|
||||
-31.3 72.6 -29.3 70 Shoushi to Chi Zou Cottages Portal
|
||||
-31.3 72.6 -28.2 75.1 Shoushi to Aimaru Plains Cottages Portal
|
||||
-31.3 72.6 -22.2 73.5 Shoushi to Mosswart Place Cottages Portal
|
||||
69.6 -20.2 62.8 -0.1 Stonehold to Lake Nemuel Settlement
|
||||
69.6 -20.2 77.8 -44.2 Stonehold to Woodshore Cottages
|
||||
69.6 -20.2 76.7 -36.1 Stonehold to Sonel
|
||||
69.6 -20.2 82.4 -43.5 Stonehold to Desolation Beach
|
||||
-30.5 94.5 -12.8 77.2 Tou-Tou to Dryreach Beach Cottages Portal
|
||||
-30.5 94.5 -16.7 77.1 Tou-Tou to Ariake Portal
|
||||
-30.5 94.5 -38.4 92.1 Tou-Tou to Tou-Tou Penninsula Cottages Portal
|
||||
-22.4 0.2 -7.1 -2.7 Yaraq to Aqalah Portal
|
||||
-22.4 0.2 -26.6 1.5 Yaraq to South Yaraq Cottages Portal
|
||||
-22.4 0.2 -25.4 10.4 Yaraq to Wi Badlands Settlement Portal
|
||||
-22.4 0.2 -33 4.5 Yaraq to Ijaniya Portal
|
||||
-10.3 45.7 -9 41.8 Yanshi to Liang Chi Settlement Portal
|
||||
-10.3 45.7 -12.1 63.5 Yanshi to Broadacre Cottages Portal
|
||||
-10.3 45.7 -15.9 60.7 Yanshi to Imuth Maer Cottages Portal
|
||||
-10.3 45.7 -23.9 44.4 Yanshi to Swamp Temple Place Portal
|
||||
-10.3 45.7 -19 44.4 Yanshi to Yanshi Namoon North Portal
|
||||
-10.3 45.7 -15.2 41 Yanshi to Faranar Foothills Portal
|
||||
12.7 -1.7 18.8 4.2 Zaikhal to New Suntik
|
||||
12.7 -1.7 30.9 9 Zaikhal to Majestic Hill Cottages
|
||||
12.7 -1.7 25.5 6.7 Zaikhal to Maitland
|
||||
12.7 -1.7 19.2 -18.3 Zaikhal to Sanai
|
||||
12.7 -1.7 40.7 -5.5 Zaikhal to Tiofor Deeps
|
||||
-50.1 63.5 -45 63.3 Baishi to North Baishi Cottages
|
||||
-50.1 63.5 -49.7 40.2 Baishi to Oboro
|
||||
-24.9 29.8 -25.9 22.7 Uziz to West Uziz Settlement Portal
|
||||
-24.9 29.8 -23 37.2 Uziz to Arida Butte Portal
|
||||
-24.9 29.8 -16.9 37.2 Uziz to Broken Sword Bethel Settlement Portal
|
||||
-24.9 29.8 -19.5 32.9 Uziz to Narziz Cottages Portal
|
||||
-24.9 29.8 -21.9 29.9 Uziz to North Uziz Settlement Portal
|
||||
-72.7 14 -5.6 40 Desert Ridge Border
|
||||
-72.6 13.8 32.8 34.7 Portal to Hilltop
|
||||
40.2 35.1 46.5 40.5 Holtburg to West Holtburg Villas Portal
|
||||
27.9 29.5 63.2 16.9 Glenden Wood to Highland Manors
|
||||
45.4 -42.3 51.6 -50.2 Plateau to Rivermouth Villas
|
||||
32.9 59.4 35.6 65.5 Arwic to South Beach Pass Villas Portal
|
||||
32.9 59.4 54.4 59.5 Arwic to Far Claw Villas Portal
|
||||
40.2 -76.1 46.1 -89.8 Ahurenga Portal
|
||||
44.2 -78.4 44.1 -78.3 Aun Firanauri the Gate Keeper
|
||||
42.3 -77.9 42 -77.8 Base of the Cliffs Portal
|
||||
44.1 -77.8 43.9 -77.7 Base of the Timaru Plateau Portal
|
||||
40.6 -82.4 43.2 -66.8 Greenspire Portal
|
||||
40 -74.5 50.5 -68.2 Northern Manumet Plains Portal
|
||||
-62 -50 -62.1 -50.4 Small Black Hill Portal
|
||||
34.9 54.6 21.3 53.9 Abandoned Mines to Underground City
|
||||
69.6 -20.2 78.1 -16.9 Stonehold to Dires' Doors Estates
|
||||
-33.5 13.1 -29.5 18.8 Al-Arqas to Dry Bone Manors
|
||||
-33.5 13.1 -44 8.7 Al-Arqas to Pillars-on-the-Sea Cottages
|
||||
5.7 4.3 41.3 15.6 Al-Jalima to Bucolic Villas
|
||||
5.7 4.3 -0.6 -1.2 Al-Jalima to Midsong Cottages
|
||||
5.7 4.3 -0.1 8.5 Al-Jalima to Jackcat Canyon
|
||||
5.7 4.3 11.1 23.5 Al-Jalima to Dillo Butte Settlement
|
||||
-50.1 63.5 -47.9 51.1 Baishi to Ring of Crystals Estates
|
||||
-50.1 63.5 -52.8 52.9 Baishi to Mage`s Pass
|
||||
-50.1 63.5 -49.8 56.8 Baishi to West Baishi Settlement
|
||||
-50.1 63.5 -45.6 59.2 Baishi to Jai-Tan Dale
|
||||
-50.1 63.5 -60 44.4 Baishi to Tattered Ridge
|
||||
-50.1 63.5 -45.8 67.2 Baishi to Tanshi
|
||||
26.2 46.3 52.6 28 Cragstone to Ispan Hills
|
||||
26.2 46.3 73.1 61 Cragstone to Haliana
|
||||
17.5 61.5 -3.9 76.3 Eastham to Dryreach Beach Manors
|
||||
17.5 61.5 47.4 69.6 Eastham to Beach Pass Villas
|
||||
27.9 29.5 25.8 30 Glenden Wood to Iceea Hills Estates
|
||||
27.9 29.5 75.4 40.1 Glenden Wood to West Norstead
|
||||
-41.5 82.1 -44.6 75.3 Hebian-To to Sai-Nan
|
||||
-41.5 82.1 -40.6 69.3 Hebian-To to South Shoushi Villas
|
||||
-49.4 26 -60.9 24.9 Khayyaban to Brigand Sands Cottages
|
||||
-49.4 26 -51.1 36.2 Khayyaban to Kanasa
|
||||
-49.4 26 -56.9 32.2 Khayyaban to Plainsview Cottages
|
||||
-49.4 26 -41.2 26.8 Khayyaban to Bhah Dhah Villas
|
||||
2.2 50.4 6.4 49 Lytelthorpe to North Lytelthorpe Villas
|
||||
2.2 50.4 -3.5 64.7 Lytelthorpe to Riverbend Cottages
|
||||
2.2 50.4 -7.1 56.9 Lytelthorpe to Neu Gerz Villas
|
||||
2.2 50.4 5.7 36.9 Lytelthorpe to Enchanter's Meadow
|
||||
8.7 60.9 3.2 60.1 Rithwic to Slinker Meadows
|
||||
8.7 60.9 3 65.7 Rithwic to Siege Road Villas
|
||||
8.7 60.9 10.4 66.3 Rithwic to East Rithwic Estates
|
||||
8.7 60.9 11.9 48.1 Rithwic to West Rithwic Estates
|
||||
-0.9 19 -9 24.8 Samsur to Cactus Acres
|
||||
-0.9 19 7.4 24.6 Samsur to Greenswath
|
||||
-0.9 19 5.7 30.8 Samsur to Sand`s Edge
|
||||
-0.9 19 4.6 20.7 Samsur to Nal Wadi Cottages
|
||||
-0.9 19 5 16.2 Samsur to Stone Scar Settlement
|
||||
-0.9 19 -9.5 33.3 Samsur to Yinar
|
||||
-0.9 19 -9.4 11.4 Samsur to Naqut Dreams Villas
|
||||
-74.8 17.8 -63.1 35.4 Qalaba`r to Ro-Nan
|
||||
-74.8 17.8 -67.6 14.6 Qalaba`r to Qalaba`r Seaside Villas
|
||||
-74.8 17.8 -60.5 18.5 Qalaba`r to Villalabar
|
||||
-74.8 17.8 -66.4 21.8 Qalaba`r to Qalabar Oasis Settlement
|
||||
-74.8 17.8 -81.9 17.1 Qalaba`r to Simda`r Villas
|
||||
-27.2 59.9 -21.9 65.6 Sawato to Sclavavania Portal
|
||||
-27.2 59.9 -15.8 72.9 Sawato to Narsys Portal
|
||||
-27.2 59.9 -21.6 60.9 Sawato to Mire Hill Portal
|
||||
-27.2 59.9 -19.8 55.9 Sawato to North Sawato Villas Portal
|
||||
-31.3 72.6 -36.7 68.5 Shoushi to Shou-Zin Portal
|
||||
-24.9 29.8 -9.6 4.6 Uziz to Arrak Portal
|
||||
-24.9 29.8 -0.2 30.4 Uziz to Charbone Ridge Portal
|
||||
-22.4 0.2 -15 -2.7 Yaraq to North Yaraq Villas Portal
|
||||
-10.3 45.7 -14.6 66.4 Yanshi to Crescent Lane Cottages Portal
|
||||
-10.3 45.7 93.9 -5.9 Yanshi to Northwater Cottages Portal
|
||||
-10.3 45.7 -21.9 41 Yanshi to West Yanshi Namoon Portal
|
||||
-10.3 45.7 -15.1 55.6 Yanshi to Snakehead Portal
|
||||
-10.3 45.7 31.3 36.2 Yanshi to Taralla Portal
|
||||
12.7 -1.7 22.1 0.7 Zaikhal to Helms Villas
|
||||
12.7 -1.7 15 -6.4 Zaikhal to Sharvale
|
||||
12.7 -1.7 24.9 -23.9 Zaikhal to East Danby
|
||||
45.4 -42.3 51.9 -45.6 Plateau to Auralla Settlement
|
||||
45.4 -42.3 76 35.3 Plateau to Zatara
|
||||
45.4 -42.3 23.1 -54.2 Plateau to Dire's Edge
|
||||
66.3 14.3 71.1 43.7 Crater to Bandit Road Villas Portal
|
||||
66.3 14.3 78.3 1 Crater to Stone Triad Dell Portal
|
||||
66.3 14.3 77.6 6.4 Crater to Frosty Dale Cottages Portal
|
||||
66.3 14.3 80 11.3 Crater to Greenvale Settlement Portal
|
||||
-82.9 48.2 -84.7 51.5 Kara to Ishilai Inlet Villas Portal
|
||||
-54.6 62.7 -86.2 39.6 South Shore Heights Portal
|
||||
-33.5 13.1 -12.1 14.4 Al-Arqas to Al-Nosaj
|
||||
-33.5 13.1 -14.5 9.6 Al-Arqas to Bleached Skull Wastes Settlement
|
||||
-33.5 13.1 -15.2 13.7 Al-Arqas to Desert Mirage Cottages
|
||||
-33.5 13.1 28.2 -25.4 Al-Arqas to Tarn Vinara Villas
|
||||
-33.5 13.1 -22.3 11.1 Al-Arqas to Djinaya Wind Cottages
|
||||
-33.5 13.1 -21.6 15.2 Al-Arqas to Hamud Cottages
|
||||
5.7 4.3 24.1 -19.1 Al-Jalima to Fearnot Valley Cottages
|
||||
32.9 59.4 40 63.2 Arwic to Lost Wish Cottages Portal
|
||||
32.9 59.4 72 52.1 Arwic to Norvale Portal
|
||||
32.9 59.4 53.5 41.7 Arwic to Bleak Valley Portal
|
||||
32.9 59.4 68.2 40.7 Arwic to Alvador Portal
|
||||
32.9 59.4 41 60.7 Arwic to Eotensfang Cottages Portal
|
||||
-50.1 63.5 -44.7 49.6 Baishi to Jasmine Meadow
|
||||
-50.1 63.5 -54.4 43.1 Baishi to Shara
|
||||
26.2 46.3 19.3 26.4 Cragstone to Lost Realm Cottages
|
||||
26.2 46.3 19.8 39.1 Cragstone to Meerthus Square
|
||||
26.2 46.3 20.1 33.6 Cragstone to Solstice Hill
|
||||
27.9 29.5 46.5 10.6 Glenden Wood to Firedew
|
||||
27.9 29.5 30.6 14.6 Glenden Wood to Mistdweller Villas Portal
|
||||
27.9 29.5 23.3 26.5 Glenden Wood to Auroch Pasture Estates
|
||||
27.9 29.5 45.7 14.6 Glenden Wood to Pine Hillock Settlement
|
||||
27.9 29.5 18.2 22.7 Glenden Wood to Redrock Cottages
|
||||
27.9 29.5 14.7 19.4 Glenden Wood to Bellig Mesa Cottages
|
||||
-41.5 82.1 58.6 -41.6 Hebian-To to Pine Deep
|
||||
-41.5 82.1 -25.7 79.4 Hebian-To to Stoneport Villas
|
||||
-41.5 82.1 -22.4 68.7 Hebian-To to San-Chin
|
||||
-41.5 82.1 -45.4 83.1 Hebian-To to South Hebian-To Estates
|
||||
8.7 60.9 9.6 36.9 Rithwic to King Pwyll Square
|
||||
-27.2 59.9 -34.3 52.7 Sawato to Lo-Han Portal
|
||||
-27.2 59.9 -35.2 46.6 Sawato to Zin-Dai Portal
|
||||
-27.2 59.9 -38.2 43.3 Sawato to Empyrean Fields Cottages Portal
|
||||
-24.9 29.8 -34.3 29.3 Uziz to South Uziz Villas Portal
|
||||
-24.9 29.8 -13.8 26.5 Uziz to Vulture's Eye Villas Portal
|
||||
17.5 61.5 7.1 -9.1 Eastham to Desert Boundary Cottages
|
||||
17.5 61.5 14.6 30.5 Eastham to Hermit Hill Cottages
|
||||
-60.8 80.3 96.3 7.1 Mayoi to Point Tremblant
|
||||
-60.8 80.3 -62.3 68.9 Mayoi to Font Alpa
|
||||
-60.8 80.3 -61.1 73.7 Mayoi to West Mayoi Mountain Villas
|
||||
-60.8 80.3 -78.4 60.2 Mayoi to Xinh
|
||||
-74.8 17.8 83.2 35.4 Qalaba'r to Northreach
|
||||
-74.8 17.8 -87.2 3.5 Qalaba'r to Land Bridge Villas
|
||||
-74.8 17.8 -82.4 31.4 Qalaba'r to Linvak Tukal Foothills Settlement
|
||||
-74.8 17.8 -75.8 37 Qalaba`r to Southern Park
|
||||
-74.8 17.8 -85.7 17 Qalaba`r to Stormbrow
|
||||
69.6 -20.2 88.2 -13.4 Stonehold to Seaview Ridge Cottages
|
||||
69.6 -20.2 84 -1.6 Stonehold to Wisp Lake Cottages
|
||||
69.6 -20.2 81 -11.2 Stonehold to Lord Cambarth Villas
|
||||
69.6 -20.2 60.2 -23.9 Stonehold to Verena
|
||||
69.6 -20.2 59.3 -19.1 Stonehold to Hidden Valley Portal
|
||||
69.6 -20.2 83.4 -40.3 Stonehold to Empyrean Shore Villas
|
||||
69.6 -20.2 67.5 -16.8 Stonehold to Laiti`s Villa
|
||||
69.6 -20.2 81.8 -17.7 Stonehold to Lightbringer Dale Cottages
|
||||
-30.46586 94.56508 85.3 -8.8 Tou-Tou to Snowy Valley Portal
|
||||
-30.5 94.5 -42.2 90.9 Tou-Tou to Tou-Tou Road Villas Portal
|
||||
-30.5 94.5 -48.9 88.5 Tou-Tou to Nan-Zari Portal
|
||||
-30.5 94.5 61.5 -52.3 Tou-Tou to Westshore Cottages Portal
|
||||
-30.5 94.5 -46.3 87.3 Tou-Tou to Ong-Hau Village Portal
|
||||
-24.9 29.8 -13.7 17.3 Uziz to Sand Kings Cottages Portal
|
||||
-24.9 29.8 -16.1 21.4 Uziz to Djebel al-Nar Cottages Portal
|
||||
-10.3 45.7 -31.8 46.6 Yanshi to Li-Po Cottages Portal
|
||||
12.7 -1.7 9.3 -12.7 Zaikhal to Loredane Villas
|
||||
12.7 -1.7 27 -18.2 Zaikhal to Embara
|
||||
12.7 -1.7 16.9 -9.5 Zaikhal to West Zaikhal Freehold
|
||||
12.7 -1.7 14.6 22.7 Zaikhal to Stonebend Cottages
|
||||
-82.9 48.2 -59.9 35.3 Kara to Ikama Cottages Portal
|
||||
-82.9 48.2 -72 42.4 Kara to Lake Thrasyl Cottages Portal
|
||||
66.3 14.3 68.1 36.7 Crater to Bretslef Cottages Portal
|
||||
66.3 14.3 52.4 5.4 Crater to Ianna Portal
|
||||
66.3 14.3 92.2 9.9 Crater to Celcynd Cottages Portal
|
||||
45.4 -42.3 48.8 -43.9 Plateau to Fadsahil Settlement
|
||||
45.4 -42.3 38.5 -12.7 Plateau to East Morntide Villas
|
||||
45.4 -42.3 35.2 -36.1 Plateau to Yee Villas
|
||||
45.4 -42.3 47.1 -39.3 Plateau to Rhynntal Cottages
|
||||
45.4 -42.3 52.1 -39.9 Plateau to Rahvard Square
|
||||
-50.1 63.5 -46.6 41.5 Baishi to Kelnen Village
|
||||
-50.1 63.5 -48.8 69.7 Baishi to Lin Kiln Park
|
||||
26.2 46.3 17.3 36.1 Cragstone to Tinkelo Hold Villas
|
||||
17.5 61.5 56.9 -27.1 Eastham to Asandra Cottages
|
||||
17.5 61.5 34.7 -49 Eastham to Sliver-of-Blue Cottages
|
||||
17.5 61.5 69.6 60.9 Eastham to P`rnelle Acres
|
||||
17.5 61.5 84.9 1.6 Eastham to Midhill Cottages
|
||||
2.2 50.4 5.5 40.8 Lytelthorpe to Osric Cottages
|
||||
2.2 50.4 9.5 40.7 Lytelthorpe to Darawyll Village
|
||||
2.2 50.4 -0.9 39.9 Lytelthorpe to Asbel Domain
|
||||
2.2 50.4 -7.2 60.5 Lytelthorpe to Jin-Lai Stronghold
|
||||
2.2 50.4 -1.7 33.6 Lytelthorpe to Devana
|
||||
45.4 -42.3 50.3 -26.4 Plateau to Aloria Portal
|
||||
45.4 -42.3 23.2 -46.3 Plateau to Last-Stop-Before-Dires Villas
|
||||
45.4 -42.3 56 -35.1 Plateau to Stormtree Villas
|
||||
45.4 -42.3 55.2 -49.6 Plateau to Caerlin Cottages
|
||||
8.7 60.9 64.1 29.5 Rithwic to Glystaene Cottages
|
||||
8.7 60.9 66.5 57.6 Rithwic to New Cannthalo
|
||||
-0.9 19 -6.4 4.2 Samsur to Return of Mumiyah Cottages
|
||||
-0.9 19 24.2 10.5 Samsur to Dovetail Valley Villas
|
||||
-0.9 19 15.3 26.3 Samsur to Maythen Geroyu Villas
|
||||
-0.9 19 11 26.4 Samsur to Palm-of-Stone Villas
|
||||
-33.5 13.1 -21.7 18.4 Al-Arqas to Ahr-Zona
|
||||
5.7 4.3 7.7 17.7 Al-Jalima to East Al-Jalima Villas
|
||||
5.7 4.3 -54.4 15.4 Al-Jalima to Mahara Cottages
|
||||
5.7 4.3 25 -3.9 Al-Jalima to Mimiana Villas
|
||||
32.9 59.4 83.3 28.8 Arwic to Dagger Vale Portal
|
||||
66.3 14.3 26.5 -36.7 Crater to Merak Portal
|
||||
66.3 14.3 53.6 10.4 Crater to New Nesortania Portal
|
||||
66.3 14.3 69.5 -4 Crater to Anadil Portal
|
||||
27.9 29.5 34.4 -11.9 Glenden Wood to Genem Causland
|
||||
27.9 29.5 28.6 17.7 Glenden Wood to Howling Wolf Villas
|
||||
27.9 29.5 24.8 15 Glenden Wood to Soltan Villas
|
||||
-41.5 82.1 27.9 -28.8 Hebian-To to Tia-Leh Homestead
|
||||
-60.8 80.3 26.4 -33.6 Mayoi to Inquisitor's Dale Cottages
|
||||
-60.8 80.3 74.4 -46.3 Mayoi to Lady Maila Estates
|
||||
-60.8 80.3 12 -15.9 Mayoi to Shore Vista Cottages
|
||||
-74.8 17.8 84.1 -31.1 Qalaba'r to Azaroth Cottages Portal
|
||||
-74.8 17.8 -68.8 30.6 Qalaba`r to Mattekar Slopes Cottages
|
||||
-74.8 17.8 -12.6 0.9 Qalaba`r to Sand Shallow Cottages
|
||||
-74.8 17.8 -86.4 37.7 Qalaba`r to Scimitar Lake Cottages
|
||||
-0.9 19 91.3 5.4 Samsur to Tharesun
|
||||
-24.9 29.8 -8.8 28 Uziz to Drytree Settlement Portal
|
||||
-24.9 29.8 -28.8 21.1 Uziz to Thasali Cottages Portal
|
||||
-82.9 48.2 73.6 -42.3 Kara to Brazenn Domain Portal
|
||||
-82.9 48.2 32.9 -22.2 Kara to Direvale Villas Portal
|
||||
-49.4 26 -47.1 16.9 Khayyaban to Al-Mar Oasis
|
||||
-49.4 26 -56.9 20.6 Khayyaban to Avatania Cottages
|
||||
-49.4 26 30.4 -18.3 Khayyaban to Rethux Vale
|
||||
-49.4 26 -43.9 35.2 Khayyaban to Sonpay
|
||||
-27.2 59.9 -35.9 40.8 Sawato to Kuyiza Portal
|
||||
-27.2 59.9 -12.7 72.8 Sawato to South Siege Villas Portal
|
||||
-27.2 59.9 -18.2 63.3 Sawato to Village Quan Portal
|
||||
69.6 -20.2 42.5 4.7 Stonehold to Durglen
|
||||
69.6 -20.2 35.3 -15.1 Stonehold to East Morntide Settlement
|
||||
69.6 -20.2 64 -16.7 Stonehold to Ice`s Edge Cottages
|
||||
69.6 -20.2 83.1 -28 Stonehold to Northfire Estates
|
||||
69.6 -20.2 54.4 -19.9 Stonehold to Regina Cottages
|
||||
69.6 -20.2 81.6 -20.7 Stonehold to Thyrinn Cant Cottages
|
||||
12.7 -1.7 25.7 -0.8 Zaikhal to Bright Blade Cottages
|
||||
-10.3 45.7 -4.7 44.6 Yanshi to Jenshi Cottages Portal
|
||||
5.7 4.3 23.2 -42.3 Al-Jalima to Mirthless Dale
|
||||
5.7 4.3 15.3 -17.5 Al-Jalima to Nidal-Taraq Villas
|
||||
32.9 59.4 -84.7 12.8 Arwic to Artifice Cottages Portal
|
||||
32.9 59.4 64.9 37.6 Arwic to Baron's Domain Portal
|
||||
32.9 59.4 72.1 55.2 Arwic to Broken Haft Vale Portal
|
||||
26.2 46.3 59.3 40.9 Cragstone to Colier View Hill
|
||||
26.2 46.3 92.9 -2.4 Cragstone to Far Horizon Cottages
|
||||
66.3 14.3 28.8 -36.8 Crater to Adept's Domain Portal
|
||||
66.3 14.3 58.5 -0.7 Crater to Mountain Retreat Cottages Portal
|
||||
66.3 14.3 75.3 27.2 Crater to Patron's Honor Cottages Portal
|
||||
66.3 14.3 80.8 -35.1 Crater to Sweet Maple Cottages Portal
|
||||
66.3 14.3 62.6 3.2 Crater to Windrune Cottages Portal
|
||||
-41.5 82.1 64.8 72.1 Hebian-To to Arrowdale Cottages
|
||||
-82.9 48.2 28.1 -22.4 Kara to Harmonious Blade Cottages Portal
|
||||
-82.9 48.2 23.3 -49.6 Kara to Peril's Edge Cottages Portal
|
||||
-49.4 26 -39.9 33 Khayyaban to Ardent Realm
|
||||
-49.4 26 -40 36.1 Khayyaban to Shield of Ispar Villas
|
||||
45.4 -42.3 30.6 -45.4 Plateau to Hero`s Vale
|
||||
45.4 -42.3 45.6 -36 Plateau to Rytheran Dale
|
||||
45.4 -42.3 37.6 -49 Plateau to Wilomine Villas
|
||||
45.4 -42.3 31.1 -28.8 Plateau to Wolfenvale
|
||||
-74.8 17.8 30.5 -40.7 Qalaba'r to Axefall Glen Portal
|
||||
-24.9 29.8 8.9 32 Uziz to Demonsbane Cottages Portal
|
||||
-10.3 45.7 27.9 -3.8 Yanshi to Blazing Wand Villas Portal
|
||||
12.7 -1.7 36 -24 Zaikhal to Deepvale Cottages
|
||||
12.7 -1.7 17.6 -12.7 Zaikhal to Gharu`n Victory Villas
|
||||
-39.8 -54.6 -8.1 74 Town of Dryreach Portal
|
||||
85.8 -27.6 68.7 -21.8 Stonehold Portal
|
||||
5.7 4.3 34.4 0.7 Al-Jalima to Reviled Maw Cottages
|
||||
5.7 4.3 36 4.1 Al-Jalima to Tusker Notch
|
||||
5.7 4.3 13.6 16.2 Al-Jalima to Unified Heart Villas
|
||||
32.9 59.4 57.8 2.4 Arwic to Defiant Prey Cottages Portal
|
||||
32.9 59.4 50.4 69.7 Arwic to Hand-on-Sword Cottages Portal
|
||||
32.9 59.4 53.7 70.4 Arwic to Jeweled Thorn Estates Portal
|
||||
32.9 59.4 51.9 67.2 Arwic to Secluded Valley Cottages Portal
|
||||
66.3 14.3 55.2 4.8 Crater to North Pass Hollow Cottages Portal
|
||||
66.3 14.3 62.5 8.3 Crater to Shaky Ledge Cottages Portal
|
||||
66.3 14.3 59 7.9 Crater to Stonerune Cottages Portal
|
||||
27.9 29.5 38.7 -9.6 Glenden Wood to Amarand Villas
|
||||
27.9 29.5 37.8 0.7 Glenden Wood to Lanadryll Cottages
|
||||
-41.5 82.1 39.5 -22.5 Hebian-To to Majestic Saddle Cottages
|
||||
-49.4 26 39.3 -29.6 Khayyaban to Rending Talon Cottages
|
||||
-49.4 26 35.7 -32.7 Khayyaban to Stone Scythe Stronghold
|
||||
-60.8 80.3 29.5 -33.5 Mayoi to Shield of Valor Cottages
|
||||
-60.8 80.3 60.8 19.3 Mayoi to Songview
|
||||
45.4 -42.3 39.2 -32.6 Plateau to Two Hills Cottages
|
||||
45.4 -42.3 42.4 -29.5 Plateau to Tyrrin Cottages
|
||||
-74.8 17.8 -61.7 14.5 Qalaba`r to Ebbing Tide Villas
|
||||
-74.8 17.8 -60.1 32.1 Qalaba'r to Gredaline Villas
|
||||
-74.8 17.8 31.2 -11.9 Qalaba`r to Sanam Batal Villas
|
||||
8.7 60.9 65 65.7 Rithwic to Isparian Flame Estates
|
||||
-0.9 19 39.3 4 Samsur to Charnhold
|
||||
-0.9 19 35.3 -8.7 Samsur to Darasa Villas
|
||||
-0.9 19 1.6 21.7 Samsur to Stone Face Oasis Villas
|
||||
-27.2 59.9 61.5 65.6 Sawato to Explorer's Villas Portal
|
||||
-30.5 94.5 42.5 -26.3 Tou-Tou to Dame Tolani Villas Portal
|
||||
-24.9 29.8 32.8 -34.3 Uziz to Hopevale Portal
|
||||
-24.9 29.8 32.1 -15.1 Uziz to Morntide Ascent Cottages Portal
|
||||
-10.3 45.7 38.4 -26.3 Yanshi to Firesong Cottages Portal
|
||||
-38.1 -60.3 2.3 -0.8 Precarious Sojourn Exit Portal
|
||||
2.3 -0.8 -38.1 -60.3 Precarious Sojourn Portal
|
||||
-49.4 26 -56.9 35.3 Khayyaban to Erevana Villas
|
||||
11 14.7 -88.3 -64.5 Sylsfear to Direlands Midland Portal
|
||||
-90.2 -64.5 -78.7 -73.4 Direlands Desert Edge Portal
|
||||
-88.5 -66.8 -84.2 -34.4 South Direlands Portal
|
||||
-80.1 -42.4 -84.2 -34.4 South Direlands Portal
|
||||
-80.2 -42.3 24.3 -53.8 North Direlands Portal
|
||||
-78 -48.7 -84.2 -34.4 South Direlands Portal
|
||||
-78.1 -48.6 -5.6 40 Desert Ridge Border
|
||||
-21.5 -74.7 -53 61.1 Ridge Tower
|
||||
5.5 -87.5 -48 -65 Obsidian Rim Portal
|
||||
-88.2 -64.6 -38.9 82.6 Hebian-To Portal
|
||||
-9.4 -71.9 23.6 62.5 Beachside
|
||||
-43.8 -83 26 48.2 Cragstone Portal
|
||||
-49.4 26 -43.9 11.8 Khayyaban to Desert Vanguard Cottages
|
||||
46.8 30.5 70.5 -8.1 Access to Crystal Mines
|
||||
70.5 -8.1 41.6 33.7 Holtburg Portal
|
||||
70.5 -8.3 70.5 -8.1 Access to Crystal Mines
|
||||
-98 -94.7 -48 -65 Obsidian Rim Portal
|
||||
19.7 17.8 20.8 18.5 South Zabool
|
||||
19.5 17.5 19.6 17 Base of Mt. Alphus
|
||||
19.5 16.9 20.3 15.8 Mt. Alphus Valley
|
||||
20.2 15 19.6 17 Base of Mt. Alphus
|
||||
17.3 16 16.3 14.7 North Gemm
|
||||
16.3 14.7 17.3 16 South Bellig
|
||||
15.7 14.2 14.6 13.2 North Dalt
|
||||
14.6 13.2 15.7 14.2 South Gemm
|
||||
14.1 12.7 12.7 11.8 North Syliph
|
||||
12.7 11.8 14.1 12.7 South Dalt
|
||||
11.6 12.3 11.2 12.2 Mt. Syliph Plain
|
||||
11.2 12.2 11.6 12.3 Base of Mt. Syliph
|
||||
-65.7 84.9 -72.5 81.3 Vesayen Isles Portal
|
||||
-53.1 61 -94.8 -9.7 Drunken Madman to Ulgrim's Island
|
||||
27.2 47.3 28.5 48 River Bridge Portal
|
||||
28.5 48 27.1 47.4 River Bridge Portal
|
||||
-69.3 94.5 -84.2 -34.4 Jungle Shadows to South Direlands Portal
|
||||
-69.3 94.5 24.4 -53.8 Jungle Shadows to North Direlands Portal
|
||||
22.9 -28.8 65 49.3 Desert March to Bandit Castle Portal
|
||||
6.5 -3.6 65 49.3 Desert March to Bandit Castle Portal
|
||||
22.9 -28.8 -48 -65 Desert March to Obsidian Rim Portal
|
||||
6.5 -3.6 -48 -65 Desert March to Obsidian Rim Portal
|
||||
6.5 -3.6 24.4 -53.8 Desert March to North Direlands Portal
|
||||
22.9 -28.8 24.4 -53.8 Desert March to North Direlands Portal
|
||||
22.9 -28.8 -62.4 -52.3 Desert March to Black Hill Portal
|
||||
6.5 -3.6 -62.4 -52.3 Desert March to Black Hill Portal
|
||||
6.5 -3.6 56.8 12.9 Desert March to Southern Mt. Esper Portal
|
||||
22.9 -28.8 56.8 12.9 Desert March to Southern Mt. Esper Portal
|
||||
22.9 -28.8 -84.2 -34.4 Desert March to South Direlands Portal
|
||||
6.5 -3.6 -84.2 -34.4 Desert March to South Direlands Portal
|
||||
21 69.3 -38.6 82.1 Hebian-To Portal
|
||||
21 69.1 26 48.2 Cragstone Portal
|
||||
29.9 27.4 26 48.2 Effigy Foundry to Cragstone
|
||||
25.7 49.2 26 48.2 Effigy Foundry to Cragstone
|
||||
17.7 63.3 26 48.2 Effigy Foundry to Cragstone
|
||||
13.8 0.6 26 48.2 Effigy Foundry to Cragstone
|
||||
7.4 4.8 26 48.2 Effigy Foundry to Cragstone
|
||||
-25.1 28.3 26 48.2 Effigy Foundry to Cragstone
|
||||
-28.1 95.8 26 48.2 Effigy Foundry to Cragstone
|
||||
-39.4 83.1 26 48.2 Effigy Foundry to Cragstone
|
||||
-47.6 24.7 26 48.2 Effigy Foundry to Cragstone
|
||||
-54.4 73.2 26 48.2 Effigy Foundry to Cragstone
|
||||
7.5 0.6 -88.3 -64.5 Carved Caves to Direland Midlands
|
||||
7.5 0.6 -75 19.6 Carved Caves to Qalaba'r
|
||||
-74.3 84.6 26 48.2 Effigy Foundry to Cragstone
|
||||
42.7 33.6 -51 81.7 Mannikin Foundry to Nanto
|
||||
10.5 58.3 -51 81.7 Mannikin Foundry to Nanto
|
||||
0.7 51.4 -51 81.7 Mannikin Foundry to Nanto
|
||||
-2.9 19.4 -51 81.7 Mannikin Foundry to Nanto
|
||||
-12.8 46.3 -51 81.7 Mannikin Foundry to Nanto
|
||||
-21.5 -1.7 -51 81.7 Mannikin Foundry to Nanto
|
||||
-31.2 13.8 -51 81.7 Mannikin Foundry to Nanto
|
||||
-33.4 72.9 -51 81.7 Mannikin Foundry to Nanto
|
||||
-52.5 82.1 -51 81.7 Mannikin Foundry to Nanto
|
||||
68.8 -21.6 -49.3 62.9 Mammet Foundry to Baishi
|
||||
44.2 -43.4 -49.3 62.9 Mammet Foundry to Baishi
|
||||
30.9 56.4 -49.3 62.9 Mammet Foundry to Baishi
|
||||
-14.9 5.8 -49.3 62.9 Mammet Foundry to Baishi
|
||||
-28.6 59.3 -49.3 62.9 Mammet Foundry to Baishi
|
||||
-49.4 62.5 -49.3 62.9 Mammet Foundry to Baishi
|
||||
-61.9 82 -49.3 62.9 Mammet Foundry to Baishi
|
||||
-74.1 92.3 -49.3 62.9 Mammet Foundry to Baishi
|
||||
-74.3 19.2 -49.3 62.9 Mammet Foundry to Baishi
|
||||
1.6 -72.1 1.7 -71.2 Colossus Foundry to Fort Tethana
|
||||
-60 -87.9 1.7 -71.2 Colossus Foundry to Fort Tethana
|
||||
-62 -51.3 1.7 -71.2 Colossus Foundry to Fort Tethana
|
||||
-83.3 47.1 1.7 -71.2 Colossus Foundry to Fort Tethana
|
||||
-74.1 19.2 28.9 26.3 Atrium Residential Halls to Glenden Wood
|
||||
29.7 27 28.9 26.3 Atrium Residential Halls to Glenden Wood
|
||||
-49.3 62.4 28.9 26.3 Atrium Residential Halls to Glenden Wood
|
||||
-49.3 62.4 -75 19.6 Atrium Residential Halls to Qalaba'r
|
||||
29.7 27 -75 19.6 Atrium Residential Halls to Qalaba'r
|
||||
-74.1 19.2 -75 19.6 Atrium Residential Halls to Qalaba'r
|
||||
-74.1 19.2 -49.3 62.9 Atrium Residential Halls to Baishi
|
||||
29.7 27 -49.3 62.9 Atrium Residential Halls to Baishi
|
||||
-49.3 62.4 -49.3 62.9 Atrium Residential Halls to Baishi
|
||||
0.6 51.6 -24.3 28.9 Haven Residential Halls to Uziz
|
||||
-24.9 28.3 -24.3 28.9 Haven Residential Halls to Uziz
|
||||
-28.2 95.6 -24.3 28.9 Haven Residential Halls to Uziz
|
||||
-28.2 95.6 1.9 51.9 Haven Residential Halls to Lytelthorpe
|
||||
-24.9 28.3 1.9 51.9 Haven Residential Halls to Lytelthorpe
|
||||
0.6 51.6 1.9 51.9 Haven Residential Halls to Lytelthorpe
|
||||
0.6 51.6 -30.4 94.7 Haven Residential Halls to Tou-Tou
|
||||
-24.9 28.3 -30.4 94.7 Haven Residential Halls to Tou-Tou
|
||||
-28.2 95.6 -30.4 94.7 Haven Residential Halls to Tou-Tou
|
||||
44 -43.1 -62.7 81.5 Oriel Residential Halls to Mayoi
|
||||
-47.4 25.1 -62.7 81.5 Oriel Residential Halls to Mayoi
|
||||
-61.8 81.6 -62.7 81.5 Oriel Residential Halls to Mayoi
|
||||
-61.8 81.6 44.5 -43.1 Oriel Residential Halls to Plateau
|
||||
-47.4 25.1 44.5 -43.1 Oriel Residential Halls to Plateau
|
||||
44 -43.1 44.5 -43.1 Oriel Residential Halls to Plateau
|
||||
44 -43.1 -47.6 26.7 Oriel Residential Halls to Khayyaban
|
||||
-47.4 25.1 -47.6 26.7 Oriel Residential Halls to Khayyaban
|
||||
-61.8 81.6 -47.6 26.7 Oriel Residential Halls to Khayyaban
|
||||
25.5 48.7 26 48.2 Sanctum Residential Halls to Cragstone
|
||||
13.4 0.6 26 48.2 Sanctum Residential Halls to Cragstone
|
||||
-39.6 83.5 26 48.2 Sanctum Residential Halls to Cragstone
|
||||
-39.6 83.5 14.3 1.3 Sanctum Residential Halls to Zaikhal
|
||||
13.4 0.6 14.3 1.3 Sanctum Residential Halls to Zaikhal
|
||||
25.5 48.7 14.3 1.3 Sanctum Residential Halls to Zaikhal
|
||||
25.5 48.7 -38.6 82.1 Sanctum Residential Halls to Hebian-to
|
||||
13.4 0.6 -38.6 82.1 Sanctum Residential Halls to Hebian-to
|
||||
-39.6 83.5 -38.6 82.1 Sanctum Residential Halls to Hebian-to
|
||||
-3.2 19.1 -53.9 74.3 Victory Residential Halls to Lin
|
||||
-48 24.5 -53.9 74.3 Victory Residential Halls to Lin
|
||||
-54.3 73.2 -53.9 74.3 Victory Residential Halls to Lin
|
||||
-54.3 73.2 -47.6 26.7 Victory Residential Halls to Khayyaban
|
||||
-48 24.5 -47.6 26.7 Victory Residential Halls to Khayyaban
|
||||
-3.2 19.1 -47.6 26.7 Victory Residential Halls to Khayyaban
|
||||
-3.2 19.1 -2.7 18.9 Victory Residential Halls to Samsur
|
||||
-48 24.5 -2.7 18.9 Victory Residential Halls to Samsur
|
||||
-54.3 73.2 -2.7 18.9 Victory Residential Halls to Samsur
|
||||
7.5 0.6 -76.5 -74.9 Carved Caves to Hall of the Lost Light
|
||||
-75.7 28.2 -77.8 28 Linvak Tukal Portal
|
||||
-75.8 83.1 68.7 -21.8 Stonehold Portal
|
||||
-75.8 83.1 16.9 63.5 Eastham Portal
|
||||
-75.8 83.1 -3.2 19 Samsur Portal
|
||||
-75.8 83.1 44.5 -43.1 Plateau Portal
|
||||
-75.8 83.1 -41.9 16.1 Xarabydun Portal
|
||||
-75.8 83.1 29.7 26.5 Glenden Wood Portal
|
||||
-75.8 83.1 33.3 56.6 Arwic Portal
|
||||
-75.8 83.1 -73 92 Freehold Portal
|
||||
-75.8 83.1 -47.4 25.5 Khayyaban Portal
|
||||
-75.8 83.1 -29.1 58.9 Sawato Portal
|
||||
-75.8 83.1 10.8 59.3 Rithwic Portal
|
||||
-75.8 83.1 1.1 51.7 Lytelthorpe Portal
|
||||
-75.8 83.1 -53.9 74.3 Lin Portal
|
||||
-75.8 83.1 -83.5 47.6 Kara Portal
|
||||
-75.8 83.1 -7.2 5 Al-Jalima Portal
|
||||
-75.8 83.1 -28.1 95.4 Tou-Tou Portal
|
||||
-75.8 83.1 -24.8 28.4 Uziz Portal
|
||||
-75.8 83.1 -74.6 84.2 Kryst Portal
|
||||
-75.8 83.1 -31.3 13.2 Al-Arquas Portal
|
||||
-18.6 -84.4 66.5 -26.7 Stonehold Valley Portal
|
||||
-18.6 -84.4 17 -58.3 Direlands North Landbridge Portal
|
||||
-18.6 -84.4 -83.3 -19.2 Direlands South Landbridge Portal
|
||||
-18.6 -84.4 -72.5 81.3 Vesayen Isles Portal
|
||||
-18.6 -84.4 -86.2 39.6 South Shore Heights
|
||||
-18.6 -84.4 34.5 42.1 Obsidian Span Portal
|
||||
-18.6 -84.4 -64 -65.3 Obsidian Plains Portal
|
||||
-18.6 -84.4 -70.9 -36.3 Direlands Southeast Shore Portal
|
||||
-18.6 -84.4 -59.7 -90 Darktide Festival Stone Portal
|
||||
-18.6 -84.4 -0.4 -80.1 Slaughterhouse Portal
|
||||
-18.6 -84.4 22.5 51.9 Isle of Tears Portal
|
||||
-18.6 -84.4 -62.4 -52.3 Black Hill Portal
|
||||
-18.6 -84.4 -21.5 -74.6 Walled Portals Portal
|
||||
-18.6 -84.4 -48 -65 Obsidian Rim Portal
|
||||
-83.4 89.8 -91.2 87.4 Portalling Device
|
||||
-53.1 61 -21.5 -74.6 Drunken Madman to Walled Fort
|
||||
-49.4 26 -39.9 23.2 Khayyaban to Sands-of-the-Skull Cottages
|
||||
76.6 -58.6 95.9 -56.8 Fiun Outpost Portal
|
||||
87.7 -69.7 90.7 -51.2 Plains of Ruin Portal
|
||||
75.3 -73.8 72.1 -60.9 Viamontian Garrison to Sanamar Portal
|
||||
95.6 -56.2 87.3 -70.8 Fiun Outpost to Silyun Portal
|
||||
-75 19.5 87.3 -70.8 Qalaba'r to Silyun
|
||||
76.6 -58.7 87.3 -70.8 Sanamar to Silyun Portal
|
||||
71.7 -61 79.2 -68 Beacon Tower
|
||||
75.9 -61.3 82.2 -74.2 Cataracts of Sabella
|
||||
79.2 -68 71.7 -61 Beacon Tower Exit
|
||||
89 -67.6 88.8 -67.9 Karlun's Fort Portal
|
||||
88.9 -67.5 89.2 -67.8 Karlun's Fort Exit Portal
|
||||
80.2 -67.8 71.7 -61 Beacon Tower Exit
|
||||
80.4 -68 71.7 -61 Beacon Tower Exit
|
||||
80.2 -68.2 71.7 -61 Beacon Tower Exit
|
||||
90.6 -51 87.3 -70.8 Silyun Portal
|
||||
-76 -67.1 66.6 49.9 Portal to Bandit Castle
|
||||
66.6 49.9 -76 -67.1 Keep Out!
|
||||
-41.9 16.1 -41.9 16.1 Xarabydun Surface Portal
|
||||
21.8 19.5 21.8 19.5 Base of Mount Zabool
|
||||
20.8 18.5 19.7 17.8 Mount Alphus
|
||||
26.3 63.9 -65.2 60.3 High Mountain Valley Portal
|
||||
26.3 63.9 33.3 66.6 Merchant Cellar to Arwic
|
||||
-60.3 -90.7 -87.6 -4.4 Gatekeepers Portal
|
||||
70.2 65.6 79 58.6 Vissidal Island Portal
|
||||
70.4 50.5 79.7 54.4 Temple of N'cthail
|
||||
80.2 54.4 70.3 50.4 Temple Exit
|
||||
85.1 57.5 79 58.6 Vissidal Island
|
||||
75.8 70.2 84.7 58.2 Dark Isle Portal
|
||||
5.7 4.3 20 10.4 Al-Jalima to Alfreth Ridge Cottages
|
||||
5.7 4.3 -12.1 -27 Al-Jalima to Al-Arqis Cottages
|
||||
5.7 4.3 1.7 -5.1 Al-Jalima to Bay of Sands
|
||||
2.2 50.4 -0.2 57.9 Lytelthorpe to East Lytelthorpe Settlement
|
||||
2.2 50.4 -4.4 48 Lytelthorpe to North Yanshi Plains Settlement
|
||||
2.2 50.4 -2.3 53.9 Lytelthorpe to South Lytelthorpe
|
||||
-60.5 78 -70.9 -36.3 Direlands Southeast Shore Portal
|
||||
40.1 60.3 32.8 34.7 Portal to Hilltop
|
||||
12.7 -1.7 31.3 -25.5 Zaikhal to Nalib Cavana Settlement
|
||||
-61.9 40 -65.2 60.3 Hidden Valley to High Mountain Valley
|
||||
-11.7 58 -61.4 -46.6 Halls of Metos (Imuth Maer Doquin)
|
||||
67.4 30.5 67.4 30.5 Portal to Bur
|
||||
16.2 69.3 21.3 69.2 Asheron's Castle
|
||||
-82.6 88.8 -62.3 96 Statue of Transport
|
||||
-58.9 -88.7 40.9 33.6 Holtburg Casino VIP Portal
|
||||
-58.9 -88.7 -34.2 73.6 Shoushi Casino VIP Portal
|
||||
-58.9 -88.7 -21.5 -0.8 Yaraq Casino VIP Portal
|
||||
17.6 63.5 58.5 -10.3 Patriarch's Valley Portal
|
||||
-14.6 -62.2 -14.6 -62 Resonant Portal
|
||||
-10.6 17.1 -10.6 17.1 Resonant Portal
|
||||
-98 -94.7 -48 -65 Portal To The Obsidian Rim
|
||||
-87.5 -67.2 -87.5 -67.2 Tree Portal
|
||||
-89.5 -57.4 32.8 34.7 Portal to Hilltop
|
||||
17.1 63 57.1 47.8 Lightning Ziggurat
|
||||
17.1 63 57.1 47.8 Frost Ziggurat
|
||||
17.1 63 57.1 47.7 Acid Ziggurat
|
||||
17.1 63 57.1 47.8 Fire Ziggurat
|
||||
-100.51667 8.65833 41.9 -82.2 Facility Hub (N W) Abandoned Tumerok Site
|
||||
-100.4822 8.58218 45 -76.3 Facility Hub (N W) An Olthoi Soldier Nest
|
||||
-100.51667 8.575 52.6 -73.1 Facility Hub (N W) Ancient Empyrean Grotto
|
||||
-100.51673 8.61639 43.8 25 Facility Hub (W)(R 1 (35) C) to Banderling Camp
|
||||
-100.51614 8.89692 -29.1 50.6 Facility Hub (E)(L 2 (25) C L) to Banderling Conquest Dungeo
|
||||
-100.64172 8.53334 17.7 15.9 Facility Hub (W)(L 2 (40) L) to Bellig Tower Base
|
||||
-100.55877 8.53326 -21.8 48 Facility Hub (W)(R 2 (45) R) to Blackmire Temple
|
||||
-100.68343 8.49261 -24.5 76.7 Facility Hub (W)(L 2 (40) C) to Castle of Baron Nuvillus
|
||||
-100.55817 8.94999 17.4 32.8 Facility Hub (E)(L 2 (25) R) to Catacombs of the Forgotten
|
||||
-100.51663 8.78329 57.1 37.7 Facility Hub (E)(L 1 (15) C) to Colier
|
||||
-100.475 8.61667 46.8 -67.8 Facility Hub (N W) Crumbling Empyrean Mansion
|
||||
-100.64161 8.95 24.29353 43.22039 Facility Hub (E)(R 2 (20) L) to Dangerous Cave
|
||||
-100.64167 8.45 -6.6 70.7 Facility Hub (W)(L 2 (40) R) to Dryreach
|
||||
-100.50647 8.90832 16.9 63.5 Facility Hub (E)(L 2 (25) C C)to Eastham
|
||||
-100.64167 8.825 29.9 26.3 Facility Hub (E)(R 1 (10) L) to Glendon Wood
|
||||
-100.55864 8.74153 -27.7431 71.62985 Facility Hub (E)(L 1 (15) L) to Green Mire Grave
|
||||
-100.55828 8.86667 77.4 -59.8 Facility Hub (E)(L 2 (25) L) to Fledgemaster's Camp
|
||||
-100.68333 8.78333 -8.8 53.6 Facility Hub (E)(R 1 (10) C) to Folthid Estate
|
||||
-100.55833 8.825 18.7 1.8 Facility Hub (E)(L 1 (15) R) to Halls of the Helm
|
||||
-100.64163 8.57496 6.5 43.9 Facility Hub (W)(L 1 (30) R)to Haunted Mansion
|
||||
-100.64167 8.86667 35.8 33.5 Facility Hub (E)(R 2 (20) R) to Hunter's Leap
|
||||
-100.68333 8.61667 41.1 57 Facility Hub (W)(L 1 (30) C) to Mite Maze
|
||||
-100.64167 8.74167 -27.53957 70.58058 Facility Hub (E)(R 1 (10) R) to Mosswart Camp
|
||||
-100.51607 8.92019 -25.3 19.4 Facility Hub (E)(L 2 (25) C R) to Mosswart Maze
|
||||
-100.64167 8.61667 -29.8 93.9 Facility Hub (W)(L 1 (30) L) to Mountain Sewer
|
||||
-100.55833 8.65833 32.3 66.3 Facility Hub (W)(R 1 (35) R) to Skeleton Fort
|
||||
-100.55833 8.575 16.5 3.9 Facility Hub (W)(R 1 (35) L) to Suntik Village
|
||||
-100.48221 8.65125 43.7 -68.4 Facility Hub (N W) The Dark Lair
|
||||
-100.68333 8.90833 13.6 50.7 Facility Hub (E)(R 2 (20) C) to Trothyr's Rest
|
||||
-100.43333 8.7 -9.1 73 Facility Hub (N N) to Tumerok Camps
|
||||
-100.55136 8.81795 -3.2 95 Facility Hub (N E) Tusker Abode
|
||||
-100.48195 8.74871 2 97.9 Facility Hub (N E) Tusker Burrow
|
||||
-100.55182 8.75287 -0.4 97.3 Facility Hub (N E) Tusker Cave
|
||||
-100.55833 8.78333 1.1 96.9 Facility Hub (N E) Tusker Cavern
|
||||
-100.51667 8.825 -0.5 95.9 Facility Hub (N E) Tusker Habitat
|
||||
-100.51667 8.74167 -0.2 98 Facility Hub (N E) Tusker Lodge
|
||||
-100.48162 8.81352 -2.3 95.6 Facility Hub (N E) Tusker Quarters
|
||||
-52.8 67.3 -52.3 67.9 South Osteth Peak Portal
|
||||
47.1 -90.2 -96.68392 -101.65892 Town Network Portal(Ahurenga)
|
||||
-31.2 13.9 -99.1 8.7 Town Network Portal(Al-Arqas)
|
||||
7.4 4.8 -99.1 8.7 Town Network Portal(Al-Jalima)
|
||||
33.5 56.8 -99.1 8.7 Town Network Portal(Arwic)
|
||||
-59.8 -87.9 -99.1 8.7 Town Network Portal(Ayan Baqur)
|
||||
-49.4 62.5 -99.1 8.7 Town Network Portal(Baishi)
|
||||
39.4 -75.4 -96.68392 -101.65892 Town Network Portal(Bluespire)
|
||||
-87.6795 -67.07218 -96.68392 -101.65892 Town Network Portal(Candeth Keep)
|
||||
25.6 49.2 -99.1 8.7 Town Network Portal(Cragstone)
|
||||
23.4 -28.6 -96.68392 -101.65892 Town Network Portal(Danby's Outpost)
|
||||
-7.9 73 -99.1 8.7 Town Network Portal(Dryreach)
|
||||
17.7 63.4 -99.1 8.7 Town Network Portal(Eastham)
|
||||
90.4 -43.2 -96.68392 -101.65892 Town Network Portal(Eastwatch)
|
||||
95.7 -56.8 -96.68392 -101.65892 Town Network Portal(Fiun Outpost)
|
||||
1.6 -71.8 -99.1 8.7 Town Network Portal(Fort Tethana)
|
||||
-74 92.2 -99.1 8.7 Town Network Portal(MacNiall's Freehold)
|
||||
29.7 27.4 -99.1 8.7 Town Network Portal(Glenden Wood)
|
||||
43.1 -66.7 -96.68392 -101.65892 Town Network Portal(Greenspire)
|
||||
-39.2 83.1 -99.1 8.7 Town Network Portal(Hebian-to)
|
||||
42.28172 33.30997 -99.1 8.7 Town Network Portal(Holtburg)
|
||||
-83.3 7.1 -99.1 8.7 Town Network Portal(Kara)
|
||||
-47.6 24.7 -99.1 8.7 Town Network Portal(Khayyaban)
|
||||
-74.3 84.4 -99.1 8.7 Town Network Portal(Kryst)
|
||||
-54.5 73.2 -99.1 8.7 Town Network Portal(Lin)
|
||||
-77.6 28.1 -96.68392 -101.65892 Town Network Portal(Linvak Tukal)
|
||||
0.7 51.4 -99.1 8.7 Town Network Portal(Lytelthorpe)
|
||||
-61.8 82.1 -99.1 8.7 Town Network Portal(Mayoi)
|
||||
-52.7 82.3 -99.1 8.7 Town Network Portal(Nanto)
|
||||
69.9 17.6 -96.68392 -101.65892 Town Network Portal(Neydisa Castle)
|
||||
2.31399 95.45557 -96.68392 -101.65892 Town Network Portal(Oolutanga's Refuge)
|
||||
44.2 -43.5 -99.1 8.7 Town Network Portal(Plateau Village)
|
||||
-74.3 19.2 -99.1 8.7 Town Network Portal(Qalaba'r)
|
||||
40.7 -83.2 -96.68392 -101.65892 Town Network Portal(Redspire)
|
||||
10.5 58.3 -99.1 8.7 Town Network Portal(Rithwic)
|
||||
-2.92809 19.43513 -96.64167 -101.7 Town Network Portal(Samsur)
|
||||
72 -61.3 -96.68392 -101.65892 Town Network Portal(Sanamar)
|
||||
-28.7 59.4 -99.1 8.7 Town Network Portal(Sawato)
|
||||
-33.6 72.7 -99.1 8.7 Town Network Portal(Shoushi)
|
||||
87.3 -70.6 -96.68392 -101.65892 Town Network Portal(Silyun)
|
||||
68.7 -21.7 -99.1 8.7 Town Network Portal(Stonehold)
|
||||
44.1 -78 -96.68392 -101.65892 Town Network Portal(Timaru)
|
||||
-30.3 94.7 -99.1 8.7 Town Network Portal(Tou-Tou)
|
||||
-14.9 5.8 -99.1 8.7 Town Network Portal(Tufa)
|
||||
-25.1 28.2 -99.1 8.7 Town Network Portal(Uziz)
|
||||
-62.1 -51.3 -99.1 8.7 Town Network Portal(Wai Jhou)
|
||||
72.8 -73.3 -96.68392 -101.65892 Town Network Portal(Westwatch)
|
||||
-41.9 15.8 -99.1 8.7 Town Network Portal(Xarabydun)
|
||||
-12.1 42.6 -99.1 8.7 Town Network Portal(Yanshi)
|
||||
-21.50505 -1.52084 -96.64167 -101.7 Town Network Portal(Yaraq)
|
||||
13.6 0.6 -99.1 8.7 Town Network Portal(Zaikhal)
|
||||
-96.9331 -101.7258 46.1 -89.8 Town Network (S R 3) to Ahurenga
|
||||
-96.70975 -101.82524 -31.29924 13.21605 Town Network (W L 2) to Al-Arqas
|
||||
-96.6 -101.93336 7.2 5 Town Network (W R 5) to Al-Jalima
|
||||
-96.51665 -101.5881 33.3 56.6 Town Network (N R 1) to Arwic
|
||||
-96.71016 -101.45011 -49.3 62.9 Town Network (E R 3) to Baishi
|
||||
-97.0852 -101.69992 44.2 -78.5 Town Network (S R 7) to Base of the Timaru Plateau
|
||||
-96.85006 -101.72708 39.5 -75.3 Town Network (S R 1) to Bluespire
|
||||
-96.47504 -101.72735 26 48.4 Town Network (N L 2) to Cragstone
|
||||
-97.01667 -101.58992 23.2 -29.9 Town Network (S L 5) to Danby's Outpost
|
||||
-96.39167 -101.58994 -8.1 73 Town Network (N R 4) to Dryreach
|
||||
-96.43346 -101.58962 16.9 65.3 Town Network (N R 3) to Eastham
|
||||
-97.05856 -101.58953 90.3 -43.3 Town Network (S L 6) to Eastwatch
|
||||
-96.76665 -101.72686 -100.72468 8.69433 Town Network (S R) to Facility Hub
|
||||
-97.05841 -101.72583 95.9 -56.8 Town Network (S R 6) to Fiun Outpost
|
||||
-96.36484 -101.65838 1.7 -71.2 Town Network (N C) to Fort Tethana
|
||||
-96.68353 -101.33931 -73 92 Town Network (E R 6) to Freehold (MacNiall's Freehold)
|
||||
-96.39167 -101.72708 29.7 26.5 Town Network (N L 4) to Glenden Wood
|
||||
-96.89144 -101.7269 43.2 -66.8 Town Network (S R 2) to Greenspire
|
||||
-96.57343 -101.40833 -38.9 82.6 Town Network (E L 4) to Hebian-to
|
||||
-96.51647 -101.72539 42.1 33.6 Town Network (N L 1) to Holtburg
|
||||
-96.57415 -101.36648 -83.5 47.6 Town Network (E L 5) to Kara
|
||||
-96.71018 -101.86674 -47.4 25.5 Town Network (W L 3)to Khayyaban
|
||||
-96.59985 -101.33949 -74.6 84.2 Town Network (E L 6) to Kryst
|
||||
-96.57263 -101.45 -53.9 74.3 Town Network (E L 3) to Lin
|
||||
-96.97496 -101.59065 -77.8 28 Town Network (S L 4) to Linvak Tukal
|
||||
-96.43333 -101.72748 1.1 51.7 Town Network (N L 3) to Lytelthorpe
|
||||
-96.76659 -101.59113 -15.68306 -100.94497 Town Network (S L) to Marketplace
|
||||
-96.57237 -101.49167 -61.9 82.5 Town Network (E L 2) to Mayoi
|
||||
-96.70835 -101.49174 -82.2 82.5 Town Network (E R 2) to Nanto
|
||||
-96.97492 -101.72478 69.5 17.9 Town Network (S R 4) to Neydisa Castle
|
||||
-97.08451 -101.6167 2.3 95.5 Town Network (S L 7) to Oolutanga's Refuge
|
||||
-96.36451 -101.7 44.5 -43.1 Town Network (N L 5) to Plateau Village
|
||||
-96.57375 -101.82495 -74.6 19.6 Town Network (W R 2) to Qalaba'r
|
||||
-96.89182 -101.58911 40.6 -83 Town Network (S L 2) to Redspire
|
||||
-96.475 -101.59066 10.8 59.3 Town Network (N R 2) to Rithwic
|
||||
-96.57333 -101.78347 -3.2 19 Town Network (W R 1) to Samsur
|
||||
-96.85015 -101.5909 72.1 -60.9 Town Network (S L 1) to Sanamar
|
||||
-96.70983 -101.36693 -29.1 58.9 Town Network (E R 5) to Sawato
|
||||
-96.57344 -101.53333 -33.5 72.8 Town Network (E L 1) to Shoushi
|
||||
-97.01655 -101.72667 87.3 -70.8 Town Network (S R 5) to Silyun
|
||||
-96.36395 -101.61692 68.7 -21.8 Town Network (N R 5) to Stonehold
|
||||
-96.7096 -101.53342 -30.3 94.7 Town Network (E R 1) to Tou-Tou
|
||||
-96.68333 -101.93296 -14.8 6.1 Town Network (W L 5) to Tufa
|
||||
-96.71055 -101.9089 -24.8 28.4 Town Network (W L 4) to Uziz
|
||||
-96.93314 -101.59051 72.8 -73.4 Town Network (S L 3) to Westwatch
|
||||
-96.57442 -101.86637 -41.9 16.1 Town Network (W R 3) to Xarabydun
|
||||
-96.70982 -101.40855 -12.6 42.4 Town Network (E R 4) to Yanshi
|
||||
-96.70908 -101.78335 -21.51417 -1.81708 Town Network (W L 1) to Yaraq
|
||||
-96.57422 -101.90859 13.5 0.7 Town Network (W R 4) to Zaikhal
|
||||
-100.51667 8.78333 -0.4 90.8 Facility Hub (N E) Tusker Barracks
|
||||
|
205
Tools/RynthNav.PortalGraph/PortalRoute.cs
Normal file
205
Tools/RynthNav.PortalGraph/PortalRoute.cs
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace RynthNav.Routing;
|
||||
|
||||
// Shared, dependency-free travel-route planner. Compiled into BOTH the offline
|
||||
// RynthNav.PortalGraph tool (for validation) and the in-process RynthNav plugin
|
||||
// (the code that actually ships), so what we test offline is exactly what runs.
|
||||
//
|
||||
// Coordinates everywhere are AC /loc decimal degrees (NS, EW). Distances are in
|
||||
// world units (1 /loc degree = 240 units). The planner runs a uniform-cost
|
||||
// (Dijkstra) search over a graph of portal endpoints + START + GOAL and returns
|
||||
// an ordered list of walk legs, each optionally ending in "use a portal".
|
||||
|
||||
/// <summary>One directed portal: walk to (SrcNs,SrcEw), teleport, arrive (DstNs,DstEw).</summary>
|
||||
public readonly struct PortalLink
|
||||
{
|
||||
public readonly double SrcNs, SrcEw, DstNs, DstEw;
|
||||
public readonly string Name;
|
||||
public PortalLink(double srcNs, double srcEw, double dstNs, double dstEw, string name)
|
||||
{ SrcNs = srcNs; SrcEw = srcEw; DstNs = dstNs; DstEw = dstEw; Name = name; }
|
||||
}
|
||||
|
||||
/// <summary>A recall spell: usable from anywhere, lands at a fixed spot.</summary>
|
||||
public readonly struct RecallLink
|
||||
{
|
||||
public readonly double DstNs, DstEw;
|
||||
public readonly string Name;
|
||||
public RecallLink(double dstNs, double dstEw, string name) { DstNs = dstNs; DstEw = dstEw; Name = name; }
|
||||
}
|
||||
|
||||
/// <summary>One leg of a route: walk to (Ns,Ew); if UsePortal, trigger the portal on arrival.</summary>
|
||||
public readonly struct RouteStep
|
||||
{
|
||||
public readonly double Ns, Ew;
|
||||
public readonly bool UsePortal; // arriving here, walk into the portal and wait for teleport
|
||||
public readonly bool UseRecall; // cast a recall here instead of walking into a portal
|
||||
public readonly string Label;
|
||||
public RouteStep(double ns, double ew, bool usePortal, bool useRecall, string label)
|
||||
{ Ns = ns; Ew = ew; UsePortal = usePortal; UseRecall = useRecall; Label = label; }
|
||||
}
|
||||
|
||||
public static class PortalRoute
|
||||
{
|
||||
public const double UnitsPerDegree = 240.0;
|
||||
|
||||
// Tuning. A portal/recall "costs" this many world units of equivalent effort,
|
||||
// so the planner only takes one when it saves more walking than the penalty.
|
||||
public const double PortalPenaltyUnits = 360.0; // ~1.5 deg
|
||||
public const double RecallPenaltyUnits = 1200.0; // recalls are slow to cast; ~5 deg
|
||||
// Only chain one portal's exit to another portal's entrance if they're within
|
||||
// this far apart (same town/area). START->any-portal and any-portal->GOAL are
|
||||
// always allowed so the graph can't disconnect.
|
||||
public const double ChainWalkRadiusUnits = 4000.0; // ~16.7 deg
|
||||
|
||||
private static double Dist(double aNs, double aEw, double bNs, double bEw)
|
||||
{
|
||||
double dn = (aNs - bNs) * UnitsPerDegree, de = (aEw - bEw) * UnitsPerDegree;
|
||||
return Math.Sqrt(dn * dn + de * de);
|
||||
}
|
||||
|
||||
private enum EdgeKind { Walk, Portal, Recall }
|
||||
private readonly struct Edge { public readonly int To; public readonly double Cost; public readonly EdgeKind Kind; public readonly string Label;
|
||||
public Edge(int to, double cost, EdgeKind kind, string label) { To = to; Cost = cost; Kind = kind; Label = label; } }
|
||||
|
||||
/// <summary>
|
||||
/// Plan a route from start to goal. Returns the ordered walk legs. The first leg(s)
|
||||
/// may be portal/recall hops; the final leg is always a plain walk to the goal.
|
||||
/// estUnits = total estimated cost; portalsUsed = how many teleports the plan takes.
|
||||
/// </summary>
|
||||
public static List<RouteStep> Plan(
|
||||
IReadOnlyList<PortalLink> portals,
|
||||
IReadOnlyList<RecallLink>? recalls,
|
||||
double startNs, double startEw,
|
||||
double goalNs, double goalEw,
|
||||
out double estUnits, out int portalsUsed)
|
||||
{
|
||||
recalls ??= Array.Empty<RecallLink>();
|
||||
|
||||
// Node layout: 0=START, 1=GOAL, then per-portal [Src,Dst] pairs, then recall dsts.
|
||||
int n = 2 + portals.Count * 2 + recalls.Count;
|
||||
var ns = new double[n];
|
||||
var ew = new double[n];
|
||||
ns[0] = startNs; ew[0] = startEw;
|
||||
ns[1] = goalNs; ew[1] = goalEw;
|
||||
for (int i = 0; i < portals.Count; i++)
|
||||
{
|
||||
int s = 2 + i * 2, d = s + 1;
|
||||
ns[s] = portals[i].SrcNs; ew[s] = portals[i].SrcEw;
|
||||
ns[d] = portals[i].DstNs; ew[d] = portals[i].DstEw;
|
||||
}
|
||||
int recallBase = 2 + portals.Count * 2;
|
||||
for (int i = 0; i < recalls.Count; i++) { ns[recallBase + i] = recalls[i].DstNs; ew[recallBase + i] = recalls[i].DstEw; }
|
||||
|
||||
var adj = new List<Edge>[n];
|
||||
for (int i = 0; i < n; i++) adj[i] = new List<Edge>();
|
||||
|
||||
// Direct walk fallback START -> GOAL.
|
||||
adj[0].Add(new Edge(1, Dist(startNs, startEw, goalNs, goalEw), EdgeKind.Walk, "walk"));
|
||||
|
||||
for (int i = 0; i < portals.Count; i++)
|
||||
{
|
||||
int s = 2 + i * 2, d = s + 1;
|
||||
string name = portals[i].Name;
|
||||
// The teleport itself.
|
||||
adj[s].Add(new Edge(d, PortalPenaltyUnits, EdgeKind.Portal, name));
|
||||
// Walk from START to this portal entrance, and from this portal exit to GOAL.
|
||||
adj[0].Add(new Edge(s, Dist(startNs, startEw, ns[s], ew[s]), EdgeKind.Walk, "walk"));
|
||||
adj[d].Add(new Edge(1, Dist(ns[d], ew[d], goalNs, goalEw), EdgeKind.Walk, "walk"));
|
||||
}
|
||||
|
||||
// Chain portals: walk from one exit to a nearby other entrance.
|
||||
for (int i = 0; i < portals.Count; i++)
|
||||
{
|
||||
int di = 3 + i * 2;
|
||||
for (int j = 0; j < portals.Count; j++)
|
||||
{
|
||||
if (i == j) continue;
|
||||
int sj = 2 + j * 2;
|
||||
double w = Dist(ns[di], ew[di], ns[sj], ew[sj]);
|
||||
if (w <= ChainWalkRadiusUnits) adj[di].Add(new Edge(sj, w, EdgeKind.Walk, "walk"));
|
||||
}
|
||||
}
|
||||
|
||||
// Recalls: from START (anywhere) to a fixed landing, then walk/chain like an exit.
|
||||
for (int i = 0; i < recalls.Count; i++)
|
||||
{
|
||||
int r = recallBase + i;
|
||||
adj[0].Add(new Edge(r, RecallPenaltyUnits, EdgeKind.Recall, recalls[i].Name));
|
||||
adj[r].Add(new Edge(1, Dist(ns[r], ew[r], goalNs, goalEw), EdgeKind.Walk, "walk"));
|
||||
for (int j = 0; j < portals.Count; j++)
|
||||
{
|
||||
int sj = 2 + j * 2;
|
||||
double w = Dist(ns[r], ew[r], ns[sj], ew[sj]);
|
||||
if (w <= ChainWalkRadiusUnits) adj[r].Add(new Edge(sj, w, EdgeKind.Walk, "walk"));
|
||||
}
|
||||
}
|
||||
|
||||
// Dijkstra (uniform-cost; optimal with positive edge costs).
|
||||
var dist = new double[n];
|
||||
var prev = new int[n];
|
||||
var prevKind = new EdgeKind[n];
|
||||
var prevLabel = new string[n];
|
||||
var done = new bool[n];
|
||||
for (int i = 0; i < n; i++) { dist[i] = double.PositiveInfinity; prev[i] = -1; }
|
||||
dist[0] = 0;
|
||||
var pq = new SortedSet<(double cost, int node)>();
|
||||
pq.Add((0, 0));
|
||||
while (pq.Count > 0)
|
||||
{
|
||||
var (cu, u) = pq.Min; pq.Remove(pq.Min);
|
||||
if (done[u]) continue;
|
||||
done[u] = true;
|
||||
if (u == 1) break;
|
||||
foreach (var e in adj[u])
|
||||
{
|
||||
if (done[e.To]) continue;
|
||||
double nd = cu + e.Cost;
|
||||
if (nd < dist[e.To])
|
||||
{
|
||||
if (!double.IsPositiveInfinity(dist[e.To])) pq.Remove((dist[e.To], e.To));
|
||||
dist[e.To] = nd; prev[e.To] = u; prevKind[e.To] = e.Kind; prevLabel[e.To] = e.Label;
|
||||
pq.Add((nd, e.To));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
estUnits = dist[1];
|
||||
portalsUsed = 0;
|
||||
var steps = new List<RouteStep>();
|
||||
if (double.IsPositiveInfinity(dist[1])) return steps; // unreachable (shouldn't happen — direct walk always exists)
|
||||
|
||||
// Rebuild node path START..GOAL.
|
||||
var nodes = new List<int>();
|
||||
for (int v = 1; v != -1; v = prev[v]) nodes.Add(v);
|
||||
nodes.Reverse();
|
||||
|
||||
// Convert node hops into walk legs, folding portal/recall edges into the
|
||||
// preceding walk leg's "use on arrival" flag.
|
||||
for (int k = 1; k < nodes.Count; k++)
|
||||
{
|
||||
int to = nodes[k];
|
||||
EdgeKind kind = prevKind[to];
|
||||
if (kind == EdgeKind.Walk)
|
||||
{
|
||||
steps.Add(new RouteStep(ns[to], ew[to], false, false, prevLabel[to]));
|
||||
}
|
||||
else if (kind == EdgeKind.Portal)
|
||||
{
|
||||
portalsUsed++;
|
||||
// 'to' is a portal Dst reached by teleport; the entrance is the prior node,
|
||||
// which the previous walk leg already targets. Flag that leg as a portal use.
|
||||
if (steps.Count > 0)
|
||||
steps[steps.Count - 1] = new RouteStep(steps[^1].Ns, steps[^1].Ew, true, false, prevLabel[to]);
|
||||
}
|
||||
else // Recall
|
||||
{
|
||||
portalsUsed++;
|
||||
// Recall is cast from START (current position); insert a recall step at START.
|
||||
steps.Add(new RouteStep(startNs, startEw, false, true, prevLabel[to]));
|
||||
}
|
||||
}
|
||||
return steps;
|
||||
}
|
||||
}
|
||||
230
Tools/RynthNav.PortalGraph/Program.cs
Normal file
230
Tools/RynthNav.PortalGraph/Program.cs
Normal file
|
|
@ -0,0 +1,230 @@
|
|||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Xml.Linq;
|
||||
using RynthNav.Routing;
|
||||
|
||||
namespace RynthNav.PortalGraph;
|
||||
|
||||
// Offline tool: parse the vendored GoArrow GAlocations.xml into a clean portals.json
|
||||
// travel-edge list that the RynthNav plugin can consume.
|
||||
//
|
||||
// A GoArrow "Town Portal" entry is a directed travel edge:
|
||||
// stand at (latitude, longitude) -> teleport -> arrive (arrival_latitude, arrival_longitude)
|
||||
// Coordinates are AC /loc decimal degrees (NS, EW) -- the same frame the plugin parses.
|
||||
//
|
||||
// Usage:
|
||||
// RynthNav.PortalGraph [--in <GAlocations.xml>] [--out <portals.json>] [--min-arrival 1.0]
|
||||
// [--include-retired]
|
||||
internal static class Program
|
||||
{
|
||||
private static int Main(string[] args)
|
||||
{
|
||||
string exeDir = AppContext.BaseDirectory;
|
||||
string inPath = Path.Combine(exeDir, "Data", "GAlocations.xml");
|
||||
string outPath = Path.Combine(exeDir, "Data", "portals.json");
|
||||
bool includeRetired = false;
|
||||
// Arrival coords are stored to 0.1 deg; treat |lat|+|lon| below this as "no real destination".
|
||||
double minArrival = 0.5;
|
||||
string? routeFrom = null, routeTo = null;
|
||||
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
switch (args[i])
|
||||
{
|
||||
case "--in": inPath = args[++i]; break;
|
||||
case "--out": outPath = args[++i]; break;
|
||||
case "--include-retired": includeRetired = true; break;
|
||||
case "--min-arrival": minArrival = double.Parse(args[++i], CultureInfo.InvariantCulture); break;
|
||||
case "--route": routeFrom = args[++i]; routeTo = args[++i]; break;
|
||||
case "-h" or "--help":
|
||||
Console.WriteLine("RynthNav.PortalGraph [--in <GAlocations.xml>] [--out <portals.json>] " +
|
||||
"[--min-arrival 0.5] [--include-retired]");
|
||||
Console.WriteLine(" --route \"<ns,ew>\" \"<ns,ew>\" plan a portal route between two /loc coords");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!File.Exists(inPath))
|
||||
{
|
||||
Console.Error.WriteLine($"Input not found: {inPath}");
|
||||
return 2;
|
||||
}
|
||||
|
||||
Console.WriteLine($"Reading {inPath}");
|
||||
XDocument doc = XDocument.Load(inPath);
|
||||
|
||||
int total = 0, skippedNoArrival = 0, skippedRetired = 0, skippedNotPortal = 0;
|
||||
var portals = new List<PortalEdge>();
|
||||
|
||||
foreach (XElement loc in doc.Descendants("location"))
|
||||
{
|
||||
total++;
|
||||
|
||||
// A location may carry several <type> tags (city + portal + dungeon).
|
||||
// We only keep ones that act as a portal.
|
||||
var types = loc.Elements("type").Select(t => (t.Value ?? "").Trim()).ToList();
|
||||
bool isPortal = types.Any(t => t.Contains("Portal", StringComparison.OrdinalIgnoreCase));
|
||||
if (!isPortal) { skippedNotPortal++; continue; }
|
||||
|
||||
string retired = (loc.Element("retired")?.Value ?? "").Trim();
|
||||
if (!includeRetired && retired.Equals("Y", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
skippedRetired++;
|
||||
continue;
|
||||
}
|
||||
|
||||
// ⚠ GoArrow's latitude is INVERTED vs AC /loc: it stores North as negative
|
||||
// (e.g. Holtburg, actually 42.3N, is latitude -42.3 in GAlocations.xml).
|
||||
// Negate to get true AC NS. Longitude (EW) matches AC already.
|
||||
double srcNs = -ParseD(loc.Element("latitude")?.Value);
|
||||
double srcEw = ParseD(loc.Element("longitude")?.Value);
|
||||
double dstNs = -ParseD(loc.Element("arrival_latitude")?.Value);
|
||||
double dstEw = ParseD(loc.Element("arrival_longitude")?.Value);
|
||||
|
||||
// Need a real destination to be a usable travel edge.
|
||||
if (Math.Abs(dstNs) + Math.Abs(dstEw) < minArrival)
|
||||
{
|
||||
skippedNoArrival++;
|
||||
continue;
|
||||
}
|
||||
|
||||
portals.Add(new PortalEdge
|
||||
{
|
||||
Id = (int)ParseD(loc.Element("id")?.Value),
|
||||
Name = (loc.Element("name")?.Value ?? "").Trim(),
|
||||
Type = types.FirstOrDefault(t => t.Contains("Portal", StringComparison.OrdinalIgnoreCase)) ?? "Portal",
|
||||
SrcNs = srcNs,
|
||||
SrcEw = srcEw,
|
||||
DstNs = dstNs,
|
||||
DstEw = dstEw,
|
||||
// GoArrow restrictions = recommended level band, e.g. "1-6". Advisory only.
|
||||
Restrictions = NullIfEmpty(loc.Element("restrictions")?.Value),
|
||||
PkRequired = !string.IsNullOrWhiteSpace(loc.Element("pk_req")?.Value),
|
||||
});
|
||||
}
|
||||
|
||||
var output = new PortalFile
|
||||
{
|
||||
Source = "GoArrow GAlocations.xml (Roogon/CoD DB)",
|
||||
GeneratedNote = "Coordinates are AC /loc decimal degrees (NS, EW). Each entry is a directed " +
|
||||
"travel edge: walk to Src, take the portal, arrive at Dst.",
|
||||
IncludesRetired = includeRetired,
|
||||
Count = portals.Count,
|
||||
Portals = portals.OrderBy(p => p.Id).ToList(),
|
||||
};
|
||||
|
||||
var jsonOpts = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
|
||||
};
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(outPath)!);
|
||||
File.WriteAllText(outPath, JsonSerializer.Serialize(output, jsonOpts));
|
||||
|
||||
// Also emit a flat TSV the AOT plugin reads with plain string.Split (no JSON
|
||||
// dependency in the NativeAOT runtime). Columns: srcNs srcEw dstNs dstEw name
|
||||
string tsvPath = Path.ChangeExtension(outPath, ".tsv");
|
||||
var tsv = new System.Text.StringBuilder(portals.Count * 48);
|
||||
foreach (var p in portals)
|
||||
{
|
||||
string safeName = p.Name.Replace('\t', ' ').Replace('\n', ' ').Replace('\r', ' ');
|
||||
tsv.Append(p.SrcNs.ToString(CultureInfo.InvariantCulture)).Append('\t')
|
||||
.Append(p.SrcEw.ToString(CultureInfo.InvariantCulture)).Append('\t')
|
||||
.Append(p.DstNs.ToString(CultureInfo.InvariantCulture)).Append('\t')
|
||||
.Append(p.DstEw.ToString(CultureInfo.InvariantCulture)).Append('\t')
|
||||
.Append(safeName).Append('\n');
|
||||
}
|
||||
File.WriteAllText(tsvPath, tsv.ToString());
|
||||
|
||||
Console.WriteLine($"Locations scanned : {total}");
|
||||
Console.WriteLine($" not a portal : {skippedNotPortal}");
|
||||
Console.WriteLine($" retired skipped : {skippedRetired}");
|
||||
Console.WriteLine($" no destination : {skippedNoArrival}");
|
||||
Console.WriteLine($"Portal edges kept : {portals.Count}");
|
||||
Console.WriteLine($"Wrote {outPath}");
|
||||
Console.WriteLine($"Wrote {tsvPath}");
|
||||
|
||||
if (routeFrom != null && routeTo != null)
|
||||
{
|
||||
if (!TryParseLoc(routeFrom, out double fNs, out double fEw) ||
|
||||
!TryParseLoc(routeTo, out double tNs, out double tEw))
|
||||
{
|
||||
Console.Error.WriteLine("Bad --route coords. Use e.g. --route \"42.5N,33.6E\" \"2.7N,18.9E\"");
|
||||
return 3;
|
||||
}
|
||||
var links = new List<PortalLink>(portals.Count);
|
||||
foreach (var p in portals) links.Add(new PortalLink(p.SrcNs, p.SrcEw, p.DstNs, p.DstEw, p.Name));
|
||||
var steps = PortalRoute.Plan(links, null, fNs, fEw, tNs, tEw, out double est, out int used);
|
||||
|
||||
double directUnits = Math.Sqrt(((fNs - tNs) * (fNs - tNs) + (fEw - tEw) * (fEw - tEw))) * PortalRoute.UnitsPerDegree;
|
||||
Console.WriteLine();
|
||||
Console.WriteLine($"ROUTE {Fmt(fNs, 'N', 'S')} {Fmt(fEw, 'E', 'W')} -> {Fmt(tNs, 'N', 'S')} {Fmt(tEw, 'E', 'W')}");
|
||||
Console.WriteLine($" direct walk : {directUnits:F0}u");
|
||||
Console.WriteLine($" planned : {est:F0}u via {used} portal hop(s), {steps.Count} leg(s)");
|
||||
for (int i = 0; i < steps.Count; i++)
|
||||
{
|
||||
var s = steps[i];
|
||||
string act = s.UseRecall ? $"RECALL ({s.Label})" : s.UsePortal ? $"walk to + take portal '{s.Label}'" : "walk to goal/exit";
|
||||
Console.WriteLine($" {i + 1,2}. {Fmt(s.Ns, 'N', 'S')} {Fmt(s.Ew, 'E', 'W')} {act}");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static string Fmt(double v, char pos, char neg) => $"{Math.Abs(v):F1}{(v >= 0 ? pos : neg)}";
|
||||
|
||||
private static bool TryParseLoc(string s, out double ns, out double ew)
|
||||
{
|
||||
ns = 0; ew = 0;
|
||||
var parts = s.Split(new[] { ',', ' ' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (parts.Length < 2) return false;
|
||||
return TryCoord(parts[0], out ns) && TryCoord(parts[1], out ew);
|
||||
}
|
||||
|
||||
private static bool TryCoord(string tok, out double val)
|
||||
{
|
||||
val = 0;
|
||||
tok = tok.Trim().ToUpperInvariant();
|
||||
if (tok.Length == 0) return false;
|
||||
int sign = 1;
|
||||
char last = tok[^1];
|
||||
if (last is 'N' or 'S' or 'E' or 'W') { if (last is 'S' or 'W') sign = -1; tok = tok[..^1]; }
|
||||
if (!double.TryParse(tok, NumberStyles.Float, CultureInfo.InvariantCulture, out val)) return false;
|
||||
val *= sign;
|
||||
return true;
|
||||
}
|
||||
|
||||
private static double ParseD(string? s)
|
||||
=> double.TryParse((s ?? "").Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out double v) ? v : 0.0;
|
||||
|
||||
private static string? NullIfEmpty(string? s)
|
||||
=> string.IsNullOrWhiteSpace(s) ? null : s.Trim();
|
||||
}
|
||||
|
||||
internal sealed class PortalFile
|
||||
{
|
||||
public string Source { get; set; } = "";
|
||||
public string GeneratedNote { get; set; } = "";
|
||||
public bool IncludesRetired { get; set; }
|
||||
public int Count { get; set; }
|
||||
public List<PortalEdge> Portals { get; set; } = new();
|
||||
}
|
||||
|
||||
internal sealed class PortalEdge
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; } = "";
|
||||
public string Type { get; set; } = "";
|
||||
|
||||
// Source: where the portal stands (you walk here).
|
||||
public double SrcNs { get; set; }
|
||||
public double SrcEw { get; set; }
|
||||
|
||||
// Destination: where the portal drops you.
|
||||
public double DstNs { get; set; }
|
||||
public double DstEw { get; set; }
|
||||
|
||||
public string? Restrictions { get; set; }
|
||||
public bool PkRequired { get; set; }
|
||||
}
|
||||
82
Tools/RynthNav.PortalGraph/README.md
Normal file
82
Tools/RynthNav.PortalGraph/README.md
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
# RynthNav.PortalGraph
|
||||
|
||||
Offline tool that converts the GoArrow location database into a clean portal
|
||||
travel-edge list (`portals.json`) for the RynthNav plugin to consume.
|
||||
|
||||
This is **step 1** of portal-assisted routing: just the data ingestion. No graph
|
||||
solver and no runtime portal use yet — those come later.
|
||||
|
||||
## Data provenance
|
||||
|
||||
`Data/GAlocations.xml` is vendored (committed in-repo) so the parser always has
|
||||
its input, even offline. Source: GoArrow / Roogon CoD database
|
||||
(https://github.com/Darktorizo/GoArrow_Data_CoD), last upstream update 2012-04-15.
|
||||
|
||||
> ⚠ This is **retail** data. We play on an ACE server (retail-derived). Most town
|
||||
> portals match, but validate routes empirically before trusting the DB wholesale.
|
||||
> Arrival coords are stored to ~0.1° and are approximate.
|
||||
|
||||
## Run
|
||||
|
||||
```
|
||||
dotnet run -c Release
|
||||
```
|
||||
|
||||
Reads `Data/GAlocations.xml`, writes `Data/portals.json`.
|
||||
|
||||
Options:
|
||||
- `--in <path>` / `--out <path>` — override input/output.
|
||||
- `--min-arrival <deg>` — minimum |arrivalNs|+|arrivalEw| to count as a real
|
||||
destination (default 0.5; drops portals with no recorded arrival).
|
||||
- `--include-retired` — keep entries flagged `retired=Y` (default: dropped).
|
||||
|
||||
Current output: **817 usable portal edges** from 5,258 locations.
|
||||
|
||||
## Output schema (`portals.json`)
|
||||
|
||||
Each entry is a **directed travel edge** in AC `/loc` decimal degrees (NS, EW):
|
||||
|
||||
| field | meaning |
|
||||
|-------|---------|
|
||||
| `Id` | original GoArrow location id |
|
||||
| `Name` | e.g. "Al-Arqas to Samsur" |
|
||||
| `Type` | GoArrow portal type (Town/Wilderness/etc.) |
|
||||
| `SrcNs`, `SrcEw` | where the portal stands — walk here |
|
||||
| `DstNs`, `DstEw` | where it drops you |
|
||||
| `Restrictions` | advisory level band, e.g. "1-6" (optional) |
|
||||
| `PkRequired` | portal is PK-only (optional) |
|
||||
|
||||
## Route planner (`PortalRoute.cs`)
|
||||
|
||||
`PortalRoute.Plan(...)` runs a uniform-cost (Dijkstra) search over a graph of
|
||||
portal endpoints + START + GOAL and returns ordered walk legs, each optionally
|
||||
flagged "use a portal on arrival". This same source file is `<Compile Include>`-d
|
||||
into the RynthNav plugin, so what's validated here is exactly what ships.
|
||||
|
||||
Validate a route offline:
|
||||
```
|
||||
dotnet run -c Release -- --route "78.0N,55.0E" "85.0S,60.0W"
|
||||
```
|
||||
prints e.g. `47876u direct -> 5342u via 4 portal hop(s)` with each leg.
|
||||
|
||||
Tunables (top of `PortalRoute.cs`): `PortalPenaltyUnits`, `RecallPenaltyUnits`,
|
||||
`ChainWalkRadiusUnits`.
|
||||
|
||||
## Plugin output: `portals.tsv`
|
||||
|
||||
The tool also emits `portals.tsv` (same dir as `portals.json`): one line per
|
||||
portal, `srcNs⇥srcEw⇥dstNs⇥dstEw⇥name`. The NativeAOT plugin reads this with
|
||||
plain `string.Split` (no JSON-reflection dependency in the AOT runtime). Deploy
|
||||
it to `C:\Games\RynthCore\NavData\portals.tsv`.
|
||||
|
||||
## Plugin integration (RynthNav v0.5.0)
|
||||
|
||||
`/rnav goto <coord>` now plans a portal route first; if portals beat walking it
|
||||
walks each leg, walks **into** each portal entrance, waits for the teleport
|
||||
(`Host.IsPortaling` falling-edge or a >240u position jump), then resumes from the
|
||||
landing. Pure navmesh walk is used when no portal helps. New commands:
|
||||
`/rnav route <coord>` (preview the plan, no movement) and `/rnav portals on|off`.
|
||||
|
||||
> ⚠ Walk-in trigger only — portals that require a click aren't handled yet (the
|
||||
> plugin can't enumerate world objects to `UseObject` them). If a portal doesn't
|
||||
> fire within ~12s the goto stops with "portal not triggered — check route".
|
||||
18
Tools/RynthNav.PortalGraph/RynthNav.PortalGraph.csproj
Normal file
18
Tools/RynthNav.PortalGraph/RynthNav.PortalGraph.csproj
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<RootNamespace>RynthNav.PortalGraph</RootNamespace>
|
||||
<AssemblyName>RynthNav.PortalGraph</AssemblyName>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- Vendor the source location DB so the parser always has its input, even offline.
|
||||
Copied to output so a published exe is fully self-contained. -->
|
||||
<ItemGroup>
|
||||
<None Include="Data\GAlocations.xml" CopyToOutputDirectory="PreserveNewest" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Reference in a new issue