diff options
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> |