Mage 400 INTO master/434

Signed-off-by: Salja <salja2012@hotmail.de>
This commit is contained in:
Salja 2012-08-05 13:30:05 +02:00 committed by Antz
parent 7665a09232
commit 22bfaa12b0
66 changed files with 5773 additions and 3971 deletions

View file

@ -230,6 +230,132 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
return false;
}
uint32 ItemPrototype::GetArmor() const
{
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
return 0;
if (Class == ITEM_CLASS_ARMOR && SubClass == ITEM_SUBCLASS_ARMOR_SHIELD)
{
if (ItemArmorShieldEntry const* ias = sItemArmorShieldStore.LookupEntry(ItemLevel))
{
return uint32(floor(ias->Value[Quality] + 0.5f));
}
return 0;
}
ItemArmorQualityEntry const* iaq = sItemArmorQualityStore.LookupEntry(ItemLevel);
ItemArmorTotalEntry const* iat = sItemArmorTotalStore.LookupEntry(ItemLevel);
if (!iaq || !iat)
return 0;
if (InventoryType != INVTYPE_HEAD && InventoryType != INVTYPE_CHEST && InventoryType != INVTYPE_SHOULDERS &&
InventoryType != INVTYPE_LEGS && InventoryType != INVTYPE_FEET && InventoryType != INVTYPE_WRISTS &&
InventoryType != INVTYPE_HANDS && InventoryType != INVTYPE_WAIST && InventoryType != INVTYPE_CLOAK &&
InventoryType != INVTYPE_ROBE)
return 0;
ArmorLocationEntry const* al = NULL;
if (InventoryType == INVTYPE_ROBE)
al = sArmorLocationStore.LookupEntry(INVTYPE_CHEST);
else
al = sArmorLocationStore.LookupEntry(InventoryType);
if (!al)
return 0;
float iatMult, alMult;
switch (SubClass)
{
case ITEM_SUBCLASS_ARMOR_CLOTH:
iatMult = iat->Value[0];
alMult = al->Value[0];
break;
case ITEM_SUBCLASS_ARMOR_LEATHER:
iatMult = iat->Value[1];
alMult = al->Value[1];
break;
case ITEM_SUBCLASS_ARMOR_MAIL:
iatMult = iat->Value[2];
alMult = al->Value[2];
break;
case ITEM_SUBCLASS_ARMOR_PLATE:
iatMult = iat->Value[3];
alMult = al->Value[3];
break;
default:
return 0;
}
return uint32(floor(iaq->Value[Quality] * iatMult * alMult + 0.5f));
}
float ItemPrototype::getDPS() const
{
float damage = 0.0f;
if (Class == ITEM_CLASS_WEAPON)
{
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
return damage;
ItemDamageEntry const* id = NULL;
switch (InventoryType)
{
case INVTYPE_WEAPON:
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
id = sItemDamageOneHandCasterStore.LookupEntry(ItemLevel);
else
id = sItemDamageOneHandStore.LookupEntry(ItemLevel);
break;
case INVTYPE_2HWEAPON:
if (Flags2 & ITEM_FLAG2_CASTER_WEAPON) // caster weapon flag
id = sItemDamageTwoHandCasterStore.LookupEntry(ItemLevel);
else
id = sItemDamageTwoHandStore.LookupEntry(ItemLevel);
break;
case INVTYPE_AMMO:
id = sItemDamageAmmoStore.LookupEntry(ItemLevel);
break;
case INVTYPE_RANGED:
case INVTYPE_THROWN:
case INVTYPE_RANGEDRIGHT:
switch (SubClass)
{
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
id = sItemDamageRangedStore.LookupEntry(ItemLevel);
break;
case ITEM_SUBCLASS_WEAPON_THROWN:
id = sItemDamageThrownStore.LookupEntry(ItemLevel);
break;
case ITEM_SUBCLASS_WEAPON_WAND:
id = sItemDamageWandStore.LookupEntry(ItemLevel);
break;
default:
break;
}
break;
default:
break;
}
if (!id)
return damage;
return id->Value[Quality];
}
return damage;
}
Item::Item()
{
m_objectType |= TYPEMASK_ITEM;
@ -883,25 +1009,35 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
{
ItemPrototype const* proto = GetProto();
SpellEquippedItemsEntry const* equippedItems = spellInfo->GetSpellEquippedItems();
if (!equippedItems)
return true;
// Enchant spells only use Effect[0] (patch 3.3.2)
if (proto->IsVellum() && spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_ENCHANT_ITEM)
if (proto->IsVellum())
{
// EffectItemType[0] is the associated scroll itemID, if a scroll can be made
if (spellInfo->EffectItemType[EFFECT_INDEX_0] == 0)
return false;
// Other checks do not apply to vellum enchants, so return final result
return ((proto->SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT && spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON) ||
(proto->SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT && spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR));
SpellEffectEntry const* spellEffect_0 = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
if (spellEffect_0 && spellEffect_0->Effect == SPELL_EFFECT_ENCHANT_ITEM)
{
// EffectItemType[0] is the associated scroll itemID, if a scroll can be made
if (spellEffect_0->EffectItemType == 0)
return false;
// Other checks do not apply to vellum enchants, so return final result
int32 eqItemClass = spellInfo->GetEquippedItemClass();
return ((proto->SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT && eqItemClass == ITEM_CLASS_WEAPON) ||
(proto->SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT && eqItemClass == ITEM_CLASS_ARMOR));
}
}
if (spellInfo->EquippedItemClass != -1) // -1 == any item class
if (equippedItems->EquippedItemClass != -1) // -1 == any item class
{
if (spellInfo->EquippedItemClass != int32(proto->Class))
if (equippedItems->EquippedItemClass != int32(proto->Class))
return false; // wrong item class
if (spellInfo->EquippedItemSubClassMask != 0) // 0 == any subclass
if (equippedItems->EquippedItemSubClassMask != 0) // 0 == any subclass
{
if ((spellInfo->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0)
if ((equippedItems->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0)
return false; // subclass not present in mask
}
}
@ -909,9 +1045,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
// Only check for item enchantments (TARGET_FLAG_ITEM), all other spells are either NPC spells
// or spells where slot requirements are already handled with AttributesEx3 fields
// and special code (Titan's Grip, Windfury Attack). Check clearly not applicable for Lava Lash.
if (spellInfo->EquippedItemInventoryTypeMask != 0 && (spellInfo->Targets & TARGET_FLAG_ITEM)) // 0 == any inventory type
if (equippedItems->EquippedItemInventoryTypeMask != 0 && (spellInfo->GetTargets() & TARGET_FLAG_ITEM)) // 0 == any inventory type
{
if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
if ((equippedItems->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
return false; // inventory type not present in mask
}