aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorSpp <spp@jorge.gr>2012-10-23 13:11:08 +0200
committerSpp <spp@jorge.gr>2012-10-23 13:11:57 +0200
commit663db1cee3ab9bd3de76f210bc7c178f4991953e (patch)
tree13f110026335fd886f64c326af11729009dceaf5 /src/server/game
parent1ff5b836570332a80c7749cf69bbc47f172f7f28 (diff)
Core/Misc: Add default count param to HasItemCount
Diffstat (limited to 'src/server/game')
-rwxr-xr-xsrc/server/game/DungeonFinding/LFGMgr.cpp4
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp8
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h3
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp10
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp2
5 files changed, 13 insertions, 14 deletions
diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp
index 0a2a4b861b8..a1084e8807e 100755
--- a/src/server/game/DungeonFinding/LFGMgr.cpp
+++ b/src/server/game/DungeonFinding/LFGMgr.cpp
@@ -493,10 +493,10 @@ void LFGMgr::InitializeLockedDungeons(Player* player, uint8 level /* = 0 */)
else
if (ar->item)
{
- if (!player->HasItemCount(ar->item, 1) && (!ar->item2 || !player->HasItemCount(ar->item2, 1)))
+ if (!player->HasItemCount(ar->item) && (!ar->item2 || !player->HasItemCount(ar->item2)))
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
}
- else if (ar->item2 && !player->HasItemCount(ar->item2, 1))
+ else if (ar->item2 && !player->HasItemCount(ar->item2))
lockData = LFG_LOCKSTATUS_MISSING_ITEM;
}
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e06463bf0aa..eeb3a49c368 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -18426,11 +18426,11 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
uint32 missingItem = 0;
if (ar->item)
{
- if (!HasItemCount(ar->item, 1) &&
- (!ar->item2 || !HasItemCount(ar->item2, 1)))
+ if (!HasItemCount(ar->item) &&
+ (!ar->item2 || !HasItemCount(ar->item2)))
missingItem = ar->item;
}
- else if (ar->item2 && !HasItemCount(ar->item2, 1))
+ else if (ar->item2 && !HasItemCount(ar->item2))
missingItem = ar->item2;
if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, target_map, this))
@@ -22909,7 +22909,7 @@ uint32 Player::GetResurrectionSpellId()
}
// Reincarnation (passive spell) // prio: 1 // Glyph of Renewed Life
- if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030, 1)))
+ if (prio < 1 && HasSpell(20608) && !HasSpellCooldown(21169) && (HasAura(58059) || HasItemCount(17030)))
spell_id = 21169;
return spell_id;
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 9d80a17bc5e..84f17643d98 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1239,7 +1239,7 @@ class Player : public Unit, public GridObject<Player>
bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos);
uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
- bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const;
+ bool HasItemCount(uint32 item, uint32 count = 1, bool inBankAlso = false) const;
bool HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item const* ignoreItem = NULL);
bool CanNoReagentCast(SpellInfo const* spellInfo) const;
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
@@ -1256,7 +1256,6 @@ class Player : public Unit, public GridObject<Player>
return EQUIP_ERR_ITEM_NOT_FOUND;
uint32 count = pItem->GetCount();
return CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL);
-
}
InventoryResult CanStoreItems(Item** pItem, int count) const;
InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const;
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 295c8216b7f..8790bf035cc 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -5846,7 +5846,7 @@ SpellCastResult Spell::CheckItems()
else
{
uint32 itemid = m_CastItem->GetEntry();
- if (!p_caster->HasItemCount(itemid, 1))
+ if (!p_caster->HasItemCount(itemid))
return SPELL_FAILED_ITEM_NOT_READY;
ItemTemplate const* proto = m_CastItem->GetTemplate();
@@ -5998,7 +5998,7 @@ SpellCastResult Spell::CheckItems()
{
if (m_spellInfo->Totem[i] != 0)
{
- if (p_caster->HasItemCount(m_spellInfo->Totem[i], 1))
+ if (p_caster->HasItemCount(m_spellInfo->Totem[i]))
{
totems -= 1;
continue;
@@ -6053,7 +6053,7 @@ SpellCastResult Spell::CheckItems()
{
if (!(m_spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (m_spellInfo->SpellFamilyFlags[0] & 0x40000000)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
- else if (!(p_caster->HasItemCount(m_spellInfo->Effects[i].ItemType, 1)))
+ else if (!(p_caster->HasItemCount(m_spellInfo->Effects[i].ItemType)))
return SPELL_FAILED_TOO_MANY_OF_ITEM;
else
p_caster->CastSpell(m_caster, m_spellInfo->Effects[EFFECT_1].CalcValue(), false); // move this to anywhere
@@ -6232,7 +6232,7 @@ SpellCastResult Spell::CheckItems()
case ITEM_SUBCLASS_WEAPON_THROWN:
{
uint32 ammo = pItem->GetEntry();
- if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
+ if (!m_caster->ToPlayer()->HasItemCount(ammo))
return SPELL_FAILED_NO_AMMO;
};
break;
@@ -6273,7 +6273,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_AMMO;
}
- if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
+ if (!m_caster->ToPlayer()->HasItemCount(ammo))
{
m_caster->ToPlayer()->SetUInt32Value(PLAYER_AMMO_ID, 0);
return SPELL_FAILED_NO_AMMO;
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index cc032a5895b..1688d3a8e69 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -1778,7 +1778,7 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex)
{
if (item_id)
{
- if (!player->HasItemCount(item_id, 1))
+ if (!player->HasItemCount(item_id))
return;
// remove reagent