mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
Fixed bank bag slot amount achievement statistic. Cleanup related code.
This commit is contained in:
parent
d3d07c5657
commit
3d1b055e9e
4 changed files with 15 additions and 22 deletions
|
|
@ -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:
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 )
|
||||||
|
|
@ -9748,44 +9740,44 @@ uint8 Player::CanUnequipItem( uint16 pos, bool swap ) const
|
||||||
|
|
||||||
uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading ) const
|
uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading ) const
|
||||||
{
|
{
|
||||||
if( !pItem )
|
if (!pItem)
|
||||||
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
|
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
uint32 count = pItem->GetCount();
|
uint32 count = pItem->GetCount();
|
||||||
|
|
||||||
sLog.outDebug( "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount());
|
sLog.outDebug( "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount());
|
||||||
ItemPrototype const *pProto = pItem->GetProto();
|
ItemPrototype const *pProto = pItem->GetProto();
|
||||||
if( !pProto )
|
if (!pProto)
|
||||||
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
|
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
|
||||||
|
|
||||||
if( pItem->IsBindedNotWith(GetGUID()) )
|
if (pItem->IsBindedNotWith(GetGUID()))
|
||||||
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
|
||||||
|
|
||||||
// check count of items (skip for auto move for same player from bank)
|
// check count of items (skip for auto move for same player from bank)
|
||||||
uint8 res = CanTakeMoreSimilarItems(pItem);
|
uint8 res = CanTakeMoreSimilarItems(pItem);
|
||||||
if(res != EQUIP_ERR_OK)
|
if (res != EQUIP_ERR_OK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
// in specific slot
|
// in specific slot
|
||||||
if( bag != NULL_BAG && slot != NULL_SLOT )
|
if (bag != NULL_BAG && slot != NULL_SLOT)
|
||||||
{
|
{
|
||||||
if( slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END )
|
if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
|
||||||
{
|
{
|
||||||
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)
|
||||||
return cantuse;
|
return cantuse;
|
||||||
}
|
}
|
||||||
|
|
||||||
res = _CanStoreItem_InSpecificSlot(bag,slot,dest,pProto,count,swap,pItem);
|
res = _CanStoreItem_InSpecificSlot(bag,slot,dest,pProto,count,swap,pItem);
|
||||||
if(res!=EQUIP_ERR_OK)
|
if (res!=EQUIP_ERR_OK)
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
if(count==0)
|
if (count==0)
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue