Cleaned up item flags: separated item proto flags and item field flags

Implemented use of:
ITEM_PROTO_FLAG_PROSPECTABLE and ITEM_PROTO_FLAG_MILLABLE now checked instead of bag family mask
ITEM_PROTO_FLAG_SMART_LOOT for profession recipes, player has to have skillline and not know the recipe
ITEM_PROTO_FLAG_OPENABLE item has to have it set to use item_loot_template
ITEM_PROTO_FLAG_NOT_USEABLE_IN_ARENA if this is set item can never be used in arena
ITEM_FLAG_UNLOCKED marks unlocked items

Simplified BoA check for mail sending
Stackable items are no longer refundable
Removed useless code that always set ITEM_FIELD_FLAGS equal to proto flags
Unlocking items (lockpicking) is now blizzlike

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-08-04 10:34:30 +02:00
parent 846aa12260
commit b7d34dcb53
15 changed files with 185 additions and 140 deletions
+23 -10
View File
@@ -4469,7 +4469,7 @@ void Spell::TakeReagents()
return;
// do not take reagents for these item casts
if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST)
if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return;
Player* p_caster = (Player*)m_caster;
@@ -5235,12 +5235,25 @@ SpellCastResult Spell::CheckCast(bool strict)
m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT_ITEM)
break;
uint32 spellId = m_spellInfo->Id;
if (m_caster->GetTypeId() != TYPEID_PLAYER // only players can open locks, gather etc.
// we need a go target in case of TARGET_GAMEOBJECT
|| m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT && !m_targets.getGOTarget()
// we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM
|| m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_ITEM && !m_targets.getGOTarget() &&
(!m_targets.getItemTarget() || !m_targets.getItemTarget()->GetProto()->LockID || m_targets.getItemTarget()->GetOwner() != m_caster))
|| m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT && !m_targets.getGOTarget())
return SPELL_FAILED_BAD_TARGETS;
Item *pTempItem = NULL;
if (m_targets.getTargetMask() & TARGET_FLAG_TRADE_ITEM)
{
if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData())
pTempItem = pTrade->GetTraderData()->GetItem(TradeSlots(m_targets.getItemTargetGUID()));
}
else if (m_targets.getTargetMask() & TARGET_FLAG_ITEM)
pTempItem = m_caster->ToPlayer()->GetItemByGuid(m_targets.getItemTargetGUID());
// we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM
if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_ITEM &&
!m_targets.getGOTarget() &&
(!pTempItem || !pTempItem->GetProto()->LockID || !pTempItem->IsLocked()))
return SPELL_FAILED_BAD_TARGETS;
if (m_spellInfo->Id != 1842 || m_targets.getGOTarget() &&
@@ -5588,7 +5601,7 @@ SpellCastResult Spell::CheckCast(bool strict)
TradeSlots slot = TradeSlots(m_targets.getItemTargetGUID());
if (slot != TRADE_SLOT_NONTRADED)
return SPELL_FAILED_ITEM_NOT_READY;
return SPELL_FAILED_BAD_TARGETS;
if (!m_IsTriggeredSpell)
if (my_trade->GetSpell())
@@ -5998,7 +6011,7 @@ SpellCastResult Spell::CheckItems()
}
// do not take reagents for these item casts
if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST))
if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST))
{
// check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case.
if (!m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo))
@@ -6110,7 +6123,7 @@ SpellCastResult Spell::CheckItems()
if (m_targets.getItemTarget()->GetOwner() != m_caster)
return SPELL_FAILED_NOT_TRADEABLE;
// do not allow to enchant vellum from scroll made by vellum-prevent exploit
if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST)
if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return SPELL_FAILED_TOTEM_CATEGORY;
ItemPosCountVec dest;
uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1);
@@ -6193,7 +6206,7 @@ SpellCastResult Spell::CheckItems()
if (!m_targets.getItemTarget())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//ensure item is a prospectable ore
if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS)
if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_PROTO_FLAG_PROSPECTABLE))
return SPELL_FAILED_CANT_BE_PROSPECTED;
//prevent prospecting in trade slot
if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
@@ -6216,7 +6229,7 @@ SpellCastResult Spell::CheckItems()
if (!m_targets.getItemTarget())
return SPELL_FAILED_CANT_BE_MILLED;
//ensure item is a millable herb
if (!(m_targets.getItemTarget()->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS) || m_targets.getItemTarget()->GetProto()->Class != ITEM_CLASS_TRADE_GOODS)
if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_PROTO_FLAG_MILLABLE))
return SPELL_FAILED_CANT_BE_MILLED;
//prevent milling in trade slot
if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
+7 -4
View File
@@ -3254,7 +3254,10 @@ void Spell::EffectOpenLock(uint32 effIndex)
return;
}
SendLoot(guid, LOOT_SKINNING);
if (gameObjTarget)
SendLoot(guid, LOOT_SKINNING);
else
itemTarget->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED);
// not allow use skill grow at item base open
if (!m_CastItem && skillId != SKILL_NONE)
@@ -3885,7 +3888,7 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx)
else
{
// do not increase skill if vellum used
if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_FLAGS_TRIGGERED_CAST))
if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST))
p_caster->UpdateCraftSkill(m_spellInfo->Id);
uint32 enchant_id = m_spellInfo->EffectMiscValue[effect_idx];
@@ -7271,7 +7274,7 @@ void Spell::EffectProspecting(uint32 /*i*/)
return;
Player* p_caster = (Player*)m_caster;
if (!itemTarget || !(itemTarget->GetProto()->BagFamily & BAG_FAMILY_MASK_MINING_SUPP))
if (!itemTarget || !(itemTarget->GetProto()->Flags & ITEM_PROTO_FLAG_PROSPECTABLE))
return;
if (itemTarget->GetCount() < 5)
@@ -7293,7 +7296,7 @@ void Spell::EffectMilling(uint32 /*i*/)
return;
Player* p_caster = (Player*)m_caster;
if (!itemTarget || !(itemTarget->GetProto()->BagFamily & BAG_FAMILY_MASK_HERBS))
if (!itemTarget || !(itemTarget->GetProto()->Flags & ITEM_PROTO_FLAG_MILLABLE))
return;
if (itemTarget->GetCount() < 5)