aboutsummaryrefslogtreecommitdiff
path: root/src/game/Player.cpp
diff options
context:
space:
mode:
authormaximius <none@none>2009-11-21 17:59:24 -0800
committermaximius <none@none>2009-11-21 17:59:24 -0800
commitc767576d929dff04ea3f2d59624a612cc6fb934c (patch)
tree1db1cb2744d1c73c930a397596b5f6b618105f37 /src/game/Player.cpp
parentb039a7586e76ad5cdb7d128ff9bcc3b8946e50b9 (diff)
*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
Diffstat (limited to 'src/game/Player.cpp')
-rw-r--r--src/game/Player.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 8a674149eca..0d93dc65f55 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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;
}
}