Fixed bank bag slot amount achievement statistic. Cleanup related code.

This commit is contained in:
VladimirMangos 2009-05-23 18:38:04 +04:00
parent d3d07c5657
commit 3d1b055e9e
4 changed files with 15 additions and 22 deletions

View file

@ -961,7 +961,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
break; break;
} }
case ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT: case ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT:
SetCriteriaProgress(achievementCriteria, GetPlayer()->GetByteValue(PLAYER_BYTES_2, 2)+1); SetCriteriaProgress(achievementCriteria, GetPlayer()->GetBankBagSlotCount());
break; break;
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION: case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
{ {

View file

@ -842,7 +842,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
return; return;
} }
uint32 slot = _player->GetByteValue(PLAYER_BYTES_2, 2); uint32 slot = _player->GetBankBagSlotCount();
// next slot // next slot
++slot; ++slot;
@ -860,7 +860,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
return; return;
_player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT, slot); _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BUY_BANK_SLOT, slot);
_player->SetByteValue(PLAYER_BYTES_2, 2, slot); _player->SetBankBagSlotCount(slot);
_player->ModifyMoney(-int32(price)); _player->ModifyMoney(-int32(price));
} }

View file

@ -8352,14 +8352,6 @@ uint32 Player::GetAttackBySlot( uint8 slot )
} }
} }
bool Player::HasBankBagSlot( uint8 slot ) const
{
uint32 maxslot = GetByteValue(PLAYER_BYTES_2, 2) + BANK_SLOT_BAG_START;
if( slot < maxslot )
return true;
return false;
}
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 )
@ -9774,7 +9766,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
if (!pItem->IsBag()) if (!pItem->IsBag())
return EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT; return EQUIP_ERR_ITEM_DOESNT_GO_TO_SLOT;
if( !HasBankBagSlot( slot ) ) if (slot - BANK_SLOT_BAG_START >= GetBankBagSlotCount())
return EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT; return EQUIP_ERR_MUST_PURCHASE_THAT_BAG_SLOT;
if (uint8 cantuse = CanUseItem( pItem, not_loading ) != EQUIP_ERR_OK) if (uint8 cantuse = CanUseItem( pItem, not_loading ) != EQUIP_ERR_OK)

View file

@ -982,7 +982,8 @@ class MANGOS_DLL_SPEC Player : public Unit
static bool IsBankPos( uint8 bag, uint8 slot ); static bool IsBankPos( uint8 bag, uint8 slot );
bool IsValidPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); } bool IsValidPos( uint16 pos ) { return IsBankPos(pos >> 8,pos & 255); }
bool IsValidPos( uint8 bag, uint8 slot ); bool IsValidPos( uint8 bag, uint8 slot );
bool HasBankBagSlot( uint8 slot ) const; uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const; bool HasItemCount( uint32 item, uint32 count, bool inBankAlso = false ) const;
bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL); bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
bool CanNoReagentCast(SpellEntry const* spellInfo) const; bool CanNoReagentCast(SpellEntry const* spellInfo) const;