Remove some "_" from private methods as required by TC standards. Thanks to Shauren for pointing out.
This commit is contained in:
@@ -180,7 +180,7 @@ void PetAI::UpdateAI(const uint32 diff)
|
||||
if (!spellUsed)
|
||||
delete spell;
|
||||
}
|
||||
else if (me->getVictim() && _CanAttack(me->getVictim()) && spellInfo->CanBeUsedInCombat())
|
||||
else if (me->getVictim() && CanAttack(me->getVictim()) && spellInfo->CanBeUsedInCombat())
|
||||
{
|
||||
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
|
||||
if (spell->CanAutoCast(me->getVictim()))
|
||||
@@ -290,7 +290,7 @@ void PetAI::AttackStart(Unit* target)
|
||||
// Overrides Unit::AttackStart to correctly evaluate Pet states
|
||||
|
||||
// Check all pet states to decide if we can attack this target
|
||||
if (!_CanAttack(target))
|
||||
if (!CanAttack(target))
|
||||
return;
|
||||
|
||||
targetHasCC = _CheckTargetCC(target);
|
||||
@@ -440,7 +440,7 @@ void PetAI::MovementInform(uint32 moveType, uint32 data)
|
||||
}
|
||||
}
|
||||
|
||||
bool PetAI::_CanAttack(Unit* target)
|
||||
bool PetAI::CanAttack(Unit* target)
|
||||
{
|
||||
// Evaluates wether a pet can attack a specific
|
||||
// target based on CommandState, ReactState and other flags
|
||||
|
||||
@@ -57,7 +57,7 @@ class PetAI : public CreatureAI
|
||||
Unit* SelectNextTarget();
|
||||
void HandleReturnMovement();
|
||||
void DoAttack(Unit* target, bool chase);
|
||||
bool _CanAttack(Unit* target);
|
||||
bool CanAttack(Unit* target);
|
||||
bool _CheckTargetCC(Unit* target);
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -1394,7 +1394,7 @@ bool Creature::IsInvisibleDueToDespawn() const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Creature::_CanAlwaysSee(WorldObject const* obj) const
|
||||
bool Creature::CanAlwaysSee(WorldObject const* obj) const
|
||||
{
|
||||
if (IsAIEnabled && AI()->CanSeeAlways(obj))
|
||||
return true;
|
||||
|
||||
@@ -753,7 +753,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
|
||||
uint32 guid_transport;
|
||||
|
||||
bool IsInvisibleDueToDespawn() const;
|
||||
bool _CanAlwaysSee(WorldObject const* obj) const;
|
||||
bool CanAlwaysSee(WorldObject const* obj) const;
|
||||
private:
|
||||
//WaypointMovementGenerator vars
|
||||
uint32 m_waypointID;
|
||||
|
||||
@@ -1630,10 +1630,10 @@ bool WorldObject::canSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
if (obj->IsNeverVisible() || _CanNeverSee(obj))
|
||||
if (obj->IsNeverVisible() || CanNeverSee(obj))
|
||||
return false;
|
||||
|
||||
if (obj->IsAlwaysVisibleFor(this) || _CanAlwaysSee(obj))
|
||||
if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
|
||||
return true;
|
||||
|
||||
bool corpseCheck = false;
|
||||
@@ -1690,13 +1690,13 @@ bool WorldObject::canSeeOrDetect(WorldObject const* obj, bool ignoreStealth, boo
|
||||
if (obj->IsInvisibleDueToDespawn())
|
||||
return false;
|
||||
|
||||
if (!_CanDetect(obj, ignoreStealth))
|
||||
if (!CanDetect(obj, ignoreStealth))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WorldObject::_CanDetect(WorldObject const* obj, bool ignoreStealth) const
|
||||
bool WorldObject::CanDetect(WorldObject const* obj, bool ignoreStealth) const
|
||||
{
|
||||
const WorldObject* seer = this;
|
||||
|
||||
@@ -1708,16 +1708,16 @@ bool WorldObject::_CanDetect(WorldObject const* obj, bool ignoreStealth) const
|
||||
if (obj->IsAlwaysDetectableFor(seer))
|
||||
return true;
|
||||
|
||||
if (!seer->_CanDetectInvisibilityOf(obj))
|
||||
if (!seer->CanDetectInvisibilityOf(obj))
|
||||
return false;
|
||||
|
||||
if (!ignoreStealth && !seer->_CanDetectStealthOf(obj))
|
||||
if (!ignoreStealth && !seer->CanDetectStealthOf(obj))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WorldObject::_CanDetectInvisibilityOf(WorldObject const* obj) const
|
||||
bool WorldObject::CanDetectInvisibilityOf(WorldObject const* obj) const
|
||||
{
|
||||
uint32 mask = obj->m_invisibility.GetFlags() & m_invisibilityDetect.GetFlags();
|
||||
|
||||
@@ -1748,7 +1748,7 @@ bool WorldObject::_CanDetectInvisibilityOf(WorldObject const* obj) const
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WorldObject::_CanDetectStealthOf(WorldObject const* obj) const
|
||||
bool WorldObject::CanDetectStealthOf(WorldObject const* obj) const
|
||||
{
|
||||
// Combat reach is the minimal distance (both in front and behind),
|
||||
// and it is also used in the range calculation.
|
||||
|
||||
@@ -729,11 +729,6 @@ class WorldObject : public Object, public WorldLocation
|
||||
virtual void SaveRespawnTime() {}
|
||||
void AddObjectToRemoveList();
|
||||
|
||||
virtual bool IsAlwaysVisibleFor(WorldObject const* /*seer*/) const { return false; }
|
||||
virtual bool IsInvisibleDueToDespawn() const { return false; }
|
||||
//difference from IsAlwaysVisibleFor: 1. after distance check; 2. use owner or charmer as seer
|
||||
virtual bool IsAlwaysDetectableFor(WorldObject const* /*seer*/) const { return false; }
|
||||
|
||||
float GetGridActivationRange() const;
|
||||
float GetVisibilityRange() const;
|
||||
float GetSightRange(const WorldObject* target = NULL) const;
|
||||
@@ -840,6 +835,10 @@ class WorldObject : public Object, public WorldLocation
|
||||
void SetLocationInstanceId(uint32 _instanceId) { m_InstanceId = _instanceId; }
|
||||
|
||||
virtual bool IsNeverVisible() const { return !IsInWorld(); }
|
||||
virtual bool IsAlwaysVisibleFor(WorldObject const* /*seer*/) const { return false; }
|
||||
virtual bool IsInvisibleDueToDespawn() const { return false; }
|
||||
//difference from IsAlwaysVisibleFor: 1. after distance check; 2. use owner or charmer as seer
|
||||
virtual bool IsAlwaysDetectableFor(WorldObject const* /*seer*/) const { return false; }
|
||||
private:
|
||||
Map* m_currMap; //current object's Map location
|
||||
|
||||
@@ -852,11 +851,11 @@ class WorldObject : public Object, public WorldLocation
|
||||
|
||||
virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const;
|
||||
|
||||
bool _CanNeverSee(WorldObject const* obj) const { return GetMap() != obj->GetMap() || !InSamePhase(obj); }
|
||||
virtual bool _CanAlwaysSee(WorldObject const* /*obj*/) const { return false; }
|
||||
bool _CanDetect(WorldObject const* obj, bool ignoreStealth) const;
|
||||
bool _CanDetectInvisibilityOf(WorldObject const* obj) const;
|
||||
bool _CanDetectStealthOf(WorldObject const* obj) const;
|
||||
bool CanNeverSee(WorldObject const* obj) const { return GetMap() != obj->GetMap() || !InSamePhase(obj); }
|
||||
virtual bool CanAlwaysSee(WorldObject const* /*obj*/) const { return false; }
|
||||
bool CanDetect(WorldObject const* obj, bool ignoreStealth) const;
|
||||
bool CanDetectInvisibilityOf(WorldObject const* obj) const;
|
||||
bool CanDetectStealthOf(WorldObject const* obj) const;
|
||||
};
|
||||
|
||||
namespace Trinity
|
||||
|
||||
@@ -10408,7 +10408,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32
|
||||
return false;
|
||||
}
|
||||
|
||||
InventoryResult Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const
|
||||
InventoryResult Player::CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const
|
||||
{
|
||||
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry);
|
||||
if (!pProto)
|
||||
@@ -10492,7 +10492,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const
|
||||
return false;
|
||||
}
|
||||
|
||||
InventoryResult Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const
|
||||
InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const
|
||||
{
|
||||
Item* pItem2 = GetItemByPos(bag, slot);
|
||||
|
||||
@@ -10566,9 +10566,9 @@ InventoryResult Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, Item
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
|
||||
InventoryResult Player::CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
|
||||
{
|
||||
// skip specific bag already processed in first called _CanStoreItem_InBag
|
||||
// skip specific bag already processed in first called CanStoreItem_InBag
|
||||
if (bag == skip_bag)
|
||||
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
|
||||
|
||||
@@ -10593,7 +10593,7 @@ InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, It
|
||||
|
||||
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
|
||||
{
|
||||
// skip specific slot already processed in first called _CanStoreItem_InSpecificSlot
|
||||
// skip specific slot already processed in first called CanStoreItem_InSpecificSlot
|
||||
if (j == skip_slot)
|
||||
continue;
|
||||
|
||||
@@ -10636,7 +10636,7 @@ InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, It
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
|
||||
InventoryResult Player::CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
|
||||
{
|
||||
//this is never called for non-bag slots so we can do this
|
||||
if (pSrcItem && pSrcItem->IsNotEmptyBag())
|
||||
@@ -10644,7 +10644,7 @@ InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 s
|
||||
|
||||
for (uint32 j = slot_begin; j < slot_end; j++)
|
||||
{
|
||||
// skip specific slot already processed in first called _CanStoreItem_InSpecificSlot
|
||||
// skip specific slot already processed in first called CanStoreItem_InSpecificSlot
|
||||
if (INVENTORY_SLOT_BAG_0 == skip_bag && j == skip_slot)
|
||||
continue;
|
||||
|
||||
@@ -10687,7 +10687,7 @@ InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 s
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item* pItem, bool swap, uint32* no_space_count) const
|
||||
InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item* pItem, bool swap, uint32* no_space_count) const
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count);
|
||||
|
||||
@@ -10719,7 +10719,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
|
||||
// check count of items (skip for auto move for same player from bank)
|
||||
uint32 no_similar_count = 0; // can't store this amount similar items
|
||||
InventoryResult res = _CanTakeMoreSimilarItems(entry, count, pItem, &no_similar_count);
|
||||
InventoryResult res = CanTakeMoreSimilarItems(entry, count, pItem, &no_similar_count);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (count == no_similar_count)
|
||||
@@ -10734,7 +10734,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
// in specific slot
|
||||
if (bag != NULL_BAG && slot != NULL_SLOT)
|
||||
{
|
||||
res = _CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
|
||||
res = CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10763,7 +10763,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
{
|
||||
if (bag == INVENTORY_SLOT_BAG_0) // inventory
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10781,7 +10781,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
|
||||
res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10802,9 +10802,9 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
else // equipped bag
|
||||
{
|
||||
// we need check 2 time (specialized/non_specialized), use NULL_BAG to prevent skipping bag
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
|
||||
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
@@ -10832,7 +10832,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
|
||||
{
|
||||
uint32 keyringSize = GetMaxKeyringSize();
|
||||
res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START+keyringSize, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START+keyringSize, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10850,7 +10850,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
|
||||
res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10870,7 +10870,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
}
|
||||
else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10889,7 +10889,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
}
|
||||
}
|
||||
|
||||
res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10909,9 +10909,9 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
}
|
||||
else // equipped bag
|
||||
{
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
|
||||
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
@@ -10937,7 +10937,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
// search stack for merge to
|
||||
if (pProto->Stackable != 1)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10955,7 +10955,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
|
||||
res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -10977,7 +10977,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
{
|
||||
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -10995,7 +10995,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
|
||||
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -11017,7 +11017,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
if (pProto->BagFamily & BAG_FAMILY_MASK_KEYS)
|
||||
{
|
||||
uint32 keyringSize = GetMaxKeyringSize();
|
||||
res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START+keyringSize, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(KEYRING_SLOT_START, KEYRING_SLOT_START+keyringSize, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -11037,7 +11037,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
}
|
||||
else if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START, CURRENCYTOKEN_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -11058,7 +11058,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
|
||||
for (uint32 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -11078,7 +11078,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
return EQUIP_ERR_NONEMPTY_BAG_OVER_OTHER_BAG;
|
||||
|
||||
// search free slot
|
||||
res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, INVENTORY_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
{
|
||||
if (no_space_count)
|
||||
@@ -11098,7 +11098,7 @@ InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &de
|
||||
|
||||
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -11597,7 +11597,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
return res;
|
||||
}
|
||||
|
||||
res = _CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
|
||||
res = CanStoreItem_InSpecificSlot(bag, slot, dest, pProto, count, swap, pItem);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
|
||||
@@ -11618,7 +11618,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
{
|
||||
if (bag == INVENTORY_SLOT_BAG_0)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
|
||||
@@ -11627,9 +11627,9 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
}
|
||||
else
|
||||
{
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, true, false, pItem, NULL_BAG, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, true, true, pItem, NULL_BAG, slot);
|
||||
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
@@ -11642,7 +11642,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
// search free slot in bag
|
||||
if (bag == INVENTORY_SLOT_BAG_0)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
|
||||
@@ -11651,9 +11651,9 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
}
|
||||
else
|
||||
{
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, false, false, pItem, NULL_BAG, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
res = _CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
|
||||
res = CanStoreItem_InBag(bag, dest, pProto, count, false, true, pItem, NULL_BAG, slot);
|
||||
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
@@ -11669,7 +11669,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
if (pProto->Stackable != 1)
|
||||
{
|
||||
// in slots
|
||||
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
|
||||
@@ -11681,7 +11681,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
{
|
||||
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -11692,7 +11692,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
|
||||
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -11706,7 +11706,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
{
|
||||
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, false, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -11716,7 +11716,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
}
|
||||
|
||||
// search free space
|
||||
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
return res;
|
||||
|
||||
@@ -11725,7 +11725,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest
|
||||
|
||||
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
|
||||
{
|
||||
res = _CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
|
||||
res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
|
||||
if (res != EQUIP_ERR_OK)
|
||||
continue;
|
||||
|
||||
@@ -21088,7 +21088,7 @@ bool Player::IsNeverVisible() const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Player::_CanAlwaysSee(WorldObject const* obj) const
|
||||
bool Player::CanAlwaysSee(WorldObject const* obj) const
|
||||
{
|
||||
// Always can see self
|
||||
if (m_mover == obj)
|
||||
|
||||
@@ -1242,18 +1242,18 @@ class Player : public Unit, public GridObject<Player>
|
||||
bool CanNoReagentCast(SpellInfo const* spellInfo) const;
|
||||
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
|
||||
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
|
||||
InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); }
|
||||
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry, count, NULL); }
|
||||
InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return CanTakeMoreSimilarItems(pItem->GetEntry(), pItem->GetCount(), pItem); }
|
||||
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return CanTakeMoreSimilarItems(entry, count, NULL); }
|
||||
InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const
|
||||
{
|
||||
return _CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count);
|
||||
return CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count);
|
||||
}
|
||||
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const
|
||||
{
|
||||
if (!pItem)
|
||||
return EQUIP_ERR_ITEM_NOT_FOUND;
|
||||
uint32 count = pItem->GetCount();
|
||||
return _CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
|
||||
return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
|
||||
|
||||
}
|
||||
InventoryResult CanStoreItems(Item** pItem, int count) const;
|
||||
@@ -1280,8 +1280,8 @@ class Player : public Unit, public GridObject<Player>
|
||||
void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG, NULL_SLOT, loot_id, store, broadcast); }
|
||||
void StoreLootItem(uint8 lootSlot, Loot* loot);
|
||||
|
||||
InventoryResult _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
|
||||
InventoryResult _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
|
||||
InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const;
|
||||
InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const;
|
||||
|
||||
void AddRefundReference(uint32 it);
|
||||
void DeleteRefundReference(uint32 it);
|
||||
@@ -2734,7 +2734,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
Runes *m_runes;
|
||||
EquipmentSets m_EquipmentSets;
|
||||
|
||||
bool _CanAlwaysSee(WorldObject const* obj) const;
|
||||
bool CanAlwaysSee(WorldObject const* obj) const;
|
||||
|
||||
bool IsAlwaysDetectableFor(WorldObject const* seer) const;
|
||||
|
||||
@@ -2742,9 +2742,9 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
private:
|
||||
// internal common parts for CanStore/StoreItem functions
|
||||
InventoryResult _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
|
||||
InventoryResult _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||
InventoryResult _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||
InventoryResult CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const;
|
||||
InventoryResult CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||
InventoryResult CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
|
||||
Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update);
|
||||
Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields);
|
||||
|
||||
|
||||
@@ -762,7 +762,7 @@ bool Guild::MoveItemData::CheckItem(uint32& splitedAmount)
|
||||
bool Guild::MoveItemData::CanStore(Item* pItem, bool swap, bool sendError)
|
||||
{
|
||||
m_vec.clear();
|
||||
InventoryResult msg = _CanStore(pItem, swap);
|
||||
InventoryResult msg = CanStore(pItem, swap);
|
||||
if (sendError && msg != EQUIP_ERR_OK)
|
||||
m_pPlayer->SendEquipError(msg, pItem);
|
||||
return (msg == EQUIP_ERR_OK);
|
||||
@@ -850,7 +850,7 @@ void Guild::PlayerMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData
|
||||
pFrom->GetItem()->GetEntry(), count);
|
||||
}
|
||||
|
||||
inline InventoryResult Guild::PlayerMoveItemData::_CanStore(Item* pItem, bool swap)
|
||||
inline InventoryResult Guild::PlayerMoveItemData::CanStore(Item* pItem, bool swap)
|
||||
{
|
||||
return m_pPlayer->CanStoreItem(m_container, m_slotId, m_vec, pItem, swap);
|
||||
}
|
||||
@@ -1002,11 +1002,11 @@ bool Guild::BankMoveItemData::_ReserveSpace(uint8 slotId, Item* pItem, Item* pIt
|
||||
return true;
|
||||
}
|
||||
|
||||
void Guild::BankMoveItemData::_CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count)
|
||||
void Guild::BankMoveItemData::CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count)
|
||||
{
|
||||
for (uint8 slotId = 0; (slotId < GUILD_BANK_MAX_SLOTS) && (count > 0); ++slotId)
|
||||
{
|
||||
// Skip slot already processed in _CanStore (when destination slot was specified)
|
||||
// Skip slot already processed in CanStore (when destination slot was specified)
|
||||
if (slotId == skipSlotId)
|
||||
continue;
|
||||
|
||||
@@ -1022,7 +1022,7 @@ void Guild::BankMoveItemData::_CanStoreItemInTab(Item* pItem, uint8 skipSlotId,
|
||||
}
|
||||
}
|
||||
|
||||
InventoryResult Guild::BankMoveItemData::_CanStore(Item* pItem, bool swap)
|
||||
InventoryResult Guild::BankMoveItemData::CanStore(Item* pItem, bool swap)
|
||||
{
|
||||
sLog->outDebug(LOG_FILTER_GUILD, "GUILD STORAGE: CanStore() tab = %u, slot = %u, item = %u, count = %u",
|
||||
m_container, m_slotId, pItem->GetEntry(), pItem->GetCount());
|
||||
@@ -1055,13 +1055,13 @@ InventoryResult Guild::BankMoveItemData::_CanStore(Item* pItem, bool swap)
|
||||
// Search for stacks to merge with
|
||||
if (pItem->GetMaxStackCount() > 1)
|
||||
{
|
||||
_CanStoreItemInTab(pItem, m_slotId, true, count);
|
||||
CanStoreItemInTab(pItem, m_slotId, true, count);
|
||||
if (count == 0)
|
||||
return EQUIP_ERR_OK;
|
||||
}
|
||||
|
||||
// Search free slot for item
|
||||
_CanStoreItemInTab(pItem, m_slotId, false, count);
|
||||
CanStoreItemInTab(pItem, m_slotId, false, count);
|
||||
if (count == 0)
|
||||
return EQUIP_ERR_OK;
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ private:
|
||||
uint8 GetContainer() const { return m_container; }
|
||||
uint8 GetSlotId() const { return m_slotId; }
|
||||
protected:
|
||||
virtual InventoryResult _CanStore(Item* pItem, bool swap) = 0;
|
||||
virtual InventoryResult CanStore(Item* pItem, bool swap) = 0;
|
||||
|
||||
Guild* m_pGuild;
|
||||
Player* m_pPlayer;
|
||||
@@ -547,7 +547,7 @@ private:
|
||||
Item* StoreItem(SQLTransaction& trans, Item* pItem);
|
||||
void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const;
|
||||
protected:
|
||||
InventoryResult _CanStore(Item* pItem, bool swap);
|
||||
InventoryResult CanStore(Item* pItem, bool swap);
|
||||
};
|
||||
|
||||
class BankMoveItemData : public MoveItemData
|
||||
@@ -566,12 +566,12 @@ private:
|
||||
void LogAction(MoveItemData* pFrom) const;
|
||||
|
||||
protected:
|
||||
InventoryResult _CanStore(Item* pItem, bool swap);
|
||||
InventoryResult CanStore(Item* pItem, bool swap);
|
||||
|
||||
private:
|
||||
Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const;
|
||||
bool _ReserveSpace(uint8 slotId, Item* pItem, Item* pItemDest, uint32& count);
|
||||
void _CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count);
|
||||
void CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count);
|
||||
};
|
||||
|
||||
typedef UNORDERED_MAP<uint32, Member*> Members;
|
||||
|
||||
Reference in New Issue
Block a user