mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +00:00
[10679] New table npc_vendor_template for comon item data for diff vendors.
In vendor list show own vedor items + template ites if any. Vendor template item lists selected by id stored in creature_template.vendor_id
This commit is contained in:
parent
a0cb8494a9
commit
0bf8b0aa79
16 changed files with 217 additions and 68 deletions
|
|
@ -742,8 +742,9 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
|
|||
pCreature->StopMoving();
|
||||
|
||||
VendorItemData const* vItems = pCreature->GetVendorItems();
|
||||
VendorItemData const* tItems = pCreature->GetVendorTemplateItems();
|
||||
|
||||
if (!vItems)
|
||||
if (!vItems && !tItems)
|
||||
{
|
||||
WorldPacket data( SMSG_LIST_INVENTORY, (8+1+1) );
|
||||
data << ObjectGuid(vendorguid);
|
||||
|
|
@ -753,7 +754,9 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
|
|||
return;
|
||||
}
|
||||
|
||||
uint8 numitems = vItems->GetItemCount();
|
||||
uint8 customitems = vItems ? vItems->GetItemCount() : 0;
|
||||
uint8 numitems = customitems + (tItems ? tItems->GetItemCount() : 0);
|
||||
|
||||
uint8 count = 0;
|
||||
|
||||
WorldPacket data( SMSG_LIST_INVENTORY, (8+1+numitems*8*4) );
|
||||
|
|
@ -766,7 +769,9 @@ void WorldSession::SendListInventory(ObjectGuid vendorguid)
|
|||
|
||||
for(uint8 vendorslot = 0; vendorslot < numitems; ++vendorslot )
|
||||
{
|
||||
if (VendorItem const* crItem = vItems->GetItem(vendorslot))
|
||||
VendorItem const* crItem = vendorslot < customitems ? vItems->GetItem(vendorslot) : tItems->GetItem(vendorslot - customitems);
|
||||
|
||||
if (crItem)
|
||||
{
|
||||
if (ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(crItem->item))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue