RynthSuite as of 2026-11-08 (internal 6ec9b64): release 2026.11.8.1
This commit is contained in:
parent
7166d256ce
commit
f8fa62b64c
196 changed files with 24980 additions and 633 deletions
|
|
@ -3,21 +3,34 @@ using System;
|
|||
namespace RynthCore.Plugin.RynthDefective.Model;
|
||||
|
||||
internal enum DefVerb { Toggle, Help, Use, Set, Clear, Bind, Unbind, Weapons, Favourite, Slots, List, Status, Error, Panels, Selection, Settings, Spell, Corpses,
|
||||
Quantity, Split, Give, Buy }
|
||||
Quantity, Split, Give, Buy, DayNight, Bars, Shortcuts }
|
||||
|
||||
/// <summary>
|
||||
/// A parsed "/rdef ..." line. Use: <see cref="Slot"/> (1-based) or <see cref="Text"/> (an item name).
|
||||
/// The quantity box's verbs (qty, split, give, buy): <see cref="Amount"/> (null = the box's number) and
|
||||
/// <see cref="Text"/> (split: the pack; buy: the item's name).
|
||||
/// Bars (the extra Shortcuts bars): <see cref="Text"/> what to do (list, add, remove, slots, show),
|
||||
/// <see cref="Slot"/> the bar's number, <see cref="Count"/> its slots.
|
||||
/// Shortcuts ("shortcuts clearbusy on|off"): <see cref="Text"/> "on", "off" or "" (say what it is).
|
||||
/// </summary>
|
||||
internal sealed record DefCommand(DefVerb Verb, int Slot = 0, string Text = "", string Error = "", QtyAmount? Amount = null);
|
||||
internal sealed record DefCommand(DefVerb Verb, int Slot = 0, string Text = "", string Error = "", QtyAmount? Amount = null, int Count = 0);
|
||||
|
||||
internal static class DefCommandParser
|
||||
{
|
||||
public const string Usage =
|
||||
"/rdef [use <slot or item name> | set <slot> [item name] | spell <slot> <spell name> | clear <slot> | bind <slot> <key> | unbind <slot> | "
|
||||
+ "weapons [search] | fav | slots <count> | list | status | settings | panels (the game panel buttons) | selection | corpses [clear] | "
|
||||
+ "qty [number|max|half] | split [number] [into <pack>] | give [number] | buy [number] [item name]]";
|
||||
+ "bars [add | remove <bar> | slots <bar> <count> | show <bar>] | shortcuts clearbusy [on|off] | "
|
||||
+ "qty [number|max|half] | split [number] [into <pack>] | give [number] | buy [number] [item name] | daynight [show|hide]]";
|
||||
|
||||
public const string DayNightUsage = "Usage: /rdef daynight [show|hide], e.g. /rdef daynight show (the Day/Night timer: real minutes to the next dawn or dusk)";
|
||||
|
||||
public const string ClearBusyUsage =
|
||||
"Usage: /rdef shortcuts clearbusy on|off, e.g. /rdef shortcuts clearbusy on (a press held only by a stuck busy count clears it first; off by default)";
|
||||
|
||||
public const string BarsUsage =
|
||||
"Usage: /rdef bars [list | add | remove <bar> | slots <bar> <count> | show <bar>], e.g. /rdef bars add or /rdef bars remove 2 "
|
||||
+ "(the extra Shortcuts bars are 2-4)";
|
||||
|
||||
public const string QtyUsage = "Usage: /rdef qty <number|max|half>, e.g. /rdef qty 25 (the Selection window's number)";
|
||||
public const string SplitUsage = "Usage: /rdef split [number|max|half] [into <pack>], e.g. /rdef split 25 or /rdef split 25 into Sack";
|
||||
|
|
@ -44,6 +57,15 @@ internal static class DefCommandParser
|
|||
case "selection": case "target":
|
||||
// "/rdef selection 0x80001234": select that object (a test hook for the Selection window).
|
||||
return new DefCommand(DefVerb.Selection, Text: rest);
|
||||
// The Day/Night timer (2026-11-04): Text "show", "hide" or "" (toggle).
|
||||
case "daynight":
|
||||
return rest.ToLowerInvariant() switch
|
||||
{
|
||||
"" or "toggle" => new DefCommand(DefVerb.DayNight),
|
||||
"show" or "on" or "open" => new DefCommand(DefVerb.DayNight, Text: "show"),
|
||||
"hide" or "off" or "close" => new DefCommand(DefVerb.DayNight, Text: "hide"),
|
||||
_ => Fail($"'{rest}' isn't show or hide. {DayNightUsage}"),
|
||||
};
|
||||
case "fav": case "favourite": case "favorite": return new DefCommand(DefVerb.Favourite);
|
||||
case "weapons": case "weapon": case "picker": return new DefCommand(DefVerb.Weapons, Text: rest);
|
||||
case "use": case "wield": case "equip":
|
||||
|
|
@ -79,6 +101,22 @@ internal static class DefCommandParser
|
|||
return int.TryParse(rest, out int count) && count >= DefSettings.SlotsMin && count <= DefSettings.SlotCountMax
|
||||
? new DefCommand(DefVerb.Slots, count)
|
||||
: Fail($"How many slots? {DefSettings.SlotsMin} to {DefSettings.SlotCountMax}, e.g. /rdef slots 10");
|
||||
// The extra Shortcuts bars (2026-11-04, ExtraBar).
|
||||
case "bars":
|
||||
return ParseBars(rest);
|
||||
// Shortcuts clear a stuck busy state (2026-11-04, DefSettings.ClearStuckBusy).
|
||||
case "shortcuts":
|
||||
{
|
||||
string[] words = rest.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
if (words.Length == 0 || words.Length > 2 || !words[0].Equals("clearbusy", StringComparison.OrdinalIgnoreCase)) return Fail(ClearBusyUsage);
|
||||
if (words.Length == 1) return new DefCommand(DefVerb.Shortcuts, Text: "");
|
||||
return words[1].ToLowerInvariant() switch
|
||||
{
|
||||
"on" or "true" or "1" or "yes" => new DefCommand(DefVerb.Shortcuts, Text: "on"),
|
||||
"off" or "false" or "0" or "no" => new DefCommand(DefVerb.Shortcuts, Text: "off"),
|
||||
_ => Fail($"'{words[1]}' isn't on or off. {ClearBusyUsage}"),
|
||||
};
|
||||
}
|
||||
// The quantity box (2026-10-30, Quantity/QuantityController.cs).
|
||||
case "qty": case "quantity": case "amount":
|
||||
{
|
||||
|
|
@ -110,6 +148,32 @@ internal static class DefCommandParser
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>"/rdef bars ...": list (alone too), add, remove N, slots N count, show N.</summary>
|
||||
private static DefCommand ParseBars(string rest)
|
||||
{
|
||||
string[] words = rest.Split(' ', StringSplitOptions.RemoveEmptyEntries);
|
||||
string sub = words.Length == 0 ? "list" : words[0].ToLowerInvariant();
|
||||
int n = 0;
|
||||
bool hasBar = words.Length >= 2 && int.TryParse(words[1], out n);
|
||||
switch (sub)
|
||||
{
|
||||
case "list": case "ls":
|
||||
return words.Length <= 1 ? new DefCommand(DefVerb.Bars, Text: "list") : Fail(BarsUsage);
|
||||
case "add": case "new":
|
||||
return words.Length <= 1 ? new DefCommand(DefVerb.Bars, Text: "add") : Fail(BarsUsage);
|
||||
case "remove": case "delete": case "rm":
|
||||
return hasBar && words.Length == 2 ? new DefCommand(DefVerb.Bars, n, "remove") : Fail("Which bar? e.g. /rdef bars remove 2 (/rdef bars lists them)");
|
||||
case "show": case "hide": case "toggle":
|
||||
return hasBar && words.Length == 2 ? new DefCommand(DefVerb.Bars, n, "show") : Fail("Which bar? e.g. /rdef bars show 2 (shows it, or hides it when it shows)");
|
||||
case "slots":
|
||||
return hasBar && words.Length == 3 && int.TryParse(words[2], out int count) && count >= ExtraBar.SlotsMin && count <= ExtraBar.SlotsMax
|
||||
? new DefCommand(DefVerb.Bars, n, "slots", Count: count)
|
||||
: Fail($"How many slots? Usage: /rdef bars slots <bar> <count>, e.g. /rdef bars slots 2 12 ({ExtraBar.SlotsMin} to {ExtraBar.SlotsMax})");
|
||||
default:
|
||||
return Fail($"'{words[0]}' isn't something /rdef bars does. {BarsUsage}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The slot number a hotkey runs for slot <paramref name="slot"/> (1-based).</summary>
|
||||
public static string UseCommand(int slot) => "/rdef use " + slot;
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,17 @@ internal sealed class DefSettings
|
|||
/// /rdef qty, split, give and buy work either way.
|
||||
/// </summary>
|
||||
public bool QuantityBox = true;
|
||||
/// <summary>
|
||||
/// Shortcuts clear a stuck busy state (2026-11-04, a player's ask): a press held only by the client's
|
||||
/// busy count (nothing of ours or RynthAi's in flight, no gesture, no "You're too busy" just now) resets
|
||||
/// the count as RynthAi's /ra clearbusy does (the engine's ForceResetBusyCount), then goes, once per
|
||||
/// press (Use/BusyGate.cs BusyClearRule). Off (the default, and what a file from before reads as): a
|
||||
/// reset also zeroes actions the server hasn't answered that RynthDefective can't see (the game's own
|
||||
/// clicks and toolbar keys, another plugin's), and each late answer then takes the count below zero;
|
||||
/// RynthAi stopped resetting it for that on 2026-10-06. The leftover rules let a press through anyway
|
||||
/// within 4 s; this only saves those seconds.
|
||||
/// </summary>
|
||||
public bool ClearStuckBusy;
|
||||
public bool BarOpen;
|
||||
public bool PickerOpen;
|
||||
|
||||
|
|
@ -131,6 +142,69 @@ internal sealed class DefSettings
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// One of the extra Shortcuts bars (2026-11-04): a window of its own ("Shortcuts 2" ... "Shortcuts 4",
|
||||
/// the engine remembers its place, size and whether it shows), with slots of its own, filled as the
|
||||
/// main bar's own slots are (drag an item from the pack, the selected item, one of your spells) and
|
||||
/// clicked the same way. Its slots have no keys: the keys are the main bar's ("/rdef use N").
|
||||
/// Per character, with the main bar's slots.
|
||||
///
|
||||
/// At most <see cref="Max"/>: the engine hosts at most 8 windows per plugin (SectionManifest.MaxWindows,
|
||||
/// later ones are dropped without a word) and RynthDefective already draws 4 (the bar, Game Panels,
|
||||
/// Selection, Corpses). 4 extra bars of up to 24 slots are 96 slots more than the game's 18 and the
|
||||
/// main bar's 24.
|
||||
/// </summary>
|
||||
internal sealed class ExtraBar
|
||||
{
|
||||
public const int Max = 3, FirstNumber = 2, LastNumber = FirstNumber + Max - 1;
|
||||
public const int SlotsMin = 1, SlotsMax = 24, DefaultSlots = 10;
|
||||
|
||||
/// <summary>Its number, <see cref="FirstNumber"/>-<see cref="LastNumber"/> (the main bar is 1): its window's title and id.</summary>
|
||||
public int Number;
|
||||
/// <summary>How many slots it shows (<see cref="SlotsMin"/>-<see cref="SlotsMax"/>).</summary>
|
||||
public int SlotCount = DefaultSlots;
|
||||
/// <summary>Always <see cref="SlotsMax"/> entries: fewer slots hides them, it doesn't forget them.</summary>
|
||||
public List<DefSlot> Slots = NewSlots();
|
||||
|
||||
public ExtraBar(int number) => Number = number;
|
||||
|
||||
/// <summary>"Shortcuts 2": the window's title (the engine's key for its place, size and open state).</summary>
|
||||
public static string TitleOf(int number) => "Shortcuts " + number.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
/// <summary>"window:bar2": the surface its window draws (RynthPluginRenderEmbed).</summary>
|
||||
public static string SurfaceOf(int number) => "window:bar" + number.ToString(System.Globalization.CultureInfo.InvariantCulture);
|
||||
|
||||
public static bool ValidNumber(int number) => number >= FirstNumber && number <= LastNumber;
|
||||
|
||||
public string Title => TitleOf(Number);
|
||||
|
||||
/// <summary>How many of its slots (all of them, shown or not) hold an item or a spell.</summary>
|
||||
public int Filled
|
||||
{
|
||||
get
|
||||
{
|
||||
int n = 0;
|
||||
foreach (DefSlot s in Slots) if (!s.Empty) n++;
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
public static List<DefSlot> NewSlots()
|
||||
{
|
||||
var l = new List<DefSlot>(SlotsMax);
|
||||
for (int i = 0; i < SlotsMax; i++) l.Add(new DefSlot());
|
||||
return l;
|
||||
}
|
||||
|
||||
/// <summary>Pads or cuts the slot list to the fixed length; the count into its range.</summary>
|
||||
public void Fix()
|
||||
{
|
||||
while (Slots.Count < SlotsMax) Slots.Add(new DefSlot());
|
||||
if (Slots.Count > SlotsMax) Slots.RemoveRange(SlotsMax, Slots.Count - SlotsMax);
|
||||
SlotCount = Math.Clamp(SlotCount, SlotsMin, SlotsMax);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>One character's slots, favourites, recent weapons and settings.</summary>
|
||||
internal sealed class DefData
|
||||
{
|
||||
|
|
@ -142,6 +216,31 @@ internal sealed class DefData
|
|||
public List<ItemRef> Favourites = new();
|
||||
/// <summary>The weapons wielded from the picker or a slot, newest first.</summary>
|
||||
public List<ItemRef> Recent = new();
|
||||
/// <summary>The extra Shortcuts bars (2026-11-04), by number; at most <see cref="ExtraBar.Max"/>, none by default.</summary>
|
||||
public List<ExtraBar> ExtraBars = new();
|
||||
|
||||
/// <summary>Extra bar <paramref name="number"/>, or null.</summary>
|
||||
public ExtraBar? Extra(int number) => ExtraBars.Find(b => b.Number == number);
|
||||
|
||||
/// <summary>
|
||||
/// Adds an extra bar with the lowest free number (a removed bar's number is used again, so its window
|
||||
/// comes back where it was). Returns it, or null at <see cref="ExtraBar.Max"/>.
|
||||
/// </summary>
|
||||
public ExtraBar? AddExtraBar()
|
||||
{
|
||||
for (int n = ExtraBar.FirstNumber; n <= ExtraBar.LastNumber; n++)
|
||||
{
|
||||
if (Extra(n) != null) continue;
|
||||
var bar = new ExtraBar(n);
|
||||
ExtraBars.Add(bar);
|
||||
ExtraBars.Sort((a, b) => a.Number.CompareTo(b.Number));
|
||||
return bar;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Removes extra bar <paramref name="number"/> and forgets its slots. False when there is none.</summary>
|
||||
public bool RemoveExtraBar(int number) => ExtraBars.RemoveAll(b => b.Number == number) > 0;
|
||||
|
||||
public static List<DefSlot> NewSlots()
|
||||
{
|
||||
|
|
@ -177,7 +276,7 @@ internal sealed class DefData
|
|||
if (Recent.Count > MaxRecent) Recent.RemoveRange(MaxRecent, Recent.Count - MaxRecent);
|
||||
}
|
||||
|
||||
/// <summary>The slot (1-based number) that holds an item of this identity, or 0.</summary>
|
||||
/// <summary>The slot (1-based number) of the main bar's own slots that holds an item of this identity, or 0.</summary>
|
||||
public int SlotOf(ItemRef r)
|
||||
{
|
||||
for (int i = 0; i < Slots.Count; i++)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,21 @@ internal static class DefReplies
|
|||
_ => (false, $"This RynthCore has no {title} window (it needs plugin API v90)."),
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// /rdef daynight [show|hide]: the Day/Night timer after it (<paramref name="state"/> as <see cref="Window"/>),
|
||||
/// then the time now when the clock can be read (null = not in world): "Day/Night timer shown. Night now
|
||||
/// (Evensong); day in 23m of real time."
|
||||
/// </summary>
|
||||
public static (bool Ok, string Text) DayNight(int state, DerethNow? now)
|
||||
{
|
||||
string time = now is { } n
|
||||
? $" {(n.IsDay ? "Day" : "Night")} now ({n.HourName}); {n.Next.ToLowerInvariant()} in {DerethClock.Countdown(n.SecondsToChange)} of real time."
|
||||
: "";
|
||||
return state < 0
|
||||
? (false, "This RynthCore has no Day/Night timer window (it needs plugin API v90)." + time)
|
||||
: (true, CommandReply.Shown("Day/Night timer", state == 1) + time);
|
||||
}
|
||||
|
||||
/// <summary>A slot's use started (the result shows on the bar; a problem is said in chat).</summary>
|
||||
public static string UseSlot(DefSlot slot, int number) => slot.IsSpell
|
||||
? $"Casting {slot.SpellLabel} (slot {number})."
|
||||
|
|
@ -45,6 +60,13 @@ internal static class DefReplies
|
|||
return false;
|
||||
}
|
||||
|
||||
/// <summary>"/rdef shortcuts clearbusy [on|off]": what the option is now.</summary>
|
||||
public static string ClearBusy(bool on) => on
|
||||
? "Shortcuts clear a stuck busy state: on. A press held only by the client's busy count (nothing of RynthDefective's or "
|
||||
+ "RynthAi's in flight, no animation, no 'too busy' from the server just now) resets the count as /ra clearbusy does, then goes."
|
||||
: "Shortcuts clear a stuck busy state: off (the default). A busy count left by a death or a login holds a press for up to 4 s, "
|
||||
+ "then is ignored; the count itself is left alone.";
|
||||
|
||||
/// <summary>"/rdef selection stack" with no stack in the pack.</summary>
|
||||
public const string NoStack = "No stack in your pack to select.";
|
||||
|
||||
|
|
|
|||
|
|
@ -69,35 +69,58 @@ internal sealed class DefStore
|
|||
st.WeaponsButtonOnBar = Bool(s, "weaponsButtonOnBar", st.WeaponsButtonOnBar); // missing (a file from before 2026-10-29): off
|
||||
st.IndependentBar = Bool(s, "independentBar", st.IndependentBar); // missing (a file from before 2026-10-27): off
|
||||
st.QuantityBox = Bool(s, "quantityBox", st.QuantityBox); // missing (a file from before 2026-10-30): on
|
||||
st.ClearStuckBusy = Bool(s, "clearStuckBusy", st.ClearStuckBusy); // missing (a file from before 2026-11-04): off
|
||||
st.BarOpen = Bool(s, "barOpen", st.BarOpen);
|
||||
st.PickerOpen = Bool(s, "pickerOpen", st.PickerOpen);
|
||||
st.Clamp();
|
||||
}
|
||||
|
||||
if (root.TryGetProperty("slots", out JsonElement slots) && slots.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
int i = 0;
|
||||
foreach (JsonElement e in slots.EnumerateArray())
|
||||
{
|
||||
if (i >= DefSettings.SlotsMax) break;
|
||||
DefSlot slot = d.Slots[i++];
|
||||
if (e.ValueKind != JsonValueKind.Object) continue;
|
||||
slot.Item = ParseRef(e, "item");
|
||||
int mode = Int(e, "mode", 0);
|
||||
slot.Mode = mode >= 0 && mode <= (int)UseMode.Equip ? (UseMode)mode : UseMode.Auto;
|
||||
// A spell (2026-10-28; a file from before has none): only in a slot without an item.
|
||||
if (slot.Item == null && e.TryGetProperty("spell", out JsonElement sp) && sp.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
slot.SpellId = UInt(sp, "id");
|
||||
slot.SpellName = slot.SpellId != 0 ? Str(sp, "name") : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (root.TryGetProperty("slots", out JsonElement slots)) ParseSlots(slots, d.Slots);
|
||||
ParseRefs(root, "favourites", d.Favourites, DefData.MaxFavourites);
|
||||
ParseRefs(root, "recent", d.Recent, DefData.MaxRecent);
|
||||
|
||||
// The extra bars (2026-11-04; a file from before has none): a bad entry, a number out of range or
|
||||
// seen before, is skipped; at most ExtraBar.Max.
|
||||
if (root.TryGetProperty("extraBars", out JsonElement bars) && bars.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
foreach (JsonElement e in bars.EnumerateArray())
|
||||
{
|
||||
if (d.ExtraBars.Count >= ExtraBar.Max) break;
|
||||
if (e.ValueKind != JsonValueKind.Object) continue;
|
||||
int number = Int(e, "number", 0);
|
||||
if (!ExtraBar.ValidNumber(number) || d.Extra(number) != null) continue;
|
||||
var bar = new ExtraBar(number) { SlotCount = Int(e, "slotCount", ExtraBar.DefaultSlots) };
|
||||
if (e.TryGetProperty("slots", out JsonElement bs)) ParseSlots(bs, bar.Slots);
|
||||
bar.Fix();
|
||||
d.ExtraBars.Add(bar);
|
||||
}
|
||||
d.ExtraBars.Sort((a, b) => a.Number.CompareTo(b.Number));
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
/// <summary>A "slots" array into <paramref name="into"/> (fixed length: the extra entries are ignored).</summary>
|
||||
private static void ParseSlots(JsonElement slots, List<DefSlot> into)
|
||||
{
|
||||
if (slots.ValueKind != JsonValueKind.Array) return;
|
||||
int i = 0;
|
||||
foreach (JsonElement e in slots.EnumerateArray())
|
||||
{
|
||||
if (i >= into.Count) break;
|
||||
DefSlot slot = into[i++];
|
||||
if (e.ValueKind != JsonValueKind.Object) continue;
|
||||
slot.Item = ParseRef(e, "item");
|
||||
int mode = Int(e, "mode", 0);
|
||||
slot.Mode = mode >= 0 && mode <= (int)UseMode.Equip ? (UseMode)mode : UseMode.Auto;
|
||||
// A spell (2026-10-28; a file from before has none): only in a slot without an item.
|
||||
if (slot.Item == null && e.TryGetProperty("spell", out JsonElement sp) && sp.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
slot.SpellId = UInt(sp, "id");
|
||||
slot.SpellName = slot.SpellId != 0 ? Str(sp, "name") : string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ParseRefs(JsonElement root, string name, List<ItemRef> into, int max)
|
||||
{
|
||||
if (!root.TryGetProperty(name, out JsonElement arr) || arr.ValueKind != JsonValueKind.Array) return;
|
||||
|
|
@ -168,26 +191,12 @@ internal sealed class DefStore
|
|||
w.WriteBoolean("weaponsButtonOnBar", s.WeaponsButtonOnBar);
|
||||
w.WriteBoolean("independentBar", s.IndependentBar);
|
||||
w.WriteBoolean("quantityBox", s.QuantityBox);
|
||||
w.WriteBoolean("clearStuckBusy", s.ClearStuckBusy);
|
||||
w.WriteBoolean("barOpen", s.BarOpen);
|
||||
w.WriteBoolean("pickerOpen", s.PickerOpen);
|
||||
w.WriteEndObject();
|
||||
|
||||
w.WriteStartArray("slots");
|
||||
foreach (DefSlot slot in d.Slots)
|
||||
{
|
||||
w.WriteStartObject();
|
||||
if (slot.Item != null) WriteRef(w, "item", slot.Item);
|
||||
else if (slot.SpellId != 0)
|
||||
{
|
||||
w.WriteStartObject("spell");
|
||||
w.WriteNumber("id", slot.SpellId);
|
||||
w.WriteString("name", slot.SpellLabel);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteNumber("mode", (int)slot.Mode);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
WriteSlots(w, d.Slots);
|
||||
|
||||
w.WriteStartArray("favourites");
|
||||
foreach (ItemRef r in d.Favourites) WriteRefValue(w, r);
|
||||
|
|
@ -195,11 +204,42 @@ internal sealed class DefStore
|
|||
w.WriteStartArray("recent");
|
||||
foreach (ItemRef r in d.Recent) WriteRefValue(w, r);
|
||||
w.WriteEndArray();
|
||||
|
||||
w.WriteStartArray("extraBars");
|
||||
foreach (ExtraBar bar in d.ExtraBars)
|
||||
{
|
||||
w.WriteStartObject();
|
||||
w.WriteNumber("number", bar.Number);
|
||||
w.WriteNumber("slotCount", bar.SlotCount);
|
||||
WriteSlots(w, bar.Slots);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
w.WriteEndObject();
|
||||
}
|
||||
return Encoding.UTF8.GetString(ms.ToArray()) + "\n";
|
||||
}
|
||||
|
||||
private static void WriteSlots(Utf8JsonWriter w, List<DefSlot> slots)
|
||||
{
|
||||
w.WriteStartArray("slots");
|
||||
foreach (DefSlot slot in slots)
|
||||
{
|
||||
w.WriteStartObject();
|
||||
if (slot.Item != null) WriteRef(w, "item", slot.Item);
|
||||
else if (slot.SpellId != 0)
|
||||
{
|
||||
w.WriteStartObject("spell");
|
||||
w.WriteNumber("id", slot.SpellId);
|
||||
w.WriteString("name", slot.SpellLabel);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteNumber("mode", (int)slot.Mode);
|
||||
w.WriteEndObject();
|
||||
}
|
||||
w.WriteEndArray();
|
||||
}
|
||||
|
||||
private static void WriteRef(Utf8JsonWriter w, string name, ItemRef r)
|
||||
{
|
||||
w.WritePropertyName(name);
|
||||
|
|
|
|||
Loading…
Reference in a new issue