Jump to content

[patch][5720] Extendedcost In Addvendoritem Command


Guest evilstar
 Share

Recommended Posts

Patch added in command ADDVENDORITEM new field EXTENDEDCOST

Index: sql/mangos.sql
===================================================================
--- sql/mangos.sql        (revision 5712)
+++ sql/mangos.sql        (working copy)
@@ -165,7 +165,7 @@
('addquest',3,'Syntax: .addquest #quest_id\\r\\n\\r\\nAdd to character quest log quest #quest_id. Quest started from item can\\'t be added by this command but correct .additem call provided in command output.'),
('addspw',2,'Syntax: .addspw #creatureid\\r\\n\\r\\nSpawn a creature by the given template id of #creatureid.'),
('addtele',3,'Syntax: .addtele $name\\r\\n\\r\\nAdd current your position to .tele command target locations list with name $name.'),
-('addvendoritem',2,'Syntax: .addvendoritem #itemId <#maxcount><#incrtime>\\r\\n\\r\\nAdd item #itemid to item list of selected vendor. Also optionally set max count item in vendor item list and time to item count restoring.'),
+('addvendoritem',2,'Syntax: .addvendoritem #itemId <#maxcount><#incrtime><#extendedcost>r\\n\\r\\nAdd item #itemid to item list of selected vendor. Also optionally set max count item in vendor item list and time to item count restoring and items ExtendedCost.'),
('addweapon',3,'Not yet implemented.'),
('allowmove',3,'Syntax: .allowmove\\r\\n\\r\\nEnable or disable movement for the selected creature.'),
('anim',2,'Syntax: .anim #emoteid\\r\\n\\r\\nPlay emote #emoteid for your character.'),
@@ -2133,7 +2133,7 @@
(203,'Error, name can only contain characters A-Z and a-z.',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(204,'The subname was too long by %i characters.',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(205,'Not yet implemented',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
-(206,'Item \\'%i\\' \\'%s\\' added to list with maxcount \\'%i\\' and incrtime \\'%i\\'',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
+(206,'Item \\'%i\\' \\'%s\\' added to list with maxcount \\'%i\\' and incrtime \\'%i\\' and extendedcost \\'%i\\'',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(207,'Item \\'%i\\' not found in database.',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(208,'Item \\'%i\\' \\'%s\\' deleted from vendor list',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(209,'Item \\'%i\\' not found in vendor list.',NULL,NULL,NULL,NULL,NULL,NULL,NULL),
Index: src/game/Level2.cpp
===================================================================
--- src/game/Level2.cpp        (revision 5712)
+++ src/game/Level2.cpp        (working copy)
@@ -937,6 +937,18 @@
        if (fincrtime)
                incrtime = atol(fincrtime);

+        char* fextendedcost = strtok(NULL, " ");                                        //add ExtendedCost, default: 0
+        uint32 extendedcost = 0;
+        
+
+        if(extendedcost && !sItemExtendedCostStore.LookupEntry(extendedcost))
+        { 
+        PSendSysMessage(LANG_BAD_VALUE, extendedcost);
+        return true;
+        }
+        if (fextendedcost)
+        {extendedcost = atol(fextendedcost);}
+
        ItemPrototype const *pProto = objmgr.GetItemPrototype(itemId);
        if(!pProto)
        {
@@ -960,10 +972,10 @@
        }

        // add to DB and to current ingame vendor
-        WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime) VALUES('%u','%u','%u','%u')",vendor->GetEntry(), itemId, maxcount,incrtime);
-        vendor->AddItem(itemId,maxcount,incrtime,0);
-        PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime);
-        return true;
+        WorldDatabase.PExecuteLog("INSERT INTO npc_vendor (entry,item,maxcount,incrtime,extendedcost) VALUES('%u','%u','%u','%u','%u')",vendor->GetEntry(), itemId, maxcount,incrtime,extendedcost);
+        vendor->AddItem(itemId,maxcount,incrtime,extendedcost);
+        PSendSysMessage(LANG_ITEM_ADDED_TO_LIST,itemId,pProto->Name1,maxcount,incrtime,extendedcost);
+         return true;
}

//del item from vendor list

Link to comment
Share on other sites

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use