Advertisement
slp13at420

item patch creator

Nov 20th, 2013
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 2.88 KB | None | 0 0
  1. -- patch creator
  2. -- XXXXsXXXXXXXXXXXlXXXXXXXXXXXpXXXXXXXXX1XXXXXXXXXXXXX3XXXXXXaXXXXXXXtXXXXXXXX4XXXXXXXX2XXXXXXXX0XXXXXXXX
  3. -- X               Created by slp13at420 of ac-web for BlackWolfsDen.dyndns-free.com                     X
  4. -- XXXXXXXXXXXXXXXXXXXXXXXXgXXXXXXXXrXXXXXXXXXXXuXXXXXXXXXXXXXXXXXXXXXXXmXXXXXXXXXXbXXXXXXXXXXXXoXXXXXXXXX
  5. -- use for extracting large blocks of data and write to file format
  6. -- so user can add entries to patch file easier than 1 entry at a time.
  7. -- this can extract the whole sqlDB into a file format (ready for patch) THIS IS BASED on YOUR CUSTOMIZED DB entries
  8. local Command = ".createitempatch"
  9. local Start = 60000 -- lowest starting item id of your custom items you added
  10. local End = 180000  -- highest item id of your custom items
  11.  
  12. function Itempatchcreator(event, pPlayer, msg)
  13.     if (msg == Command) then
  14.         local EntryID = Start
  15.         local File = io.open("scripts/ADMIN/Item.txt", "w")
  16.         File:write("long,long,long,long,long,long,long,long,\n")
  17.             repeat
  18.                 local XClassID = WorldDBQuery("SELECT `class` FROM world.items WHERE `entry` = '"..EntryID.."' LIMIT 1;");
  19.                 local ClassID = XClassID:GetColumn(0):GetLong()
  20.                 local XSubclassID = WorldDBQuery("SELECT `subclass` FROM world.items WHERE `entry` = '"..EntryID.."' LIMIT 1;")
  21.                 local SubclassID = XSubclassID:GetColumn(0):GetLong()
  22.                 local XField4ID = WorldDBQuery("SELECT `field4` FROM world.items WHERE `entry` = '"..EntryID.."' LIMIT 1;");
  23.                 local Field4ID = XField4ID:GetColumn(0):GetLong()
  24.                 local XQualityID = WorldDBQuery("SELECT `quality` FROM world.items WHERE `entry` = '"..EntryID.."' LIMIT 1;");
  25.                 local QualityID = XQualityID:GetColumn(0):GetLong()
  26.                 local XDisplayID = WorldDBQuery("SELECT `displayid` FROM world.items WHERE `entry` = '"..EntryID.."' LIMIT 1;");
  27.                 local DisplayID = XDisplayID:GetColumn(0):GetLong()
  28.                 local XInventorytypeID = WorldDBQuery("SELECT `inventorytype` FROM world.items WHERE `entry` = '"..EntryID.."' LIMIT 1;");
  29.                 local InventorytypeID = XInventorytypeID:GetColumn(0):GetLong()
  30.                 local XSheathID = WorldDBQuery("SELECT `sheathID` FROM world.items WHERE `entry` = '"..EntryID.."' LIMIT 1;");
  31.                 local SheathID = XSheathID:GetColumn(0):GetLong()
  32.  
  33.                 File:write(""..tostring(EntryID)..","..tostring(ClassID)..","..tostring(SubclassID)..","..tostring(Field4ID)..","..tostring(QualityID)..","..tostring(DisplayID)..","..tostring(InventorytypeID)..","..tostring(SheathID)..",\n")
  34.                 print("logged: "..EntryID.."")
  35.                     repeat
  36.                         EntryID = (EntryID+1)
  37.                         local Idtest = WorldDBQuery("SELECT `entry` FROM world.items WHERE `entry` = '"..EntryID.."' limit 1;");
  38.                     until (Idtest~=nil)or(EntryID==(End+1))
  39.             until (EntryID==(End+1))
  40.         pPlayer:SendBroadcastMessage("item.patch completed.");
  41.         EntryId = 0
  42.         File:close()
  43.         return false;
  44.         end
  45. return;
  46. end
  47.  
  48. print"\n Admin items.patch maker loaded\n"
  49.  
  50. RegisterServerHook(16, "Itempatchcreator")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement