diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-09-20 17:45:30 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-09-20 17:45:30 +0300 |
commit | 551261e4aa47d9e4baa9396e20f503b9fc75680a (patch) | |
tree | 52a125e266c9338a365854be97ffe75360b1ecda /hercules/code | |
parent | 06887bd17dd04cb6314cc215424b041dda7dca87 (diff) | |
download | evol-tools-551261e4aa47d9e4baa9396e20f503b9fc75680a.tar.gz evol-tools-551261e4aa47d9e4baa9396e20f503b9fc75680a.tar.bz2 evol-tools-551261e4aa47d9e4baa9396e20f503b9fc75680a.tar.xz evol-tools-551261e4aa47d9e4baa9396e20f503b9fc75680a.zip |
hercules: add support for convert ro npcs.
Diffstat (limited to 'hercules/code')
-rw-r--r-- | hercules/code/servertoclient/npcs.py | 34 | ||||
-rw-r--r-- | hercules/code/servertoclient/sprites.py | 2 |
2 files changed, 35 insertions, 1 deletions
diff --git a/hercules/code/servertoclient/npcs.py b/hercules/code/servertoclient/npcs.py new file mode 100644 index 0000000..1c0d76f --- /dev/null +++ b/hercules/code/servertoclient/npcs.py @@ -0,0 +1,34 @@ +# -*- coding: utf8 -*- +# +# Copyright (C) 2015 Evol Online +# Author: Andrei Karas (4144) + +import re +from sets import Set + +from code.fileutils import * +from code.stringutils import * + +from code.servertoclient.sprites import * + +def getNpcIds(idtofile): + for key1 in idtofile: + key = int(key1) + 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") + data = "" + + for key in getNpcIds(idtofile): + npcSprite = "<sprite>sprites/{0}.xml</sprite>".format(idtofile[key]) + data = data + tpl.format(key, idtofile[key], npcSprite) + saveFile(destDir + "npcs.xml", npcs.format(data)) diff --git a/hercules/code/servertoclient/sprites.py b/hercules/code/servertoclient/sprites.py index 9243f19..035540e 100644 --- a/hercules/code/servertoclient/sprites.py +++ b/hercules/code/servertoclient/sprites.py @@ -307,7 +307,7 @@ def saveSpriteXml(act, spr, spriteDir, spriteName): deadData = extractSpriteDataAll(act, spr, 32, "dead") data = tpl.format( - src = "graphics/sprites/monsters/" + spriteName + ".png", + src = "graphics/sprites/sprites/" + spriteName + ".png", width = spr.maxwidth, height = spr.maxheight, stand = standData, |