Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/LuaEngine/LuaFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ ALERegister<Player> PlayerMethods[] =
{ "IsAtLootRewardDistance", &LuaPlayer::IsAtLootRewardDistance },
{ "CanTeleport", &LuaPlayer::CanTeleport },
{ "IsSpectator", &LuaPlayer::IsSpectator },
{ "HasKnownTaxiNode", &LuaPlayer::HasKnownTaxiNode },
// { "HasSpellMod", &LuaPlayer::HasSpellMod },

// Gossip
Expand Down
27 changes: 26 additions & 1 deletion src/LuaEngine/methods/PlayerMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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++);
}
}
}
Expand Down Expand Up @@ -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;
Copy link

Copilot AI Feb 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HasKnownTaxiNode documents a boolean return, but when player is null it returns 0 results (Lua sees nil). That makes the API behave differently than the documented/expected false value. Consider either always pushing false and returning 1 in the !player case, or remove the null-check if player is guaranteed to be valid for Player methods.

Suggested change
return 0;
{
ALE::Push(L, false);
return 1;
}

Copilot uses AI. Check for mistakes.

uint32 nodeId = ALE::CHECKVAL<uint32>(L, 2);

if (nodeId == 0)
{
ALE::Push(L, false);
return 1;
}

ALE::Push(L, player->m_taxi.IsTaximaskNodeKnown(nodeId));
return 1;
}
};
#endif