From ab7496dd21c6a26c233da1db349bee63be6b0dcf Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Wed, 24 Jun 2020 00:41:28 -0300 Subject: New object: Treasure Chest (Static only) --- hercules/tmx_converter.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'hercules') 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 ############################################################## -- cgit v1.2.3-60-g2f50