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: add player event OnFfaPvpStateUpdate #63

Merged
merged 1 commit into from
Sep 22, 2022
Merged
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 @@ -741,6 +741,11 @@ class Eluna_PlayerScript : public PlayerScript
{
sEluna->OnAchiComplete(player, achievement);
}

void OnFfaPvpStateUpdate(Player* player, bool IsFlaggedForFfaPvp) override
{
sEluna->OnFfaPvpStateUpdate(player, IsFlaggedForFfaPvp);
}
};

class Eluna_ServerScript : public ServerScript
Expand Down
1 change: 1 addition & 0 deletions src/LuaEngine/GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,7 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)
* PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId)
* PLAYER_EVENT_ON_ACHIEVEMENT_COMPLETE = 45, // (event, player, achievement)
* PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp)
* };
* </pre>
*
Expand Down
3 changes: 2 additions & 1 deletion src/LuaEngine/Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ namespace Hooks

// AddOns
ADDON_EVENT_ON_MESSAGE = 30, // (event, sender, type, prefix, msg, target) - target can be nil/whisper_target/guild/group/channel. Can return false

WORLD_EVENT_ON_DELETE_CREATURE = 31, // (event, creature)
WORLD_EVENT_ON_DELETE_GAMEOBJECT = 32, // (event, gameobject)

Expand Down Expand Up @@ -207,6 +207,7 @@ namespace Hooks
PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)
PLAYER_EVENT_ON_LEARN_SPELL = 44, // (event, player, spellId)
PLAYER_EVENT_ON_ACHIEVEMENT_COMPLETE = 45, // (event, player, achievement)
PLAYER_EVENT_ON_FFAPVP_CHANGE = 46, // (event, player, hasFfaPvp)

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 @@ -474,6 +474,7 @@ class ELUNA_GAME_API Eluna
void HandleGossipSelectOption(Player* pPlayer, uint32 menuId, uint32 sender, uint32 action, const std::string& code);
void OnLearnSpell(Player* player, uint32 spellId);
void OnAchiComplete(Player* player, AchievementEntry const* achievement);
void OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp);

#ifndef CLASSIC
#ifndef TBC
Expand Down
9 changes: 9 additions & 0 deletions src/LuaEngine/PlayerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,3 +574,12 @@ void Eluna::OnAchiComplete(Player* player, AchievementEntry const* achievement)
Push(achievement);
CallAllFunctions(PlayerEventBindings, key);
}


void Eluna::OnFfaPvpStateUpdate(Player* player, bool hasFfaPvp)
{
START_HOOK(PLAYER_EVENT_ON_FFAPVP_CHANGE);
Push(player);
Push(hasFfaPvp);
CallAllFunctions(PlayerEventBindings, key);
}