#include "KillRewarder.h"
◆ KillRewarder()
KillRewarder::KillRewarder |
( |
Player * |
killer, |
|
|
Unit * |
victim, |
|
|
bool |
isBattleGround |
|
) |
| |
66 :
67
71{
72
75
78
80}
bool IsPlayer() const
Definition: Object.h:200
bool IsPlayer() const
Definition: ObjectGuid.h:168
uint8 _maxLevel
Definition: KillRewarder.h:57
uint32 _count
Definition: KillRewarder.h:52
float _groupRate
Definition: KillRewarder.h:50
uint32 _xp
Definition: KillRewarder.h:55
uint32 _aliveSumLevel
Definition: KillRewarder.h:53
uint32 _sumLevel
Definition: KillRewarder.h:54
Player * _maxNotGrayMember
Definition: KillRewarder.h:51
Unit * _victim
Definition: KillRewarder.h:48
Player * _killer
Definition: KillRewarder.h:47
bool _isBattleGround
Definition: KillRewarder.h:58
Group * _group
Definition: KillRewarder.h:49
void _InitGroupData()
Definition: KillRewarder.cpp:82
bool _isFullXP
Definition: KillRewarder.h:56
bool _isPvP
Definition: KillRewarder.h:59
Group * GetGroup()
Definition: Player.h:2468
bool IsVehicle() const
Definition: Unit.h:757
ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Unit.h:1220
References _InitGroupData(), _isPvP, Unit::GetCharmerOrOwnerGUID(), Object::IsPlayer(), ObjectGuid::IsPlayer(), and Unit::IsVehicle().
◆ _InitGroupData()
void KillRewarder::_InitGroupData |
( |
| ) |
|
|
private |
83{
85 {
86
88 if (
Player* member = itr->GetSource())
90 {
91 const uint8 lvl = member->GetLevel();
92 if (member->IsAlive())
93 {
94
96
98
100 {
102 }
103
104
107 {
109 }
110 }
111
113 }
114
115
117 }
118 else
120}
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
uint8 GetGrayLevel(uint8 pl_level)
Definition: Formulas.h:46
Definition: Player.h:1081
bool IsAtGroupRewardDistance(WorldObject const *pRewardSource) const
Definition: Player.cpp:12797
uint8 GetLevel() const
Definition: Unit.h:1024
GroupReference * GetFirstMember()
Definition: Group.h:243
Definition: GroupReference.h:27
GroupReference * next()
Definition: GroupReference.h:36
References _aliveSumLevel, _count, _group, _isFullXP, _killer, _maxLevel, _maxNotGrayMember, _sumLevel, _victim, Group::GetFirstMember(), Acore::XP::GetGrayLevel(), Unit::GetLevel(), Player::IsAtGroupRewardDistance(), and GroupReference::next().
Referenced by KillRewarder().
◆ _InitXP()
void KillRewarder::_InitXP |
( |
Player * |
player | ) |
|
|
private |
123{
124
125
126
127
128
131
135 if (ct->ModHealth <= 0.75f && ct->ModHealth >= 0.0f)
137}
uint32 Gain(Player *player, Unit *unit, bool isBattleGround=false)
Definition: Formulas.cpp:71
CreatureTemplate const * GetCreatureTemplate() const
Definition: Creature.h:205
Definition: CreatureData.h:186
bool IsCreature() const
Definition: Object.h:204
Creature * ToCreature()
Definition: Object.h:205
Vehicle * GetVehicle() const
Definition: Unit.h:1786
References _isBattleGround, _isPvP, _killer, _victim, _xp, Acore::XP::Gain(), Creature::GetCreatureTemplate(), Unit::GetVehicle(), Object::IsCreature(), and Object::ToCreature().
Referenced by _RewardGroup(), and Reward().
◆ _RewardGroup()
void KillRewarder::_RewardGroup |
( |
| ) |
|
|
private |
230{
232 {
234
235
237
238
239
241 {
244 {
245
248 }
249
250
252 {
253 if (
Player* member = itr->GetSource())
254 {
256 {
258
259
260
261 }
262 }
263 }
264 }
265 }
266}
DBCStorage< MapEntry > sMapStore(MapEntryfmt)
float xp_in_group_rate(uint32 count, bool isRaid)
Definition: Formulas.h:119
uint32 GetMapId() const
Definition: Position.h:275
void _RewardPlayer(Player *player, bool isDungeon)
Definition: KillRewarder.cpp:196
void _InitXP(Player *player)
Definition: KillRewarder.cpp:122
bool isRaidGroup() const
Definition: Group.cpp:2267
References _count, _group, _groupRate, _InitXP(), _isBattleGround, _isPvP, _killer, _maxLevel, _maxNotGrayMember, _RewardPlayer(), _victim, _xp, Group::GetFirstMember(), WorldLocation::GetMapId(), Player::IsAtGroupRewardDistance(), Group::isRaidGroup(), GroupReference::next(), sMapStore, and Acore::XP::xp_in_group_rate().
Referenced by Reward().
◆ _RewardHonor()
void KillRewarder::_RewardHonor |
( |
Player * |
player | ) |
|
|
private |
◆ _RewardKillCredit()
void KillRewarder::_RewardKillCredit |
( |
Player * |
player | ) |
|
|
private |
186{
187
190 {
191 player->
KilledMonster(target->GetCreatureTemplate(), target->GetGUID());
193 }
194}
@ ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE
Definition: DBCEnums.h:188
Definition: Creature.h:43
void UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1=0, uint32 miscValue2=0, Unit *unit=nullptr)
Definition: PlayerUpdates.cpp:2131
void KilledMonster(CreatureTemplate const *cInfo, ObjectGuid guid)
Definition: PlayerQuest.cpp:1914
Corpse * GetCorpse() const
Definition: Player.cpp:4725
References _group, _victim, ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE_TYPE, Player::GetCorpse(), Unit::IsAlive(), Player::KilledMonster(), Object::ToCreature(), and Player::UpdateAchievementCriteria().
Referenced by _RewardPlayer().
◆ _RewardPlayer()
void KillRewarder::_RewardPlayer |
( |
Player * |
player, |
|
|
bool |
isDungeon |
|
) |
| |
|
private |
197{
198
200 {
201
203
206 }
207
208
209
211 {
213 sScriptMgr->OnRewardKillRewarder(player,
this, isDungeon, xpRate);
214
216 {
217
219 }
221 {
222
225 }
226 }
227}
#define sScriptMgr
Definition: ScriptMgr.h:709
void _RewardReputation(Player *player)
Definition: KillRewarder.cpp:178
void _RewardHonor(Player *player)
Definition: KillRewarder.cpp:139
void _RewardXP(Player *player, float rate)
Definition: KillRewarder.cpp:146
void _RewardKillCredit(Player *player)
Definition: KillRewarder.cpp:185
void KilledPlayerCredit(uint16 count=1)
Definition: PlayerQuest.cpp:1994
References _aliveSumLevel, _group, _groupRate, _isBattleGround, _isPvP, _RewardHonor(), _RewardKillCredit(), _RewardReputation(), _RewardXP(), _victim, _xp, Unit::GetLevel(), Object::IsPlayer(), Player::KilledPlayerCredit(), and sScriptMgr.
Referenced by _RewardGroup(), and Reward().
◆ _RewardReputation()
void KillRewarder::_RewardReputation |
( |
Player * |
player | ) |
|
|
private |
◆ _RewardXP()
void KillRewarder::_RewardXP |
( |
Player * |
player, |
|
|
float |
rate |
|
) |
| |
|
private |
147{
150 {
151
152
153
158 uint32(xp * rate / 2) + 1;
159 else
160 xp = 0;
161 }
162 if (xp)
163 {
164
166 for (Unit::AuraEffectList::const_iterator i = auras.begin(); i != auras.end(); ++i)
167 AddPct(xp, (*i)->GetAmount());
168
169
173
174 pet->GivePetXP(
_group ? xp / 2 : xp);
175 }
176}
T AddPct(T &base, U pct)
Definition: Util.h:67
@ SPELL_AURA_MOD_XP_PCT
Definition: SpellAuraDefines.h:263
Pet * GetPet() const
Definition: Player.cpp:8939
void GiveXP(uint32 xp, Unit *victim, float group_rate=1.0f, bool isLFGReward=false)
Definition: Player.cpp:2395
AuraEffectList const & GetAuraEffectsByType(AuraType type) const
Definition: Unit.h:1349
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:646
References _group, _groupRate, _isFullXP, _maxNotGrayMember, _victim, _xp, AddPct(), Unit::GetAuraEffectsByType(), Unit::GetLevel(), Player::GetPet(), Player::GiveXP(), Unit::IsAlive(), SPELL_AURA_MOD_XP_PCT, and sScriptMgr.
Referenced by _RewardPlayer().
◆ GetKiller()
Player * KillRewarder::GetKiller |
( |
| ) |
|
◆ GetVictim()
Unit * KillRewarder::GetVictim |
( |
| ) |
|
◆ Reward()
void KillRewarder::Reward |
( |
| ) |
|
269{
270
272
274 else
275 {
276
277
279
280
281
283
286 }
287
288
290 if (victim->IsDungeonBoss())
293}
@ ENCOUNTER_CREDIT_KILL_CREATURE
Definition: Map.h:306
uint32 GetEntry() const
Definition: Object.h:115
Map * FindMap() const
Definition: Object.h:537
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1296
void _RewardGroup()
Definition: KillRewarder.cpp:229
References _group, _InitXP(), _isBattleGround, _killer, _RewardGroup(), _RewardPlayer(), _victim, _xp, ENCOUNTER_CREDIT_KILL_CREATURE, WorldObject::FindMap(), Object::GetEntry(), WorldObject::IsInMap(), and Object::ToCreature().
Referenced by Player::RewardPlayerAndGroupAtKill().
◆ _aliveSumLevel
uint32 KillRewarder::_aliveSumLevel |
|
private |
◆ _count
◆ _group
Group* KillRewarder::_group |
|
private |
◆ _groupRate
float KillRewarder::_groupRate |
|
private |
◆ _isBattleGround
bool KillRewarder::_isBattleGround |
|
private |
◆ _isFullXP
bool KillRewarder::_isFullXP |
|
private |
◆ _isPvP
bool KillRewarder::_isPvP |
|
private |
◆ _killer
◆ _maxLevel
uint8 KillRewarder::_maxLevel |
|
private |
◆ _maxNotGrayMember
Player* KillRewarder::_maxNotGrayMember |
|
private |
◆ _sumLevel
uint32 KillRewarder::_sumLevel |
|
private |
◆ _victim
Unit* KillRewarder::_victim |
|
private |
◆ _xp