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
193
Tools/RynthLua.CompatTests/Scripts/actions.lua
Normal file
193
Tools/RynthLua.CompatTests/Scripts/actions.lua
Normal file
|
|
@ -0,0 +1,193 @@
|
|||
-- UB-style game.Actions use: UB's argument order and defaults, ActionOptions, callbacks,
|
||||
-- await, action fields (ActionType, Error), RunAllOrdered, the vendor, trade and salvage
|
||||
-- actions, the WorldObject action methods, and game.ActionQueue.
|
||||
local ids = harness.ids
|
||||
local Actions = game.Actions
|
||||
local me = game.Character.Id
|
||||
|
||||
local function waitUntil(fn, ms)
|
||||
local t = 0
|
||||
while not fn() and t < (ms or 5000) do sleep(20); t = t + 20 end
|
||||
return fn()
|
||||
end
|
||||
|
||||
local function invokedHas(text)
|
||||
for _, line in ipairs(harness.invoked()) do if line == text then return true end end
|
||||
return false
|
||||
end
|
||||
|
||||
local function callsHave(prefix)
|
||||
for _, line in ipairs(harness.calls()) do if line:sub(1, #prefix) == prefix then return true end end
|
||||
return false
|
||||
end
|
||||
|
||||
-- use with await; the action is queued already when the call returns
|
||||
local use = Actions.ObjectUse(ids.Potion)
|
||||
check(use.ActionType == ActionType.Misc, "ObjectUse ActionType == ActionType.Misc")
|
||||
eq(use.ObjectId, ids.Potion, "ObjectUse.ObjectId")
|
||||
check(game.ActionQueue.Contains(use), "ActionQueue.Contains")
|
||||
await(use)
|
||||
check(use.IsFinished and use.Success, "ObjectUse succeeded: " .. tostring(use.ErrorDetails))
|
||||
check(use.Error == ActionError.None, "Error == ActionError.None")
|
||||
eq(harness.stackOf(ids.Potion), 4, "a potion was used")
|
||||
|
||||
-- UB's positional callback: ObjectUse(id, target, options, callback)
|
||||
local cbResult
|
||||
Actions.ObjectUse(ids.Potion, 0, nil, function(a) cbResult = a end)
|
||||
check(waitUntil(function() return cbResult ~= nil end), "callback ran")
|
||||
check(cbResult and cbResult.Success, "callback got the finished action")
|
||||
|
||||
-- action:Await()
|
||||
local sel = Actions.ObjectSelect(ids.Drudge)
|
||||
sel:Await()
|
||||
check(sel.Success, "ObjectSelect")
|
||||
eq(game.World.Selected.Id, ids.Drudge, "selected")
|
||||
|
||||
-- ActionOptions, the UB way
|
||||
local opts = ActionOptions.new()
|
||||
opts.Priority = ActionType.Wield
|
||||
opts.MaxRetryCount = 0
|
||||
opts.TimeoutMilliseconds = 4000
|
||||
local appraise = Actions.ObjectAppraise(ids.Drudge, opts)
|
||||
eq(appraise.Priority, ActionType.Wield, "options Priority used")
|
||||
await(appraise)
|
||||
check(appraise.Success, "ObjectAppraise")
|
||||
check(game.World.Get(ids.Drudge).HasAppraisalData, "appraised")
|
||||
local opts2 = ActionOptions()
|
||||
check(opts2 ~= nil, "ActionOptions() also constructs")
|
||||
|
||||
-- a failure reports UB's error names
|
||||
local bad = await(Actions.ObjectUse(0x7FFFFFF0))
|
||||
check(not bad.Success, "using an unknown object fails")
|
||||
check(bad.Error == ActionError.InvalidSourceObject, "Error == ActionError.InvalidSourceObject, got " .. tostring(bad.Error))
|
||||
|
||||
-- inventory actions with UB's arguments
|
||||
local move = await(Actions.ObjectMove(ids.Tapers, me, 0, true))
|
||||
check(move.Success, "ObjectMove to the main pack: " .. tostring(move.ErrorDetails))
|
||||
check(move.ActionType == ActionType.Inventory, "ObjectMove ActionType == ActionType.Inventory")
|
||||
eq(harness.containerOf(ids.Tapers), me, "tapers moved")
|
||||
local split = await(Actions.ObjectSplit(ids.Pyreals, me, 100))
|
||||
check(split.Success, "ObjectSplit: " .. tostring(split.ErrorDetails))
|
||||
check(split.NewStackObjectId ~= nil and split.NewStackObjectId ~= 0, "ObjectSplit.NewStackObjectId")
|
||||
eq(harness.stackOf(ids.Pyreals), 2400, "source stack shrank")
|
||||
eq(harness.stackOf(split.NewStackObjectId), 100, "new stack of 100")
|
||||
local drop = await(Actions.ObjectDrop(split.NewStackObjectId))
|
||||
check(drop.Success, "ObjectDrop")
|
||||
local give = await(Actions.ObjectGive(ids.ManaStone, ids.OtherPlayer))
|
||||
check(give.Success, "ObjectGive")
|
||||
check(not harness.exists(ids.ManaStone), "given away")
|
||||
local wield = await(Actions.ObjectWield(ids.Sword, EquipMask.MeleeWeapon))
|
||||
check(wield.Success, "ObjectWield with a slot: " .. tostring(wield.ErrorDetails))
|
||||
check(wield.ActionType == ActionType.Wield, "ObjectWield ActionType == ActionType.Wield")
|
||||
eq(harness.wielderOf(ids.Sword), me, "sword wielded")
|
||||
|
||||
-- combat mode and casting
|
||||
local mode = await(Actions.SetCombatMode(CombatMode.Magic))
|
||||
check(mode.Success, "SetCombatMode(CombatMode.Magic)")
|
||||
check(game.Character.CombatMode == CombatMode.Magic, "in magic mode")
|
||||
local cast = await(Actions.CastSpell(4567, ids.Drudge))
|
||||
check(cast.Success, "CastSpell: " .. tostring(cast.ErrorDetails))
|
||||
check(cast.ActionType == ActionType.CastSpell, "CastSpell ActionType")
|
||||
local wandCast = await(Actions.CastEquippedWandSpell(ids.Drudge))
|
||||
check(wandCast.Success, "CastEquippedWandSpell: " .. tostring(wandCast.ErrorDetails))
|
||||
check(callsHave(string.format("UseEquippedItem 0x%08X 0x%08X", ids.Wand, ids.Drudge)), "the wand was used on the target")
|
||||
|
||||
-- chat, tells, sleep, blank, autorun
|
||||
check(await(Actions.InvokeChat("/say hello")).Success, "InvokeChat")
|
||||
check(invokedHas("/say hello"), "InvokeChat line")
|
||||
check(await(Actions.SendTellById(ids.OtherPlayer, "hi there")).Success, "SendTellById")
|
||||
check(invokedHas("/t Friendly Player, hi there"), "SendTellById line")
|
||||
local t0 = clock()
|
||||
check(await(Actions.Sleep(150)).Success, "Sleep action")
|
||||
check(clock() - t0 >= 140, "Sleep waited")
|
||||
check(await(Actions.Blank()).Success, "Blank")
|
||||
check(await(Actions.SetAutorun(true)).Success, "SetAutorun")
|
||||
check(harness.autorun(), "autorun on")
|
||||
|
||||
-- RunAllOrdered
|
||||
local steps = {
|
||||
Actions.ObjectSelect(ids.Crier),
|
||||
Actions.Sleep(50),
|
||||
Actions.ObjectSelect(ids.Lever),
|
||||
}
|
||||
local all = await(Actions.RunAllOrdered(steps))
|
||||
check(all.Success, "RunAllOrdered")
|
||||
eq(game.World.Selected.Id, ids.Lever, "RunAllOrdered ran in order")
|
||||
|
||||
-- salvage with the ust
|
||||
local salvageAdd = await(Actions.SalvageAdd(ids.Tapers))
|
||||
check(salvageAdd.Success, "SalvageAdd: " .. tostring(salvageAdd.ErrorDetails))
|
||||
eq(harness.salvageItems()[1], ids.Tapers, "in the salvage panel")
|
||||
local salvage = await(Actions.Salvage())
|
||||
check(salvage.Success, "Salvage: " .. tostring(salvage.ErrorDetails))
|
||||
check(not harness.exists(ids.Tapers), "salvaged")
|
||||
|
||||
-- the vendor
|
||||
harness.vendor(ids.Shopkeeper)
|
||||
check(waitUntil(function() return game.World.Vendor.IsOpen end), "vendor open")
|
||||
check(await(Actions.VendorAddToBuyList(ids.VendorItemA, 2)).Success, "VendorAddToBuyList")
|
||||
local buy = await(Actions.VendorBuyAll())
|
||||
check(buy.Success, "VendorBuyAll: " .. tostring(buy.ErrorDetails))
|
||||
check(buy.ActionType == ActionType.Vendor, "VendorBuyAll ActionType")
|
||||
check(game.Character.GetFirstInventory("Mana Potion") ~= nil, "bought a Mana Potion")
|
||||
eq(game.Character.GetInventoryCount("Mana Potion"), 2, "bought two")
|
||||
check(await(Actions.VendorAddToSellList(ids.Ust)).Success, "VendorAddToSellList")
|
||||
check(await(Actions.VendorClearSellList()).Success, "VendorClearSellList")
|
||||
check(await(Actions.VendorAddToSellList(ids.Potion)).Success, "VendorAddToSellList again")
|
||||
local sell = await(Actions.VendorSellAll())
|
||||
check(sell.Success, "VendorSellAll: " .. tostring(sell.ErrorDetails))
|
||||
check(not harness.exists(ids.Potion), "sold the potions")
|
||||
check(harness.exists(ids.Ust), "the cleared item wasn't sold")
|
||||
harness.vendor(nil)
|
||||
check(waitUntil(function() return not game.World.Vendor.IsOpen end), "vendor closed")
|
||||
local noVendor = await(Actions.VendorBuyAll())
|
||||
check(noVendor.Error == ActionError.VendorNotOpen, "VendorBuyAll without a vendor: " .. tostring(noVendor.Error))
|
||||
|
||||
-- trade
|
||||
harness.tradeStart(ids.OtherPlayer)
|
||||
check(waitUntil(function() return game.Character.Trade.IsOpen end), "trade open")
|
||||
local add = await(Actions.TradeAdd(ids.Ust))
|
||||
check(add.Success, "TradeAdd: " .. tostring(add.ErrorDetails))
|
||||
eq(game.Character.Trade.YourItemIds[1], ids.Ust, "in the trade window")
|
||||
check(await(Actions.TradeAccept()).Success, "TradeAccept")
|
||||
check(game.Character.Trade.YouAccepted, "accepted")
|
||||
check(await(Actions.TradeDecline()).Success, "TradeDecline")
|
||||
check(await(Actions.TradeReset()).Success, "TradeReset")
|
||||
eq(#game.Character.Trade.YourItemIds, 0, "trade window emptied")
|
||||
check(await(Actions.TradeEnd()).Success, "TradeEnd")
|
||||
check(not game.Character.Trade.IsOpen, "trade ended")
|
||||
|
||||
-- WorldObject action methods
|
||||
local lever = game.World.Get(ids.Lever)
|
||||
check(await(lever:Select()).Success, "wo:Select()")
|
||||
check(await(lever:Use()).Success, "wo:Use()")
|
||||
local cap = game.World.Get(ids.Cap)
|
||||
harness.tradeStart(ids.OtherPlayer)
|
||||
check(waitUntil(function() return game.Character.Trade.IsOpen end), "trade open again")
|
||||
check(await(cap:AddToTrade()).Success, "wo:AddToTrade()")
|
||||
local sword = game.World.Get(ids.Sword)
|
||||
local woSalvage = await(sword:Salvage())
|
||||
check(woSalvage.Success, "wo:Salvage(): " .. tostring(woSalvage.ErrorDetails))
|
||||
check(not harness.exists(ids.Sword), "wo:Salvage() salvaged it")
|
||||
|
||||
-- not available yet: these fail cleanly instead of being missing
|
||||
for _, name in ipairs({ "Login", "Logout", "SkillAdvance", "AttributeAddExperience", "SkillAddExperience",
|
||||
"VitalAddExperience", "FellowCreate", "FellowDisband", "FellowDismiss", "FellowSetLeader", "FellowQuit",
|
||||
"FellowRecruit", "FellowSetOpen", "AllegianceSwear", "AllegianceBreak", "Inscribe" }) do
|
||||
check(type(Actions[name]) == "function", "Actions." .. name .. " exists")
|
||||
end
|
||||
local inscribe = await(Actions.Inscribe(ids.Cap, "mine"))
|
||||
check(not inscribe.Success and inscribe.ErrorDetails:find("engine") ~= nil, "Inscribe fails and says why")
|
||||
|
||||
-- the queue
|
||||
local q1 = Actions.Sleep(300, { Priority = ActionType.Misc })
|
||||
local q2 = Actions.ObjectSelect(ids.Crier, { Priority = ActionType.Inventory })
|
||||
check(game.ActionQueue.Contains(q2), "queued")
|
||||
game.ActionQueue.Remove(q2)
|
||||
check(q2.IsFinished and q2.Error == ActionError.Cancelled, "Remove cancels")
|
||||
await(q1)
|
||||
local n = 0
|
||||
for _, a in ipairs(game.ActionQueue.Queue) do n = n + 1 end
|
||||
eq(n, 0, "queue empty")
|
||||
|
||||
done()
|
||||
172
Tools/RynthLua.CompatTests/Scripts/character.lua
Normal file
172
Tools/RynthLua.CompatTests/Scripts/character.lua
Normal file
|
|
@ -0,0 +1,172 @@
|
|||
-- UB-style game.Character use: identity, stats on the weenie, inventory lists and
|
||||
-- searches, spellbook, enchantments, the character events, and the trade window.
|
||||
local ids = harness.ids
|
||||
local Character = game.Character
|
||||
|
||||
local function waitUntil(fn, ms)
|
||||
local t = 0
|
||||
while not fn() and t < (ms or 3000) do sleep(20); t = t + 20 end
|
||||
return fn()
|
||||
end
|
||||
|
||||
-- identity and simple state
|
||||
eq(Character.Id, harness.player, "Character.Id")
|
||||
eq(game.CharacterId, harness.player, "game.CharacterId")
|
||||
eq(Character.Weenie.Name, "Tester", "Character.Weenie.Name")
|
||||
eq(Character.Weenie:Value(IntId.Level), 100, "level from the weenie")
|
||||
eq(Character.Weenie:Value(Int64Id.TotalExperience), 1000000, "total xp from the weenie")
|
||||
eq(Character.Weenie:Value(StringId.Template), "Adventurer", "template from the weenie")
|
||||
check(Character.CombatMode == CombatMode.NonCombat, "CombatMode == CombatMode.NonCombat")
|
||||
eq(Character.InPortalSpace, false, "InPortalSpace")
|
||||
eq(Character.Vitae, 1, "Vitae")
|
||||
eq(Character.BurdenUnits, 1500, "BurdenUnits")
|
||||
eq(Character.MaxBurdenUnits, 200 * 150, "MaxBurdenUnits")
|
||||
eq(Character.IsBusy(), false, "IsBusy()")
|
||||
|
||||
-- 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")
|
||||
eq(vitals[VitalId.Health].Max, 350, "Health.Max")
|
||||
eq(vitals[VitalId.Stamina].Current, 400, "Stamina.Current")
|
||||
eq(vitals[VitalId.Mana].Current, 250, "Mana.Current")
|
||||
eq(vitals[3].Current, 400, "a hard-coded 3 is Stamina, as in UB")
|
||||
eq(vitals[5].Max, 500, "a hard-coded 5 is Mana, as in UB")
|
||||
local skills = Character.Weenie.Skills
|
||||
eq(skills[SkillId.WarMagic].Current, 430, "WarMagic.Current")
|
||||
eq(skills[SkillId.WarMagic].Base, 380, "WarMagic.Base")
|
||||
check(skills[SkillId.WarMagic].Training == SkillTrainingType.Trained, "WarMagic trained")
|
||||
check(skills[SkillId.Axe].Training == SkillTrainingType.Untrained, "Axe untrained")
|
||||
eq(skills[SkillId.MissleWeapons].Current, 350, "UB's MissleWeapons spelling")
|
||||
eq(Character.Weenie.Attributes[AttributeId.Self].Current, 190, "Self.Current")
|
||||
|
||||
-- inventory as UB lists
|
||||
local inv = Character.Inventory
|
||||
check(#inv >= 8, "Inventory has everything carried")
|
||||
local seen = {}
|
||||
for _, wo in ipairs(inv) do seen[wo.Name] = true end
|
||||
check(seen["Healing Potion"] and seen["Mana Stone"] and seen["Wand of Testing"], "Inventory: packs, side packs and equipment")
|
||||
eq(#Character.Containers, 1, "Containers")
|
||||
eq(Character.Containers[1].Name, "Backpack", "Containers[1]")
|
||||
local eqp = {}
|
||||
for _, wo in ipairs(Character.Equipment) do eqp[wo.Name] = true end
|
||||
check(eqp["Wand of Testing"] and eqp["Leather Cap"], "Equipment")
|
||||
local n = 0
|
||||
for wo in Character.Inventory do n = n + 1 end
|
||||
eq(n, #inv, "for wo in Character.Inventory do")
|
||||
|
||||
-- UB's searches
|
||||
local potions = Character.GetInventory("Potion")
|
||||
eq(#potions, 1, "GetInventory(name)")
|
||||
eq(#Character.GetInventory(ObjectClass.SpellComponent), 1, "GetInventory(ObjectClass)")
|
||||
eq(#Character.GetInventory(function(wo) return wo:Value(IntId.Value) >= 500 end), 2, "GetInventory(function)")
|
||||
eq(Character.GetFirstInventory("Healing Potion").Id, ids.Potion, "GetFirstInventory(name)")
|
||||
check(Character.GetFirstInventory("Nonexistent Thing") == nil, "GetFirstInventory miss")
|
||||
eq(Character.GetInventoryCount("Prismatic Taper"), 100, "GetInventoryCount counts stack sizes")
|
||||
eq(Character.GetInventoryCount(ObjectClass.Money), 2500, "GetInventoryCount(ObjectClass)")
|
||||
eq(Character:GetInventoryCount("Healing Potion"), 5, "colon call form")
|
||||
-- RynthLua's own call forms keep working
|
||||
eq(#Character.Inventory("Potion"), 1, "Inventory(filter) still works")
|
||||
eq(Character.InventoryCount("Prismatic Taper"), 100, "InventoryCount still works")
|
||||
|
||||
-- spellbook
|
||||
local known = Character.SpellBook.KnownSpellsIds
|
||||
eq(#known, 4, "SpellBook.KnownSpellsIds")
|
||||
check(Character.SpellBook.IsKnown(2345), "SpellBook.IsKnown")
|
||||
check(not Character.SpellBook.IsKnown(9999), "SpellBook.IsKnown false")
|
||||
eq(Character.SpellBook.Count, 4, "SpellBook.Count")
|
||||
|
||||
-- enchantments
|
||||
local active = Character.ActiveEnchantments()
|
||||
eq(#active, 2, "ActiveEnchantments()")
|
||||
local byId = {}
|
||||
for _, e in ipairs(active) do byId[e.SpellId] = e end
|
||||
check(byId[3456] ~= nil and byId[3456].ExpiresAt ~= nil, "enchantment 3456 has ExpiresAt")
|
||||
check(byId[5000] ~= nil, "permanent enchantment 5000")
|
||||
eq(#Character.AllEnchantments(), 2, "AllEnchantments()")
|
||||
|
||||
-- events
|
||||
local vital, ench, level, xp, lum, vitae, death
|
||||
local portalIn, portalOut = false, false
|
||||
Character.OnVitalChanged.Add(function(e) if e.Type == VitalId.Stamina then vital = e end end)
|
||||
Character.OnEnchantmentsChanged.Add(function(e) ench = e end)
|
||||
Character.OnLevelChanged.Add(function(e) level = e end)
|
||||
Character.OnTotalExperienceChanged.Add(function(e) xp = e end)
|
||||
Character.OnAvailableLuminanceChanged.Add(function(e) lum = e end)
|
||||
Character.OnVitaeChanged.Add(function(e) vitae = e end)
|
||||
Character.OnPortalSpaceEntered.Add(function() portalIn = true end)
|
||||
Character.OnPortalSpaceExited.Add(function() portalOut = true end)
|
||||
Character.OnDeath.Add(function(e) death = e end)
|
||||
sleep(700) -- the slow polls take their baseline
|
||||
|
||||
harness.vitals({ Stamina = 350 })
|
||||
check(waitUntil(function() return vital ~= nil end), "OnVitalChanged")
|
||||
if vital then
|
||||
eq(vital.Value, 350, "OnVitalChanged.Value")
|
||||
eq(vital.OldValue, 400, "OnVitalChanged.OldValue")
|
||||
end
|
||||
|
||||
harness.enchant(7777, 1800)
|
||||
check(waitUntil(function() return ench ~= nil end), "OnEnchantmentsChanged")
|
||||
if ench then
|
||||
check(ench.Type == AddRemoveEventType.Added, "OnEnchantmentsChanged.Type Added")
|
||||
eq(ench.Enchantment.SpellId, 7777, "Enchantment.SpellId")
|
||||
eq(ench.LayeredSpellId.Id, 7777, "LayeredSpellId.Id")
|
||||
end
|
||||
ench = nil
|
||||
harness.dispel(7777)
|
||||
check(waitUntil(function() return ench ~= nil end), "OnEnchantmentsChanged removed")
|
||||
if ench then check(ench.Type == AddRemoveEventType.Removed, "OnEnchantmentsChanged.Type Removed") end
|
||||
|
||||
harness.level(101)
|
||||
harness.xp(1200000)
|
||||
harness.luminance(6000)
|
||||
harness.vitae(0.95)
|
||||
check(waitUntil(function() return level and xp and lum and vitae end), "level/xp/luminance/vitae events")
|
||||
if level then eq(level.Level, 101, "Level"); eq(level.OldLevel, 100, "OldLevel") end
|
||||
if xp then eq(xp.TotalExperience, 1200000, "TotalExperience"); eq(xp.OldTotalExperience, 1000000, "OldTotalExperience") end
|
||||
if lum then eq(lum.AvailableLuminance, 6000, "AvailableLuminance"); eq(lum.OldAvailableLuminance, 5000, "OldAvailableLuminance") end
|
||||
if vitae then check(math.abs(vitae.Vitae - 0.95) < 0.001, "Vitae") end
|
||||
|
||||
harness.portal(true)
|
||||
check(waitUntil(function() return portalIn end), "OnPortalSpaceEntered")
|
||||
harness.portal(false)
|
||||
check(waitUntil(function() return portalOut end), "OnPortalSpaceExited")
|
||||
|
||||
harness.chat("You have been killed by a Drudge Skulker!", ChatMessageType.System)
|
||||
check(waitUntil(function() return death ~= nil end), "OnDeath")
|
||||
if death then
|
||||
check(death.Text:find("killed") ~= nil, "OnDeath.Text")
|
||||
eq(death.KillerId, 0, "OnDeath.KillerId (unknown: 0)")
|
||||
end
|
||||
|
||||
-- the trade window
|
||||
local Trade = Character.Trade
|
||||
check(not Trade.IsOpen, "no trade open")
|
||||
local started, added, accepted, completed, ended
|
||||
Trade.OnStarted.Add(function(e) started = e end)
|
||||
Trade.OnObjectAdded.Add(function(e) added = e end)
|
||||
Trade.OnAccepted.Add(function(e) accepted = e end)
|
||||
Trade.OnCompleted.Add(function(e) completed = e end)
|
||||
Trade.OnEnded.Add(function(e) ended = e end)
|
||||
harness.tradeStart(ids.OtherPlayer)
|
||||
check(waitUntil(function() return started ~= nil end), "Trade.OnStarted")
|
||||
if started then eq(started.PartnerId, ids.OtherPlayer, "OnStarted.PartnerId") end
|
||||
check(Trade.IsOpen, "Trade.IsOpen")
|
||||
eq(Trade.PartnerId, ids.OtherPlayer, "Trade.PartnerId")
|
||||
harness.partnerAdd(ids.ChestGem)
|
||||
check(waitUntil(function() return added ~= nil end), "Trade.OnObjectAdded")
|
||||
if added then
|
||||
eq(added.ObjectId, ids.ChestGem, "OnObjectAdded.ObjectId")
|
||||
check(added.Side == TradeSide.Partner, "OnObjectAdded.Side")
|
||||
end
|
||||
eq(Trade.PartnerItemIds[1], ids.ChestGem, "Trade.PartnerItemIds")
|
||||
harness.partnerAccept()
|
||||
check(waitUntil(function() return accepted ~= nil end), "Trade.OnAccepted")
|
||||
if accepted then eq(accepted.AcceptorId, ids.OtherPlayer, "OnAccepted.AcceptorId") end
|
||||
check(Trade.PartnerAccepted, "Trade.PartnerAccepted")
|
||||
harness.tradeComplete()
|
||||
check(waitUntil(function() return completed ~= nil and ended ~= nil end), "Trade.OnCompleted and OnEnded")
|
||||
if completed then eq(completed.PartnerItemIds[1], ids.ChestGem, "OnCompleted.PartnerItemIds") end
|
||||
check(not Trade.IsOpen, "trade closed")
|
||||
|
||||
done()
|
||||
82
Tools/RynthLua.CompatTests/Scripts/enums.lua
Normal file
82
Tools/RynthLua.CompatTests/Scripts/enums.lua
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
-- UB-style use of the enum globals (UtilityBelt.Common.Enums and the scripting enums).
|
||||
-- Written the way UB scripts use them: comparisons against fields, flag helpers,
|
||||
-- ToNumber(), tostring() for display, and the property-id enums passed to wo:Value().
|
||||
|
||||
-- Globals UB scripts expect to exist
|
||||
for _, name in ipairs({ "ObjectClass", "ObjectType", "SkillId", "AttributeId", "VitalId", "CombatMode",
|
||||
"IntId", "Int64Id", "FloatId", "StringId", "BoolId", "DataId", "InstanceId", "EquipMask",
|
||||
"ChatMessageType", "ChatChannel", "SkillTrainingType", "MagicSchool", "ClientState", "DistanceType",
|
||||
"AddRemoveEventType", "ActionError", "ActionType", "UseActionType", "CoverageMask", "ClientCapability",
|
||||
"TradeSide", "CharacterOptions1", "MaterialType", "DamageType", "CreatureType", "WeenieError" }) do
|
||||
check(_G[name] ~= nil, "global enum " .. name)
|
||||
end
|
||||
|
||||
-- Values that match UB's numbering
|
||||
eq(ObjectClass.Monster, 5, "ObjectClass.Monster")
|
||||
eq(ObjectClass.NumObjectClasses, 43, "ObjectClass.NumObjectClasses")
|
||||
eq(SkillId.MeleeDefense, 6, "SkillId.MeleeDefense")
|
||||
eq(SkillId.MissleWeapons, 47, "SkillId.MissleWeapons (UB's spelling)")
|
||||
eq(SkillId.ThrownWeapons, 12, "SkillId.ThrownWeapons")
|
||||
eq(SkillId.ArmorRepair, 26, "SkillId.ArmorRepair")
|
||||
eq(SkillId.Undef, 0, "SkillId.Undef")
|
||||
eq(AttributeId.Undef, 0, "AttributeId.Undef")
|
||||
eq(VitalId.Health, 1, "VitalId.Health")
|
||||
eq(VitalId.Stamina, 3, "VitalId.Stamina (UB numbering)")
|
||||
eq(VitalId.Mana, 5, "VitalId.Mana (UB numbering)")
|
||||
eq(CombatMode.Magic, 8, "CombatMode.Magic")
|
||||
eq(CombatMode.Invalid, 153, "CombatMode.Invalid")
|
||||
eq(EquipMask.Head, 1, "EquipMask.Head")
|
||||
eq(EquipMask.MeleeWeapon, 1048576, "EquipMask.MeleeWeapon")
|
||||
eq(ChatMessageType.Tell, 3, "ChatMessageType.Tell")
|
||||
eq(ChatMessageType.Fellowship, 19, "ChatMessageType.Fellowship")
|
||||
eq(ChatChannel.General, 2, "ChatChannel.General")
|
||||
eq(SkillTrainingType.Specialized, 3, "SkillTrainingType.Specialized")
|
||||
eq(MagicSchool.WarMagic, 1, "MagicSchool.WarMagic")
|
||||
eq(DistanceType.T2D, 0, "DistanceType.T2D")
|
||||
eq(AddRemoveEventType.Removed, 1, "AddRemoveEventType.Removed")
|
||||
eq(ActionType.Inventory, 9000, "ActionType.Inventory")
|
||||
eq(IntId.Value, 19, "IntId.Value")
|
||||
eq(IntId.MerchandiseObjectTypes, 74, "IntId.MerchandiseObjectTypes (UB name)")
|
||||
eq(UseActionType.SummonPortal, 2, "UseActionType.SummonPortal")
|
||||
eq(TradeSide.Partner, 2, "TradeSide.Partner")
|
||||
eq(MaterialType.Steel, 64, "MaterialType.Steel")
|
||||
eq(DamageType.Fire, 16, "DamageType.Fire")
|
||||
|
||||
-- ToNumber() on any enum value, as UB scripts do before arithmetic
|
||||
eq(SkillId.Axe:ToNumber(), 1, "SkillId.Axe:ToNumber()")
|
||||
eq(CombatMode.Melee:ToNumber() + 1, 3, "CombatMode.Melee:ToNumber() + 1")
|
||||
eq(StringId.Name:ToNumber(), 1, "StringId.Name:ToNumber()")
|
||||
eq(ObjectType.Creature:ToNumber(), 16, "ObjectType.Creature:ToNumber()")
|
||||
|
||||
-- tostring() of the typed enums gives the name (UB prints enum values by name)
|
||||
eq(tostring(StringId.Name), "Name", "tostring(StringId.Name)")
|
||||
eq(tostring(FloatId.WeaponLength), "WeaponLength", "tostring(FloatId.WeaponLength)")
|
||||
eq(tostring(ObjectType.Creature), "Creature", "tostring(ObjectType.Creature)")
|
||||
|
||||
-- Flag helpers on flag enums
|
||||
local both = ObjectType.Creature:AddFlags(ObjectType.Misc)
|
||||
check(both:HasFlags(ObjectType.Creature), "AddFlags/HasFlags Creature")
|
||||
check(both:HasFlags(ObjectType.Misc), "AddFlags/HasFlags Misc")
|
||||
check(not both:HasFlags(ObjectType.Portal), "HasFlags Portal is false")
|
||||
eq(both:ToNumber(), 16 + 128, "combined flags value")
|
||||
local back = both:RemoveFlags(ObjectType.Misc)
|
||||
check(back == ObjectType.Creature, "RemoveFlags gives the same enum value back")
|
||||
check(EquipMask.Head:HasFlags(EquipMask.Head), "HasFlags on a numeric flag enum")
|
||||
|
||||
-- Typed enums compare with each other, not with plain numbers (UB userdata behaves so too)
|
||||
check(StringId.Name == StringId.Name, "same typed value is equal")
|
||||
check(StringId.Name ~= StringId.Title, "different typed values differ")
|
||||
check(FloatId.WeaponLength < FloatId.DamageMod, "typed values order by number")
|
||||
|
||||
-- Reverse lookup of a number to its name (RynthLua's way; UB uses tostring)
|
||||
eq(SkillId[6], "MeleeDefense", "SkillId[6]")
|
||||
eq(ObjectClass[5], "Monster", "ObjectClass[5]")
|
||||
|
||||
-- ClientState: UB compares game.State and OnStateChanged.NewState against it
|
||||
check(game.State == ClientState.In_Game, "game.State == ClientState.In_Game")
|
||||
check(ClientState.Character_Select_Screen ~= ClientState.In_Game, "ClientState values differ")
|
||||
|
||||
-- ActionError compares with the action's Error
|
||||
eq(ActionError.TooBusy, ActionError.TooBusy, "ActionError.TooBusy")
|
||||
|
||||
done()
|
||||
93
Tools/RynthLua.CompatTests/Scripts/events.lua
Normal file
93
Tools/RynthLua.CompatTests/Scripts/events.lua
Normal file
|
|
@ -0,0 +1,93 @@
|
|||
-- UB-style event handling: Add/Once/Until/Remove in either case and call style, handlers
|
||||
-- that sleep, several handlers on one event, errors that don't unsubscribe, event args
|
||||
-- that can be written to (Eat), and the game-level events.
|
||||
|
||||
local function waitUntil(fn, ms)
|
||||
local t = 0
|
||||
while not fn() and t < (ms or 3000) do sleep(20); t = t + 20 end
|
||||
return fn()
|
||||
end
|
||||
|
||||
local chat = game.World.OnChatText
|
||||
|
||||
-- Add, in UB's call styles
|
||||
local a, b, c = 0, 0, 0
|
||||
local fa = function(e) a = a + 1 end
|
||||
chat.Add(fa)
|
||||
chat:Add(function(e) b = b + 1 end)
|
||||
chat.add(function(e) c = c + 1 end) -- lower-case verb
|
||||
harness.chat("one", 0)
|
||||
check(waitUntil(function() return a == 1 and b == 1 and c == 1 end), "Add / :Add / add all fire")
|
||||
|
||||
-- Remove (both cases)
|
||||
chat.Remove(fa)
|
||||
harness.chat("two", 0)
|
||||
check(waitUntil(function() return b == 2 and c == 2 end), "others still fire")
|
||||
eq(a, 1, "Remove(fn) unsubscribed")
|
||||
|
||||
-- Once
|
||||
local once = 0
|
||||
chat.Once(function(e) once = once + 1 end)
|
||||
local once2 = 0
|
||||
chat.once(function(e) once2 = once2 + 1 end)
|
||||
harness.chat("three", 0)
|
||||
harness.chat("four", 0)
|
||||
check(waitUntil(function() return c == 4 end), "lines delivered")
|
||||
eq(once, 1, "Once fires once")
|
||||
eq(once2, 1, "once fires once")
|
||||
|
||||
-- Until: kept until the handler returns true
|
||||
local seen = {}
|
||||
chat.Until(function(e)
|
||||
seen[#seen + 1] = e.Message
|
||||
return e.Message == "stop"
|
||||
end)
|
||||
harness.chat("go", 0)
|
||||
harness.chat("stop", 0)
|
||||
harness.chat("after", 0)
|
||||
check(waitUntil(function() return c == 7 end), "lines delivered again")
|
||||
eq(#seen, 2, "Until stopped after returning true")
|
||||
eq(seen[2], "stop", "Until saw the stopping line")
|
||||
|
||||
-- handlers can sleep and still see their own args
|
||||
local slept
|
||||
chat.Add(function(e)
|
||||
local msg = e.Message
|
||||
sleep(100)
|
||||
if msg == "sleepy" then slept = e.Message end
|
||||
end)
|
||||
harness.chat("sleepy", 0)
|
||||
check(waitUntil(function() return slept == "sleepy" end), "a handler that sleeps keeps its args")
|
||||
|
||||
-- args are writable (UB scripts set e.Eat)
|
||||
local wrote
|
||||
chat.Add(function(e) e.Eat = true; wrote = e.Eat end)
|
||||
harness.chat("eat me", 0)
|
||||
check(waitUntil(function() return wrote == true end), "e.Eat can be set")
|
||||
|
||||
-- an error in a handler is reported but the handler stays subscribed
|
||||
local calls = 0
|
||||
game.World.OnTell.Add(function(e)
|
||||
calls = calls + 1
|
||||
if calls == 1 then error("first tell fails (expected)") end
|
||||
end)
|
||||
harness.chat('Friendly Player tells you, "one"', ChatMessageType.Tell)
|
||||
harness.chat('Friendly Player tells you, "two"', ChatMessageType.Tell)
|
||||
check(waitUntil(function() return calls == 2 end), "handler still subscribed after an error")
|
||||
|
||||
-- game-level events
|
||||
local ticks = 0
|
||||
local tick = function() ticks = ticks + 1 end
|
||||
game.OnTick.Add(tick)
|
||||
check(waitUntil(function() return ticks >= 3 end), "game.OnTick")
|
||||
game.OnTick.Remove(tick)
|
||||
local frozen = ticks
|
||||
sleep(100)
|
||||
eq(ticks, frozen, "game.OnTick removed")
|
||||
check(game.OnStateChanged ~= nil and game.OnScriptEnd ~= nil, "game.OnStateChanged / OnScriptEnd exist")
|
||||
game.OnScriptEnd.Add(function() end)
|
||||
|
||||
-- tostring of an event
|
||||
check(tostring(chat):find("OnChatText") ~= nil, "tostring(event)")
|
||||
|
||||
done()
|
||||
35
Tools/RynthLua.CompatTests/Scripts/game.lua
Normal file
35
Tools/RynthLua.CompatTests/Scripts/game.lua
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
-- UB-style use of the game root: state, identity, capabilities, and a script command
|
||||
-- (RynthLua's RegisterCommand, next to UB's OnChatInput way in world.lua).
|
||||
check(game ~= nil, "game global")
|
||||
check(game.State == ClientState.In_Game, "game.State == ClientState.In_Game")
|
||||
eq(game.ServerName, "TestServer", "game.ServerName")
|
||||
eq(game.AccountName, "testaccount", "game.AccountName")
|
||||
eq(game.CharacterId, harness.player, "game.CharacterId")
|
||||
check(type(game.LastTick) == "number", "game.LastTick")
|
||||
check(game.World ~= nil and game.Character ~= nil and game.Actions ~= nil and game.ActionQueue ~= nil, "game's parts")
|
||||
check(game.OnTick ~= nil and game.OnStateChanged ~= nil and game.OnScriptEnd ~= nil, "game events")
|
||||
|
||||
-- capabilities (UB: game.Capabilities.Has(ClientCapability.ImGui))
|
||||
check(game.Capabilities ~= nil, "game.Capabilities")
|
||||
check(type(game.Capabilities.Has(ClientCapability.ImGui)) == "boolean", "Capabilities.Has")
|
||||
check(type(game.Capabilities.Get()) == "number", "Capabilities.Get")
|
||||
|
||||
-- a quick look at the world through game
|
||||
eq(game.Character.Weenie.Name, "Tester", "character name")
|
||||
eq(game.World.Get(harness.ids.Drudge).Name, "Drudge Skulker", "drudge")
|
||||
local a = await(game.Actions.ObjectUse(harness.ids.Potion))
|
||||
check(a.Success, "use a potion: " .. tostring(a.ErrorDetails))
|
||||
|
||||
-- script commands
|
||||
local got
|
||||
game.RegisterCommand("/testcmd", function(args) got = args end)
|
||||
check(harness.chatInput("/testcmd hello world"), "a registered command is eaten")
|
||||
local t = 0
|
||||
while got == nil and t < 2000 do sleep(20); t = t + 20 end
|
||||
eq(got, "hello world", "the command got its arguments")
|
||||
game.UnregisterCommand("/testcmd")
|
||||
check(not harness.chatInput("/testcmd again"), "unregistered")
|
||||
|
||||
-- the script's own name
|
||||
eq(game.ScriptName, "game", "game.ScriptName")
|
||||
done()
|
||||
64
Tools/RynthLua.CompatTests/Scripts/json.lua
Normal file
64
Tools/RynthLua.CompatTests/Scripts/json.lua
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
-- UB-style JSON: the require'd module and the global, the names UB's interpreter ships
|
||||
-- (parse / serialize / null / isnull) and the rxi-style encode / decode many UB scripts
|
||||
-- bundle.
|
||||
local json = require("json")
|
||||
check(json ~= nil, "require('json')")
|
||||
check(_G.json ~= nil, "global json")
|
||||
|
||||
-- rxi-style round trip
|
||||
local data = {
|
||||
name = "Tester",
|
||||
level = 100,
|
||||
ratio = 0.25,
|
||||
alive = true,
|
||||
tags = { "one", "two", "three" },
|
||||
nested = { deep = { deeper = { 1, 2, 3 } } },
|
||||
unicode = "Élan – “quotes” ✓",
|
||||
}
|
||||
local text = json.encode(data)
|
||||
check(type(text) == "string", "encode gives text")
|
||||
local back = json.decode(text)
|
||||
eq(back.name, "Tester", "string")
|
||||
eq(back.level, 100, "integer")
|
||||
eq(back.ratio, 0.25, "fraction")
|
||||
eq(back.alive, true, "boolean")
|
||||
eq(#back.tags, 3, "array length")
|
||||
eq(back.tags[2], "two", "array order")
|
||||
eq(back.nested.deep.deeper[3], 3, "nested")
|
||||
eq(back.unicode, data.unicode, "unicode text survives")
|
||||
eq(json.encode({}), "[]", "empty table is an array")
|
||||
eq(json.encode({ 1, 2, 3 }), "[1,2,3]", "array text")
|
||||
eq(json.encode(12), "12", "whole numbers without .0")
|
||||
|
||||
-- UB interpreter's names
|
||||
local parsed = json.parse('{"a": 1, "b": null, "list": [1, null, 3]}')
|
||||
eq(parsed.a, 1, "parse")
|
||||
check(json.isnull(parsed.b), "parse keeps null as json.null()")
|
||||
check(parsed.b == json.null(), "json.null() is one value")
|
||||
eq(#parsed.list, 3, "arrays keep their null holes")
|
||||
check(json.isnull(parsed.list[2]), "null in an array")
|
||||
check(json.isnull(nil), "isnull(nil)")
|
||||
check(not json.isnull(0), "isnull(0) is false")
|
||||
eq(json.serialize({ x = json.null() }), '{"x":null}', "json.null() serializes as null")
|
||||
eq(tostring(json.null()), "null", "tostring(json.null())")
|
||||
local dec = json.decode('{"a": null, "b": 2}')
|
||||
eq(dec.a, nil, "decode turns null into nil")
|
||||
eq(dec.b, 2, "decode keeps the rest")
|
||||
|
||||
-- API values encode sensibly
|
||||
local sword = game.World.Get(harness.ids.Sword)
|
||||
eq(json.encode({ item = sword }), '{"item":' .. harness.ids.Sword .. '}', "a WorldObject encodes as its id")
|
||||
eq(json.encode({ key = StringId.Name }), '{"key":1}', "a typed enum value encodes as its number")
|
||||
eq(json.encode({ skill = SkillId.WarMagic }), '{"skill":34}', "a numeric enum value is a number")
|
||||
|
||||
-- errors say what's wrong
|
||||
local ok, err = pcall(json.decode, "{not json")
|
||||
check(not ok and tostring(err):find("not valid JSON") ~= nil, "bad JSON is an error")
|
||||
local cyc = {}
|
||||
cyc.self = cyc
|
||||
local ok2, err2 = pcall(json.encode, cyc)
|
||||
check(not ok2 and tostring(err2):find("contains itself") ~= nil, "a cycle is an error")
|
||||
local ok3 = pcall(json.encode, { f = function() end })
|
||||
check(not ok3, "a function can't be encoded")
|
||||
|
||||
done()
|
||||
60
Tools/RynthLua.CompatTests/Scripts/storage.lua
Normal file
60
Tools/RynthLua.CompatTests/Scripts/storage.lua
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
-- storage: RynthLua's saved values (UB has no storage module; UB scripts write their own
|
||||
-- JSON through filesystem, which this also checks against).
|
||||
local storage = require("storage")
|
||||
local json = require("json")
|
||||
local fs = require("filesystem").GetData()
|
||||
|
||||
storage.Clear()
|
||||
eq(#storage.Keys(), 0, "starts empty")
|
||||
eq(storage.Get("missing"), nil, "missing is nil")
|
||||
eq(storage.Get("missing", 42), 42, "missing with a default")
|
||||
|
||||
storage.Set("count", 3)
|
||||
storage.Set("name", "Tester")
|
||||
storage.Set("flags", { a = true, list = { 1, 2, 3 } })
|
||||
storage.Set("skill", SkillId.WarMagic)
|
||||
storage.Set("typed", StringId.Name)
|
||||
eq(storage.Get("count"), 3, "number")
|
||||
eq(storage.Get("name"), "Tester", "string")
|
||||
eq(storage.Get("flags").list[3], 3, "table")
|
||||
eq(storage.Get("skill"), 34, "numeric enum stored as its number")
|
||||
eq(storage.Get("typed"), 1, "typed enum stored as its number")
|
||||
check(storage.Has("name"), "Has")
|
||||
local keys = storage.Keys()
|
||||
eq(#keys, 5, "Keys")
|
||||
eq(keys[1], "count", "Keys are sorted")
|
||||
|
||||
-- values are copies
|
||||
local t = storage.Get("flags")
|
||||
t.a = false
|
||||
eq(storage.Get("flags").a, true, "Get returns a copy")
|
||||
|
||||
check(storage.Remove("count"), "Remove says it was there")
|
||||
check(not storage.Has("count"), "removed")
|
||||
storage.Set("name", nil)
|
||||
check(not storage.Has("name"), "Set(nil) removes")
|
||||
|
||||
-- written to the script's data folder as JSON
|
||||
storage.Save()
|
||||
local text, err = fs.ReadText("storage.json")
|
||||
check(text ~= nil, "storage.json written: " .. tostring(err))
|
||||
if text then
|
||||
local onDisk = json.decode(text)
|
||||
eq(onDisk.skill, 34, "on disk")
|
||||
end
|
||||
|
||||
-- per character
|
||||
storage.Character.Set("seen", true)
|
||||
eq(storage.Character.Get("seen"), true, "storage.Character")
|
||||
check(not storage.Has("seen"), "character values are separate")
|
||||
|
||||
-- the UB way: a script's own JSON file through filesystem
|
||||
local ok, werr = fs.WriteText("settings.json", json.encode({ enabled = true, range = 30 }))
|
||||
check(ok, "WriteText: " .. tostring(werr))
|
||||
local saved = json.decode((fs.ReadText("settings.json")))
|
||||
eq(saved.range, 30, "read back")
|
||||
check(fs.FileExists("settings.json"), "FileExists")
|
||||
|
||||
storage.Clear()
|
||||
eq(#storage.Keys(), 0, "Clear")
|
||||
done()
|
||||
73
Tools/RynthLua.CompatTests/Scripts/timers.lua
Normal file
73
Tools/RynthLua.CompatTests/Scripts/timers.lua
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
-- UB-style timing: sleep(ms) and await(action) as globals, in the main chunk, in handlers
|
||||
-- and in callbacks; coroutines; plus RynthLua's spawn / waitfor / clock helpers.
|
||||
|
||||
-- sleep in the main chunk
|
||||
local t0 = clock()
|
||||
sleep(120)
|
||||
check(clock() - t0 >= 110, "sleep(ms) waits")
|
||||
sleep(0)
|
||||
check(true, "sleep(0) returns")
|
||||
|
||||
-- await an action in the main chunk and in a callback
|
||||
local a = await(game.Actions.Sleep(80))
|
||||
check(a.IsFinished and a.Success, "await returns the finished action")
|
||||
local inner
|
||||
game.Actions.Sleep(30, nil, function(res)
|
||||
inner = await(game.Actions.Sleep(30))
|
||||
end)
|
||||
local t = 0
|
||||
while inner == nil and t < 3000 do sleep(20); t = t + 20 end
|
||||
check(inner ~= nil and inner.Success, "await inside an action callback")
|
||||
|
||||
-- sleep inside an event handler doesn't block other handlers
|
||||
local order = {}
|
||||
game.World.OnChatText.Add(function(e)
|
||||
if e.Message == "slow" then sleep(200) end
|
||||
order[#order + 1] = e.Message
|
||||
end)
|
||||
harness.chat("slow", 0)
|
||||
harness.chat("fast", 0)
|
||||
t = 0
|
||||
while #order < 2 and t < 3000 do sleep(20); t = t + 20 end
|
||||
eq(order[1], "fast", "a sleeping handler doesn't hold up the next event")
|
||||
eq(order[2], "slow", "the sleeping handler finishes later")
|
||||
|
||||
-- plain Lua coroutines work alongside
|
||||
local co = coroutine.create(function(x)
|
||||
local y = coroutine.yield(x + 1)
|
||||
return y * 2
|
||||
end)
|
||||
local ok1, v1 = coroutine.resume(co, 1)
|
||||
local ok2, v2 = coroutine.resume(co, 10)
|
||||
check(ok1 and v1 == 2 and ok2 and v2 == 20, "coroutine.create / resume / yield")
|
||||
local gen = coroutine.wrap(function() for i = 1, 3 do coroutine.yield(i) end end)
|
||||
eq(gen() + gen() + gen(), 6, "coroutine.wrap")
|
||||
|
||||
-- spawn / waitfor
|
||||
local flag = false
|
||||
spawn(function(msg)
|
||||
sleep(50)
|
||||
flag = (msg == "go")
|
||||
end, "go")
|
||||
check(waitfor(function() return flag end, 2000), "spawn + waitfor")
|
||||
check(not waitfor(function() return false end, 100), "waitfor times out")
|
||||
|
||||
-- the action object's Await()
|
||||
local b = game.Actions.Sleep(40)
|
||||
b.Await()
|
||||
check(b.IsFinished, "action.Await()")
|
||||
|
||||
-- a long loop doesn't freeze anything (auto-yield), and sleeping in it keeps ticks going
|
||||
local ticks = 0
|
||||
game.OnTick.Add(function() ticks = ticks + 1 end)
|
||||
local sum = 0
|
||||
for i = 1, 200000 do sum = sum + i end
|
||||
eq(sum, 200000 * 200001 / 2, "long loop finished")
|
||||
sleep(100)
|
||||
check(ticks > 0, "ticks kept coming")
|
||||
|
||||
-- os time functions of the sandbox
|
||||
check(type(os.time()) == "number" and type(os.clock()) == "number", "os.time / os.clock")
|
||||
check(type(os.date("%Y")) == "string", "os.date")
|
||||
|
||||
done()
|
||||
167
Tools/RynthLua.CompatTests/Scripts/world.lua
Normal file
167
Tools/RynthLua.CompatTests/Scripts/world.lua
Normal file
|
|
@ -0,0 +1,167 @@
|
|||
-- UB-style game.World use: lookups, searches with every filter kind, nearest by 2D/3D,
|
||||
-- the open container and vendor, and the world events (objects, selection, chat, input).
|
||||
local ids = harness.ids
|
||||
local World = game.World
|
||||
|
||||
local function waitUntil(fn, ms)
|
||||
local t = 0
|
||||
while not fn() and t < (ms or 3000) do sleep(20); t = t + 20 end
|
||||
return fn()
|
||||
end
|
||||
|
||||
local function names(list)
|
||||
local set = {}
|
||||
for _, wo in ipairs(list) do set[wo.Name] = true end
|
||||
return set
|
||||
end
|
||||
|
||||
-- lookups
|
||||
eq(World.Get(ids.Drudge).Name, "Drudge Skulker", "Get")
|
||||
local ok, wo = World.TryGet(ids.Crier)
|
||||
check(ok and wo.Name == "Town Crier", "TryGet found")
|
||||
local ok2, wo2 = World.TryGet(0x7FFFFFF0)
|
||||
check(not ok2 and wo2 == nil, "TryGet missing")
|
||||
check(World.Exists(ids.PortalObj), "Exists")
|
||||
check(not World.Exists(0x7FFFFFF1), "Exists missing")
|
||||
eq(World[ids.Lever].Name, "Tower Lever", "World[id]")
|
||||
check(World.Selected == nil, "nothing selected")
|
||||
|
||||
-- searches
|
||||
local all = names(World.GetAll())
|
||||
check(all["Plain Sword"] and all["Drudge Skulker"] and all["Tester"], "GetAll() has pack items, landscape and me")
|
||||
local monsters = World.GetAll(ObjectClass.Monster)
|
||||
eq(#monsters, 1, "GetAll(ObjectClass.Monster)")
|
||||
eq(monsters[1].Name, "Drudge Skulker", "the monster")
|
||||
local creatures = names(World.GetAll(ObjectType.Creature))
|
||||
check(creatures["Drudge Skulker"] and creatures["Town Crier"] and creatures["Shopkeeper"] and creatures["Friendly Player"], "GetAll(ObjectType.Creature)")
|
||||
check(not creatures["Plain Sword"], "GetAll(ObjectType.Creature) has no items")
|
||||
local cheap = World.GetAll(function(w) return w:Value(IntId.Value) >= 500 end)
|
||||
local cheapNames = names(cheap)
|
||||
check(cheapNames["Plain Sword"] and cheapNames["Amethyst"], "GetAll(function)")
|
||||
local land = names(World.GetLandscape())
|
||||
check(land["Drudge Skulker"] and land["Chest"], "GetLandscape()")
|
||||
check(not land["Tester"] and not land["Plain Sword"] and not land["Amethyst"], "GetLandscape() has no me and no pack/chest items")
|
||||
local portals = World.GetLandscape(ObjectType.Portal)
|
||||
eq(#portals, 1, "GetLandscape(ObjectType.Portal)")
|
||||
eq(#World.GetLandscape(ObjectClass.Npc), 1, "GetLandscape(ObjectClass.Npc)")
|
||||
|
||||
-- nearest
|
||||
eq(World.GetNearest(ObjectClass.Monster).Name, "Drudge Skulker", "GetNearest(ObjectClass)")
|
||||
eq(World.GetNearest(ObjectType.Portal).Name, "Portal to Town", "GetNearest(ObjectType)")
|
||||
eq(World.GetNearest("Town Crier").Name, "Town Crier", "GetNearest(name)")
|
||||
local leverOrCrier = function(w) return w.Name == "Tower Lever" or w.Name == "Town Crier" end
|
||||
eq(World.GetNearest(leverOrCrier).Name, "Town Crier", "GetNearest default is 3D")
|
||||
eq(World.GetNearest(leverOrCrier, DistanceType.T3D).Name, "Town Crier", "GetNearest T3D")
|
||||
eq(World.GetNearest(leverOrCrier, DistanceType.T2D).Name, "Tower Lever", "GetNearest T2D ignores height")
|
||||
|
||||
-- selection
|
||||
local selected
|
||||
World.OnObjectSelected.Add(function(e) selected = e.ObjectId end)
|
||||
harness.select(ids.Crier)
|
||||
check(waitUntil(function() return selected == ids.Crier end), "OnObjectSelected.ObjectId")
|
||||
eq(World.Selected.Id, ids.Crier, "World.Selected")
|
||||
|
||||
-- objects created and released
|
||||
local created, released
|
||||
World.OnObjectCreated.Add(function(e) created = e.ObjectId end)
|
||||
World.OnObjectReleased.Add(function(e) released = e.ObjectId end)
|
||||
local newId = harness.create({ Name = "Olthoi Grub", ItemType = ObjectType.Creature:ToNumber(), Bitfield = 0x10, X = 2 })
|
||||
check(waitUntil(function() return created == newId end), "OnObjectCreated.ObjectId")
|
||||
eq(World.Get(newId).Name, "Olthoi Grub", "new object is known")
|
||||
harness.delete(newId)
|
||||
check(waitUntil(function() return released == newId end), "OnObjectReleased.ObjectId")
|
||||
check(World.Get(newId) == nil, "released object is gone")
|
||||
|
||||
-- the open container
|
||||
local opened, closed
|
||||
World.OnContainerOpened.Add(function(e) opened = e.Container end)
|
||||
World.OnContainerClosed.Add(function(e) closed = e.Container end)
|
||||
harness.container(ids.Chest)
|
||||
check(waitUntil(function() return opened ~= nil end), "OnContainerOpened")
|
||||
eq(opened and opened.Id, ids.Chest, "OnContainerOpened.Container")
|
||||
eq(World.OpenContainer.Id, ids.Chest, "World.OpenContainer")
|
||||
eq(World.OpenContainer.Items[1].Name, "Amethyst", "OpenContainer.Items")
|
||||
harness.container(nil)
|
||||
check(waitUntil(function() return closed ~= nil end), "OnContainerClosed")
|
||||
eq(closed and closed.Id, ids.Chest, "OnContainerClosed.Container")
|
||||
check(World.OpenContainer == nil, "no open container")
|
||||
|
||||
-- the vendor
|
||||
local vendorOpened, vendorClosed = false, false
|
||||
World.Vendor.OnOpened.Add(function() vendorOpened = true end)
|
||||
World.Vendor.OnClosed.Add(function() vendorClosed = true end)
|
||||
check(not World.Vendor.IsOpen, "Vendor closed")
|
||||
harness.vendor(ids.Shopkeeper)
|
||||
check(waitUntil(function() return vendorOpened end), "Vendor.OnOpened")
|
||||
check(World.Vendor.IsOpen, "Vendor.IsOpen")
|
||||
eq(World.Vendor.VendorId, ids.Shopkeeper, "Vendor.VendorId")
|
||||
eq(#World.Vendor.Items, 2, "Vendor.Items")
|
||||
eq(World.Vendor.Items[1].ObjectId, ids.VendorItemA, "Vendor.Items[1].ObjectId")
|
||||
eq(World.Vendor.Items[2].Amount, 500, "Vendor.Items[2].Amount")
|
||||
check(math.abs(World.Vendor.SellPriceModifier - 1.15) < 0.001, "Vendor.SellPriceModifier")
|
||||
check(World.Vendor.Category:HasFlags(ObjectType.Gem), "Vendor.Category")
|
||||
harness.vendor(nil)
|
||||
check(waitUntil(function() return vendorClosed end), "Vendor.OnClosed")
|
||||
check(not World.Vendor.IsOpen, "Vendor closed again")
|
||||
|
||||
-- chat
|
||||
local lines, tells, locals, channels, fellows, emotes = {}, {}, {}, {}, {}, {}
|
||||
World.OnChatText.Add(function(e) lines[#lines + 1] = e end)
|
||||
World.OnTell.Add(function(e) tells[#tells + 1] = e end)
|
||||
World.OnLocalMessage.Add(function(e) locals[#locals + 1] = e end)
|
||||
World.OnChannelMessage.Add(function(e) channels[#channels + 1] = e end)
|
||||
World.OnFellowMessage.Add(function(e) fellows[#fellows + 1] = e end)
|
||||
World.OnEmote.Add(function(e) emotes[#emotes + 1] = e end)
|
||||
harness.chat("You have 5 minutes left.", ChatMessageType.System:ToNumber())
|
||||
harness.chat('<Tell:IIDString:1342177282:Friendly Player>Friendly Player<\\Tell> tells you, "buff me"', ChatMessageType.Tell)
|
||||
harness.chat('Town Crier says, "Hear ye!"', ChatMessageType.Speech)
|
||||
harness.chat('[General] Friendly Player says, "WTS sword"', ChatMessageType.Channels)
|
||||
harness.chat('[Fellowship] Friendly Player says, "pull"', ChatMessageType.Fellowship)
|
||||
harness.chat('Friendly Player waves.', ChatMessageType.Emote)
|
||||
check(waitUntil(function() return #lines >= 6 end), "OnChatText saw every line")
|
||||
local sys = lines[1]
|
||||
eq(sys.Message, "You have 5 minutes left.", "ChatText.Message")
|
||||
eq(sys.Type, ChatMessageType.System, "ChatText.Type")
|
||||
eq(sys.SenderName, "", "no sender gives an empty SenderName")
|
||||
eq(sys.SenderId, 0, "no sender gives SenderId 0")
|
||||
eq(sys.Room, ChatChannel.None, "ChatText.Room None")
|
||||
eq(sys.Eat, false, "ChatText.Eat")
|
||||
eq(#tells, 1, "OnTell once")
|
||||
eq(tells[1].SenderName, "Friendly Player", "Tell.SenderName")
|
||||
eq(tells[1].SenderId, 1342177282, "Tell.SenderId")
|
||||
eq(tells[1].Message, "buff me", "Tell.Message")
|
||||
eq(#locals, 1, "OnLocalMessage once")
|
||||
eq(locals[1].SenderName, "Town Crier", "Local.SenderName")
|
||||
eq(locals[1].Message, "Hear ye!", "Local.Message")
|
||||
eq(#channels, 1, "OnChannelMessage once")
|
||||
eq(channels[1].Room, ChatChannel.General, "Channel.Room")
|
||||
eq(channels[1].SenderName, "Friendly Player", "Channel.SenderName")
|
||||
eq(channels[1].Message, "WTS sword", "Channel.Message")
|
||||
eq(#fellows, 1, "OnFellowMessage once")
|
||||
eq(fellows[1].Message, "pull", "Fellow.Message")
|
||||
eq(#emotes, 1, "OnEmote once")
|
||||
eq(emotes[1].Message, "Friendly Player waves.", "Emote.Message")
|
||||
|
||||
-- chat input: UB scripts eat their own commands with e.Eat = true
|
||||
local inputs = {}
|
||||
World.OnChatInput.Add(function(e)
|
||||
inputs[#inputs + 1] = e.Text
|
||||
if e.Text:sub(1, 4) == "/mm " then e.Eat = true end
|
||||
end)
|
||||
local eaten1 = harness.chatInput("/mm hello")
|
||||
check(waitUntil(function() return #inputs >= 1 end), "OnChatInput fired")
|
||||
eq(inputs[1], "/mm hello", "OnChatInput.Text")
|
||||
sleep(50)
|
||||
local eaten2 = harness.chatInput("/mm again")
|
||||
check(eaten2, "a command a handler ate once is eaten from then on")
|
||||
check(waitUntil(function() return #inputs >= 2 end), "OnChatInput fired again")
|
||||
eq(inputs[2], "/mm again", "second input")
|
||||
local eaten3 = harness.chatInput("hello everyone")
|
||||
check(not eaten3, "plain chat is never eaten")
|
||||
|
||||
-- World.OnTick
|
||||
local ticks = 0
|
||||
World.OnTick.Add(function() ticks = ticks + 1 end)
|
||||
check(waitUntil(function() return ticks >= 3 end), "World.OnTick")
|
||||
|
||||
done()
|
||||
143
Tools/RynthLua.CompatTests/Scripts/worldobject.lua
Normal file
143
Tools/RynthLua.CompatTests/Scripts/worldobject.lua
Normal file
|
|
@ -0,0 +1,143 @@
|
|||
-- UB-style WorldObject use: typed Value() reads, HasValue, list properties, positions,
|
||||
-- distances, parents, enum-valued fields and the per-object events.
|
||||
local ids = harness.ids
|
||||
|
||||
local sword = game.World.Get(ids.Sword)
|
||||
check(sword ~= nil, "World.Get(sword)")
|
||||
eq(sword.Id, ids.Sword, "Id")
|
||||
eq(sword.Name, "Plain Sword", "Name")
|
||||
eq(sword.WeenieClassId, 351, "WeenieClassId")
|
||||
check(sword.ObjectClass == ObjectClass.MeleeWeapon, "ObjectClass == ObjectClass.MeleeWeapon")
|
||||
check(sword.ObjectType == ObjectType.MeleeWeapon, "ObjectType == ObjectType.MeleeWeapon")
|
||||
check(sword.ObjectType:HasFlags(ObjectType.MeleeWeapon), "ObjectType:HasFlags")
|
||||
|
||||
-- Value(key [, default]) picks the property kind from the key's enum
|
||||
eq(sword:Value(IntId.Value), 500, "Value(IntId.Value)")
|
||||
eq(sword:Value(StringId.Name), "Plain Sword", "Value(StringId.Name)")
|
||||
eq(sword:Value(StringId.LongDesc), "A plain sword.", "Value(StringId.LongDesc)")
|
||||
eq(sword:Value(FloatId.WeaponLength), 1.25, "Value(FloatId.WeaponLength)")
|
||||
eq(sword:Value(BoolId.Inscribable), true, "Value(BoolId.Inscribable)")
|
||||
eq(sword:Value(DataId.Icon), 0x06001234, "Value(DataId.Icon)")
|
||||
eq(sword:Value(Int64Id.ItemTotalXp), 0, "Value(Int64Id.ItemTotalXp)")
|
||||
eq(sword:Value(InstanceId.Container), game.Character.Id, "Value(InstanceId.Container)")
|
||||
-- API v73: every instance id, not just Container/Wielder
|
||||
eq(game.Character.Weenie:Value(InstanceId.Monarch), ids.OtherPlayer, "Value(InstanceId.Monarch) on the character")
|
||||
check(game.Character.Weenie:HasValue(InstanceId.Monarch), "HasValue(InstanceId.Monarch)")
|
||||
check(not sword:HasValue(InstanceId.Wielder), "an unwielded sword has no Wielder")
|
||||
eq(sword:Value(InstanceId.PetOwner), 0, "missing instance id defaults to 0")
|
||||
-- defaults when the object doesn't have the property
|
||||
eq(sword:Value(IntId.ArmorLevel), 0, "missing int defaults to 0")
|
||||
eq(sword:Value(IntId.ArmorLevel, 7), 7, "missing int uses the given default")
|
||||
eq(sword:Value(StringId.Inscription), "", "missing string defaults to empty")
|
||||
eq(sword:Value(BoolId.Stuck), false, "missing bool defaults to false")
|
||||
eq(sword:Value(FloatId.DamageMod, 1.5), 1.5, "missing float uses the given default")
|
||||
-- HasValue
|
||||
check(sword:HasValue(IntId.Value), "HasValue(IntId.Value)")
|
||||
check(not sword:HasValue(IntId.ArmorLevel), "not HasValue(IntId.ArmorLevel)")
|
||||
check(sword:HasValue(StringId.LongDesc), "HasValue(StringId.LongDesc)")
|
||||
check(not sword:HasValue(FloatId.DamageMod), "not HasValue(FloatId.DamageMod)")
|
||||
-- the enum-typed fields
|
||||
eq(sword.ValidWieldedLocations, EquipMask.MeleeWeapon, "ValidWieldedLocations")
|
||||
eq(sword.Material, MaterialType.Steel, "Material")
|
||||
eq(sword.Burden, 0, "Burden (none set)")
|
||||
check(sword.Container ~= nil and sword.Container.Id == game.Character.Id, "Container is the character")
|
||||
eq(sword.ContainerId, game.Character.Id, "ContainerId")
|
||||
eq(sword.WielderId, 0, "WielderId")
|
||||
check(sword:GetTopmostParent().Id == game.Character.Id, "GetTopmostParent of a pack item")
|
||||
|
||||
-- a pack in a pack
|
||||
local stone = game.World.Get(ids.ManaStone)
|
||||
eq(stone.ContainerId, ids.Backpack, "stone in the backpack")
|
||||
eq(stone:GetTopmostParent().Id, game.Character.Id, "GetTopmostParent through a side pack")
|
||||
|
||||
-- list properties: Items / ItemIds / Containers / ContainerIds / AllItems / Equipment
|
||||
local me = game.Character.Weenie
|
||||
local itemNames = {}
|
||||
for _, wo in ipairs(me.Items) do itemNames[wo.Name] = true end
|
||||
check(itemNames["Healing Potion"] and itemNames["Plain Sword"], "Weenie.Items has pack items")
|
||||
check(not itemNames["Backpack"], "Weenie.Items has no containers")
|
||||
check(not itemNames["Mana Stone"], "Weenie.Items is only the main pack")
|
||||
eq(#me.ContainerIds, 1, "one side pack")
|
||||
eq(me.Containers[1].Name, "Backpack", "Containers[1]")
|
||||
local all = {}
|
||||
for _, wo in ipairs(me.AllItems) do all[wo.Name] = true end
|
||||
check(all["Mana Stone"] and all["Prismatic Taper"] and all["Healing Potion"], "AllItems includes side-pack items")
|
||||
local eqNames = {}
|
||||
for _, wo in ipairs(me.Equipment) do eqNames[wo.Name] = true end
|
||||
check(eqNames["Wand of Testing"] and eqNames["Leather Cap"], "Equipment")
|
||||
eq(#me.EquipmentIds, 2, "EquipmentIds")
|
||||
local backpack = game.World.Get(ids.Backpack)
|
||||
eq(#backpack.Items, 2, "backpack.Items")
|
||||
eq(#backpack.ItemIds, 2, "backpack.ItemIds")
|
||||
-- the old call form still works
|
||||
eq(#backpack:Items(), 2, "backpack:Items() still callable")
|
||||
-- iterating a list with a plain generic for
|
||||
local n = 0
|
||||
for wo in backpack.Items do n = n + 1; check(wo.Name ~= nil, "for-in item has a name") end
|
||||
eq(n, 2, "for wo in list do")
|
||||
|
||||
-- equipment slot
|
||||
local cap = game.World.Get(ids.Cap)
|
||||
check(cap.CurrentWieldedLocation == EquipMask.Head, "CurrentWieldedLocation == EquipMask.Head")
|
||||
eq(cap.WielderId, game.Character.Id, "cap WielderId")
|
||||
eq(cap.Wielder.Id, game.Character.Id, "cap Wielder")
|
||||
local wand = game.World.Get(ids.Wand)
|
||||
eq(#wand.SpellIds, 1, "wand SpellIds")
|
||||
eq(wand.SpellIds[1].Id, 2345, "wand SpellIds[1].Id")
|
||||
eq(wand.SpellId, 2345, "wand SpellId")
|
||||
|
||||
-- positions and distances
|
||||
local drudge = game.World.Get(ids.Drudge)
|
||||
local pos = drudge.ServerPosition
|
||||
check(pos ~= nil, "ServerPosition")
|
||||
eq(pos.Landcell, 0x7D640013, "ServerPosition.Landcell")
|
||||
eq(pos.Frame.Origin.X, 110, "Frame.Origin.X")
|
||||
eq(pos.Frame.Origin.Z, 10, "Frame.Origin.Z")
|
||||
check(pos.Frame.Orientation ~= nil and pos.Frame.Orientation.W ~= nil, "Frame.Orientation")
|
||||
local mePos = me.ServerPosition
|
||||
check(math.abs(mePos:DistanceTo3D(pos) - 10) < 0.01, "Position:DistanceTo3D")
|
||||
check(math.abs(me:DistanceTo3D(drudge) - 10) < 0.01, "DistanceTo3D(wo)")
|
||||
check(math.abs(me:DistanceTo3D(ids.Drudge) - 10) < 0.01, "DistanceTo3D(id)")
|
||||
local portal = game.World.Get(ids.PortalObj)
|
||||
check(math.abs(me:DistanceTo2D(portal) - 20) < 0.01, "DistanceTo2D(wo) ignores height")
|
||||
check(math.abs(me:DistanceTo2d(ids.PortalObj) - 20) < 0.01, "DistanceTo2d(id)")
|
||||
check(math.abs(me:DistanceTo3D(portal) - 36.0555) < 0.01, "DistanceTo3D includes height")
|
||||
check(sword.ServerPosition == nil, "pack items have no ServerPosition")
|
||||
check(ObjectDescriptionFlag ~= nil, "ObjectDescriptionFlag enum")
|
||||
eq(portal.ObjectDescriptionFlag, 0x40000, "ObjectDescriptionFlag (the description bitfield)")
|
||||
check(PhysicsState ~= nil, "PhysicsState enum")
|
||||
eq(portal.PhysicsState, 0x0C, "PhysicsState (the last state the server sent)")
|
||||
eq(sword.PhysicsState, 0, "PhysicsState 0 when none was seen")
|
||||
|
||||
-- the player's stats on the weenie, the way UB keeps them
|
||||
eq(me.Vitals[VitalId.Health].Current, 300, "Weenie.Vitals[VitalId.Health].Current")
|
||||
eq(me.Vitals[VitalId.Mana].Max, 500, "Weenie.Vitals[VitalId.Mana].Max")
|
||||
eq(me.Vitals[VitalId.Stamina].Type, VitalId.Stamina, "Vital.Type")
|
||||
eq(me.Skills[SkillId.MeleeDefense].Current, 400, "Weenie.Skills[...].Current")
|
||||
eq(me.Skills[SkillId.MeleeDefense].Training, SkillTrainingType.Specialized, "Skill.Training")
|
||||
eq(me.Skills[SkillId.MeleeDefense].Type, SkillId.MeleeDefense, "Skill.Type")
|
||||
eq(me.Attributes[AttributeId.Strength].Base, 190, "Weenie.Attributes[...].Base")
|
||||
eq(me.Attributes[AttributeId.Strength].Type, AttributeId.Strength, "Attribute.Type")
|
||||
|
||||
-- tostring and equality
|
||||
check(tostring(sword):find("Plain Sword") ~= nil, "tostring(wo)")
|
||||
check(game.World.Get(ids.Sword) == sword, "two wrappers of one object are ==")
|
||||
|
||||
-- per-object events: OnPositionChanged and OnDestroyed
|
||||
local moved, destroyed = nil, false
|
||||
drudge.OnPositionChanged.Add(function(e) moved = e end)
|
||||
harness.move(ids.Drudge, 5, 0, 0)
|
||||
local t = 0
|
||||
while moved == nil and t < 3000 do sleep(20); t = t + 20 end
|
||||
check(moved ~= nil, "OnPositionChanged fired")
|
||||
if moved then
|
||||
eq(moved.Weenie.Id, ids.Drudge, "OnPositionChanged.Weenie")
|
||||
eq(moved.Position.Frame.Origin.X, 115, "OnPositionChanged.Position")
|
||||
end
|
||||
drudge.OnDestroyed.Add(function(e) destroyed = e.ObjectId == ids.Drudge end)
|
||||
harness.delete(ids.Drudge)
|
||||
t = 0
|
||||
while not destroyed and t < 3000 do sleep(20); t = t + 20 end
|
||||
check(destroyed, "OnDestroyed fired with ObjectId")
|
||||
|
||||
done()
|
||||
Loading…
Reference in a new issue