Snapshot for release 2026.10.19.1 (internal f0bdcf8)

This commit is contained in:
Tom Bohar 2026-10-19 09:11:22 -04:00
commit 39de36d3af
131 changed files with 11266 additions and 520 deletions

View file

@ -21,6 +21,9 @@ internal sealed partial class OracleView
w.Checkbox("Hide the replies to RynthOracle's own requests", "o.hide", s.HideOwnQuestReplies, v => { s.HideOwnQuestReplies = v; s.Save(); });
w.Tooltip("/myquests, and on their servers /b, /augs, /top and the like. A command you type yourself always shows its reply.");
w.Checkbox("Show the Void window for characters with Void Magic", "o.void", s.AutoShowVoidWindow, v => { s.AutoShowVoidWindow = v; s.Save(); });
w.Checkbox("Say in chat when a quest timer comes up", "o.alert", s.AlertTimers, v => { s.AlertTimers = v; s.Save(); });
w.Tooltip("Watches the quests you track (the * on the Quests tab) and prints a line the moment a cooldown ends.");
w.Checkbox("...for every quest you hold, not just tracked ones", "o.alertall", s.AlertAllTimers, v => { s.AlertAllTimers = v; s.Save(); });
w.Checkbox("Check once a day for a newer quest list", "o.daily", s.CheckQuestListDaily, v => { s.CheckQuestListDaily = v; s.Save(); });
w.Tooltip("Downloads Oracle of Dereth's master quest list from GitHub, as the original plugin does.");
@ -64,6 +67,7 @@ internal sealed partial class OracleView
w.SeparatorText("Commands");
w.BulletText("/ro open or close this window");
w.BulletText("/ro character the Character tab (status, session)");
w.BulletText("/ro skills the Skills tab (raise and train); /ro attributes, /ro progress likewise");
w.BulletText("/ro timers open or close the Quest Timers window");
w.BulletText("/ro fellowship the Fellowship tab");
w.BulletText("/ro about this tab (settings, server)");

View file

