feat: add PLAYER_EVENT_ON_QUEST_REWARD_ITEM, add PLAYER_EVENT_ON_CREATE_ITEM, add PLAYER_EVENT_ON_STORE_NEW_ITEM (#88)

Co-authored-by: Axel Cocat <ax.cocat@gmail.com>
This commit is contained in:
veserine
2023-01-30 21:18:28 +08:00
committed by GitHub
parent 63d6ebab01
commit 695c6b7d7c
7 changed files with 57 additions and 0 deletions

View File

@@ -771,6 +771,21 @@ public:
{
return sEluna->OnCanJoinLfg(player, roles, dungeons, comment);
}
void OnQuestRewardItem(Player* player, Item* item, uint32 count) override
{
sEluna->OnQuestRewardItem(player, item, count);
}
void OnCreateItem(Player* player, Item* item, uint32 count) override
{
sEluna->OnCreateItem(player, item, count);
}
void OnStoreNewItem(Player* player, Item* item, uint32 count) override
{
sEluna->OnStoreNewItem(player, item, count);
}
};
class Eluna_ServerScript : public ServerScript

View File

@@ -723,6 +723,9 @@ namespace LuaGlobalFunctions
* PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
* PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
* PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing
* PLAYER_EVENT_ON_QUEST_REWARD_ITEM = 51, // (event, player, item, count)
* PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count)
* PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count)
* };
* </pre>
*

View File

@@ -212,6 +212,9 @@ namespace Hooks
PLAYER_EVENT_ON_CAN_INIT_TRADE = 48, // (event, player, target) - Can return false to prevent the trade
PLAYER_EVENT_ON_CAN_SEND_MAIL = 49, // (event, player, receiverGuid, mailbox, subject, body, money, cod, item) - Can return false to prevent sending the mail
PLAYER_EVENT_ON_CAN_JOIN_LFG = 50, // (event, player, roles, dungeons, comment) - Can return false to prevent queueing
PLAYER_EVENT_ON_QUEST_REWARD_ITEM = 51, // (event, player, item, count)
PLAYER_EVENT_ON_CREATE_ITEM = 52, // (event, player, item, count)
PLAYER_EVENT_ON_STORE_NEW_ITEM = 53, // (event, player, item, count)
PLAYER_EVENT_COUNT
};

View File

@@ -370,6 +370,9 @@ public:
void OnLuaStateOpen();
bool OnAddonMessage(Player* sender, uint32 type, std::string& msg, Player* receiver, Guild* guild, Group* group, Channel* channel);
void OnPetAddedToWorld(Player* player, Creature* pet);
void OnQuestRewardItem(Player* player, Item* item, uint32 count);
void OnCreateItem(Player* player, Item* item, uint32 count);
void OnStoreNewItem(Player* player, Item* item, uint32 count);
/* Item */
void OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, Item* pTarget);

View File

@@ -635,3 +635,30 @@ bool Eluna::OnCanJoinLfg(Player* player, uint8 roles, lfg::LfgDungeonSet& dungeo
Push(comment);
return CallAllFunctionsBool(PlayerEventBindings, key);
}
void Eluna::OnQuestRewardItem(Player* player, Item* item, uint32 count)
{
START_HOOK(PLAYER_EVENT_ON_QUEST_REWARD_ITEM);
Push(player);
Push(item);
Push(count);
CallAllFunctions(PlayerEventBindings, key);
}
void Eluna::OnCreateItem(Player* player, Item* item, uint32 count)
{
START_HOOK(PLAYER_EVENT_ON_CREATE_ITEM);
Push(player);
Push(item);
Push(count);
CallAllFunctions(PlayerEventBindings, key);
}
void Eluna::OnStoreNewItem(Player* player, Item* item, uint32 count)
{
START_HOOK(PLAYER_EVENT_ON_STORE_NEW_ITEM);
Push(player);
Push(item);
Push(count);
CallAllFunctions(PlayerEventBindings, key);
}