[7015] Implement support -1 in item_template.stackable and item_template.maxcount fields. By VladimirMangos.
--HG-- branch : trunk
This commit is contained in:
+2
-2
@@ -220,12 +220,12 @@ struct GuildBankTab
|
||||
|
||||
struct GuildItemPosCount
|
||||
{
|
||||
GuildItemPosCount(uint8 _slot, uint8 _count) : slot(_slot), count(_count) {}
|
||||
GuildItemPosCount(uint8 _slot, uint32 _count) : slot(_slot), count(_count) {}
|
||||
|
||||
bool isContainedIn(std::vector<GuildItemPosCount> const& vec) const;
|
||||
|
||||
uint8 slot;
|
||||
uint8 count;
|
||||
uint32 count;
|
||||
};
|
||||
typedef std::vector<GuildItemPosCount> GuildItemPosCountVec;
|
||||
|
||||
|
||||
+2
-2
@@ -890,8 +890,8 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
|
||||
ItemPrototype const *pProto = objmgr.GetItemPrototype( item );
|
||||
if( pProto )
|
||||
{
|
||||
if ( count > pProto->Stackable )
|
||||
count = pProto->Stackable;
|
||||
if ( count > pProto->GetMaxStackSize())
|
||||
count = pProto->GetMaxStackSize();
|
||||
|
||||
assert(count !=0 && "pProto->Stackable==0 but checked at loading already");
|
||||
|
||||
|
||||
+1
-1
@@ -232,7 +232,7 @@ class TRINITY_DLL_SPEC Item : public Object
|
||||
|
||||
uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); }
|
||||
void SetCount(uint32 value) { SetUInt32Value (ITEM_FIELD_STACK_COUNT, value); }
|
||||
uint32 GetMaxStackCount() const { return GetProto()->Stackable; }
|
||||
uint32 GetMaxStackCount() const { return GetProto()->GetMaxStackSize(); }
|
||||
uint8 GetGemCountWithID(uint32 GemID) const;
|
||||
|
||||
uint8 GetSlot() const {return m_slot;}
|
||||
|
||||
@@ -346,8 +346,8 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data )
|
||||
data << pProto->RequiredCityRank;
|
||||
data << pProto->RequiredReputationFaction;
|
||||
data << pProto->RequiredReputationRank;
|
||||
data << pProto->MaxCount;
|
||||
data << pProto->Stackable;
|
||||
data << int32(pProto->MaxCount);
|
||||
data << int32(pProto->Stackable);
|
||||
data << pProto->ContainerSlots;
|
||||
data << pProto->StatsCount; // item stats count
|
||||
for(int i = 0; i < pProto->StatsCount; i++)
|
||||
|
||||
@@ -511,8 +511,8 @@ struct ItemPrototype
|
||||
uint32 RequiredCityRank;
|
||||
uint32 RequiredReputationFaction; // id from Faction.dbc
|
||||
uint32 RequiredReputationRank;
|
||||
uint32 MaxCount;
|
||||
uint32 Stackable;
|
||||
int32 MaxCount; // <=0: no limit
|
||||
int32 Stackable; // 0: not allowed, -1: put in player coin info tab and don't limit stacking (so 1 slot)
|
||||
uint32 ContainerSlots;
|
||||
uint32 StatsCount;
|
||||
_ItemStat ItemStat[10];
|
||||
@@ -621,6 +621,8 @@ struct ItemPrototype
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 GetMaxStackSize() const { return Stackable > 0 ? uint32(Stackable) : uint32(0x7FFFFFFF-1); }
|
||||
};
|
||||
|
||||
struct ItemLocale
|
||||
|
||||
+4
-4
@@ -6374,17 +6374,17 @@ bool ChatHandler::HandleSendItemsCommand(const char* args)
|
||||
}
|
||||
|
||||
uint32 item_count = itemCountStr ? atoi(itemCountStr) : 1;
|
||||
if(item_count < 1 || item_proto->MaxCount && item_count > item_proto->MaxCount)
|
||||
if(item_count < 1 || item_proto->MaxCount > 0 && item_count > uint32(item_proto->MaxCount))
|
||||
{
|
||||
PSendSysMessage(LANG_COMMAND_INVALID_ITEM_COUNT, item_count,item_id);
|
||||
SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
while(item_count > item_proto->Stackable)
|
||||
while(item_count > item_proto->GetMaxStackSize())
|
||||
{
|
||||
items.push_back(ItemPair(item_id,item_proto->Stackable));
|
||||
item_count -= item_proto->Stackable;
|
||||
items.push_back(ItemPair(item_id,item_proto->GetMaxStackSize()));
|
||||
item_count -= item_proto->GetMaxStackSize();
|
||||
}
|
||||
|
||||
items.push_back(ItemPair(item_id,item_count));
|
||||
|
||||
+12
-1
@@ -1800,11 +1800,22 @@ void ObjectMgr::LoadItemPrototypes()
|
||||
else if(proto->RequiredReputationRank > MIN_REPUTATION_RANK)
|
||||
sLog.outErrorDb("Item (Entry: %u) has RequiredReputationFaction ==0 but RequiredReputationRank > 0, rank setting is useless.",i);
|
||||
|
||||
if(proto->MaxCount < -1)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has too large negative in maxcount (%i), replace by value (-1) no storing limits.",i,proto->MaxCount);
|
||||
const_cast<ItemPrototype*>(proto)->MaxCount = -1;
|
||||
}
|
||||
|
||||
if(proto->Stackable==0)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has wrong value in stackable (%u), replace by default 1.",i,proto->Stackable);
|
||||
sLog.outErrorDb("Item (Entry: %u) has wrong value in stackable (%i), replace by default 1.",i,proto->Stackable);
|
||||
const_cast<ItemPrototype*>(proto)->Stackable = 1;
|
||||
}
|
||||
else if(proto->Stackable < -1)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has too large negative in stackable (%i), replace by value (-1) no stacking limits.",i,proto->Stackable);
|
||||
const_cast<ItemPrototype*>(proto)->Stackable = -1;
|
||||
}
|
||||
else if(proto->Stackable > 255)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) has too large value in stackable (%u), replace by hardcoded upper limit (255).",i,proto->Stackable);
|
||||
|
||||
+56
-37
@@ -767,7 +767,9 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32 count = iProto->Stackable; // max stack by default (mostly 1)
|
||||
// max stack by default (mostly 1), 1 for infinity stackable
|
||||
uint32 count = iProto->Stackable > 0 ? uint32(iProto->Stackable) : 1;
|
||||
|
||||
if(iProto->Class==ITEM_CLASS_CONSUMABLE && iProto->SubClass==ITEM_SUBCLASS_FOOD)
|
||||
{
|
||||
switch(iProto->Spells[0].SpellCategory)
|
||||
@@ -8927,12 +8929,12 @@ uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem,
|
||||
}
|
||||
|
||||
// no maximum
|
||||
if(pProto->MaxCount == 0)
|
||||
if(pProto->MaxCount <= 0)
|
||||
return EQUIP_ERR_OK;
|
||||
|
||||
uint32 curcount = GetItemCount(pProto->ItemId,true,pItem);
|
||||
|
||||
if( curcount + count > pProto->MaxCount )
|
||||
if (curcount + count > uint32(pProto->MaxCount))
|
||||
{
|
||||
if(no_space_count)
|
||||
*no_space_count = count +curcount - pProto->MaxCount;
|
||||
@@ -8991,16 +8993,16 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV
|
||||
if(slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_START+GetMaxKeyringSize() && !(pProto->BagFamily & BAG_FAMILY_MASK_KEYS))
|
||||
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
|
||||
|
||||
// vanitypet case
|
||||
if(slot >= VANITYPET_SLOT_START && slot < VANITYPET_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS))
|
||||
// vanitypet case (disabled until proper implement)
|
||||
if(slot >= VANITYPET_SLOT_START && slot < VANITYPET_SLOT_END && !(false /*pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS*/))
|
||||
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
|
||||
|
||||
// currencytoken case
|
||||
if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS))
|
||||
// currencytoken case (disabled until proper implement)
|
||||
if(slot >= CURRENCYTOKEN_SLOT_START && slot < CURRENCYTOKEN_SLOT_END && !(false /*pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS*/))
|
||||
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
|
||||
|
||||
// guestbag case
|
||||
if(slot >= QUESTBAG_SLOT_START && slot < QUESTBAG_SLOT_END && !(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS))
|
||||
// guestbag case (disabled until proper implement)
|
||||
if(slot >= QUESTBAG_SLOT_START && slot < QUESTBAG_SLOT_END && !(false /*pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS*/))
|
||||
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
|
||||
|
||||
// prevent cheating
|
||||
@@ -9022,7 +9024,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV
|
||||
}
|
||||
|
||||
// non empty stack with space
|
||||
need_space = pProto->Stackable;
|
||||
need_space = pProto->GetMaxStackSize();
|
||||
}
|
||||
// non empty slot, check item type
|
||||
else
|
||||
@@ -9032,10 +9034,11 @@ uint8 Player::_CanStoreItem_InSpecificSlot( uint8 bag, uint8 slot, ItemPosCountV
|
||||
return EQUIP_ERR_ITEM_CANT_STACK;
|
||||
|
||||
// check free space
|
||||
if(pItem2->GetCount() >= pProto->Stackable)
|
||||
if(pItem2->GetCount() >= pProto->GetMaxStackSize())
|
||||
return EQUIP_ERR_ITEM_CANT_STACK;
|
||||
|
||||
need_space = pProto->Stackable - pItem2->GetCount();
|
||||
// free stack space or infinity
|
||||
need_space = pProto->GetMaxStackSize() - pItem2->GetCount();
|
||||
}
|
||||
|
||||
if(need_space > count)
|
||||
@@ -9089,9 +9092,9 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy
|
||||
|
||||
if( pItem2 )
|
||||
{
|
||||
if(pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->Stackable )
|
||||
if(pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->GetMaxStackSize())
|
||||
{
|
||||
uint32 need_space = pProto->Stackable - pItem2->GetCount();
|
||||
uint32 need_space = pProto->GetMaxStackSize() - pItem2->GetCount();
|
||||
if(need_space > count)
|
||||
need_space = count;
|
||||
|
||||
@@ -9108,7 +9111,7 @@ uint8 Player::_CanStoreItem_InBag( uint8 bag, ItemPosCountVec &dest, ItemPrototy
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 need_space = pProto->Stackable;
|
||||
uint32 need_space = pProto->GetMaxStackSize();
|
||||
if(need_space > count)
|
||||
need_space = count;
|
||||
|
||||
@@ -9146,9 +9149,9 @@ uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end,
|
||||
|
||||
if( pItem2 )
|
||||
{
|
||||
if(pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->Stackable )
|
||||
if(pItem2->GetEntry() == pProto->ItemId && pItem2->GetCount() < pProto->GetMaxStackSize())
|
||||
{
|
||||
uint32 need_space = pProto->Stackable - pItem2->GetCount();
|
||||
uint32 need_space = pProto->GetMaxStackSize() - pItem2->GetCount();
|
||||
if(need_space > count)
|
||||
need_space = count;
|
||||
ItemPosCount newPosition = ItemPosCount((INVENTORY_SLOT_BAG_0 << 8) | j, need_space);
|
||||
@@ -9164,7 +9167,7 @@ uint8 Player::_CanStoreItem_InInventorySlots( uint8 slot_begin, uint8 slot_end,
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 need_space = pProto->Stackable;
|
||||
uint32 need_space = pProto->GetMaxStackSize();
|
||||
if(need_space > count)
|
||||
need_space = count;
|
||||
|
||||
@@ -9243,7 +9246,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
if( bag != NULL_BAG )
|
||||
{
|
||||
// search stack in bag for merge to
|
||||
if( pProto->Stackable > 1 )
|
||||
if( pProto->Stackable != 1 )
|
||||
{
|
||||
if( bag == INVENTORY_SLOT_BAG_0 ) // inventory
|
||||
{
|
||||
@@ -9334,6 +9337,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
/* until proper implementation
|
||||
else if(pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(VANITYPET_SLOT_START,VANITYPET_SLOT_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
@@ -9354,6 +9358,8 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* until proper implementation
|
||||
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);
|
||||
@@ -9374,6 +9380,8 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
*/
|
||||
/* until proper implementation
|
||||
else if(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(QUESTBAG_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
@@ -9394,6 +9402,7 @@ 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)
|
||||
@@ -9441,7 +9450,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
// not specific bag or have space for partly store only in specific bag
|
||||
|
||||
// search stack for merge to
|
||||
if( pProto->Stackable > 1 )
|
||||
if( pProto->Stackable != 1 )
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(KEYRING_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,true,pItem,bag,slot);
|
||||
if(res!=EQUIP_ERR_OK)
|
||||
@@ -9541,7 +9550,8 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
else if(pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS)
|
||||
/* until proper implementation
|
||||
else if(false pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(VANITYPET_SLOT_START,VANITYPET_SLOT_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
if(res!=EQUIP_ERR_OK)
|
||||
@@ -9561,7 +9571,9 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
else if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
*/
|
||||
/* until proper implementation
|
||||
else if(false 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)
|
||||
@@ -9581,7 +9593,9 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3
|
||||
return EQUIP_ERR_CANT_CARRY_MORE_OF_THIS;
|
||||
}
|
||||
}
|
||||
else if(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS)
|
||||
*/
|
||||
/* until proper implementation
|
||||
else if(false pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS)
|
||||
{
|
||||
res = _CanStoreItem_InInventorySlots(QUESTBAG_SLOT_START,QUESTBAG_SLOT_END,dest,pProto,count,false,pItem,bag,slot);
|
||||
if(res!=EQUIP_ERR_OK)
|
||||
@@ -9601,6 +9615,7 @@ 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++)
|
||||
{
|
||||
@@ -9775,14 +9790,14 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
return res;
|
||||
|
||||
// search stack for merge to
|
||||
if( pProto->Stackable > 1 )
|
||||
if( pProto->Stackable != 1 )
|
||||
{
|
||||
bool b_found = false;
|
||||
|
||||
for(int t = KEYRING_SLOT_START; t < KEYRING_SLOT_END; t++)
|
||||
{
|
||||
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->Stackable )
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_keys[t-KEYRING_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
|
||||
{
|
||||
inv_keys[t-KEYRING_SLOT_START] += pItem->GetCount();
|
||||
b_found = true;
|
||||
@@ -9794,7 +9809,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
for(int t = VANITYPET_SLOT_START; t < VANITYPET_SLOT_END; t++)
|
||||
{
|
||||
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_pets[t-VANITYPET_SLOT_START] + pItem->GetCount() <= pProto->Stackable )
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_pets[t-VANITYPET_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
|
||||
{
|
||||
inv_pets[t-VANITYPET_SLOT_START] += pItem->GetCount();
|
||||
b_found = true;
|
||||
@@ -9806,7 +9821,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
for(int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; t++)
|
||||
{
|
||||
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->Stackable )
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_tokens[t-CURRENCYTOKEN_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
|
||||
{
|
||||
inv_tokens[t-CURRENCYTOKEN_SLOT_START] += pItem->GetCount();
|
||||
b_found = true;
|
||||
@@ -9818,7 +9833,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
for(int t = QUESTBAG_SLOT_START; t < QUESTBAG_SLOT_END; t++)
|
||||
{
|
||||
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_quests[t-QUESTBAG_SLOT_START] + pItem->GetCount() <= pProto->Stackable )
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_quests[t-QUESTBAG_SLOT_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
|
||||
{
|
||||
inv_quests[t-QUESTBAG_SLOT_START] += pItem->GetCount();
|
||||
b_found = true;
|
||||
@@ -9830,7 +9845,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
for(int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; t++)
|
||||
{
|
||||
pItem2 = GetItemByPos( INVENTORY_SLOT_BAG_0, t );
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->Stackable )
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_slot_items[t-INVENTORY_SLOT_ITEM_START] + pItem->GetCount() <= pProto->GetMaxStackSize())
|
||||
{
|
||||
inv_slot_items[t-INVENTORY_SLOT_ITEM_START] += pItem->GetCount();
|
||||
b_found = true;
|
||||
@@ -9847,7 +9862,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
for(uint32 j = 0; j < pBag->GetBagSize(); j++)
|
||||
{
|
||||
pItem2 = GetItemByPos( t, j );
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->Stackable )
|
||||
if( pItem2 && pItem2->GetEntry() == pItem->GetEntry() && inv_bags[t-INVENTORY_SLOT_BAG_START][j] + pItem->GetCount() <= pProto->GetMaxStackSize())
|
||||
{
|
||||
inv_bags[t-INVENTORY_SLOT_BAG_START][j] += pItem->GetCount();
|
||||
b_found = true;
|
||||
@@ -9879,6 +9894,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
|
||||
if (b_found) continue;
|
||||
|
||||
/* until proper implementation
|
||||
if(pProto->BagFamily & BAG_FAMILY_MASK_VANITY_PETS)
|
||||
{
|
||||
for(uint32 t = VANITYPET_SLOT_START; t < VANITYPET_SLOT_END; ++t)
|
||||
@@ -9893,7 +9909,8 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
}
|
||||
|
||||
if (b_found) continue;
|
||||
|
||||
*/
|
||||
/* until proper implementation
|
||||
if(pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
|
||||
{
|
||||
for(uint32 t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
|
||||
@@ -9908,7 +9925,8 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
}
|
||||
|
||||
if (b_found) continue;
|
||||
|
||||
*/
|
||||
/* until proper implementation
|
||||
if(pProto->BagFamily & BAG_FAMILY_MASK_QUEST_ITEMS)
|
||||
{
|
||||
for(uint32 t = QUESTBAG_SLOT_START; t < QUESTBAG_SLOT_END; ++t)
|
||||
@@ -9923,6 +9941,7 @@ uint8 Player::CanStoreItems( Item **pItems,int count) const
|
||||
}
|
||||
|
||||
if (b_found) continue;
|
||||
*/
|
||||
|
||||
for(int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; t++)
|
||||
{
|
||||
@@ -10262,7 +10281,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
|
||||
}
|
||||
|
||||
// search stack in bag for merge to
|
||||
if( pProto->Stackable > 1 )
|
||||
if( pProto->Stackable != 1 )
|
||||
{
|
||||
if( bag == INVENTORY_SLOT_BAG_0 )
|
||||
{
|
||||
@@ -10314,7 +10333,7 @@ uint8 Player::CanBankItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *p
|
||||
// not specific bag or have space for partly store only in specific bag
|
||||
|
||||
// search stack for merge to
|
||||
if( pProto->Stackable > 1 )
|
||||
if( pProto->Stackable != 1 )
|
||||
{
|
||||
// in slots
|
||||
res = _CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START,BANK_SLOT_ITEM_END,dest,pProto,count,true,pItem,bag,slot);
|
||||
@@ -11502,7 +11521,7 @@ void Player::SwapItem( uint16 src, uint16 dst )
|
||||
// can be merge/fill
|
||||
if(msg == EQUIP_ERR_OK)
|
||||
{
|
||||
if( pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetProto()->Stackable )
|
||||
if( pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetProto()->GetMaxStackSize())
|
||||
{
|
||||
RemoveItem(srcbag, srcslot, true);
|
||||
|
||||
@@ -11518,8 +11537,8 @@ void Player::SwapItem( uint16 src, uint16 dst )
|
||||
}
|
||||
else
|
||||
{
|
||||
pSrcItem->SetCount( pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetProto()->Stackable );
|
||||
pDstItem->SetCount( pSrcItem->GetProto()->Stackable );
|
||||
pSrcItem->SetCount( pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetProto()->GetMaxStackSize());
|
||||
pDstItem->SetCount( pSrcItem->GetProto()->GetMaxStackSize());
|
||||
pSrcItem->SetState(ITEM_CHANGED, this);
|
||||
pDstItem->SetState(ITEM_CHANGED, this);
|
||||
if( IsInWorld() )
|
||||
|
||||
+2
-2
@@ -733,10 +733,10 @@ enum QuestBagSlots
|
||||
|
||||
struct ItemPosCount
|
||||
{
|
||||
ItemPosCount(uint16 _pos, uint8 _count) : pos(_pos), count(_count) {}
|
||||
ItemPosCount(uint16 _pos, uint32 _count) : pos(_pos), count(_count) {}
|
||||
bool isContainedIn(std::vector<ItemPosCount> const& vec) const;
|
||||
uint16 pos;
|
||||
uint8 count;
|
||||
uint32 count;
|
||||
};
|
||||
typedef std::vector<ItemPosCount> ItemPosCountVec;
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode( WorldPacket & recv_data )
|
||||
bool destroyItem = true;
|
||||
for(int i = 0; i < QUEST_OBJECTIVES_COUNT; i++)
|
||||
{
|
||||
if ((qInfo->ReqItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetProto()->MaxCount != 0))
|
||||
if ((qInfo->ReqItemId[i] == ((Item*)pObject)->GetEntry()) && (((Item*)pObject)->GetProto()->MaxCount > 0))
|
||||
{
|
||||
destroyItem = false;
|
||||
break;
|
||||
|
||||
+1
-1
@@ -3160,7 +3160,7 @@ void Spell::TakeCastItem()
|
||||
if (charges)
|
||||
{
|
||||
(charges > 0) ? --charges : ++charges; // abs(charges) less at 1 after use
|
||||
if (proto->Stackable < 2)
|
||||
if (proto->Stackable == 1)
|
||||
m_CastItem->SetSpellCharges(i, charges);
|
||||
m_CastItem->SetState(ITEM_CHANGED, (Player*)m_caster);
|
||||
}
|
||||
|
||||
@@ -2581,8 +2581,8 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype)
|
||||
|
||||
if (num_to_add < 1)
|
||||
num_to_add = 1;
|
||||
if (num_to_add > pProto->Stackable)
|
||||
num_to_add = pProto->Stackable;
|
||||
if (num_to_add > pProto->GetMaxStackSize())
|
||||
num_to_add = pProto->GetMaxStackSize();
|
||||
|
||||
// init items_count to 1, since 1 item will be created regardless of specialization
|
||||
int items_count=1;
|
||||
|
||||
Reference in New Issue
Block a user