mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
feat(Core/Hooks): Add the KillRewarder reference to the OnRewardKillRewarder hook. (#18290)
* Another hackfix attempt at warden payload forcechecks ban fix. * Revert last commit, interrupt all forcechecks instead of just _dataSent ones. * Add rewarder parameter to OnRewardKillRewarder hook. * Undo old warden changes. * Removed too much!
This commit is contained in:
@@ -204,12 +204,13 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
|
||||
if (_victim->GetTypeId() == TYPEID_PLAYER)
|
||||
player->KilledPlayerCredit();
|
||||
}
|
||||
|
||||
// Give XP only in PvE or in battlegrounds.
|
||||
// Give reputation and kill credit only in PvE.
|
||||
if (!_isPvP || _isBattleGround)
|
||||
{
|
||||
float xpRate = _group ? _groupRate * float(player->GetLevel()) / _aliveSumLevel : /*Personal rate is 100%.*/ 1.0f; // Group rate depends on the sum of levels.
|
||||
sScriptMgr->OnRewardKillRewarder(player, isDungeon, xpRate); // Personal rate is 100%.
|
||||
sScriptMgr->OnRewardKillRewarder(player, this, isDungeon, xpRate); // Personal rate is 100%.
|
||||
|
||||
if (_xp)
|
||||
{
|
||||
@@ -290,3 +291,13 @@ void KillRewarder::Reward()
|
||||
if (Map* map = _victim->FindMap())
|
||||
map->UpdateEncounterState(ENCOUNTER_CREDIT_KILL_CREATURE, _victim->GetEntry(), _victim);
|
||||
}
|
||||
|
||||
Unit* KillRewarder::GetVictim()
|
||||
{
|
||||
return _victim;
|
||||
}
|
||||
|
||||
Player* KillRewarder::GetKiller()
|
||||
{
|
||||
return _killer;
|
||||
}
|
||||
|
||||
@@ -30,6 +30,8 @@ public:
|
||||
KillRewarder(Player* killer, Unit* victim, bool isBattleGround);
|
||||
|
||||
void Reward();
|
||||
Unit* GetVictim();
|
||||
Player* GetKiller();
|
||||
|
||||
private:
|
||||
void _InitXP(Player* player);
|
||||
|
||||
@@ -992,11 +992,11 @@ void ScriptMgr::PetitionShowList(Player* player, Creature* creature, uint32& Cha
|
||||
});
|
||||
}
|
||||
|
||||
void ScriptMgr::OnRewardKillRewarder(Player* player, bool isDungeon, float& rate)
|
||||
void ScriptMgr::OnRewardKillRewarder(Player* player, KillRewarder* rewarder, bool isDungeon, float& rate)
|
||||
{
|
||||
ExecuteScript<PlayerScript>([&](PlayerScript* script)
|
||||
{
|
||||
script->OnRewardKillRewarder(player, isDungeon, rate);
|
||||
script->OnRewardKillRewarder(player, rewarder, isDungeon, rate);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
// TODO to remove
|
||||
#include "AchievementMgr.h"
|
||||
#include "KillRewarder.h"
|
||||
|
||||
class PlayerScript : public ScriptObject
|
||||
{
|
||||
@@ -314,7 +315,7 @@ public:
|
||||
|
||||
virtual void PetitionShowList(Player* /*player*/, Creature* /*creature*/, uint32& /*CharterEntry*/, uint32& /*CharterDispayID*/, uint32& /*CharterCost*/) { }
|
||||
|
||||
virtual void OnRewardKillRewarder(Player* /*player*/, bool /*isDungeon*/, float& /*rate*/) { }
|
||||
virtual void OnRewardKillRewarder(Player* /*player*/, KillRewarder* /*rewarder*/, bool /*isDungeon*/, float& /*rate*/) { }
|
||||
|
||||
[[nodiscard]] virtual bool CanGiveMailRewardAtGiveLevel(Player* /*player*/, uint8 /*level*/) { return true; }
|
||||
|
||||
|
||||
@@ -397,7 +397,7 @@ public: /* PlayerScript */
|
||||
bool CanSendMail(Player* player, ObjectGuid receiverGuid, ObjectGuid mailbox, std::string& subject, std::string& body, uint32 money, uint32 COD, Item* item);
|
||||
void PetitionBuy(Player* player, Creature* creature, uint32& charterid, uint32& cost, uint32& type);
|
||||
void PetitionShowList(Player* player, Creature* creature, uint32& CharterEntry, uint32& CharterDispayID, uint32& CharterCost);
|
||||
void OnRewardKillRewarder(Player* player, bool isDungeon, float& rate);
|
||||
void OnRewardKillRewarder(Player* player, KillRewarder* rewarder, bool isDungeon, float& rate);
|
||||
bool CanGiveMailRewardAtGiveLevel(Player* player, uint8 level);
|
||||
void OnDeleteFromDB(CharacterDatabaseTransaction trans, uint32 guid);
|
||||
bool CanRepopAtGraveyard(Player* player);
|
||||
|
||||
Reference in New Issue
Block a user