*Cleanup, more consistant HandleDummyAuraProc code (added basepoints1 and basepoints2 and edited some spell cases to use these instead of more hacky custom methods..)

--HG--
branch : trunk
This commit is contained in:
maximius
2009-11-21 17:59:24 -08:00
parent b039a7586e
commit c767576d92
10 changed files with 203 additions and 207 deletions
@@ -178,7 +178,7 @@ struct TRINITY_DLL_DECL instance_culling_of_stratholme : public ScriptedInstance
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
uint16 data0,data1,data2, data3, data4;
uint16 data0, data1, data2, data3, data4;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4;
@@ -176,7 +176,7 @@ struct TRINITY_DLL_DECL instance_ruins_of_ahn_qiraj : public ScriptedInstance
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
uint16 data0,data1,data2, data3, data4, data5;
uint16 data0, data1, data2, data3, data4, data5;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5;
@@ -277,7 +277,7 @@ struct TRINITY_DLL_DECL instance_ahnkahet : public ScriptedInstance
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
uint16 data0,data1,data2,data3,data4, data5, data6;
uint16 data0, data1, data2, data3, data4, data5, data6;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5 >> data6;
@@ -308,8 +308,8 @@ struct TRINITY_DLL_DECL instance_ulduar : public ScriptedInstance
OUT_LOAD_INST_DATA(strIn);
char dataHead1, dataHead2;
uint32 data0,data1,data2,data3,data4,data5,data6,
data7,data8,data9,data10,data11,data12,data13;
uint32 data0, data1, data2, data3, data4, data5, data6,
data7, data8, data9, data10, data11, data12, data13;
std::istringstream loadStream(strIn);
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5 >> data6
@@ -272,7 +272,7 @@ struct TRINITY_DLL_DECL instance_utgarde_keep : public ScriptedInstance
OUT_LOAD_INST_DATA(in);
char dataHead1, dataHead2;
uint16 data0,data1,data2, data3, data4, data5;
uint16 data0, data1, data2, data3, data4, data5;
std::istringstream loadStream(in);
loadStream >> dataHead1 >> dataHead2 >> data0 >> data1 >> data2 >> data3 >> data4 >> data5;
+11 -12
View File
@@ -787,23 +787,23 @@ void GameObject::Respawn()
}
}
bool GameObject::ActivateToQuest( Player *pTarget)const
bool GameObject::ActivateToQuest(Player *pTarget) const
{
if(!objmgr.IsGameObjectForQuests(GetEntry()))
if (!objmgr.IsGameObjectForQuests(GetEntry()))
return false;
switch(GetGoType())
switch (GetGoType())
{
// scan GO chest with loot including quest items
case GAMEOBJECT_TYPE_CHEST:
{
if(LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->GetLootId(), pTarget))
if (LootTemplates_Gameobject.HaveQuestLootForPlayer(GetGOInfo()->GetLootId(), pTarget))
{
//TODO: fix this hack
//look for battlegroundAV for some objects which are only activated after mine gots captured by own team
if(GetEntry() == BG_AV_OBJECTID_MINE_N || GetEntry() == BG_AV_OBJECTID_MINE_S)
if(BattleGround *bg = pTarget->GetBattleGround())
if(bg->GetTypeID() == BATTLEGROUND_AV && !(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(GetEntry(),pTarget->GetTeam())))
if (GetEntry() == BG_AV_OBJECTID_MINE_N || GetEntry() == BG_AV_OBJECTID_MINE_S)
if (BattleGround *bg = pTarget->GetBattleGround())
if (bg->GetTypeID() == BATTLEGROUND_AV && !(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(GetEntry(),pTarget->GetTeam())))
return false;
return true;
}
@@ -811,7 +811,7 @@ bool GameObject::ActivateToQuest( Player *pTarget)const
}
case GAMEOBJECT_TYPE_GOOBER:
{
if(pTarget->GetQuestStatus(GetGOInfo()->goober.questId) == QUEST_STATUS_INCOMPLETE)
if (pTarget->GetQuestStatus(GetGOInfo()->goober.questId) == QUEST_STATUS_INCOMPLETE)
return true;
break;
}
@@ -822,10 +822,10 @@ bool GameObject::ActivateToQuest( Player *pTarget)const
return false;
}
void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
void GameObject::TriggeringLinkedGameObject(uint32 trapEntry, Unit* target)
{
GameObjectInfo const* trapInfo = sGOStorage.LookupEntry<GameObjectInfo>(trapEntry);
if(!trapInfo || trapInfo->type!=GAMEOBJECT_TYPE_TRAP)
if (!trapInfo || trapInfo->type != GAMEOBJECT_TYPE_TRAP)
return;
SpellEntry const* trapSpell = sSpellStore.LookupEntry(trapInfo->trap.spellId);
@@ -839,8 +839,7 @@ void GameObject::TriggeringLinkedGameObject( uint32 trapEntry, Unit* target)
range = GetSpellMaxRangeForHostile(srentry);
else
{
Unit * owner=GetOwner();
if (owner)
if (Unit *owner = GetOwner())
range = owner->GetSpellMaxRangeForTarget(target, srentry);
else
//if no owner assume that object is hostile to target
+8 -8
View File
@@ -1149,11 +1149,11 @@ void LoadLootTemplates_Creature()
// remove real entries and check existence loot
for (uint32 i = 1; i < sCreatureStorage.MaxEntry; ++i)
{
if(CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
if (CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(i))
{
if(uint32 lootid = cInfo->lootid)
if (uint32 lootid = cInfo->lootid)
{
if(!ids_set.count(lootid))
if (!ids_set.count(lootid))
LootTemplates_Creature.ReportNotExistedId(lootid);
else
ids_setUsed.insert(lootid);
@@ -1240,8 +1240,8 @@ void LoadLootTemplates_Item()
// remove real entries and check existence loot
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
if(ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(i))
if(ids_set.count(proto->ItemId))
if (ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(i))
if (ids_set.count(proto->ItemId))
ids_set.erase(proto->ItemId);
// output error for any still listed (not referenced from appropriate table) ids
@@ -1257,13 +1257,13 @@ void LoadLootTemplates_Milling()
for (uint32 i = 1; i < sItemStorage.MaxEntry; ++i)
{
ItemPrototype const *proto = sItemStorage.LookupEntry<ItemPrototype>(i);
if(!proto)
if (!proto)
continue;
if((proto->BagFamily & BAG_FAMILY_MASK_HERBS) == 0)
if ((proto->BagFamily & BAG_FAMILY_MASK_HERBS) == 0)
continue;
if(ids_set.count(proto->ItemId))
if (ids_set.count(proto->ItemId))
ids_set.erase(proto->ItemId);
}
+68 -68
View File
@@ -7806,13 +7806,13 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
if (go->getLootState() == GO_READY)
{
uint32 lootid = go->GetGOInfo()->GetLootId();
uint32 lootid = go->GetGOInfo()->GetLootId();
//TODO: fix this big hack
if((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S))
if( BattleGround *bg = GetBattleGround())
if(bg->GetTypeID() == BATTLEGROUND_AV)
if(!(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(go->GetEntry(),GetTeam())))
if(!(((BattleGroundAV*)bg)->PlayerCanDoMineQuest(go->GetEntry(), GetTeam())))
{
SendLootRelease(guid);
return;
@@ -7826,7 +7826,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
}
if (loot_type == LOOT_FISHING)
go->getFishLoot(loot,this);
go->getFishLoot(loot, this);
go->SetLootState(GO_ACTIVATED);
}
@@ -7851,17 +7851,17 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
switch (loot_type)
{
case LOOT_DISENCHANTING:
loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this,true);
loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this, true);
break;
case LOOT_PROSPECTING:
loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this,true);
loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this, true);
break;
case LOOT_MILLING:
loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this,true);
loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this, true);
break;
default:
loot->FillLoot(item->GetEntry(), LootTemplates_Item, this,true);
loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot,item->GetProto()->MaxMoneyLoot);
loot->FillLoot(item->GetEntry(), LootTemplates_Item, this, true);
loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot, item->GetProto()->MaxMoneyLoot);
break;
}
}
@@ -8238,7 +8238,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(0x532) << uint32(0x1); // 8 frostwolfhut hc
data << uint32(0x531) << uint32(0x0); // 9 frostwolfhut ac
data << uint32(0x52e) << uint32(0x0); // 10 stormpike firstaid a_a
data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted -unused
data << uint32(0x571) << uint32(0x0); // 11 east frostwolf tower horde assaulted - unused
data << uint32(0x570) << uint32(0x0); // 12 west frostwolf tower horde assaulted - unused
data << uint32(0x567) << uint32(0x1); // 13 frostwolfe c
data << uint32(0x566) << uint32(0x1); // 14 frostwolfw c
@@ -8249,7 +8249,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid)
data << uint32(0x518) << uint32(0x0); // 19 stoneheart grave a_a
data << uint32(0x517) << uint32(0x0); // 20 stoneheart grave h_a
data << uint32(0x574) << uint32(0x0); // 21 1396 unk
data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted -unused
data << uint32(0x573) << uint32(0x0); // 22 iceblood tower horde assaulted - unused
data << uint32(0x572) << uint32(0x0); // 23 towerpoint horde assaulted - unused
data << uint32(0x56f) << uint32(0x0); // 24 1391 unk
data << uint32(0x56e) << uint32(0x0); // 25 iceblood a
@@ -8632,7 +8632,7 @@ void Player::SendPetSkillWipeConfirm()
/*** STORAGE SYSTEM ***/
/*********************************************************/
void Player::SetVirtualItemSlot( uint8 i, Item* item)
void Player::SetVirtualItemSlot(uint8 i, Item *item)
{
assert(i < 3);
if (i < 2 && item)
@@ -8652,7 +8652,7 @@ void Player::SetVirtualItemSlot( uint8 i, Item* item)
}
}
void Player::SetSheath( SheathState sheathed )
void Player::SetSheath(SheathState sheathed)
{
switch (sheathed)
{
@@ -8681,7 +8681,7 @@ void Player::SetSheath( SheathState sheathed )
Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players...
}
uint8 Player::FindEquipSlot( ItemPrototype const* proto, uint32 slot, bool swap ) const
uint8 Player::FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) const
{
uint8 pClass = getClass();
@@ -8899,10 +8899,10 @@ uint8 Player::CanUnequipItems( uint32 item, uint32 count ) const
return res;
}
uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item *skipItem) const
{
uint32 count = 0;
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++)
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem && pItem->GetEntry() == item)
count += pItem->GetCount();
@@ -8972,21 +8972,21 @@ Item* Player::GetItemByGuid( uint64 guid ) const
return NULL;
}
Item* Player::GetItemByPos( uint16 pos ) const
Item* Player::GetItemByPos(uint16 pos) const
{
uint8 bag = pos >> 8;
uint8 slot = pos & 255;
return GetItemByPos( bag, slot );
return GetItemByPos(bag, slot);
}
Item* Player::GetItemByPos( uint8 bag, uint8 slot ) const
{
if (bag == INVENTORY_SLOT_BAG_0 && ( slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END) ))
if (bag == INVENTORY_SLOT_BAG_0 && (slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)))
return m_items[slot];
else if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
|| (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END))
{
if (Bag *pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, bag))
if (Bag *pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, bag))
return pBag->GetItemByPos(slot);
}
return NULL;
@@ -9031,9 +9031,9 @@ Item* Player::GetShield(bool useable) const
return item;
}
uint8 Player::GetAttackBySlot( uint8 slot )
uint8 Player::GetAttackBySlot(uint8 slot)
{
switch(slot)
switch (slot)
{
case EQUIPMENT_SLOT_MAINHAND: return BASE_ATTACK;
case EQUIPMENT_SLOT_OFFHAND: return OFF_ATTACK;
@@ -9042,35 +9042,35 @@ uint8 Player::GetAttackBySlot( uint8 slot )
}
}
bool Player::IsInventoryPos( uint8 bag, uint8 slot )
bool Player::IsInventoryPos(uint8 bag, uint8 slot)
{
if( bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT )
if (bag == INVENTORY_SLOT_BAG_0 && slot == NULL_SLOT)
return true;
if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_END)
return true;
if( bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END )
if (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
return true;
if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)
return true;
return false;
}
bool Player::IsEquipmentPos( uint8 bag, uint8 slot )
bool Player::IsEquipmentPos(uint8 bag, uint8 slot)
{
if( bag == INVENTORY_SLOT_BAG_0 && ( slot < EQUIPMENT_SLOT_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot < EQUIPMENT_SLOT_END)
return true;
if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END)
return true;
return false;
}
bool Player::IsBankPos( uint8 bag, uint8 slot )
bool Player::IsBankPos(uint8 bag, uint8 slot)
{
if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot >= BANK_SLOT_ITEM_START && slot < BANK_SLOT_ITEM_END)
return true;
if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
return true;
if( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
if (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END)
return true;
return false;
}
@@ -9079,14 +9079,14 @@ bool Player::IsBagPos( uint16 pos )
{
uint8 bag = pos >> 8;
uint8 slot = pos & 255;
if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END)
return true;
if( bag == INVENTORY_SLOT_BAG_0 && ( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END ) )
if (bag == INVENTORY_SLOT_BAG_0 && slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
return true;
return false;
}
bool Player::IsValidPos( uint8 bag, uint8 slot )
bool Player::IsValidPos(uint8 bag, uint8 slot)
{
// post selected
if(bag == NULL_BAG)
@@ -9129,7 +9129,7 @@ bool Player::IsValidPos( uint8 bag, uint8 slot )
if (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
{
Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag);
if(!pBag)
if (!pBag)
return false;
// any post selected
@@ -9143,7 +9143,7 @@ bool Player::IsValidPos( uint8 bag, uint8 slot )
if( bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END )
{
Bag* pBag = (Bag*)GetItemByPos (INVENTORY_SLOT_BAG_0, bag);
if(!pBag)
if (!pBag)
return false;
// any post selected
@@ -9160,66 +9160,66 @@ bool Player::IsValidPos( uint8 bag, uint8 slot )
bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const
{
uint32 tempcount = 0;
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++)
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if( pItem && pItem->GetEntry() == item )
if (pItem && pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
if( tempcount >= count )
if (tempcount >= count)
return true;
}
}
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if( pItem && pItem->GetEntry() == item )
if (pItem && pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
if( tempcount >= count )
if (tempcount >= count)
return true;
}
}
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
{
if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
if (Bag* pBag = (Bag*)GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
{
Item* pItem = GetItemByPos( i, j );
if( pItem && pItem->GetEntry() == item )
if (pItem && pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
if( tempcount >= count )
if (tempcount >= count)
return true;
}
}
}
}
if(inBankAlso)
if (inBankAlso)
{
for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++)
for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
{
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if( pItem && pItem->GetEntry() == item )
Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (pItem && pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
if( tempcount >= count )
if (tempcount >= count)
return true;
}
}
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
{
if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
if(Bag* pBag = (Bag*)GetItemByPos( INVENTORY_SLOT_BAG_0, i))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
{
Item* pItem = GetItemByPos( i, j );
if( pItem && pItem->GetEntry() == item )
Item *pItem = GetItemByPos(i, j);
if (pItem && pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
if( tempcount >= count )
if (tempcount >= count)
return true;
}
}
@@ -9230,19 +9230,19 @@ bool Player::HasItemCount( uint32 item, uint32 count, bool inBankAlso ) const
return false;
}
bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except_slot ) const
bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot) const
{
uint32 tempcount = 0;
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
if(i == except_slot)
if (i == except_slot)
continue;
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if( pItem && pItem->GetEntry() == item)
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i);
if (pItem && pItem->GetEntry() == item)
{
tempcount += pItem->GetCount();
if( tempcount >= count )
if (tempcount >= count)
return true;
}
}
@@ -9252,14 +9252,14 @@ bool Player::HasItemOrGemWithIdEquipped( uint32 item, uint32 count, uint8 except
{
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
{
if(i == except_slot)
if (i == except_slot)
continue;
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i );
if( pItem && pItem->GetProto()->Socket[0].Color)
Item *pItem = GetItemByPos( INVENTORY_SLOT_BAG_0, i);
if (pItem && pItem->GetProto()->Socket[0].Color)
{
tempcount += pItem->GetGemCountWithID(item);
if( tempcount >= count )
if (tempcount >= count)
return true;
}
}
+27 -28
View File
@@ -2901,7 +2901,7 @@ void Spell::cast(bool skipCheck)
continue;
SpellEntry const *auraSpellInfo = (*i)->GetSpellProto();
uint32 auraSpellIdx = (*i)->GetEffIndex();
if(SpellEntry const *spellInfo = sSpellStore.LookupEntry(auraSpellInfo->EffectTriggerSpell[auraSpellIdx]))
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(auraSpellInfo->EffectTriggerSpell[auraSpellIdx]))
{
// Calculate chance at that moment (can be depend for example from combo points)
int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(), NULL);
@@ -2909,7 +2909,7 @@ void Spell::cast(bool skipCheck)
}
}
if(m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
if (m_customAttr & SPELL_ATTR_CU_DIRECT_DAMAGE)
CalculateDamageDoneForAllTargets();
// CAST SPELL
@@ -2917,11 +2917,11 @@ void Spell::cast(bool skipCheck)
//SendCastResult(castResult);
SendSpellGo(); // we must send smsg_spell_go packet before m_castItem delete in TakeCastItem()...
if(m_customAttr & SPELL_ATTR_CU_CHARGE)
if (m_customAttr & SPELL_ATTR_CU_CHARGE)
{
for (uint32 i = 0; i < 3; ++i)
{
switch(m_spellInfo->Effect[i])
switch (m_spellInfo->Effect[i])
{
case SPELL_EFFECT_CHARGE:
case SPELL_EFFECT_JUMP:
@@ -4287,10 +4287,9 @@ void Spell::HandleThreatSpells(uint32 spellId)
DEBUG_LOG("Spell %u, rank %u, added an additional %i threat", spellId, spellmgr.GetSpellRank(spellId), threat);
}
void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i)
void Spell::HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i)
{
if (!Script->OnSpellCast(pUnitTarget,pItemTarget,pGOTarget,i,m_spellInfo))
if (!Script->OnSpellCast(pUnitTarget, pItemTarget, pGOTarget, i, m_spellInfo))
return;
//effect has been handled, skip it
@@ -4303,12 +4302,12 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar
uint8 eff = m_spellInfo->Effect[i];
sLog.outDebug( "Spell: %u Effect : %u", m_spellInfo->Id, eff);
sLog.outDebug("Spell: %u Effect : %u", m_spellInfo->Id, eff);
//we do not need DamageMultiplier here.
damage = CalculateDamage(i, NULL);
if(eff < TOTAL_SPELL_EFFECTS)
if (eff < TOTAL_SPELL_EFFECTS)
{
//sLog.outDebug( "WORLD: Spell FX %d < TOTAL_SPELL_EFFECTS ", eff);
(this->*SpellEffects[eff])(i);
@@ -4317,7 +4316,7 @@ void Spell::HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTar
void Spell::TriggerSpell()
{
for (TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si)
for (TriggerSpells::iterator si = m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si)
{
Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer, true);
spell->prepare(&m_targets); // use original spell original targets
@@ -6367,7 +6366,7 @@ bool Spell::IsValidSingleTargetSpell(Unit const* target) const
}
for (uint8 i = 0; i < 3; ++i)
{
if(!IsValidSingleTargetEffect(target, Targets(m_spellInfo->EffectImplicitTargetA[i])))
if (!IsValidSingleTargetEffect(target, Targets(m_spellInfo->EffectImplicitTargetA[i])))
return false;
// Need to check B?
//if(!IsValidSingleTargetEffect(m_spellInfo->EffectImplicitTargetB[i], target)
@@ -6386,8 +6385,8 @@ void Spell::CalculateDamageDoneForAllTargets()
// Get multiplier
multiplier[i] = m_spellInfo->DmgMultiplier[i];
// Apply multiplier mods
if(m_originalCaster)
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
if (m_originalCaster)
if (Player *modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_EFFECT_PAST_FIRST, multiplier[i], this);
}
}
@@ -6400,7 +6399,7 @@ void Spell::CalculateDamageDoneForAllTargets()
usesAmmo=false;
}
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
{
TargetInfo &target = *ihit;
@@ -6414,8 +6413,8 @@ void Spell::CalculateDamageDoneForAllTargets()
if (usesAmmo)
{
bool ammoTaken=false;
for (uint8 i=0; i<3; i++)
bool ammoTaken = false;
for (uint8 i = 0; i < 3; ++i)
{
if (!(mask & 1<<i))
continue;
@@ -6426,7 +6425,7 @@ void Spell::CalculateDamageDoneForAllTargets()
case SPELL_EFFECT_WEAPON_DAMAGE_NOSCHOOL:
case SPELL_EFFECT_NORMALIZED_WEAPON_DMG:
case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE:
ammoTaken=true;
ammoTaken = true;
TakeAmmo();
}
if (ammoTaken)
@@ -6434,14 +6433,14 @@ void Spell::CalculateDamageDoneForAllTargets()
}
}
if (target.missCondition==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
if (target.missCondition == SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
{
target.damage += CalculateDamageDone(unit, mask, multiplier);
target.crit = m_caster->isSpellCrit(unit, m_spellInfo, m_spellSchoolMask, m_attackType);
}
else if (target.missCondition == SPELL_MISS_REFLECT) // In case spell reflect from target, do all effect on caster (if hit)
{
if (target.reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
if (target.reflectResult == SPELL_MISS_NONE) // If reflected spell hit caster -> do all effect on him
{
target.damage += CalculateDamageDone(m_caster, mask, multiplier);
target.crit = m_caster->isSpellCrit(m_caster, m_spellInfo, m_spellSchoolMask, m_attackType);
@@ -6477,11 +6476,11 @@ int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float *mul
break;
}
if(m_damage > 0)
if (m_damage > 0)
{
if(IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetA[i]] || IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetB[i]])
if (IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetA[i]] || IsAreaEffectTarget[m_spellInfo->EffectImplicitTargetB[i]])
{
if(int32 reducedPct = unit->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE))
if (int32 reducedPct = unit->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_AOE_DAMAGE_AVOIDANCE))
m_damage = m_damage * (100 + reducedPct) / 100;
}
}
@@ -6511,13 +6510,13 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
bool reqKey = false; // some locks not have reqs
for (int j = 0; j < 8; ++j)
for (uint8 j = 0; j < 8; ++j)
{
switch(lockInfo->Type[j])
switch (lockInfo->Type[j])
{
// check key item (many fit cases can be)
case LOCK_KEY_ITEM:
if(lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry()==lockInfo->Index[j])
if (lockInfo->Index[j] && m_CastItem && m_CastItem->GetEntry()==lockInfo->Index[j])
return SPELL_CAST_OK;
reqKey = true;
break;
@@ -6527,12 +6526,12 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
reqKey = true;
// wrong locktype, skip
if(uint32(m_spellInfo->EffectMiscValue[effIndex]) != lockInfo->Index[j])
if (uint32(m_spellInfo->EffectMiscValue[effIndex]) != lockInfo->Index[j])
continue;
skillId = SkillByLockType(LockType(lockInfo->Index[j]));
if ( skillId != SKILL_NONE )
if (skillId != SKILL_NONE)
{
// skill bonus provided by casting spell (mostly item spells)
// add the damage modifier from the spell casted (cheat lock / skeleton key etc.) (use m_currentBasePoints, CalculateDamage returns wrong value)
@@ -6554,7 +6553,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk
}
}
if(reqKey)
if (reqKey)
return SPELL_FAILED_BAD_TARGETS;
return SPELL_CAST_OK;
+83 -85
View File
@@ -4890,6 +4890,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
uint32 triggered_spell_id = 0;
Unit* target = pVictim;
int32 basepoints0 = 0;
int32 basepoints1 = 0;
int32 basepoints2 = 0;
uint64 originalCaster = 0;
// Master of subtlety (checked here because ranks have different spellfamilynames)
@@ -5320,7 +5322,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// mana cost save
int32 cost = procSpell->manaCost + procSpell->ManaCostPercentage * GetCreateMana() / 100;
basepoints0 = cost * triggerAmount/100;
if( basepoints0 <=0 )
if (basepoints0 <= 0)
return false;
target = this;
@@ -5519,9 +5521,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
switch (dummySpell->Id)
{
case 29838: triggered_spell_id=29842; break;
case 29834: triggered_spell_id=29841; break;
case 42770: triggered_spell_id=42771; break;
case 29838: triggered_spell_id = 29842; break;
case 29834: triggered_spell_id = 29841; break;
case 42770: triggered_spell_id = 42771; break;
default:
sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (SW)",dummySpell->Id);
return false;
@@ -5545,10 +5547,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Seed of Corruption
if (dummySpell->SpellFamilyFlags[1] & 0x00000010)
{
if(procSpell && procSpell->Id == 27285)
if (procSpell && procSpell->Id == 27285)
return false;
// if damage is more than need or target die from damage deal finish spell
if( triggeredByAura->GetAmount() <= damage || GetHealth() <= damage )
if (triggeredByAura->GetAmount() <= damage || GetHealth() <= damage)
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@@ -5557,7 +5559,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
RemoveAurasDueToSpell(triggeredByAura->GetId());
// Cast finish spell (triggeredByAura already not exist!)
if(Unit* caster = GetUnit(*this, casterGuid))
if (Unit *caster = GetUnit(*this, casterGuid))
caster->CastSpell(this, 27285, true, castItem);
return true; // no hidden cooldown
}
@@ -5570,7 +5572,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (dummySpell->SpellFamilyFlags.IsEqual(0,0,0) && dummySpell->SpellIconID == 1932)
{
// if damage is more than need deal finish spell
if( triggeredByAura->GetAmount() <= damage )
if (triggeredByAura->GetAmount() <= damage)
{
// remember guid before aura delete
uint64 casterGuid = triggeredByAura->GetCasterGUID();
@@ -5579,7 +5581,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
RemoveAurasDueToSpell(triggeredByAura->GetId());
// Cast finish spell (triggeredByAura already not exist!)
if(Unit* caster = GetUnit(*this, casterGuid))
if (Unit *caster = GetUnit(*this, casterGuid))
caster->CastSpell(this, 32865, true, castItem);
return true; // no hidden cooldown
}
@@ -5722,7 +5724,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if(!pVictim || !pVictim->isAlive())
return false;
if (effIndex!=0)
if (effIndex != 0)
return false;
// pVictim is caster of aura
@@ -5771,10 +5773,10 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 40438:
{
// Shadow Word: Pain
if( procSpell->SpellFamilyFlags[0] & 0x8000 )
if (procSpell->SpellFamilyFlags[0] & 0x8000)
triggered_spell_id = 40441;
// Renew
else if( procSpell->SpellFamilyFlags[0] & 0x40 )
else if (procSpell->SpellFamilyFlags[0] & 0x40)
triggered_spell_id = 40440;
else
return false;
@@ -5799,7 +5801,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
int EffIndex = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; i++)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if(GoPoH->Effect[i] == SPELL_EFFECT_APPLY_AURA)
{
@@ -5808,7 +5810,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
}
int32 tickcount = GetSpellMaxDuration(GoPoH) / GoPoH->EffectAmplitude[EffIndex];
if(!tickcount)
if (!tickcount)
return false;
basepoints0 = damage * triggerAmount / tickcount / 100;
@@ -5886,7 +5888,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Frozen Shadoweave (Shadow's Embrace set) warning! its not only priest set
case 39372:
{
if(!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW))==0 )
if (!procSpell || (GetSpellSchoolMask(procSpell) & (SPELL_SCHOOL_MASK_FROST | SPELL_SCHOOL_MASK_SHADOW)) == 0)
return false;
// heal amount
@@ -5915,7 +5917,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
case SPELLFAMILY_DRUID:
{
switch(dummySpell->Id)
switch (dummySpell->Id)
{
// Glyph of Innervate
case 54832:
@@ -5971,11 +5973,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
triggered_spell_id = 34299;
if (triggeredByAura->GetCasterGUID() != GetGUID())
break;
int32 basepoints1 = triggerAmount * 2;
int32 _basepoints0 = triggerAmount * 2;
// Improved Leader of the Pack
// Check cooldown of heal spell cooldown
if (GetTypeId() == TYPEID_PLAYER && !((Player *)this)->HasSpellCooldown(34299))
CastCustomSpell(this,60889,&basepoints1,0,0,true,0,triggeredByAura);
CastCustomSpell(this, 60889, &_basepoints0, NULL, NULL, true, 0, triggeredByAura);
break;
}
// Healing Touch (Dreamwalker Raiment set)
@@ -6057,7 +6059,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (!procSpell)
return false;
// Only 0 aura can proc
if (effIndex!=0)
if (effIndex != 0)
return false;
// Wrath crit
if (procSpell->SpellFamilyFlags[0] & 0x1)
@@ -6090,7 +6092,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
else if (dummySpell->SpellIconID == 2850)
{
// Effect 0 - mod damage while having Enrage
if (effIndex==0)
if (effIndex == 0)
{
if (!(procSpell->SpellFamilyFlags[0] & 0x00080000))
return false;
@@ -6100,7 +6102,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
break;
}
// Effect 1 - Tiger's Fury restore energy
else if (effIndex==1)
else if (effIndex == 1)
{
if (!(procSpell->SpellFamilyFlags[2] & 0x00000800))
return false;
@@ -6114,7 +6116,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
case SPELLFAMILY_ROGUE:
{
switch(dummySpell->Id)
switch (dummySpell->Id)
{
// Glyph of Backstab
case 56800:
@@ -6230,7 +6232,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Seal of Righteousness - melee proc dummy (addition ${$MWS*(0.022*$AP+0.044*$SPH)} damage)
if (dummySpell->SpellFamilyFlags[0]&0x8000000)
{
if (effIndex!=0)
if (effIndex != 0)
return false;
triggered_spell_id = 25742;
float ap = GetTotalAttackPowerValue(BASE_ATTACK);
@@ -6240,7 +6242,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
break;
}
// Light's Beacon - Beacon of Light
if ( dummySpell->Id == 53651 )
if (dummySpell->Id == 53651)
{
if (Unit *source = triggeredByAura->GetParentAura()->GetUnitSource())
{
@@ -6278,8 +6280,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
triggered_spell_id = 57318;
target = this;
basepoints0 = triggerAmount;
CastCustomSpell(target,triggered_spell_id,&basepoints0,&basepoints0,NULL,true,castItem,triggeredByAura);
return true;
basepoints1 = triggerAmount;
//
break;
}
// Sacred Shield
if (dummySpell->SpellFamilyFlags[1]&0x00080000)
@@ -6387,14 +6390,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 33776:
{
// if healed by another unit (pVictim)
if(this == pVictim)
if (this == pVictim)
return false;
// heal amount
basepoints0 = triggerAmount*damage/100;
target = this;
if(basepoints0)
if (basepoints0)
triggered_spell_id = 31786;
break;
}
@@ -6410,7 +6413,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Seal of the Martyr do damage trigger
case 53720:
{
if (effIndex == 0 && procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT ) // 0 effect - is proc on enemy
if (effIndex == 0 && procFlag & PROC_FLAG_SUCCESSFUL_MELEE_HIT) // 0 effect - is proc on enemy
triggered_spell_id = 53719;
else
return true;
@@ -6419,19 +6422,19 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Paladin Tier 6 Trinket (Ashtongue Talisman of Zeal)
case 40470:
{
if( !procSpell )
if (!procSpell)
return false;
float chance;
// Flash of light/Holy light
if( procSpell->SpellFamilyFlags[0] & 0xC0000000)
if (procSpell->SpellFamilyFlags[0] & 0xC0000000)
{
triggered_spell_id = 40471;
chance = 15.0f;
}
// Judgement (any)
else if (GetSpellSpecific(procSpell->Id)==SPELL_JUDGEMENT)
else if (GetSpellSpecific(procSpell->Id) == SPELL_JUDGEMENT)
{
triggered_spell_id = 40472;
chance = 50.0f;
@@ -6448,14 +6451,15 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
case 54939:
{
// Lookup base amount mana restore
for (uint8 i=0; i<MAX_SPELL_EFFECTS; i++)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE)
{
int32 mana = procSpell->EffectBasePoints[i];
CastCustomSpell(this, 54986, 0, &mana, 0, true, castItem, triggeredByAura);
basepoints1 = procSpell->EffectBasePoints[i]; // Not sure if this is right, maybe basepoints0?
triggered_spell_id = 54986;
target = this;
break;
}
return true;
break;
}
// Glyph of Flash of Light
case 54936:
@@ -6496,7 +6500,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Totemic Power (The Earthshatterer set)
case 28823:
{
if( !pVictim )
if (!pVictim)
return false;
// Set class defined buff
@@ -6534,17 +6538,17 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Windfury Weapon (Passive) 1-5 Ranks
case 33757:
{
if(GetTypeId() != TYPEID_PLAYER)
if (GetTypeId() != TYPEID_PLAYER)
return false;
if(!castItem || !castItem->IsEquipped())
if (!castItem || !castItem->IsEquipped())
return false;
// custom cooldown processing case
if( cooldown && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
if (cooldown && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
return false;
if(triggeredByAura->GetParentAura() && castItem->GetGUID() != triggeredByAura->GetParentAura()->GetCastItemGUID())
if (triggeredByAura->GetParentAura() && castItem->GetGUID() != triggeredByAura->GetParentAura()->GetCastItemGUID())
return false;
// Now amount of extra power stored in 1 effect of Enchant spell
@@ -6578,14 +6582,14 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
int32 extra_attack_power = CalculateSpellDamage(windfurySpellEntry, 1, windfurySpellEntry->EffectBasePoints[1], pVictim);
// Main-Hand case
if ( castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK) )
if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK))
{
// Value gained from additional AP
basepoints0 = int32(extra_attack_power/14.0f * GetAttackTime(BASE_ATTACK)/1000);
triggered_spell_id = 25504;
}
// Off-Hand case
else if ( castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && isAttackReady(OFF_ATTACK) )
else if (castItem->GetSlot() == EQUIPMENT_SLOT_OFFHAND && isAttackReady(OFF_ATTACK))
{
// Value gained from additional AP
basepoints0 = int32(extra_attack_power/14.0f * GetAttackTime(OFF_ATTACK)/1000/2);
@@ -6595,12 +6599,12 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
return false;
// apply cooldown before cast to prevent processing itself
if( cooldown )
((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
if (cooldown)
((Player*)this)->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
// Attack Twice
for (uint32 i = 0; i<2; ++i )
CastCustomSpell(pVictim,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
for (uint8 i = 0; i < 2; ++i)
CastCustomSpell(pVictim, triggered_spell_id, &basepoints0, NULL, NULL, true, castItem, triggeredByAura);
return true;
}
@@ -6660,7 +6664,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Shaman T8 Elemental 4P Bonus
case 64928:
{
basepoints0 = int32( triggerAmount * damage / 100 );
basepoints0 = triggerAmount * damage / 100;
triggered_spell_id = 64930; // Electrified
break;
}
@@ -6668,7 +6672,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Frozen Power
if (dummySpell->SpellIconID == 3780)
{
if (this->GetDistance(target) < 15.0f)
if (GetDistance(target) < 15.0f)
return false;
float chance = triggerAmount;
if (!roll_chance_f(chance))
@@ -6700,7 +6704,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
break;
}
// Earth Shield
if(dummySpell->SpellFamilyFlags[1] & 0x00000400)
if (dummySpell->SpellFamilyFlags[1] & 0x00000400)
{
// 3.0.8: Now correctly uses the Shaman's own spell critical strike chance to determine the chance of a critical heal.
originalCaster = triggeredByAura->GetCasterGUID();
@@ -6740,26 +6744,24 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
float BaseWeaponSpeed = GetAttackTime(OFF_ATTACK)/1000.0;
// Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
basepoints0 = int32( (fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed) );
basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
triggered_spell_id = 10444;
}
// Enchant on Main-Hand and ready?
else if ( castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK))
else if (castItem->GetSlot() == EQUIPMENT_SLOT_MAINHAND && isAttackReady(BASE_ATTACK))
{
float BaseWeaponSpeed = GetAttackTime(BASE_ATTACK)/1000.0;
// Value1: add the tooltip damage by swingspeed + Value2: add spelldmg by swingspeed
basepoints0 = int32( (fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed) );
basepoints0 = int32((fire_onhit * BaseWeaponSpeed) + (add_spellpower * BaseWeaponSpeed));
triggered_spell_id = 10444;
}
// If not ready, we should return, shouldn't we?!
// If not ready, we should return, shouldn't we?!
else
return false;
CastCustomSpell(pVictim,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura);
return true;
target = pVictim;
break;
}
// Improved Water Shield
if (dummySpell->SpellIconID == 2287)
@@ -6780,11 +6782,11 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Lightning Overload
if (dummySpell->SpellIconID == 2018) // only this spell have SpellFamily Shaman SpellIconID == 2018 and dummy aura
{
if(!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim )
if(!procSpell || GetTypeId() != TYPEID_PLAYER || !pVictim)
return false;
// custom cooldown processing case
if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(dummySpell->Id))
return false;
uint32 spell;
@@ -6799,15 +6801,15 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
((Player*)this)->RemoveSpellCooldown(spellId);
// do not reduce damage-spells have correct basepoints
int32 mod = 0;
basepoints1 = 0;
// Apply spellmod
CastCustomSpell(this, 39805, NULL, &mod, NULL, true, castItem, triggeredByAura);
CastCustomSpell(this, 39805, NULL, &basepoints1, NULL, true, castItem, triggeredByAura);
CastSpell(pVictim, spellId, true, castItem, triggeredByAura);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
((Player*)this)->AddSpellCooldown(dummySpell->Id,0,time(NULL) + cooldown);
if (cooldown && GetTypeId() == TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(dummySpell->Id, 0, time(NULL) + cooldown);
return true;
}
@@ -6854,9 +6856,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
if (dummySpell->Id == 49028)
{
// 1 dummy aura for dismiss rune blade
if (effIndex!=2)
if (effIndex != 2)
return false;
// TODO: wite script for this "fights on its own, doing the same attacks"
// TODO: write script for this "fights on its own, doing the same attacks"
// NOTE: Trigger here on every attack and spell cast
return false;
}
@@ -6949,21 +6951,17 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
if (procSpell->SpellFamilyName == SPELLFAMILY_POTION)
{
for (uint8 i=0; i<MAX_SPELL_EFFECTS; i++)
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (procSpell->Effect[i]==SPELL_EFFECT_HEAL)
{
if (procSpell->Effect[i] == SPELL_EFFECT_HEAL)
triggered_spell_id = 21399;
}
else if (procSpell->Effect[i]==SPELL_EFFECT_ENERGIZE)
{
else if (procSpell->Effect[i] == SPELL_EFFECT_ENERGIZE)
triggered_spell_id = 21400;
}
else
continue;
basepoints0 = CalculateSpellDamage(procSpell,i,procSpell->EffectBasePoints[i],this) * 0.4f;
CastCustomSpell(this,triggered_spell_id,&basepoints0,NULL,NULL,true,NULL,triggeredByAura);
basepoints0 = CalculateSpellDamage(procSpell, i, procSpell->EffectBasePoints[i], this) * 0.4f;
CastCustomSpell(this, triggered_spell_id, &basepoints0, NULL, NULL, true, NULL, triggeredByAura);
}
return true;
}
@@ -6984,7 +6982,7 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
{
triggered_spell_id = 54445;
target = this;
pVictim->AddThreat(this,procSpell->EffectBasePoints[0]*triggerAmount/100.0f);
pVictim->AddThreat(this, procSpell->EffectBasePoints[0]*triggerAmount/100.0f);
break;
}
break;
@@ -6994,30 +6992,30 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
}
// processed charge only counting case
if(!triggered_spell_id)
if (!triggered_spell_id)
return true;
SpellEntry const* triggerEntry = sSpellStore.LookupEntry(triggered_spell_id);
if(!triggerEntry)
if (!triggerEntry)
{
sLog.outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u",dummySpell->Id,triggered_spell_id);
sLog.outError("Unit::HandleDummyAuraProc: Spell %u have not existed triggered spell %u", dummySpell->Id, triggered_spell_id);
return false;
}
// default case
if((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
if ((!target && !spellmgr.IsSrcTargetSpell(triggerEntry)) || (target && target!=this && !target->isAlive()))
return false;
if( cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
if (cooldown && GetTypeId() == TYPEID_PLAYER && ((Player*)this)->HasSpellCooldown(triggered_spell_id))
return false;
if(basepoints0)
CastCustomSpell(target,triggered_spell_id,&basepoints0,NULL,NULL,true,castItem,triggeredByAura, originalCaster);
if (basepoints0 || basepoints1 || basepoints2)
CastCustomSpell(target, triggered_spell_id, &basepoints0, &basepoints1, &basepoints2, true, castItem, triggeredByAura, originalCaster);
else
CastSpell(target,triggered_spell_id,true,castItem,triggeredByAura, originalCaster);
CastSpell(target, triggered_spell_id, true, castItem, triggeredByAura, originalCaster);
if( cooldown && GetTypeId() == TYPEID_PLAYER )
if (cooldown && GetTypeId() == TYPEID_PLAYER)
((Player*)this)->AddSpellCooldown(triggered_spell_id,0,time(NULL) + cooldown);
return true;