| 1 | # |
| 2 | # (C) Copyright 2001 Kai Sterker <[email protected]> |
| 3 | # Part of the Adonthell Project http://adonthell.linuxgames.com |
| 4 | # |
| 5 | # This program is free software; you can redistribute it and/or modify |
| 6 | # it under the terms of the GNU General Public License. |
| 7 | # This program is distributed in the hope that it will be useful, |
| 8 | # but WITHOUT ANY WARRANTY. |
| 9 | # |
| 10 | # See the COPYING file for more details |
| 11 | # |
| 12 | |
| 13 | # -- Map Event to teleport a character into Silverhair's room, if allowed. |
| 14 | # |
| 15 | # Teleport the character that triggered this event to another position |
| 16 | # if silverhair is considered as innocent by Jelom. |
| 17 | |
| 18 | import adonthell |
| 19 | import events |
| 20 | |
| 21 | class fst_to_silverhair(object): |
| 22 | |
| 23 | # Parameters: |
| 24 | # smdest: destination submap |
| 25 | # xdest: X position on smdest |
| 26 | # ydest: Y position on smdest |
| 27 | # destdir: direction where to look at after the teleport |
| 28 | def __init__ (self, eventinstance, smdest, xdest, ydest, destdir): |
| 29 | self.smdest = smdest |
| 30 | self.xdest = xdest |
| 31 | self.ydest = ydest |
| 32 | self.destdir = destdir |
| 33 | |
| 34 | def run (self, submap, x, y, dir, name): |
| 35 | p = adonthell.gamedata_get_character (name) |
| 36 | |
| 37 | free = adonthell.gamedata_get_quest ("demo").get_val("silverhair_free") |
| 38 | |
| 39 | # -- Jelom not convinced of Silverhair's innocence |
| 40 | if not free and p.get_name () == adonthell.gamedata_player ().get_name (): |
| 41 | # -- we only need that for the dialogue, ... |
| 42 | p.set_val ("at_silverhairs_door", 1) |
| 43 | p.stand () |
| 44 | p.go_north () |
| 45 | adonthell.gamedata_get_character ("Jelom Rasgar").launch_action (p) |
| 46 | # -- ... so remove it again afterwards |
| 47 | p.set_val ("at_silverhairs_door", 0) |
| 48 | else: |
| 49 | events.switch_submap (p, self.smdest, self.xdest, self.ydest, self.destdir) |
| 50 | adonthell.audio_fade_out_background (500) |