Skip to content

Commit

Permalink
Add pre and post reward player at kill (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidonete authored and celguar committed Mar 25, 2024
1 parent 3bd3a4f commit 506b967
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/game/Entities/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19356,6 +19356,11 @@ void Player::RemoveCityTitle()

void Player::RewardSinglePlayerAtKill(Unit* pVictim)
{
#ifdef ENABLE_MODULES
if (!sModuleMgr.OnPreRewardPlayerAtKill(this, pVictim))
{
#endif

// honor can be in PvP and !PvP (racial leader) cases
RewardHonor(pVictim, 1);

Expand All @@ -19375,7 +19380,8 @@ void Player::RewardSinglePlayerAtKill(Unit* pVictim)
}

#ifdef ENABLE_MODULES
sModuleMgr.OnRewardSinglePlayerAtKill(this, pVictim);
}
sModuleMgr.OnRewardPlayerAtKill(this, pVictim);
#endif
}

Expand Down
14 changes: 14 additions & 0 deletions src/game/Groups/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
#include "PlayerBot/Base/PlayerbotMgr.h"
#endif

#ifdef ENABLE_MODULES
#include "ModuleMgr.h"
#endif

GroupMemberStatus GetGroupMemberStatus(const Player* member = nullptr)
{
uint8 flags = MEMBER_STATUS_OFFLINE;
Expand Down Expand Up @@ -1500,6 +1504,11 @@ void Group::_homebindIfInstance(Player* player) const

static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 count, bool PvP, float group_rate, uint32 sum_level, bool is_dungeon, Player* not_gray_member_with_max_level, Player* member_with_max_level, uint32 xp)
{
#ifdef ENABLE_MODULES
if (!sModuleMgr.OnPreRewardPlayerAtKill(pGroupGuy, pVictim))
{
#endif

// honor can be in PvP and !PvP (racial leader) cases (for alive)
if (pGroupGuy->IsAlive())
pGroupGuy->RewardHonor(pVictim, count);
Expand Down Expand Up @@ -1541,6 +1550,11 @@ static void RewardGroupAtKill_helper(Player* pGroupGuy, Unit* pVictim, uint32 co
}
}
}

#ifdef ENABLE_MODULES
}
sModuleMgr.OnRewardPlayerAtKill(pGroupGuy, pVictim);
#endif
}

/** Provide rewards to group members at unit kill
Expand Down

0 comments on commit 506b967

Please sign in to comment.