Skip to content

Commit 0246faa

Browse files
authored
feat(Core/Scripting): Add OnPlayerLearnTaxiNode hook (azerothcore#25288)
1 parent f644e45 commit 0246faa

4 files changed

Lines changed: 19 additions & 0 deletions

File tree

src/server/game/Handlers/TaxiHandler.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ bool WorldSession::SendLearnNewTaxiNode(Creature* unit)
142142
update << uint8(1);
143143
SendPacket(&update);
144144

145+
sScriptMgr->OnPlayerLearnTaxiNode(GetPlayer(), curloc);
146+
145147
return true;
146148
}
147149
else
@@ -154,6 +156,8 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
154156
{
155157
WorldPacket msg(SMSG_NEW_TAXI_PATH, 0);
156158
SendPacket(&msg);
159+
160+
sScriptMgr->OnPlayerLearnTaxiNode(GetPlayer(), nodeid);
157161
}
158162
}
159163

src/server/game/Scripting/ScriptDefines/PlayerScript.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,11 @@ void ScriptMgr::OnPlayerGetReputationPriceDiscount(Player const* player, Faction
925925
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_GET_REPUTATION_PRICE_DISCOUNT, script->OnPlayerGetReputationPriceDiscount(player, factionTemplate, discount));
926926
}
927927

928+
void ScriptMgr::OnPlayerLearnTaxiNode(Player const* player, uint32 nodeId)
929+
{
930+
CALL_ENABLED_HOOKS(PlayerScript, PLAYERHOOK_ON_LEARN_TAXI_NODE, script->OnPlayerLearnTaxiNode(player, nodeId));
931+
}
932+
928933
PlayerScript::PlayerScript(const char* name, std::vector<uint16> enabledHooks)
929934
: ScriptObject(name, PLAYERHOOK_END)
930935
{

src/server/game/Scripting/ScriptDefines/PlayerScript.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ enum PlayerHook
210210
PLAYERHOOK_ON_SEND_LIST_INVENTORY,
211211
PLAYERHOOK_ON_GIVE_REPUTATION,
212212
PLAYERHOOK_ON_GET_REPUTATION_PRICE_DISCOUNT,
213+
PLAYERHOOK_ON_LEARN_TAXI_NODE,
213214
PLAYERHOOK_END
214215
};
215216

@@ -820,6 +821,14 @@ class PlayerScript : public ScriptObject
820821
* @param discount Float value of the discount, as a multiplier of the base price
821822
*/
822823
virtual void OnPlayerGetReputationPriceDiscount(Player const* /*player*/, FactionTemplateEntry const* /*factionTemplate*/, float& /*discount*/) {}
824+
825+
/**
826+
* @brief This hook is called when a player learns a new flight path node.
827+
*
828+
* @param player Contains information about the Player
829+
* @param nodeId The id of the learned taxi node
830+
*/
831+
virtual void OnPlayerLearnTaxiNode(Player const* /*player*/, uint32 /*nodeId*/) {}
823832
};
824833

825834
#endif

src/server/game/Scripting/ScriptMgr.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ class ScriptMgr
466466
void OnPlayerSendListInventory(Player* player, ObjectGuid vendorGuid, uint32& vendorEntry);
467467
void OnPlayerGetReputationPriceDiscount(Player const* player, Creature const* creature, float& discount);
468468
void OnPlayerGetReputationPriceDiscount(Player const* player, FactionTemplateEntry const* factionTemplate, float& discount);
469+
void OnPlayerLearnTaxiNode(Player const* player, uint32 nodeId);
469470

470471
// Anti cheat
471472
void AnticheatSetCanFlybyServer(Player* player, bool apply);

0 commit comments

Comments
 (0)