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 | |
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')
-rw-r--r-- | hercules/code/servertoclient/npcs.py | 34 | ||||
-rw-r--r-- | hercules/code/servertoclient/sprites.py | 2 | ||||
-rwxr-xr-x | hercules/convert_server_to_client.py | 2 | ||||
-rw-r--r-- | hercules/templates/npc.tpl | 3 | ||||
-rw-r--r-- | hercules/templates/npcs.xml | 11 |
5 files changed, 51 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, diff --git a/hercules/convert_server_to_client.py b/hercules/convert_server_to_client.py index fc2dec2..03f7457 100755 --- a/hercules/convert_server_to_client.py +++ b/hercules/convert_server_to_client.py @@ -9,6 +9,7 @@ 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 * @@ -17,6 +18,7 @@ from code.servertoclient.sprites import * # non free data idtofile = convertLuas() convertSpritesNonFree(idtofile) +convertNpcsNonFree(idtofile) convertHomunculuses() convertItems() diff --git a/hercules/templates/npc.tpl b/hercules/templates/npc.tpl new file mode 100644 index 0000000..9c345eb --- /dev/null +++ b/hercules/templates/npc.tpl @@ -0,0 +1,3 @@ + <npc id="{0}" name="{1}"> + {2} + </npc> diff --git a/hercules/templates/npcs.xml b/hercules/templates/npcs.xml new file mode 100644 index 0000000..72a0a4f --- /dev/null +++ b/hercules/templates/npcs.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Copyright (C) 2010-2014 Evol Online --> + +<npcs> + <its:rules xmlns:its="http://www.w3.org/2005/11/its" version="1.0"> + <its:translateRule selector="//monster/@name" translate="yes"/> + <its:translateRule selector="//*" translate="no"/> + </its:rules> + +{0} +</npcs> |