mirror of
https://github.com/azerothcore/mod-ale
synced 2025-11-29 15:38:17 +08:00
fix: restore gossip menu after lua script
Cherry pick from https://github.com/ElunaLuaEngine/Eluna/pull/405 Co-authored by https://github.com/Rochet2
This commit is contained in:
@@ -116,22 +116,32 @@ bool Eluna::OnGossipHello(Player* pPlayer, Creature* pCreature)
|
||||
bool Eluna::OnGossipSelect(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action)
|
||||
{
|
||||
START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_SELECT, pCreature->GetEntry(), false);
|
||||
auto original_menu = *pPlayer->PlayerTalkClass;
|
||||
pPlayer->PlayerTalkClass->ClearMenus();
|
||||
Push(pPlayer);
|
||||
Push(pCreature);
|
||||
Push(sender);
|
||||
Push(action);
|
||||
return CallAllFunctionsBool(CreatureGossipBindings, key, true);
|
||||
auto preventDefault = CallAllFunctionsBool(CreatureGossipBindings, key, true);
|
||||
if (!preventDefault) {
|
||||
*pPlayer->PlayerTalkClass = original_menu;
|
||||
}
|
||||
return preventDefault;
|
||||
}
|
||||
|
||||
bool Eluna::OnGossipSelectCode(Player* pPlayer, Creature* pCreature, uint32 sender, uint32 action, const char* code)
|
||||
{
|
||||
START_HOOK_WITH_RETVAL(CreatureGossipBindings, GOSSIP_EVENT_ON_SELECT, pCreature->GetEntry(), false);
|
||||
auto original_menu = *pPlayer->PlayerTalkClass;
|
||||
pPlayer->PlayerTalkClass->ClearMenus();
|
||||
Push(pPlayer);
|
||||
Push(pCreature);
|
||||
Push(sender);
|
||||
Push(action);
|
||||
Push(code);
|
||||
return CallAllFunctionsBool(CreatureGossipBindings, key, true);
|
||||
auto preventDefault = CallAllFunctionsBool(CreatureGossipBindings, key, true);
|
||||
if (!preventDefault) {
|
||||
*pPlayer->PlayerTalkClass = original_menu;
|
||||
}
|
||||
return preventDefault;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user