Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- vendor item table creator
- -- XXXXXXXXXXXXXXGXXXXXXXXXXXXXRXXXXXXXXXXXXUXXXXXXXXXMXXXXXXBXXXXOXXXXXXX
- -- X created by slp13at420 of ac-web X
- -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
- -- extracts item id's into a fastload sql insert file
- -- used for making mall vendors
- -- this will put ALLLLL items in db into vendors................
- local Command = ".createvendor"
- local Class = 0
- local Subclass = 0
- function Createvendor(event, pPlayer, msg)
- if(msg == Command)then
- local NpcID = 250000 -- start point for vendor ID's
- local File1 = io.open("scripts/ADMIN/vendortable.sql", "w")
- local File2 = io.open("scripts/ADMIN/vendor_names.sql", "w")
- local File3 = io.open("scripts/ADMIN/vendor_proto.sql", "w")
- File1:write("INSERT INTO `vendors`(`entry`, `item`, `amount`)Values\n\n")
- File2:write("INSERT INTO `creature_names`(`entry`, `name`, `subname`, `info_str`, `male_displayid`)VALUE\n\n")
- File3:write("INSERT INTO `creature_proto`(`entry`, `faction`, `scale`, `npcflags`)VALUES\n\n")
- repeat -- class
- local Subclass = 0
- repeat -- subclass
- local XentryID = WorldDBQuery("SELECT `entry` FROM world.items WHERE `class` = '"..Class.."' AND `subclass` = '"..Subclass.."';");
- if(XentryID~=nil)then
- repeat -- bundles into 150 count per vendor (max a vendor can show)
- local Vcount = 0
- File1:write("\n")
- File2:write("("..(NpcID)..", 'Mall Vendor', '"..tostring(Class).."x"..tostring(Subclass).."', 'Buy', 14334),\n")
- File3:write("("..(NpcID)..", 35, 1, 128),\n")
- repeat -- 150 per entries counter
- Vcount = (Vcount+1)
- local EntryID = XentryID:GetColumn(0):GetLong()
- File1:write("("..NpcID..", "..tostring(EntryID)..", 1),\n")
- until(Vcount==150)or(XentryID:NextRow()~=true)
- NpcID = (NpcID+1)
- until(XentryID:NextRow()~=true)
- end
- Subclass = (Subclass+1)
- until(Subclass==21)
- Class = (Class+1)
- until(Class==18)
- pPlayer:SendBroadcastMessage("DONE.")
- File1:close()
- File2:close()
- File3:close()
- return false;
- end
- return;
- end
- RegisterServerHook(16, "Createvendor")
Advertisement
Add Comment
Please, Sign In to add comment