summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-09-12 03:14:35 +0300
committerAndrei Karas <akaras@inbox.ru>2016-09-12 03:14:35 +0300
commit460822ea6cef840e0f478918547a806b231c3dc6 (patch)
tree729118f0273a182b62628aae87ae8c9fe9b5f1c2
parentd3648ee52a4860111afe9049713d788f60e5b588 (diff)
downloadevol-tools-460822ea6cef840e0f478918547a806b231c3dc6.tar.gz
evol-tools-460822ea6cef840e0f478918547a806b231c3dc6.tar.bz2
evol-tools-460822ea6cef840e0f478918547a806b231c3dc6.tar.xz
evol-tools-460822ea6cef840e0f478918547a806b231c3dc6.zip
Fix different issues in tools found by pyflakes.
-rw-r--r--hercules/code/clienttoserver/maps.py4
-rw-r--r--hercules/code/server/account.py4
-rw-r--r--hercules/code/server/accreg.py5
-rw-r--r--hercules/code/server/db/char.py4
-rw-r--r--hercules/code/server/db/charregnumdb.py3
-rw-r--r--hercules/code/server/db/inventory.py3
-rw-r--r--hercules/code/server/db/skill.py3
-rw-r--r--hercules/code/server/evol/athena.py9
-rw-r--r--hercules/code/server/evol/consts.py3
-rw-r--r--hercules/code/server/evol/itemdb.py5
-rw-r--r--hercules/code/server/evol/main.py33
-rw-r--r--hercules/code/server/evol/mobdb.py3
-rw-r--r--hercules/code/server/evol/mobskilldb.py3
-rw-r--r--hercules/code/server/evol/npcs.py5
-rw-r--r--hercules/code/server/maps.py4
-rw-r--r--hercules/code/server/party.py5
-rw-r--r--hercules/code/server/questsdb.py7
-rw-r--r--hercules/code/server/storage.py8
-rw-r--r--hercules/code/server/tmw/athena.py9
-rw-r--r--hercules/code/server/tmw/consts.py5
-rw-r--r--hercules/code/server/tmw/itemdb.py6
-rw-r--r--hercules/code/server/tmw/main.py34
-rw-r--r--hercules/code/server/tmw/mobdb.py9
-rw-r--r--hercules/code/server/tmw/mobskilldb.py3
-rw-r--r--hercules/code/server/tmw/npcs.py5
-rw-r--r--hercules/code/server/utils.py2
-rw-r--r--hercules/code/servertoclient/homunculuses.py2
-rw-r--r--hercules/code/servertoclient/items.py44
-rw-r--r--hercules/code/servertoclient/luas.py4
-rw-r--r--hercules/code/servertoclient/maps.py4
-rw-r--r--hercules/code/servertoclient/mercenaries.py2
-rw-r--r--hercules/code/servertoclient/monsters.py8
-rw-r--r--hercules/code/servertoclient/npcs.py11
-rw-r--r--hercules/code/servertoclient/pets.py2
-rw-r--r--hercules/code/servertoclient/quests.py4
-rw-r--r--hercules/code/servertoclient/skills.py2
-rw-r--r--hercules/code/servertoclient/sprites.py12
-rw-r--r--hercules/code/tileutils.py2
-rwxr-xr-xhercules/convert_db.py4
-rwxr-xr-xhercules/convert_mapcache_to_tmx.py4
-rwxr-xr-xhercules/convert_server.py5
-rwxr-xr-xhercules/convert_server_to_client.py20
-rwxr-xr-xhercules/convert_tmx_to_mapcache.py2
-rwxr-xr-xhercules/extract_mapcache.py4
-rwxr-xr-xhercules/list_mapcache.py4
-rwxr-xr-xherculesversion/packetversion.py12
-rwxr-xr-xlang/updatelang.py2
-rwxr-xr-xpluginvalidator/validate.py4
-rwxr-xr-xservergreps/hercules/src/preproc.py2
-rwxr-xr-xservergreps/hercules/src/server.py1
-rwxr-xr-xtestxml/testxml.py38
51 files changed, 164 insertions, 219 deletions
diff --git a/hercules/code/clienttoserver/maps.py b/hercules/code/clienttoserver/maps.py
index ee98ed1..b8ee14c 100644
--- a/hercules/code/clienttoserver/maps.py
+++ b/hercules/code/clienttoserver/maps.py
@@ -11,7 +11,7 @@ import struct
import StringIO
from xml.dom import minidom
-from code.fileutils import *
+from code.fileutils import makeDir, writeInt16, writeInt32, writeMapName, writeData
def getTmxFiles(srcDir):
names = []
@@ -150,7 +150,7 @@ def recreateMapCache():
print "map format not supported: " + fileName
continue
- comp = zlib.compressobj()
+ #comp = zlib.compressobj()
binData = struct.pack(str(len(tiles))+"B", *tiles)
binData = zlib.compress(binData)
idx = fileName.rfind("/") + 1
diff --git a/hercules/code/server/account.py b/hercules/code/server/account.py
index 28aafe4..7763766 100644
--- a/hercules/code/server/account.py
+++ b/hercules/code/server/account.py
@@ -5,8 +5,8 @@
import re
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
+from code.stringutils import stripNewLine, escapeSqlStr
def convertSex(sex):
if sex == "M" or sex == "F" or sex == "S":
diff --git a/hercules/code/server/accreg.py b/hercules/code/server/accreg.py
index 98b0934..b69910f 100644
--- a/hercules/code/server/accreg.py
+++ b/hercules/code/server/accreg.py
@@ -5,9 +5,8 @@
import re
-from code.fileutils import *
-from code.stringutils import *
-from code.server.dbitem import *
+from code.fileutils import readFile
+from code.stringutils import stripNewLine
def convertAccReg():
srcFile = "olddb/accreg.txt"
diff --git a/hercules/code/server/db/char.py b/hercules/code/server/db/char.py
index c1bb4a8..cd8e0cc 100644
--- a/hercules/code/server/db/char.py
+++ b/hercules/code/server/db/char.py
@@ -3,8 +3,8 @@
# Copyright (C) 2015 Evol Online
# Author: Andrei Karas (4144)
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
+from code.stringutils import escapeSqlStr
def saveCharTable(users):
dstFile = "newdb/char.sql"
diff --git a/hercules/code/server/db/charregnumdb.py b/hercules/code/server/db/charregnumdb.py
index 8837c9d..1617c13 100644
--- a/hercules/code/server/db/charregnumdb.py
+++ b/hercules/code/server/db/charregnumdb.py
@@ -3,8 +3,7 @@
# Copyright (C) 2015 Evol Online
# Author: Andrei Karas (4144)
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
def saveCharRegNumDbTable(users):
dstFile = "newdb/char_reg_num_db.sql"
diff --git a/hercules/code/server/db/inventory.py b/hercules/code/server/db/inventory.py
index 52a2fd0..e5c1e6a 100644
--- a/hercules/code/server/db/inventory.py
+++ b/hercules/code/server/db/inventory.py
@@ -3,8 +3,7 @@
# Copyright (C) 2015 Evol Online
# Author: Andrei Karas (4144)
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
def saveInventoryTable(users):
dstFile = "newdb/inventory.sql"
diff --git a/hercules/code/server/db/skill.py b/hercules/code/server/db/skill.py
index 2f45813..d21eb3d 100644
--- a/hercules/code/server/db/skill.py
+++ b/hercules/code/server/db/skill.py
@@ -3,8 +3,7 @@
# Copyright (C) 2015 Evol Online
# Author: Andrei Karas (4144)
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
def saveSkillTable(users):
dstFile = "newdb/skill.sql"
diff --git a/hercules/code/server/evol/athena.py b/hercules/code/server/evol/athena.py
index 567db3b..59d8223 100644
--- a/hercules/code/server/evol/athena.py
+++ b/hercules/code/server/evol/athena.py
@@ -5,11 +5,10 @@
import re
-from code.fileutils import *
-from code.stringutils import *
-from code.server.dbitem import *
-from code.server.dbskill import *
-from code.server.dbuser import *
+from code.stringutils import stripNewLine, removeGat
+from code.server.dbitem import Item
+from code.server.dbskill import Skill, skills
+from code.server.dbuser import User
comaSplit = re.compile(",")
spaceSplit = re.compile(" ")
diff --git a/hercules/code/server/evol/consts.py b/hercules/code/server/evol/consts.py
index d2c5c9b..c63f559 100644
--- a/hercules/code/server/evol/consts.py
+++ b/hercules/code/server/evol/consts.py
@@ -5,9 +5,6 @@
import re
-from code.fileutils import *
-from code.stringutils import *
-
def convertConsts(quests):
dstFile = "newserverdata/db/const.txt"
fieldsSplit = re.compile("\t+")
diff --git a/hercules/code/server/evol/itemdb.py b/hercules/code/server/evol/itemdb.py
index b86b848..a60e57d 100644
--- a/hercules/code/server/evol/itemdb.py
+++ b/hercules/code/server/evol/itemdb.py
@@ -5,9 +5,8 @@
import re
-from code.configutils import *
-from code.fileutils import *
-from code.stringutils import *
+from code.configutils import writeIntField, writeStartBlock, writeEndBlock, writeStartScript, writeEndScript, writeStrField, writeSubField
+from code.fileutils import readFile
def convertItemDb():
srcFile = "oldserverdata/db/item_db.txt"
diff --git a/hercules/code/server/evol/main.py b/hercules/code/server/evol/main.py
index 308bc87..0483118 100644
--- a/hercules/code/server/evol/main.py
+++ b/hercules/code/server/evol/main.py
@@ -4,23 +4,22 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-from code.server.account import *
-from code.server.accreg import *
-from code.server.party import *
-from code.server.storage import *
-from code.server.db.char import *
-from code.server.db.charregnumdb import *
-from code.server.db.inventory import *
-from code.server.db.skill import *
-from code.server.evol.athena import *
-from code.server.evol.consts import *
-from code.server.evol.itemdb import *
-from code.server.evol.mobdb import *
-from code.server.evol.mobskilldb import *
-from code.server.evol.npcs import *
-from code.server.utils import *
-from code.server.questsdb import *
-from code.serverutils import *
+from code.server.account import convertAccount
+from code.server.accreg import convertAccReg
+from code.server.party import convertParty
+from code.server.storage import convertStorage
+from code.server.db.char import saveCharTable
+from code.server.db.charregnumdb import saveCharRegNumDbTable
+from code.server.db.inventory import saveInventoryTable
+from code.server.db.skill import saveSkillTable
+from code.server.evol.athena import readAthena
+from code.server.evol.consts import convertConsts
+from code.server.evol.itemdb import convertItemDb
+from code.server.evol.mobdb import convertMobDb
+from code.server.evol.mobskilldb import convertMobSkillDb
+from code.server.evol.npcs import createMainScript, convertNpcs
+from code.server.questsdb import convertQuestsDb
+from code.serverutils import cleanServerData
def serverEvolMain():
cleanServerData()
diff --git a/hercules/code/server/evol/mobdb.py b/hercules/code/server/evol/mobdb.py
index a09348b..74eda04 100644
--- a/hercules/code/server/evol/mobdb.py
+++ b/hercules/code/server/evol/mobdb.py
@@ -5,9 +5,6 @@
import re
-from code.fileutils import *
-from code.stringutils import *
-
def convertMobDb():
srcFile = "oldserverdata/db/mob_db.txt"
dstFile = "newserverdata/db/re/mob_db.txt"
diff --git a/hercules/code/server/evol/mobskilldb.py b/hercules/code/server/evol/mobskilldb.py
index 6f0bf12..a5a7d5f 100644
--- a/hercules/code/server/evol/mobskilldb.py
+++ b/hercules/code/server/evol/mobskilldb.py
@@ -5,8 +5,7 @@
import re
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
def convertMobSkillDb():
srcFile = "oldserverdata/db/mob_skill_db.txt"
diff --git a/hercules/code/server/evol/npcs.py b/hercules/code/server/evol/npcs.py
index 2d198c1..6efe811 100644
--- a/hercules/code/server/evol/npcs.py
+++ b/hercules/code/server/evol/npcs.py
@@ -3,10 +3,11 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
+import os
import re
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import makeDir
+from code.stringutils import stripWindows, stripNewLine
mapsConfFile = "newserverdata/conf/maps.conf"
mapsIndexFile = "newserverdata/db/map_index.txt"
diff --git a/hercules/code/server/maps.py b/hercules/code/server/maps.py
index bdeb0f7..2ef0173 100644
--- a/hercules/code/server/maps.py
+++ b/hercules/code/server/maps.py
@@ -3,9 +3,11 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
+import array
+import struct
import zlib
-from code.fileutils import *
+from code.fileutils import readMapName, readInt16, readInt32, readData, makeDir
def listMapCache(f, mapsCount):
print "Known maps:"
diff --git a/hercules/code/server/party.py b/hercules/code/server/party.py
index b71f66f..c75a541 100644
--- a/hercules/code/server/party.py
+++ b/hercules/code/server/party.py
@@ -5,9 +5,8 @@
import re
-from code.fileutils import *
-from code.stringutils import *
-from code.server.dbitem import *
+from code.fileutils import readFile
+from code.stringutils import stripNewLine, escapeSqlStr
def findLeaderId(name, users):
for userId in users:
diff --git a/hercules/code/server/questsdb.py b/hercules/code/server/questsdb.py
index 25b0303..880a7f9 100644
--- a/hercules/code/server/questsdb.py
+++ b/hercules/code/server/questsdb.py
@@ -3,16 +3,11 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-import re
-from sets import Set
-
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
def convertQuestsDb():
srcFile = "oldserverdata/db/questvars.txt"
dstFile = "newserverdata/db/quest_db.txt"
- fieldsSplit = re.compile(",")
quests = dict()
with open(srcFile, "r") as r:
with open(dstFile, "w") as w:
diff --git a/hercules/code/server/storage.py b/hercules/code/server/storage.py
index a8d5802..6bddb52 100644
--- a/hercules/code/server/storage.py
+++ b/hercules/code/server/storage.py
@@ -5,9 +5,9 @@
import re
-from code.fileutils import *
-from code.stringutils import *
-from code.server.dbitem import *
+from code.fileutils import readFile
+from code.stringutils import stripNewLine
+from code.server.dbitem import Item
def convertStorage():
srcFile = "olddb/storage.txt"
@@ -33,7 +33,7 @@ def convertStorage():
tmp = comaSplit.split(rows[0])
accountId = tmp[0]
- storage_amount = tmp[1]
+# storage_amount = tmp[1]
data = spaceSplit.split(rows[1])
for itemStr in data:
diff --git a/hercules/code/server/tmw/athena.py b/hercules/code/server/tmw/athena.py
index 4c59ea1..6ad3e9c 100644
--- a/hercules/code/server/tmw/athena.py
+++ b/hercules/code/server/tmw/athena.py
@@ -5,11 +5,10 @@
import re
-from code.fileutils import *
-from code.stringutils import *
-from code.server.dbitem import *
-from code.server.dbskill import *
-from code.server.dbuser import *
+from code.stringutils import stripNewLine
+from code.server.dbitem import Item
+from code.server.dbskill import Skill, skills
+from code.server.dbuser import User
comaSplit = re.compile(",")
spaceSplit = re.compile(" ")
diff --git a/hercules/code/server/tmw/consts.py b/hercules/code/server/tmw/consts.py
index c3ca848..5b8403e 100644
--- a/hercules/code/server/tmw/consts.py
+++ b/hercules/code/server/tmw/consts.py
@@ -3,10 +3,11 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
+import os
import re
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
+from code.stringutils import stripNewLine
fieldsSplit = re.compile(":")
diff --git a/hercules/code/server/tmw/itemdb.py b/hercules/code/server/tmw/itemdb.py
index 0729fc3..beccd09 100644
--- a/hercules/code/server/tmw/itemdb.py
+++ b/hercules/code/server/tmw/itemdb.py
@@ -3,11 +3,11 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
+import os
import re
-from code.configutils import *
-from code.fileutils import *
-from code.stringutils import *
+from code.configutils import writeStartScript, writeEndScript, writeIntField, writeStrField
+from code.fileutils import readFile
def getItemDbFile(srcDir):
files = os.listdir(srcDir)
diff --git a/hercules/code/server/tmw/main.py b/hercules/code/server/tmw/main.py
index 59363ac..f3dd10d 100644
--- a/hercules/code/server/tmw/main.py
+++ b/hercules/code/server/tmw/main.py
@@ -4,23 +4,23 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-from code.server.account import *
-from code.server.accreg import *
-from code.server.party import *
-from code.server.storage import *
-from code.server.db.char import *
-from code.server.db.charregnumdb import *
-from code.server.db.inventory import *
-from code.server.db.skill import *
-from code.server.tmw.athena import *
-from code.server.tmw.consts import *
-from code.server.tmw.itemdb import *
-from code.server.tmw.mobdb import *
-from code.server.tmw.mobskilldb import *
-from code.server.tmw.npcs import *
-from code.server.utils import *
-from code.server.questsdb import *
-from code.serverutils import *
+from sets import Set
+
+from code.server.account import convertAccount
+from code.server.accreg import convertAccReg
+from code.server.party import convertParty
+from code.server.storage import convertStorage
+from code.server.db.char import saveCharTableCustom
+from code.server.db.charregnumdb import saveCharRegNumDbTable
+from code.server.db.inventory import saveInventoryTable
+from code.server.db.skill import saveSkillTable
+from code.server.tmw.athena import readAthena
+from code.server.tmw.consts import convertConsts
+from code.server.tmw.itemdb import convertItemDb
+from code.server.tmw.mobdb import convertMobDb
+from code.server.tmw.mobskilldb import convertMobSkillDb
+from code.server.tmw.npcs import createMainScript, convertNpcs
+from code.serverutils import cleanServerData
def serverTmwMain(isNew):
try:
diff --git a/hercules/code/server/tmw/mobdb.py b/hercules/code/server/tmw/mobdb.py
index 652a203..04d1fce 100644
--- a/hercules/code/server/tmw/mobdb.py
+++ b/hercules/code/server/tmw/mobdb.py
@@ -3,11 +3,12 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-import re, math
+import math
+import os
+import re
-from code.configutils import *
-from code.fileutils import *
-from code.stringutils import *
+from code.configutils import isHaveData, writeCondField2, writeStartBlock, writeEndBlock, writeIntField, writeStrField, writeFieldArr, writeIntField2, writeFieldList, writeSubField
+from code.fileutils import readFile
def getMobDbFile(srcDir):
files = os.listdir(srcDir)
diff --git a/hercules/code/server/tmw/mobskilldb.py b/hercules/code/server/tmw/mobskilldb.py
index cba7d70..7188824 100644
--- a/hercules/code/server/tmw/mobskilldb.py
+++ b/hercules/code/server/tmw/mobskilldb.py
@@ -5,8 +5,7 @@
import re
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readFile
def convertMobSkillDb():
srcFile = "oldserverdata/world/map/db/mob_skill_db.txt"
diff --git a/hercules/code/server/tmw/npcs.py b/hercules/code/server/tmw/npcs.py
index dc73d75..c51da78 100644
--- a/hercules/code/server/tmw/npcs.py
+++ b/hercules/code/server/tmw/npcs.py
@@ -3,10 +3,11 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
+import os
import re
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import makeDir
+from code.stringutils import stripWindows, stripNewLine
mapsConfFile = "newserverdata/conf/maps.conf"
if os.path.isfile(mapsConfFile):
diff --git a/hercules/code/server/utils.py b/hercules/code/server/utils.py
index 0f164ca..ebbddf3 100644
--- a/hercules/code/server/utils.py
+++ b/hercules/code/server/utils.py
@@ -3,7 +3,7 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-from code.fileutils import *
+from code.fileutils import removeAllFiles, makeDir
def cleanServerData():
removeAllFiles("newserverdata")
diff --git a/hercules/code/servertoclient/homunculuses.py b/hercules/code/servertoclient/homunculuses.py
index f2683d3..678a96c 100644
--- a/hercules/code/servertoclient/homunculuses.py
+++ b/hercules/code/servertoclient/homunculuses.py
@@ -5,7 +5,7 @@
import re
-from code.fileutils import *
+from code.fileutils import makeDir, readFile, saveFile
def convertHomunculuses():
destDir = "clientdata/"
diff --git a/hercules/code/servertoclient/items.py b/hercules/code/servertoclient/items.py
index 89a9b96..3fdb531 100644
--- a/hercules/code/servertoclient/items.py
+++ b/hercules/code/servertoclient/items.py
@@ -6,8 +6,8 @@
import re
from sets import Set
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import makeDir, readFile, saveFile
+from code.stringutils import stripQuotes2, strToXml
def prepStat(val, text):
if val != "0" and val != "":
@@ -38,35 +38,35 @@ def convertItems():
rows = stripQuotes2(rows)
itemId = rows[0]
name = rows[1]
- name2 = rows[2]
+# name2 = rows[2]
itemType = rows[3]
- priceBuy = rows[4]
- priceSell = rows[5]
+# priceBuy = rows[4]
+# priceSell = rows[5]
weight = rows[6]
atk = rows[7]
matk = rows[8]
defense = rows[9]
attackRange = rows[10]
- slots = rows[11]
- equipJobs = rows[12]
- equipUpper = rows[12]
- equipGender = rows[14]
+# slots = rows[11]
+# equipJobs = rows[12]
+# equipUpper = rows[12]
+# equipGender = rows[14]
equipLocations = rows[15]
- weaponLevel = rows[16]
- equipLevelMin = rows[17]
- equipLevelMax = rows[18]
- refinable = rows[19]
+# weaponLevel = rows[16]
+# equipLevelMin = rows[17]
+# equipLevelMax = rows[18]
+# refinable = rows[19]
view = rows[20]
- bindOnEquip = rows[21]
- buyInStore = rows[22]
+# bindOnEquip = rows[21]
+# buyInStore = rows[22]
delay = rows[23]
- tradeFlag = rows[24]
- tradeGroup = rows[25]
- nouseFlag = rows[26]
- nouseGroup = rows[27]
- stackAmount = rows[28]
- stackFlag = rows[29]
- sprite = rows[30]
+# tradeFlag = rows[24]
+# tradeGroup = rows[25]
+# nouseFlag = rows[26]
+# nouseGroup = rows[27]
+# stackAmount = rows[28]
+# stackFlag = rows[29]
+# sprite = rows[30]
name = name.replace("\\'", "'")
image = ""
diff --git a/hercules/code/servertoclient/luas.py b/hercules/code/servertoclient/luas.py
index 6399da6..8b401b7 100644
--- a/hercules/code/servertoclient/luas.py
+++ b/hercules/code/servertoclient/luas.py
@@ -4,10 +4,6 @@
# Author: Andrei Karas (4144)
import re
-from sets import Set
-
-from code.fileutils import *
-from code.stringutils import *
comaSplit = re.compile(",")
equalSplit = re.compile("=")
diff --git a/hercules/code/servertoclient/maps.py b/hercules/code/servertoclient/maps.py
index e0a7641..0f1ca5b 100644
--- a/hercules/code/servertoclient/maps.py
+++ b/hercules/code/servertoclient/maps.py
@@ -5,8 +5,8 @@
import zlib
-from code.fileutils import *
-from code.tileutils import *
+from code.fileutils import readInt16, readInt32, makeDir, copyFile, readFile, readMapName, saveFile, readData
+from code.tileutils import getTileData, getTile
def covertToTmx(f, mapsCount):
destDir = "clientdata/"
diff --git a/hercules/code/servertoclient/mercenaries.py b/hercules/code/servertoclient/mercenaries.py
index 9e4245d..481f66c 100644
--- a/hercules/code/servertoclient/mercenaries.py
+++ b/hercules/code/servertoclient/mercenaries.py
@@ -5,7 +5,7 @@
import re
-from code.fileutils import *
+from code.fileutils import makeDir, readFile, saveFile
def convertMercenaries():
destDir = "clientdata/"
diff --git a/hercules/code/servertoclient/monsters.py b/hercules/code/servertoclient/monsters.py
index 10f20ec..969795d 100644
--- a/hercules/code/servertoclient/monsters.py
+++ b/hercules/code/servertoclient/monsters.py
@@ -4,12 +4,9 @@
# Author: Andrei Karas (4144)
import re
-from sets import Set
-from code.fileutils import *
-from code.stringutils import *
-
-from code.servertoclient.sprites import *
+from code.fileutils import makeDir, readFile, saveFile
+from code.stringutils import strToXml, stripQuotes
def convertMonsters(isNonFree = False, idtofile = None):
destDir = "clientdata/"
@@ -21,7 +18,6 @@ def convertMonsters(isNonFree = False, idtofile = None):
tpl = readFile(templatesDir + "monster.tpl")
monsters = readFile(templatesDir + "monsters.xml")
data = ""
- ids = Set()
with open(monstersDbFile, "r") as f:
for line in f:
diff --git a/hercules/code/servertoclient/npcs.py b/hercules/code/servertoclient/npcs.py
index be5cb46..5e49ffd 100644
--- a/hercules/code/servertoclient/npcs.py
+++ b/hercules/code/servertoclient/npcs.py
@@ -3,13 +3,8 @@
# Copyright (C) 2015 Evol Online
# Author: Andrei Karas (4144)
-import re
-from sets import Set
+from code.fileutils import makeDir, readFile, saveFile
-from code.fileutils import *
-from code.stringutils import *
-
-from code.servertoclient.sprites import *
def getNpcIds(idtofile):
for key1 in idtofile:
@@ -17,12 +12,10 @@ def getNpcIds(idtofile):
if 45 <= key <= 125 or 400 < key < 1000 or 10001 <= key < 10100:
yield key1
+
def convertNpcsNonFree(idtofile):
destDir = "clientdata/"
templatesDir = "templates/"
- monstersDbFile = "serverdata/sql-files/mob_db_re.sql"
- fieldsSplit = re.compile(",")
- bracketsSplit = re.compile("[(]|[)]")
makeDir(destDir)
tpl = readFile(templatesDir + "npc.tpl")
npcs = readFile(templatesDir + "npcs.xml")
diff --git a/hercules/code/servertoclient/pets.py b/hercules/code/servertoclient/pets.py
index c064af7..bc6deef 100644
--- a/hercules/code/servertoclient/pets.py
+++ b/hercules/code/servertoclient/pets.py
@@ -5,7 +5,7 @@
import re
-from code.fileutils import *
+from code.fileutils import makeDir, readFile, saveFile
def convertPets():
destDir = "clientdata/"
diff --git a/hercules/code/servertoclient/quests.py b/hercules/code/servertoclient/quests.py
index 848f07b..df47fd5 100644
--- a/hercules/code/servertoclient/quests.py
+++ b/hercules/code/servertoclient/quests.py
@@ -5,8 +5,8 @@
import re
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import makeDir, readFile, saveFile
+from code.stringutils import strToXml, stripQuotes
def convertQuests():
print "quests disabled for now"
diff --git a/hercules/code/servertoclient/skills.py b/hercules/code/servertoclient/skills.py
index 022e874..6affb72 100644
--- a/hercules/code/servertoclient/skills.py
+++ b/hercules/code/servertoclient/skills.py
@@ -5,7 +5,7 @@
import re
-from code.fileutils import *
+from code.fileutils import makeDir, readFile, saveFile
def convertSkillsToXml():
destDir = "clientdata/"
diff --git a/hercules/code/servertoclient/sprites.py b/hercules/code/servertoclient/sprites.py
index 9873d40..5dad9d1 100644
--- a/hercules/code/servertoclient/sprites.py
+++ b/hercules/code/servertoclient/sprites.py
@@ -3,13 +3,11 @@
# Copyright (C) 2015 Evol Online
# Author: Andrei Karas (4144)
+import array
import os
from PIL import Image
-from PIL import ImageDraw
-from sets import Set
-from code.fileutils import *
-from code.stringutils import *
+from code.fileutils import readInt8, readInt16, readInt32, makeDir, readFile, saveFile, skipData, readData, findFileIn
class ActClass:
pass
@@ -48,7 +46,7 @@ def readIndexedRLEImage(f, spr):
image.data = data
compressSize = readInt16(f)
- uncompressedSize = image.width * image.height
+ #uncompressedSize = image.width * image.height
#print "uncompressed size=" + str(uncompressedSize)
#print "compressed size=" + str(compressSize)
@@ -160,7 +158,7 @@ def saveSpriteImage(act, spr, spriteDir, spriteName):
anim = act.animations[animN]
for spriteN in range(0, anim.nsprites):
sprite = anim.sprites[spriteN]
- key = []
+# key = []
# for frameN in range(0, sprite.nframes):
# frame = sprite.frames[frameN]
# idf = frame.frameIndex
@@ -254,7 +252,7 @@ def extractSpriteAnimData(act, spr, actIndex, direction):
anim = act.animations[actIndex]
for spriteN in range(0, anim.nsprites):
- sprite = anim.sprites[spriteN]
+ #sprite = anim.sprites[spriteN]
#for frameN in range(0, sprite.nframes):
#frame = sprite.frames[frameN]
#frm = frame.frameIndex
diff --git a/hercules/code/tileutils.py b/hercules/code/tileutils.py
index c5457e7..42e7a84 100644
--- a/hercules/code/tileutils.py
+++ b/hercules/code/tileutils.py
@@ -14,7 +14,7 @@ def getTileData(mapData, x, y, sx):
def getTile(data):
normal = 0
- collison = 0
+ collision = 0
if data == 0: # 000 normal walkable
normal = 1
collision = 5
diff --git a/hercules/convert_db.py b/hercules/convert_db.py
index 1c367ff..e10ad8a 100755
--- a/hercules/convert_db.py
+++ b/hercules/convert_db.py
@@ -6,8 +6,8 @@
import sys
-from code.server.evol.main import *
-from code.server.tmw.main import *
+from code.server.evol.main import dbEvolMain
+from code.server.tmw.main import dbTmwMain
def showHelp():
print "Usage: ./convert_db.py evol"
diff --git a/hercules/convert_mapcache_to_tmx.py b/hercules/convert_mapcache_to_tmx.py
index bcc50ac..e6e6bc9 100755
--- a/hercules/convert_mapcache_to_tmx.py
+++ b/hercules/convert_mapcache_to_tmx.py
@@ -6,8 +6,8 @@
import os
-from code.fileutils import *
-from code.servertoclient.maps import *
+from code.fileutils import readInt32, readInt16
+from code.servertoclient.maps import covertToTmx
def runFunction(path):
with open(path, "rb") as f:
diff --git a/hercules/convert_server.py b/hercules/convert_server.py
index 6f0f5ba..83e9149 100755
--- a/hercules/convert_server.py
+++ b/hercules/convert_server.py
@@ -6,9 +6,8 @@
import sys
-from code.serverutils import *
-from code.server.evol.main import *
-from code.server.tmw.main import *
+from code.server.evol.main import serverEvolMain
+from code.server.tmw.main import serverTmwMain
def showHelp():
print "Usage: ./convert_server.py evol"
diff --git a/hercules/convert_server_to_client.py b/hercules/convert_server_to_client.py
index 03f7457..f98ead3 100755
--- a/hercules/convert_server_to_client.py
+++ b/hercules/convert_server_to_client.py
@@ -4,16 +4,16 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-from code.servertoclient.homunculuses import *
-from code.servertoclient.items import *
-from code.servertoclient.luas import *
-from code.servertoclient.mercenaries import *
-from code.servertoclient.monsters import *
-from code.servertoclient.npcs import *
-from code.servertoclient.pets import *
-from code.servertoclient.quests import *
-from code.servertoclient.skills import *
-from code.servertoclient.sprites import *
+from code.servertoclient.homunculuses import convertHomunculuses
+from code.servertoclient.items import convertItems
+from code.servertoclient.luas import convertLuas
+from code.servertoclient.mercenaries import convertMercenaries
+from code.servertoclient.monsters import convertMonsters
+from code.servertoclient.npcs import convertNpcsNonFree
+from code.servertoclient.pets import convertPets
+from code.servertoclient.quests import convertQuests
+from code.servertoclient.skills import convertSkillsToXml
+from code.servertoclient.sprites import convertSpritesNonFree
# non free data
idtofile = convertLuas()
diff --git a/hercules/convert_tmx_to_mapcache.py b/hercules/convert_tmx_to_mapcache.py
index a41816b..62d0d18 100755
--- a/hercules/convert_tmx_to_mapcache.py
+++ b/hercules/convert_tmx_to_mapcache.py
@@ -4,6 +4,6 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-from code.clienttoserver.maps import *
+from code.clienttoserver.maps import recreateMapCache
recreateMapCache();
diff --git a/hercules/extract_mapcache.py b/hercules/extract_mapcache.py
index fc82404..39a63c3 100755
--- a/hercules/extract_mapcache.py
+++ b/hercules/extract_mapcache.py
@@ -6,8 +6,8 @@
import os
-from code.fileutils import *
-from code.server.maps import *
+from code.fileutils import readInt16, readInt32
+from code.server.maps import extractMaps
def runFunction(path):
diff --git a/hercules/list_mapcache.py b/hercules/list_mapcache.py
index 79a7910..2a83f53 100755
--- a/hercules/list_mapcache.py
+++ b/hercules/list_mapcache.py
@@ -6,8 +6,8 @@
import os
-from code.fileutils import *
-from code.server.maps import *
+from code.fileutils import readInt16, readInt32
+from code.server.maps import listMapCache
def runFunction(path):
with open(path, "rb") as f:
diff --git a/herculesversion/packetversion.py b/herculesversion/packetversion.py
index 279aea2..e75db57 100755
--- a/herculesversion/packetversion.py
+++ b/herculesversion/packetversion.py
@@ -4,21 +4,9 @@
# Copyright (C) 2014 Evol Online
# Author: Andrei Karas (4144)
-import array
-import base64
-import gzip
import os
import re
-import datetime
-import xml
-import csv
-import ogg.vorbis
-import StringIO
import sys
-import zlib
-import struct
-import shutil
-from sets import Set
defStart = "#if PACKETVER >= "
defEnd = "#endif"
diff --git a/lang/updatelang.py b/lang/updatelang.py
index 6ba74c5..397cfcb 100755
--- a/lang/updatelang.py
+++ b/lang/updatelang.py
@@ -99,7 +99,7 @@ def collectMessages(messagesDir):
idx = line.find(": ")
if idx < 1:
continue
- msgId = line[:idx]
+# msgId = line[:idx]
msgStr = line[idx + 2:]
if msgStr[-1:] == "\n":
msgStr = msgStr[:-1]
diff --git a/pluginvalidator/validate.py b/pluginvalidator/validate.py
index 1c71f8c..796bd26 100755
--- a/pluginvalidator/validate.py
+++ b/pluginvalidator/validate.py
@@ -118,7 +118,7 @@ def decodeTypes(funcs):
for f in funcs:
#print "{0}: {1}".format(f, funcs[f])
fstr = funcs[f]
- idx = fstr.find("(")
+# idx = fstr.find("(")
fstr = fstr[fstr.find("(") + 1 : fstr.rfind(")")]
parts = comaSplit.split(fstr)
lst = []
@@ -214,7 +214,7 @@ def processServer(name1, name2):
session.plugDecls = decodeTypes(session.plugDecls)
#print session.plugDecls
- pluginfunctions = session.decls
+# pluginfunctions = session.decls
session.func = extractFuncFuncions
session.funcList = funcToPlug
session.altList = plugToFunc
diff --git a/servergreps/hercules/src/preproc.py b/servergreps/hercules/src/preproc.py
index 23735c9..4f3b458 100755
--- a/servergreps/hercules/src/preproc.py
+++ b/servergreps/hercules/src/preproc.py
@@ -5,8 +5,6 @@
# Author: Andrei Karas (4144)
import os
-import re
-import sys
import shutil
class PreProc:
diff --git a/servergreps/hercules/src/server.py b/servergreps/hercules/src/server.py
index c70d411..614feb5 100755
--- a/servergreps/hercules/src/server.py
+++ b/servergreps/hercules/src/server.py
@@ -4,7 +4,6 @@
# Copyright (C) 2015-2016 Evol Online
# Author: Andrei Karas (4144)
-import os
import re
class Server:
diff --git a/testxml/testxml.py b/testxml/testxml.py
index c350e65..d62d1f4 100755
--- a/testxml/testxml.py
+++ b/testxml/testxml.py
@@ -5,8 +5,6 @@
# Author: Andrei Karas (4144)
import array
-import base64
-import gzip
import os
import re
import datetime
@@ -181,7 +179,7 @@ def checkFilePermission(fullName):
def loadPaths():
global warnings, iconsDir, spritesDir, sfxDir, particlesDir, mapsDir, spriteErrorFile, \
levelUpEffectFile, portalEffectFile, minimapsDir, wallpapersDir, walpaperFile, \
- musicDir
+ musicDir, wallpaperFile
try:
dom = minidom.parse(parentDir + "/paths.xml")
for node in dom.getElementsByTagName("option"):
@@ -438,12 +436,12 @@ def testSpriteFile(id, fullPath, file, fileLoc, dnum, variant, checkAction, iser
except:
variants = 0
- try:
- variant_offset = dom.documentElement.attributes["variant_offset"].value
- except:
- variant_offset = 0
+# try:
+# variant_offset = dom.documentElement.attributes["variant_offset"].value
+# except:
+# variant_offset = 0
- root = dom.childNodes[0];
+# root = dom.childNodes[0];
imagesets = dom.getElementsByTagName("imageset")
if imagesets is None or len(imagesets) < 1:
showMsgSprite(fileLoc, "incorrect number of imageset tags", iserr)
@@ -591,8 +589,6 @@ def testSpriteFile(id, fullPath, file, fileLoc, dnum, variant, checkAction, iser
except:
actions = None
- foundAction = False
-
if (actions == None or len(actions) == 0) and (includes == None or len(includes) == 0):
showMsgSprite(fileLoc, "no actions in sprite file", iserr)
else:
@@ -778,10 +774,10 @@ def testSpriteAction(file, name, action, numframes, iserr):
except:
showMsgSprite(file, "no sequence start or end index action: " + \
name + ", direction: " + direction, iserr)
- try:
- repeat = int(sequence.attributes["repeat"].value)
- except:
- repeat = 1
+# try:
+# repeat = int(sequence.attributes["repeat"].value)
+# except:
+# repeat = 1
if i1 >= numframes or i1 < 0:
showMsgSprite(file, "incorrect start sequence index " + str(i1) + \
@@ -934,7 +930,7 @@ def testSound(file, sfxDir, msg):
showMsgFile(file, "sound file not found", True)
return
try:
- snd = ogg.vorbis.VorbisFile(fullPath)
+ ogg.vorbis.VorbisFile(fullPath)
except ogg.vorbis.VorbisError as e:
showMsgFile(file, "sound file incorrect error: " + str(e), True)
@@ -1091,10 +1087,10 @@ def testItems(fileName, imgDir):
except:
drawAfter = ""
- try:
- drawPriority = int(node.attributes["drawPriority"].value)
- except:
- drawPriority = 0
+# try:
+# drawPriority = int(node.attributes["drawPriority"].value)
+# except:
+# drawPriority = 0
if type == "hairsprite":
if idI >= 0:
@@ -1177,7 +1173,7 @@ def testItems(fileName, imgDir):
fullPath = os.path.abspath(parentDir + "/" + imgDir + floor)
if not os.path.isfile(fullPath) or os.path.exists(fullPath) == False:
showFileErrorById (id, imgDir, floor)
- error = errors + 1
+ errors = errors + 1
else:
testImageFile(imgDir + floor, fullPath, 0, "", True)
@@ -1209,7 +1205,6 @@ def testItems(fileName, imgDir):
def testItemReplace(id, rootNode, name):
global warnings, errors
- sprites = set()
for node in rootNode.getElementsByTagName(name):
if node.parentNode != rootNode:
continue
@@ -2190,7 +2185,6 @@ def testSoundsDir(dir, sfxDir):
if not os.path.isfile(file2):
testSoundsDir(dir + file + "/", sfxDir)
elif filtogg.search(file):
- fullName = dir + file
testSound(dir + file, sfxDir, "")