From 35029e3fd61022f603a2343679b01857044c1650 Mon Sep 17 00:00:00 2001 From: Aldori Date: Fri, 6 Feb 2026 11:13:31 -0500 Subject: [PATCH 1/2] fix(PlayerMethods): GetKnownTaxiNodes should use an index counter instead of lua_rawlen Using an index counter is more performant than using lua_rawlen every time since lua_rawlen can become expensive if the nodes list is very large. --- src/LuaEngine/methods/PlayerMethods.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 891477ca2d..75694f9452 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -1634,6 +1634,8 @@ namespace LuaPlayer ByteBuffer data; player->m_taxi.AppendTaximaskTo(data, false); + uint32 idx = 1; + for (uint8 i = 0; i < TaxiMaskSize; i++) { uint32 mask; @@ -1645,7 +1647,7 @@ namespace LuaPlayer { uint32 nodeId = (i * 32) + bit + 1; lua_pushinteger(L, nodeId); - lua_rawseti(L, -2, lua_rawlen(L, -2) + 1); + lua_rawseti(L, -2, idx++); } } } From ae11f98e4fc14e5512c59cdab04413a54baf8d22 Mon Sep 17 00:00:00 2001 From: Aldori Date: Fri, 6 Feb 2026 11:19:32 -0500 Subject: [PATCH 2/2] feat(PlayerMethods): Add HasKnownTaxiNode Add HasKnownTaxiNode to PlayerMethods. This method will return `true` if the Player knows the given nodeId, `false` otherwise. This method is used in my Accountwide Taxi Paths script on my Github. --- src/LuaEngine/LuaFunctions.cpp | 1 + src/LuaEngine/methods/PlayerMethods.h | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index 0ebe274acc..c029fd37da 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -707,6 +707,7 @@ ALERegister PlayerMethods[] = { "IsAtLootRewardDistance", &LuaPlayer::IsAtLootRewardDistance }, { "CanTeleport", &LuaPlayer::CanTeleport }, { "IsSpectator", &LuaPlayer::IsSpectator }, + { "HasKnownTaxiNode", &LuaPlayer::HasKnownTaxiNode }, // { "HasSpellMod", &LuaPlayer::HasSpellMod }, // Gossip diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 75694f9452..4fb1a28470 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -4983,6 +4983,29 @@ namespace LuaPlayer player->ApplyRatingMod(CombatRating(stat), value, apply); return 0; } + + /** + * Returns `true` if the [Player] knows the given taxi node, `false` otherwise. + * + * @param uint32 nodeId + * @return bool known + */ + int HasKnownTaxiNode(lua_State* L, Player* player) + { + if (!player) + return 0; + + uint32 nodeId = ALE::CHECKVAL(L, 2); + + if (nodeId == 0) + { + ALE::Push(L, false); + return 1; + } + + ALE::Push(L, player->m_taxi.IsTaximaskNodeKnown(nodeId)); + return 1; + } }; #endif