@ -34,9 +34,6 @@ internal sealed partial class OracleView
w.ToggleButton(cq.Boards[i].Label, "cb.tab." + i, i == _conquestBoard, () => _conquestBoard = index, small: true);
}
ConquestBoard b = cq.Boards[_conquestBoard];
w.Button("Refresh", "cb.refresh", () => _c.Send(cq.RequestBoard(b, _c.NowMs)));
w.Tooltip($"Sends {b.Command} and reads the reply.");
w.SameLine();
w.TextDisabled(b.UpdatedUtc == DateTime.MinValue ? "not read yet" : $"read at {b.UpdatedUtc.ToLocalTime():HH:mm}");
if (b.You != null) w.Text($"You: #{b.You.Rank} with {b.You.Value}");
DrawRows(w, "cb.rows", b.Rows);
@ -76,8 +73,6 @@ internal sealed partial class OracleView
if (_aelrynthView == 1)
{
w.Button("Refresh", "ab.me", () => _c.Send(a.RequestTop("me", _c.NowMs)));
w.Tooltip("Sends /top me.");
w.BeginChild("ab.melist", 0f, 0f, border: true);
foreach (AelrynthStanding s in a.Standings)
{
@ -93,9 +88,6 @@ internal sealed partial class OracleView
if (_aelrynthView == 2)
{
w.Button("Refresh", "ab.trials", () => _c.Send(a.RequestTrial("", _c.NowMs)));
w.Tooltip("Sends /trial.");
w.SameLine();
w.InputText("Dungeon", "ab.trialarg", _trialArg, 48, s => _trialArg = s);
w.SameLine();
w.Button("Top 10", "ab.trialtop", () => { if (_trialArg.Trim().Length > 0) _c.Send(a.RequestTrial(_trialArg, _c.NowMs)); });

View file

@ -44,9 +44,6 @@ internal sealed partial class OracleView
private void DrawConquestBank(UiWindow w)
{
ConquestData cq = _c.Conquest;
w.Button("Refresh", "cq.bank.refresh", () => _c.Send(cq.RequestBank(_c.NowMs)));
w.Tooltip("Sends /b and reads your balances.");
w.SameLine();
w.TextDisabled(ReadAt(cq.BankUtc));
foreach (NamedValue b in cq.Bank.OrderBy(b => b.Name, StringComparer.OrdinalIgnoreCase))
{
@ -90,9 +87,6 @@ internal sealed partial class OracleView
private void DrawConquestAugs(UiWindow w)
{
ConquestData cq = _c.Conquest;
w.Button("Refresh", "cq.augs.refresh", () => _c.Send(cq.RequestAugs(_c.NowMs)));
w.Tooltip("Sends /augs.");
w.SameLine();
w.TextDisabled($"{ReadAt(cq.AugsUtc)}, {cq.AugTotal} in total");
w.TextDisabled("Aug"); w.SameLine(120f); w.TextDisabled("Have"); w.SameLine(170f); w.TextDisabled("Next costs"); w.SameLine(330f); w.TextDisabled("Effect now");
foreach (ConquestAug a in cq.Augs)
@ -111,9 +105,6 @@ internal sealed partial class OracleView
private void DrawConquestEnl(UiWindow w)
{
ConquestData cq = _c.Conquest;
w.Button("Refresh", "cq.enl.refresh", () => _c.Send(cq.RequestEnl(_c.NowMs)));
w.Tooltip("Sends /enl augs.");
w.SameLine();
w.TextDisabled(ReadAt(cq.EnlUtc));
foreach (NamedValue a in cq.EnlAugs)
{
@ -157,9 +148,6 @@ internal sealed partial class OracleView
w.Text($"Next costs {TimeText.Number(ConquestData.EnlCoinCost(target))} coins and {(ConquestData.EnlLuminanceCost(target) / 1_000_000.0):0.##}M luminance");
w.SeparatorText("Experience bonuses");
w.Button("Refresh", "cq.bonus.refresh", () => _c.Send(cq.RequestBonus(_c.NowMs)));
w.Tooltip("Sends /bonus.");
w.SameLine();
w.TextDisabled(ReadAt(cq.BonusUtc));
foreach (NamedValue b in cq.Bonuses)
{
@ -172,9 +160,6 @@ internal sealed partial class OracleView
private void DrawConquestFships(UiWindow w)
{
ConquestData cq = _c.Conquest;
w.Button("Refresh", "cq.fship.refresh", () => _c.Send(cq.RequestFships(_c.NowMs)));
w.Tooltip("Sends /fship list.");
w.SameLine();
w.TextDisabled($"{ReadAt(cq.FshipUtc)}, {cq.Fellowships.Count} looking for members");
w.Combo("Sort", "cq.fship.sort", _fshipSort, new[] { "Name", "Leader", "Most members", "Location" }, i => _fshipSort = i);
var list = _fshipSort switch

View file

@ -9,12 +9,18 @@ namespace RynthCore.Plugin.RynthOracle.Views;
/// </summary>
internal sealed partial class OracleView
{
public const string TabQuests = "Quests", TabCharacter = "Character", TabAugs = "Augs", TabSociety = "Society",
public const string TabQuests = "Quests", TabCharacter = "Character",
TabSkills = "Skills", TabAttributes = "Attributes", TabProgress = "Progress",
TabAugs = "Augs", TabSociety = "Society",
TabMarkers = "Markers", TabTitles = "Titles", TabVoid = "Void", TabFellowship = "Fellowship",
TabBoards = "Leaderboards", TabConquest = "Conquest", 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);
/// <summary>
/// A tab: shown where any of its server tags matches the server; no tags = everywhere (retail).
/// Refresh is the page's Refresh button (Views\RefreshBar.cs); Help its tooltip.
/// </summary>
private sealed record TabDef(string Name, string[] Servers, Action<UiWindow> Draw, bool LiveTimers,
Func<RefreshResult> Refresh, Func<string> Help);
private readonly OracleContext _c;
private readonly TabDef[] _tabs;
@ -29,18 +35,35 @@ internal sealed partial class OracleView
string[] any = Array.Empty<string>();
_tabs = new TabDef[]
{
new(TabQuests, any, DrawQuests, true),
new(TabCharacter, any, DrawCharacter, true),
new(TabAugs, any, DrawAugs, true),
new(TabSociety, any, DrawSociety, true),
new(TabMarkers, any, DrawMarkers, false),
new(TabTitles, any, DrawTitles, false),
new(TabVoid, any, DrawVoid, true),
new(TabFellowship, any, DrawFellowship, false),
new(TabQuests, any, DrawQuests, true, () => RefreshQuests(),
() => "Sends /myquests to the server and reads the reply."),
new(TabCharacter, any, DrawCharacter, true, RefreshCharacter,
() => "Re-reads your level, experience, buffs and skills from the game now (and RynthAi's session)."),
// Skills / Attributes / Progress: RynthCore draws its Skills panel body under the tab
// strip (SkillsEmbed). The engine's panel reads the game itself, so there is no Refresh row.
new(TabSkills, any, DrawEmbedded, false, RefreshCharacter,
() => "RynthCore's skills panel: raise and train skills."),
new(TabAttributes, any, DrawEmbedded, false, RefreshCharacter,
() => "RynthCore's skills panel: attributes and vitals."),
new(TabProgress, any, DrawEmbedded, false, RefreshCharacter,
() => "RynthCore's skills panel: progression planners (Infinite Leaftide)."),
new(TabAugs, any, DrawAugs, true, RefreshCharacterAndQuests,
() => "Re-reads your character from the game and sends /myquests for the gem timers."),
new(TabSociety, any, DrawSociety, true, RefreshCharacterAndQuests,
() => "Re-reads your society standing from the game and sends /myquests for today's ribbons and quest timers."),
new(TabMarkers, any, DrawMarkers, false, () => RefreshQuests(),
() => "Sends /myquests: the markers you found are in your quest flags."),
new(TabTitles, any, DrawTitles, false, RefreshTitles,
() => "Re-reads the titles you hold from the game."),
new(TabVoid, any, DrawVoid, true, RefreshVoid,
() => "Re-reads your buffs from the game and drops the spell timers that ran out."),
new(TabFellowship, any, DrawFellowship, false, RefreshFellowship,
() => "Re-reads the fellowship and its members from the game."),
// 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(TabAbout, any, DrawAbout, false),
new(TabBoards, new[] { Data.ServerTags.Conquest, Data.ServerTags.Aelrynth }, DrawBoards, false, RefreshBoards, BoardsHelp),
new(TabConquest, new[] { Data.ServerTags.Conquest }, DrawConquest, true, RefreshConquest, ConquestHelp),
new(TabAbout, any, DrawAbout, false, RefreshAbout,
() => "Loads the quest list and server pack from their files again and asks RynthCore which server this is."),
};
}
@ -103,11 +126,20 @@ internal sealed partial class OracleView
return;
}
// Skills / Attributes / Progress: nothing more is recorded. The rest of the window is
// the region RynthCore fills with its Skills panel body (see SkillsEmbed), so the page
// has no Refresh row and no child of its own to cover it.
if (SkillsEmbed.IsEmbedTab(tab)) return;
if (current != null) DrawRefreshRow(w, current);
w.BeginChild("page." + tab, 0f, 0f, border: false);
(current?.Draw ?? DrawAbout)(w);
w.EndChild();
}
/// <summary>The Skills-family tabs record nothing: <see cref="Draw"/> returns before it would call this.</summary>
private void DrawEmbedded(UiWindow w) { }
// ── Shared helpers ──────────────────────────────────────────────────────
/// <summary>"Done" in green or "--" in grey, the status column most lists start with.</summary>
@ -125,7 +157,7 @@ internal sealed partial class OracleView
w.Text(value);
}
/// <summary>Prints a quest's name, status, notes and wiki link in chat (upstream "thinks" them).</summary>
/// <summary>Prints an entry's name, status, notes and wiki link in chat (upstream "thinks" them). Quests print more: <see cref="OracleContext.PrintQuest"/>.</summary>
private void PrintEntry(string name, string flag, string status, string details, string url)
{
_c.Print(flag.Length > 0 ? $"{name} ({flag}){(status.Length > 0 ? " - " + status : "")}" : name);

View file

@ -54,9 +54,10 @@ internal sealed class QuestTimersView
foreach (Quest q in _rows)
{
string flag = q.Flag;
w.Text(Cut(q.Label, 26));
Quest row = q;
w.Selectable(Cut(q.Label, 26), "qt.r." + flag, false, () => _c.PrintQuest(row), StatusX - 10f);
string reward = _c.Book.RewardText(flag);
w.Tooltip(reward.Length > 0 ? $"{q.Label}\n{flag}\nRewards: {reward}" : $"{q.Label}\n{flag}");
w.Tooltip((reward.Length > 0 ? $"{q.Label}\n{flag}\nRewards: {reward}" : $"{q.Label}\n{flag}") + "\nClick: prints its texts in chat.");
w.SameLine(StatusX);
QuestTimerState s = QuestTimer.State(q, flags, now, out string text);
bool held = flags.TryGet(flag, out _);
@ -74,7 +75,7 @@ internal sealed class QuestTimersView
if (flags.Loading) w.TextColored(UiColors.Yellow, "Reading quest flags...");
else if (flags.LastReadUtc == DateTime.MinValue) w.TextDisabled("Quest flags not read yet.");
w.SmallButton("Refresh", "qt.refresh", _c.RequestQuests);
w.SmallButton("Refresh", "qt.refresh", () => _c.RequestQuests());
w.Tooltip("Sends /myquests and reads the reply (timers count down by themselves between reads).");
if (flags.LastReadUtc != DateTime.MinValue)
{

View file

@ -51,9 +51,6 @@ internal sealed partial class OracleView
else
w.Text($"{flags.Flags.Count} quest flags on this character, read at {flags.LastReadUtc.ToLocalTime():HH:mm}.");
w.Button("Refresh", "q.refresh", _c.RequestQuests);
w.Tooltip("Sends /myquests to the server and reads the reply.");
w.SameLine();
bool timersShown = _c.QuestTimersWindowVisible();
w.Button(timersShown ? "Hide quest timers" : "Show quest timers", "q.timers", () => _c.SetQuestTimersWindow(!timersShown));
w.Tooltip("A small window with the quests you track (the * column) and the time left on each.");
@ -125,7 +122,7 @@ internal sealed partial class OracleView
w.SameLine(72f);
Quest row = q;
w.Selectable(Cut(q.Label, 44), "q.r." + flag, flag == _questSel, () => SelectQuest(row), 290f);
w.Tooltip(flag);
w.Tooltip(flag + "\nClick: opens it below and prints its texts in chat.");
w.SameLine(370f);
TimerText(w, q, flags, now, done);
string solves = q.SolvesText(flags);
@ -163,9 +160,14 @@ internal sealed partial class OracleView
// ── The opened quest and its rewards ──────────────────────────────────
/// <summary>
/// A click opens the quest below the list (a second click closes it) and, as upstream's list
/// does, prints its texts in chat: the info and hint, the wiki link and the flag's history.
/// </summary>
private void SelectQuest(Quest q)
{
if (_questSel == q.Flag) { _questSel = ""; return; } // a second click closes it
_c.PrintQuest(q);
if (_questSel == q.Flag) { _questSel = ""; return; }
_questSel = q.Flag;
_rewardMsg = "";
LoadRewardEdit(q.Flag);
@ -208,7 +210,7 @@ internal sealed partial class OracleView
w.Tooltip("List this quest in the Quest Timers window.");
w.SameLine();
Quest print = q;
w.Button("Print in chat", "q.sel.print", () => PrintQuest(print));
w.Button("Print in chat", "q.sel.print", () => _c.PrintQuest(print));
w.SameLine();
w.Button("Close", "q.sel.close", () => _questSel = "");
@ -272,13 +274,6 @@ internal sealed partial class OracleView
_rewardMsg = r.IsEmpty ? "Cleared." : "Saved: " + r.ShortSummary();
}
private void PrintQuest(Quest q)
{
string status = q.IsComplete(_c.Flags) ? q.Status(_c.Flags, _c.UtcNow) : "not done";
PrintEntry(q.IsNew ? (q.Name.Length > 0 ? q.Name : "Not in the quest list") : q.DisplayName, q.Flag, status, q.Details(), q.Url);
if (_c.Book.TryGetReward(q.Flag, out QuestReward r)) _c.Print("Rewards: " + r.LongSummary());
}
// ── Rows ──────────────────────────────────────────────────────────────
/// <summary>The filtered, sorted rows; rebuilt when the filter or data changed (or every 5 s for timers).</summary>

View file

@ -0,0 +1,213 @@
using System;
using System.Collections.Generic;
using RynthCore.Plugin.RynthOracle.Data;
using RynthCore.Plugin.RynthOracle.Ui;
namespace RynthCore.Plugin.RynthOracle.Views;
/// <summary>
/// The Refresh button every page of the Oracle window starts with, and the status line beside it.
/// What "refresh" means depends on where a page's data comes from:
/// - data the server owns (quest flags, ConquestAC's bank and boards, Aelrynth's /top and /trial)
/// is asked for again with the same command the page always used, and the line waits for the
/// reply;
/// - data read from the game client (level, buffs, titles, fellowship) is re-read at once instead
/// of at the next timer;
/// - files (the About page) are loaded again.
/// A page that needs both does both. Nothing here blocks: a request is one chat command, and the
/// same request is refused for <see cref="CooldownMs"/> after it went out (the quest read has its
/// own 5 s gap), so the button can't spam the server.
/// </summary>
internal sealed partial class OracleView
{
private const long CooldownMs = 3000;
private const long ReplyWaitMs = 15_000;
/// <summary>What a Refresh did, and (when it asked the server) how to tell the reply has landed.</summary>
private sealed record RefreshResult(string What, Func<bool>? Done = null);
private string _refreshScope = "", _refreshWhat = "";
private Func<bool>? _refreshDone;
private bool _refreshDoneSeen;
private long _refreshAtMs;
private DateTime _refreshAtUtc, _refreshDoneUtc;
private readonly Dictionary<string, long> _refreshSent = new();
/// <summary>The tab, plus the sub-page a tab has (Conquest's views, the boards), so a status line stays with its own page.</summary>
private string RefreshScope(string tab) => tab switch
{
TabConquest => tab + _conquestView,
TabBoards => tab + _aelrynthView + _conquestBoard,
_ => tab,
};
private void DrawRefreshRow(UiWindow w, TabDef def)
{
string scope = RefreshScope(def.Name);
w.Button("Refresh", "refresh." + scope, () => DoRefresh(def, scope), small: true);
w.Tooltip(def.Help());
if (_refreshScope != scope || _refreshWhat.Length == 0) return;
w.SameLine();
if (_refreshDone != null && !_refreshDoneSeen && _refreshDone())
{
_refreshDoneSeen = true;
_refreshDoneUtc = _c.UtcNow;
}
if (_refreshDone != null && !_refreshDoneSeen)
{
if (_c.NowMs - _refreshAtMs > ReplyWaitMs) w.TextColored(UiColors.Red, "No reply yet. Press Refresh to ask again.");
else w.TextColored(UiColors.Yellow, _refreshWhat + " Waiting for the reply...");
}
else if (_refreshDone != null)
w.TextDisabled($"Updated {_refreshDoneUtc.ToLocalTime():HH:mm:ss}. {_refreshWhat}");
else
w.TextDisabled($"Refreshed {_refreshAtUtc.ToLocalTime():HH:mm:ss}. {_refreshWhat}");
}
private void DoRefresh(TabDef def, string scope)
{
RefreshResult r;
try { r = def.Refresh(); }
catch (Exception ex) { r = new RefreshResult("Couldn't refresh: " + ex.Message); }
_refreshScope = scope;
_refreshWhat = r.What;
_refreshDone = r.Done;
_refreshDoneSeen = false;
_refreshAtMs = _c.NowMs;
_refreshAtUtc = _c.UtcNow;
}
// ── What each page's Refresh does ───────────────────────────────────────
/// <summary>The same request twice within <see cref="CooldownMs"/> is refused.</summary>
private bool CoolingDown(string key)
{
if (_refreshSent.TryGetValue(key, out long t) && _c.NowMs - t < CooldownMs) return true;
_refreshSent[key] = _c.NowMs;
return false;
}
private const string TooSoon = "That was just asked for; wait a few seconds before asking again.";
/// <summary>Sends one chat command (the page's own) and waits for <paramref name="state"/> to change.</summary>
private RefreshResult Ask(string key, Func<long> state, Func<string> command)
{
if (CoolingDown(key)) return new RefreshResult(TooSoon);
long before = state();
string cmd = command();
if (!_c.Send(cmd)) return new RefreshResult($"Couldn't send {cmd} (not in the world).");
return new RefreshResult($"Sent {cmd}.", () => state() != before);
}
/// <summary>/myquests (refused for 5 s after the last one); the line waits for the new flags.</summary>
private RefreshResult RefreshQuests(string before = "")
{
QuestFlagStore f = _c.Flags;
int rev = f.Revision;
if (_c.RequestQuests()) return new RefreshResult(before + "Asked the server for your quest flags (/myquests).", () => f.Revision != rev);
if (f.Loading) return new RefreshResult(before + "Your quest flags are already being read.", () => f.Revision != rev);
return new RefreshResult(before + "Your quest flags were asked for a moment ago; wait a few seconds before asking again.");
}
private RefreshResult RefreshCharacter()
{
_c.RereadCharacter();
return new RefreshResult("Re-read your level, experience, buffs and skills from the game.");
}
/// <summary>Pages built from the character's properties and the quest flags: both are read again.</summary>
private RefreshResult RefreshCharacterAndQuests()
{
_c.RereadCharacter();
return RefreshQuests("Re-read your character from the game. ");
}
private RefreshResult RefreshTitles()
{
_c.RereadTitles();
return new RefreshResult(_c.TitlesKnown
? $"Re-read your titles from the game: {_c.EarnedTitles.Count} held."
: "The game hasn't sent this character's titles yet (they arrive at login).");
}
private RefreshResult RefreshVoid()
{
_c.RereadCharacter();
return new RefreshResult("Re-read your buffs and dropped the spell timers that ran out. Timers on targets are learned from your casts.");
}
private RefreshResult RefreshFellowship()
{
_c.Fellowship.Invalidate();
return new RefreshResult("Re-read the fellowship from the game.");
}
private RefreshResult RefreshAbout()
{
if (CoolingDown("about")) return new RefreshResult(TooSoon);
_c.ReloadQuestList();
QuestCatalog cat = _c.Catalog;
string pack = cat.PackServer.Length > 0 ? $" + {cat.ServerCount} {cat.PackServer}" : "";
return new RefreshResult($"Reloaded the quest list ({cat.RetailCount} retail{pack}) and asked RynthCore which server this is.");
}
private RefreshResult RefreshBoards()
{
if (_c.Server.Is(ServerTags.Conquest))
{
ConquestData cq = _c.Conquest;
ConquestBoard b = cq.Boards[Math.Clamp(_conquestBoard, 0, cq.Boards.Count - 1)];
return Ask("board" + b.Key, () => b.UpdatedUtc.Ticks, () => cq.RequestBoard(b, _c.NowMs));
}
AelrynthBoards a = _c.Boards;
return _aelrynthView switch
{
1 => Ask("top me", () => a.Revision, () => a.RequestTop("me", _c.NowMs)),
2 => Ask("trial", () => a.Revision, () => a.RequestTrial("", _c.NowMs)),
_ => Ask("top " + _aelrynthBoardArg, () => a.Revision,
() => a.RequestTop(a.BoardTitle.Length > 0 ? _aelrynthBoardArg : "", _c.NowMs)),
};
}
private string BoardsHelp()
{
if (_c.Server.Is(ServerTags.Conquest))
{
ConquestBoard b = _c.Conquest.Boards[Math.Clamp(_conquestBoard, 0, _c.Conquest.Boards.Count - 1)];
return $"Sends {b.Command} and reads the reply.";
}
return _aelrynthView switch
{
1 => "Sends /top me and reads the reply.",
2 => "Sends /trial and reads the dungeon list.",
_ => "Sends /top (every board's leader), or asks again for the board that is open.",
};
}
private RefreshResult RefreshConquest()
{
ConquestData cq = _c.Conquest;
switch (_conquestView)
{
case 0: return Ask("bank", () => cq.BankUtc.Ticks, () => cq.RequestBank(_c.NowMs));
case 1: return Ask("augs", () => cq.AugsUtc.Ticks, () => cq.RequestAugs(_c.NowMs));
case 2: return Ask("enl", () => cq.EnlUtc.Ticks, () => cq.RequestEnl(_c.NowMs));
case 3:
_c.RereadCharacter();
return Ask("bonus", () => cq.BonusUtc.Ticks, () => cq.RequestBonus(_c.NowMs));
case 4: return Ask("fship", () => cq.FshipUtc.Ticks, () => cq.RequestFships(_c.NowMs));
default: return RefreshQuests();
}
}
private string ConquestHelp() => _conquestView switch
{
0 => "Sends /b and reads your balances.",
1 => "Sends /augs and reads your advanced augmentations.",
2 => "Sends /enl augs and reads your enlightenment augmentations.",
3 => "Re-reads your level, and sends /bonus for the experience bonuses.",
4 => "Sends /fship list and reads the fellowships looking for members.",
_ => "Sends /myquests: the custom quests' status comes from your quest flags.",
};
}

View file

@ -0,0 +1,90 @@
using System;
namespace RynthCore.Plugin.RynthOracle.Views;
/// <summary>
/// The Skills, Attributes and Progress tabs have no page of their own: RynthCore draws its Skills
/// panel body (raise and train, attributes and vitals, the ILT planners) into the Oracle window,
/// below the tab strip. This class is the plugin's half of that hand-off. It tells the engine
/// which body to draw with "/rc oracle-skills skills|attrs|progress" and to stop with
/// "/rc oracle-skills off".
///
/// It is a small state machine over what the engine was last told, so a command goes out only
/// when the wanted mode changes: never once per frame or per recorded pass. The first command,
/// once a character is in the world, is sent whatever the mode (usually "off"): the engine takes
/// any "/rc oracle-skills" as Oracle announcing that it has these tabs, and only then points the
/// bar's Skills icon and "/rc skills" at them instead of its standalone Skills panel.
/// </summary>
internal sealed class SkillsEmbed
{
/// <summary>The engine's word for "no embedded Skills body".</summary>
public const string Off = "off";
/// <summary>A failed send is tried again no sooner than this.</summary>
public const long RetryMs = 1000;
private readonly Func<string, bool> _send;
private string? _sent; // null until the first command has gone out (the engine knows nothing of us yet)
private long _retryAtMs;
/// <param name="send">Runs a chat command through the engine; false when it didn't go out.</param>
public SkillsEmbed(Func<string, bool> send) => _send = send;
/// <summary>What the engine was last told (and accepted): "skills", "attrs", "progress" or "off"; "off" before any command.</summary>
public string Sent => _sent ?? Off;
/// <summary>True once the engine has been sent a command (it then knows Oracle has these tabs).</summary>
public bool Announced => _sent != null;
/// <summary>The engine mode for an Oracle tab, or null when the tab isn't one of the three.</summary>
public static string? ModeFor(string tab) => tab switch
{
OracleView.TabSkills => "skills",
OracleView.TabAttributes => "attrs",
OracleView.TabProgress => "progress",
_ => null,
};
/// <summary>True for the tabs whose page is drawn by the engine.</summary>
public static bool IsEmbedTab(string tab) => ModeFor(tab) != null;
/// <summary>
/// The mode the engine should be in: the selected tab's while the Oracle window is showing and
/// a character is in the world, otherwise off.
/// </summary>
public static string Wanted(string tab, bool windowVisible, bool inWorld) =>
windowVisible && inWorld ? ModeFor(tab) ?? Off : Off;
/// <summary>
/// Sends the command for the wanted mode if it differs from the last one sent (the first
/// command waits for the world). Returns true when a command went out. A refused send leaves
/// the state as it was and is retried after <see cref="RetryMs"/>.
/// </summary>
public bool Update(string tab, bool windowVisible, bool inWorld, long nowMs)
{
if (_sent == null && !inWorld) return false;
string want = Wanted(tab, windowVisible, inWorld);
if (want == _sent || nowMs < _retryAtMs) return false;
if (!_send("/rc oracle-skills " + want))
{
_retryAtMs = nowMs + RetryMs;
return false;
}
_sent = want;
return true;
}
/// <summary>
/// Unload: leave the engine with no embedded body, whatever was shown. One attempt; nothing is
/// kept to retry. Returns true when a command went out.
/// </summary>
public bool Shutdown()
{
if (_sent == null || _sent == Off) return false;
bool ok;
try { ok = _send("/rc oracle-skills " + Off); }
catch { ok = false; }
if (ok) _sent = Off;
return ok;
}
}