Snapshot for release 2026.10.15.2 (internal 2d4b0af)
This commit is contained in:
parent
a89ae04005
commit
d5e0b50de7
224 changed files with 17914 additions and 1182 deletions
|
|
@ -28,6 +28,21 @@ internal sealed partial class OracleView
|
|||
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.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;
|
||||
if (st.State is { } es)
|
||||
{
|
||||
w.TextDisabled(es.HasActive
|
||||
? $"RynthCore: {es.ActiveName} ({es.Active}){(es.Picked ? ", picked by hand" : "")}; settings from {(es.ActivePlugin.Length > 0 ? es.ActivePlugin : "no plugin")}"
|
||||
: "RynthCore: no server active" + (es.Picked ? " (picked by hand)" : ""));
|
||||
if (RynthCore.Plugin.Shared.ServerProfileView.Parse(st.ProfileJson) is { } prof)
|
||||
w.TextDisabled($"{st.ProfilePlugin} ({RynthCore.Plugin.Shared.RynthServerProfileApiV1.InterfaceName}): {prof.Summary()}");
|
||||
else if (es.ActivePlugin.Length > 0)
|
||||
w.TextDisabled($"{es.ActivePlugin} hasn't sent its server settings (an older plugin?).");
|
||||
w.TextDisabled("Change the server: RynthCore Options > Diagnostics > Server, or /rc server pick <id>|auto.");
|
||||
}
|
||||
else if (_c.Host.Version >= 75 && _c.Host.Version < 85)
|
||||
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.");
|
||||
|
||||
w.SeparatorText("Quest list");
|
||||
|
|
@ -48,6 +63,10 @@ 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 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 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");
|
||||
|
|
|
|||
|
|
@ -8,7 +8,9 @@ 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) and the full buff list.
|
||||
/// 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).
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
|
|
@ -54,6 +56,8 @@ internal sealed partial class OracleView
|
|||
Field(w, "Melee D", SkillText(c.MeleeDefense), 0f, 100f);
|
||||
Field(w, "Summoning", SkillText(c.Summoning), 300f, 400f);
|
||||
|
||||
DrawSession(w);
|
||||
|
||||
var list = new List<ActiveEnchantment>(c.Enchantments);
|
||||
list.Sort((a, b) => a.Remaining.CompareTo(b.Remaining));
|
||||
if (w.CollapsingHeader($"Buffs and debuffs ({list.Count})", "c.buffs", defaultOpen: true))
|
||||
|
|
@ -69,6 +73,38 @@ internal sealed partial class OracleView
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// "Session": RynthAi's session (the Mini Remote's Session Stats), so every tracker shows the same
|
||||
/// XP, luminance and kills. Read through "RynthAi.Hub" only while this tab is on screen.
|
||||
/// </summary>
|
||||
private void DrawSession(UiWindow w)
|
||||
{
|
||||
w.SeparatorText("Session");
|
||||
if (!_c.SessionKnown)
|
||||
{
|
||||
w.TextDisabled("Load RynthAi for the session rates (the Mini Remote's Session Stats).");
|
||||
return;
|
||||
}
|
||||
RynthCore.Plugin.Shared.SessionStatsV1 s = _c.Session;
|
||||
w.TextDisabled($"From RynthAi's Mini Remote, {TimeText.Clock(Math.Max(0, s.SessionSeconds))} so far.");
|
||||
Field(w, "XP", $"{TimeText.Number(s.Xp)} ({RateText(s.XpPerHour)}/h)", 0f, 100f);
|
||||
Field(w, "Luminance", $"{TimeText.Number(s.Lum)} ({RateText(s.LumPerHour)}/h)", 300f, 400f);
|
||||
Field(w, "Kills", $"{s.Kills} ({s.KillsPerHour:0}/h)", 0f, 100f);
|
||||
Field(w, "Lum, 5 min", TimeText.Number(s.LumLast5Min), 300f, 400f);
|
||||
if (s.PassUpTracked != 0)
|
||||
Field(w, "Pass-up", $"{TimeText.Number(s.LumPassUp)} ({RateText(s.PassUpPerHour)}/h)", 0f, 100f);
|
||||
w.SmallButton("Session Stats", "c.session.open", () => _c.RunCommand(SessionStatsCommand));
|
||||
w.Tooltip("Opens RynthCore's Mini Remote on Session Stats (reset the session there).");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Mini Remote's Session Stats section (RynthCore 2026-10-13). "section", not "tab": the
|
||||
/// engine sends "tab char" back here (/ro character), since that tab moved to this one.
|
||||
/// </summary>
|
||||
internal const string SessionStatsCommand = "/rc miniremote section char";
|
||||
|
||||
private static string RateText(double perHour) => perHour > 0 ? TimeText.Number((long)Math.Round(perHour)) : "0";
|
||||
|
||||
/// <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,13 +1,17 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthAi;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Fellowship: name, leader, open/locked, experience sharing and the members (upstream's status
|
||||
/// list). Read from the client's fellowship object through RynthAi's FellowshipTracker (shared
|
||||
/// source). The recruiting tools are not ported (see the port report).
|
||||
/// Fellowship: name, leader, open/locked, experience sharing and the members with their levels
|
||||
/// (upstream's status list). Read from the client's fellowship object through RynthAi's
|
||||
/// FellowshipTracker (shared source). The Mini Remote's Fellowship view links here ("/ro fellowship").
|
||||
/// A server's own fellowship rules and commands (Infinite Leaftide's larger fellowships and /fship
|
||||
/// buttons) are its server plugin's (RynthILT's Fellowship section), not drawn here. The upstream
|
||||
/// recruiting tools are not ported (see the port report).
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
|
|
@ -22,28 +26,40 @@ internal sealed partial class OracleView
|
|||
return;
|
||||
}
|
||||
|
||||
// One snapshot for every row: the index getters could each see a different refresh.
|
||||
List<(int Id, string Name, int Level)> members = f.GetMembers();
|
||||
int leaderId = f.LeaderId;
|
||||
int count = f.MemberCount;
|
||||
int count = System.Math.Max(f.MemberCount, members.Count);
|
||||
string leaderName = "";
|
||||
for (int i = 0; i < count; i++)
|
||||
if (f.GetMemberId(i) == leaderId) leaderName = f.GetMemberName(i);
|
||||
foreach ((int id, string name, int _) in members)
|
||||
if (id == leaderId) leaderName = name;
|
||||
|
||||
// A server that allows more than retail's nine: no limit is shown (its server plugin knows it).
|
||||
bool overRetail = count > MaxFellows;
|
||||
w.SeparatorText(f.FellowshipName.Length > 0 ? f.FellowshipName : "Fellowship");
|
||||
Field(w, "Leader", leaderName.Length > 0 ? leaderName : "-", 0f, 110f);
|
||||
Field(w, "Members", $"{count} / {MaxFellows}", 300f, 400f);
|
||||
Field(w, "Members", overRetail ? count.ToString() : $"{count} / {MaxFellows}", 300f, 400f);
|
||||
Field(w, "Open", f.IsOpen ? "yes" : "no", 0f, 110f);
|
||||
Field(w, "Locked", f.IsLocked ? "yes" : "no", 300f, 400f);
|
||||
Field(w, "Experience", f.ShareXP ? "shared" : "not shared", 0f, 110f);
|
||||
bool canRecruit = (leaderId == (int)_c.Character.PlayerId || f.IsOpen) && count < MaxFellows;
|
||||
Field(w, "Recruit", count >= MaxFellows ? "fellowship full" : canRecruit ? "you can recruit" : "must be open or leader", 300f, 400f);
|
||||
bool mayRecruit = leaderId == (int)_c.Character.PlayerId || f.IsOpen;
|
||||
Field(w, "Recruit", !overRetail && count >= MaxFellows ? "fellowship full" : mayRecruit ? "you can recruit" : "must be open or leader", 300f, 400f);
|
||||
|
||||
w.SeparatorText("Members");
|
||||
for (int i = 0; i < count; i++)
|
||||
if (members.Count == 0) w.TextDisabled("Reading the member list...");
|
||||
// Leader first, then everyone else by name; the level (0 = not read yet) in its own column.
|
||||
members.Sort((a, b) => a.Id == leaderId ? -1 : b.Id == leaderId ? 1
|
||||
: string.Compare(a.Name, b.Name, System.StringComparison.OrdinalIgnoreCase));
|
||||
foreach ((int id, string name, int level) in members)
|
||||
{
|
||||
string name = f.GetMemberName(i);
|
||||
if (name.Length == 0) continue;
|
||||
if (f.GetMemberId(i) == leaderId) w.TextColored(UiColors.Gold, name + " (leader)");
|
||||
if (id == leaderId) w.TextColored(UiColors.Gold, name + " (leader)");
|
||||
else w.Text(name);
|
||||
if (level > 0)
|
||||
{
|
||||
w.SameLine(260f);
|
||||
w.TextDisabled("level " + level);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,87 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// The Quest Timers window: the quests this character tracks (the * column on the Quests tab),
|
||||
/// each with the time left before it can be done again, "ready", a kill task's kills left, or
|
||||
/// done. Replaces RynthAi's Mini Remote quest favorites HUD and UtilityBelt ILT's favorites HUD.
|
||||
/// Ready quests first, then by time left. Hovering a quest shows its flag and recorded rewards.
|
||||
/// </summary>
|
||||
internal sealed class QuestTimersView
|
||||
{
|
||||
private const float StatusX = 190f;
|
||||
private const float RemoveX = 275f;
|
||||
|
||||
private readonly OracleContext _c;
|
||||
private readonly List<Quest> _rows = new();
|
||||
|
||||
public QuestTimersView(OracleContext c) => _c = c;
|
||||
|
||||
public void Draw(UiWindow w)
|
||||
{
|
||||
if (!_c.InWorld)
|
||||
{
|
||||
w.TextDisabled("Not in the world.");
|
||||
return;
|
||||
}
|
||||
if (!_c.Book.Loaded)
|
||||
{
|
||||
w.TextDisabled("Waiting for the character...");
|
||||
return;
|
||||
}
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
if (_c.Book.Tracked.Count == 0)
|
||||
{
|
||||
w.TextDisabled("No quests tracked.");
|
||||
w.TextWrapped("Tick * next to a quest on Oracle's Quests tab (/ro) to list it here.");
|
||||
return;
|
||||
}
|
||||
|
||||
DateTime now = _c.UtcNow;
|
||||
_rows.Clear();
|
||||
foreach (string flag in _c.Book.Tracked)
|
||||
_rows.Add(_c.Catalog.TryGet(flag, out Quest q) ? q : new Quest { Flag = flag, IsNew = true });
|
||||
_rows.Sort((a, b) =>
|
||||
{
|
||||
int c = QuestTimer.SortKey(a, flags, now).CompareTo(QuestTimer.SortKey(b, flags, now));
|
||||
return c != 0 ? c : string.Compare(a.Label, b.Label, StringComparison.OrdinalIgnoreCase);
|
||||
});
|
||||
|
||||
foreach (Quest q in _rows)
|
||||
{
|
||||
string flag = q.Flag;
|
||||
w.Text(Cut(q.Label, 26));
|
||||
string reward = _c.Book.RewardText(flag);
|
||||
w.Tooltip(reward.Length > 0 ? $"{q.Label}\n{flag}\nRewards: {reward}" : $"{q.Label}\n{flag}");
|
||||
w.SameLine(StatusX);
|
||||
QuestTimerState s = QuestTimer.State(q, flags, now, out string text);
|
||||
bool held = flags.TryGet(flag, out _);
|
||||
switch (s)
|
||||
{
|
||||
case QuestTimerState.Ready: w.TextColored(UiColors.Green, held ? text : "not done"); break;
|
||||
case QuestTimerState.InProgress: w.TextColored(UiColors.Yellow, text); break;
|
||||
case QuestTimerState.Done: w.TextColored(UiColors.Grey, text); break;
|
||||
default: w.Text(text); break;
|
||||
}
|
||||
w.SameLine(RemoveX);
|
||||
w.SmallButton("x", "qt.x." + flag, () => _c.Book.SetTracked(flag, false));
|
||||
w.Tooltip("Stop tracking this quest.");
|
||||
}
|
||||
|
||||
if (flags.Loading) w.TextColored(UiColors.Yellow, "Reading quest flags...");
|
||||
else if (flags.LastReadUtc == DateTime.MinValue) w.TextDisabled("Quest flags not read yet.");
|
||||
w.SmallButton("Refresh", "qt.refresh", _c.RequestQuests);
|
||||
w.Tooltip("Sends /myquests and reads the reply (timers count down by themselves between reads).");
|
||||
if (flags.LastReadUtc != DateTime.MinValue)
|
||||
{
|
||||
w.SameLine();
|
||||
w.TextDisabled($"read {flags.LastReadUtc.ToLocalTime():HH:mm}");
|
||||
}
|
||||
}
|
||||
|
||||
private static string Cut(string s, int max) => s.Length <= max ? s : s.Substring(0, Math.Max(0, max - 3)) + "...";
|
||||
}
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
// 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).
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
|
|
@ -8,16 +11,22 @@ 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). Click a quest to print its
|
||||
/// notes and wiki link in chat.
|
||||
/// 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).
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private const int QuestPageSize = 40;
|
||||
private const float QuestListHeightWithPanel = 300f;
|
||||
private static readonly string[] QuestSorts = { "Flag", "Name", "Done first", "Not done first", "Ready soonest", "Most solves" };
|
||||
|
||||
// The reward editor's fields, in QuestReward order (two percentages, then counts).
|
||||
private static readonly string[] RewardLabels =
|
||||
{ "XP %", "Lum %", "Coins", "Trinkets", "Medallions", "Yellow powder", "Red powder", "Blue powder", "MMDs" };
|
||||
|
||||
private string _questSearch = "";
|
||||
private bool _qDone, _qNotDone, _qRepeatable, _qOneTime, _qNew, _qServer;
|
||||
private bool _qDone, _qNotDone, _qRepeatable, _qOneTime, _qNew, _qServer, _qTracked, _qKill;
|
||||
private int _questSort;
|
||||
private int _questPage;
|
||||
|
||||
|
|
@ -25,6 +34,11 @@ internal sealed partial class OracleView
|
|||
private string _questKey = "";
|
||||
private long _questBuiltMs;
|
||||
|
||||
// The quest opened below the list, and its reward editor's text (kept while typing).
|
||||
private string _questSel = "";
|
||||
private readonly string[] _rewardEdit = new string[RewardLabels.Length];
|
||||
private string _rewardMsg = "";
|
||||
|
||||
private void DrawQuests(UiWindow w)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
|
|
@ -40,13 +54,17 @@ internal sealed partial class OracleView
|
|||
w.Button("Refresh", "q.refresh", _c.RequestQuests);
|
||||
w.Tooltip("Sends /myquests to the server and reads the reply.");
|
||||
w.SameLine();
|
||||
bool timersShown = _c.QuestTimersWindowVisible();
|
||||
w.Button(timersShown ? "Hide quest timers" : "Show quest timers", "q.timers", () => _c.SetQuestTimersWindow(!timersShown));
|
||||
w.Tooltip("A small window with the quests you track (the * column) and the time left on each.");
|
||||
w.SameLine();
|
||||
QuestCatalog cat = _c.Catalog;
|
||||
w.TextDisabled(cat.PackServer.Length > 0
|
||||
? $"{cat.RetailCount} retail quests + {cat.ServerCount} {cat.PackServer} quests"
|
||||
: $"{cat.RetailCount} retail quests");
|
||||
|
||||
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 the quest's flag or name, e.g. \"kill task\". ");
|
||||
w.Checkbox("Done", "q.done", _qDone, v => { _qDone = v; _questPage = 0; });
|
||||
w.SameLine();
|
||||
w.Checkbox("Not done", "q.notdone", _qNotDone, v => { _qNotDone = v; _questPage = 0; });
|
||||
|
|
@ -57,6 +75,11 @@ internal sealed partial class OracleView
|
|||
w.SameLine();
|
||||
w.Checkbox("Not in list", "q.new", _qNew, v => { _qNew = v; _questPage = 0; });
|
||||
w.Tooltip("Flags this character holds that no quest list knows.");
|
||||
w.Checkbox("Tracked", "q.tracked", _qTracked, v => { _qTracked = v; _questPage = 0; });
|
||||
w.Tooltip("Only the quests you track (the * column).");
|
||||
w.SameLine();
|
||||
w.Checkbox("Kill tasks", "q.kill", _qKill, v => { _qKill = v; _questPage = 0; });
|
||||
w.Tooltip("Only kill-task counters you hold: kills left, then the reset timer.");
|
||||
if (_c.Catalog.PackServer.Length > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
|
|
@ -70,52 +93,199 @@ internal sealed partial class OracleView
|
|||
w.SameLine(160f);
|
||||
_questPage = Pager(w, "q.page", _questPage, rows.Count, QuestPageSize, p => _questPage = p);
|
||||
|
||||
w.BeginChild("q.list", 0f, 0f, border: true);
|
||||
// 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);
|
||||
w.TextDisabled("*");
|
||||
w.Tooltip("Track: list the quest in the Quest Timers window.");
|
||||
w.SameLine(28f);
|
||||
w.TextDisabled("Done");
|
||||
w.SameLine(50f);
|
||||
w.SameLine(72f);
|
||||
w.TextDisabled("Quest");
|
||||
w.SameLine(370f);
|
||||
w.TextDisabled("Ready in");
|
||||
w.SameLine(480f);
|
||||
w.SameLine(470f);
|
||||
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.");
|
||||
|
||||
DateTime now = _c.UtcNow;
|
||||
bool canTrack = _c.Book.Loaded;
|
||||
int start = _questPage * QuestPageSize;
|
||||
for (int i = start; i < rows.Count && i < start + QuestPageSize; i++)
|
||||
{
|
||||
Quest q = rows[i];
|
||||
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);
|
||||
w.SameLine(50f);
|
||||
string name = q.IsNew ? "(new) " + (q.Name.Length > 0 ? q.Name : q.Flag) : q.DisplayName;
|
||||
w.SameLine(72f);
|
||||
Quest row = q;
|
||||
w.Selectable(Cut(name, 46), "q.r." + q.Flag, false, () => PrintQuest(row), 310f);
|
||||
w.Tooltip(q.Flag);
|
||||
w.Selectable(Cut(q.Label, 44), "q.r." + flag, flag == _questSel, () => SelectQuest(row), 290f);
|
||||
w.Tooltip(flag);
|
||||
w.SameLine(370f);
|
||||
string status = q.Status(flags, now);
|
||||
if (status == "ready" && done) w.TextColored(UiColors.Green, status);
|
||||
else w.Text(status);
|
||||
TimerText(w, q, flags, now, done);
|
||||
string solves = q.SolvesText(flags);
|
||||
if (solves.Length > 0)
|
||||
{
|
||||
w.SameLine(480f);
|
||||
w.SameLine(470f);
|
||||
w.Text(solves);
|
||||
}
|
||||
string reward = _c.Book.RewardText(flag);
|
||||
if (reward.Length > 0)
|
||||
{
|
||||
w.SameLine(530f);
|
||||
w.Text(Cut(reward, 18));
|
||||
if (reward.Length > 18) w.Tooltip(reward);
|
||||
}
|
||||
}
|
||||
if (rows.Count == 0) w.TextDisabled("No quests match.");
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>The timer column: "ready" (green once done), a countdown, "N left" (yellow) or done (grey).</summary>
|
||||
private static void TimerText(UiWindow w, Quest q, QuestFlagStore flags, DateTime now, bool done)
|
||||
{
|
||||
QuestTimerState s = QuestTimer.State(q, flags, now, out string text);
|
||||
switch (s)
|
||||
{
|
||||
case QuestTimerState.Ready when done: w.TextColored(UiColors.Green, text); break;
|
||||
case QuestTimerState.InProgress: w.TextColored(UiColors.Yellow, text); break;
|
||||
case QuestTimerState.Done: w.TextColored(UiColors.Grey, text); break;
|
||||
default: w.Text(text); break;
|
||||
}
|
||||
}
|
||||
|
||||
// ── The opened quest and its rewards ──────────────────────────────────
|
||||
|
||||
private void SelectQuest(Quest q)
|
||||
{
|
||||
if (_questSel == q.Flag) { _questSel = ""; return; } // a second click closes it
|
||||
_questSel = q.Flag;
|
||||
_rewardMsg = "";
|
||||
LoadRewardEdit(q.Flag);
|
||||
}
|
||||
|
||||
/// <summary>Fills the editor from what is recorded (blank fields for zero).</summary>
|
||||
private void LoadRewardEdit(string flag)
|
||||
{
|
||||
Array.Fill(_rewardEdit, "");
|
||||
if (!_c.Book.TryGetReward(flag, out QuestReward r)) return;
|
||||
_rewardEdit[0] = r.XpPercent > 0 ? QuestReward.Percent(r.XpPercent) : "";
|
||||
_rewardEdit[1] = r.LumPercent > 0 ? QuestReward.Percent(r.LumPercent) : "";
|
||||
int[] counts = { r.Coins, r.Trinkets, r.Medallions, r.YellowPowder, r.RedPowder, r.BluePowder, r.Mmd };
|
||||
for (int i = 0; i < counts.Length; i++) _rewardEdit[2 + i] = counts[i] > 0 ? counts[i].ToString() : "";
|
||||
}
|
||||
|
||||
private void DrawSelectedQuest(UiWindow w)
|
||||
{
|
||||
Quest q = _c.Catalog.TryGet(_questSel, out Quest found) ? found : new Quest { Flag = _questSel, IsNew = true };
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
w.SeparatorText(Cut(q.Label, 60));
|
||||
w.TextDisabled("Flag");
|
||||
w.SameLine(90f);
|
||||
w.Text(q.Flag);
|
||||
w.TextDisabled("Status");
|
||||
w.SameLine(90f);
|
||||
TimerText(w, q, flags, _c.UtcNow, q.IsComplete(flags));
|
||||
if (flags.TryGet(q.Flag, out QuestFlag f))
|
||||
{
|
||||
w.SameLine(260f);
|
||||
w.TextDisabled(f.MaxSolves > 0 ? $"solves {f.Solves} of {f.MaxSolves}" : $"solves {f.Solves}");
|
||||
}
|
||||
string details = q.Details();
|
||||
if (details.Length > 0) w.TextWrapped(Cut(details, 600));
|
||||
|
||||
bool loaded = _c.Book.Loaded;
|
||||
bool tracked = _c.Book.IsTracked(q.Flag);
|
||||
string flag = q.Flag;
|
||||
w.Button(tracked ? "Untrack" : "Track", "q.sel.track", () => { if (loaded) _c.Book.ToggleTracked(flag); });
|
||||
w.Tooltip("List this quest in the Quest Timers window.");
|
||||
w.SameLine();
|
||||
Quest print = q;
|
||||
w.Button("Print in chat", "q.sel.print", () => PrintQuest(print));
|
||||
w.SameLine();
|
||||
w.Button("Close", "q.sel.close", () => _questSel = "");
|
||||
|
||||
w.SeparatorText("Rewards");
|
||||
if (!loaded)
|
||||
{
|
||||
w.TextDisabled("Waiting for the character's name before rewards can be saved.");
|
||||
return;
|
||||
}
|
||||
int level = _c.Book.TryGetReward(flag, out QuestReward saved) && saved.RecordedLevel > 0 ? saved.RecordedLevel : _c.Character.Level;
|
||||
w.TextDisabled($"Level: {level} (XP % and Lum % are for this level)");
|
||||
for (int i = 0; i < RewardLabels.Length; i++)
|
||||
{
|
||||
int field = i;
|
||||
w.InputText(RewardLabels[i], "q.rw." + i, _rewardEdit[i], 16, s => _rewardEdit[field] = s);
|
||||
}
|
||||
w.Button("Save rewards", "q.rw.save", () => SaveReward(flag));
|
||||
w.SameLine();
|
||||
w.Button("Clear", "q.rw.clear", () =>
|
||||
{
|
||||
_c.Book.SetReward(flag, null);
|
||||
LoadRewardEdit(flag);
|
||||
_rewardMsg = "Cleared.";
|
||||
});
|
||||
if (_rewardMsg.Length > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
w.TextDisabled(_rewardMsg);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Parses the editor (UB's rules: percent 0..1000, counts 0 and up) and stores the entry.</summary>
|
||||
private void SaveReward(string flag)
|
||||
{
|
||||
var r = new QuestReward();
|
||||
if (!QuestReward.TryParsePercent(_rewardEdit[0], out r.XpPercent)) { _rewardMsg = "XP % isn't a number."; return; }
|
||||
if (!QuestReward.TryParsePercent(_rewardEdit[1], out r.LumPercent)) { _rewardMsg = "Lum % isn't a number."; return; }
|
||||
var counts = new int[7];
|
||||
for (int i = 0; i < counts.Length; i++)
|
||||
{
|
||||
if (QuestReward.TryParseCount(_rewardEdit[2 + i], out counts[i])) continue;
|
||||
_rewardMsg = RewardLabels[2 + i] + " isn't a whole number.";
|
||||
return;
|
||||
}
|
||||
r.Coins = counts[0];
|
||||
r.Trinkets = counts[1];
|
||||
r.Medallions = counts[2];
|
||||
r.YellowPowder = counts[3];
|
||||
r.RedPowder = counts[4];
|
||||
r.BluePowder = counts[5];
|
||||
r.Mmd = counts[6];
|
||||
|
||||
// The percentages belong to the level they were noted at: keep the old level unless they changed.
|
||||
bool had = _c.Book.TryGetReward(flag, out QuestReward old);
|
||||
bool percentChanged = !had || old.XpPercent != r.XpPercent || old.LumPercent != r.LumPercent;
|
||||
if (r.XpPercent > 0 || r.LumPercent > 0)
|
||||
r.RecordedLevel = !percentChanged && old.RecordedLevel > 0 ? old.RecordedLevel : _c.Character.Level;
|
||||
|
||||
_c.Book.SetReward(flag, r);
|
||||
LoadRewardEdit(flag);
|
||||
_rewardMsg = r.IsEmpty ? "Cleared." : "Saved: " + r.ShortSummary();
|
||||
}
|
||||
|
||||
private void PrintQuest(Quest q)
|
||||
{
|
||||
string status = q.IsComplete(_c.Flags) ? q.Status(_c.Flags, _c.UtcNow) : "not done";
|
||||
PrintEntry(q.IsNew ? (q.Name.Length > 0 ? q.Name : "Not in the quest list") : q.DisplayName, q.Flag, status, q.Details(), q.Url);
|
||||
if (_c.Book.TryGetReward(q.Flag, out QuestReward r)) _c.Print("Rewards: " + r.LongSummary());
|
||||
}
|
||||
|
||||
// ── Rows ──────────────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>The filtered, sorted rows; rebuilt when the filter or data changed (or every 5 s for timers).</summary>
|
||||
private List<Quest> QuestRows()
|
||||
{
|
||||
string key = $"{_questSearch}|{_qDone}{_qNotDone}{_qRepeatable}{_qOneTime}{_qNew}{_qServer}|{_questSort}|{_c.Flags.Revision}|{_c.Catalog.Revision}";
|
||||
string key = $"{_questSearch}|{_qDone}{_qNotDone}{_qRepeatable}{_qOneTime}{_qNew}{_qServer}{_qTracked}{_qKill}|{_questSort}"
|
||||
+ $"|{_c.Flags.Revision}|{_c.Catalog.Revision}|{(_qTracked ? _c.Book.Revision : 0)}";
|
||||
bool timeSorted = _questSort == 4;
|
||||
if (key == _questKey && (!timeSorted || _c.NowMs - _questBuiltMs < 5000)) return _questRows;
|
||||
_questKey = key;
|
||||
|
|
@ -128,6 +298,8 @@ internal sealed partial class OracleView
|
|||
{
|
||||
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)
|
||||
|
|
@ -170,11 +342,10 @@ internal sealed partial class OracleView
|
|||
}
|
||||
|
||||
/// <summary>Held repeatables by time left (ready ones first); everything else after them.</summary>
|
||||
private static double ReadyKey(Quest q, QuestFlagStore flags, DateTime now)
|
||||
{
|
||||
if (!flags.TryGet(q.Flag, out QuestFlag f) || !q.IsRepeatable(flags) || f.AtSolveLimit) return double.MaxValue;
|
||||
return Math.Max(0, f.NextAvailableTime(now).TotalSeconds);
|
||||
}
|
||||
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))
|
||||
? QuestTimer.SortKey(q, flags, now)
|
||||
: double.MaxValue;
|
||||
|
||||
private static int Solves(Quest q, QuestFlagStore flags) =>
|
||||
flags.TryGet(q.Flag, out QuestFlag f) && q.IsRepeatable(flags) ? f.Solves : 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue