diff --git a/src/LuaEngine/LuaFunctions.cpp b/src/LuaEngine/LuaFunctions.cpp index 2c23c01..e01c4a9 100644 --- a/src/LuaEngine/LuaFunctions.cpp +++ b/src/LuaEngine/LuaFunctions.cpp @@ -543,6 +543,7 @@ ElunaRegister PlayerMethods[] = { "GetPlayerSettingValue", &LuaPlayer::GetPlayerSettingValue }, { "GetTrader", &LuaPlayer::GetTrader }, { "GetBonusTalentCount", &LuaPlayer::GetBonusTalentCount }, + { "GetKnownTaxiNodes", &LuaPlayer::GetKnownTaxiNodes }, // Setters { "AdvanceSkillsToMax", &LuaPlayer::AdvanceSkillsToMax }, @@ -559,6 +560,7 @@ ElunaRegister PlayerMethods[] = { "SetLifetimeKills", &LuaPlayer::SetLifetimeKills }, { "SetGameMaster", &LuaPlayer::SetGameMaster }, { "SetGMChat", &LuaPlayer::SetGMChat }, + { "SetKnownTaxiNodes", &LuaPlayer::SetKnownTaxiNodes }, { "SetTaxiCheat", &LuaPlayer::SetTaxiCheat }, { "SetGMVisible", &LuaPlayer::SetGMVisible }, { "SetPvPDeath", &LuaPlayer::SetPvPDeath }, @@ -785,6 +787,7 @@ ElunaRegister CreatureMethods[] = { "GetShieldBlockValue", &LuaCreature::GetShieldBlockValue }, { "GetDBTableGUIDLow", &LuaCreature::GetDBTableGUIDLow }, { "GetCreatureFamily", &LuaCreature::GetCreatureFamily }, + { "GetReactState", &LuaCreature::GetReactState }, // Setters { "SetRegeneratingHealth", &LuaCreature::SetRegeneratingHealth }, diff --git a/src/LuaEngine/methods/CreatureMethods.h b/src/LuaEngine/methods/CreatureMethods.h index 0d126fb..10cd444 100644 --- a/src/LuaEngine/methods/CreatureMethods.h +++ b/src/LuaEngine/methods/CreatureMethods.h @@ -841,6 +841,27 @@ namespace LuaCreature return 1; } + /** + * Returns the [Creature]'s current ReactState. + * + *
+     * enum ReactState
+     * {
+     *     REACT_PASSIVE       = 0,
+     *     REACT_DEFENSIVE     = 1,
+     *     REACT_AGGRESSIVE    = 2
+     * };
+     * 
+ * + * @return [ReactState] state + */ + int GetReactState(lua_State* L, Creature* creature) + { + ReactStates state = creature->GetReactState(); + lua_pushinteger(L, (int)state); + return 1; + } + /** * Sets the [Creature]'s NPC flags to `flags`. * diff --git a/src/LuaEngine/methods/PlayerMethods.h b/src/LuaEngine/methods/PlayerMethods.h index 2f64078..df625e9 100644 --- a/src/LuaEngine/methods/PlayerMethods.h +++ b/src/LuaEngine/methods/PlayerMethods.h @@ -1659,6 +1659,40 @@ namespace LuaPlayer return 1; } + /** + * Returns known taxi nodes (flight paths) that the player has unlocked. + * + * @return table nodes : A table containing the IDs of the known taxi nodes + */ + int GetKnownTaxiNodes(lua_State* L, Player* player) + { + if (!player) + return 0; + + lua_newtable(L); + + ByteBuffer data; + player->m_taxi.AppendTaximaskTo(data, false); + + for (uint8 i = 0; i < TaxiMaskSize; i++) + { + uint32 mask; + data >> mask; + + for (uint8 bit = 0; bit < 32; bit++) + { + if (mask & (1 << bit)) + { + uint8 nodeId = (i * 32) + bit + 1; + lua_pushinteger(L, nodeId); + lua_rawseti(L, -2, lua_rawlen(L, -2) + 1); + } + } + } + + return 1; + } + /*int GetRecruiterId(lua_State* L, Player* player) { Eluna::Push(L, player->GetSession()->GetRecruiterId()); @@ -1893,6 +1927,34 @@ namespace LuaPlayer return 0; } + /** + * Sets the player's known taxi nodes (flight paths). + * + * @param table nodes : A table containing the taxi node IDs to set as known + */ + int SetKnownTaxiNodes(lua_State* L, Player* player) + { + if (!player) + return 0; + + if (!lua_istable(L, 2)) + return 0; + + lua_pushnil(L); + + while (lua_next(L, 2) != 0) + { + uint32 nodeId = luaL_checkinteger(L, -1); + + if (nodeId > 0) + player->m_taxi.SetTaximaskNode(nodeId); + + lua_pop(L, 1); + } + + return 0; + } + /** * Toggles whether the [Player] has taxi cheat enabled or not *