Snapshot for release 2026.10.20.1 (internal 7116fab)
This commit is contained in:
parent
2a20c7acd6
commit
bfcd48950d
215 changed files with 16200 additions and 2838 deletions
|
|
@ -19,7 +19,7 @@ internal sealed partial class OracleView
|
|||
w.Checkbox("Read quest flags when you log in", "o.readlogin", s.ReadQuestsAtLogin, v => { s.ReadQuestsAtLogin = v; s.Save(); });
|
||||
w.Tooltip("Sends /myquests once after login so the quest pages have data.");
|
||||
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.Tooltip("/myquests. 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.");
|
||||
|
|
@ -29,7 +29,9 @@ internal sealed partial class OracleView
|
|||
|
||||
w.SeparatorText("Server");
|
||||
ServerIdentity sv = _c.Server;
|
||||
w.Text(sv.Tag.Length > 0 ? $"{sv.Tag}: its own pages and quest pack are on." : "No server-specific pages here (retail features only).");
|
||||
w.Text(sv.Tag.Length == 0 ? "No server-specific pages here (retail features only)."
|
||||
: sv.Is(ServerTags.InfiniteLeaftide) ? $"{sv.Tag}: its own pages are on (stamps and guardians on the Quests tab, Pet Breeding)."
|
||||
: $"{sv.Tag}: its own pages and quest pack are on.");
|
||||
w.TextDisabled($"How it was decided: {sv.Source}");
|
||||
// RynthCore's server list (API v86) and the active server's settings from the plugin that owns it.
|
||||
RynthCore.Plugin.Shared.ServerStateClient st = _c.ServerState;
|
||||
|
|
@ -48,6 +50,8 @@ internal sealed partial class OracleView
|
|||
w.TextDisabled($"This engine is API v{_c.Host.Version}; v86 lets RynthOracle follow RynthCore's server pick and overrides.");
|
||||
if (_c.Host.Version < 75) w.TextDisabled($"This engine is API v{_c.Host.Version}; v75 adds a surer server check and the titles you hold.");
|
||||
|
||||
DrawServerFeatures(w);
|
||||
|
||||
w.SeparatorText("Quest list");
|
||||
QuestCatalog cat = _c.Catalog;
|
||||
w.Text($"{cat.RetailCount} retail quests from the {cat.Source}" +
|
||||
|
|
@ -66,17 +70,79 @@ 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 character the Character tab (status, session, charms)");
|
||||
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)");
|
||||
w.BulletText("/ro trackers the Quests tab, trackers only (Legendary, markers, and on ILT stamps and guardians)");
|
||||
w.BulletText("/ro legendary John's Legendary Key quests: have, missing, repeat timers");
|
||||
w.BulletText("/ro markers the 100 exploration markers: found and still to find");
|
||||
if (_c.Server.Is(Data.ServerTags.InfiniteLeaftide))
|
||||
{
|
||||
w.BulletText("/ro dynamic Infinite Leaftide Dynamic Stamps: NPC stamps you have and are missing");
|
||||
w.BulletText("/ro guardians the Temple guardians: riddle answers, auto hand-in, buy if missing, turn-ins");
|
||||
w.BulletText("/ro breeding the Pet Breeding tab (when the server has pet breeding)");
|
||||
}
|
||||
w.BulletText("/ro about this tab (settings, server, server features)");
|
||||
w.BulletText("/ro void open or close the Void window");
|
||||
w.BulletText("/ro quests read your quest flags now");
|
||||
w.BulletText("/ro help list the commands in chat");
|
||||
w.TextDisabled("A server quest pack can be replaced without a rebuild: put quests.<server>.csv in %APPDATA%\\RynthCore\\RynthOracle\\packs.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Server features": the Leaftide feature list RynthILT keeps (sent in its "RynthILT.Server"
|
||||
/// profile), drawn group by group in RynthILT's order with each feature's state and where it
|
||||
/// lives. Nothing here is hard-coded: a newer RynthILT adds features without an Oracle update.
|
||||
/// </summary>
|
||||
private void DrawServerFeatures(UiWindow w)
|
||||
{
|
||||
IltServerProfile p = _c.Ilt.Profile;
|
||||
if (!p.Available)
|
||||
{
|
||||
if (_c.Server.Is(ServerTags.InfiniteLeaftide))
|
||||
{
|
||||
w.SeparatorText("Server features");
|
||||
w.TextDisabled("Load RynthILT to list the Infinite Leaftide features here.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (p.Features.Count == 0) return;
|
||||
|
||||
w.SeparatorText("Server features");
|
||||
string checkedText = p.CheckedUtc == DateTime.MinValue ? "not checked yet" : $"checked {p.CheckedUtc.ToLocalTime():yyyy-MM-dd HH:mm}";
|
||||
w.TextDisabled(p.Ilt
|
||||
? $"From RynthILT ({(p.World.Length > 0 ? p.World : "this world")}, {checkedText}{(p.Forced ? ", forced on" : "")})."
|
||||
: "From RynthILT: this isn't an Infinite Leaftide world, so no Leaftide feature is claimed.");
|
||||
|
||||
// Groups in the order RynthILT lists them; one table per group.
|
||||
var groups = new System.Collections.Generic.List<string>();
|
||||
foreach (IltFeature f in p.Features)
|
||||
if (!groups.Exists(g => string.Equals(g, f.Group, StringComparison.OrdinalIgnoreCase))) groups.Add(f.Group);
|
||||
|
||||
int on = 0;
|
||||
foreach (IltFeature f in p.Features) if (f.State == RynthCore.Plugin.Shared.RynthIltServer.StateOn) on++;
|
||||
w.TextDisabled($"{on} of {p.Features.Count} on.");
|
||||
|
||||
foreach (string group in groups)
|
||||
{
|
||||
if (!w.CollapsingHeader(group.Length > 0 ? group : "Other", "o.feat.h." + group)) continue;
|
||||
foreach (IltFeature f in p.InGroup(group))
|
||||
{
|
||||
uint color = f.State switch
|
||||
{
|
||||
RynthCore.Plugin.Shared.RynthIltServer.StateOn => UiColors.Green,
|
||||
RynthCore.Plugin.Shared.RynthIltServer.StateOff => UiColors.Red,
|
||||
_ => UiColors.Yellow,
|
||||
};
|
||||
w.TextColored(color, $"[{IltServerProfile.StateText(f.State)}]");
|
||||
w.SameLine();
|
||||
w.Text(f.Label);
|
||||
if (f.Where.Length > 0) w.Tooltip("Where: " + f.Where);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void StartQuestListCheck()
|
||||
{
|
||||
_c.Settings.LastQuestListCheckUtc = DateTime.UtcNow;
|
||||
|
|
|
|||
|
|
@ -1,152 +0,0 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT (the ConquestAC part). See THIRD_PARTY_NOTICES.md.
|
||||
using System;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Leaderboards, server-specific: ConquestAC's /top boards (upstream's Top Players tab), or
|
||||
/// Aelrynth's /top boards and /trial dungeon records. Each server's view only exists on that
|
||||
/// server (tab tags in OracleView), since both servers answer /top in different shapes.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private int _conquestBoard;
|
||||
private int _aelrynthView; // 0 boards, 1 me, 2 trials
|
||||
private string _aelrynthBoardArg = "";
|
||||
private string _trialArg = "";
|
||||
|
||||
private void DrawBoards(UiWindow w)
|
||||
{
|
||||
if (_c.Server.Is(ServerTags.Conquest)) DrawConquestBoards(w);
|
||||
else if (_c.Server.Is(ServerTags.Aelrynth)) DrawAelrynthBoards(w);
|
||||
}
|
||||
|
||||
private void DrawConquestBoards(UiWindow w)
|
||||
{
|
||||
ConquestData cq = _c.Conquest;
|
||||
_conquestBoard = Math.Clamp(_conquestBoard, 0, cq.Boards.Count - 1);
|
||||
for (int i = 0; i < cq.Boards.Count; i++)
|
||||
{
|
||||
int index = i;
|
||||
if (i > 0) w.SameLine();
|
||||
w.ToggleButton(cq.Boards[i].Label, "cb.tab." + i, i == _conquestBoard, () => _conquestBoard = index, small: true);
|
||||
}
|
||||
ConquestBoard b = cq.Boards[_conquestBoard];
|
||||
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);
|
||||
}
|
||||
|
||||
private static void DrawRows(UiWindow w, string id, System.Collections.Generic.List<BoardRow> rows)
|
||||
{
|
||||
w.BeginChild(id, 0f, 0f, border: true);
|
||||
w.TextDisabled("Rank");
|
||||
w.SameLine(60f);
|
||||
w.TextDisabled("Name");
|
||||
w.SameLine(280f);
|
||||
w.TextDisabled("Value");
|
||||
foreach (BoardRow r in rows)
|
||||
{
|
||||
w.Text(r.Rank.ToString());
|
||||
w.SameLine(60f);
|
||||
if (r.IsYou) w.TextColored(UiColors.Gold, Cut(r.Name, 30));
|
||||
else w.Text(Cut(r.Name, 30));
|
||||
w.SameLine(280f);
|
||||
w.Text(r.Value);
|
||||
if (r.Extra.Length > 0) { w.SameLine(420f); w.TextDisabled(Cut(r.Extra, 40)); }
|
||||
}
|
||||
if (rows.Count == 0) w.TextDisabled("Nothing read yet. Press Refresh.");
|
||||
w.EndChild();
|
||||
}
|
||||
|
||||
private void DrawAelrynthBoards(UiWindow w)
|
||||
{
|
||||
AelrynthBoards a = _c.Boards;
|
||||
w.ToggleButton("Boards", "ab.v0", _aelrynthView == 0, () => _aelrynthView = 0, small: true);
|
||||
w.SameLine();
|
||||
w.ToggleButton("Me", "ab.v1", _aelrynthView == 1, () => _aelrynthView = 1, small: true);
|
||||
w.SameLine();
|
||||
w.ToggleButton("Trials", "ab.v2", _aelrynthView == 2, () => _aelrynthView = 2, small: true);
|
||||
if (a.LastError.Length > 0) w.TextColored(UiColors.Red, a.LastError);
|
||||
|
||||
if (_aelrynthView == 1)
|
||||
{
|
||||
w.BeginChild("ab.melist", 0f, 0f, border: true);
|
||||
foreach (AelrynthStanding s in a.Standings)
|
||||
{
|
||||
w.Text(Cut(s.Title, 34));
|
||||
w.SameLine(260f);
|
||||
w.Text(s.Rank > 0 ? $"#{s.Rank} of {s.Of}" : "-");
|
||||
if (s.Value.Length > 0) { w.SameLine(380f); w.Text(s.Value); }
|
||||
}
|
||||
if (a.Standings.Count == 0) w.TextDisabled("Nothing read yet. Press Refresh.");
|
||||
w.EndChild();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_aelrynthView == 2)
|
||||
{
|
||||
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)); });
|
||||
w.BeginChild("ab.triallist", 0f, 0f, border: true);
|
||||
foreach (TrialDungeon d in a.Trials)
|
||||
{
|
||||
TrialDungeon row = d;
|
||||
w.Selectable($"{d.Name} ({d.Landblock})", "ab.t." + d.Landblock, false,
|
||||
() => { _trialArg = row.Name; _c.Send(a.RequestTrial(row.Name, _c.NowMs)); });
|
||||
w.Tooltip("Click for this dungeon's top 10.");
|
||||
w.TextDisabled(" record:"); w.SameLine(90f); w.TextWrapped(d.Record);
|
||||
w.TextDisabled(" you:"); w.SameLine(90f); w.Text(d.You);
|
||||
w.TextDisabled(" this week:"); w.SameLine(90f); w.Text(d.Week);
|
||||
}
|
||||
foreach (string line in a.TrialLines) if (!line.StartsWith("Trials - ", StringComparison.Ordinal)) w.TextWrapped(line);
|
||||
if (a.TrialBoardTitle.Length > 0)
|
||||
{
|
||||
w.SeparatorText(a.TrialBoardTitle);
|
||||
foreach (BoardRow r in a.TrialRows)
|
||||
{
|
||||
w.Text($"{r.Rank,2}. {r.Value}");
|
||||
w.SameLine(90f);
|
||||
w.Text(Cut(r.Name, 28));
|
||||
w.SameLine(300f);
|
||||
w.TextDisabled(Cut(r.Extra, 40));
|
||||
}
|
||||
foreach (string n in a.TrialNotes) w.TextWrapped(n);
|
||||
}
|
||||
if (a.Trials.Count == 0 && a.TrialBoardTitle.Length == 0) w.TextDisabled("Nothing read yet. Press Refresh.");
|
||||
w.EndChild();
|
||||
return;
|
||||
}
|
||||
|
||||
w.Button("All boards", "ab.all", () => _c.Send(a.RequestTop("", _c.NowMs)));
|
||||
w.Tooltip("Sends /top: every board's leader.");
|
||||
w.SameLine();
|
||||
w.InputText("Board", "ab.arg", _aelrynthBoardArg, 32, s => _aelrynthBoardArg = s);
|
||||
w.SameLine();
|
||||
w.Button("Top 10", "ab.board", () => { if (_aelrynthBoardArg.Trim().Length > 0) _c.Send(a.RequestTop(_aelrynthBoardArg, _c.NowMs)); });
|
||||
if (a.OverviewNote.Length > 0) w.TextDisabled(a.OverviewNote);
|
||||
|
||||
if (a.BoardTitle.Length > 0)
|
||||
{
|
||||
w.SeparatorText($"{a.BoardTitle} ({a.BoardNote})");
|
||||
if (a.BoardYou.Length > 0) w.TextColored(UiColors.Gold, a.BoardYou);
|
||||
DrawRows(w, "ab.rows", a.BoardRows);
|
||||
return;
|
||||
}
|
||||
w.BeginChild("ab.overview", 0f, 0f, border: true);
|
||||
foreach (AelrynthBoardSummary s in a.Overview)
|
||||
{
|
||||
AelrynthBoardSummary row = s;
|
||||
w.Selectable(Cut(s.Title, 30), "ab.o." + s.Key, false, () => { _aelrynthBoardArg = row.Key; _c.Send(a.RequestTop(row.Key, _c.NowMs)); }, 230f);
|
||||
w.Tooltip($"/top {s.Key}");
|
||||
w.SameLine(240f);
|
||||
w.Text(Cut(s.Leader, 24));
|
||||
if (s.Value.Length > 0) { w.SameLine(430f); w.Text(s.Value); }
|
||||
}
|
||||
if (a.Overview.Count == 0) w.TextDisabled("Nothing read yet. Press All boards.");
|
||||
w.EndChild();
|
||||
}
|
||||
}
|
||||
|
|
@ -9,8 +9,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).
|
||||
/// part of the Mini Remote's old Character tab, moved here 2026-10-13), on Infinite Leaftide RynthILT's
|
||||
/// charms (a second place for them: the Mini Remote's Charms tab stays) and the full buff list.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
|
|
@ -57,6 +57,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 +106,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 Charms tab shows the same
|
||||
/// one), 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).
|
||||
|
|
|
|||
|
|
@ -1,204 +0,0 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
using System;
|
||||
using System.Linq;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// ConquestAC (tag Conquest; the tab only exists there): bank balances and bank commands, advanced
|
||||
/// and enlightenment augmentations, levels past 275 and the XP bonus breakdown, fellowships looking
|
||||
/// for members, and the server's custom quest worklist. Upstream's Bank, Conquest Augs, Conquest XP,
|
||||
/// Fship and Custom tabs.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private static readonly string[] ConquestViews = { "Bank", "Augs", "Enlightenment", "Experience", "Fellowships", "Custom quests" };
|
||||
private int _conquestView;
|
||||
private int _withdrawIndex = ConquestData.DefaultWithdraw, _transferIndex = ConquestData.DefaultTransfer;
|
||||
private string _withdrawAmount = "", _transferAmount = "", _transferTarget = "";
|
||||
private int _fshipSort;
|
||||
|
||||
private void DrawConquest(UiWindow w)
|
||||
{
|
||||
for (int i = 0; i < ConquestViews.Length; i++)
|
||||
{
|
||||
int index = i;
|
||||
if (i > 0) w.SameLine();
|
||||
w.ToggleButton(ConquestViews[i], "cq.v." + i, i == _conquestView, () => _conquestView = index, small: true);
|
||||
}
|
||||
switch (_conquestView)
|
||||
{
|
||||
case 0: DrawConquestBank(w); break;
|
||||
case 1: DrawConquestAugs(w); break;
|
||||
case 2: DrawConquestEnl(w); break;
|
||||
case 3: DrawConquestXp(w); break;
|
||||
case 4: DrawConquestFships(w); break;
|
||||
default: DrawConquestCustom(w); break;
|
||||
}
|
||||
}
|
||||
|
||||
private static string ReadAt(DateTime utc) => utc == DateTime.MinValue ? "not read yet" : $"read at {utc.ToLocalTime():HH:mm}";
|
||||
|
||||
private void DrawConquestBank(UiWindow w)
|
||||
{
|
||||
ConquestData cq = _c.Conquest;
|
||||
w.TextDisabled(ReadAt(cq.BankUtc));
|
||||
foreach (NamedValue b in cq.Bank.OrderBy(b => b.Name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
w.TextDisabled(Cut(b.Name, 34));
|
||||
w.SameLine(260f);
|
||||
w.Text(b.Value);
|
||||
}
|
||||
if (cq.Bank.Count == 0) w.TextDisabled("No balances read yet.");
|
||||
|
||||
w.SeparatorText("Deposit");
|
||||
w.Button("Deposit everything", "cq.bank.deposit", () => _c.Send("/bank deposit"));
|
||||
w.Tooltip("Sends /bank deposit.");
|
||||
w.Checkbox("Deposit by itself every ten minutes", "cq.bank.auto", _c.Settings.ConquestAutoDeposit,
|
||||
v => { _c.Settings.ConquestAutoDeposit = v; _c.Settings.Save(); });
|
||||
w.Tooltip("At :00, :10, :20 ... while you're logged in on ConquestAC. Its reply is hidden.");
|
||||
|
||||
w.SeparatorText("Withdraw");
|
||||
string[] wl = ConquestData.Withdrawable.Select(c => c.Label).ToArray();
|
||||
w.Combo("Currency", "cq.bank.wcur", _withdrawIndex, wl, i => _withdrawIndex = Math.Clamp(i, 0, wl.Length - 1));
|
||||
w.InputText("Amount", "cq.bank.wamt", _withdrawAmount, 16, s => _withdrawAmount = s);
|
||||
w.Button("Withdraw", "cq.bank.withdraw", () =>
|
||||
{
|
||||
string? cmd = ConquestData.WithdrawCommand(ConquestData.Withdrawable[_withdrawIndex], _withdrawAmount);
|
||||
if (cmd == null) _c.Print("Withdraw: type a whole number above 0.");
|
||||
else _c.Send(cmd);
|
||||
});
|
||||
|
||||
w.SeparatorText("Transfer to a character");
|
||||
string[] tl = ConquestData.Transferable.Select(c => c.Label).ToArray();
|
||||
w.Combo("Currency##t", "cq.bank.tcur", _transferIndex, tl, i => _transferIndex = Math.Clamp(i, 0, tl.Length - 1));
|
||||
w.InputText("Amount##t", "cq.bank.tamt", _transferAmount, 16, s => _transferAmount = s);
|
||||
w.InputText("Character", "cq.bank.tgt", _transferTarget, 40, s => _transferTarget = s);
|
||||
w.Button("Transfer", "cq.bank.transfer", () =>
|
||||
{
|
||||
string? cmd = ConquestData.TransferCommand(ConquestData.Transferable[_transferIndex], _transferAmount, _transferTarget);
|
||||
if (cmd == null) _c.Print("Transfer: type a whole number above 0 (MMD notes: at most 1,000) and a character name.");
|
||||
else _c.Send(cmd);
|
||||
});
|
||||
}
|
||||
|
||||
private void DrawConquestAugs(UiWindow w)
|
||||
{
|
||||
ConquestData cq = _c.Conquest;
|
||||
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)
|
||||
{
|
||||
w.Text(a.Name);
|
||||
w.SameLine(120f);
|
||||
w.Text(a.Count.ToString());
|
||||
w.SameLine(170f);
|
||||
w.Text(a.NextCostText());
|
||||
w.SameLine(330f);
|
||||
w.TextDisabled(Cut(a.Effect(), 48));
|
||||
w.Tooltip(a.Effect());
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawConquestEnl(UiWindow w)
|
||||
{
|
||||
ConquestData cq = _c.Conquest;
|
||||
w.TextDisabled(ReadAt(cq.EnlUtc));
|
||||
foreach (NamedValue a in cq.EnlAugs)
|
||||
{
|
||||
w.Text(Cut(a.Name, 26));
|
||||
w.SameLine(200f);
|
||||
w.Text(a.Value);
|
||||
w.SameLine(360f);
|
||||
w.TextDisabled(ConquestData.EnlCost(a.Name));
|
||||
}
|
||||
if (cq.EnlAugs.Count == 0) w.TextDisabled("Nothing read yet. Press Refresh.");
|
||||
}
|
||||
|
||||
private void DrawConquestXp(UiWindow w)
|
||||
{
|
||||
ConquestData cq = _c.Conquest;
|
||||
CharacterSnapshot ch = _c.Character;
|
||||
int level = ch.Level;
|
||||
w.SeparatorText($"Level {level}");
|
||||
if (level >= ConquestData.MaxLevel) w.Text("Maximum level.");
|
||||
else
|
||||
{
|
||||
long start = level >= 276 ? ConquestData.XpForLevel(level) : 0;
|
||||
long next = level >= 275 ? ConquestData.XpForLevel(level + 1) : 0;
|
||||
if (next > 0)
|
||||
{
|
||||
long toNext = Math.Max(0, next - ch.TotalXp);
|
||||
long begin = level == 275 ? 191_226_310_247 : start;
|
||||
float frac = next > begin ? (float)Math.Clamp((double)(ch.TotalXp - begin) / (next - begin), 0, 1) : 1f;
|
||||
w.ProgressBar(frac, -1f, 0f, $"{TimeText.Number(toNext)} to level {level + 1}");
|
||||
}
|
||||
else
|
||||
{
|
||||
(long toNext, float frac) = ch.LevelProgress();
|
||||
w.ProgressBar(frac, -1f, 0f, $"{TimeText.Number(toNext)} to level {level + 1}");
|
||||
}
|
||||
long toMax = Math.Max(0, ConquestData.XpForLevel(ConquestData.MaxLevel) - ch.TotalXp);
|
||||
w.TextDisabled($"{TimeText.Number(toMax)} to level {ConquestData.MaxLevel}");
|
||||
}
|
||||
int target = ch.Enlightenment + 1;
|
||||
w.SeparatorText($"Enlightenment {ch.Enlightenment}");
|
||||
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.TextDisabled(ReadAt(cq.BonusUtc));
|
||||
foreach (NamedValue b in cq.Bonuses)
|
||||
{
|
||||
w.TextDisabled(b.Name);
|
||||
w.SameLine(200f);
|
||||
w.Text(b.Value.Length > 0 ? b.Value : "-");
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawConquestFships(UiWindow w)
|
||||
{
|
||||
ConquestData cq = _c.Conquest;
|
||||
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
|
||||
{
|
||||
1 => cq.Fellowships.OrderBy(f => f.Leader, StringComparer.OrdinalIgnoreCase),
|
||||
2 => cq.Fellowships.OrderByDescending(f => f.MemberCount),
|
||||
3 => cq.Fellowships.OrderBy(f => f.Location, StringComparer.OrdinalIgnoreCase),
|
||||
_ => cq.Fellowships.OrderBy(f => f.Name, StringComparer.OrdinalIgnoreCase),
|
||||
};
|
||||
w.BeginChild("cq.fship.list", 0f, 0f, border: true);
|
||||
foreach (ConquestFellowship f in list)
|
||||
{
|
||||
w.Text(Cut(f.Name, 26));
|
||||
w.SameLine(200f);
|
||||
w.Text(Cut(f.Leader, 20));
|
||||
w.SameLine(350f);
|
||||
w.Text(f.Members);
|
||||
if (f.Location.Length > 0) { w.SameLine(410f); w.TextDisabled(Cut(f.Location, 26)); }
|
||||
}
|
||||
if (cq.Fellowships.Count == 0) w.TextDisabled("None read yet. Press Refresh.");
|
||||
w.EndChild();
|
||||
}
|
||||
|
||||
private void DrawConquestCustom(UiWindow w)
|
||||
{
|
||||
DateTime now = _c.UtcNow;
|
||||
bool any = false;
|
||||
foreach (CustomQuest q in CustomQuestList.For(_c.Server))
|
||||
{
|
||||
any = true;
|
||||
DoneMark(w, q.IsComplete(_c.Flags, now));
|
||||
w.SameLine(50f);
|
||||
CustomQuest row = q;
|
||||
string status = q.Status(_c.Flags, now);
|
||||
w.Selectable(Cut(q.Name, 34), "cq.cust." + q.Flag, false, () => PrintEntry(row.Name, row.Flag, status, row.Hint, row.Url), 280f);
|
||||
w.SameLine(340f);
|
||||
w.Text(status);
|
||||
}
|
||||
if (!any) w.TextDisabled("No custom quests listed for this server.");
|
||||
if (_c.Flags.LastReadUtc == DateTime.MinValue) w.TextDisabled("Read your quest flags (Quests tab) for their status.");
|
||||
}
|
||||
}
|
||||
214
Plugins/RynthCore.Plugin.RynthOracle/Views/DynamicStampsTab.cs
Normal file
214
Plugins/RynthCore.Plugin.RynthOracle/Views/DynamicStampsTab.cs
Normal file
|
|
@ -0,0 +1,214 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Dynamic Stamps (Infinite Leaftide only): the NPC hand-ins that put a "Dynamic_N_..." flag on
|
||||
/// the character, read from /myquests. They are rows of the Quests tab's merged list (QuestsTab.cs:
|
||||
/// DYN rows, the Show filter's area picker). What is here is the opened stamp's box (RynthNav, the
|
||||
/// Parchment hand-in, chat), the read after a hand-in, and the RynthNav sender every row kind
|
||||
/// shares. The list follows the players' "ExtraDyn" sheet (dynstamps.csv).
|
||||
///
|
||||
/// Give Parchment sends RynthAi's "/ub give 1 <parchment> to <npc>". That verb belongs to
|
||||
/// RynthAi, so the button is disabled (with a tooltip saying why) when RynthAi isn't loaded or has
|
||||
/// answered "Unrecognized /ub command" to it.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
// The stamp clicked last: the box below the list offers RynthNav's auto nav to it.
|
||||
private DynamicStamp? _dynNav;
|
||||
private bool _dynNavDone;
|
||||
private string _dynNavStatus = "";
|
||||
// The Parchment waiting for Yes: handing it over is the one thing here that can't be taken back.
|
||||
private string _giveConfirm = "";
|
||||
|
||||
/// <summary>
|
||||
/// The destination box (the click's pop-up): the stamp, where RynthNav will take you, and Go (plan
|
||||
/// and walk the route: portals, recalls and dungeon entrances included), Arrow, Chat and Close.
|
||||
/// </summary>
|
||||
private void DrawDynamicNavBox(UiWindow w)
|
||||
{
|
||||
DynamicStamp? s = _dynNav;
|
||||
if (s == null) return;
|
||||
List<string> targets = s.NavCandidates();
|
||||
w.SeparatorText("Navigate to " + Cut(s.Label, 40));
|
||||
w.TextDisabled(targets.Count == 0
|
||||
? "No place, coordinates or area to go to for this stamp."
|
||||
: "Where: " + Cut(string.Join(" or ", targets), 90));
|
||||
if (targets.Count > 0)
|
||||
{
|
||||
w.Button("Go (auto nav)", "dy.nav.go", () => SendNav("go", s));
|
||||
w.Tooltip("RynthNav plans the route (walking, portals, recalls, the dungeon's entrance) and walks it.");
|
||||
w.SameLine();
|
||||
w.Button("Arrow", "dy.nav.arrow", () => SendNav("arrow", s));
|
||||
w.Tooltip("Only point RynthNav's arrow at it.");
|
||||
w.SameLine();
|
||||
}
|
||||
w.Button("Chat", "dy.nav.chat", () => PrintStamp(s, _dynNavDone));
|
||||
w.SameLine();
|
||||
w.Button("Close", "dy.nav.close", () => { _dynNav = null; _dynNavStatus = ""; _selKey = ""; _giveConfirm = ""; });
|
||||
|
||||
// The hand-in: a Parchment from your packs to the stamp's NPC (RynthAi's /ub give).
|
||||
if (s.Npc.Length > 0)
|
||||
{
|
||||
string? parchment = CarriedParchment();
|
||||
if (parchment != null)
|
||||
{
|
||||
string? why = GiveUnavailableReason();
|
||||
if (why == null && _giveConfirm == parchment)
|
||||
{
|
||||
// Asked first: the Parchment leaves the pack and doesn't come back.
|
||||
w.TextColored(UiColors.Red, $"Give one {Cut(parchment, 30)} to {Cut(s.Npc, 30)}? It leaves your pack for good.");
|
||||
w.SmallButton("Yes, give it", "dy.nav.give.yes", () => { _giveConfirm = ""; GiveParchment(s, parchment); });
|
||||
w.SameLine();
|
||||
w.SmallButton("Cancel", "dy.nav.give.no", () => _giveConfirm = "");
|
||||
}
|
||||
else if (why == null)
|
||||
{
|
||||
w.Button("Give " + Cut(parchment, 24), "dy.nav.give", () => _giveConfirm = parchment);
|
||||
w.Tooltip($"Hands one {parchment} to {s.Npc} (it asks first). Stand near them (or Go first): AC walks you the last bit.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Greyed text in place of the button, so it can't be clicked into a command nobody answers.
|
||||
w.TextDisabled("[Give " + Cut(parchment, 24) + "]");
|
||||
w.Tooltip(why);
|
||||
}
|
||||
}
|
||||
else
|
||||
w.TextDisabled("No Parchment in your packs to give " + Cut(s.Npc, 30) + ".");
|
||||
}
|
||||
if (_dynNavStatus.Length > 0) w.TextDisabled(_dynNavStatus);
|
||||
}
|
||||
|
||||
// A /myquests read this long after a Parchment hand-in (the walk there and the NPC's answer), so
|
||||
// the new stamp shows as had; 0 = none due.
|
||||
private const long HandInRefreshMs = 8000;
|
||||
private long _dynRefreshAt;
|
||||
|
||||
/// <summary>The read after a hand-in, when it is due: now, or when the server's once-a-minute wait ends.</summary>
|
||||
private void RefreshAfterHandIn(QuestFlagStore flags)
|
||||
{
|
||||
if (_dynRefreshAt == 0 || _c.NowMs < _dynRefreshAt) return;
|
||||
if (flags.Loading) return;
|
||||
int wait = flags.ThrottleSecondsLeft(_c.NowMs);
|
||||
if (wait > 0) { _dynRefreshAt = _c.NowMs + wait * 1000L; return; }
|
||||
_dynRefreshAt = 0;
|
||||
_c.RequestQuests();
|
||||
}
|
||||
|
||||
// Packs scanned for a Parchment at most this often (the box draws every frame).
|
||||
private const long ParchmentScanMs = 1500;
|
||||
private long _parchmentScanAt;
|
||||
private string? _parchmentName;
|
||||
|
||||
/// <summary>
|
||||
/// The name of a Parchment you carry (the main pack and its side packs), or null. Any item
|
||||
/// whose name has "Parchment" in it; read again every <see cref="ParchmentScanMs"/>.
|
||||
/// </summary>
|
||||
private string? CarriedParchment()
|
||||
{
|
||||
if (_c.ParchmentFinder != null) return _c.ParchmentFinder();
|
||||
if (_c.NowMs - _parchmentScanAt < ParchmentScanMs && _parchmentScanAt != 0) return _parchmentName;
|
||||
_parchmentScanAt = _c.NowMs == 0 ? 1 : _c.NowMs;
|
||||
_parchmentName = null;
|
||||
RynthCore.PluginSdk.RynthCoreHost host = _c.Host; // a struct: an empty one (the offline tests) reports nothing carried
|
||||
uint me = _c.Character.PlayerId;
|
||||
if (!_c.InWorld || me == 0 || !host.HasGetContainerContents) return null;
|
||||
var buf = new uint[512];
|
||||
var packs = new List<uint> { me };
|
||||
for (int p = 0; p < packs.Count && p < 16; p++)
|
||||
{
|
||||
int n = Math.Min(host.GetContainerContents(packs[p], buf), buf.Length);
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
uint id = buf[i];
|
||||
if (!host.TryGetObjectName(id, out string name)) continue;
|
||||
if (name.IndexOf("Parchment", StringComparison.OrdinalIgnoreCase) >= 0) { _parchmentName = name; return name; }
|
||||
// A side pack in the main pack: look inside it too (only one level deep, as AC packs go).
|
||||
if (p == 0) packs.Add(id);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Why Give Parchment can't be used now (for its tooltip); null when it can.</summary>
|
||||
private string? GiveUnavailableReason()
|
||||
{
|
||||
if (_c.UbGiveMissing)
|
||||
return "The loaded RynthAi has no \"/ub give\" (it answered \"Unrecognized /ub command\"). Update RynthAi, or hand the Parchment over yourself.";
|
||||
if (!_c.UbGiveAvailable())
|
||||
return "Needs RynthAi: the hand-in is RynthAi's \"/ub give\". It isn't loaded (or you aren't logged in), so give the Parchment to the NPC yourself.";
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>A name made safe to put inside a chat command: no control characters.</summary>
|
||||
private static string ForCommand(string name)
|
||||
{
|
||||
var sb = new System.Text.StringBuilder(name.Length);
|
||||
foreach (char ch in name) if (ch >= ' ' && ch != '\u007f') sb.Append(ch);
|
||||
return sb.ToString().Trim();
|
||||
}
|
||||
|
||||
/// <summary>"/ub give 1 <parchment> to <npc>": RynthAi finds the NPC by name and hands it over.</summary>
|
||||
private void GiveParchment(DynamicStamp s, string parchment)
|
||||
{
|
||||
if (!_c.InWorld) { _dynNavStatus = "Log in first."; return; }
|
||||
string? why = GiveUnavailableReason();
|
||||
if (why != null) { _dynNavStatus = why; return; }
|
||||
_c.UbGiveSentMs = _c.NowMs; // a "Unrecognized /ub command" in the next moments turns the button off
|
||||
bool sent = _c.RunCommand($"/ub give 1 {ForCommand(parchment)} to {ForCommand(s.Npc)}");
|
||||
_parchmentScanAt = 0; // read the packs again after the give
|
||||
// The stamp is a quest flag: read /myquests again once the NPC has had time to answer.
|
||||
if (sent) _dynRefreshAt = _c.NowMs + HandInRefreshMs;
|
||||
_dynNavStatus = sent
|
||||
? $"Giving {parchment} to {s.Npc} (RynthAi does the give; it says so in chat if {s.Npc} isn't in sight)."
|
||||
: "Could not send the give.";
|
||||
}
|
||||
|
||||
/// <summary>Clicking a row: select it and ask RynthNav for the route (shown in chat and its overlay).</summary>
|
||||
private void SelectDynamicStamp(DynamicStamp s, bool done)
|
||||
{
|
||||
_dynNav = s;
|
||||
_dynNavDone = done;
|
||||
_dynNavStatus = "";
|
||||
_giveConfirm = "";
|
||||
if (s.NavCandidates().Count > 0) SendNav("route", s);
|
||||
}
|
||||
|
||||
/// <summary>"/rnav <verb> a || b || c" to RynthNav (it takes the first candidate on its map).</summary>
|
||||
private void SendNav(string verb, DynamicStamp s)
|
||||
{
|
||||
List<string> targets = s.NavCandidates();
|
||||
if (targets.Count == 0) return;
|
||||
_dynNavStatus = SendRynthNav(verb, targets);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "/rnav <verb> a || b || c" to RynthNav (go walks the route, route plans it in chat, arrow
|
||||
/// points at it; RynthNav takes the first candidate on its map). What to tell the player.
|
||||
/// Shared by every row kind of the Quests tab.
|
||||
/// </summary>
|
||||
private string SendRynthNav(string verb, IReadOnlyList<string> targets)
|
||||
{
|
||||
if (targets.Count == 0) return "";
|
||||
if (!_c.InWorld) return "Log in first.";
|
||||
bool sent = _c.SendNav(verb + " " + string.Join(" || ", targets));
|
||||
return !sent ? "RynthNav isn't loaded (it plans and walks the route)."
|
||||
: verb == "go" ? "RynthNav is planning the route and walking it (its chat lines say how)."
|
||||
: verb == "arrow" ? "RynthNav's arrow points at it."
|
||||
: "RynthNav's route is in chat. Go walks it.";
|
||||
}
|
||||
|
||||
/// <summary>Chat: the NPC, its stamp and whether this character has it, where, the reward and
|
||||
/// any coordinates (RynthChat makes those a RynthNav arrow link).</summary>
|
||||
private void PrintStamp(DynamicStamp s, bool done)
|
||||
{
|
||||
string where = s.Place.Length > 0 ? $"{s.Area}, {s.Place}" : s.Area;
|
||||
string details = $"{where}" + (s.Reward.Length > 0 ? $" - gives {s.Reward}" : "") + (s.Note.Length > 0 ? $" - {s.Note}" : "");
|
||||
PrintEntry(s.Label, s.Stamp, done ? "have" : "missing", details, "");
|
||||
}
|
||||
}
|
||||
18
Plugins/RynthCore.Plugin.RynthOracle/Views/LegendaryTab.cs
Normal file
18
Plugins/RynthCore.Plugin.RynthOracle/Views/LegendaryTab.cs
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Legendary Key quests (John in Arwic counts 30 for his reward): rows of the Quests tab's merged
|
||||
/// list since 2026-10-18 (QuestsTab.cs: LEG rows, John's counter in the trackers' status). The list
|
||||
/// and notes follow the "Arwic John Route" sheet (legendary.csv). What is left here is the chat print.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
/// <summary>Chat: the quest, its flags and status, the sheet's notes, wiki and video links.</summary>
|
||||
private void PrintLegendary(LegendaryQuest q, string status)
|
||||
{
|
||||
PrintEntry(q.Label, string.Join(", ", q.Flags), status, q.Note, q.Url);
|
||||
if (q.Video.Length > 0) _c.Print("Video: " + q.Video);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,61 +1,15 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
using System;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>Markers: which of the 100 exploration markers you've found, and the next one to run to.</summary>
|
||||
/// <summary>
|
||||
/// The 100 exploration markers: rows of the Quests tab's merged list (QuestsTab.cs: MRK rows, the
|
||||
/// markers found and the next one in the trackers' status, "Not done" for the ones still to find).
|
||||
/// What is left here is the chat print a click on a marker row (or its Print button) gives.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private const int MarkerPageSize = 50;
|
||||
private bool _markersMissingOnly;
|
||||
private int _markerPage;
|
||||
|
||||
private void DrawMarkers(UiWindow w)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
if (flags.LastReadUtc == DateTime.MinValue)
|
||||
w.TextDisabled("Quest flags not read yet (Quests tab, Refresh).");
|
||||
|
||||
int found = 0;
|
||||
Marker? next = null;
|
||||
foreach (Marker m in MarkerList.All)
|
||||
{
|
||||
if (m.IsFound(flags)) found++;
|
||||
else next ??= m;
|
||||
}
|
||||
w.ProgressBar(MarkerList.All.Count > 0 ? (float)found / MarkerList.All.Count : 0f, -1f, 0f, $"{found} / {MarkerList.All.Count} markers found");
|
||||
if (next != null)
|
||||
{
|
||||
Marker n = next;
|
||||
w.TextDisabled("Next:");
|
||||
w.SameLine();
|
||||
w.Selectable($"#{next.Number} {next.Name} ({next.Location})", "m.next", false, () => PrintMarker(n));
|
||||
w.Tooltip("Prints the directions in chat.");
|
||||
}
|
||||
w.Checkbox("Only the ones still to find", "m.missing", _markersMissingOnly, v => { _markersMissingOnly = v; _markerPage = 0; });
|
||||
|
||||
var rows = new System.Collections.Generic.List<Marker>();
|
||||
foreach (Marker m in MarkerList.All)
|
||||
if (!_markersMissingOnly || !m.IsFound(flags)) rows.Add(m);
|
||||
_markerPage = Pager(w, "m.page", _markerPage, rows.Count, MarkerPageSize, p => _markerPage = p);
|
||||
|
||||
w.BeginChild("m.list", 0f, 0f, border: true);
|
||||
int start = _markerPage * MarkerPageSize;
|
||||
for (int i = start; i < rows.Count && i < start + MarkerPageSize; i++)
|
||||
{
|
||||
Marker m = rows[i];
|
||||
DoneMark(w, m.IsFound(flags));
|
||||
w.SameLine(50f);
|
||||
Marker row = m;
|
||||
w.Selectable(Cut($"#{m.Number} {m.Name}", 38), "m.r." + m.Number, false, () => PrintMarker(row), 300f);
|
||||
w.SameLine(360f);
|
||||
w.TextDisabled(Cut(m.Location, 24));
|
||||
}
|
||||
w.EndChild();
|
||||
}
|
||||
|
||||
private void PrintMarker(Marker m) =>
|
||||
PrintEntry($"Marker {m.Number}: {m.Name}", "", m.IsFound(_c.Flags) ? "found" : "", m.Hint, m.Url);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,8 +12,11 @@ internal sealed partial class OracleView
|
|||
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";
|
||||
TabTitles = "Titles", TabVoid = "Void", TabFellowship = "Fellowship",
|
||||
TabBreeding = "Pet Breeding", TabAbout = "About";
|
||||
// The Markers tab (and the Legendary and Dynamic Stamps trackers and RynthILT's Temple guardians)
|
||||
// are rows of the Quests tab: QuestsTab.cs, ShowTrackers, /ro markers. A saved tab name of the old
|
||||
// Markers tab falls back to Quests (see Tab).
|
||||
|
||||
/// <summary>
|
||||
/// A tab: shown where any of its server tags matches the server; no tags = everywhere (retail).
|
||||
|
|
@ -51,17 +54,17 @@ internal sealed partial class OracleView
|
|||
() => "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, RefreshBoards, BoardsHelp),
|
||||
new(TabConquest, new[] { Data.ServerTags.Conquest }, DrawConquest, true, RefreshConquest, ConquestHelp),
|
||||
// A server's own pages are its server plugin's since 2026-10-20: Conquest's (bank, augs,
|
||||
// boards, ...) RynthConquest's, Aelrynth's leaderboards and Trials RynthAelrynth's.
|
||||
// Infinite Leaftide only, and only while the server has pet breeding (BreedingOffered).
|
||||
new(TabBreeding, new[] { Data.ServerTags.InfiniteLeaftide }, DrawBreeding, false, RefreshBreeding,
|
||||
() => "Asks RynthILT to appraise every essence again (charges, rest timers, bond, growth)."),
|
||||
new(TabAbout, any, DrawAbout, false, RefreshAbout,
|
||||
() => "Loads the quest list and server pack from their files again and asks RynthCore which server this is."),
|
||||
};
|
||||
|
|
@ -69,11 +72,24 @@ internal sealed partial class OracleView
|
|||
|
||||
private bool Visible(TabDef t)
|
||||
{
|
||||
if (t.Name == TabBreeding && !BreedingOffered()) return false;
|
||||
if (t.Servers.Length == 0) return true;
|
||||
foreach (string s in t.Servers) if (_c.Server.Is(s)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Pet Breeding tab is offered on an Infinite Leaftide world unless RynthILT's profile says
|
||||
/// the server has pet breeding switched off (a feature it doesn't know yet counts as on).
|
||||
/// </summary>
|
||||
internal bool BreedingOffered()
|
||||
{
|
||||
if (!_c.Server.Is(Data.ServerTags.InfiniteLeaftide)) return false;
|
||||
foreach (Data.IltFeature f in _c.Ilt.Profile.Features)
|
||||
if (f.Key == "pet_breeding") return f.State != RynthCore.Plugin.Shared.RynthIltServer.StateOff;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>The selected tab's name; a tab not available on this server falls back to Quests.</summary>
|
||||
public string Tab
|
||||
{
|
||||
|
|
|
|||
202
Plugins/RynthCore.Plugin.RynthOracle/Views/PetBreedingTab.cs
Normal file
202
Plugins/RynthCore.Plugin.RynthOracle/Views/PetBreedingTab.cs
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
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, and only where the server has pet breeding on): RynthILT's
|
||||
/// breeding tracker, the same one as RynthAi's Mini Remote Pets > Breeding tab (which stays). 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). The page's Refresh button is the Refresh row every page has.
|
||||
/// </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.3.1 and has no breeding tracker; update RynthILT."
|
||||
: "Load RynthILT (0.3.1 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("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);
|
||||
}
|
||||
|
|
@ -1,25 +1,42 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
// Tracking, kill tasks and rewards merged in from RynthAi's Mini Remote Quests tab and
|
||||
// UtilityBelt ILT's quest tracker (2026-10-13). Infinite Leaftide's quest bonus list (/qb) stays
|
||||
// RynthILT's (the Quests section it draws in the Mini Remote).
|
||||
// Tracking, kill tasks, rewards and the quest bonus list merged in from RynthAi's Mini Remote
|
||||
// Quests tab and UtilityBelt ILT's quest tracker (2026-10-13). The Legendary, Markers and Dynamic
|
||||
// Stamps tabs and RynthILT's Temple guardians merged in as tracker rows (SilentKelpie's PR 12,
|
||||
// RynthOracle 0.6.0, ported by hand onto this lineage).
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
using RynthCore.Plugin.Shared;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Quests: every flag the character holds, cross-referenced with the master quest list, in one
|
||||
/// searchable, sortable, paged list (upstream's Quest Flags tab). The * column tracks a quest in
|
||||
/// the Quest Timers window; clicking a quest opens it below the list, with its notes and the
|
||||
/// rewards editor (UtilityBelt ILT's).
|
||||
/// What a row of the merged Quests list is. Every kind but Quest is a tracker: Legendary Key quests
|
||||
/// and exploration markers everywhere, Dynamic Stamps and the Temple guardians on Infinite Leaftide.
|
||||
/// </summary>
|
||||
internal enum QuestKind { Quest, Legendary, Marker, Dynamic, Guardian }
|
||||
|
||||
/// <summary>
|
||||
/// Quests: every flag the character holds, cross-referenced with the master quest list, plus the
|
||||
/// trackers (Legendary Key quests, exploration markers, Dynamic Stamps, Temple guardians), in one
|
||||
/// searchable, sortable, paged list. Each kind shows only on the servers it belongs to, and
|
||||
/// "Trackers only" narrows the list to the trackers with their status above it. The * column tracks
|
||||
/// a quest in the Quest Timers window (a favourite); clicking a row opens it below the list: a
|
||||
/// quest's notes and rewards editor, a tracker's details, and RynthNav's Go / Route / Arrow for any
|
||||
/// coordinates in its notes. A click on a quest or a marker also prints its texts in chat. On
|
||||
/// Infinite Leaftide the quest bonus list (/qb, read by RynthILT) follows.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private const int QuestPageSize = 40;
|
||||
private const int QbShownMax = 150; // per /qb list on one pass (the rest: narrow with Search)
|
||||
private const float QuestListHeightWithPanel = 300f;
|
||||
private static readonly string[] QuestSorts = { "Flag", "Name", "Done first", "Not done first", "Ready soonest", "Most solves" };
|
||||
/// <summary>The kinds' names in <see cref="QuestKind"/> order (the Show filter).</summary>
|
||||
private static readonly string[] KindNames = { "Quests", "Legendary", "Markers", "Dynamic Stamps", "Guardians" };
|
||||
/// <summary>The guardians' last answer is offered for this long (RynthILT's Mini Remote line does the same).</summary>
|
||||
private const long GuardianAnswerShownSec = 600;
|
||||
|
||||
// The reward editor's fields, in QuestReward order (two percentages, then counts).
|
||||
private static readonly string[] RewardLabels =
|
||||
|
|
@ -27,21 +44,79 @@ internal sealed partial class OracleView
|
|||
|
||||
private string _questSearch = "";
|
||||
private bool _qDone, _qNotDone, _qRepeatable, _qOneTime, _qNew, _qServer, _qTracked, _qKill;
|
||||
// Trackers only: the list keeps only tracker rows, with the trackers' status above it.
|
||||
private bool _qTrackers;
|
||||
// The Show filter: one kind, or null for every kind this server has.
|
||||
private QuestKind? _qKind;
|
||||
private int _questSort;
|
||||
private int _questPage;
|
||||
private int _dynArea; // 0 = all areas, else DynamicStampList.Areas[n - 1] (Show: Dynamic Stamps)
|
||||
|
||||
private readonly List<Quest> _questRows = new();
|
||||
private readonly List<QuestRow> _questRows = new();
|
||||
private string _questKey = "";
|
||||
private long _questBuiltMs;
|
||||
|
||||
// The quest opened below the list, and its reward editor's text (kept while typing).
|
||||
// The row opened below the list: a quest (_questSel), a Dynamic Stamp (_dynNav) or another tracker (_selKey).
|
||||
private QuestKind _selKind;
|
||||
private string _selKey = "";
|
||||
private string _questSel = "";
|
||||
private readonly string[] _rewardEdit = new string[RewardLabels.Length];
|
||||
private string _rewardMsg = "";
|
||||
|
||||
/// <summary>One row of the merged list: its kind, a unique key, and the entry it shows.</summary>
|
||||
private sealed class QuestRow
|
||||
{
|
||||
public QuestKind Kind;
|
||||
/// <summary>Unique across kinds: the quest flag, or "lg:", "mk:", "dy:", "gd:" and the tracker's own key.</summary>
|
||||
public string Key = "";
|
||||
public string Label = "";
|
||||
/// <summary>The tracker's group: a Legendary area, a marker's location, a stamp's area, a guardian's NPC.</summary>
|
||||
public string Group = "";
|
||||
/// <summary>Its place in its own list (the default order of tracker rows).</summary>
|
||||
public int Order;
|
||||
public bool Done;
|
||||
public Quest? Q;
|
||||
public LegendaryQuest? L;
|
||||
public Marker? M;
|
||||
public DynamicStamp? D;
|
||||
public IltGuardianRow? G;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The kinds this server shows: quests, Legendary quests and markers everywhere; Dynamic Stamps
|
||||
/// and the Temple guardians only on Infinite Leaftide. Internal for the tests.
|
||||
/// </summary>
|
||||
internal List<QuestKind> AvailableKinds()
|
||||
{
|
||||
var kinds = new List<QuestKind> { QuestKind.Quest, QuestKind.Legendary, QuestKind.Marker };
|
||||
if (_c.Server.Is(ServerTags.InfiniteLeaftide))
|
||||
{
|
||||
kinds.Add(QuestKind.Dynamic);
|
||||
kinds.Add(QuestKind.Guardian);
|
||||
}
|
||||
return kinds;
|
||||
}
|
||||
|
||||
/// <summary>A kind is listed: this server has it, the Show filter allows it, and Trackers only doesn't hide it.</summary>
|
||||
private bool KindListed(QuestKind k, List<QuestKind> kinds)
|
||||
=> kinds.Contains(k) && (_qKind == null || _qKind == k) && !(_qTrackers && k == QuestKind.Quest);
|
||||
|
||||
/// <summary>
|
||||
/// Opens the Quests tab on the trackers: one kind (/ro legendary, /ro dynamic, /ro markers,
|
||||
/// /ro guardians) or all of them (null). The old tabs' commands land here.
|
||||
/// </summary>
|
||||
public void ShowTrackers(QuestKind? kind)
|
||||
{
|
||||
_qTrackers = kind != QuestKind.Quest;
|
||||
_qKind = kind;
|
||||
_questPage = 0;
|
||||
Tab = TabQuests;
|
||||
}
|
||||
|
||||
private void DrawQuests(UiWindow w)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
RefreshAfterHandIn(flags);
|
||||
if (flags.ServerDisabled)
|
||||
w.TextColored(UiColors.Red, "This server has /myquests turned off, so quest flags can't be read.");
|
||||
else if (flags.Loading)
|
||||
|
|
@ -50,6 +125,9 @@ internal sealed partial class OracleView
|
|||
w.TextDisabled("Quest flags not read yet. Press Refresh, or type /myquests.");
|
||||
else
|
||||
w.Text($"{flags.Flags.Count} quest flags on this character, read at {flags.LastReadUtc.ToLocalTime():HH:mm}.");
|
||||
int throttleLeft = flags.ThrottleSecondsLeft(_c.NowMs);
|
||||
if (throttleLeft > 0 && !flags.Loading)
|
||||
w.TextDisabled($"The server answers one /myquests a minute: Refresh works again in {throttleLeft}s.");
|
||||
|
||||
bool timersShown = _c.QuestTimersWindowVisible();
|
||||
w.Button(timersShown ? "Hide quest timers" : "Show quest timers", "q.timers", () => _c.SetQuestTimersWindow(!timersShown));
|
||||
|
|
@ -60,9 +138,15 @@ internal sealed partial class OracleView
|
|||
? $"{cat.RetailCount} retail quests + {cat.ServerCount} {cat.PackServer} quests"
|
||||
: $"{cat.RetailCount} retail quests");
|
||||
|
||||
// A Show filter left on a kind this server doesn't have (another server's character): all kinds.
|
||||
List<QuestKind> kinds = AvailableKinds();
|
||||
if (_qKind is QuestKind chosen && !kinds.Contains(chosen)) _qKind = null;
|
||||
bool ilt = kinds.Contains(QuestKind.Dynamic);
|
||||
|
||||
w.InputText("Search", "q.search", _questSearch, 64, s => { _questSearch = s; _questPage = 0; });
|
||||
w.Tooltip("Words to find in the quest's flag or name, e.g. \"kill task\". ");
|
||||
w.Tooltip("Words to find in a row: a quest's flag or name; a tracker's NPC, place, area, reward or notes. Also filters the quest bonus list.");
|
||||
w.Checkbox("Done", "q.done", _qDone, v => { _qDone = v; _questPage = 0; });
|
||||
w.Tooltip("Done quests; Legendary quests and stamps you have, markers found, guardians on cooldown.");
|
||||
w.SameLine();
|
||||
w.Checkbox("Not done", "q.notdone", _qNotDone, v => { _qNotDone = v; _questPage = 0; });
|
||||
w.SameLine();
|
||||
|
|
@ -83,18 +167,49 @@ internal sealed partial class OracleView
|
|||
w.Checkbox(_c.Catalog.PackServer + " only", "q.server", _qServer, v => { _qServer = v; _questPage = 0; });
|
||||
w.Tooltip($"Quests only {_c.Catalog.PackServer} has.");
|
||||
}
|
||||
|
||||
w.Checkbox("Trackers only", "q.trackers", _qTrackers, v =>
|
||||
{
|
||||
_qTrackers = v;
|
||||
if (v && _qKind == QuestKind.Quest) _qKind = null;
|
||||
_questPage = 0;
|
||||
});
|
||||
w.Tooltip("Only the trackers, with their status above the list: Legendary Key quests, exploration markers"
|
||||
+ (ilt ? ", Dynamic Stamps and the Temple guardians." : ".")
|
||||
+ (ilt ? "" : "\nDynamic Stamps and the Temple guardians show on Infinite Leaftide."));
|
||||
w.SameLine();
|
||||
var kindItems = new List<string>(kinds.Count + 1) { "Everything" };
|
||||
foreach (QuestKind k in kinds) kindItems.Add(KindNames[(int)k]);
|
||||
int kindIndex = _qKind is QuestKind sel ? kinds.IndexOf(sel) + 1 : 0;
|
||||
w.Combo("Show", "q.kind", kindIndex, kindItems, i =>
|
||||
{
|
||||
_qKind = i <= 0 || i > kinds.Count ? null : kinds[i - 1];
|
||||
if (_qKind == QuestKind.Quest) _qTrackers = false;
|
||||
_questPage = 0;
|
||||
});
|
||||
w.Tooltip("One kind of row, or everything this server has.");
|
||||
if (_qKind == QuestKind.Dynamic)
|
||||
{
|
||||
w.SameLine();
|
||||
var areaItems = new List<string>(DynamicStampList.Areas.Count + 1) { "All areas" };
|
||||
areaItems.AddRange(DynamicStampList.Areas);
|
||||
w.Combo("##dyarea", "dy.area", Math.Clamp(_dynArea, 0, areaItems.Count - 1), areaItems, v => { _dynArea = v; _questPage = 0; });
|
||||
}
|
||||
w.Combo("Sort", "q.sort", _questSort, QuestSorts, i => { _questSort = Math.Clamp(i, 0, QuestSorts.Length - 1); _questPage = 0; });
|
||||
|
||||
List<Quest> rows = QuestRows();
|
||||
if (_qTrackers || _qKind is QuestKind k2 && k2 != QuestKind.Quest) DrawTrackerSummary(w, kinds);
|
||||
|
||||
List<QuestRow> rows = QuestRows(kinds);
|
||||
w.Text($"{rows.Count} shown");
|
||||
w.SameLine(160f);
|
||||
_questPage = Pager(w, "q.page", _questPage, rows.Count, QuestPageSize, p => _questPage = p);
|
||||
|
||||
// A fixed-height list when the opened quest follows it; else it fills the page.
|
||||
bool selected = _questSel.Length > 0;
|
||||
w.BeginChild("q.list", 0f, selected ? QuestListHeightWithPanel : 0f, border: true);
|
||||
// A fixed-height list when something follows it (the opened row, the /qb list); else it fills the page.
|
||||
IltQuestBonusList? qb = ilt && !_qTrackers ? _c.Ilt.Profile.QuestBonus : null;
|
||||
bool selected = HasSelection();
|
||||
w.BeginChild("q.list", 0f, selected || qb != null ? QuestListHeightWithPanel : 0f, border: true);
|
||||
w.TextDisabled("*");
|
||||
w.Tooltip("Track: list the quest in the Quest Timers window.");
|
||||
w.Tooltip("Track: list the quest in the Quest Timers window. Trackers show their kind here instead (LEG, MRK, DYN, GRD).");
|
||||
w.SameLine(28f);
|
||||
w.TextDisabled("Done");
|
||||
w.SameLine(72f);
|
||||
|
|
@ -105,26 +220,38 @@ internal sealed partial class OracleView
|
|||
w.TextDisabled("Solves");
|
||||
w.SameLine(530f);
|
||||
w.TextDisabled("Rewards");
|
||||
w.Tooltip("What you recorded for the quest (click it to edit): %XP, %Lum, Coins, Trinkets, Medallions, Yellow/Red/Blue powder, MMDs (D), at Level.");
|
||||
w.Tooltip("What you recorded for a quest (click it to edit): %XP, %Lum, Coins, Trinkets, Medallions, Yellow/Red/Blue powder, MMDs (D), at Level.\n"
|
||||
+ "Trackers: a Legendary quest's luminance, a marker's location, a stamp's area, a guardian's next turn-in.");
|
||||
|
||||
DateTime now = _c.UtcNow;
|
||||
bool canTrack = _c.Book.Loaded;
|
||||
int start = _questPage * QuestPageSize;
|
||||
for (int i = start; i < rows.Count && i < start + QuestPageSize; i++)
|
||||
DrawQuestRow(w, rows[i], flags, now, canTrack);
|
||||
if (rows.Count == 0)
|
||||
w.TextDisabled(_qTracked ? "No tracked quests match. Tick * on a quest to track it." : "No rows match.");
|
||||
w.EndChild();
|
||||
|
||||
if (selected) DrawSelection(w);
|
||||
if (qb != null) DrawQuestBonus(w, qb);
|
||||
}
|
||||
|
||||
/// <summary>One list row: a quest (track, done, timer, solves, rewards) or a tracker (kind, status, its own columns).</summary>
|
||||
private void DrawQuestRow(UiWindow w, QuestRow r, QuestFlagStore flags, DateTime now, bool canTrack)
|
||||
{
|
||||
if (r.Kind == QuestKind.Quest)
|
||||
{
|
||||
Quest q = rows[i];
|
||||
Quest q = r.Q!;
|
||||
string flag = q.Flag;
|
||||
bool tracked = _c.Book.IsTracked(flag);
|
||||
w.ToggleButton("*", "q.t." + flag, tracked, () => { if (canTrack) _c.Book.ToggleTracked(flag); }, small: true);
|
||||
w.SameLine(28f);
|
||||
bool done = q.IsComplete(flags);
|
||||
DoneMark(w, done);
|
||||
DoneMark(w, r.Done);
|
||||
w.SameLine(72f);
|
||||
Quest row = q;
|
||||
w.Selectable(Cut(q.Label, 44), "q.r." + flag, flag == _questSel, () => SelectQuest(row), 290f);
|
||||
w.Selectable(Cut(q.Label, 44), "q.r." + flag, IsSelected(r), () => SelectRow(r), 290f);
|
||||
w.Tooltip(flag + "\nClick: opens it below and prints its texts in chat.");
|
||||
w.SameLine(370f);
|
||||
TimerText(w, q, flags, now, done);
|
||||
TimerText(w, q, flags, now, r.Done);
|
||||
string solves = q.SolvesText(flags);
|
||||
if (solves.Length > 0)
|
||||
{
|
||||
|
|
@ -138,11 +265,99 @@ internal sealed partial class OracleView
|
|||
w.Text(Cut(reward, 18));
|
||||
if (reward.Length > 18) w.Tooltip(reward);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (rows.Count == 0) w.TextDisabled(_qTracked ? "No tracked quests match. Tick * on a quest to track it." : "No quests match.");
|
||||
w.EndChild();
|
||||
|
||||
if (selected) DrawSelectedQuest(w);
|
||||
// A tracker: its kind tag where the * is, then its mark, label and columns.
|
||||
w.TextColored(UiColors.Gold, r.Kind switch
|
||||
{
|
||||
QuestKind.Legendary => "LEG",
|
||||
QuestKind.Marker => "MRK",
|
||||
QuestKind.Dynamic => "DYN",
|
||||
_ => "GRD",
|
||||
});
|
||||
w.SameLine(28f);
|
||||
TrackerMark(w, r);
|
||||
w.SameLine(72f);
|
||||
w.Selectable(Cut(r.Label, 44), "q.r." + r.Key, IsSelected(r), () => SelectRow(r), 290f);
|
||||
string tip = TrackerTooltip(r);
|
||||
if (tip.Length > 0) w.Tooltip(Cut(tip, 300));
|
||||
switch (r.Kind)
|
||||
{
|
||||
case QuestKind.Legendary:
|
||||
{
|
||||
LegendaryQuest l = r.L!;
|
||||
TimeSpan? left = l.TimeLeft(flags, now);
|
||||
w.SameLine(370f);
|
||||
if (left == null) w.TextColored(UiColors.Grey, "not done");
|
||||
else if (left.Value <= TimeSpan.Zero) w.TextColored(UiColors.Green, "ready");
|
||||
else w.TextColored(UiColors.Yellow, TimeText.Friendly(left.Value));
|
||||
if (l.Luminance > 0)
|
||||
{
|
||||
w.SameLine(530f);
|
||||
w.TextDisabled(TimeText.Number(l.Luminance) + " lum");
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QuestKind.Guardian:
|
||||
{
|
||||
IltGuardianRow g = r.G!;
|
||||
w.SameLine(370f);
|
||||
w.TextColored(g.Ready ? UiColors.Green : g.Status == "Unknown" ? UiColors.Grey : UiColors.Yellow, Cut(g.Status, 14));
|
||||
w.SameLine(470f);
|
||||
w.Text("#" + g.Count);
|
||||
if (g.Eta.Length > 0)
|
||||
{
|
||||
w.SameLine(530f);
|
||||
w.TextDisabled(Cut(g.Eta, 18));
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
// Markers and stamps: where they are.
|
||||
if (r.Group.Length > 0)
|
||||
{
|
||||
w.SameLine(530f);
|
||||
w.TextDisabled(Cut(r.Group, 18));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A tracker's done column: have / need, found / --, or a guardian's ready / wait.</summary>
|
||||
private static void TrackerMark(UiWindow w, QuestRow r)
|
||||
{
|
||||
switch (r.Kind)
|
||||
{
|
||||
case QuestKind.Marker:
|
||||
DoneMark(w, r.Done);
|
||||
break;
|
||||
case QuestKind.Guardian:
|
||||
// Done = turned in and on cooldown; not done = a turn-in is ready (or unknown).
|
||||
w.TextColored(r.Done ? UiColors.Yellow : UiColors.Green, r.Done ? "wait" : "ready");
|
||||
break;
|
||||
default:
|
||||
w.TextColored(r.Done ? UiColors.Green : UiColors.Red, r.Done ? "have" : "need");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A tracker row's hover text: its notes, hint or where it comes from.</summary>
|
||||
private static string TrackerTooltip(QuestRow r) => r.Kind switch
|
||||
{
|
||||
QuestKind.Legendary => r.L!.Note.Length > 0 ? $"{r.Group}: {r.L.Note}" : r.Group,
|
||||
QuestKind.Marker => r.M!.Hint,
|
||||
QuestKind.Dynamic => string.Join(" - ", Parts(r.D!.Area, r.D.Place, r.D.Reward.Length > 0 ? "gives " + r.D.Reward : "", r.D.Note)),
|
||||
QuestKind.Guardian => $"{r.G!.Npc}: {(r.G.Exact ? "from /myquests (exact)" : "from /qb wait stamps (count and timer are estimates)")}",
|
||||
_ => "",
|
||||
};
|
||||
|
||||
/// <summary>The non-empty strings, in order.</summary>
|
||||
private static List<string> Parts(params string[] items)
|
||||
{
|
||||
var list = new List<string>(items.Length);
|
||||
foreach (string s in items) if (!string.IsNullOrWhiteSpace(s)) list.Add(s);
|
||||
return list;
|
||||
}
|
||||
|
||||
/// <summary>The timer column: "ready" (green once done), a countdown, "N left" (yellow) or done (grey).</summary>
|
||||
|
|
@ -158,21 +373,341 @@ internal sealed partial class OracleView
|
|||
}
|
||||
}
|
||||
|
||||
// ── The opened quest and its rewards ──────────────────────────────────
|
||||
// ── Tracker status (above the list in Trackers only / one tracker kind) ──
|
||||
|
||||
/// <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.
|
||||
/// The trackers' status (what each old tab showed at its top), for the kinds the Show filter
|
||||
/// lists: John's Legendary counter, markers found and the next one, stamps had, and the Temple
|
||||
/// guardians' switches, last answer and hand-in.
|
||||
/// </summary>
|
||||
private void SelectQuest(Quest q)
|
||||
private void DrawTrackerSummary(UiWindow w, List<QuestKind> kinds)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
bool Shows(QuestKind k) => kinds.Contains(k) && (_qKind == null || _qKind == k);
|
||||
|
||||
if (Shows(QuestKind.Legendary))
|
||||
{
|
||||
DateTime now = _c.UtcNow;
|
||||
int have = 0, ready = 0;
|
||||
foreach (LegendaryQuest q in LegendaryList.All)
|
||||
{
|
||||
TimeSpan? left = q.TimeLeft(flags, now);
|
||||
if (left == null) continue;
|
||||
have++;
|
||||
if (left.Value <= TimeSpan.Zero) ready++;
|
||||
}
|
||||
// John's own counter when the server has it; it counts every key quest, not just these.
|
||||
int? john = LegendaryList.JohnCount(flags);
|
||||
int shown = john ?? have;
|
||||
w.ProgressBar(Math.Min(1f, (float)shown / LegendaryList.JohnTarget), -1f, 0f,
|
||||
john != null
|
||||
? $"John: {john} / {LegendaryList.JohnTarget} legendary quests ({ready} ready to run again)"
|
||||
: $"{have} / {LegendaryList.JohnTarget} toward John, {ready} ready to run again");
|
||||
w.Tooltip("John in Arwic (33.6N 56.7E) rewards 30 different Legendary Key quests: 500,000 luminance and a 25-use Legendary Key.\n"
|
||||
+ "Bar: his counter (legendaryquestcounter_0913) when /myquests has it, else the Legendary quests you've done.");
|
||||
}
|
||||
|
||||
if (Shows(QuestKind.Marker))
|
||||
{
|
||||
int found = 0;
|
||||
Marker? next = null;
|
||||
foreach (Marker m in MarkerList.All)
|
||||
{
|
||||
if (m.IsFound(flags)) found++;
|
||||
else next ??= m;
|
||||
}
|
||||
w.ProgressBar(MarkerList.All.Count > 0 ? (float)found / MarkerList.All.Count : 0f, -1f, 0f, $"{found} / {MarkerList.All.Count} markers found");
|
||||
if (next != null)
|
||||
{
|
||||
Marker n = next;
|
||||
w.TextDisabled("Next marker:");
|
||||
w.SameLine();
|
||||
w.Selectable($"#{next.Number} {next.Name} ({next.Location})", "m.next", false, () => SelectRow(MarkerRow(n, flags, 0)));
|
||||
w.Tooltip("Opens it below the list (directions, RynthNav) and prints the directions in chat.");
|
||||
}
|
||||
}
|
||||
|
||||
if (Shows(QuestKind.Dynamic))
|
||||
{
|
||||
List<DynamicStamp> all = DynamicStampList.All;
|
||||
int have = 0;
|
||||
foreach (DynamicStamp s in all) if (s.Have(flags)) have++;
|
||||
int unlisted = DynamicStampList.Unlisted(flags).Count;
|
||||
w.ProgressBar(all.Count == 0 ? 0f : (float)have / all.Count, -1f, 0f,
|
||||
$"{have} / {all.Count} listed Dynamic stamps" + (unlisted > 0 ? $" (+{unlisted} not in the list)" : ""));
|
||||
w.Tooltip("Dynamic stamps are one-time quest flags (Dynamic_1_...) from handing items to NPCs on Infinite Leaftide.\n"
|
||||
+ "List: the players' ExtraDyn sheet. Click a stamp for RynthNav's route to it and the Parchment hand-in."
|
||||
+ (unlisted > 0 ? "\nStamps not in the sheet show as quests with Not in list." : ""));
|
||||
}
|
||||
|
||||
if (Shows(QuestKind.Guardian)) DrawGuardianControls(w);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Temple guardians' controls (RynthILT's Guardian window): chat detection, auto hand-in and
|
||||
/// buy-if-missing, which run inside RynthILT; the last answer with Hand in / Stop; and a refresh.
|
||||
/// </summary>
|
||||
private void DrawGuardianControls(UiWindow w)
|
||||
{
|
||||
IltGuardianView g = _c.Guardian;
|
||||
if (!g.Loaded)
|
||||
{
|
||||
w.TextDisabled(_c.IltData.Connected
|
||||
? "Temple guardians: this RynthILT is older than 0.3.3 (no guardian data for Oracle)."
|
||||
: "Temple guardians: RynthILT isn't loaded (it runs the riddles, hand-ins and turn-in tracker).");
|
||||
return;
|
||||
}
|
||||
int ready = 0;
|
||||
foreach (IltGuardianRow r in g.Rows) if (r.Ready) ready++;
|
||||
w.TextColored(UiColors.Gold, "Temple guardians");
|
||||
w.SameLine();
|
||||
w.TextDisabled($"{ready} of {g.Rows.Count} attribute turn-ins ready"
|
||||
+ (g.SyncedUtc == DateTime.MinValue ? ", /qb not read this session" : $", /qb read {g.SyncedUtc.ToLocalTime():HH:mm}"));
|
||||
w.SameLine();
|
||||
w.SmallButton("Refresh", "gd.refresh", () => _c.GuardianCommand(IltGuardianView.RefreshVerb()));
|
||||
w.Tooltip("RynthILT re-reads /myquests and /qb list for the turn-ins (the server allows each once a minute).");
|
||||
|
||||
w.Checkbox("Detect from chat", "gd.chat", g.Chat, v => _c.GuardianCommand(IltGuardianView.SwitchVerb("chat", v)));
|
||||
w.Tooltip("Translate the guardians' tells as they arrive and show the answer here.");
|
||||
w.SameLine();
|
||||
w.Checkbox("Auto hand-in", "gd.auto", g.Auto, v => _c.GuardianCommand(IltGuardianView.SwitchVerb("auto", v)));
|
||||
w.Tooltip("After a chat answer, RynthILT gives one of the item to the guardian automatically.");
|
||||
w.SameLine();
|
||||
w.Checkbox("Buy if missing", "gd.buy", g.Buy, v => _c.GuardianCommand(IltGuardianView.SwitchVerb("buy", v)));
|
||||
w.Tooltip("Temple guardian: when you carry none, RynthILT buys one from the open or nearest vendor first.");
|
||||
|
||||
bool recent = g.Answer.Length > 0 && g.AnswerAgeSec >= 0 && g.AnswerAgeSec < GuardianAnswerShownSec;
|
||||
if (recent || g.Running)
|
||||
{
|
||||
w.TextColored(UiColors.Green, g.Answer);
|
||||
if (g.Heard.Length > 0) w.Tooltip("Heard: " + Cut(g.Heard, 300));
|
||||
w.SameLine();
|
||||
w.TextDisabled("-> " + g.Npc);
|
||||
w.SameLine();
|
||||
if (g.Running) w.SmallButton("Stop", "gd.stop", () => _c.GuardianCommand(IltGuardianView.StopVerb()));
|
||||
else w.SmallButton("Hand in", "gd.handin", () => _c.GuardianCommand(IltGuardianView.HandInVerb()));
|
||||
}
|
||||
else w.TextDisabled("No guardian answer yet.");
|
||||
w.TextDisabled("Hand-in: " + g.Status + (_c.GuardianMessage.Length > 0 ? " - " + _c.GuardianMessage : ""));
|
||||
}
|
||||
|
||||
// ── The opened row ──────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>Something is opened below the list.</summary>
|
||||
private bool HasSelection() => _selKind switch
|
||||
{
|
||||
QuestKind.Quest => _questSel.Length > 0,
|
||||
QuestKind.Dynamic => _dynNav != null,
|
||||
_ => _selKey.Length > 0,
|
||||
};
|
||||
|
||||
private bool IsSelected(QuestRow r) => r.Kind switch
|
||||
{
|
||||
QuestKind.Quest => _selKind == QuestKind.Quest && r.Q!.Flag == _questSel,
|
||||
QuestKind.Dynamic => _selKind == QuestKind.Dynamic && ReferenceEquals(r.D, _dynNav),
|
||||
_ => _selKind == r.Kind && _selKey == r.Key,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Clicking a row opens it below the list (a second click closes it). As before, a click on a
|
||||
/// quest prints its texts in chat (the info and hint, the wiki link and the flag's history) and
|
||||
/// a click on a marker prints its directions. A Dynamic Stamp also asks RynthNav for the route
|
||||
/// at once, as its tab did.
|
||||
/// </summary>
|
||||
private void SelectRow(QuestRow r)
|
||||
{
|
||||
if (r.Kind == QuestKind.Quest) _c.PrintQuest(r.Q!);
|
||||
else if (r.Kind == QuestKind.Marker) PrintMarker(r.M!);
|
||||
|
||||
bool same = IsSelected(r);
|
||||
_questSel = "";
|
||||
_dynNav = null;
|
||||
_selKey = "";
|
||||
_questStopIdx = 0;
|
||||
_questNavStatus = "";
|
||||
if (same) return;
|
||||
_selKind = r.Kind;
|
||||
switch (r.Kind)
|
||||
{
|
||||
case QuestKind.Quest:
|
||||
OpenQuest(r.Q!);
|
||||
break;
|
||||
case QuestKind.Dynamic:
|
||||
_selKey = r.Key;
|
||||
SelectDynamicStamp(r.D!, r.Done);
|
||||
break;
|
||||
default:
|
||||
_selKey = r.Key;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Opens a quest below the list with its reward editor.</summary>
|
||||
private void OpenQuest(Quest q)
|
||||
{
|
||||
_c.PrintQuest(q);
|
||||
if (_questSel == q.Flag) { _questSel = ""; return; }
|
||||
_questSel = q.Flag;
|
||||
_rewardMsg = "";
|
||||
LoadRewardEdit(q.Flag);
|
||||
}
|
||||
|
||||
/// <summary>The opened row's panel: a quest, a Dynamic Stamp's nav box, a Legendary quest, a marker or a guardian.</summary>
|
||||
private void DrawSelection(UiWindow w)
|
||||
{
|
||||
switch (_selKind)
|
||||
{
|
||||
case QuestKind.Quest:
|
||||
DrawSelectedQuest(w);
|
||||
break;
|
||||
case QuestKind.Dynamic:
|
||||
DrawDynamicNavBox(w);
|
||||
break;
|
||||
case QuestKind.Legendary:
|
||||
LegendaryQuest? l = LegendaryList.All.Find(x => "lg:" + x.Name == _selKey);
|
||||
if (l != null) DrawSelectedLegendary(w, l);
|
||||
break;
|
||||
case QuestKind.Marker:
|
||||
Marker? m = MarkerList.All.Find(x => "mk:" + x.Number == _selKey);
|
||||
if (m != null) DrawSelectedMarker(w, m);
|
||||
break;
|
||||
case QuestKind.Guardian:
|
||||
IltGuardianRow? g = null;
|
||||
foreach (IltGuardianRow r in _c.Guardian.Rows)
|
||||
if ("gd:" + r.Attribute == _selKey) { g = r; break; }
|
||||
DrawSelectedGuardian(w, g);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawSelectedLegendary(UiWindow w, LegendaryQuest l)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
string status = l.Status(flags, _c.UtcNow);
|
||||
w.SeparatorText(Cut(l.Label, 60));
|
||||
w.TextDisabled("Area");
|
||||
w.SameLine(90f);
|
||||
w.Text(l.Group);
|
||||
w.TextDisabled("Flags");
|
||||
w.SameLine(90f);
|
||||
w.Text(Cut(string.Join(", ", l.Flags), 70));
|
||||
w.TextDisabled("Status");
|
||||
w.SameLine(90f);
|
||||
w.TextColored(status == "missing" ? UiColors.Red : status == "ready" ? UiColors.Green : UiColors.Yellow, status);
|
||||
if (l.Luminance > 0)
|
||||
{
|
||||
w.SameLine(260f);
|
||||
w.TextDisabled(TimeText.Number(l.Luminance) + " luminance");
|
||||
}
|
||||
if (l.Note.Length > 0) w.TextWrapped(Cut(l.Note, 600));
|
||||
DrawGoTo(w, StopsFor("lg:" + l.Name, () => NavTargets.Stops(l.Note)));
|
||||
w.Button("Print in chat", "lg.sel.print", () => PrintLegendary(l, status));
|
||||
w.Tooltip("The quest, its flags and status, the notes, wiki and video links.");
|
||||
w.SameLine();
|
||||
w.Button("Close", "lg.sel.close", () => _selKey = "");
|
||||
}
|
||||
|
||||
private void DrawSelectedMarker(UiWindow w, Marker m)
|
||||
{
|
||||
bool found = m.IsFound(_c.Flags);
|
||||
w.SeparatorText(Cut($"Marker {m.Number}: {m.Name}", 60));
|
||||
w.TextDisabled("Location");
|
||||
w.SameLine(90f);
|
||||
w.Text(m.Location);
|
||||
w.TextDisabled("Status");
|
||||
w.SameLine(90f);
|
||||
w.TextColored(found ? UiColors.Green : UiColors.Grey, found ? "found" : "not found yet");
|
||||
if (m.Hint.Length > 0) w.TextWrapped(Cut(m.Hint, 600));
|
||||
// Coordinates in the directions, else the location's name for RynthNav's Atlas.
|
||||
DrawGoTo(w, StopsFor("mk:" + m.Number, () =>
|
||||
{
|
||||
List<NavTargets.Stop> stops = NavTargets.Stops(m.Hint);
|
||||
if (stops.Count == 0 && m.Location.Length > 0) stops.Add(NavTargets.Place(m.Location));
|
||||
return stops;
|
||||
}));
|
||||
w.Button("Print in chat", "m.sel.print", () => PrintMarker(m));
|
||||
w.SameLine();
|
||||
w.Button("Close", "m.sel.close", () => _selKey = "");
|
||||
}
|
||||
|
||||
private void DrawSelectedGuardian(UiWindow w, IltGuardianRow? g)
|
||||
{
|
||||
if (g != null)
|
||||
{
|
||||
w.SeparatorText("Temple guardian: " + g.Attribute);
|
||||
w.TextDisabled("NPC");
|
||||
w.SameLine(90f);
|
||||
w.Text(g.Npc);
|
||||
w.TextDisabled("Turn-ins");
|
||||
w.SameLine(90f);
|
||||
w.Text(g.Count.ToString());
|
||||
w.TextDisabled("Status");
|
||||
w.SameLine(90f);
|
||||
w.TextColored(g.Ready ? UiColors.Green : g.Status == "Unknown" ? UiColors.Grey : UiColors.Yellow, g.Status);
|
||||
if (g.Eta.Length > 0)
|
||||
{
|
||||
w.SameLine(260f);
|
||||
w.TextDisabled("Next: " + g.Eta);
|
||||
}
|
||||
w.TextDisabled(g.Exact ? "From /myquests (exact)." : $"From /qb wait stamps: the count and timer are estimates (cooldown taken as {_c.Guardian.CooldownHours} h).");
|
||||
}
|
||||
else w.SeparatorText("Temple guardians");
|
||||
DrawGuardianControls(w);
|
||||
w.Button("Close", "gd.sel.close", () => _selKey = "");
|
||||
}
|
||||
|
||||
// ── Go to: the coordinates in the opened row's text, through RynthNav ──
|
||||
|
||||
private string _questStopsFor = "";
|
||||
private List<NavTargets.Stop> _questStops = new();
|
||||
private int _questStopIdx;
|
||||
private string _questNavStatus = "";
|
||||
|
||||
/// <summary>The opened row's stops, worked out once per row (<paramref name="key"/>).</summary>
|
||||
private List<NavTargets.Stop> StopsFor(string key, Func<List<NavTargets.Stop>> build)
|
||||
{
|
||||
if (_questStopsFor != key)
|
||||
{
|
||||
_questStopsFor = key;
|
||||
_questStops = build();
|
||||
}
|
||||
return _questStops;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Go to: one place is shown with Go / Route / Arrow; several get a picker first (picking one
|
||||
/// plans its route, as clicking a Dynamic Stamp does). Nothing without any.
|
||||
/// </summary>
|
||||
private void DrawGoTo(UiWindow w, List<NavTargets.Stop> stops)
|
||||
{
|
||||
if (stops.Count == 0) return;
|
||||
_questStopIdx = Math.Clamp(_questStopIdx, 0, stops.Count - 1);
|
||||
w.SeparatorText(stops.Count == 1 ? "Go to" : $"Go to ({stops.Count} places in these notes)");
|
||||
if (stops.Count == 1)
|
||||
w.Text(Cut(stops[0].Display, 80));
|
||||
else
|
||||
{
|
||||
var items = new List<string>(stops.Count);
|
||||
for (int i = 0; i < stops.Count; i++) items.Add($"{i + 1}. {Cut(stops[i].Display, 70)}");
|
||||
w.Combo("##q.nav.pick", "q.nav.pick", _questStopIdx, items, i =>
|
||||
{
|
||||
_questStopIdx = Math.Clamp(i, 0, stops.Count - 1);
|
||||
_questNavStatus = SendRynthNav("route", new[] { stops[_questStopIdx].Target });
|
||||
});
|
||||
w.Tooltip("The places the notes give coordinates for, in their order. Picking one plans RynthNav's route to it.");
|
||||
}
|
||||
NavTargets.Stop stop = stops[_questStopIdx];
|
||||
w.Button("Go (auto nav)", "q.nav.go", () => _questNavStatus = SendRynthNav("go", new[] { stop.Target }));
|
||||
w.Tooltip("RynthNav plans the route (walking, portals, recalls, a dungeon's entrance) and walks it.");
|
||||
w.SameLine();
|
||||
w.Button("Route", "q.nav.route", () => _questNavStatus = SendRynthNav("route", new[] { stop.Target }));
|
||||
w.Tooltip("Only plan it: RynthNav prints the steps in chat.");
|
||||
w.SameLine();
|
||||
w.Button("Arrow", "q.nav.arrow", () => _questNavStatus = SendRynthNav("arrow", new[] { stop.Target }));
|
||||
w.Tooltip("Only point RynthNav's arrow at it.");
|
||||
if (_questNavStatus.Length > 0) w.TextDisabled(_questNavStatus);
|
||||
}
|
||||
|
||||
// ── The opened quest and its rewards ──────────────────────────────────
|
||||
|
||||
/// <summary>Fills the editor from what is recorded (blank fields for zero).</summary>
|
||||
private void LoadRewardEdit(string flag)
|
||||
{
|
||||
|
|
@ -202,6 +737,7 @@ internal sealed partial class OracleView
|
|||
}
|
||||
string details = q.Details();
|
||||
if (details.Length > 0) w.TextWrapped(Cut(details, 600));
|
||||
DrawGoTo(w, StopsFor("q:" + q.Flag, () => NavTargets.Stops(q.Info + " - " + q.Hint)));
|
||||
|
||||
bool loaded = _c.Book.Loaded;
|
||||
bool tracked = _c.Book.IsTracked(q.Flag);
|
||||
|
|
@ -274,13 +810,61 @@ internal sealed partial class OracleView
|
|||
_rewardMsg = r.IsEmpty ? "Cleared." : "Saved: " + r.ShortSummary();
|
||||
}
|
||||
|
||||
// ── Quest bonus (/qb, Infinite Leaftide through RynthILT) ──────────────
|
||||
|
||||
private void DrawQuestBonus(UiWindow w, IltQuestBonusList qb)
|
||||
{
|
||||
string count = qb.Count >= 0 ? $" - count {TimeText.Number(qb.Count)}" : "";
|
||||
if (!w.CollapsingHeader($"Quest bonus (/qb){count}", "q.qb")) return;
|
||||
if (qb.Disabled)
|
||||
{
|
||||
w.TextDisabled("/qb is turned off on this server.");
|
||||
return;
|
||||
}
|
||||
w.Button("Load /qb list", "q.qb.load", () =>
|
||||
{
|
||||
if (!_c.Send("/ilt qb")) _c.Print("Log in first.");
|
||||
});
|
||||
w.Tooltip("RynthILT asks the server for your quest bonus list (the server allows once a minute).");
|
||||
w.SameLine();
|
||||
w.TextDisabled(qb.Generation == 0 && qb.Status == "not loaded" ? "Not loaded yet this session." : qb.Status);
|
||||
|
||||
string[] terms = _questSearch.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
QbList(w, "Incomplete", "q.qb.todo", qb.Incomplete, terms, UiColors.Yellow);
|
||||
QbList(w, "Completed", "q.qb.done", qb.Completed, terms, UiColors.Green);
|
||||
}
|
||||
|
||||
private static void QbList(UiWindow w, string label, string id, IReadOnlyList<string> items, string[] terms, uint color)
|
||||
{
|
||||
var shown = new List<string>();
|
||||
foreach (string s in items)
|
||||
if (MatchesAll(s, terms)) shown.Add(s);
|
||||
string counts = terms.Length > 0 ? $"{shown.Count} of {items.Count}" : items.Count.ToString();
|
||||
if (!w.CollapsingHeader($"{label} ({counts})", id)) return;
|
||||
for (int i = 0; i < shown.Count && i < QbShownMax; i++) w.TextColored(color, shown[i]);
|
||||
if (shown.Count > QbShownMax) w.TextDisabled($"... and {shown.Count - QbShownMax} more. Narrow them with Search.");
|
||||
if (shown.Count == 0) w.TextDisabled(items.Count == 0 ? "None." : "None match the search.");
|
||||
}
|
||||
|
||||
/// <summary>Every search word is in <paramref name="hay"/> (any case); no words = everything matches.</summary>
|
||||
private static bool MatchesAll(string hay, string[] terms)
|
||||
{
|
||||
foreach (string t in terms)
|
||||
if (hay.IndexOf(t, StringComparison.OrdinalIgnoreCase) < 0) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
// ── Rows ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The filtered, sorted rows; rebuilt when the filter or data changed (or every 5 s for timers).</summary>
|
||||
private List<Quest> QuestRows()
|
||||
/// <summary>
|
||||
/// The filtered, sorted rows of every listed kind; rebuilt when the filter or data changed (or
|
||||
/// every 5 s for the timer sort).
|
||||
/// </summary>
|
||||
private List<QuestRow> QuestRows(List<QuestKind> kinds)
|
||||
{
|
||||
string key = $"{_questSearch}|{_qDone}{_qNotDone}{_qRepeatable}{_qOneTime}{_qNew}{_qServer}{_qTracked}{_qKill}|{_questSort}"
|
||||
+ $"|{_c.Flags.Revision}|{_c.Catalog.Revision}|{(_qTracked ? _c.Book.Revision : 0)}";
|
||||
+ $"|{_qTrackers}|{_qKind}|{_dynArea}|{string.Join(",", kinds)}"
|
||||
+ $"|{_c.Flags.Revision}|{_c.Catalog.Revision}|{(_qTracked ? _c.Book.Revision : 0)}|{_c.GuardianRevision}";
|
||||
bool timeSorted = _questSort == 4;
|
||||
if (key == _questKey && (!timeSorted || _c.NowMs - _questBuiltMs < 5000)) return _questRows;
|
||||
_questKey = key;
|
||||
|
|
@ -289,53 +873,138 @@ internal sealed partial class OracleView
|
|||
QuestFlagStore flags = _c.Flags;
|
||||
string[] terms = _questSearch.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
_questRows.Clear();
|
||||
foreach (Quest q in _c.Catalog.Quests)
|
||||
|
||||
// The Dynamic stamps the list matched: shown as stamp rows, not again as unknown quest flags.
|
||||
var stampFlags = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||||
if (kinds.Contains(QuestKind.Dynamic))
|
||||
foreach (DynamicStamp s in DynamicStampList.All)
|
||||
if (s.MatchedFlag(flags) is string f) stampFlags.Add(f);
|
||||
|
||||
if (KindListed(QuestKind.Quest, kinds))
|
||||
{
|
||||
if (_qNew && !q.IsNew) continue;
|
||||
if (_qServer && q.Server.Length == 0) continue;
|
||||
if (_qTracked && !_c.Book.IsTracked(q.Flag)) continue;
|
||||
if (_qKill && !(flags.TryGet(q.Flag, out QuestFlag kf) && QuestTimer.IsKillTask(kf))) continue;
|
||||
if (_qDone != _qNotDone && q.IsComplete(flags) != _qDone) continue;
|
||||
if (_qRepeatable != _qOneTime && q.IsRepeatable(flags) != _qRepeatable) continue;
|
||||
if (terms.Length > 0)
|
||||
foreach (Quest q in _c.Catalog.Quests)
|
||||
{
|
||||
string hay = q.Flag + " " + q.DisplayName;
|
||||
bool all = true;
|
||||
foreach (string t in terms)
|
||||
if (hay.IndexOf(t, StringComparison.OrdinalIgnoreCase) < 0) { all = false; break; }
|
||||
if (!all) continue;
|
||||
if (q.IsNew && stampFlags.Contains(q.Flag)) continue;
|
||||
if (_qNew && !q.IsNew) continue;
|
||||
if (_qServer && q.Server.Length == 0) continue;
|
||||
if (_qTracked && !_c.Book.IsTracked(q.Flag)) continue;
|
||||
if (_qKill && !(flags.TryGet(q.Flag, out QuestFlag kf) && QuestTimer.IsKillTask(kf))) continue;
|
||||
bool done = q.IsComplete(flags);
|
||||
if (_qDone != _qNotDone && done != _qDone) continue;
|
||||
if (_qRepeatable != _qOneTime && q.IsRepeatable(flags) != _qRepeatable) continue;
|
||||
if (!MatchesAll(q.Flag + " " + q.DisplayName, terms)) continue;
|
||||
_questRows.Add(new QuestRow { Kind = QuestKind.Quest, Key = q.Flag, Label = q.DisplayName, Done = done, Q = q });
|
||||
}
|
||||
_questRows.Add(q);
|
||||
}
|
||||
|
||||
// The quest-only filters (not in the list, server pack, kill tasks) leave the trackers out.
|
||||
if (!_qNew && !_qServer && !_qKill)
|
||||
{
|
||||
if (KindListed(QuestKind.Legendary, kinds))
|
||||
for (int i = 0; i < LegendaryList.All.Count; i++)
|
||||
{
|
||||
LegendaryQuest l = LegendaryList.All[i];
|
||||
var r = new QuestRow { Kind = QuestKind.Legendary, Key = "lg:" + l.Name, Label = l.Label, Group = l.Group, Order = i, Done = l.Have(flags), L = l };
|
||||
bool tracked = l.Flags.Length > 0 && _c.Book.IsTracked(l.Flags[0]);
|
||||
if (KeepTracker(r, repeatable: true, tracked, $"{l.Label} {l.Group} {l.Note} {string.Join(" ", l.Flags)}", terms)) _questRows.Add(r);
|
||||
}
|
||||
|
||||
if (KindListed(QuestKind.Marker, kinds))
|
||||
for (int i = 0; i < MarkerList.All.Count; i++)
|
||||
{
|
||||
QuestRow r = MarkerRow(MarkerList.All[i], flags, i);
|
||||
if (KeepTracker(r, repeatable: false, tracked: false, $"{r.Label} {r.M!.Location} {r.M.Hint}", terms)) _questRows.Add(r);
|
||||
}
|
||||
|
||||
if (KindListed(QuestKind.Dynamic, kinds))
|
||||
for (int i = 0; i < DynamicStampList.All.Count; i++)
|
||||
{
|
||||
DynamicStamp s = DynamicStampList.All[i];
|
||||
if (_dynArea > 0 && (_dynArea > DynamicStampList.Areas.Count || DynamicStampList.Areas[_dynArea - 1] != s.Area)) continue;
|
||||
var r = new QuestRow { Kind = QuestKind.Dynamic, Key = "dy:" + s.Stamp, Label = s.Label, Group = s.Area, Order = i, Done = s.Have(flags), D = s };
|
||||
if (KeepTracker(r, repeatable: false, tracked: false, $"{s.Npc} {s.Place} {s.Reward} {s.Area} {s.Stamp} {s.Note}", terms)) _questRows.Add(r);
|
||||
}
|
||||
|
||||
if (KindListed(QuestKind.Guardian, kinds))
|
||||
for (int i = 0; i < _c.Guardian.Rows.Count; i++)
|
||||
{
|
||||
IltGuardianRow g = _c.Guardian.Rows[i];
|
||||
var r = new QuestRow { Kind = QuestKind.Guardian, Key = "gd:" + g.Attribute, Label = g.Attribute + " (" + g.Npc + ")", Group = g.Npc, Order = i, Done = !g.Ready, G = g };
|
||||
if (KeepTracker(r, repeatable: true, tracked: false, $"{g.Attribute} {g.Npc} {g.Status}", terms)) _questRows.Add(r);
|
||||
}
|
||||
}
|
||||
|
||||
DateTime now = _c.UtcNow;
|
||||
Comparison<Quest> byFlag = (a, b) => string.CompareOrdinal(a.Flag, b.Flag);
|
||||
switch (_questSort)
|
||||
{
|
||||
case 1:
|
||||
_questRows.Sort((a, b) => Then(string.Compare(a.DisplayName, b.DisplayName, StringComparison.OrdinalIgnoreCase), a, b));
|
||||
_questRows.Sort((a, b) => Then(string.Compare(a.Label, b.Label, StringComparison.OrdinalIgnoreCase), a, b));
|
||||
break;
|
||||
case 2:
|
||||
_questRows.Sort((a, b) => Then(b.IsComplete(flags).CompareTo(a.IsComplete(flags)), a, b));
|
||||
_questRows.Sort((a, b) => Then(b.Done.CompareTo(a.Done), a, b));
|
||||
break;
|
||||
case 3:
|
||||
_questRows.Sort((a, b) => Then(a.IsComplete(flags).CompareTo(b.IsComplete(flags)), a, b));
|
||||
_questRows.Sort((a, b) => Then(a.Done.CompareTo(b.Done), a, b));
|
||||
break;
|
||||
case 4:
|
||||
_questRows.Sort((a, b) => Then(ReadyKey(a, flags, now).CompareTo(ReadyKey(b, flags, now)), a, b));
|
||||
_questRows.Sort((a, b) => Then(RowReadyKey(a, flags, now).CompareTo(RowReadyKey(b, flags, now)), a, b));
|
||||
break;
|
||||
case 5:
|
||||
_questRows.Sort((a, b) => Then(Solves(b, flags).CompareTo(Solves(a, flags)), a, b));
|
||||
_questRows.Sort((a, b) => Then(RowSolves(b, flags).CompareTo(RowSolves(a, flags)), a, b));
|
||||
break;
|
||||
default:
|
||||
_questRows.Sort(byFlag);
|
||||
_questRows.Sort((a, b) => Then(0, a, b));
|
||||
break;
|
||||
}
|
||||
return _questRows;
|
||||
|
||||
static int Then(int c, Quest a, Quest b) => c != 0 ? c : string.CompareOrdinal(a.Flag, b.Flag);
|
||||
// Ties: by kind (quests first), then quests by flag and trackers in their own list's order.
|
||||
static int Then(int c, QuestRow a, QuestRow b)
|
||||
{
|
||||
if (c != 0) return c;
|
||||
if (a.Kind != b.Kind) return a.Kind.CompareTo(b.Kind);
|
||||
return a.Kind == QuestKind.Quest ? string.CompareOrdinal(a.Key, b.Key) : a.Order.CompareTo(b.Order);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A marker's row (the list, and the summary's "Next marker").</summary>
|
||||
private static QuestRow MarkerRow(Marker m, QuestFlagStore flags, int order)
|
||||
=> new() { Kind = QuestKind.Marker, Key = "mk:" + m.Number, Label = $"#{m.Number} {m.Name}", Group = m.Location, Order = order, Done = m.IsFound(flags), M = m };
|
||||
|
||||
/// <summary>The filters a tracker row answers to: Tracked, Done / Not done, Repeatable / One-time and Search.</summary>
|
||||
private bool KeepTracker(QuestRow r, bool repeatable, bool tracked, string hay, string[] terms)
|
||||
{
|
||||
if (_qTracked && !tracked) return false;
|
||||
if (_qDone != _qNotDone && r.Done != _qDone) return false;
|
||||
if (_qRepeatable != _qOneTime && repeatable != _qRepeatable) return false;
|
||||
return MatchesAll(hay, terms);
|
||||
}
|
||||
|
||||
/// <summary>Ready soonest: held repeatable quests and Legendary quests by time left, ready guardians first; the rest after.</summary>
|
||||
private static double RowReadyKey(QuestRow r, QuestFlagStore flags, DateTime now)
|
||||
{
|
||||
switch (r.Kind)
|
||||
{
|
||||
case QuestKind.Quest:
|
||||
return ReadyKey(r.Q!, flags, now);
|
||||
case QuestKind.Legendary:
|
||||
TimeSpan? left = r.L!.TimeLeft(flags, now);
|
||||
return left == null ? double.MaxValue : Math.Max(0, left.Value.TotalSeconds);
|
||||
case QuestKind.Guardian:
|
||||
return r.G!.Ready ? 0 : double.MaxValue;
|
||||
default:
|
||||
return double.MaxValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Most solves: a repeatable quest's solves, a guardian's turn-ins.</summary>
|
||||
private static int RowSolves(QuestRow r, QuestFlagStore flags) => r.Kind switch
|
||||
{
|
||||
QuestKind.Quest => Solves(r.Q!, flags),
|
||||
QuestKind.Guardian => r.G!.Count,
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
/// <summary>Held repeatables by time left (ready ones first); everything else after them.</summary>
|
||||
private static double ReadyKey(Quest q, QuestFlagStore flags, DateTime now) =>
|
||||
flags.TryGet(q.Flag, out _) && (q.IsRepeatable(flags) || flags.TryGet(q.Flag, out QuestFlag f) && QuestTimer.IsKillTask(f))
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ 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)
|
||||
/// - data the server owns (the quest flags)
|
||||
/// 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
|
||||
|
|
@ -33,13 +33,8 @@ internal sealed partial class OracleView
|
|||
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,
|
||||
};
|
||||
/// <summary>The page a status line belongs to (each tab is one page).</summary>
|
||||
private static string RefreshScope(string tab) => tab;
|
||||
|
||||
private void DrawRefreshRow(UiWindow w, TabDef def)
|
||||
{
|
||||
|
|
@ -90,16 +85,6 @@ internal sealed partial class OracleView
|
|||
|
||||
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 = "")
|
||||
{
|
||||
|
|
@ -107,6 +92,8 @@ internal sealed partial class OracleView
|
|||
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);
|
||||
int wait = f.ThrottleSecondsLeft(_c.NowMs);
|
||||
if (wait > 0) return new RefreshResult(before + $"The server answers one /myquests a minute; try again in {wait}s (the flags shown are kept).");
|
||||
return new RefreshResult(before + "Your quest flags were asked for a moment ago; wait a few seconds before asking again.");
|
||||
}
|
||||
|
||||
|
|
@ -137,6 +124,16 @@ internal sealed partial class OracleView
|
|||
return new RefreshResult("Re-read your buffs and dropped the spell timers that ran out. Timers on targets are learned from your casts.");
|
||||
}
|
||||
|
||||
/// <summary>The Pet Breeding tab: RynthILT appraises every essence again; the line waits for the new snapshot.</summary>
|
||||
private RefreshResult RefreshBreeding()
|
||||
{
|
||||
if (CoolingDown("breeding")) return new RefreshResult(TooSoon);
|
||||
object before = _c.Breeding;
|
||||
if (!_c.BreedingCommand(RynthCore.Plugin.Shared.IltBreedingView.RefreshVerb()))
|
||||
return new RefreshResult("RynthILT didn't take that (not loaded, or older than 0.3.1).");
|
||||
return new RefreshResult("Asked RynthILT to appraise your essences again.", () => !ReferenceEquals(_c.Breeding, before));
|
||||
}
|
||||
|
||||
private RefreshResult RefreshFellowship()
|
||||
{
|
||||
_c.Fellowship.Invalidate();
|
||||
|
|
@ -151,63 +148,4 @@ internal sealed partial class OracleView
|
|||
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.",
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue