Revert "Core: more more cleanup" - Build test anyone?

This reverts commit 20cd4c71ee.
This commit is contained in:
leak
2012-03-14 18:51:51 +01:00
parent b02a012b47
commit 2a5caef4a6
27 changed files with 804 additions and 804 deletions
@@ -2102,9 +2102,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
// and also HandleAuraModDisarm is not triggered
if (!target->CanUseAttackType(BASE_ATTACK))
{
if (Item* item = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
{
target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, item->GetTemplate(), NULL, apply);
target->ToPlayer()->_ApplyWeaponDamage(EQUIPMENT_SLOT_MAINHAND, pItem->GetTemplate(), NULL, apply);
}
}
}
@@ -2536,14 +2536,14 @@ void AuraEffect::HandleAuraModDisarm(AuraApplication const* aurApp, uint8 mode,
// Handle damage modification, shapeshifted druids are not affected
if (target->GetTypeId() == TYPEID_PLAYER && !target->IsInFeralForm())
{
if (Item* item = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
if (Item* pItem = target->ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot))
{
uint8 attacktype = Player::GetAttackBySlot(slot);
if (attacktype < MAX_ATTACK)
{
target->ToPlayer()->_ApplyWeaponDamage(slot, item->GetTemplate(), NULL, !apply);
target->ToPlayer()->_ApplyWeaponDependentAuraMods(item, WeaponAttackType(attacktype), !apply);
target->ToPlayer()->_ApplyWeaponDamage(slot, pItem->GetTemplate(), NULL, !apply);
target->ToPlayer()->_ApplyWeaponDependentAuraMods(pItem, WeaponAttackType(attacktype), !apply);
}
}
}
@@ -4082,8 +4082,8 @@ void AuraEffect::HandleAuraModWeaponCritPercent(AuraApplication const* aurApp, u
return;
for (int i = 0; i < MAX_ATTACK; ++i)
if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(item, WeaponAttackType(i), this, apply);
if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
target->ToPlayer()->_ApplyWeaponDependentAuraCritMod(pItem, WeaponAttackType(i), this, apply);
// mods must be applied base at equipped weapon class and subclass comparison
// with spell->EquippedItemClass and EquippedItemSubClassMask and EquippedItemInventoryTypeMask
@@ -4395,8 +4395,8 @@ void AuraEffect::HandleModDamageDone(AuraApplication const* aurApp, uint8 mode,
if (target->GetTypeId() == TYPEID_PLAYER)
{
for (int i = 0; i < MAX_ATTACK; ++i)
if (Item* item = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(item, WeaponAttackType(i), this, apply);
if (Item* pItem = target->ToPlayer()->GetWeaponForAttack(WeaponAttackType(i), true))
target->ToPlayer()->_ApplyWeaponDependentAuraDamageMod(pItem, WeaponAttackType(i), this, apply);
}
// GetMiscValue() is bitmask of spell schools
+18 -18
View File
@@ -530,8 +530,8 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
if (m_attackType == RANGED_ATTACK)
// wand case
if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
if (Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
m_spellSchoolMask = SpellSchoolMask(1 << item->GetTemplate()->Damage[0].DamageType);
if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType);
if (originalCasterGUID)
m_originalCasterGUID = originalCasterGUID;
@@ -3952,12 +3952,12 @@ void Spell::WriteAmmoToPacket(WorldPacket* data)
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
if (item)
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
if (pItem)
{
ammoInventoryType = item->GetTemplate()->InventoryType;
ammoInventoryType = pItem->GetTemplate()->InventoryType;
if (ammoInventoryType == INVTYPE_THROWN)
ammoDisplayID = item->GetTemplate()->DisplayInfoID;
ammoDisplayID = pItem->GetTemplate()->DisplayInfoID;
else
{
uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
@@ -4361,15 +4361,15 @@ void Spell::TakeAmmo()
{
if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER)
{
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
// wands don't have ammo
if (!item || item->IsBroken() || item->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
if (!pItem || pItem->IsBroken() || pItem->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
return;
if (item->GetTemplate()->InventoryType == INVTYPE_THROWN)
if (pItem->GetTemplate()->InventoryType == INVTYPE_THROWN)
{
if (item->GetMaxStackCount() == 1)
if (pItem->GetMaxStackCount() == 1)
{
// decrease durability for non-stackable throw weapon
m_caster->ToPlayer()->DurabilityPointLossForEquipSlot(EQUIPMENT_SLOT_RANGED);
@@ -4378,7 +4378,7 @@ void Spell::TakeAmmo()
{
// decrease items amount for stackable throw weapon
uint32 count = 1;
m_caster->ToPlayer()->DestroyItemCount(item, count, true);
m_caster->ToPlayer()->DestroyItemCount(pItem, count, true);
}
}
else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID))
@@ -6216,15 +6216,15 @@ SpellCastResult Spell::CheckItems()
if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER;
if (m_attackType != RANGED_ATTACK)
break;
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
if (!item || item->IsBroken())
Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType);
if (!pItem || pItem->IsBroken())
return SPELL_FAILED_EQUIPPED_ITEM;
switch (item->GetTemplate()->SubClass)
switch (pItem->GetTemplate()->SubClass)
{
case ITEM_SUBCLASS_WEAPON_THROWN:
{
uint32 ammo = item->GetEntry();
uint32 ammo = pItem->GetEntry();
if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
return SPELL_FAILED_NO_AMMO;
}; break;
@@ -6250,7 +6250,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_AMMO;
// check ammo ws. weapon compatibility
switch (item->GetTemplate()->SubClass)
switch (pItem->GetTemplate()->SubClass)
{
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
@@ -6286,10 +6286,10 @@ SpellCastResult Spell::CheckItems()
if (!pProto)
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
if (Item* item = p_caster->GetItemByEntry(item_id))
if (Item* pitem = p_caster->GetItemByEntry(item_id))
{
for (int x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
if (pProto->Spells[x].SpellCharges != 0 && item->GetSpellCharges(x) == pProto->Spells[x].SpellCharges)
if (pProto->Spells[x].SpellCharges != 0 && pitem->GetSpellCharges(x) == pProto->Spells[x].SpellCharges)
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
}
break;
+9 -9
View File
@@ -1777,22 +1777,22 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype)
if (num_to_add)
{
// create the new item and store it
Item* item = player->StoreNewItem(dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid));
Item* pItem = player->StoreNewItem(dest, newitemid, true, Item::GenerateItemRandomPropertyId(newitemid));
// was it successful? return error if not
if (!item)
if (!pItem)
{
player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL);
return;
}
// set the "Crafted by ..." property of the item
if (item->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && item->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948)
item->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
if (pItem->GetTemplate()->Class != ITEM_CLASS_CONSUMABLE && pItem->GetTemplate()->Class != ITEM_CLASS_QUEST && newitemid != 6265 && newitemid != 6948)
pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow());
// send info to the client
if (item)
player->SendNewItem(item, num_to_add, true, bgType == 0);
if (pItem)
player->SendNewItem(pItem, num_to_add, true, bgType == 0);
// we succeeded in creating at least one item, so a levelup is possible
if (bgType == 0)
@@ -6672,11 +6672,11 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/)
return;
}
if (Item* item = player->GetItemByEntry(item_id))
if (Item* pItem = player->GetItemByEntry(item_id))
{
for (int x = 0; x < MAX_ITEM_PROTO_SPELLS; ++x)
item->SetSpellCharges(x, pProto->Spells[x].SpellCharges);
item->SetState(ITEM_CHANGED, player);
pItem->SetSpellCharges(x, pProto->Spells[x].SpellCharges);
pItem->SetState(ITEM_CHANGED, player);
}
}