mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[7015] Implement support -1 in item_template.stackable and item_template.maxcount fields.
Also disable incorrect used vanity pets/currences/quest items special slotes. All items in its will be send by mail to characters at re-login. Fixed code for item stacks operations with size > 255.
This commit is contained in:
parent
7864c9aee1
commit
ee505ec9da
16 changed files with 109 additions and 61 deletions
|
|
@ -22,7 +22,7 @@
|
|||
DROP TABLE IF EXISTS `db_version`;
|
||||
CREATE TABLE `db_version` (
|
||||
`version` varchar(120) default NULL,
|
||||
`required_7002_01_mangos_spell_chain` bit(1) default NULL
|
||||
`required_7015_01_mangos_item_template` bit(1) default NULL
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||
|
||||
--
|
||||
|
|
@ -1539,8 +1539,8 @@ CREATE TABLE `item_template` (
|
|||
`RequiredCityRank` mediumint(8) unsigned NOT NULL default '0',
|
||||
`RequiredReputationFaction` smallint(5) unsigned NOT NULL default '0',
|
||||
`RequiredReputationRank` smallint(5) unsigned NOT NULL default '0',
|
||||
`maxcount` smallint(5) unsigned NOT NULL default '0',
|
||||
`stackable` smallint(5) unsigned NOT NULL default '1',
|
||||
`maxcount` smallint(5) NOT NULL default '-1',
|
||||
`stackable` smallint(5) NOT NULL default '1',
|
||||
`ContainerSlots` tinyint(3) unsigned NOT NULL default '0',
|
||||
`StatsCount` tinyint(3) unsigned NOT NULL default '0',
|
||||
`stat_type1` tinyint(3) unsigned NOT NULL default '0',
|
||||
|
|
|
|||
14
sql/updates/7015_01_mangos_item_template.sql
Normal file
14
sql/updates/7015_01_mangos_item_template.sql
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
ALTER TABLE db_version CHANGE COLUMN required_7002_01_mangos_spell_chain required_7015_01_mangos_item_template bit;
|
||||
|
||||
UPDATE item_template
|
||||
SET maxcount = 0 WHERE maxcount > 32000;
|
||||
|
||||
UPDATE item_template
|
||||
SET stackable = 0 WHERE stackable > 32000;
|
||||
|
||||
ALTER TABLE item_template
|
||||
CHANGE COLUMN maxcount maxcount smallint(5) NOT NULL default '-1',
|
||||
CHANGE COLUMN stackable stackable smallint(5) NOT NULL default '1';
|
||||
|
||||
UPDATE item_template
|
||||
SET stackable = -1 WHERE stackable = 0;
|
||||
|
|
@ -108,6 +108,7 @@ pkgdata_DATA = \
|
|||
6976_01_realmd_realmd_db_version.sql \
|
||||
6976_02_characters_character_db_version.sql \
|
||||
7002_01_mangos_spell_chain.sql \
|
||||
7015_01_mangos_item_template.sql \
|
||||
README
|
||||
|
||||
## Additional files to include when running 'make dist'
|
||||
|
|
@ -196,4 +197,5 @@ EXTRA_DIST = \
|
|||
6976_01_realmd_realmd_db_version.sql \
|
||||
6976_02_characters_character_db_version.sql \
|
||||
7002_01_mangos_spell_chain.sql \
|
||||
7015_01_mangos_item_template.sql \
|
||||
README
|
||||
|
|
|
|||
|
|
@ -218,12 +218,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -888,8 +888,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");
|
||||
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ class MANGOS_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;}
|
||||
|
|
|
|||
|
|
@ -344,8 +344,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++)
|
||||
|
|
|
|||
|
|
@ -509,8 +509,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];
|
||||
|
|
@ -619,6 +619,8 @@ struct ItemPrototype
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32 GetMaxStackSize() const { return Stackable > 0 ? uint32(Stackable) : uint32(0x7FFFFFFF-1); }
|
||||
};
|
||||
|
||||
struct ItemLocale
|
||||
|
|
|
|||
|
|
@ -6289,17 +6289,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));
|
||||
|
|
|
|||
|
|
@ -1705,11 +1705,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);
|
||||
|
|
|
|||
|
|
@ -705,7 +705,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)
|
||||
|
|
@ -8603,12 +8605,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;
|
||||
|
|
@ -8667,16 +8669,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
|
||||
|
|
@ -8698,7 +8700,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
|
||||
|
|
@ -8708,10 +8710,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)
|
||||
|
|
@ -8765,9 +8768,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;
|
||||
|
||||
|
|
@ -8784,7 +8787,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;
|
||||
|
||||
|
|
@ -8822,9 +8825,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);
|
||||
|
|
@ -8840,7 +8843,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;
|
||||
|
||||
|
|
@ -8919,7 +8922,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
|
||||
{
|
||||
|
|
@ -9010,6 +9013,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);
|
||||
|
|
@ -9030,6 +9034,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);
|
||||
|
|
@ -9050,6 +9056,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);
|
||||
|
|
@ -9070,6 +9078,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)
|
||||
|
|
@ -9117,7 +9126,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)
|
||||
|
|
@ -9217,7 +9226,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)
|
||||
|
|
@ -9237,7 +9247,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)
|
||||
|
|
@ -9257,7 +9269,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)
|
||||
|
|
@ -9277,6 +9291,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++)
|
||||
{
|
||||
|
|
@ -9451,14 +9466,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;
|
||||
|
|
@ -9470,7 +9485,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;
|
||||
|
|
@ -9482,7 +9497,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;
|
||||
|
|
@ -9494,7 +9509,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;
|
||||
|
|
@ -9506,7 +9521,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;
|
||||
|
|
@ -9523,7 +9538,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;
|
||||
|
|
@ -9555,6 +9570,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)
|
||||
|
|
@ -9569,7 +9585,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)
|
||||
|
|
@ -9584,7 +9601,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)
|
||||
|
|
@ -9599,6 +9617,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++)
|
||||
{
|
||||
|
|
@ -9938,7 +9957,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 )
|
||||
{
|
||||
|
|
@ -9990,7 +10009,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);
|
||||
|
|
@ -11178,7 +11197,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);
|
||||
|
||||
|
|
@ -11194,8 +11213,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() )
|
||||
|
|
|
|||
|
|
@ -731,10 +731,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;
|
||||
|
||||
|
|
|
|||
|
|
@ -176,7 +176,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;
|
||||
|
|
|
|||
|
|
@ -3189,7 +3189,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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2564,8 +2564,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;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "7014"
|
||||
#define REVISION_NR "7015"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue