RynthSuite as of 2026-11-17 (internal d924ac04): release 2026.11.17.1
This commit is contained in:
parent
04add6c51b
commit
88f0aac49a
72 changed files with 7910 additions and 172 deletions
|
|
@ -27,7 +27,7 @@ internal static unsafe class FakeHost
|
|||
|
||||
public static RynthCoreApiNative Build()
|
||||
{
|
||||
var a = new RynthCoreApiNative { Version = 73 };
|
||||
var a = new RynthCoreApiNative { Version = 85 }; // 85: the server prompt answers (AnswerNextPrompt)
|
||||
a.LogFn = (IntPtr)(delegate* unmanaged[Cdecl]<IntPtr, void>)&LogImpl;
|
||||
a.WriteToChatFn = (IntPtr)(delegate* unmanaged[Cdecl]<IntPtr, int, int>)&WriteToChat;
|
||||
a.InvokeChatParserFn = (IntPtr)(delegate* unmanaged[Cdecl]<IntPtr, int>)&InvokeChatParser;
|
||||
|
|
@ -109,6 +109,8 @@ internal static unsafe class FakeHost
|
|||
a.TradeDeclineFn = (IntPtr)(delegate* unmanaged[Cdecl]<int>)&TradeDecline;
|
||||
a.TradeResetFn = (IntPtr)(delegate* unmanaged[Cdecl]<int>)&TradeReset;
|
||||
a.TradeCloseFn = (IntPtr)(delegate* unmanaged[Cdecl]<int>)&TradeClose;
|
||||
a.ArmConfirmationFn = (IntPtr)(delegate* unmanaged[Cdecl]<uint, int, int, int>)&ArmConfirmation;
|
||||
a.GetLastConfirmationFn = (IntPtr)(delegate* unmanaged[Cdecl]<uint*, uint*, int*, int*, int*, int>)&GetLastConfirmation;
|
||||
return a;
|
||||
}
|
||||
|
||||
|
|
@ -127,6 +129,27 @@ internal static unsafe class FakeHost
|
|||
|
||||
// ── Identity ────────────────────────────────────────────────────────────
|
||||
|
||||
// ── The server's yes/no prompts (API v85) ──
|
||||
// The last arm a script made, and the last prompt the "server" sent (the harness sets it).
|
||||
public static uint ArmType;
|
||||
public static int ArmMinPercent, ArmTimeoutMs, ArmCalls;
|
||||
public static int PromptSeq, PromptPercent = -1, PromptOutcome, PromptAgeMs;
|
||||
public static uint PromptType, PromptContext;
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int ArmConfirmation(uint type, int minPercent, int timeoutMs)
|
||||
{
|
||||
ArmType = type; ArmMinPercent = minPercent; ArmTimeoutMs = timeoutMs; ArmCalls++;
|
||||
return 1;
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static int GetLastConfirmation(uint* type, uint* context, int* percent, int* outcome, int* ageMs)
|
||||
{
|
||||
*type = PromptType; *context = PromptContext; *percent = PromptPercent; *outcome = PromptOutcome; *ageMs = PromptAgeMs;
|
||||
return PromptSeq;
|
||||
}
|
||||
|
||||
[UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvCdecl) })]
|
||||
private static uint GetPlayerId() => FakeWorld.Player;
|
||||
|
||||
|
|
|
|||
|
|
@ -84,6 +84,20 @@ internal static class Harness
|
|||
}
|
||||
|
||||
Fn("chat", a => { W.IncomingChat(Str(a, 0), (int)Num(a, 1, 0)); return DynValue.Nil; });
|
||||
// The server prompt answers: what the script armed, and the last prompt the "server" sent.
|
||||
Fn("promptArm", a =>
|
||||
{
|
||||
var t = new Table(s);
|
||||
t["Type"] = (double)FakeHost.ArmType; t["MinPercent"] = (double)FakeHost.ArmMinPercent;
|
||||
t["TimeoutMs"] = (double)FakeHost.ArmTimeoutMs; t["Calls"] = (double)FakeHost.ArmCalls;
|
||||
return DynValue.NewTable(t);
|
||||
});
|
||||
Fn("setLastPrompt", a =>
|
||||
{
|
||||
FakeHost.PromptSeq = (int)Num(a, 0); FakeHost.PromptType = (uint)Num(a, 1); FakeHost.PromptContext = (uint)Num(a, 2);
|
||||
FakeHost.PromptPercent = (int)Num(a, 3, -1); FakeHost.PromptOutcome = (int)Num(a, 4); FakeHost.PromptAgeMs = (int)Num(a, 5);
|
||||
return DynValue.Nil;
|
||||
});
|
||||
Fn("chatInput", a =>
|
||||
{
|
||||
int eat = 0;
|
||||
|
|
|
|||
|
|
@ -23,6 +23,34 @@ eq(Character.BurdenUnits, 1500, "BurdenUnits")
|
|||
eq(Character.MaxBurdenUnits, 200 * 150, "MaxBurdenUnits")
|
||||
eq(Character.IsBusy(), false, "IsBusy()")
|
||||
|
||||
-- the server's yes/no prompts (AnswerNextPrompt / LastPrompt)
|
||||
eq(Character.LastPrompt, nil, "LastPrompt: none this session")
|
||||
eq(Character.AnswerNextPrompt(), true, "AnswerNextPrompt() arms")
|
||||
local arm = harness.promptArm()
|
||||
eq(arm.Type, 7, "default type YESNO")
|
||||
eq(arm.TimeoutMs, 5000, "default 5 s")
|
||||
eq(arm.MinPercent, 0, "default: Yes whatever the percent")
|
||||
eq(Character.AnswerNextPrompt(ClientConfirmationType.CRAFT_INTERACTION, 90000, 70), true, "a craft prompt")
|
||||
arm = harness.promptArm()
|
||||
eq(arm.Type, 5, "CRAFT_INTERACTION")
|
||||
eq(arm.TimeoutMs, 30000, "the timeout is capped at 30 s")
|
||||
eq(arm.MinPercent, 70, "Yes from 70%")
|
||||
eq(Character.AnswerNextPrompt(9), false, "an unknown type is refused")
|
||||
eq(harness.promptArm().Calls, 2, "and not armed")
|
||||
eq(Character.AnswerNextPrompt(7, 0), true, "0 ms disarms")
|
||||
eq(harness.promptArm().TimeoutMs, 0, "disarm sent")
|
||||
harness.setLastPrompt(4, 7, 0x1234, -1, 2, 150)
|
||||
local lp = Character.LastPrompt
|
||||
check(lp ~= nil, "LastPrompt after one")
|
||||
eq(lp.Seq, 4, "LastPrompt.Seq")
|
||||
eq(lp.Type, 7, "LastPrompt.Type")
|
||||
eq(lp.ContextId, 0x1234, "LastPrompt.ContextId")
|
||||
eq(lp.Percent, -1, "LastPrompt.Percent: none in its text")
|
||||
eq(lp.Outcome, "Accepted", "LastPrompt.Outcome")
|
||||
eq(lp.AgeMs, 150, "LastPrompt.AgeMs")
|
||||
harness.setLastPrompt(5, 7, 0, -1, 1, 10)
|
||||
eq(Character.LastPrompt.Outcome, "Shown", "not armed: the client's dialog")
|
||||
|
||||
-- stats the UB way (on the weenie) and with the vital numbering UB uses
|
||||
local vitals = Character.Weenie.Vitals
|
||||
eq(vitals[VitalId.Health].Current, 300, "Health.Current")
|
||||
|
|
|
|||
15
Tools/RynthLua.CompatTests/Scripts/deathline.lua
Normal file
15
Tools/RynthLua.CompatTests/Scripts/deathline.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
-- DreamWeave's death line ("... (Killing blow: N damage. You had H/M health.)") fires OnDeath
|
||||
-- (2026-11-15: a script missed one, the health read having skipped the 0 too).
|
||||
local death
|
||||
game.Character.OnDeath.Add(function(e) death = e end)
|
||||
sleep(700)
|
||||
|
||||
harness.chat("You are fatally punctured by Zefir Knotbinder! (Killing blow: 130 damage. You had 21/346 health.)", ChatMessageType.System)
|
||||
local t = 0
|
||||
while not death and t < 3000 do sleep(20); t = t + 20 end
|
||||
check(death ~= nil, "OnDeath on DreamWeave's killing-blow line")
|
||||
if death then
|
||||
check(death.Text:find("Killing blow", 1, true) ~= nil, "OnDeath.Text is the line")
|
||||
end
|
||||
|
||||
done()
|
||||
Loading…
Reference in a new issue