[7513] Implement currencies tab work. Also check related item data at server startup. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
@@ -1824,6 +1824,17 @@ void ObjectMgr::LoadItemPrototypes()
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has bag family bit set not listed in ItemBagFamily.dbc, remove bit",i);
|
||||
const_cast<ItemPrototype*>(proto)->BagFamily &= ~mask;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(BAG_FAMILY_MASK_CURRENCY_TOKENS & mask)
|
||||
{
|
||||
CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(proto->ItemId);
|
||||
if(!ctEntry)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has currency bag family bit set in BagFamily but not listed in CurrencyTypes.dbc, remove bit",i);
|
||||
const_cast<ItemPrototype*>(proto)->BagFamily &= ~mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+41
-8
@@ -9289,7 +9289,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV
|
||||
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
|
||||
|
||||
// currencytoken case (disabled until proper implement)
|
||||
if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(false /*pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS*/))
|
||||
if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS))
|
||||
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
|
||||
|
||||
// guestbag case (not use)
|
||||
@@ -9627,9 +9627,25 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
*no_space_count = count + no_similar_count;
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
|
||||
/* until proper implementation
|
||||
res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
if(res!=EQUIP_ERR_OK)
|
||||
{
|
||||
if(no_space_count)
|
||||
*no_space_count = count + no_similar_count;
|
||||
return res;
|
||||
}
|
||||
|
||||
if(count==0)
|
||||
{
|
||||
if(no_similar_count==0)
|
||||
return EQUIP_ERR_OK;
|
||||
|
||||
if(no_space_count)
|
||||
*no_space_count = count + no_similar_count;
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
@@ -9650,7 +9666,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
res = _CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START,INVENTORY_SLOT_ITEM_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
if(res!=EQUIP_ERR_OK)
|
||||
@@ -9798,9 +9813,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
|
||||
/* until proper implementation
|
||||
else if(false pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(CURRENCYTOKEN_SLOT_START,CURRENCYTOKEN_SLOT_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
if(res!=EQUIP_ERR_OK)
|
||||
@@ -9820,7 +9833,6 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for(int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++)
|
||||
{
|
||||
@@ -10719,6 +10731,10 @@ Item* Player::_StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, boo
|
||||
pItem->SetSlot( slot );
|
||||
pItem->SetContainer( NULL );
|
||||
|
||||
// need update known currency
|
||||
if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)
|
||||
UpdateKnownCurrencies(pItem->GetEntry(),true);
|
||||
|
||||
if( IsInWorld() && update )
|
||||
{
|
||||
pItem->AddToWorld();
|
||||
@@ -11026,6 +11042,9 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update )
|
||||
UpdateExpertise(OFF_ATTACK);
|
||||
}
|
||||
}
|
||||
// need update known currency
|
||||
else if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)
|
||||
UpdateKnownCurrencies(pItem->GetEntry(),false);
|
||||
|
||||
m_items[slot] = NULL;
|
||||
SetUInt64Value((uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot*2)), 0);
|
||||
@@ -11137,6 +11156,9 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update )
|
||||
// equipment visual show
|
||||
SetVisibleItemSlot(slot,NULL);
|
||||
}
|
||||
// need update known currency
|
||||
else if (slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END)
|
||||
UpdateKnownCurrencies(pItem->GetEntry(),false);
|
||||
|
||||
m_items[slot] = NULL;
|
||||
}
|
||||
@@ -20875,3 +20897,14 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
|
||||
// update free talent points
|
||||
pet->SetFreeTalentPoints(CurTalentPoints - (talentRank - curtalent_maxrank + 1));
|
||||
}
|
||||
|
||||
void Player::UpdateKnownCurrencies(uint32 itemId, bool apply)
|
||||
{
|
||||
if(CurrencyTypesEntry const* ctEntry = sCurrencyTypesStore.LookupEntry(itemId))
|
||||
{
|
||||
if(apply)
|
||||
SetFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(1LL << (ctEntry->BitIndex-1)));
|
||||
else
|
||||
RemoveFlag64(PLAYER_FIELD_KNOWN_CURRENCIES,(1LL << (ctEntry->BitIndex-1)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2371,6 +2371,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
uint8 _CanStoreItem_InBag( uint8 bag, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const;
|
||||
uint8 _CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot ) const;
|
||||
Item* _StoreItem( uint16 pos, Item *pItem, uint32 count, bool clone, bool update );
|
||||
void UpdateKnownCurrencies(uint32 itemId, bool apply);
|
||||
|
||||
void AdjustQuestReqItemCount( Quest const* pQuest, QuestStatusData& questStatusData );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user