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
4 changed files with 19 additions and 0 deletions
+4
View File
@@ -142,6 +142,8 @@ bool WorldSession::SendLearnNewTaxiNode(Creature* unit)
update << uint8(1); update << uint8(1);
SendPacket(&update); SendPacket(&update);
sScriptMgr->OnPlayerLearnTaxiNode(GetPlayer(), curloc);
return true; return true;
} }
else else
@@ -154,6 +156,8 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
{ {
WorldPacket msg(SMSG_NEW_TAXI_PATH, 0); WorldPacket msg(SMSG_NEW_TAXI_PATH, 0);
SendPacket(&msg); SendPacket(&msg);
sScriptMgr->OnPlayerLearnTaxiNode(GetPlayer(), nodeid);
} }
} }
@@ -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)); 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) PlayerScript::PlayerScript(const char* name, std::vector<uint16> enabledHooks)
: ScriptObject(name, PLAYERHOOK_END) : ScriptObject(name, PLAYERHOOK_END)
{ {
@@ -210,6 +210,7 @@ enum PlayerHook
PLAYERHOOK_ON_SEND_LIST_INVENTORY, PLAYERHOOK_ON_SEND_LIST_INVENTORY,
PLAYERHOOK_ON_GIVE_REPUTATION, PLAYERHOOK_ON_GIVE_REPUTATION,
PLAYERHOOK_ON_GET_REPUTATION_PRICE_DISCOUNT, PLAYERHOOK_ON_GET_REPUTATION_PRICE_DISCOUNT,
PLAYERHOOK_ON_LEARN_TAXI_NODE,
PLAYERHOOK_END PLAYERHOOK_END
}; };
@@ -820,6 +821,14 @@ public:
* @param discount Float value of the discount, as a multiplier of the base price * @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*/) {} 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 #endif
+1
View File
@@ -466,6 +466,7 @@ public: /* PlayerScript */
void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry); void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry);
void OnPlayerGetReputationPriceDiscount(Player const* player, Creature const* creature, float& discount); void OnPlayerGetReputationPriceDiscount(Player const* player, Creature const* creature, float& discount);
void OnPlayerGetReputationPriceDiscount(Player const* player, FactionTemplateEntry const* factionTemplate, float& discount); void OnPlayerGetReputationPriceDiscount(Player const* player, FactionTemplateEntry const* factionTemplate, float& discount);
void OnPlayerLearnTaxiNode(Player const* player, uint32 nodeId);
// Anti cheat // Anti cheat
void AnticheatSetCanFlybyServer(Player* player, bool apply); void AnticheatSetCanFlybyServer(Player* player, bool apply);