Core/Vendors: Add currencies to vendors

npc_vendor table gets a new field, type (1 is item, 2 is currency)
for type 1 fields still mean the same, for type 2 maxcount is buycount (without any "precision")

changed structure of SMSG_UPDATE_CURRENCY(_WEEK_LIMIT) but not enabled, wrong values are being wrongly calculated
This commit is contained in:
Nay
2012-08-14 18:11:06 +01:00
parent e761458b24
commit c0adf370e5
16 changed files with 346 additions and 186 deletions

View File

@@ -178,6 +178,8 @@ public:
if (!*args)
return false;
const uint8 type = 1; // FIXME: make type (1 item, 2 currency) an argument
char* pitem = handler->extractKeyFromLink((char*)args, "Hitem");
if (!pitem)
{
@@ -214,13 +216,13 @@ public:
uint32 vendor_entry = vendor ? vendor->GetEntry() : 0;
if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer()))
if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, type, handler->GetSession()->GetPlayer()))
{
handler->SetSentErrorMessage(true);
return false;
}
sObjectMgr->AddVendorItem(vendor_entry, itemId, maxcount, incrtime, extendedcost);
sObjectMgr->AddVendorItem(vendor_entry, itemId, maxcount, incrtime, type, extendedcost);
ItemTemplate const* itemTemplate = sObjectMgr->GetItemTemplate(itemId);
@@ -435,7 +437,9 @@ public:
}
uint32 itemId = atol(pitem);
if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId))
const uint8 type = 1; // FIXME: make type (1 item, 2 currency) an argument
if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId, type))
{
handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
handler->SetSentErrorMessage(true);