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 891477ca2d..4fb1a28470 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++); } } } @@ -4981,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