feat(Core/Scripting): Add OnPlayerLearnTaxiNode hook (#25288)

This commit is contained in:
Axel Cocat 2026-03-29 01:20:27 +01:00 committed by GitHub
parent f644e4522e
commit 0246faa95a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 0 deletions

View file

@ -142,6 +142,8 @@ bool WorldSession::SendLearnNewTaxiNode(Creature* unit)
update << uint8(1);
SendPacket(&update);
sScriptMgr->OnPlayerLearnTaxiNode(GetPlayer(), curloc);
return true;
}
else
@ -154,6 +156,8 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
{
WorldPacket msg(SMSG_NEW_TAXI_PATH, 0);
SendPacket(&msg);
sScriptMgr->OnPlayerLearnTaxiNode(GetPlayer(), nodeid);
}
}

View file

@ -925,6 +925,11 @@ void ScriptMgr::OnPlayerGetReputationPriceDiscount(Player const* player, Faction
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_GET_REPUTATION_PRICE_DISCOUNT, script->OnPlayerGetReputationPriceDiscount(player, factionTemplate, discount));
}
void ScriptMgr::OnPlayerLearnTaxiNode(Player const* player, uint32 nodeId)
{
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_LEARN_TAXI_NODE, script->OnPlayerLearnTaxiNode(player, nodeId));
}
PlayerScript::PlayerScript(const char* name, std::vector<uint16> enabledHooks)
: ScriptObject(name, PLAYERHOOK_END)
{

View file

@ -210,6 +210,7 @@ enum PlayerHook
PLAYERHOOK_ON_SEND_LIST_INVENTORY,
PLAYERHOOK_ON_GIVE_REPUTATION,
PLAYERHOOK_ON_GET_REPUTATION_PRICE_DISCOUNT,
PLAYERHOOK_ON_LEARN_TAXI_NODE,
PLAYERHOOK_END
};
@ -820,6 +821,14 @@ public:
* @param discount Float value of the discount, as a multiplier of the base price
*/
virtual void OnPlayerGetReputationPriceDiscount(Player const* /*player*/, FactionTemplateEntry const* /*factionTemplate*/, float& /*discount*/) {}
/**
* @brief This hook is called when a player learns a new flight path node.
*
* @param player Contains information about the Player
* @param nodeId The id of the learned taxi node
*/
virtual void OnPlayerLearnTaxiNode(Player const* /*player*/, uint32 /*nodeId*/) {}
};
#endif

View file

@ -466,6 +466,7 @@ public: /* PlayerScript */
void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry);
void OnPlayerGetReputationPriceDiscount(Player const* player, Creature const* creature, float& discount);
void OnPlayerGetReputationPriceDiscount(Player const* player, FactionTemplateEntry const* factionTemplate, float& discount);
void OnPlayerLearnTaxiNode(Player const* player, uint32 nodeId);
// Anti cheat
void AnticheatSetCanFlybyServer(Player* player, bool apply);