RynthServers/Tools/RynthServerPack.Tests/DreamWeaveAbilitiesTests.cs

507 lines
27 KiB
C#

using System;
using RynthCore.Plugin.RynthDreamWeave;
using RynthCore.RynthAiTests.Harness;
namespace RynthServerPack.Tests;
// RynthDreamWeave's class ability point calculator (Plugins\RynthCore.Plugin.RynthDreamWeave\DreamWeave\AbilityPointPrices.cs
// and DreamWeaveAbilityPoints.cs, 2026-11-17): DreamWeave's two price curves as its server computes them
// (ACE-DreamWeave ClassAbilityLumCurve.cs with the PropertyManager defaults), what a budget buys, the curve fitted to
// the server's quote, the "/abilities points" reply (worded as the source of 2026-11-02 writes it) and the grant
// lines, only its own reply hidden, and when its read goes.
internal static class DreamWeaveAbilitiesTests
{
private const int Broadcast = 0x00, Advancement = 0x0D, Tell = 0x03;
private static readonly DateTime Utc = new(2026, 11, 17, 22, 0, 0, DateTimeKind.Utc);
private const string Points = "Points: 12 available, 30 lifetime earned.";
private const string Lum = "Luminance purchases: 5 bought so far; the next point costs 3,051,758 Luminance. Exchange it at the reckoning-stone by the Skillmaster in the Drift Network. Prices rise with each point and there is no cap.";
private const string Xp = "Experience purchases: 2 bought so far; the next point costs 392,000,000,000 experience and you have 1,234,567 unassigned. Prices rise with each point and there is no cap.";
private const string XpLocked = "Experience purchases: unlocked at level 275 (you are 200).";
private const string Off = "Class abilities are not currently enabled on this server.";
public static void Register(Runner r)
{
r.Add("dw abilities: the luminance curve is the server's (1M, x1.25 to the 10th, x1.5 to the 20th, x1.75 after)", LumCurve);
r.Add("dw abilities: the experience curve is the server's (200B, x1.4 each) and stops at long.MaxValue", XpCurve);
r.Add("dw abilities: a range is the unrounded prices summed and rounded once", Ranges);
r.Add("dw abilities: what a budget buys, its cost and what the next point still needs", Affordable);
r.Add("dw abilities: the curve is scaled to a quote it doesn't give, and kept when it does", Fit);
r.Add("dw abilities: the /abilities points reply (unlocked, locked, class abilities off)", Replies);
r.Add("dw abilities: only the reply to its own request is hidden; a typed one shows and is read", OursAndTyped);
r.Add("dw abilities: player chat and a quoted copy are not read", NotRead);
r.Add("dw abilities: a purchase moves its lane on and asks for a read; other grants and learning move only the points", Grants);
r.Add("dw abilities: the read goes once when the page opens, on Read now, only when quiet and in the world", ReadTiming);
r.Add("dw abilities: a request with no reply is given up and said", Missed);
r.Add("dw abilities: the command, the numbers in words and ordinals, and the summary lines", Text);
r.Add("dw abilities: buying with experience: the command, the grant, the refusals, no answer, no read meanwhile", BuyXp);
r.Add("dw abilities: the luminance stone: its answers, what it counted, a purchase through it, one used by hand", Stone);
r.Add("dw abilities: the earning rate (purchases added back, a drop starts again) and the time to the next point", Rates);
r.Add("dw abilities: how the price grows from a point on, and the live prices of 2026-11-17", StageAndLive);
}
private static void LumCurve()
{
AbilityCurve c = AbilityCurve.Luminance;
Check.Eq(c.Cost(0), 0L, "no 0th point");
Check.Eq(c.Cost(1), 1_000_000L, "1st");
Check.Eq(c.Cost(2), 1_250_000L, "2nd = x1.25");
Check.Eq(c.Cost(3), 1_562_500L, "3rd");
Check.Eq(c.Cost(6), 3_051_758L, "6th (3,051,757.8125 rounded)");
Check.Eq(c.Cost(10), 7_450_581L, "10th = 1.25^9");
Check.Eq(c.Cost(11), 11_175_871L, "11th: x1.5 from the 10th");
Check.Eq(c.Cost(20), 429_638_021L, "20th: 1.25^9 * 1.5^10");
Check.Eq(c.Cost(21), 751_866_537L, "21st: x1.75 from the 20th");
Check.Eq(c.Cost(23), 2_302_591_270L, "23rd");
// Seen live on DreamWeave (a client log, 2026-11): "You gain 1 class ability point from spending 16,763,806 Luminance."
Check.Eq(c.Cost(12), 16_763_806L, "12th, as the server charged it");
}
private static void XpCurve()
{
AbilityCurve c = AbilityCurve.Experience;
Check.Eq(c.Cost(1), 200_000_000_000L, "1st");
Check.Eq(c.Cost(2), 280_000_000_000L, "2nd = x1.4 (seen live: \"from spending 280,000,000,000 experience\")");
Check.Eq(c.Cost(3), 392_000_000_000L, "3rd (391,999,999,999.99994 rounded)");
Check.Eq(c.Cost(10), 4_132_209_356_800L, "10th = 1.4^9");
Check.Eq(c.Cost(54), long.MaxValue, "the 54th is past long.MaxValue: it stays there");
Check.Eq(c.CostOfRange(50, 10), long.MaxValue, "a range past it too");
Check.Eq(AbilityCurve.ExperienceMinLevel, 275, "the lane opens at 275");
}
private static void Ranges()
{
AbilityCurve c = AbilityCurve.Luminance;
Check.Eq(c.CostOfRange(5, 0), 0L, "no points, no cost");
Check.Eq(c.CostOfRange(0, 1), 1_000_000L, "one point");
Check.Eq(c.CostOfRange(5, 5), 25_045_872L, "points 6 to 10: 25,045,871.73 rounded once");
long each = 0;
for (int n = 6; n <= 10; n++) each += c.Cost(n);
Check.Eq(each, 25_045_872L, "the same as the rounded prices here");
Check.Eq(c.CostOfRange(0, 23), 5_670_039_471L, "the first 23 points");
}
private static void Affordable()
{
AbilityCurve c = AbilityCurve.Luminance;
int k = c.Affordable(0, 3_000_000, out long spent, out long next, out long need);
Check.Eq(k, 2, "3M buys the 1st and 2nd");
Check.Eq(spent, 2_250_000L, "for 2,250,000");
Check.Eq(next, 1_562_500L, "the 3rd's price");
Check.Eq(need, 812_500L, "the 3rd needs 812,500 more");
k = c.Affordable(0, 2_250_000, out spent, out _, out need);
Check.Eq(k, 2, "exactly enough buys both");
Check.Eq(need, 1_562_500L, "nothing left for the 3rd");
k = c.Affordable(5, 8_904_758, out spent, out _, out need);
Check.Eq(k, 2, "8,904,758 from 5 bought: the 6th and 7th");
Check.Eq(spent, 6_866_455L, "3,051,758 + 3,814,697");
Check.Eq(need, 2_730_069L, "the 8th (4,768,372) less what is left");
k = c.Affordable(0, 0, out spent, out _, out need);
Check.Eq(k, 0, "nothing buys nothing");
Check.Eq(need, 1_000_000L, "the 1st needs all of it");
k = AbilityCurve.Experience.Affordable(0, long.MaxValue - 1, out spent, out _, out need);
Check.True(k > 40 && k < 54, $"the experience lane stops before long.MaxValue ({k})");
Check.True(spent > 0 && spent < long.MaxValue, "and what it spent fits");
}
private static void Fit()
{
AbilityCurve c = AbilityCurve.Luminance;
AbilityCurve same = c.Fit(5, 3_051_758, out bool matches);
Check.True(matches, "the server's own price matches");
Check.Eq(same, c, "and the curve is kept");
AbilityCurve scaled = c.Fit(5, 6_103_516, out matches);
Check.False(matches, "a doubled price doesn't");
Check.Eq(scaled.Cost(6), 6_103_516L, "the scaled curve gives the quote");
Check.Eq(scaled.Cost(1), 2_000_000L, "and doubles the rest");
c.Fit(5, 0, out matches);
Check.True(matches, "no quote: kept");
}
private static DreamWeaveAbilityPoints Asked(out long t)
{
var p = new DreamWeaveAbilityPoints();
t = 1_000_000;
p.Login();
p.CheckSoon();
Check.Eq(p.Due(t, canSend: true, quiet: true), DreamWeaveAbilityPoints.Command, "the read goes");
p.NoteChatBar(); // our own send through the chat bar
return p;
}
private static void Replies()
{
var p = Asked(out long t);
Check.True(p.OnChatText(Points, Broadcast, t + 100, Utc), "points line hidden");
Check.True(p.OnChatText(Lum, Broadcast, t + 110, Utc), "luminance line hidden");
Check.True(p.OnChatText(Xp, Broadcast, t + 120, Utc), "experience line hidden");
Check.Eq(p.Available, 12, "available");
Check.Eq(p.Earned, 30, "earned");
Check.Eq(p.LumBought, 5, "luminance bought");
Check.Eq(p.LumNext, 3_051_758L, "its next price");
Check.True(p.LumMatches, "the published curve gives it");
Check.Eq(p.XpBought, 2, "experience bought");
Check.Eq(p.XpNext, 392_000_000_000L, "its next price");
Check.True(p.XpMatches, "the published curve gives it");
Check.Eq(p.UnassignedXp, 1_234_567L, "unassigned experience from the reply");
Check.Null(p.XpUnlockLevel, "the lane is open");
Check.True(p.HasReading, "a reading");
Check.Eq(p.ReadUtc, Utc, "read now");
Check.False(p.Waiting(t + 130), "the reply is complete");
p = Asked(out t);
p.OnChatText(Points, Broadcast, t + 100, Utc);
p.OnChatText(Lum, Broadcast, t + 110, Utc);
Check.True(p.OnChatText(XpLocked, Broadcast, t + 120, Utc), "the locked line hidden");
Check.Eq(p.XpUnlockLevel, 275, "opens at 275");
Check.Eq(p.Level, 200, "the level from the line");
Check.Eq(p.XpBought, 0, "none bought below it");
Check.Null(p.XpNext, "no quote");
Check.False(p.Waiting(t + 130), "the reply is complete");
p = Asked(out t);
Check.True(p.OnChatText(Off, Broadcast, t + 100, Utc), "the off line hidden");
Check.True(p.Off, "class abilities are off");
Check.False(p.Waiting(t + 110), "and that is the whole reply");
// A timestamped line and one message holding the whole reply.
p = Asked(out t);
Check.True(p.OnChatText("[22:01:05] " + Points + "\n" + Lum + "\r\n" + Xp, Broadcast, t + 100, Utc), "one message, hidden");
Check.Eq(p.LumBought, 5, "read");
Check.Eq(p.XpBought, 2, "read");
// A price the curve doesn't give: scaled to it.
p = Asked(out t);
p.OnChatText("Luminance purchases: 5 bought so far; the next point costs 6,103,516 Luminance. Exchange it.", Broadcast, t + 100, Utc);
Check.False(p.LumMatches, "a changed price is seen");
Check.Eq(p.LumCurve.Cost(6), 6_103_516L, "the lane's curve gives the quote");
}
private static void OursAndTyped()
{
// Typed: the chat bar sees a /abilities points we didn't send.
var p = new DreamWeaveAbilityPoints();
long t = 1_000_000;
p.Login();
p.NoteChatBar();
Check.False(p.OnChatText(Points, Broadcast, t, Utc), "a typed command's reply shows");
Check.False(p.OnChatText(Lum, Broadcast, t + 10, Utc), "all of it");
Check.False(p.OnChatText(Xp, Broadcast, t + 20, Utc), "all of it");
Check.Eq(p.LumBought, 5, "and is read");
// Ours, then the player types one while it is on its way: theirs shows.
p = Asked(out t);
p.NoteChatBar(); // the player's
Check.False(p.OnChatText(Points, Broadcast, t + 100, Utc), "the player's reply shows");
// After our reply, the same lines (a /abilities list ends with Points:) show.
p = Asked(out t);
p.OnChatText(Points + "\n" + Lum + "\n" + Xp, Broadcast, t + 100, Utc);
Check.False(p.OnChatText(Points, Broadcast, t + 500, Utc), "a later Points line shows");
Check.Eq(p.Available, 12, "and is read");
// The window: a reply 5 s late isn't ours.
p = Asked(out t);
Check.False(p.OnChatText(Lum, Broadcast, t + 6_000, Utc), "too late to be ours");
}
private static void NotRead()
{
var p = Asked(out long t);
Check.False(p.OnChatText(Lum, Tell, t + 100, Utc), "a tell isn't read");
Check.Null(p.LumBought, "nothing read");
Check.False(p.OnChatText("Someone says, \"" + Lum + "\"", Broadcast, t + 100, Utc), "a quoted copy isn't read");
Check.Null(p.LumBought, "nothing read");
Check.False(p.OnChatText("You gain 5 class ability points from spending 1 Luminance. Available: 99.", Tell, t + 100, Utc), "a grant in a tell isn't read");
Check.Null(p.Available, "nothing read");
}
private static void Grants()
{
var p = Asked(out long t);
p.OnChatText(Points + "\n" + Lum + "\n" + Xp, Broadcast, t + 100, Utc);
int rev = p.Revision;
Check.False(p.OnChatText("You gain 1 class ability point from spending 3,051,758 Luminance. Available: 13. Use /abilities to spend them.",
Advancement, t + 10_000, Utc), "a grant shows");
Check.Eq(p.LumBought, 6, "the luminance lane moves on");
Check.Null(p.LumNext, "its quote is stale");
Check.Eq(p.Available, 13, "available");
Check.Eq(p.Earned, 31, "earned");
Check.True(p.Wanted, "a read follows");
Check.True(p.Revision != rev, "the page refills");
p = Asked(out t);
p.OnChatText(Points + "\n" + Lum + "\n" + Xp, Broadcast, t + 100, Utc);
p.OnChatText("You gain 2 class ability points from spending 672,000,000,000 experience. Available: 14. Use /abilities to spend them.",
Advancement, t + 10_000, Utc);
Check.Eq(p.XpBought, 4, "the experience lane moves on");
Check.Eq(p.LumBought, 5, "the luminance lane doesn't");
Check.True(p.Wanted, "a read follows");
p = Asked(out t);
p.OnChatText(Points + "\n" + Lum + "\n" + Xp, Broadcast, t + 100, Utc);
p.OnChatText("You gain 1 class ability point from reaching level 300. Available: 13. Use /abilities to spend them.",
Advancement, t + 10_000, Utc);
Check.Eq(p.Available, 13, "a milestone moves the points");
Check.Eq(p.LumBought, 5, "not a lane");
Check.False(p.Wanted, "no read");
p.OnChatText("You have learned Arcane Surge rank 2/5. Points: 10 available, 31 lifetime earned.", Broadcast, t + 20_000, Utc);
Check.Eq(p.Available, 10, "learning moves the points");
Check.Eq(p.Earned, 31, "earned");
// A purchase before any reading: no lane to move.
var q = new DreamWeaveAbilityPoints();
q.Login();
q.OnChatText("You gain 1 class ability point from spending 1,000,000 Luminance. Available: 1. Use /abilities to spend them.", Advancement, t, Utc);
Check.Null(q.LumBought, "unknown stays unknown");
Check.Eq(q.Available, 1, "available");
Check.False(q.Wanted, "no read without the page");
}
private static void ReadTiming()
{
var p = new DreamWeaveAbilityPoints();
long t = 1_000_000;
p.Login();
Check.False(p.Wanted, "nothing at login");
Check.Null(p.Due(t, true, true), "nothing goes");
p.PageOpened();
Check.True(p.Wanted, "the page's first draw wants a read");
Check.Null(p.Due(t, canSend: false, quiet: true), "not outside the world or in portal space");
Check.Null(p.Due(t, canSend: true, quiet: false), "not near another command");
Check.Eq(p.Due(t, true, true), DreamWeaveAbilityPoints.Command, "then it goes");
Check.Null(p.Due(t + 10, true, true), "once");
p.OnChatText(Points + "\n" + Lum + "\n" + Xp, Broadcast, t + 100, Utc);
p.PageOpened();
Check.False(p.Wanted, "the page again: no second read");
p.CheckSoon();
Check.True(p.Wanted, "Read now");
Check.Eq(p.Due(t + 1_000, true, true), DreamWeaveAbilityPoints.Command, "goes");
p.CheckSoon();
Check.Null(p.Due(t + 1_100, true, true), "not while the last one waits for its reply");
p.Logout();
p.Login();
Check.False(p.HasReading, "a new login forgets the reading");
p.PageOpened();
Check.True(p.Wanted, "and reads again when the page opens");
p.Login();
Check.Eq(p.Due(t, true, true), null, "login drops a wanted read");
p.CheckSoon();
p.Due(t, true, true);
p.NotSent();
Check.False(p.Waiting(t), "a send that didn't go isn't waited for");
}
private static void Missed()
{
var p = Asked(out long t);
Check.False(p.Tick(t + 1_000), "still in time");
Check.True(p.Tick(t + 6_000), "given up after 5 s");
Check.True(p.LastMiss.Contains("No reply", StringComparison.Ordinal), "and said");
Check.False(p.Tick(t + 7_000), "once");
p.CheckSoon();
Check.Eq(p.LastMiss, "", "Read now clears it");
}
private static DreamWeaveAbilityPoints ReadIn(out long t)
{
var p = Asked(out t);
p.OnChatText("Points: 0 available, 35 lifetime earned.\n"
+ "Luminance purchases: 16 bought so far; the next point costs 127,300,154 Luminance. Exchange it at the reckoning-stone.\n"
+ "Experience purchases: 3 bought so far; the next point costs 548,800,000,000 experience and you have 600,000,000,000 unassigned. Prices rise.",
Broadcast, t + 100, Utc);
t += 10_000;
return p;
}
private static void BuyXp()
{
var p = ReadIn(out long t);
Check.Eq(p.BuyXp(1, t), "/abilities buyxp 1", "the command");
Check.True(p.Buying(t + 10), "waits for its answer");
Check.Null(p.BuyXp(1, t + 20), "one at a time");
p.CheckSoon();
Check.Null(p.Due(t + 30, true, true), "no read while a purchase waits");
Check.False(p.OnChatText("You gain 1 class ability point from spending 548,800,000,000 experience. Available: 1. Use /abilities to spend them.",
Advancement, t + 500, Utc), "the grant shows");
Check.Eq(p.XpBought, 4, "the lane moves on");
Check.False(p.Buying(t + 600), "answered");
Check.False(p.BuyFailed, "bought");
Check.True(p.BuyMessage.StartsWith("Bought 1 point with experience (548,800,000,000)", StringComparison.Ordinal), p.BuyMessage);
Check.Eq(p.Due(t + 700, true, true), DreamWeaveAbilityPoints.Command, "then the read goes");
p = ReadIn(out t);
Check.Eq(p.BuyXp(5, t), "/abilities buyxp 5", "five at once");
p.OnChatText("Buying 5 points costs 5,000,000,000,000 experience; you have 600,000,000,000 unassigned.", Broadcast, t + 300, Utc);
Check.True(p.BuyFailed, "refused");
Check.True(p.BuyMessage.Contains("Not enough unassigned experience", StringComparison.Ordinal), p.BuyMessage);
Check.False(p.Buying(t + 400), "answered");
Check.Eq(p.XpBought, 3, "nothing bought");
p = ReadIn(out t);
p.BuyXp(1, t);
p.OnChatText("You must be level 275 to exchange experience for class ability points. You are level 200.", Broadcast, t + 300, Utc);
Check.True(p.BuyFailed, "refused below the level");
Check.Eq(p.XpUnlockLevel, 275, "the lane's level");
Check.Eq(p.Level, 200, "yours");
p = ReadIn(out t);
p.BuyXp(1, t);
p.Tick(t + 1_000);
Check.False(p.BuyFailed, "still in time");
p.Tick(t + DreamWeaveAbilityPoints.BuyWindowMs + 1);
Check.True(p.BuyFailed, "no answer is said");
Check.True(p.BuyMessage.Contains("No answer", StringComparison.Ordinal), p.BuyMessage);
Check.False(p.Buying(t + DreamWeaveAbilityPoints.BuyWindowMs + 2), "and given up");
p = ReadIn(out t);
Check.Null(p.BuyXp(0, t), "no points, no command");
p.BuyXp(1, t);
p.BuyNotSent("Couldn't send it.");
Check.False(p.Buying(t + 1), "not waiting for a send that didn't go");
Check.True(p.BuyFailed, "and said");
// A refusal that isn't the answer to the page's purchase (typed by hand) is read but not said.
p = ReadIn(out t);
p.OnChatText("Buying 1 point costs 548,800,000,000 experience; you have 5 unassigned.", Broadcast, t, Utc);
Check.Eq(p.BuyMessage, "", "not said");
Check.Eq(p.UnassignedXp, 5L, "but read");
}
private static void Stone()
{
var p = ReadIn(out long t);
p.SetStone(known: false, near: true);
Check.False(p.StoneNear, "an unknown stone is never near");
p.SetStone(known: true, near: true);
Check.True(p.StoneNear, "known and near");
p.StoneUsed(t);
Check.True(p.Buying(t + 30_000), "the walk and AC's Yes/No take a while");
Check.False(p.OnChatText("Reckoning-Stone of Radiance: this weighs your Luminance and renders it as a class ability point. Each point costs more than the last; the only limit is the price.",
Broadcast, t + 2_000, Utc), "the stone's words show");
Check.True(p.Buying(t + 2_100), "still waiting");
p.OnChatText("Your next point would cost 127,300,154 Luminance; you have 56,700,791 (0 available + 56,700,791 banked).", Broadcast, t + 2_200, Utc);
Check.True(p.BuyFailed, "not enough");
Check.True(p.BuyMessage.Contains("Not enough luminance", StringComparison.Ordinal), p.BuyMessage);
Check.Eq(p.StoneSpendable, 56_700_791L, "what the stone counted");
Check.Eq(p.StoneOnYou, 0L, "on you");
Check.Eq(p.LumNext, 127_300_154L, "its price");
Check.True(p.LumMatches, "the curve's");
p = ReadIn(out t);
p.StoneUsed(t);
p.OnChatText("You gain 1 class ability point from spending 127,300,154 Luminance. Available: 1. Use /abilities to spend them.", Advancement, t + 9_000, Utc);
Check.Eq(p.LumBought, 17, "bought through the stone");
Check.False(p.BuyFailed, "bought");
Check.True(p.BuyMessage.StartsWith("Bought 1 point with luminance (127,300,154)", StringComparison.Ordinal), p.BuyMessage);
Check.False(p.Buying(t + 9_100), "answered");
p = ReadIn(out t);
p.StoneUsed(t);
p.OnChatText("Buying 1 point costs 127,300,154 Luminance; you have 100 (0 available + 100 banked).", Broadcast, t + 9_000, Utc);
Check.True(p.BuyFailed, "a Yes it couldn't honour");
Check.Eq(p.StoneSpendable, 100L, "what it counted");
p = ReadIn(out t);
p.OnChatText("Your next point would cost 127,300,154 Luminance; you have 56,700,791 (5 available + 56,700,786 banked).", Broadcast, t, Utc);
Check.Eq(p.BuyMessage, "", "a stone used by hand: not said");
Check.Eq(p.StoneOnYou, 5L, "but read");
p = ReadIn(out t);
p.StoneUsed(t);
p.Tick(t + DreamWeaveAbilityPoints.StoneWindowMs + 1);
Check.False(p.Buying(t + DreamWeaveAbilityPoints.StoneWindowMs + 2), "a stone use not answered is let go");
Check.False(p.BuyFailed, "quietly: the player may have said No");
}
private static void Rates()
{
var r = new EarnRate();
Check.Null(r.PerHour(1), "nothing yet");
r.Add(0, 1_000);
Check.Null(r.PerHour(1), "one reading");
r.Add(30 * 60_000, 1_600);
Check.Null(r.PerHour(60 * 60_000), "not long enough");
Check.Near(r.PerHour(10 * 60_000) ?? -1, 1_200, 1e-9, "600 in 30 min");
r.Spent(500); // a point bought: the bank drops by 500
r.Add(60 * 60_000, 1_700);
Check.Near(r.PerHour(1) ?? -1, 1_200, 1e-9, "the purchase is added back");
r.Add(70 * 60_000, 100);
Check.Null(r.PerHour(1), "a drop nothing explains starts again");
r.Add(130 * 60_000, 700);
Check.Near(r.PerHour(1) ?? -1, 600, 1e-9, "from there");
r.Clear();
Check.Null(r.PerHour(1), "cleared");
Check.Eq(EarnRate.Time(0, 100), "now", "nothing needed");
Check.Eq(EarnRate.Time(500, 1_000), "about 30 min", "half an hour");
Check.Eq(EarnRate.Time(3_500, 1_000), "about 3.5 h", "hours and a half");
Check.Eq(EarnRate.Time(70_599_363, 1_200_000), "about 59 h", "59 hours");
Check.Eq(EarnRate.Time(100, 1), "about 4 days", "days");
Check.Eq(EarnRate.Time(100, 0), "", "never at nothing an hour");
Check.Eq(EarnRate.Time(1, 1e9), "about 1 min", "at least a minute");
}
private static void StageAndLive()
{
Check.Eq(AbilityText.Stage(AbilityCurve.Luminance, 2), "each point costs x1.25 the last up to the 10th, then x1.5 up to the 20th, then x1.75", "early");
Check.Eq(AbilityText.Stage(AbilityCurve.Luminance, 18), "each point costs x1.5 the last up to the 20th, then x1.75", "middle");
Check.Eq(AbilityText.Stage(AbilityCurve.Luminance, 21), "each point costs x1.75 the last, with no end", "tail");
Check.Eq(AbilityText.Stage(AbilityCurve.Experience, 5), "each point costs x1.4 the last, with no end", "experience");
// DreamWeave's own quotes for one character on 2026-11-17 (/abilities points): 16 bought with luminance, 3 with experience.
Check.Eq(AbilityCurve.Luminance.Cost(17), 127_300_154L, "the 17th luminance point, as quoted");
Check.Eq(AbilityCurve.Experience.Cost(4), 548_800_000_000L, "the 4th experience point, as quoted");
}
private static void Text()
{
Check.True(DreamWeaveAbilityPoints.IsCommand("/abilities points"), "the command");
Check.True(DreamWeaveAbilityPoints.IsCommand(" /Abilities POINTS "), "any case and spacing");
Check.False(DreamWeaveAbilityPoints.IsCommand("/abilities"), "not the list");
Check.False(DreamWeaveAbilityPoints.IsCommand("/abilities buyxp 1"), "not a purchase");
Check.Eq(AbilityText.Ordinal(1), "1st", "1st");
Check.Eq(AbilityText.Ordinal(2), "2nd", "2nd");
Check.Eq(AbilityText.Ordinal(3), "3rd", "3rd");
Check.Eq(AbilityText.Ordinal(4), "4th", "4th");
Check.Eq(AbilityText.Ordinal(11), "11th", "11th");
Check.Eq(AbilityText.Ordinal(12), "12th", "12th");
Check.Eq(AbilityText.Ordinal(13), "13th", "13th");
Check.Eq(AbilityText.Ordinal(21), "21st", "21st");
Check.Eq(AbilityText.Ordinal(112), "112th", "112th");
Check.Eq(AbilityText.Num(3_051_758), "3,051,758", "under a billion: exact only");
Check.Eq(AbilityText.Num(392_000_000_000), "392,000,000,000 (392 billion)", "with words");
Check.Eq(AbilityText.Words(4_132_209_356_800), "4.13 trillion", "two places under ten");
Check.Eq(AbilityText.Words(25_045_871_734), "25 billion", "one place under a hundred, dropped when 0");
Check.Eq(AbilityText.Num(long.MaxValue), "more than 9.2 quintillion", "past the top");
Check.Eq(AbilityText.Lane("Luminance", AbilityCurve.Luminance, 5, 8_904_758, "banked"),
"Luminance: 5 bought; the 6th costs 3,051,758; your 8,904,758 banked buys 2 more (6,866,455), the 8th needs 2,730,069 more",
"the lane's sentence");
Check.Eq(AbilityText.Lane("Experience", AbilityCurve.Experience, 0, 1_000, "unassigned"),
"Experience: 0 bought; the 1st costs 200,000,000,000 (200 billion); your 1,000 unassigned is 199,999,999,000 (200 billion) short of it",
"short of the next");
Check.Eq(AbilityText.Range("Luminance", AbilityCurve.Luminance, 5, 5),
"Luminance: points 6 to 10 cost 25,045,872 in all (3,051,758, 3,814,697, 4,768,372, 5,960,464, 7,450,581)", "a range");
Check.Eq(AbilityText.Range("Luminance", AbilityCurve.Luminance, 0, 1), "Luminance: the 1st point costs 1,000,000", "one point");
var p = Asked(out long t);
Check.Eq(p.Summary(null), "Your class ability points aren't read yet", "before a reading");
p.OnChatText(Points + "\n" + Lum + "\n" + XpLocked, Broadcast, t + 100, Utc);
Check.Eq(p.Summary(8_904_758),
"Class ability points: 12 available, 30 earned. "
+ "Luminance: 5 bought; the 6th costs 3,051,758; your 8,904,758 banked buys 2 more (6,866,455), the 8th needs 2,730,069 more. "
+ "Experience: opens at level 275 (you are 200)", "the summary");
}
}