feat(suite): Vaulted Dungeons tab, Oracle breeding/charms, Mini Remote Options
Port tonight's Suite work onto standing sk for upstream release prep: ILT Vaulted Dungeons (Options-gated), chat 0x1C channels, Oracle Charms/Pet Breeding, Mini Remote Options opens Settings. HandWrittenVersion stays 0.5.0-legacy-ui. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
dc8cc9bc81
commit
0532d8d981
43 changed files with 2129 additions and 197 deletions
232
Plugins/RynthCore.Plugin.RynthOracle/Data/IltServerProfile.cs
Normal file
232
Plugins/RynthCore.Plugin.RynthOracle/Data/IltServerProfile.cs
Normal file
|
|
@ -0,0 +1,232 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using RynthCore.Plugin.Shared;
|
||||
using RynthCore.PluginSdk;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
/// <summary>One Leaftide feature from RynthILT's profile: its state on this server and where it lives.</summary>
|
||||
internal sealed record IltFeature(string Key, string Label, string Group, int State, string Where);
|
||||
|
||||
/// <summary>
|
||||
/// The ACECustom quest bonus list ("/qb list") as RynthILT last read it (the profile's "questBonus"
|
||||
/// object). <see cref="Generation"/> 0 = not loaded this session; <see cref="Count"/> -1 = unknown.
|
||||
/// </summary>
|
||||
internal sealed record IltQuestBonusList(bool Disabled, int Generation, long Count, string Status,
|
||||
IReadOnlyList<string> Completed, IReadOnlyList<string> Incomplete);
|
||||
|
||||
/// <summary>
|
||||
/// What RynthILT reports about the Infinite Leaftide server (the "RynthILT.Server" profile JSON,
|
||||
/// Plugins/Shared/RynthIltServerApi.cs): whether this is an ILT world, the Leaftide features with
|
||||
/// their server state, and the fellowship rules. <see cref="None"/> without RynthILT; every field is
|
||||
/// read leniently so an older or newer RynthILT still parses.
|
||||
/// </summary>
|
||||
internal sealed class IltServerProfile
|
||||
{
|
||||
/// <summary>No RynthILT (or nothing parsed): a retail fellowship and no features.</summary>
|
||||
public static readonly IltServerProfile None = new();
|
||||
|
||||
/// <summary>RynthILT answered with a profile.</summary>
|
||||
public bool Available { get; private init; }
|
||||
public bool Ilt { get; private init; }
|
||||
public string World { get; private init; } = "";
|
||||
public bool Forced { get; private init; }
|
||||
public string Source { get; private init; } = "";
|
||||
/// <summary>Last server-options check (UTC); MinValue = never.</summary>
|
||||
public DateTime CheckedUtc { get; private init; } = DateTime.MinValue;
|
||||
public IReadOnlyList<IltFeature> Features { get; private init; } = Array.Empty<IltFeature>();
|
||||
|
||||
/// <summary>The server's fellowship size limit (retail 9 without RynthILT or off ILT).</summary>
|
||||
public int FellowshipMax { get; private init; } = RynthIltServer.RetailFellowshipMax;
|
||||
/// <summary>Fellowship feature states (RynthIltServer.State*): Zone Share, Fellowship Blackjack, luminance share.</summary>
|
||||
public int ZoneShare { get; private init; } = RynthIltServer.StateUnknown;
|
||||
public int Blackjack { get; private init; } = RynthIltServer.StateUnknown;
|
||||
public int LuminanceShare { get; private init; } = RynthIltServer.StateUnknown;
|
||||
|
||||
/// <summary>The /qb list (ILT worlds with RynthILT 0.2.3 or later); null = none offered.</summary>
|
||||
public IltQuestBonusList? QuestBonus { get; private init; }
|
||||
|
||||
/// <summary>The features in one group, in RynthILT's order.</summary>
|
||||
public IEnumerable<IltFeature> InGroup(string group)
|
||||
{
|
||||
foreach (IltFeature f in Features)
|
||||
if (string.Equals(f.Group, group, StringComparison.OrdinalIgnoreCase)) yield return f;
|
||||
}
|
||||
|
||||
/// <summary>Parses the profile JSON; <see cref="None"/> when it is empty or not JSON.</summary>
|
||||
public static IltServerProfile Parse(string? json)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(json)) return None;
|
||||
try
|
||||
{
|
||||
using JsonDocument doc = JsonDocument.Parse(json);
|
||||
JsonElement root = doc.RootElement;
|
||||
if (root.ValueKind != JsonValueKind.Object) return None;
|
||||
|
||||
var features = new List<IltFeature>();
|
||||
if (root.TryGetProperty("features", out JsonElement fs) && fs.ValueKind == JsonValueKind.Array)
|
||||
{
|
||||
foreach (JsonElement f in fs.EnumerateArray())
|
||||
{
|
||||
if (f.ValueKind != JsonValueKind.Object) continue;
|
||||
string key = Str(f, "key");
|
||||
if (key.Length == 0) continue;
|
||||
string label = Str(f, "label");
|
||||
features.Add(new IltFeature(key, label.Length > 0 ? label : key, Str(f, "group"),
|
||||
Int(f, "state", RynthIltServer.StateUnknown), Str(f, "where")));
|
||||
}
|
||||
}
|
||||
|
||||
bool ilt = Bool(root, "ilt");
|
||||
int max = RynthIltServer.RetailFellowshipMax;
|
||||
int zone = RynthIltServer.StateUnknown, bj = RynthIltServer.StateUnknown, lum = RynthIltServer.StateUnknown;
|
||||
if (root.TryGetProperty("fellowship", out JsonElement fel) && fel.ValueKind == JsonValueKind.Object)
|
||||
{
|
||||
max = Int(fel, "maxMembers", max);
|
||||
zone = Int(fel, "zoneShare", zone);
|
||||
bj = Int(fel, "blackjack", bj);
|
||||
lum = Int(fel, "luminanceShare", lum);
|
||||
}
|
||||
// A bogus size would let the tab claim room nobody has; stay within what the reader handles.
|
||||
if (max < 1 || max > 64) max = RynthIltServer.RetailFellowshipMax;
|
||||
|
||||
DateTime checkedUtc = DateTime.MinValue;
|
||||
string when = Str(root, "checked");
|
||||
if (when.Length > 0
|
||||
&& DateTime.TryParse(when, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal | DateTimeStyles.AssumeUniversal, out DateTime t))
|
||||
checkedUtc = t;
|
||||
|
||||
return new IltServerProfile
|
||||
{
|
||||
Available = true,
|
||||
Ilt = ilt,
|
||||
World = Str(root, "world"),
|
||||
Forced = Bool(root, "forced"),
|
||||
Source = Str(root, "source"),
|
||||
CheckedUtc = checkedUtc,
|
||||
Features = features,
|
||||
FellowshipMax = max,
|
||||
ZoneShare = zone,
|
||||
Blackjack = bj,
|
||||
LuminanceShare = lum,
|
||||
QuestBonus = ParseQuestBonus(root),
|
||||
};
|
||||
}
|
||||
catch (JsonException)
|
||||
{
|
||||
return None;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>The "questBonus" object, or null when the profile has none.</summary>
|
||||
private static IltQuestBonusList? ParseQuestBonus(JsonElement root)
|
||||
{
|
||||
if (!root.TryGetProperty("questBonus", out JsonElement q) || q.ValueKind != JsonValueKind.Object) return null;
|
||||
long count = q.TryGetProperty("count", out JsonElement c) && c.ValueKind == JsonValueKind.Number && c.TryGetInt64(out long n) ? n : -1;
|
||||
return new IltQuestBonusList(Bool(q, "disabled"), Int(q, "generation", 0), count, Str(q, "status"),
|
||||
Strings(q, "completed"), Strings(q, "incomplete"));
|
||||
}
|
||||
|
||||
private static string[] Strings(JsonElement o, string name)
|
||||
{
|
||||
if (!o.TryGetProperty(name, out JsonElement a) || a.ValueKind != JsonValueKind.Array) return Array.Empty<string>();
|
||||
var list = new List<string>(a.GetArrayLength());
|
||||
foreach (JsonElement e in a.EnumerateArray())
|
||||
if (e.ValueKind == JsonValueKind.String && e.GetString() is { Length: > 0 } s) list.Add(s);
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>"on", "off" or "checking" for a feature state.</summary>
|
||||
public static string StateText(int state) => state switch
|
||||
{
|
||||
RynthIltServer.StateOn => "on",
|
||||
RynthIltServer.StateOff => "off",
|
||||
_ => "checking",
|
||||
};
|
||||
|
||||
private static string Str(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.String ? v.GetString() ?? "" : "";
|
||||
|
||||
private static bool Bool(JsonElement o, string name) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.True;
|
||||
|
||||
private static int Int(JsonElement o, string name, int fallback) =>
|
||||
o.TryGetProperty(name, out JsonElement v) && v.ValueKind == JsonValueKind.Number && v.TryGetInt32(out int i) ? i : fallback;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads RynthILT's "RynthILT.Server" interface on the plugin pump. Looks the table up through the
|
||||
/// host (re-checked while RynthILT is missing or after it unloads, Version 0) and copies the JSON
|
||||
/// out every <see cref="PollMs"/>; <see cref="Revision"/> goes up when the profile changes.
|
||||
/// </summary>
|
||||
internal sealed unsafe class IltServerLink
|
||||
{
|
||||
private const long PollMs = 2000;
|
||||
private const long RequeryMs = 10_000;
|
||||
// Room for the /qb list (hundreds of flags) on top of the features.
|
||||
private const int MaxBuffer = 512 * 1024;
|
||||
|
||||
private RynthIltServerApiV1* _table;
|
||||
private long _nextPollAt, _nextQueryAt;
|
||||
private byte[] _buffer = new byte[8192];
|
||||
private string _lastJson = "";
|
||||
|
||||
public IltServerProfile Profile { get; private set; } = IltServerProfile.None;
|
||||
public int Revision { get; private set; }
|
||||
|
||||
/// <summary>Forget the profile (logout); the next poll reads it again.</summary>
|
||||
public void Clear()
|
||||
{
|
||||
_nextPollAt = 0;
|
||||
SetJson("");
|
||||
}
|
||||
|
||||
/// <summary>Pump thread. Cheap when not due.</summary>
|
||||
public void Poll(RynthCoreHost host, long now)
|
||||
{
|
||||
if (now < _nextPollAt) return;
|
||||
_nextPollAt = now + PollMs;
|
||||
RynthIltServerApiV1* t = Table(host, now);
|
||||
SetJson(t == null ? "" : Read(t));
|
||||
}
|
||||
|
||||
/// <summary>The table, re-queried when it is missing or RynthILT has shut down (Version 0).</summary>
|
||||
private RynthIltServerApiV1* Table(RynthCoreHost host, long now)
|
||||
{
|
||||
if (_table != null && _table->Version >= 1) return _table;
|
||||
_table = null;
|
||||
if (now < _nextQueryAt || !host.HasGetPluginInterface) return null;
|
||||
_nextQueryAt = now + RequeryMs;
|
||||
var p = (RynthIltServerApiV1*)host.GetPluginInterface(RynthIltServer.PluginName, RynthIltServerApiV1.InterfaceName, RynthIltServerApiV1.InterfaceVersion);
|
||||
if (p != null && p->Version >= 1 && p->StructSize >= (uint)sizeof(RynthIltServerApiV1) && p->GetProfileJson != null)
|
||||
_table = p;
|
||||
return _table;
|
||||
}
|
||||
|
||||
/// <summary>Copies the JSON out, growing the buffer once when RynthILT says it didn't fit.</summary>
|
||||
private string Read(RynthIltServerApiV1* t)
|
||||
{
|
||||
for (int attempt = 0; attempt < 2; attempt++)
|
||||
{
|
||||
int len;
|
||||
fixed (byte* b = _buffer) len = t->GetProfileJson(b, _buffer.Length);
|
||||
if (len <= 0) return "";
|
||||
if (len < _buffer.Length) return Encoding.UTF8.GetString(_buffer, 0, len);
|
||||
if (len + 1 > MaxBuffer) return "";
|
||||
_buffer = new byte[len + 1024];
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/// <summary>Takes a profile JSON (internal: the tests feed one without RynthILT).</summary>
|
||||
internal void SetJson(string json)
|
||||
{
|
||||
if (json == _lastJson) return;
|
||||
_lastJson = json;
|
||||
Profile = IltServerProfile.Parse(json);
|
||||
Revision++;
|
||||
}
|
||||
}
|
||||
|
|
@ -10,9 +10,11 @@ internal static class ServerTags
|
|||
public const string Aelrynth = "Aelrynth";
|
||||
public const string Conquest = "Conquest";
|
||||
public const string Levistras = "Levistras";
|
||||
/// <summary>Infinite Leaftide (ACECustom). Its server rules come from RynthILT ("RynthILT.Server").</summary>
|
||||
public const string InfiniteLeaftide = "InfiniteLeaftide";
|
||||
|
||||
/// <summary>Tags with a quest pack (Resources\quests.<tag>.csv) or features.</summary>
|
||||
public static readonly string[] Known = { Aelrynth, Conquest, Levistras };
|
||||
public static readonly string[] Known = { Aelrynth, Conquest, Levistras, InfiniteLeaftide };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -31,8 +33,9 @@ internal static class ServerTags
|
|||
/// mod's player properties 9101-9103, which only Aelrynth sends.
|
||||
/// Aelrynth's live config still names the world "Aeshnidae" (its earlier name); both count.
|
||||
/// ConquestAC and Levistras are matched on their world names, as upstream does
|
||||
/// (Decal's CharacterFilter.Server). Infinite Leaftide has no RynthOracle pages: its screens are
|
||||
/// RynthILT's, so RynthCore's "ilt" server gives no tag here.
|
||||
/// (Decal's CharacterFilter.Server). Infinite Leaftide is matched on a world name containing
|
||||
/// "Leaftide", or on RynthILT's own verdict (its world list or the character's override) when
|
||||
/// RynthILT is loaded.
|
||||
/// </summary>
|
||||
internal sealed class ServerIdentity
|
||||
{
|
||||
|
|
@ -55,11 +58,12 @@ internal sealed class ServerIdentity
|
|||
Set("", "", "not logged in");
|
||||
}
|
||||
|
||||
/// <param name="rynthIltSaysIlt">RynthILT's profile reports an ILT world (IltServerLink); false without RynthILT.</param>
|
||||
/// <param name="engine">
|
||||
/// RynthCore's server list (plugin API v86, ServerStateClient); null on older engines. When there,
|
||||
/// it decides: it already applies this character's overrides and the Diagnostics page's pick.
|
||||
/// </param>
|
||||
public void Refresh(RynthCoreHost host, uint playerId, EngineServerState? engine = null)
|
||||
public void Refresh(RynthCoreHost host, uint playerId, bool rynthIltSaysIlt = false, EngineServerState? engine = null)
|
||||
{
|
||||
if (engine != null)
|
||||
{
|
||||
|
|
@ -98,6 +102,11 @@ internal sealed class ServerIdentity
|
|||
source = "the Aelrynth Bank properties (older engine)";
|
||||
}
|
||||
}
|
||||
if (tag.Length == 0 && rynthIltSaysIlt)
|
||||
{
|
||||
tag = ServerTags.InfiniteLeaftide;
|
||||
source = "RynthILT: an Infinite Leaftide world";
|
||||
}
|
||||
Set(tag, world, source);
|
||||
}
|
||||
|
||||
|
|
@ -139,6 +148,7 @@ internal sealed class ServerIdentity
|
|||
/// <summary>The tag for a RynthCore server id; "" for servers without RynthOracle features.</summary>
|
||||
public static string TagForEngineId(string? id) => (id ?? "").Trim().ToLowerInvariant() switch
|
||||
{
|
||||
EngineServerState.IltId => ServerTags.InfiniteLeaftide,
|
||||
EngineServerState.AelrynthId => ServerTags.Aelrynth,
|
||||
"conquest" => ServerTags.Conquest,
|
||||
"levistras" => ServerTags.Levistras,
|
||||
|
|
@ -148,6 +158,7 @@ internal sealed class ServerIdentity
|
|||
/// <summary>The RynthCore server id for a tag; "" for none.</summary>
|
||||
public static string EngineIdForTag(string? tag) => tag switch
|
||||
{
|
||||
ServerTags.InfiniteLeaftide => EngineServerState.IltId,
|
||||
ServerTags.Aelrynth => EngineServerState.AelrynthId,
|
||||
ServerTags.Conquest => "conquest",
|
||||
ServerTags.Levistras => "levistras",
|
||||
|
|
@ -165,6 +176,9 @@ internal sealed class ServerIdentity
|
|||
return ServerTags.Conquest;
|
||||
if (w.Equals(ServerTags.Levistras, StringComparison.OrdinalIgnoreCase))
|
||||
return ServerTags.Levistras;
|
||||
// "InfiniteLeaftide", "Infinite Leaftide", staging copies: RynthILT's own world rule.
|
||||
if (w.IndexOf("Leaftide", StringComparison.OrdinalIgnoreCase) >= 0)
|
||||
return ServerTags.InfiniteLeaftide;
|
||||
return "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -19,11 +19,26 @@ internal sealed class OracleContext
|
|||
public readonly VoidTracker Void = new();
|
||||
public readonly FellowshipTracker Fellowship = new();
|
||||
public readonly ServerIdentity Server = new();
|
||||
/// <summary>RynthILT's server profile (Leaftide features, fellowship rules); None without RynthILT.</summary>
|
||||
public readonly IltServerLink Ilt = new();
|
||||
/// <summary>RynthILT's "RynthILT.Data" (the Character tab's charms list and Toggle buttons).</summary>
|
||||
public readonly RynthCore.Plugin.Shared.RynthIltDataClient IltData = new();
|
||||
/// <summary>The charms RynthILT last reported (None without RynthILT); read while the Character tab shows.</summary>
|
||||
public RynthCore.Plugin.Shared.IltCharmsView Charms = RynthCore.Plugin.Shared.IltCharmsView.None;
|
||||
/// <summary>RynthAi's session (the one session every tracker shows); read while the Character tab shows.</summary>
|
||||
public readonly RynthCore.Plugin.Shared.RynthAiSessionClient AiSession = new();
|
||||
/// <summary>The last session RynthAi reported; SessionKnown false without RynthAi.</summary>
|
||||
public RynthCore.Plugin.Shared.SessionStatsV1 Session;
|
||||
public bool SessionKnown;
|
||||
/// <summary>The last charm Toggle's outcome, shown under the charms list.</summary>
|
||||
public string CharmMessage = "";
|
||||
/// <summary>RynthILT's pet breeding tracker (None without it); read while the Pet Breeding tab shows.</summary>
|
||||
public RynthCore.Plugin.Shared.IltBreedingView Breeding = RynthCore.Plugin.Shared.IltBreedingView.None;
|
||||
/// <summary>The last breeding button's outcome, shown under the tab's buttons.</summary>
|
||||
public string BreedingMessage = "";
|
||||
|
||||
/// <summary>Set by the plugin: sends a verb to RynthILT's breeding tracker (RynthIltDataApi PetBreedingCommand).</summary>
|
||||
public Func<string, bool> BreedingCommand = _ => false;
|
||||
/// <summary>RynthCore's server list (API v86) and the active server owner's settings; State null on older engines.</summary>
|
||||
public readonly RynthCore.Plugin.Shared.ServerStateClient ServerState = new();
|
||||
/// <summary>ConquestAC-only data (tag Conquest); fed only while on ConquestAC.</summary>
|
||||
|
|
@ -48,6 +63,9 @@ internal sealed class OracleContext
|
|||
/// <summary>Set by the plugin: sends a chat command to the server as if typed (the views' buttons).</summary>
|
||||
public Func<string, bool> Send = _ => false;
|
||||
|
||||
/// <summary>Set by the plugin: asks RynthILT to use a carried charm or Guardian Hand (its toggle id).</summary>
|
||||
public Func<uint, bool> ToggleCharm = _ => false;
|
||||
|
||||
/// <summary>Set by the plugin: runs a chat command through RynthCore's plugin dispatch (another plugin's window).</summary>
|
||||
public Func<string, bool> RunCommand = _ => false;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ public static unsafe class PluginExports
|
|||
public static IntPtr GetVersion()
|
||||
{
|
||||
// Keep in step with RynthOraclePlugin.Version (a u8 literal can't be built from a const string).
|
||||
try { return LiteralPointer("0.2.1"u8); }
|
||||
try { return LiteralPointer("0.2.8"u8); }
|
||||
catch { return IntPtr.Zero; }
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,15 +52,22 @@
|
|||
<ItemGroup>
|
||||
<!-- Fellowship reader (client memory, VirtualQuery-guarded), shared source with RynthAi. -->
|
||||
<Compile Include="..\RynthCore.Plugin.RynthAi\Combat\FellowshipTracker.cs" Link="Shared\FellowshipTracker.cs" />
|
||||
<!-- RynthILT's "RynthILT.Server" interface (server profile: Leaftide features, fellowship rules). -->
|
||||
<Compile Include="..\Shared\RynthIltServerApi.cs" Link="Shared\RynthIltServerApi.cs" />
|
||||
<Compile Include="..\Shared\RynthIltDataApi.cs" Link="Shared\RynthIltDataApi.cs" />
|
||||
<!-- RynthAi's session stats ("RynthAi.Hub" SessionStats): the Character tab's session rates
|
||||
count the same session as the Mini Remote's Session Stats. -->
|
||||
<Compile Include="..\Shared\RynthAiHubApi.cs" Link="Shared\RynthAiHubApi.cs" />
|
||||
<Compile Include="..\Shared\RynthAiSessionClient.cs" Link="Shared\RynthAiSessionClient.cs" />
|
||||
<!-- RynthCore's server list (API v86) and the active server's settings from its plugin
|
||||
("RynthServer.Profile"): which server this is, overrides included. -->
|
||||
("RynthServer.Profile" / "RynthILT.Server"): which server this is, overrides included. -->
|
||||
<Compile Include="..\Shared\RynthServerProfileApi.cs" Link="Shared\RynthServerProfileApi.cs" />
|
||||
<Compile Include="..\Shared\EngineServerState.cs" Link="Shared\EngineServerState.cs" />
|
||||
<Compile Include="..\Shared\ServerStateClient.cs" Link="Shared\ServerStateClient.cs" />
|
||||
<!-- Infinite Leaftide's /fship commands for the Fellowship tab: RynthILT's list and the shared
|
||||
argument rules (quoting, required names), shared source rather than copied. Both are pure. -->
|
||||
<Compile Include="..\Shared\ServerCommandShare.cs" Link="Shared\ServerCommandShare.cs" />
|
||||
<Compile Include="..\RynthCore.Plugin.RynthILT\IltFellowship\IltFellowshipCommands.cs" Link="Shared\IltFellowshipCommands.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -18,12 +18,12 @@ namespace RynthCore.Plugin.RynthOracle;
|
|||
/// </summary>
|
||||
public sealed class RynthOraclePlugin : RynthPluginBase
|
||||
{
|
||||
// Previous release: 0.2.0.
|
||||
public const string Version = "0.2.1";
|
||||
// Previous release: 0.2.5.
|
||||
public const string Version = "0.2.8";
|
||||
|
||||
private const long QuestReadDelayMs = 6000; // after login, before the hidden /myquests
|
||||
private const long CharacterReadMs = 1000;
|
||||
// The Character tab's session (RynthAi): read only while that tab is on screen.
|
||||
// The Character tab's charms (RynthILT) and session (RynthAi): read only while that tab is on screen.
|
||||
private const long CharacterExtrasReadMs = 2000;
|
||||
private const long BookWorldWaitMs = 15_000; // how long the quest book waits for the world name
|
||||
|
||||
|
|
@ -40,9 +40,12 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
private long _loginMs;
|
||||
private long _nextCharacterReadMs;
|
||||
private long _nextCharacterExtrasMs;
|
||||
private string _charmsJson = "";
|
||||
private long _nextBreedingMs;
|
||||
private string _breedingJson = "";
|
||||
private bool _voidAutoDecided;
|
||||
private bool _dailyCheckStarted;
|
||||
private int _seenFlagRevision = -1, _seenCatalogRevision = -1, _seenVoidRevision = -1;
|
||||
private int _seenFlagRevision = -1, _seenCatalogRevision = -1, _seenVoidRevision = -1, _seenIltRevision = -1;
|
||||
// RynthCore's server list (ServerStateClient.Revision) last applied to the server identity.
|
||||
private int _seenServerStateRevision = -1;
|
||||
private bool _noUiLogged;
|
||||
|
|
@ -59,6 +62,8 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.RequestQuests = RequestQuests;
|
||||
_c.Send = cmd => _c.InWorld && Host.InvokeChatParser(cmd);
|
||||
_c.RunCommand = cmd => _c.InWorld && Host.InvokeChatParser(cmd);
|
||||
_c.ToggleCharm = ToggleCharm;
|
||||
_c.BreedingCommand = BreedingCommand;
|
||||
_ui.Log = msg => Host.Log(msg);
|
||||
|
||||
_mainView = new OracleView(_c);
|
||||
|
|
@ -112,10 +117,12 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.Flags.Clear();
|
||||
_c.Void.Clear();
|
||||
_c.Server.Reset();
|
||||
_c.Ilt.Clear();
|
||||
_c.Ilt.Poll(Host, Environment.TickCount64);
|
||||
_c.ServerState.Clear();
|
||||
_c.ServerState.Poll(Host, Environment.TickCount64, force: true);
|
||||
_seenServerStateRevision = _c.ServerState.Revision;
|
||||
_c.Server.Refresh(Host, Host.GetPlayerId(), _c.ServerState.State);
|
||||
_c.Server.Refresh(Host, Host.GetPlayerId(), _c.Ilt.Profile.Ilt, _c.ServerState.State);
|
||||
_catalogTag = null;
|
||||
ApplyServer();
|
||||
_conquestLoginRead = false;
|
||||
|
|
@ -153,23 +160,40 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.Conquest.Clear();
|
||||
_c.Boards.Clear();
|
||||
_c.Server.Reset();
|
||||
_c.Ilt.Clear();
|
||||
_c.ServerState.Clear();
|
||||
_c.TitlesKnown = false;
|
||||
_c.EarnedTitles.Clear();
|
||||
ClearCharacterExtras();
|
||||
}
|
||||
|
||||
/// <summary>Forgets the Character tab's session (login, logout): the next character's comes fresh.</summary>
|
||||
/// <summary>Forgets the Character tab's charms and session (login, logout): the next character's come fresh.</summary>
|
||||
private void ClearCharacterExtras()
|
||||
{
|
||||
_c.Charms = Shared.IltCharmsView.None;
|
||||
_charmsJson = "";
|
||||
_c.CharmMessage = "";
|
||||
_c.Breeding = Shared.IltBreedingView.None;
|
||||
_breedingJson = "";
|
||||
_c.BreedingMessage = "";
|
||||
_c.Session = default;
|
||||
_c.SessionKnown = false;
|
||||
_c.AiSession.Reset();
|
||||
}
|
||||
|
||||
/// <summary>The Character tab's Toggle: RynthILT checks the id is one of the player's charms and uses it.</summary>
|
||||
private bool ToggleCharm(uint id)
|
||||
{
|
||||
bool ok = _c.InWorld && _c.IltData.ToggleCharm(Host, Environment.TickCount64, id);
|
||||
_c.CharmMessage = ok ? "Toggled; the status updates in a moment." : "RynthILT didn't take that (not carried any more, or RynthILT isn't loaded).";
|
||||
_nextCharacterExtrasMs = Environment.TickCount64 + 1000; // re-read soon so the new state shows
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// While the Character tab is on screen: RynthAi's session, every <see cref="CharacterExtrasReadMs"/>.
|
||||
/// Nothing is read with the window closed or on another tab.
|
||||
/// While the Character tab is on screen: RynthILT's charms JSON and RynthAi's session, every
|
||||
/// <see cref="CharacterExtrasReadMs"/>. Nothing is read with the window closed or on another tab.
|
||||
/// </summary>
|
||||
private void ReadCharacterExtras(long now)
|
||||
{
|
||||
|
|
@ -177,6 +201,13 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
if (now < _nextCharacterExtrasMs) return;
|
||||
_nextCharacterExtrasMs = now + CharacterExtrasReadMs;
|
||||
|
||||
string json = _c.IltData.ReadCharms(Host, now);
|
||||
if (!string.Equals(json, _charmsJson, StringComparison.Ordinal))
|
||||
{
|
||||
_charmsJson = json;
|
||||
_c.Charms = Shared.IltCharmsView.Parse(json);
|
||||
_main.NeedsPass = true;
|
||||
}
|
||||
bool known = _c.AiSession.TryGet(Host, now, out Shared.SessionStatsV1 s);
|
||||
if (known != _c.SessionKnown || known && (s.Xp != _c.Session.Xp || s.Lum != _c.Session.Lum || s.Kills != _c.Session.Kills))
|
||||
_main.NeedsPass = true;
|
||||
|
|
@ -184,12 +215,40 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_c.Session = known ? s : default;
|
||||
}
|
||||
|
||||
/// <summary>The Pet Breeding tab's buttons: a verb for RynthILT's tracker, then a quick re-read.</summary>
|
||||
private bool BreedingCommand(string verb)
|
||||
{
|
||||
long now = Environment.TickCount64;
|
||||
bool ok = _c.InWorld && _c.IltData.PetBreedingCommand(Host, now, verb);
|
||||
_c.BreedingMessage = ok ? "Sent to RynthILT; the tab updates in a moment." : "RynthILT didn't take that (not loaded, or older than 0.2.7).";
|
||||
_nextBreedingMs = now + 800;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
return ok;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// While the Pet Breeding tab is on screen: RynthILT's breeding JSON every <see cref="CharacterExtrasReadMs"/>
|
||||
/// (reading it keeps RynthILT's tracker scanning). Nothing is read with the window closed or on another tab.
|
||||
/// </summary>
|
||||
private void ReadBreeding(long now)
|
||||
{
|
||||
if (_main == null || _mainView == null || !_main.Visible || _mainView.Tab != OracleView.TabBreeding) return;
|
||||
if (now < _nextBreedingMs) return;
|
||||
_nextBreedingMs = now + CharacterExtrasReadMs;
|
||||
string json = _c.IltData.ReadPetBreeding(Host, now);
|
||||
if (string.Equals(json, _breedingJson, StringComparison.Ordinal)) return;
|
||||
_breedingJson = json;
|
||||
_c.Breeding = Shared.IltBreedingView.Parse(json);
|
||||
_main.NeedsPass = true;
|
||||
}
|
||||
|
||||
/// <summary>Shows the main window on a tab (another plugin's link, or a /ro tab command).</summary>
|
||||
private void ShowTab(string tab)
|
||||
{
|
||||
if (_mainView != null) _mainView.Tab = tab;
|
||||
if (_main != null) { _main.Visible = true; _main.NeedsPass = true; }
|
||||
if (tab == OracleView.TabCharacter) _nextCharacterExtrasMs = 0; // read at once
|
||||
if (tab == OracleView.TabBreeding) _nextBreedingMs = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -310,11 +369,20 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
break;
|
||||
case "character":
|
||||
case "char":
|
||||
// The Character tab: the character overview and RynthAi's session (the generic part of
|
||||
// the Mini Remote's old Character tab; Infinite Leaftide's charms stay RynthILT's).
|
||||
case "charms":
|
||||
case "charm":
|
||||
// The Character tab: where the Mini Remote's Character and Charms tabs moved (2026-10-13).
|
||||
// RynthAi, RynthILT and RynthCore's menus link here; it shows, never toggles off.
|
||||
ShowTab(OracleView.TabCharacter);
|
||||
break;
|
||||
case "breeding":
|
||||
case "breed":
|
||||
case "pets":
|
||||
// The Pet Breeding tab (Infinite Leaftide): RynthAi's Character menu and its Pets > Breeding tab link here.
|
||||
if (!_c.Server.Is(ServerTags.InfiniteLeaftide))
|
||||
_c.Print("Pet breeding is an Infinite Leaftide feature; this server isn't recognised as Infinite Leaftide.");
|
||||
ShowTab(OracleView.TabBreeding);
|
||||
break;
|
||||
case "status":
|
||||
string pack = _c.Catalog.PackServer.Length > 0 ? $" + {_c.Catalog.ServerCount} {_c.Catalog.PackServer}" : "";
|
||||
string titles = _c.TitlesKnown ? $", {_c.EarnedTitles.Count} titles held" : "";
|
||||
|
|
@ -322,18 +390,20 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
+ $"{_c.Flags.Flags.Count} quest flags read, {_c.Catalog.RetailCount} retail quests{pack}, {_c.Void.Dots.Count} Void spells tracked{titles}.");
|
||||
break;
|
||||
case "about":
|
||||
// The About tab (settings, the server RynthCore says this is).
|
||||
case "features":
|
||||
// The About tab (its "Server features" list is RynthILT's; RynthILT's settings link here).
|
||||
_c.Print("Based on Oracle of Dereth by Advis Eveldan - thank you! github.com/advis61/OracleOfDereth (MIT)");
|
||||
ShowTab(OracleView.TabAbout);
|
||||
break;
|
||||
default:
|
||||
_c.Print("Commands: /ro (window), /ro character (Character tab: status, session), /ro void (Void window), "
|
||||
+ "/ro timers (Quest Timers window), /ro fellowship (Fellowship tab), /ro quests (read quest flags), /ro status, "
|
||||
+ "/ro about (About tab: settings, server)");
|
||||
_c.Print("Commands: /ro (window), /ro character (Character tab: status, session, charms), /ro void (Void window), "
|
||||
+ "/ro timers (Quest Timers window), /ro fellowship (Fellowship tab), /ro breeding (Pet Breeding tab, Infinite Leaftide), "
|
||||
+ "/ro quests (read quest flags), /ro status, "
|
||||
+ "/ro about (About tab: settings, server features)");
|
||||
break;
|
||||
}
|
||||
if (arg is "" or "void" or "timers" or "timer" or "fellowship" or "fellow" or "fship" or "character" or "char"
|
||||
or "about" && !Host.HasUi && !_noUiLogged)
|
||||
if (arg is "" or "void" or "timers" or "timer" or "fellowship" or "fellow" or "fship" or "character" or "char" or "charms" or "charm"
|
||||
or "breeding" or "breed" or "pets" or "about" or "features" && !Host.HasUi && !_noUiLogged)
|
||||
{
|
||||
_noUiLogged = true;
|
||||
_c.Print("This RynthCore engine can't show plugin windows (it needs script windows, API v71, with ImGui on). /ro status still works.");
|
||||
|
|
@ -418,14 +488,23 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
|
||||
if (!_c.InWorld) return;
|
||||
|
||||
// RynthILT's profile (every 2 s): the Fellowship tab's size and Leaftide fellowship features.
|
||||
_c.Ilt.Poll(Host, now);
|
||||
if (_c.Ilt.Revision != _seenIltRevision)
|
||||
{
|
||||
_seenIltRevision = _c.Ilt.Revision;
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
|
||||
ReadCharacterExtras(now);
|
||||
ReadBreeding(now);
|
||||
|
||||
// RynthCore's server list (every 2 s): a new pick or override applies now, not at the next character read.
|
||||
_c.ServerState.Poll(Host, now);
|
||||
if (_c.ServerState.Revision != _seenServerStateRevision)
|
||||
{
|
||||
_seenServerStateRevision = _c.ServerState.Revision;
|
||||
_c.Server.Refresh(Host, _c.Character.PlayerId != 0 ? _c.Character.PlayerId : Host.GetPlayerId(), _c.ServerState.State);
|
||||
_c.Server.Refresh(Host, _c.Character.PlayerId != 0 ? _c.Character.PlayerId : Host.GetPlayerId(), _c.Ilt.Profile.Ilt, _c.ServerState.State);
|
||||
ApplyServer();
|
||||
if (_main != null) _main.NeedsPass = true;
|
||||
}
|
||||
|
|
@ -451,7 +530,7 @@ public sealed class RynthOraclePlugin : RynthPluginBase
|
|||
_nextCharacterReadMs = now + CharacterReadMs;
|
||||
_c.Character.Read(Host);
|
||||
_c.Void.RemoveExpired(now);
|
||||
_c.Server.Refresh(Host, _c.Character.PlayerId, _c.ServerState.State);
|
||||
_c.Server.Refresh(Host, _c.Character.PlayerId, _c.Ilt.Profile.Ilt, _c.ServerState.State);
|
||||
ApplyServer();
|
||||
LoadQuestBook(now);
|
||||
ReadTitles();
|
||||
|
|
|
|||
|
|
@ -8,9 +8,8 @@ namespace RynthCore.Plugin.RynthOracle.Views;
|
|||
|
||||
/// <summary>
|
||||
/// Character: level and experience, luminance, the status summary (upstream's Status HUD: buff,
|
||||
/// house, beer, page and rare timers, key skills, aetheria surges), RynthAi's session (the generic
|
||||
/// part of the Mini Remote's old Character tab, moved here 2026-10-13) and the full buff list.
|
||||
/// Infinite Leaftide's charms stay RynthILT's (its Charms tab in the Mini Remote).
|
||||
/// house, beer, page and rare timers, key skills, aetheria surges), RynthAi's session, RynthILT's
|
||||
/// charms (the Mini Remote's Character and Charms tabs moved here 2026-10-13) and the full buff list.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
|
|
@ -57,6 +56,7 @@ internal sealed partial class OracleView
|
|||
Field(w, "Summoning", SkillText(c.Summoning), 300f, 400f);
|
||||
|
||||
DrawSession(w);
|
||||
DrawCharms(w);
|
||||
|
||||
var list = new List<ActiveEnchantment>(c.Enchantments);
|
||||
list.Sort((a, b) => a.Remaining.CompareTo(b.Remaining));
|
||||
|
|
@ -105,6 +105,97 @@ internal sealed partial class OracleView
|
|||
|
||||
private static string RateText(double perHour) => perHour > 0 ? TimeText.Number((long)Math.Round(perHour)) : "0";
|
||||
|
||||
/// <summary>
|
||||
/// "Charms": RynthILT's Infinite Leaftide charm list (the Mini Remote's old Charms tab), with a
|
||||
/// Toggle for each carried charm and Guardian Hand. Nothing is listed here: RynthILT sends the
|
||||
/// list, so a charm it learns about shows up without an Oracle update.
|
||||
/// </summary>
|
||||
private void DrawCharms(UiWindow w)
|
||||
{
|
||||
Shared.IltCharmsView v = _c.Charms;
|
||||
if (!v.Loaded)
|
||||
{
|
||||
if (_c.Server.Is(ServerTags.InfiniteLeaftide))
|
||||
{
|
||||
w.SeparatorText("Charms");
|
||||
w.TextDisabled("Load RynthILT to list your Infinite Leaftide charms here.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (!v.Available) return; // not an ILT world: no charms
|
||||
|
||||
w.SeparatorText("Charms");
|
||||
w.TextDisabled($"{v.Acquired} acquired, {v.Active} on (from RynthILT{(v.World.Length > 0 ? ", " + v.World : "")}).");
|
||||
if (_c.CharmMessage.Length > 0) w.TextDisabled(_c.CharmMessage);
|
||||
|
||||
if (w.CollapsingHeader($"Charms ({v.Charms.Count})", "c.charms", defaultOpen: true))
|
||||
{
|
||||
if (v.Charms.Count == 0) w.TextDisabled("RynthILT hasn't listed any charms yet.");
|
||||
for (int i = 0; i < v.Charms.Count; i++)
|
||||
{
|
||||
Shared.IltCharmRow r = v.Charms[i];
|
||||
CharmState(w, r.Active);
|
||||
w.SameLine(50f);
|
||||
if (r.Carried) w.Text(Cut(r.Name, 30));
|
||||
else w.TextDisabled(Cut(r.Name, 30));
|
||||
if (r.Effect.Length > 0) w.Tooltip(r.Effect);
|
||||
w.SameLine(270f);
|
||||
w.TextDisabled(r.MaxTier > 0 ? $"T{r.Tier}/{r.MaxTier}" : r.Tier > 0 ? $"T{r.Tier}" : "-");
|
||||
w.SameLine(330f);
|
||||
w.TextDisabled(AcquiredText(r));
|
||||
if (r.Server == "off")
|
||||
{
|
||||
w.SameLine(430f);
|
||||
w.TextColored(UiColors.Red, "server off");
|
||||
}
|
||||
if (r.Carried && r.ToggleId != 0)
|
||||
{
|
||||
w.SameLine(510f);
|
||||
uint id = r.ToggleId;
|
||||
w.SmallButton("Toggle", "c.charm." + i, () => _c.ToggleCharm(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (v.Hands.Count > 0 && w.CollapsingHeader($"Guardian Hands ({v.Hands.Count})", "c.hands", defaultOpen: true))
|
||||
{
|
||||
for (int i = 0; i < v.Hands.Count; i++)
|
||||
{
|
||||
Shared.IltHandRow h = v.Hands[i];
|
||||
CharmState(w, h.Active);
|
||||
w.SameLine(50f);
|
||||
w.Text(Cut(h.Name, 30));
|
||||
if (h.Server == "off")
|
||||
{
|
||||
w.SameLine(430f);
|
||||
w.TextColored(UiColors.Red, "server off");
|
||||
}
|
||||
w.SameLine(510f);
|
||||
uint id = h.Id;
|
||||
w.SmallButton("Toggle", "c.hand." + i, () => _c.ToggleCharm(id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>ON in green, OFF in red, "?" in grey (status not read yet).</summary>
|
||||
private static void CharmState(UiWindow w, string active)
|
||||
{
|
||||
switch (active)
|
||||
{
|
||||
case "on": w.TextColored(UiColors.Green, "ON"); break;
|
||||
case "off": w.TextColored(UiColors.Red, "OFF"); break;
|
||||
default: w.TextColored(UiColors.Grey, "?"); break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Carried (with the count), stored (seen on this character before) or not acquired.</summary>
|
||||
internal static string AcquiredText(Shared.IltCharmRow r) => r.Acquired switch
|
||||
{
|
||||
"carried" => r.Count > 1 ? $"carried x{r.Count}" : "carried",
|
||||
"seen" => r.LastSeen.Length > 0 ? "seen " + r.LastSeen : "seen",
|
||||
_ => "not acquired",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// The buff timer: the soonest-ending long (over 15 minutes) buff that isn't a beer, a debuff
|
||||
/// or one of the not-really-buffs, with how many there are (upstream's rule).
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ internal sealed partial class OracleView
|
|||
{
|
||||
public const string TabQuests = "Quests", TabCharacter = "Character", TabAugs = "Augs", TabSociety = "Society",
|
||||
TabMarkers = "Markers", TabTitles = "Titles", TabVoid = "Void", TabFellowship = "Fellowship",
|
||||
TabBoards = "Leaderboards", TabConquest = "Conquest", TabAbout = "About";
|
||||
TabBoards = "Leaderboards", TabConquest = "Conquest", TabBreeding = "Pet Breeding", TabAbout = "About";
|
||||
|
||||
/// <summary>A tab: shown where any of its server tags matches the server; no tags = everywhere (retail).</summary>
|
||||
private sealed record TabDef(string Name, string[] Servers, Action<UiWindow> Draw, bool LiveTimers);
|
||||
|
|
@ -40,6 +40,7 @@ internal sealed partial class OracleView
|
|||
// Server-specific: each parser and its commands only exist on its own server.
|
||||
new(TabBoards, new[] { Data.ServerTags.Conquest, Data.ServerTags.Aelrynth }, DrawBoards, false),
|
||||
new(TabConquest, new[] { Data.ServerTags.Conquest }, DrawConquest, true),
|
||||
new(TabBreeding, new[] { Data.ServerTags.InfiniteLeaftide }, DrawBreeding, false),
|
||||
new(TabAbout, any, DrawAbout, false),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
204
Plugins/RynthCore.Plugin.RynthOracle/Views/PetBreedingTab.cs
Normal file
204
Plugins/RynthCore.Plugin.RynthOracle/Views/PetBreedingTab.cs
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// "Pet Breeding" (Infinite Leaftide): RynthILT's breeding tracker, the same one as RynthAi's Mini
|
||||
/// Remote Pets > Breeding tab. RynthILT reads the essences, learns the server's rules and runs the
|
||||
/// actions; this tab draws its JSON ("RynthILT.Data" GetPetBreedingJson) and sends its verbs back.
|
||||
/// Dance and supply uses ask here first (RynthILT doesn't ask again).
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
/// <summary>Essence rows drawn at most (each is about eight ops; the window's op budget is shared).</summary>
|
||||
private const int BreedingMaxRows = 40;
|
||||
|
||||
/// <summary>The breeding verb waiting for Yes / No, with its question ("" = none).</summary>
|
||||
private string _breedConfirmVerb = "", _breedConfirmText = "";
|
||||
/// <summary>The essence the supplies are used on (index into the essence list).</summary>
|
||||
private int _breedTarget;
|
||||
|
||||
private void DrawBreeding(UiWindow w)
|
||||
{
|
||||
IltBreedingView v = _c.Breeding;
|
||||
w.SeparatorText("Pet Breeding");
|
||||
if (!v.Loaded)
|
||||
{
|
||||
w.TextDisabled(_c.IltData.Connected && !_c.IltData.PetBreedingSupported
|
||||
? "This RynthILT is older than 0.2.7 and has no breeding tracker; update RynthILT."
|
||||
: "Load RynthILT (0.2.7 or later) to track pet breeding here. Reading...");
|
||||
return;
|
||||
}
|
||||
|
||||
uint col = v.Enabled == "off" ? UiColors.Red : v.Enabled == "on" ? UiColors.Green : UiColors.Yellow;
|
||||
w.TextColored(col, v.Enabled switch
|
||||
{
|
||||
"off" => "Pet breeding is off on this server.",
|
||||
"on" => $"Pet breeding: on. Breeding room: {v.Room}.",
|
||||
_ => "Pet breeding: not confirmed yet (Diagnostics in the breeding room checks).",
|
||||
});
|
||||
if (v.Bond == "off") w.TextColored(UiColors.Yellow, "Pet bond is off here, so bond can't reach the breeding minimum.");
|
||||
|
||||
w.SmallButton("Refresh", "br.refresh", () => _c.BreedingCommand(IltBreedingView.RefreshVerb()));
|
||||
w.Tooltip("Re-appraise every essence (charges, rest timers, bond, growth).");
|
||||
w.SameLine();
|
||||
w.SmallButton("Diagnostics", "br.debug", () => _c.BreedingCommand(IltBreedingView.DebugVerb()));
|
||||
w.Tooltip("@breed-debug: whether you're in the breeding room, your pet, partners nearby.");
|
||||
w.SameLine();
|
||||
w.SmallButton("Dance", "br.dance", () => AskBreeding(IltBreedingView.DanceVerb(),
|
||||
"Dance now? If your partner dances in time with both pets summoned in the same room, the breed happens."));
|
||||
w.Tooltip("@dance: both owners must dance within a few seconds.");
|
||||
w.SameLine();
|
||||
w.SmallButton("Mini Remote", "br.remote", () => _c.RunCommand("/ra hub open breeding"));
|
||||
w.Tooltip("RynthAi's Mini Remote, Pets > Breeding (the same tracker, with the pair planner).");
|
||||
|
||||
if (_breedConfirmVerb.Length > 0)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, _breedConfirmText);
|
||||
string verb = _breedConfirmVerb;
|
||||
w.SmallButton("Yes", "br.yes", () => { _breedConfirmVerb = ""; _c.BreedingCommand(verb); });
|
||||
w.SameLine();
|
||||
w.SmallButton("No", "br.no", () => _breedConfirmVerb = "");
|
||||
}
|
||||
if (v.Message.Length > 0) w.TextDisabled(v.Message);
|
||||
else if (_c.BreedingMessage.Length > 0) w.TextDisabled(_c.BreedingMessage);
|
||||
if (v.FreeSlots == 0) w.TextColored(UiColors.Yellow, "Your main pack is full: as the dam's owner you couldn't receive the baby.");
|
||||
|
||||
DrawBreedEssences(w, v);
|
||||
DrawBreedPairs(w, v);
|
||||
DrawBreedSupplies(w, v);
|
||||
DrawBreedRules(w, v);
|
||||
DrawBreedEvents(w, v);
|
||||
}
|
||||
|
||||
/// <summary>Holds a verb until the player clicks Yes.</summary>
|
||||
private void AskBreeding(string verb, string question)
|
||||
{
|
||||
_breedConfirmVerb = verb;
|
||||
_breedConfirmText = question;
|
||||
}
|
||||
|
||||
private void DrawBreedEssences(UiWindow w, IltBreedingView v)
|
||||
{
|
||||
int ready = 0;
|
||||
foreach (IltBreedEssenceRow e in v.Essences) if (e.Ready) ready++;
|
||||
if (!w.CollapsingHeader($"Essences ({ready} ready of {v.Essences.Count})", "br.ess", defaultOpen: true)) return;
|
||||
if (v.Essences.Count == 0) { w.TextDisabled("No combat pet essences in your pack."); return; }
|
||||
for (int i = 0; i < v.Essences.Count && i < BreedingMaxRows; i++)
|
||||
{
|
||||
IltBreedEssenceRow e = v.Essences[i];
|
||||
w.TextColored(e.Ready ? UiColors.Green : e.Problems.Count > 0 && e.ReadyIn > 0 ? UiColors.Yellow : UiColors.Grey, Cut(e.Status, 22));
|
||||
w.SameLine(170f);
|
||||
w.Text(Cut(e.Name, 32));
|
||||
w.Tooltip(BreedTooltip(e));
|
||||
w.SameLine(410f);
|
||||
w.TextDisabled($"{(e.Male ? "M" : "F")} T{(e.Tier > 0 ? e.Tier.ToString(CultureInfo.InvariantCulture) : "?")} B{e.Bond} "
|
||||
+ $"Mut {e.Mutations}{(e.PotencyMutations > 0 ? "+" + e.PotencyMutations + "p" : "")}");
|
||||
}
|
||||
if (v.Essences.Count > BreedingMaxRows) w.TextDisabled($"... and {v.Essences.Count - BreedingMaxRows} more (see the Mini Remote).");
|
||||
}
|
||||
|
||||
private static string BreedTooltip(IltBreedEssenceRow e)
|
||||
{
|
||||
var lines = new List<string> { $"{e.Name}: {(e.Male ? "stud" : "dam")}, tier {e.Tier}, bond {e.Bond}" };
|
||||
if (e.Male) lines.Add($"Charges {e.Charges}/{e.ChargesMax}");
|
||||
if (e.Juvenile) lines.Add($"Growing: {e.Stage}, {Math.Max(0, e.KillsRequired - e.Kills)} kills to Adult");
|
||||
if (e.Boosters.Count > 0) lines.Add("Boosters: " + string.Join(", ", e.Boosters));
|
||||
foreach (string p in e.Problems) lines.Add("- " + p);
|
||||
return string.Join("\n", lines);
|
||||
}
|
||||
|
||||
private static void DrawBreedPairs(UiWindow w, IltBreedingView v)
|
||||
{
|
||||
if (v.Pairs.Count == 0) return;
|
||||
if (!w.CollapsingHeader($"Ready pairs ({v.Pairs.Count})", "br.pairs", defaultOpen: true)) return;
|
||||
w.TextDisabled("Stat mutation odds; fewer inherited mutations keep the odds up. Each owner dances with their own pet.");
|
||||
for (int i = 0; i < v.Pairs.Count; i++)
|
||||
{
|
||||
IltBreedPairRow p = v.Pairs[i];
|
||||
w.Text($"{Cut(p.Stud, 26)} x {Cut(p.Dam, 26)}");
|
||||
w.SameLine(400f);
|
||||
w.TextDisabled($"{Pct(p.ChanceWorst)}-{Pct(p.ChanceBest)}, inherits {p.InheritMin}-{p.InheritMax}");
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawBreedSupplies(UiWindow w, IltBreedingView v)
|
||||
{
|
||||
long carried = 0;
|
||||
foreach (IltBreedSupplyRow s in v.Supplies) carried += s.Count;
|
||||
if (!w.CollapsingHeader($"Supplies ({carried} carried)", "br.sup", defaultOpen: false)) return;
|
||||
w.TextDisabled("Ivo sells these at the Seedy Motel. Boosters are spent by the essence's next breed.");
|
||||
|
||||
IltBreedEssenceRow? target = null;
|
||||
if (v.Essences.Count > 0)
|
||||
{
|
||||
var names = new List<string>(v.Essences.Count);
|
||||
foreach (IltBreedEssenceRow e in v.Essences) names.Add(Cut(e.Name, 34));
|
||||
int index = Math.Clamp(_breedTarget, 0, v.Essences.Count - 1);
|
||||
w.Combo("Use on", "br.target", index, names, i => _breedTarget = i);
|
||||
target = v.Essences[index];
|
||||
}
|
||||
|
||||
for (int i = 0; i < v.Supplies.Count; i++)
|
||||
{
|
||||
IltBreedSupplyRow s = v.Supplies[i];
|
||||
w.TextColored(s.Count > 0 ? UiColors.Green : UiColors.Grey, $"{s.Count,3} {s.Name}");
|
||||
w.Tooltip(s.Price > 0 ? $"{s.Effect}\nIvo's price: {Price(s.Price)} pyreals" : s.Effect);
|
||||
if (!s.Apply || s.Count <= 0 || target == null) continue;
|
||||
w.SameLine(330f);
|
||||
if (System.Linq.Enumerable.Contains(s.Targets, target.Id))
|
||||
{
|
||||
string verb = IltBreedingView.ApplyVerb(s.Key, target.Id);
|
||||
string q = $"Use {s.Name} on {target.Name}? {s.Effect}";
|
||||
w.SmallButton("Use", "br.use." + i, () => AskBreeding(verb, q));
|
||||
}
|
||||
else w.TextDisabled("-");
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawBreedRules(UiWindow w, IltBreedingView v)
|
||||
{
|
||||
if (!w.CollapsingHeader("Server rules", "br.rules", defaultOpen: false)) return;
|
||||
w.TextDisabled("Values this server showed win over the ILT profile, which wins over ACE's defaults.");
|
||||
foreach (IltBreedRuleRow r in v.Rules)
|
||||
{
|
||||
w.Text(r.Label);
|
||||
if (r.Help.Length > 0) w.Tooltip(r.Help);
|
||||
w.SameLine(230f);
|
||||
w.Text(r.Value);
|
||||
w.SameLine(310f);
|
||||
w.TextColored(r.Source == "seen on server" ? UiColors.Green : UiColors.Grey, r.Source);
|
||||
}
|
||||
if (v.Debug is { } d)
|
||||
{
|
||||
w.Separator();
|
||||
w.TextDisabled($"Last diagnostics ({d.When} UTC):");
|
||||
if (d.Location.Length > 0) w.BulletText("You: " + d.Location);
|
||||
if (d.Match.Length > 0) w.BulletText(d.Match == "valid" ? "In the breeding room" : "Not in the breeding room");
|
||||
if (d.Pet.Length > 0) w.BulletText("Pet: " + d.Pet + (d.Sex.Length > 0 ? " (" + d.Sex + ")" : ""));
|
||||
if (d.Partners >= 0) w.BulletText($"Partners nearby: {d.Partners}");
|
||||
}
|
||||
}
|
||||
|
||||
private static void DrawBreedEvents(UiWindow w, IltBreedingView v)
|
||||
{
|
||||
if (!w.CollapsingHeader($"Recent events ({v.Events.Count})", "br.events", defaultOpen: false)) return;
|
||||
if (v.Events.Count == 0) w.TextDisabled("Nothing yet: rituals, births, growth and charges land here.");
|
||||
foreach (IltBreedEventRow e in v.Events)
|
||||
{
|
||||
w.TextDisabled(e.When);
|
||||
w.SameLine(130f);
|
||||
w.TextWrapped(e.Text);
|
||||
}
|
||||
}
|
||||
|
||||
private static string Pct(double v) => (v * 100).ToString("0.#", CultureInfo.InvariantCulture) + "%";
|
||||
|
||||
private static string Price(long p) => p >= 1_000_000
|
||||
? (p / 1_000_000.0).ToString("0.##", CultureInfo.InvariantCulture) + "M"
|
||||
: p.ToString("N0", CultureInfo.InvariantCulture);
|
||||
}
|
||||
Loading…
Reference in a new issue