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

New player event: PLAYER_EVENT_ON_PET_ADDED_TO_WORLD #3

Merged
merged 1 commit into from
Oct 8, 2021
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
7 changes: 4 additions & 3 deletions GlobalMethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,10 @@ namespace LuaGlobalFunctions
* Low GUID is an ID to distinct the objects of the same type.
*
* [Player] and [Creature] for example can have the same low GUID but not GUID.
*
*
* On TrinityCore all low GUIDs are different for all objects of the same type.
* For example creatures in instances are assigned new GUIDs when the Map is created.
*
*
* On MaNGOS and cMaNGOS low GUIDs are unique only on the same map.
* For example creatures in instances use the same low GUID assigned for that spawn in the database.
* This is why to identify a creature you have to know the instanceId and low GUID. See [Map:GetIntstanceId]
Expand Down Expand Up @@ -700,6 +700,7 @@ namespace LuaGlobalFunctions
* // UNUSED = 40, // (event, player)
* // UNUSED = 41, // (event, player)
* PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - player is nil if command used from console. Can return false
* PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)
* };
* </pre>
*
Expand Down Expand Up @@ -2273,7 +2274,7 @@ namespace LuaGlobalFunctions

/**
* Adds a taxi path to a specified map, returns the used pathId.
*
*
* Note that the first taxi point needs to be near the player when he starts the taxi path.
* The function should also be used only **once** per path added so use it on server startup for example.
*
Expand Down
1 change: 1 addition & 0 deletions Hooks.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ namespace Hooks
// UNUSED = 40, // (event, player)
// UNUSED = 41, // (event, player)
PLAYER_EVENT_ON_COMMAND = 42, // (event, player, command) - player is nil if command used from console. Can return false
PLAYER_EVENT_ON_PET_ADDED_TO_WORLD = 43, // (event, player, pet)

PLAYER_EVENT_COUNT
};
Expand Down
1 change: 1 addition & 0 deletions LuaEngine.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ class ELUNA_GAME_API Eluna
void OnLuaStateClose();
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);

/* Item */
void OnDummyEffect(WorldObject* pCaster, uint32 spellId, SpellEffIndex effIndex, Item* pTarget);
Expand Down
8 changes: 8 additions & 0 deletions PlayerHooks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,3 +544,11 @@ bool Eluna::OnChat(Player* pPlayer, uint32 type, uint32 lang, std::string& msg,
CleanUpStack(5);
return result;
}

void Eluna::OnPetAddedToWorld(Player* player, Creature* pet)
{
START_HOOK(PLAYER_EVENT_ON_PET_ADDED_TO_WORLD);
Push(player);
Push(pet);
CallAllFunctions(PlayerEventBindings, key);
}