summaryrefslogtreecommitdiff
path: root/hercules
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2020-06-24 00:41:28 -0300
committerJesusaves <cpntb1@ymail.com>2020-06-24 00:41:28 -0300
commitab7496dd21c6a26c233da1db349bee63be6b0dcf (patch)
tree4718f7a662f9026b265292b4eeb46558fd5dbe49 /hercules
parent1e783f3840c182e3dbe1490b3f35862ae1bca5de (diff)
downloadtools-ab7496dd21c6a26c233da1db349bee63be6b0dcf.tar.gz
tools-ab7496dd21c6a26c233da1db349bee63be6b0dcf.tar.bz2
tools-ab7496dd21c6a26c233da1db349bee63be6b0dcf.tar.xz
tools-ab7496dd21c6a26c233da1db349bee63be6b0dcf.zip
New object: Treasure Chest (Static only)
Diffstat (limited to 'hercules')
-rwxr-xr-xhercules/tmx_converter.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/hercules/tmx_converter.py b/hercules/tmx_converter.py
index 92cf5a5..44a4101 100755
--- a/hercules/tmx_converter.py
+++ b/hercules/tmx_converter.py
@@ -180,6 +180,13 @@ class Trap(Object):
self.damage = 80
self.target = 3
+class TreasureChest(Object):
+ __slots__ = (
+ 'distance',
+ )
+ def __init__(self):
+ self.distance = 2
+
####################################
class ContentHandler(xml.sax.ContentHandler):
__slots__ = (
@@ -335,6 +342,12 @@ class ContentHandler(xml.sax.ContentHandler):
y += h/2
w -= 1
h -= 1
+ elif obj_type == 'treasure':
+ self.object = TreasureChest()
+ x += w/2
+ y += h/2
+ w -= 1
+ h -= 1
elif obj_type == 'function':
self.object = FunctionTrigger()
x += w/2
@@ -521,6 +534,20 @@ class ContentHandler(xml.sax.ContentHandler):
])
)
self.save_cnt = True
+ elif isinstance(obj, TreasureChest):
+ obj_name = "%s_%s_%s" % (self.base, obj.x, obj.y)
+ self.confs.write(
+ SEPARATOR.join([
+ '\n',
+ '%s,%d,%d,0\t' % (self.base, obj.x, (obj.y)),
+ 'script\t',
+ '#%s\tNPC_CHEST,{\n\tTreasureBox();' % (obj_name),
+ '\n\tspecialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing',
+ '\n\tclose;\nOnInit:\n\t.distance=%d;' % (obj.distance),
+ '\n\tend;\n}\n',
+ ])
+ )
+ self.save_cnt = True
##############################################################