RynthSuite as of 2026-10-04 (internal c94715f): RynthOracle (based on Oracle of Dereth by Advis Eveldan) and RynthInventory, RynthAi patrol doorways and rooms, healing priority, strict monster priority, finish the wounded target, slayer weapons, arcs when clear, blasts like rings, learn unknown spells, looting fixes, release 2026.10.4.6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
c33e24a610
commit
12ca25f911
426 changed files with 108239 additions and 7521 deletions
73
Plugins/RynthCore.Plugin.RynthOracle/Views/AboutTab.cs
Normal file
73
Plugins/RynthCore.Plugin.RynthOracle/Views/AboutTab.cs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>About: the credit to Oracle of Dereth's author, the settings and the quest list's source.</summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private void DrawAbout(UiWindow w)
|
||||
{
|
||||
w.TextColored(UiColors.Gold, "Based on Oracle of Dereth by Advis Eveldan - thank you!");
|
||||
w.TextDisabled("github.com/advis61/OracleOfDereth (MIT licence). The quest, augmentation, society, title and marker lists are Advis's.");
|
||||
w.Text($"RynthOracle {RynthOraclePlugin.Version}");
|
||||
|
||||
OracleSettings s = _c.Settings;
|
||||
w.SeparatorText("Settings");
|
||||
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.Checkbox("Show the Void window for characters with Void Magic", "o.void", s.AutoShowVoidWindow, v => { s.AutoShowVoidWindow = v; s.Save(); });
|
||||
w.Checkbox("Check once a day for a newer quest list", "o.daily", s.CheckQuestListDaily, v => { s.CheckQuestListDaily = v; s.Save(); });
|
||||
w.Tooltip("Downloads Oracle of Dereth's master quest list from GitHub, as the original plugin does.");
|
||||
|
||||
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.TextDisabled($"How it was decided: {sv.Source}");
|
||||
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");
|
||||
QuestCatalog cat = _c.Catalog;
|
||||
w.Text($"{cat.RetailCount} retail quests from the {cat.Source}" +
|
||||
(cat.PackServer.Length > 0 ? $", plus {cat.ServerCount} {cat.PackServer} quests ({cat.PackSource})" : ""));
|
||||
if (cat.HiddenCount > 0) w.TextDisabled($"{cat.HiddenCount} retail quests are hidden: {cat.PackServer}'s /myquests can't show their flags.");
|
||||
if (s.LastQuestListCheckUtc != DateTime.MinValue)
|
||||
w.TextDisabled($"Last checked {s.LastQuestListCheckUtc.ToLocalTime():yyyy-MM-dd HH:mm}");
|
||||
if (_c.Updater.Running) w.TextColored(UiColors.Yellow, "Checking...");
|
||||
else w.Button("Check for a newer list now", "o.check", () => StartQuestListCheck());
|
||||
if (!_c.Catalog.UsingBundled)
|
||||
{
|
||||
w.SameLine();
|
||||
w.Button("Go back to the bundled list", "o.bundled", UseBundledList);
|
||||
}
|
||||
if (_c.UpdaterMessage.Length > 0) w.TextWrapped(_c.UpdaterMessage);
|
||||
|
||||
w.SeparatorText("Commands");
|
||||
w.BulletText("/ro open or close this window");
|
||||
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.");
|
||||
}
|
||||
|
||||
private void StartQuestListCheck()
|
||||
{
|
||||
_c.Settings.LastQuestListCheckUtc = DateTime.UtcNow;
|
||||
_c.Settings.Save();
|
||||
_c.UpdaterMessage = "";
|
||||
_c.Updater.Start();
|
||||
}
|
||||
|
||||
private void UseBundledList()
|
||||
{
|
||||
try { File.Delete(QuestCatalog.DownloadedPath); }
|
||||
catch (Exception ex) { _c.UpdaterMessage = "Couldn't remove the downloaded list: " + ex.Message; return; }
|
||||
_c.Catalog.Load(_c.Server.Tag, null);
|
||||
_c.Catalog.SyncDiscoveries(_c.Flags);
|
||||
_c.UpdaterMessage = "Using the bundled quest list.";
|
||||
}
|
||||
}
|
||||
95
Plugins/RynthCore.Plugin.RynthOracle/Views/AugsTab.cs
Normal file
95
Plugins/RynthCore.Plugin.RynthOracle/Views/AugsTab.cs
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
// 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>
|
||||
/// Augmentations: aug-gem quest timers, experience augmentations and luminance auras, with
|
||||
/// luminance spent and still to go (upstream's Augmentations and Luminance tabs).
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private void DrawAugs(UiWindow w)
|
||||
{
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
Func<uint, int> prop = _c.Props;
|
||||
DateTime now = _c.UtcNow;
|
||||
if (flags.LastReadUtc == DateTime.MinValue)
|
||||
w.TextDisabled("Quest flags not read yet (Quests tab, Refresh): gem timers and seer auras show as not done.");
|
||||
|
||||
if (w.CollapsingHeader("Augmentation gem quests", "a.gems", defaultOpen: true))
|
||||
{
|
||||
foreach (AugQuest q in AugmentationList.Quests)
|
||||
{
|
||||
bool held = flags.TryGet(q.Flag, out QuestFlag f);
|
||||
bool ready = !held || f.Ready(now);
|
||||
DoneMark(w, !ready);
|
||||
w.SameLine(50f);
|
||||
AugQuest row = q;
|
||||
w.Selectable(Cut(q.Name, 44), "a.g." + q.Flag, false,
|
||||
() => PrintEntry(row.Name, row.Flag, ready ? "ready" : "on cooldown", row.Hint, row.Url), 300f);
|
||||
w.SameLine(370f);
|
||||
w.Text(held ? f.NextAvailable(now) : "ready");
|
||||
if (held)
|
||||
{
|
||||
w.SameLine(480f);
|
||||
w.Text(f.Solves.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Starts closed: it is the longest list, and every row drawn costs replay time each frame.
|
||||
if (w.CollapsingHeader("Experience augmentations", "a.xp", defaultOpen: false))
|
||||
DrawAugRows(w, xp: true, prop, flags);
|
||||
|
||||
if (w.CollapsingHeader("Luminance auras", "a.lum", defaultOpen: true))
|
||||
{
|
||||
long spent = AugmentationList.TotalLuminanceSpent(prop, flags);
|
||||
long total = AugmentationList.TotalLuminance;
|
||||
w.ProgressBar((float)spent / total, -1f, 0f,
|
||||
$"{TimeText.Number(spent)} spent of {TimeText.Number(total)} ({(int)(spent * 100 / total)}%), {TimeText.Number(Math.Max(0, total - spent))} to go");
|
||||
DrawAugRows(w, xp: false, prop, flags);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawAugRows(UiWindow w, bool xp, Func<uint, int> prop, QuestFlagStore flags)
|
||||
{
|
||||
w.TextDisabled("Done");
|
||||
w.SameLine(50f);
|
||||
w.TextDisabled("Have");
|
||||
w.SameLine(100f);
|
||||
w.TextDisabled("Augmentation");
|
||||
w.SameLine(300f);
|
||||
w.TextDisabled("Effect");
|
||||
w.SameLine(520f);
|
||||
w.TextDisabled("Cost");
|
||||
foreach (Augmentation a in AugmentationList.All)
|
||||
{
|
||||
if (a.IsXp != xp || a.Name == "Blank") continue;
|
||||
if (a.IsHeading)
|
||||
{
|
||||
w.SeparatorText(a.Name);
|
||||
continue;
|
||||
}
|
||||
if (a.IsUnknown) w.TextColored(UiColors.Grey, "?");
|
||||
else DoneMark(w, a.IsComplete(prop, flags));
|
||||
w.SameLine(50f);
|
||||
w.Text(a.IsUnknown ? "" : a.Text(prop, flags));
|
||||
w.SameLine(100f);
|
||||
Augmentation row = a;
|
||||
w.Selectable(Cut(a.Name, 26), "a.r." + a.Category + a.Id + a.Flag + a.Name, false,
|
||||
() => PrintEntry(row.Name, row.Flag, row.Effect, row.Hint, row.Url), 190f);
|
||||
if (a.IsUnknown) w.Tooltip("Asheron's Lesser Benediction is an item; RynthOracle can't count it.");
|
||||
w.SameLine(300f);
|
||||
w.Text(Cut(a.Effect, 34));
|
||||
string cost = a.CostText(prop, flags);
|
||||
if (cost.Length > 0)
|
||||
{
|
||||
w.SameLine(520f);
|
||||
w.Text(cost);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
160
Plugins/RynthCore.Plugin.RynthOracle/Views/BoardsTab.cs
Normal file
160
Plugins/RynthCore.Plugin.RynthOracle/Views/BoardsTab.cs
Normal file
|
|
@ -0,0 +1,160 @@
|
|||
// 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.Button("Refresh", "cb.refresh", () => _c.Send(cq.RequestBoard(b, _c.NowMs)));
|
||||
w.Tooltip($"Sends {b.Command} and reads the reply.");
|
||||
w.SameLine();
|
||||
w.TextDisabled(b.UpdatedUtc == DateTime.MinValue ? "not read yet" : $"read at {b.UpdatedUtc.ToLocalTime():HH:mm}");
|
||||
if (b.You != null) w.Text($"You: #{b.You.Rank} with {b.You.Value}");
|
||||
DrawRows(w, "cb.rows", b.Rows);
|
||||
}
|
||||
|
||||
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.Button("Refresh", "ab.me", () => _c.Send(a.RequestTop("me", _c.NowMs)));
|
||||
w.Tooltip("Sends /top me.");
|
||||
w.BeginChild("ab.melist", 0f, 0f, border: true);
|
||||
foreach (AelrynthStanding s in a.Standings)
|
||||
{
|
||||
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.Button("Refresh", "ab.trials", () => _c.Send(a.RequestTrial("", _c.NowMs)));
|
||||
w.Tooltip("Sends /trial.");
|
||||
w.SameLine();
|
||||
w.InputText("Dungeon", "ab.trialarg", _trialArg, 48, s => _trialArg = s);
|
||||
w.SameLine();
|
||||
w.Button("Top 10", "ab.trialtop", () => { if (_trialArg.Trim().Length > 0) _c.Send(a.RequestTrial(_trialArg, _c.NowMs)); });
|
||||
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();
|
||||
}
|
||||
}
|
||||
142
Plugins/RynthCore.Plugin.RynthOracle/Views/CharacterTab.cs
Normal file
142
Plugins/RynthCore.Plugin.RynthOracle/Views/CharacterTab.cs
Normal file
|
|
@ -0,0 +1,142 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
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.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private void DrawCharacter(UiWindow w)
|
||||
{
|
||||
CharacterSnapshot c = _c.Character;
|
||||
if (!c.Valid)
|
||||
{
|
||||
w.TextDisabled("Character data isn't available yet.");
|
||||
return;
|
||||
}
|
||||
|
||||
w.SeparatorText(c.Name.Length > 0 ? c.Name : "Character");
|
||||
w.Text($"Level {c.Level}");
|
||||
w.SameLine(130f);
|
||||
w.Text($"Total experience {TimeText.Number(c.TotalXp)}");
|
||||
(long toNext, float frac) = c.LevelProgress();
|
||||
w.ProgressBar(frac, -1f, 0f, c.Level >= CharacterSnapshot.MaxLevel || c.Level <= 0
|
||||
? "Maximum level"
|
||||
: $"{TimeText.Number(toNext)} to level {c.Level + 1}");
|
||||
Field(w, "Unassigned XP", TimeText.Number(c.UnassignedXp), 0f, 130f);
|
||||
Field(w, "Skill credits", c.SkillCredits.ToString(), 300f, 420f);
|
||||
Field(w, "Luminance", c.MaxLuminance > 0 ? $"{TimeText.Number(c.Luminance)} / {TimeText.Number(c.MaxLuminance)}" : "not unlocked", 0f, 130f);
|
||||
Field(w, "Deaths", c.Deaths.ToString(), 300f, 420f);
|
||||
if (c.Enlightenment > 0 || c.VitaePercent > 0)
|
||||
{
|
||||
Field(w, "Enlightenment", c.Enlightenment.ToString(), 0f, 130f);
|
||||
Field(w, "Vitae", c.VitaePercent > 0 ? $"{c.VitaePercent}%" : "none", 300f, 420f);
|
||||
}
|
||||
|
||||
w.SeparatorText("Status");
|
||||
Field(w, "Buffs", BuffsText(c), 0f, 100f);
|
||||
Field(w, "House", GroupText(c, SpellIds.House, withHours: true), 300f, 400f);
|
||||
Field(w, "Beers", GroupText(c, SpellIds.Beer, withHours: false), 0f, 100f);
|
||||
Field(w, "Pages", GroupText(c, SpellIds.Pages, withHours: false), 300f, 400f);
|
||||
Field(w, "Rares", RareText(c), 0f, 100f);
|
||||
Field(w, "Cloaked", OneText(c, SpellIds.CloakedInSkill), 300f, 400f);
|
||||
Field(w, "Destruction", OneText(c, SpellIds.SurgeOfDestruction), 0f, 100f);
|
||||
Field(w, "Protection", OneText(c, SpellIds.SurgeOfProtection), 300f, 400f);
|
||||
Field(w, "Regen", OneText(c, SpellIds.SurgeOfRegeneration), 0f, 100f);
|
||||
Field(w, "Lockpick", LockpickText(c.Lockpick), 0f, 100f);
|
||||
Field(w, "Life", SkillText(c.Life), 300f, 400f);
|
||||
Field(w, "Melee D", SkillText(c.MeleeDefense), 0f, 100f);
|
||||
Field(w, "Summoning", SkillText(c.Summoning), 300f, 400f);
|
||||
|
||||
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))
|
||||
{
|
||||
if (list.Count == 0) w.TextDisabled("None.");
|
||||
foreach (ActiveEnchantment e in list)
|
||||
{
|
||||
if (e.Debuff) w.TextColored(UiColors.Red, Cut(e.Name, 44));
|
||||
else w.Text(Cut(e.Name, 44));
|
||||
w.SameLine(330f);
|
||||
w.Text(double.IsPositiveInfinity(e.Remaining) ? "-" : TimeText.Clock(e.Remaining));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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).
|
||||
/// </summary>
|
||||
private static string BuffsText(CharacterSnapshot c)
|
||||
{
|
||||
double min = double.MaxValue;
|
||||
int count = 0;
|
||||
foreach (ActiveEnchantment e in c.Enchantments)
|
||||
{
|
||||
if (e.Duration <= 900 || double.IsPositiveInfinity(e.Remaining) || e.Debuff) continue;
|
||||
if (SpellIds.Beer.Contains(e.SpellId) || SpellIds.NotBuff.Contains(e.SpellId)) continue;
|
||||
count++;
|
||||
if (e.Remaining < min) min = e.Remaining;
|
||||
}
|
||||
return count == 0 ? "-" : $"{TimeText.Clock(min)} ({count})";
|
||||
}
|
||||
|
||||
private static string GroupText(CharacterSnapshot c, HashSet<uint> ids, bool withHours)
|
||||
{
|
||||
double min = double.MaxValue;
|
||||
int count = 0;
|
||||
foreach (ActiveEnchantment e in c.Enchantments)
|
||||
{
|
||||
if (!ids.Contains(e.SpellId) || double.IsPositiveInfinity(e.Remaining)) continue;
|
||||
count++;
|
||||
if (e.Remaining < min) min = e.Remaining;
|
||||
}
|
||||
if (count == 0) return "-";
|
||||
return withHours ? $"{TimeText.Clock(min)} ({count})" : TimeText.Clock(min);
|
||||
}
|
||||
|
||||
private static string OneText(CharacterSnapshot c, uint spellId)
|
||||
{
|
||||
double min = double.MaxValue;
|
||||
foreach (ActiveEnchantment e in c.Enchantments)
|
||||
if (e.SpellId == spellId && e.Remaining < min) min = e.Remaining;
|
||||
return min == double.MaxValue ? "-" : double.IsPositiveInfinity(min) ? "on" : TimeText.Clock(min);
|
||||
}
|
||||
|
||||
/// <summary>Rares: the soonest to end, how many, and the 3-minute cooldown left after the newest (upstream's rule).</summary>
|
||||
private static string RareText(CharacterSnapshot c)
|
||||
{
|
||||
double min = double.MaxValue, max = 0;
|
||||
int count = 0;
|
||||
foreach (ActiveEnchantment e in c.Enchantments)
|
||||
{
|
||||
if (!SpellIds.Rare.Contains(e.SpellId) || double.IsPositiveInfinity(e.Remaining)) continue;
|
||||
count++;
|
||||
min = Math.Min(min, e.Remaining);
|
||||
max = Math.Max(max, e.Remaining);
|
||||
}
|
||||
if (count == 0) return "-";
|
||||
double cooldown = 180 - (900 - max);
|
||||
return cooldown > 0
|
||||
? $"{TimeText.Clock(min)} ({count}) {(int)cooldown}s"
|
||||
: $"{TimeText.Clock(min)} ({count})";
|
||||
}
|
||||
|
||||
private static string SkillText(SkillValue s) => s.Known ? s.Current.ToString() : "-";
|
||||
|
||||
/// <summary>Lockpick, with the Viridian Rise essences one try costs at this skill (upstream's table).</summary>
|
||||
private static string LockpickText(SkillValue s)
|
||||
{
|
||||
if (!s.Known) return "-";
|
||||
int v = s.Current;
|
||||
if (v < 500) return v.ToString();
|
||||
(int a, int b) = v >= 575 ? (3, 10) : v >= 570 ? (4, 11) : v >= 565 ? (5, 12) : v >= 550 ? (6, 13) : v >= 525 ? (6, 14) : (7, 15);
|
||||
return $"{v} (VR {a}/{b})";
|
||||
}
|
||||
}
|
||||
219
Plugins/RynthCore.Plugin.RynthOracle/Views/ConquestTab.cs
Normal file
219
Plugins/RynthCore.Plugin.RynthOracle/Views/ConquestTab.cs
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
// 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.Button("Refresh", "cq.bank.refresh", () => _c.Send(cq.RequestBank(_c.NowMs)));
|
||||
w.Tooltip("Sends /b and reads your balances.");
|
||||
w.SameLine();
|
||||
w.TextDisabled(ReadAt(cq.BankUtc));
|
||||
foreach (NamedValue b in cq.Bank.OrderBy(b => b.Name, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
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.Button("Refresh", "cq.augs.refresh", () => _c.Send(cq.RequestAugs(_c.NowMs)));
|
||||
w.Tooltip("Sends /augs.");
|
||||
w.SameLine();
|
||||
w.TextDisabled($"{ReadAt(cq.AugsUtc)}, {cq.AugTotal} in total");
|
||||
w.TextDisabled("Aug"); w.SameLine(120f); w.TextDisabled("Have"); w.SameLine(170f); w.TextDisabled("Next costs"); w.SameLine(330f); w.TextDisabled("Effect now");
|
||||
foreach (ConquestAug a in cq.Augs)
|
||||
{
|
||||
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.Button("Refresh", "cq.enl.refresh", () => _c.Send(cq.RequestEnl(_c.NowMs)));
|
||||
w.Tooltip("Sends /enl augs.");
|
||||
w.SameLine();
|
||||
w.TextDisabled(ReadAt(cq.EnlUtc));
|
||||
foreach (NamedValue a in cq.EnlAugs)
|
||||
{
|
||||
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.Button("Refresh", "cq.bonus.refresh", () => _c.Send(cq.RequestBonus(_c.NowMs)));
|
||||
w.Tooltip("Sends /bonus.");
|
||||
w.SameLine();
|
||||
w.TextDisabled(ReadAt(cq.BonusUtc));
|
||||
foreach (NamedValue b in cq.Bonuses)
|
||||
{
|
||||
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.Button("Refresh", "cq.fship.refresh", () => _c.Send(cq.RequestFships(_c.NowMs)));
|
||||
w.Tooltip("Sends /fship list.");
|
||||
w.SameLine();
|
||||
w.TextDisabled($"{ReadAt(cq.FshipUtc)}, {cq.Fellowships.Count} looking for members");
|
||||
w.Combo("Sort", "cq.fship.sort", _fshipSort, new[] { "Name", "Leader", "Most members", "Location" }, i => _fshipSort = i);
|
||||
var list = _fshipSort switch
|
||||
{
|
||||
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.");
|
||||
}
|
||||
}
|
||||
49
Plugins/RynthCore.Plugin.RynthOracle/Views/FellowshipTab.cs
Normal file
49
Plugins/RynthCore.Plugin.RynthOracle/Views/FellowshipTab.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
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).
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private const int MaxFellows = 9; // retail
|
||||
|
||||
private void DrawFellowship(UiWindow w)
|
||||
{
|
||||
FellowshipTracker f = _c.Fellowship;
|
||||
if (!f.IsInFellowship)
|
||||
{
|
||||
w.Text("Not in a fellowship.");
|
||||
return;
|
||||
}
|
||||
|
||||
int leaderId = f.LeaderId;
|
||||
int count = f.MemberCount;
|
||||
string leaderName = "";
|
||||
for (int i = 0; i < count; i++)
|
||||
if (f.GetMemberId(i) == leaderId) leaderName = f.GetMemberName(i);
|
||||
|
||||
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, "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);
|
||||
|
||||
w.SeparatorText("Members");
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
string name = f.GetMemberName(i);
|
||||
if (name.Length == 0) continue;
|
||||
if (f.GetMemberId(i) == leaderId) w.TextColored(UiColors.Gold, name + " (leader)");
|
||||
else w.Text(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
61
Plugins/RynthCore.Plugin.RynthOracle/Views/MarkersTab.cs
Normal file
61
Plugins/RynthCore.Plugin.RynthOracle/Views/MarkersTab.cs
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// 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>
|
||||
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);
|
||||
}
|
||||
149
Plugins/RynthCore.Plugin.RynthOracle/Views/OracleView.cs
Normal file
149
Plugins/RynthCore.Plugin.RynthOracle/Views/OracleView.cs
Normal file
|
|
@ -0,0 +1,149 @@
|
|||
using System;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// The main RynthOracle window: a row of tabs and the selected tab's page. Each tab is a
|
||||
/// partial of this class (Views\*Tab.cs). Recorded on the pump thread, replayed by the engine.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
public const string TabQuests = "Quests", TabCharacter = "Character", TabAugs = "Augs", TabSociety = "Society",
|
||||
TabMarkers = "Markers", TabTitles = "Titles", TabVoid = "Void", TabFellowship = "Fellowship",
|
||||
TabBoards = "Leaderboards", TabConquest = "Conquest", TabAbout = "About";
|
||||
|
||||
/// <summary>A tab: shown where any of its server tags matches the server; no tags = everywhere (retail).</summary>
|
||||
private sealed record TabDef(string Name, string[] Servers, Action<UiWindow> Draw, bool LiveTimers);
|
||||
|
||||
private readonly OracleContext _c;
|
||||
private readonly TabDef[] _tabs;
|
||||
|
||||
/// <summary>Asks the plugin to show or hide the Void window (the Void tab's button).</summary>
|
||||
public Action<bool>? SetVoidWindow;
|
||||
public Func<bool>? VoidWindowVisible;
|
||||
|
||||
public OracleView(OracleContext c)
|
||||
{
|
||||
_c = c;
|
||||
string[] any = Array.Empty<string>();
|
||||
_tabs = new TabDef[]
|
||||
{
|
||||
new(TabQuests, any, DrawQuests, true),
|
||||
new(TabCharacter, any, DrawCharacter, true),
|
||||
new(TabAugs, any, DrawAugs, true),
|
||||
new(TabSociety, any, DrawSociety, true),
|
||||
new(TabMarkers, any, DrawMarkers, false),
|
||||
new(TabTitles, any, DrawTitles, false),
|
||||
new(TabVoid, any, DrawVoid, true),
|
||||
new(TabFellowship, any, DrawFellowship, false),
|
||||
// Server-specific: each parser and its commands only exist on its own server.
|
||||
new(TabBoards, new[] { Data.ServerTags.Conquest, Data.ServerTags.Aelrynth }, DrawBoards, false),
|
||||
new(TabConquest, new[] { Data.ServerTags.Conquest }, DrawConquest, true),
|
||||
new(TabAbout, any, DrawAbout, false),
|
||||
};
|
||||
}
|
||||
|
||||
private bool Visible(TabDef t)
|
||||
{
|
||||
if (t.Servers.Length == 0) return true;
|
||||
foreach (string s in t.Servers) if (_c.Server.Is(s)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>The selected tab's name; a tab not available on this server falls back to Quests.</summary>
|
||||
public string Tab
|
||||
{
|
||||
get
|
||||
{
|
||||
foreach (TabDef t in _tabs)
|
||||
if (t.Name == _c.Settings.TabName && Visible(t)) return t.Name;
|
||||
return TabQuests;
|
||||
}
|
||||
set
|
||||
{
|
||||
_c.Settings.TabName = value;
|
||||
_c.Settings.Save();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Tabs whose content changes by the second (timers), so the window re-records often.</summary>
|
||||
public bool TabHasLiveTimers
|
||||
{
|
||||
get
|
||||
{
|
||||
string tab = Tab;
|
||||
foreach (TabDef t in _tabs) if (t.Name == tab) return t.LiveTimers;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>For tests: the names of the tabs this server shows.</summary>
|
||||
internal string[] VisibleTabs() => Array.ConvertAll(Array.FindAll(_tabs, Visible), t => t.Name);
|
||||
|
||||
public void Draw(UiWindow w)
|
||||
{
|
||||
string tab = Tab;
|
||||
bool first = true;
|
||||
TabDef? current = null;
|
||||
foreach (TabDef t in _tabs)
|
||||
{
|
||||
if (!Visible(t)) continue;
|
||||
if (!first) w.SameLine();
|
||||
first = false;
|
||||
string name = t.Name;
|
||||
w.ToggleButton(name, "tab." + name, tab == name, () => Tab = name, small: true);
|
||||
if (tab == name) current = t;
|
||||
}
|
||||
w.Separator();
|
||||
|
||||
if (!_c.InWorld && tab != TabAbout)
|
||||
{
|
||||
w.TextDisabled("Log in to a character to see this page.");
|
||||
return;
|
||||
}
|
||||
|
||||
w.BeginChild("page." + tab, 0f, 0f, border: false);
|
||||
(current?.Draw ?? DrawAbout)(w);
|
||||
w.EndChild();
|
||||
}
|
||||
|
||||
// ── Shared helpers ──────────────────────────────────────────────────────
|
||||
|
||||
/// <summary>"Done" in green or "--" in grey, the status column most lists start with.</summary>
|
||||
private static void DoneMark(UiWindow w, bool done) =>
|
||||
w.TextColored(done ? UiColors.Green : UiColors.Grey, done ? "done" : "--");
|
||||
|
||||
private static string Cut(string s, int max) => s.Length <= max ? s : s.Substring(0, Math.Max(0, max - 3)) + "...";
|
||||
|
||||
/// <summary>"Label value" with the value at a fixed column.</summary>
|
||||
private static void Field(UiWindow w, string label, string value, float x, float valueX)
|
||||
{
|
||||
if (x > 0f) w.SameLine(x);
|
||||
w.TextDisabled(label);
|
||||
w.SameLine(valueX);
|
||||
w.Text(value);
|
||||
}
|
||||
|
||||
/// <summary>Prints a quest's name, status, notes and wiki link in chat (upstream "thinks" them).</summary>
|
||||
private void PrintEntry(string name, string flag, string status, string details, string url)
|
||||
{
|
||||
_c.Print(flag.Length > 0 ? $"{name} ({flag}){(status.Length > 0 ? " - " + status : "")}" : name);
|
||||
if (details.Length > 0) _c.Print(details);
|
||||
if (url.Length > 0) _c.Print(url);
|
||||
}
|
||||
|
||||
/// <summary>Previous / page n of m / next, with the page kept in range.</summary>
|
||||
private static int Pager(UiWindow w, string id, int page, int count, int pageSize, Action<int> setPage)
|
||||
{
|
||||
int pages = Math.Max(1, (count + pageSize - 1) / pageSize);
|
||||
page = Math.Clamp(page, 0, pages - 1);
|
||||
int p = page;
|
||||
w.SmallButton("<", id + ".prev", () => setPage(Math.Max(0, p - 1)));
|
||||
w.SameLine();
|
||||
w.Text($"Page {page + 1} of {pages}");
|
||||
w.SameLine();
|
||||
w.SmallButton(">", id + ".next", () => setPage(Math.Min(pages - 1, p + 1)));
|
||||
return page;
|
||||
}
|
||||
}
|
||||
181
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestsTab.cs
Normal file
181
Plugins/RynthCore.Plugin.RynthOracle/Views/QuestsTab.cs
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
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.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private const int QuestPageSize = 40;
|
||||
private static readonly string[] QuestSorts = { "Flag", "Name", "Done first", "Not done first", "Ready soonest", "Most solves" };
|
||||
|
||||
private string _questSearch = "";
|
||||
private bool _qDone, _qNotDone, _qRepeatable, _qOneTime, _qNew, _qServer;
|
||||
private int _questSort;
|
||||
private int _questPage;
|
||||
|
||||
private readonly List<Quest> _questRows = new();
|
||||
private string _questKey = "";
|
||||
private long _questBuiltMs;
|
||||
|
||||
private void DrawQuests(UiWindow w)
|
||||
{
|
||||
QuestFlagStore flags = _c.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)
|
||||
w.TextColored(UiColors.Yellow, "Reading your quest flags...");
|
||||
else if (flags.LastReadUtc == DateTime.MinValue)
|
||||
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}.");
|
||||
|
||||
w.Button("Refresh", "q.refresh", _c.RequestQuests);
|
||||
w.Tooltip("Sends /myquests to the server and reads the reply.");
|
||||
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.Checkbox("Done", "q.done", _qDone, v => { _qDone = v; _questPage = 0; });
|
||||
w.SameLine();
|
||||
w.Checkbox("Not done", "q.notdone", _qNotDone, v => { _qNotDone = v; _questPage = 0; });
|
||||
w.SameLine();
|
||||
w.Checkbox("Repeatable", "q.rep", _qRepeatable, v => { _qRepeatable = v; _questPage = 0; });
|
||||
w.SameLine();
|
||||
w.Checkbox("One-time", "q.one", _qOneTime, v => { _qOneTime = v; _questPage = 0; });
|
||||
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.");
|
||||
if (_c.Catalog.PackServer.Length > 0)
|
||||
{
|
||||
w.SameLine();
|
||||
w.Checkbox(_c.Catalog.PackServer + " only", "q.server", _qServer, v => { _qServer = v; _questPage = 0; });
|
||||
w.Tooltip($"Quests only {_c.Catalog.PackServer} has.");
|
||||
}
|
||||
w.Combo("Sort", "q.sort", _questSort, QuestSorts, i => { _questSort = Math.Clamp(i, 0, QuestSorts.Length - 1); _questPage = 0; });
|
||||
|
||||
List<Quest> rows = QuestRows();
|
||||
w.Text($"{rows.Count} shown");
|
||||
w.SameLine(160f);
|
||||
_questPage = Pager(w, "q.page", _questPage, rows.Count, QuestPageSize, p => _questPage = p);
|
||||
|
||||
w.BeginChild("q.list", 0f, 0f, border: true);
|
||||
w.TextDisabled("Done");
|
||||
w.SameLine(50f);
|
||||
w.TextDisabled("Quest");
|
||||
w.SameLine(370f);
|
||||
w.TextDisabled("Ready in");
|
||||
w.SameLine(480f);
|
||||
w.TextDisabled("Solves");
|
||||
|
||||
DateTime now = _c.UtcNow;
|
||||
int start = _questPage * QuestPageSize;
|
||||
for (int i = start; i < rows.Count && i < start + QuestPageSize; i++)
|
||||
{
|
||||
Quest q = rows[i];
|
||||
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;
|
||||
Quest row = q;
|
||||
w.Selectable(Cut(name, 46), "q.r." + q.Flag, false, () => PrintQuest(row), 310f);
|
||||
w.Tooltip(q.Flag);
|
||||
w.SameLine(370f);
|
||||
string status = q.Status(flags, now);
|
||||
if (status == "ready" && done) w.TextColored(UiColors.Green, status);
|
||||
else w.Text(status);
|
||||
string solves = q.SolvesText(flags);
|
||||
if (solves.Length > 0)
|
||||
{
|
||||
w.SameLine(480f);
|
||||
w.Text(solves);
|
||||
}
|
||||
}
|
||||
if (rows.Count == 0) w.TextDisabled("No quests match.");
|
||||
w.EndChild();
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/// <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}";
|
||||
bool timeSorted = _questSort == 4;
|
||||
if (key == _questKey && (!timeSorted || _c.NowMs - _questBuiltMs < 5000)) return _questRows;
|
||||
_questKey = key;
|
||||
_questBuiltMs = _c.NowMs;
|
||||
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
string[] terms = _questSearch.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
_questRows.Clear();
|
||||
foreach (Quest q in _c.Catalog.Quests)
|
||||
{
|
||||
if (_qNew && !q.IsNew) continue;
|
||||
if (_qServer && q.Server.Length == 0) continue;
|
||||
if (_qDone != _qNotDone && q.IsComplete(flags) != _qDone) continue;
|
||||
if (_qRepeatable != _qOneTime && q.IsRepeatable(flags) != _qRepeatable) continue;
|
||||
if (terms.Length > 0)
|
||||
{
|
||||
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;
|
||||
}
|
||||
_questRows.Add(q);
|
||||
}
|
||||
|
||||
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));
|
||||
break;
|
||||
case 2:
|
||||
_questRows.Sort((a, b) => Then(b.IsComplete(flags).CompareTo(a.IsComplete(flags)), a, b));
|
||||
break;
|
||||
case 3:
|
||||
_questRows.Sort((a, b) => Then(a.IsComplete(flags).CompareTo(b.IsComplete(flags)), a, b));
|
||||
break;
|
||||
case 4:
|
||||
_questRows.Sort((a, b) => Then(ReadyKey(a, flags, now).CompareTo(ReadyKey(b, flags, now)), a, b));
|
||||
break;
|
||||
case 5:
|
||||
_questRows.Sort((a, b) => Then(Solves(b, flags).CompareTo(Solves(a, flags)), a, b));
|
||||
break;
|
||||
default:
|
||||
_questRows.Sort(byFlag);
|
||||
break;
|
||||
}
|
||||
return _questRows;
|
||||
|
||||
static int Then(int c, Quest a, Quest b) => c != 0 ? c : string.CompareOrdinal(a.Flag, b.Flag);
|
||||
}
|
||||
|
||||
/// <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 int Solves(Quest q, QuestFlagStore flags) =>
|
||||
flags.TryGet(q.Flag, out QuestFlag f) && q.IsRepeatable(flags) ? f.Solves : 0;
|
||||
}
|
||||
54
Plugins/RynthCore.Plugin.RynthOracle/Views/SocietyTab.cs
Normal file
54
Plugins/RynthCore.Plugin.RynthOracle/Views/SocietyTab.cs
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
// 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>Society: membership, rank, ribbons to the next rank and today, and the society quests.</summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private void DrawSociety(UiWindow w)
|
||||
{
|
||||
CharacterSnapshot c = _c.Character;
|
||||
var s = new SocietyStanding(
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyCelhan),
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyEldweb),
|
||||
c.Int(_c.Host, CharacterSnapshot.IntSocietyRadblo));
|
||||
QuestFlagStore flags = _c.Flags;
|
||||
DateTime now = _c.UtcNow;
|
||||
|
||||
if (!s.IsMember)
|
||||
{
|
||||
w.Text("Not in a society.");
|
||||
}
|
||||
else
|
||||
{
|
||||
w.SeparatorText($"{s.SocietyName}: {s.RankName}");
|
||||
w.ProgressBar(s.RankMax > 0 ? (float)s.Progress / s.RankMax : 1f, -1f, 0f, $"{s.Progress} / {s.RankMax} ribbons");
|
||||
if (s.NextRankName.Length > 0) Field(w, "To " + s.NextRankName, $"{s.RibbonsToNextRank} ribbons", 0f, 130f);
|
||||
else Field(w, "Rank", "Master (the top rank)", 0f, 130f);
|
||||
Field(w, "Today", s.DailyLimit > 0
|
||||
? $"{s.RibbonsToday(flags, now)} / {s.DailyLimit} ribbons"
|
||||
: "no daily limit at Master", 300f, 400f);
|
||||
if (flags.LastReadUtc == DateTime.MinValue)
|
||||
w.TextDisabled("Read your quest flags (Quests tab) for today's ribbons and quest timers.");
|
||||
}
|
||||
|
||||
w.SeparatorText("Quests");
|
||||
foreach (SocietyQuest q in SocietyQuestList.Visible(s))
|
||||
{
|
||||
if (q.IsBlank) { w.Spacing(); continue; }
|
||||
if (q.IsHeading) { w.TextColored(UiColors.Gold, q.Name); continue; }
|
||||
DoneMark(w, q.IsComplete(s, flags, now));
|
||||
w.SameLine(50f);
|
||||
SocietyQuest row = q;
|
||||
string status = q.Status(s, flags, now);
|
||||
w.Selectable(Cut(q.Name, 36), "s.q." + q.Name, false, () => PrintEntry(row.Name, row.Flag, status, row.Hint, row.Url), 250f);
|
||||
w.SameLine(310f);
|
||||
w.TextDisabled(Cut(q.Area, 18));
|
||||
w.SameLine(450f);
|
||||
w.Text(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
104
Plugins/RynthCore.Plugin.RynthOracle/Views/TitlesTab.cs
Normal file
104
Plugins/RynthCore.Plugin.RynthOracle/Views/TitlesTab.cs
Normal file
|
|
@ -0,0 +1,104 @@
|
|||
// Ported from Oracle of Dereth by Advis Eveldan (advis61), MIT. See THIRD_PARTY_NOTICES.md.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RynthCore.Plugin.RynthOracle.Data;
|
||||
using RynthCore.Plugin.RynthOracle.Ui;
|
||||
|
||||
namespace RynthCore.Plugin.RynthOracle.Views;
|
||||
|
||||
/// <summary>
|
||||
/// Titles: every title, which ones you hold (engine API v75, from the server's title events) and
|
||||
/// how to earn the rest; searchable, with held / not held filters.
|
||||
/// </summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private const int TitlePageSize = 40;
|
||||
private string _titleSearch = "";
|
||||
private bool _titleUnavailable, _titleHeld, _titleNotHeld;
|
||||
private int _titlePage;
|
||||
private readonly List<Title> _titleRows = new();
|
||||
private string _titleKey = "\0";
|
||||
|
||||
private void DrawTitles(UiWindow w)
|
||||
{
|
||||
if (_c.TitlesKnown)
|
||||
{
|
||||
int held = 0;
|
||||
foreach (Title t in TitleList.All) if (_c.EarnedTitles.Contains(t.TitleId)) held++;
|
||||
string current = "";
|
||||
foreach (Title t in TitleList.All) if (t.TitleId == (int)_c.CurrentTitle) current = t.Name;
|
||||
w.Text($"You hold {_c.EarnedTitles.Count} titles ({held} of the {TitleList.All.Count} listed).");
|
||||
if (current.Length > 0) { w.SameLine(); w.TextDisabled($"Showing: {current}"); }
|
||||
}
|
||||
else if (_c.Host.HasGetCharacterTitles)
|
||||
w.TextWrapped("The server sends your titles when you log in; this engine hasn't seen them yet for this character. Log out and back in to see which titles you hold.");
|
||||
else
|
||||
w.TextWrapped("Which titles you hold needs RynthCore's engine update (plugin API v75). Below is every title and how to earn it.");
|
||||
|
||||
w.InputText("Search", "t.search", _titleSearch, 64, s => { _titleSearch = s; _titlePage = 0; });
|
||||
if (_c.TitlesKnown)
|
||||
{
|
||||
w.Checkbox("Held", "t.held", _titleHeld, v => { _titleHeld = v; _titlePage = 0; });
|
||||
w.SameLine();
|
||||
w.Checkbox("Not held", "t.notheld", _titleNotHeld, v => { _titleNotHeld = v; _titlePage = 0; });
|
||||
w.SameLine();
|
||||
}
|
||||
w.Checkbox("Include titles no longer available", "t.unavail", _titleUnavailable, v => { _titleUnavailable = v; _titlePage = 0; });
|
||||
|
||||
List<Title> rows = TitleRows();
|
||||
w.Text($"{rows.Count} titles");
|
||||
w.SameLine(160f);
|
||||
_titlePage = Pager(w, "t.page", _titlePage, rows.Count, TitlePageSize, p => _titlePage = p);
|
||||
|
||||
w.BeginChild("t.list", 0f, 0f, border: true);
|
||||
float x = _c.TitlesKnown ? 50f : 0f;
|
||||
if (_c.TitlesKnown) { w.TextDisabled("Held"); w.SameLine(x); }
|
||||
w.TextDisabled("Title");
|
||||
w.SameLine(x + 230f);
|
||||
w.TextDisabled("Where");
|
||||
w.SameLine(x + 470f);
|
||||
w.TextDisabled("Level");
|
||||
int start = _titlePage * TitlePageSize;
|
||||
for (int i = start; i < rows.Count && i < start + TitlePageSize; i++)
|
||||
{
|
||||
Title t = rows[i];
|
||||
Title row = t;
|
||||
bool held = _c.EarnedTitles.Contains(t.TitleId);
|
||||
if (_c.TitlesKnown) { DoneMark(w, held); w.SameLine(x); }
|
||||
w.Selectable(Cut(t.Name, 30), "t.r." + t.Number, false,
|
||||
() => PrintEntry(row.Name, "", _c.TitlesKnown ? (held ? "held" : "not held") : "", row.Hint, row.Url), 220f);
|
||||
w.SameLine(x + 230f);
|
||||
w.TextDisabled(Cut(t.Group, 36));
|
||||
w.SameLine(x + 470f);
|
||||
w.Text(t.Level > 0 ? t.Level.ToString() : "");
|
||||
}
|
||||
if (rows.Count == 0) w.TextDisabled("No titles match.");
|
||||
w.EndChild();
|
||||
}
|
||||
|
||||
private List<Title> TitleRows()
|
||||
{
|
||||
bool filterHeld = _c.TitlesKnown && _titleHeld != _titleNotHeld;
|
||||
string key = $"{_titleSearch}|{_titleUnavailable}|{(filterHeld ? (_titleHeld ? "h" : "n") : "")}|{_c.EarnedTitles.Count}";
|
||||
if (key == _titleKey) return _titleRows;
|
||||
_titleKey = key;
|
||||
string[] terms = _titleSearch.Split(' ', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
|
||||
_titleRows.Clear();
|
||||
foreach (Title t in TitleList.All)
|
||||
{
|
||||
bool held = _c.EarnedTitles.Contains(t.TitleId);
|
||||
if (t.Unavailable && !_titleUnavailable && !held) continue;
|
||||
if (filterHeld && held != _titleHeld) continue;
|
||||
if (terms.Length > 0)
|
||||
{
|
||||
string hay = t.Name + " " + t.Group;
|
||||
bool all = true;
|
||||
foreach (string term in terms)
|
||||
if (hay.IndexOf(term, StringComparison.OrdinalIgnoreCase) < 0) { all = false; break; }
|
||||
if (!all) continue;
|
||||
}
|
||||
_titleRows.Add(t);
|
||||
}
|
||||
return _titleRows;
|
||||
}
|
||||
}
|
||||
93
Plugins/RynthCore.Plugin.RynthOracle/Views/VoidTab.cs
Normal file
93
Plugins/RynthCore.Plugin.RynthOracle/Views/VoidTab.cs
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
// 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>Void: your damage-over-time spells on every target, and the switch for the Void window.</summary>
|
||||
internal sealed partial class OracleView
|
||||
{
|
||||
private void DrawVoid(UiWindow w)
|
||||
{
|
||||
CharacterSnapshot c = _c.Character;
|
||||
bool visible = VoidWindowVisible?.Invoke() ?? false;
|
||||
w.Button(visible ? "Hide the Void window" : "Show the Void window", "v.toggle", () => SetVoidWindow?.Invoke(!visible));
|
||||
w.Tooltip("A small window with your Corrosion, Corruption and Destructive Curse timers on the selected target.");
|
||||
if (!c.VoidMagic.Known)
|
||||
w.TextDisabled("This character hasn't trained Void Magic.");
|
||||
Field(w, "Surge of Destruction", OneText(c, SpellIds.SurgeOfDestruction), 0f, 160f);
|
||||
|
||||
w.SeparatorText("Your spells on targets");
|
||||
if (_c.Void.Dots.Count == 0)
|
||||
{
|
||||
w.TextDisabled("None running. Cast Corrosion, Corruption or Destructive Curse on something.");
|
||||
return;
|
||||
}
|
||||
w.TextDisabled("Target");
|
||||
w.SameLine(230f);
|
||||
w.TextDisabled("Spell");
|
||||
w.SameLine(430f);
|
||||
w.TextDisabled("Left");
|
||||
long now = _c.NowMs;
|
||||
foreach (VoidDot d in _c.Void.Dots)
|
||||
{
|
||||
int s = d.SecondsRemaining(now);
|
||||
if (s <= 0) continue;
|
||||
w.Text(Cut(d.TargetName, 30));
|
||||
w.SameLine(230f);
|
||||
if (d.Destruction) w.TextColored(UiColors.Destruction, d.SpellName);
|
||||
else w.Text(d.SpellName);
|
||||
w.SameLine(430f);
|
||||
w.Text(s + "s");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The Void window (upstream's target view): your Corrosion, Corruption and Destructive Curse
|
||||
/// seconds on the selected target, highlighted when cast with Surge of Destruction up, and the
|
||||
/// surge's own time. Shown by itself for characters with Void Magic (setting).
|
||||
/// </summary>
|
||||
internal sealed class VoidView
|
||||
{
|
||||
private readonly OracleContext _c;
|
||||
|
||||
public VoidView(OracleContext c) => _c = c;
|
||||
|
||||
public void Draw(UiWindow w)
|
||||
{
|
||||
if (!_c.InWorld)
|
||||
{
|
||||
w.TextDisabled("Not in the world.");
|
||||
return;
|
||||
}
|
||||
uint target = _c.Host.GetSelectedItemId();
|
||||
string name = target != 0 && _c.Host.TryGetObjectName(target, out string n) ? n : "";
|
||||
w.Text(name.Length > 0 ? name : "No target selected");
|
||||
|
||||
long now = _c.NowMs;
|
||||
Row(w, "Corrosion", target, name, VoidFamily.Corrosion, now);
|
||||
Row(w, "Corruption", target, name, VoidFamily.Corruption, now);
|
||||
Row(w, "Curse", target, name, VoidFamily.Curse, now);
|
||||
|
||||
double surge = double.MaxValue;
|
||||
foreach (ActiveEnchantment e in _c.Character.Enchantments)
|
||||
if (e.SpellId == SpellIds.SurgeOfDestruction) surge = Math.Min(surge, e.Remaining);
|
||||
w.TextDisabled("Destruction");
|
||||
w.SameLine(100f);
|
||||
if (surge == double.MaxValue) w.Text("-");
|
||||
else w.TextColored(UiColors.Destruction, double.IsPositiveInfinity(surge) ? "on" : $"{(int)Math.Ceiling(surge)}s");
|
||||
}
|
||||
|
||||
private void Row(UiWindow w, string label, uint target, string name, VoidFamily family, long now)
|
||||
{
|
||||
w.TextDisabled(label);
|
||||
w.SameLine(100f);
|
||||
bool destruction = false;
|
||||
int s = target != 0 ? _c.Void.Remaining(target, name, family, now, out destruction) : -1;
|
||||
if (s <= 0) w.Text("-");
|
||||
else if (destruction) w.TextColored(UiColors.Destruction, s + "s");
|
||||
else w.Text(s + "s");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue