Skip to content

Commit

Permalink
Add new environmental death hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Foereaper committed Oct 12, 2023
1 parent e38a8fd commit 0dca017
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ namespace Hooks
PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId)
PLAYER_EVENT_ON_LEARN_TALENTS = 39, // (event, player, talentId, talentRank, spellid)
// UNUSED = 40, // (event, player)
PLAYER_EVENT_ON_ENVIRONMENTAL_DEATH = 40, // (event, player, environmentalDamageType)
// UNUSED = 41, // (event, player)
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - player is nil if command used from console. Can return false

Expand Down
1 change: 1 addition & 0 deletions LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,7 @@ class ELUNA_GAME_API Eluna
void OnPVPKill(Player* pKiller, Player* pKilled);
void OnCreatureKill(Player* pKiller, Creature* pKilled);
void OnPlayerKilledByCreature(Creature* pKiller, Player* pKilled);
void OnPlayerKilledByEnvironment(Player* pKilled, uint8 damageType);
void OnLevelChanged(Player* pPlayer, uint8 oldLevel);
void OnFreeTalentPointsChanged(Player* pPlayer, uint32 newPoints);
void OnTalentsReset(Player* pPlayer, bool noCost);
Expand Down
8 changes: 8 additions & 0 deletions PlayerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ void Eluna::OnPlayerKilledByCreature(Creature* pKiller, Player* pKilled)
CallAllFunctions(PlayerEventBindings, key);
}

void Eluna::OnPlayerKilledByEnvironment(Player* pKilled, uint8 damageType)
{
START_HOOK(PLAYER_EVENT_ON_ENVIRONMENTAL_DEATH);
Push(pKilled);
Push(damageType);
CallAllFunctions(PlayerEventBindings, key);
}

void Eluna::OnLevelChanged(Player* pPlayer, uint8 oldLevel)
{
START_HOOK(PLAYER_EVENT_ON_LEVEL_CHANGE);
Expand Down
2 changes: 1 addition & 1 deletion TrinityCore/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_LOOT_MONEY = 37, // (event, player, amount)
* PLAYER_EVENT_ON_QUEST_ABANDON = 38, // (event, player, questId)
* PLAYER_EVENT_ON_LEARN_TALENTS = 39, // (event, player, talentId, talentRank, spellid)
* // UNUSED = 40, // (event, player)
* PLAYER_EVENT_ON_ENVIRONMENTAL_DEATH = 40, // (event, player, environmentalDamageType)
* // UNUSED = 41, // (event, player)
* PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - player is nil if command used from console. Can return false
* };
Expand Down

0 comments on commit 0dca017

Please sign in to comment.