fix(Core/Player): Prevent looting already looted items (#4420)

This commit is contained in:
Kitzunu
2021-02-05 12:38:44 +01:00
committed by GitHub
parent 8961a2406d
commit 9f47c83c11
+46 -46
View File
@@ -379,7 +379,7 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
SetSpell(0); SetSpell(0);
} }
void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/) void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= nullptr*/)
{ {
uint64 itemGuid = castItem ? castItem->GetGUID() : 0; uint64 itemGuid = castItem ? castItem->GetGUID() : 0;
@@ -1356,7 +1356,7 @@ uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
data << uint32(resist); data << uint32(resist);
SendMessageToSet(&data, true); SendMessageToSet(&data, true);
uint32 final_damage = Unit::DealDamage(this, this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); uint32 final_damage = Unit::DealDamage(this, this, damage, nullptr, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
if (!IsAlive()) if (!IsAlive())
{ {
@@ -1981,7 +1981,7 @@ void Player::setDeathState(DeathState s, bool /*despawn = false*/)
clearResurrectRequestData(); clearResurrectRequestData();
//FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD) //FIXME: is pet dismissed at dying or releasing spirit? if second, add setDeathState(DEAD) to HandleRepopRequestOpcode and define pet unsummon here with (s == DEAD)
RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
// save value before aura remove in Unit::setDeathState // save value before aura remove in Unit::setDeathState
ressSpellId = GetUInt32Value(PLAYER_SELF_RES_SPELL); ressSpellId = GetUInt32Value(PLAYER_SELF_RES_SPELL);
@@ -3174,7 +3174,7 @@ bool Player::IsGroupVisibleFor(Player const* p) const
bool Player::IsInSameGroupWith(Player const* p) const bool Player::IsInSameGroupWith(Player const* p) const
{ {
return p == this || (GetGroup() != NULL && return p == this || (GetGroup() != nullptr &&
GetGroup() == p->GetGroup() && GetGroup() == p->GetGroup() &&
GetGroup()->SameSubGroup(this, p)); GetGroup()->SameSubGroup(this, p));
} }
@@ -3205,7 +3205,7 @@ void Player::UninviteFromGroup()
} }
} }
void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /* = 0 */, const char* reason /* = NULL */) void Player::RemoveFromGroup(Group* group, uint64 guid, RemoveMethod method /* = GROUP_REMOVEMETHOD_DEFAULT*/, uint64 kicker /* = 0 */, const char* reason /* = nullptr */)
{ {
if (group) if (group)
{ {
@@ -4564,7 +4564,7 @@ bool Player::resetTalents(bool noResetCost)
} }
} }
RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true); RemovePet(nullptr, PET_SAVE_NOT_IN_SLOT, true);
// xinef: reset talents // xinef: reset talents
for (PlayerTalentMap::iterator iter = m_talents.begin(); iter != m_talents.end(); ) for (PlayerTalentMap::iterator iter = m_talents.begin(); iter != m_talents.end(); )
@@ -5955,7 +5955,7 @@ float Player::GetMeleeCritFromAgility()
GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1); GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass - 1);
GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
if (critBase == NULL || critRatio == nullptr) if (critBase == nullptr || critRatio == nullptr)
return 0.0f; return 0.0f;
float crit = critBase->base + GetStat(STAT_AGILITY) * critRatio->ratio; float crit = critBase->base + GetStat(STAT_AGILITY) * critRatio->ratio;
@@ -6003,7 +6003,7 @@ void Player::GetDodgeFromAgility(float& diminishing, float& nondiminishing)
// Dodge per agility is proportional to crit per agility, which is available from DBC files // Dodge per agility is proportional to crit per agility, which is available from DBC files
GtChanceToMeleeCritEntry const* dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); GtChanceToMeleeCritEntry const* dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
if (dodgeRatio == NULL || pclass > MAX_CLASSES) if (dodgeRatio == nullptr || pclass > MAX_CLASSES)
return; return;
// TODO: research if talents/effects that increase total agility by x% should increase non-diminishing part // TODO: research if talents/effects that increase total agility by x% should increase non-diminishing part
@@ -6025,7 +6025,7 @@ float Player::GetSpellCritFromIntellect()
GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass - 1); GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass - 1);
GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
if (critBase == NULL || critRatio == nullptr) if (critBase == nullptr || critRatio == nullptr)
return 0.0f; return 0.0f;
float crit = critBase->base + GetStat(STAT_INTELLECT) * critRatio->ratio; float crit = critBase->base + GetStat(STAT_INTELLECT) * critRatio->ratio;
@@ -6077,7 +6077,7 @@ float Player::OCTRegenHPPerSpirit()
GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1); GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass - 1) * GT_MAX_LEVEL + level - 1);
if (baseRatio == NULL || moreRatio == nullptr) if (baseRatio == nullptr || moreRatio == nullptr)
return 0.0f; return 0.0f;
// Formula from PaperDollFrame script // Formula from PaperDollFrame script
@@ -7539,7 +7539,7 @@ void Player::SetArenaPoints(uint32 value)
AddKnownCurrency(ITEM_ARENA_POINTS_ID); AddKnownCurrency(ITEM_ARENA_POINTS_ID);
} }
void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/) void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=nullptr*/)
{ {
int32 newValue = int32(GetHonorPoints()) + value; int32 newValue = int32(GetHonorPoints()) + value;
if (newValue < 0) if (newValue < 0)
@@ -7555,7 +7555,7 @@ void Player::ModifyHonorPoints(int32 value, SQLTransaction* trans /*=NULL*/)
} }
} }
void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=NULL*/) void Player::ModifyArenaPoints(int32 value, SQLTransaction* trans /*=nullptr*/)
{ {
int32 newValue = int32(GetArenaPoints()) + value; int32 newValue = int32(GetArenaPoints()) + value;
if (newValue < 0) if (newValue < 0)
@@ -7941,7 +7941,7 @@ void Player::DuelComplete(DuelCompleteType type)
// Honor points after duel (the winner) - ImpConfig // Honor points after duel (the winner) - ImpConfig
if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL)) if (uint32 amount = sWorld->getIntConfig(CONFIG_HONOR_AFTER_DUEL))
duel->opponent->RewardHonor(NULL, 1, amount); duel->opponent->RewardHonor(nullptr, 1, amount);
break; break;
default: default:
@@ -8590,8 +8590,8 @@ void Player::UpdateEquipSpellsAtFormChange()
if (!spellInfo) if (!spellInfo)
continue; continue;
ApplyEquipSpell(spellInfo, NULL, false, true); // remove spells that not fit to form ApplyEquipSpell(spellInfo, nullptr, false, true); // remove spells that not fit to form
ApplyEquipSpell(spellInfo, NULL, true, true); // add spells that fit form but not active ApplyEquipSpell(spellInfo, nullptr, true, true); // add spells that fit form but not active
} }
} }
} }
@@ -12771,7 +12771,7 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
(pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos))) (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
pItem->SetBinding(true); pItem->SetBinding(true);
Bag* pBag = (bag == INVENTORY_SLOT_BAG_0) ? NULL : GetBagByPos(bag); Bag* pBag = (bag == INVENTORY_SLOT_BAG_0) ? nullptr : GetBagByPos(bag);
if (!pBag) if (!pBag)
{ {
m_items[slot] = pItem; m_items[slot] = pItem;
@@ -14012,7 +14012,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
EquipItem(eDest2, pDstItem, true); EquipItem(eDest2, pDstItem, true);
// Xinef: Call this here after all needed items are equipped // Xinef: Call this here after all needed items are equipped
RemoveItemDependentAurasAndCasts((Item*)NULL); RemoveItemDependentAurasAndCasts((Item*)nullptr);
// if player is moving bags and is looting an item inside this bag // if player is moving bags and is looting an item inside this bag
// release the loot // release the loot
@@ -16090,7 +16090,7 @@ void Player::RewardQuest(Quest const* quest, uint32 reward, Object* questGiver,
// honor reward // honor reward
if (uint32 honor = quest->CalculateHonorGain(getLevel())) if (uint32 honor = quest->CalculateHonorGain(getLevel()))
RewardHonor(NULL, 0, honor); RewardHonor(nullptr, 0, honor);
// title reward // title reward
if (quest->GetCharTitleId()) if (quest->GetCharTitleId())
@@ -18726,7 +18726,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff)
else else
remaincharges = 0; remaincharges = 0;
if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, NULL, &baseDamage[0], NULL, caster_guid)) if (Aura* aura = Aura::TryCreate(spellInfo, effmask, this, nullptr, &baseDamage[0], nullptr, caster_guid))
{ {
if (!aura->CanBeSaved()) if (!aura->CanBeSaved())
{ {
@@ -19499,7 +19499,7 @@ void Player::_LoadGroup()
void Player::BindToInstance() void Player::BindToInstance()
{ {
InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(_pendingBindId); InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(_pendingBindId);
if (!mapSave) //it seems sometimes mapSave is NULL, but I did not check why if (!mapSave) //it seems sometimes mapSave is nullptr, but I did not check why
return; return;
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
@@ -21060,7 +21060,7 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
if (!isAddonMessage) // if not addon data if (!isAddonMessage) // if not addon data
language = LANG_UNIVERSAL; // whispers should always be readable language = LANG_UNIVERSAL; // whispers should always be readable
Player* rPlayer = ObjectAccessor::GetObjectInOrOutOfWorld(receiver, (Player*)NULL); Player* rPlayer = ObjectAccessor::GetObjectInOrOutOfWorld(receiver, (Player*)nullptr);
std::string _text(text); std::string _text(text);
sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, rPlayer); sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, rPlayer);
@@ -21740,7 +21740,7 @@ void Player::SetRestBonus(float rest_bonus_new)
SetUInt32Value(PLAYER_REST_STATE_EXPERIENCE, uint32(_restBonus)); SetUInt32Value(PLAYER_REST_STATE_EXPERIENCE, uint32(_restBonus));
} }
bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= NULL*/, uint32 spellid /*= 1*/) bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= nullptr*/, uint32 spellid /*= 1*/)
{ {
if (nodes.size() < 2) if (nodes.size() < 2)
return false; return false;
@@ -21881,7 +21881,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
// only one mount ID for both sides. Probably not good to use 315 in case DBC nodes // only one mount ID for both sides. Probably not good to use 315 in case DBC nodes
// change but I couldn't find a suitable alternative. OK to use class because only DK // change but I couldn't find a suitable alternative. OK to use class because only DK
// can use this taxi. // can use this taxi.
uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(true), npc == NULL || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT)); uint32 mount_display_id = sObjectMgr->GetTaxiMountDisplayId(sourcenode, GetTeamId(true), npc == nullptr || (sourcenode == 315 && getClass() == CLASS_DEATH_KNIGHT));
// in spell case allow 0 model // in spell case allow 0 model
if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0) if ((mount_display_id == 0 && spellid == 0) || sourcepath == 0)
@@ -21939,7 +21939,7 @@ bool Player::ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid /*= 1*/)
nodes[0] = entry->from; nodes[0] = entry->from;
nodes[1] = entry->to; nodes[1] = entry->to;
return ActivateTaxiPathTo(nodes, NULL, spellid); return ActivateTaxiPathTo(nodes, nullptr, spellid);
} }
void Player::CleanupAfterTaxiFlight() void Player::CleanupAfterTaxiFlight()
@@ -22197,13 +22197,13 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item);
if (!pProto) if (!pProto)
{ {
SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item, 0);
return false; return false;
} }
if (!(pProto->AllowableClass & getClassMask()) && pProto->Bonding == BIND_WHEN_PICKED_UP && !IsGameMaster()) if (!(pProto->AllowableClass & getClassMask()) && pProto->Bonding == BIND_WHEN_PICKED_UP && !IsGameMaster())
{ {
SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); SendBuyError(BUY_ERR_CANT_FIND_ITEM, nullptr, item, 0);
return false; return false;
} }
@@ -22216,7 +22216,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS) #if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)));
#endif #endif
SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0); SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, nullptr, item, 0);
return false; return false;
} }
@@ -22277,14 +22277,14 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
// honor points price // honor points price
if (GetHonorPoints() < (iece->reqhonorpoints * count)) if (GetHonorPoints() < (iece->reqhonorpoints * count))
{ {
SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, NULL, nullptr); SendEquipError(EQUIP_ERR_NOT_ENOUGH_HONOR_POINTS, nullptr, nullptr);
return false; return false;
} }
// arena points price // arena points price
if (GetArenaPoints() < (iece->reqarenapoints * count)) if (GetArenaPoints() < (iece->reqarenapoints * count))
{ {
SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, NULL, nullptr); SendEquipError(EQUIP_ERR_NOT_ENOUGH_ARENA_POINTS, nullptr, nullptr);
return false; return false;
} }
@@ -22293,7 +22293,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
{ {
if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count))) if (iece->reqitem[i] && !HasItemCount(iece->reqitem[i], (iece->reqitemcount[i] * count)))
{ {
SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, NULL, nullptr); SendEquipError(EQUIP_ERR_VENDOR_MISSING_TURNINS, nullptr, nullptr);
return false; return false;
} }
} }
@@ -22302,7 +22302,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
if (GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating) if (GetMaxPersonalArenaRatingRequirement(iece->reqarenaslot) < iece->reqpersonalarenarating)
{ {
// probably not the proper equip err // probably not the proper equip err
SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, NULL, nullptr); SendEquipError(EQUIP_ERR_CANT_EQUIP_RANK, nullptr, nullptr);
return false; return false;
} }
} }
@@ -22337,7 +22337,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
{ {
if (pProto->BuyCount * count != 1) if (pProto->BuyCount * count != 1)
{ {
SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, nullptr); SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, nullptr, nullptr);
return false; return false;
} }
if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false)) if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false))
@@ -22345,7 +22345,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
} }
else else
{ {
SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, NULL, nullptr); SendEquipError(EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT, nullptr, nullptr);
return false; return false;
} }
@@ -22615,7 +22615,7 @@ void Player::ModifySpellCooldown(uint32 spellId, int32 cooldown)
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }
void Player::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= NULL*/, bool setCooldown /*= true*/) void Player::SendCooldownEvent(SpellInfo const* spellInfo, uint32 itemId /*= 0*/, Spell* spell /*= nullptr*/, bool setCooldown /*= true*/)
{ {
// start cooldowns at server side, if any // start cooldowns at server side, if any
if (setCooldown) if (setCooldown)
@@ -23185,7 +23185,7 @@ bool Player::ModifyMoney(int32 amount, bool sendError /*= true*/)
else else
{ {
if (sendError) if (sendError)
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, nullptr); SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, nullptr, nullptr);
return false; return false;
} }
} }
@@ -23290,7 +23290,7 @@ void Player::SetGroup(Group* group, int8 subgroup)
m_group.unlink(); m_group.unlink();
else else
{ {
// never use SetGroup without a subgroup unless you specify NULL for group // never use SetGroup without a subgroup unless you specify nullptr for group
ASSERT(subgroup >= 0); ASSERT(subgroup >= 0);
m_group.link(group, this); m_group.link(group, this);
m_group.setSubGroup((uint8)subgroup); m_group.setSubGroup((uint8)subgroup);
@@ -23415,7 +23415,7 @@ void Player::SendInitialPacketsAfterAddToMap()
if (GetMap()->GetDifficulty() != GetRaidDifficulty()) if (GetMap()->GetDifficulty() != GetRaidDifficulty())
{ {
StoreRaidMapDifficulty(); StoreRaidMapDifficulty();
SendRaidDifficulty(GetGroup() != NULL, GetStoredRaidDifficulty()); SendRaidDifficulty(GetGroup() != nullptr, GetStoredRaidDifficulty());
} }
} }
else if (GetRaidDifficulty() != GetStoredRaidDifficulty()) else if (GetRaidDifficulty() != GetStoredRaidDifficulty())
@@ -24714,7 +24714,7 @@ void Player::SetOriginalGroup(Group* group, int8 subgroup)
m_originalGroup.unlink(); m_originalGroup.unlink();
else else
{ {
// never use SetOriginalGroup without a subgroup unless you specify NULL for group // never use SetOriginalGroup without a subgroup unless you specify nullptr for group
ASSERT(subgroup >= 0); ASSERT(subgroup >= 0);
m_originalGroup.link(group, this); m_originalGroup.link(group, this);
m_originalGroup.setSubGroup((uint8)subgroup); m_originalGroup.setSubGroup((uint8)subgroup);
@@ -24904,7 +24904,7 @@ WorldObject* Player::GetViewpoint() const
bool Player::CanUseBattlegroundObject(GameObject* gameobject) const bool Player::CanUseBattlegroundObject(GameObject* gameobject) const
{ {
// It is possible to call this method will a null pointer, only skipping faction check. // It is possible to call this method will a nullptr pointer, only skipping faction check.
if (gameobject) if (gameobject)
{ {
FactionTemplateEntry const* playerFaction = GetFactionTemplateEntry(); FactionTemplateEntry const* playerFaction = GetFactionTemplateEntry();
@@ -25058,7 +25058,7 @@ void Player::UpdateCharmedAI()
for (AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter) for (AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
if ((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent()) if ((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent())
{ {
Unit::DealDamage(charmer, this, GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); Unit::DealDamage(charmer, this, GetHealth(), nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, nullptr, false);
return; return;
} }
} }
@@ -25104,7 +25104,7 @@ void Player::UpdateCharmedAI()
if (!target || !IsValidAttackTarget(target)) if (!target || !IsValidAttackTarget(target))
{ {
target = SelectNearbyTarget(NULL, 30); target = SelectNearbyTarget(nullptr, 30);
if (!target) if (!target)
{ {
if (!HasUnitState(UNIT_STATE_FOLLOW)) if (!HasUnitState(UNIT_STATE_FOLLOW))
@@ -25362,16 +25362,16 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot)
LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem); LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem);
if (!item) if (!item || item->is_looted)
{ {
SendEquipError(EQUIP_ERR_ALREADY_LOOTED, NULL, nullptr); SendEquipError(EQUIP_ERR_ALREADY_LOOTED, nullptr, nullptr);
return; return;
} }
// Xinef: exploit protection, dont allow to loot normal items if player is not master loot // Xinef: exploit protection, dont allow to loot normal items if player is not master loot
// Xinef: only quest, ffa and conditioned items // Xinef: only quest, ffa and conditioned items
if (!IS_ITEM_GUID(GetLootGUID()) && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid()) if (!IS_ITEM_GUID(GetLootGUID()) && GetGroup() && GetGroup()->GetLootMethod() == MASTER_LOOT && GetGUID() != GetGroup()->GetMasterLooterGuid())
if (qitem == NULL && ffaitem == NULL && conditem == nullptr) if (qitem == nullptr && ffaitem == nullptr && conditem == nullptr)
{ {
SendLootRelease(GetLootGUID()); SendLootRelease(GetLootGUID());
return; return;
@@ -25761,7 +25761,7 @@ void Player::ResetAchievementCriteria(AchievementCriteriaCondition condition, ui
m_achievementMgr->ResetAchievementCriteria(condition, value, evenIfCriteriaComplete); m_achievementMgr->ResetAchievementCriteria(condition, value, evenIfCriteriaComplete);
} }
void Player::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, Unit* unit /*= NULL*/) void Player::UpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscValue1 /*= 0*/, uint32 miscValue2 /*= 0*/, Unit* unit /*= nullptr*/)
{ {
m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit); m_achievementMgr->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit);
} }
@@ -26473,7 +26473,7 @@ void Player::ResetMap()
// after decrement+unlink, ++m_mapRefIter will continue correctly // after decrement+unlink, ++m_mapRefIter will continue correctly
// when the first element of the list is being removed // when the first element of the list is being removed
// nocheck_prev will return the padding element of the RefManager // nocheck_prev will return the padding element of the RefManager
// instead of NULL in the case of prev // instead of nullptr in the case of prev
GetMap()->UpdateIteratorBack(this); GetMap()->UpdateIteratorBack(this);
Unit::ResetMap(); Unit::ResetMap();
GetMapRef().unlink(); GetMapRef().unlink();