Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(LuaEngine/PlayerHooks): Add OnCanPlayerResurrect #236

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ElunaLuaEngine_SC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,11 @@ class Eluna_PlayerScript : public PlayerScript
{
sEluna->OnCreatureKilledByPet(player, killed);
}

bool CanPlayerResurrect(Player* player) override
{
return sEluna->CanPlayerResurrect(player);
}
};

class Eluna_ServerScript : public ServerScript
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ namespace Hooks
PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type)
PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer)
PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player)

PLAYER_EVENT_COUNT
};
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ class ELUNA_GAME_API Eluna
void OnGroupRollRewardItem(Player* player, Item* item, uint32 count, RollVote voteType, Roll* roll);
void OnBattlegroundDesertion(Player* player, const BattlegroundDesertionType type);
void OnCreatureKilledByPet(Player* player, Creature* killed);
bool CanPlayerResurrect(Player* player);

/* Vehicle */
void OnInstall(Vehicle* vehicle);
Expand Down
8 changes: 8 additions & 0 deletions src/LuaEngine/hooks/PlayerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,3 +706,11 @@ void Eluna::OnCreatureKilledByPet(Player* player, Creature* killed)
Push(killed);
CallAllFunctions(PlayerEventBindings, key);
}

bool Eluna::CanPlayerResurrect(Player* player)
{
START_HOOK_WITH_RETVAL(PLAYER_EVENT_ON_CAN_RESURRECT, true);
Push(player);
return CallAllFunctionsBool(PlayerEventBindings, key);
}

2 changes: 2 additions & 0 deletions src/LuaEngine/methods/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_CAN_GROUP_INVITE = 55, // (event, player, memberName) - Can return false to prevent inviting
* PLAYER_EVENT_ON_GROUP_ROLL_REWARD_ITEM = 56, // (event, player, item, count, voteType, roll)
* PLAYER_EVENT_ON_BG_DESERTION = 57, // (event, player, type)
* PLAYER_EVENT_ON_PET_KILL = 58, // (event, player, killer)
* PLAYER_EVENT_ON_CAN_RESURRECT = 59, // (event, player)
* };
* </pre>
*
Expand Down