diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-04-10 00:45:07 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-04-10 00:45:07 -0300 |
commit | c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe (patch) | |
tree | 742dd839971d2aab1f08fd0291af66e6439646ab /hercules/code/server/db/inventory.py | |
download | tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.gz tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.bz2 tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.tar.xz tools-c6095ad062eaa0f5576cfab1c4fe436b90c2fbfe.zip |
Add initial tools
Diffstat (limited to 'hercules/code/server/db/inventory.py')
-rw-r--r-- | hercules/code/server/db/inventory.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/hercules/code/server/db/inventory.py b/hercules/code/server/db/inventory.py new file mode 100644 index 0000000..e5c1e6a --- /dev/null +++ b/hercules/code/server/db/inventory.py @@ -0,0 +1,44 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2015 Evol Online +# Author: Andrei Karas (4144) + +from code.fileutils import readFile + +def saveInventoryTable(users): + dstFile = "newdb/inventory.sql" + firstLine = True + tpl = readFile("templates/inventory.sql") + with open(dstFile, "w") as w: + w.write(tpl) + w.write("INSERT INTO `inventory` VALUES ") + for userId in users: + user = users[userId] + for item in user.inventory: + + if firstLine == False: + w.write(",\n") + else: + firstLine = False + + w.write(("({id},{char_id},{nameid},{amount},{equip},{identify}," + + "{refine},{attribute},{card0},{card1},{card2},{card3}," + + "{expire_time},{favorite},{bound},{unique_id})").format( + id = 0, + char_id = user.char_id, + nameid = item.itemId, + amount = item.amount, + equip = item.equip, + identify = "1", + refine = item.refine, + attribute = item.attribute, + card0 = "0", + card1 = "0", + card2 = "0", + card3 = "0", + expire_time = "0", + favorite = "0", + bound = "0", + unique_id = "0" + )) + w.write("\n") |