adonthell-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-commits] CVS: wastesedge/scripts/game_events .cvsignore,NONE,


From: Kai Sterker <address@hidden>
Subject: [Adonthell-commits] CVS: wastesedge/scripts/game_events .cvsignore,NONE,1.1 Makefile.am,NONE,1.1 brn_to_silverhair.py,NONE,1.1 cellar_to_bjarn.py,NONE,1.1 character_speak.py,NONE,1.1 fst_to_silverhair.py,NONE,1.1 lft_to_vnd.py,NONE,1.1 open_inn_door.py,NONE,1.1 search_chest.py,NONE,1.1 silverhair_to_brn.py,NONE,1.1 silverhair_to_fst.py,NONE,1.1 teleport.py,NONE,1.1 to_storage.py,NONE,1.1 vnd_to_lft.py,NONE,1.1
Date: Mon, 06 May 2002 09:47:20 -0400

Update of /cvsroot/adonthell/wastesedge/scripts/game_events
In directory subversions:/tmp/cvs-serv1954/scripts/game_events

Added Files:
        .cvsignore Makefile.am brn_to_silverhair.py cellar_to_bjarn.py 
        character_speak.py fst_to_silverhair.py lft_to_vnd.py 
        open_inn_door.py search_chest.py silverhair_to_brn.py 
        silverhair_to_fst.py teleport.py to_storage.py vnd_to_lft.py 
Log Message:
UPDATE to 0.3.2pre


--- NEW FILE ---
*.pyc
Makefile.in
Makefile

--- NEW FILE ---
pkgdatadir = $(gamedatadir)/scripts/game_events

pkgdata_DATA = *.pyc

EXTRA_DIST = teleport.py cellar_to_bjarn.py fst_to_silverhair.py \
        character_speak.py open_inn_door.py silverhair_to_fst.py \
        silverhair_to_brn.py brn_to_silverhair.py search_chest.py \
        to_storage.py lft_to_vnd.py vnd_to_lft.py __init__.py

all:
        $(adonthell_binary) -c

*.pyc: *.py

CLEANFILES = *.pyc

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport a character from the veranda into 
#    Silverhair's room

import adonthell
import events

class brn_to_silverhair:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir

    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)
        p.set_val ("came_from_barn", 1)
        p.set_val ("on_veranda", 0)
         
        events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)
        adonthell.audio_fade_out_background (500)

        p.stand ()
        p.go_west ()
        
        silverhair = adonthell.gamedata_get_character ("Imoen Silverhair")
        
        # -- only initiate dialogue the first time the player enters
        if silverhair.get_val ("talked_to") == 0:
            silverhair.launch_action (p)

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport a character into Bjarn's room, if allowed.
#
#    Teleport the character that triggered this event to another position
#    if bjarn's room door is open.

import adonthell
import events

class cellar_to_bjarn:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir
        
    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)
        # -- bjarn's door closed?
        open = adonthell.gamedata_get_quest ("demo").get_val("bjarn_door_open")
        if open == 0 or open == 1:
            if p.get_name () == adonthell.gamedata_player ().get_name ():
                adonthell.gamedata_get_character ("Bjarn 
Fingolson").launch_action (p)
            p.stand ()
            p.go_west ()
        else:
            events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)

--- NEW FILE ---
#
#  (C) Copyright 2001 Alexandre Courbot <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to make a character say something.

import adonthell

class character_speak:

    # Parameters:
    # name: name of the character that should speak when the event is triggered
    # sentence: sentence to say when the event is triggered
    def __init__ (self, eventinstance, name, sentence):
        self.myself = eventinstance
        self.mapchar = adonthell.gamedata_get_character (name)
        self.sentence = sentence

    def run (self, submap, x, y, dir, name):
        self.mapchar.speak (self.sentence)

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport a character into Silverhair's room, if allowed.
#
#    Teleport the character that triggered this event to another position
#    if silverhair is considered as innocent by Jelom.

import adonthell
import events

class fst_to_silverhair:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir

    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)

        free = adonthell.gamedata_get_quest ("demo").get_val("silverhair_free")

        # -- Jelom not convinced of Silverhair's innocence
        if not free and p.get_name () == adonthell.gamedata_player ().get_name 
():
            # -- we only need that for the dialogue, ...
            p.set_val ("at_silverhairs_door", 1)
            p.stand ()
            p.go_north ()
            adonthell.gamedata_get_character ("Jelom Rasgar").launch_action (p)
            # -- ... so remove it again afterwards
            p.set_val ("at_silverhairs_door", 0)
        else:
            events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)
            adonthell.audio_fade_out_background (500)
--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport a character from the barn onto 
#    the veranda

import adonthell
import events

class lft_to_vnd:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir

    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)
        p.set_val ("on_veranda", 1)
            
        events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)

--- NEW FILE ---
#
#  (C) Copyright 2001 Alexandre Courbot <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to open / close the inn door.

import adonthell

class open_inn_door:

    def __init__ (self, eventinstance):
        pass

    def run (self, submap, x, y, dir, name):
        adonthell.gamedata_engine ().get_landmap ().get_mapobject (0).\
                                     get_animation (0).next_frame ()

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Let the player search Silverhair's chest

import adonthell

# -- pygettext support
def _(message): return message

class search_chest:

    # Parameters:
    # name: name of the character that should speak when the event is triggered
    def __init__ (self, eventinstance, name):
        self.myself = eventinstance
        self.mapchar = adonthell.gamedata_get_character (name)

    def run (self, submap, x, y, dir, name):
        if adonthell.gamedata_get_quest ("demo").get_val ("get_item") == 1:
            fgs = find_gem_screen ()
            
            adonthell.gamedata_engine ().set_control_active (0)
            adonthell.gamedata_player ().set_schedule_active (0)
            adonthell.gamedata_engine ().main (fgs, "find_gem_screen")
            adonthell.gamedata_player ().set_schedule_active (1)
            adonthell.gamedata_engine ().set_control_active (1)
            
            adonthell.gamedata_get_quest ("demo").set_val ("get_item", 2)
            adonthell.gamedata_get_quest ("demo").set_val ("have_gem", 1)
        else:
            self.mapchar.speak (_("I know this chest. The Lady uses it on her 
journeys."))


class find_gem_screen (adonthell.win_container):
    def __init__(self):
        adonthell.win_container.__init__(self)

        self.py_signal_connect (self.on_update, adonthell.win_event_UPDATE)
        self.state = 1

        # -- get font and theme
        self.font = adonthell.win_manager_get_font ("original")
        self.theme = adonthell.win_manager_get_theme ("original")
        
        self.move (58, 75)      
        self.resize (205, 70)
        self.set_border (self.theme, adonthell.win_border_MINI)
        self.set_background (self.theme)
        self.set_trans_background (1)

        # -- The window text
        self.text = adonthell.win_label ()
        self.text.thisown = 0
        self.text.resize (120, 0)
        self.text.set_font (self.font)
        self.text.set_form (adonthell.label_AUTO_HEIGHT)
        self.text.set_text (_("Upon opening the chest, a small green something 
catches your attention ..."))
        self.text.pack ()
        self.text.move (80, (self.height () - self.text.height ())/2)

        # -- The character image
        self.image = adonthell.win_image ()
        self.image.thisown = 0
        self.image.move (10, 3)
        self.image.resize (64, 64)
        self.image.load_pnm ("gfx/cutscene/gem.pnm")
        self.image.set_mask (1)
        self.image.pack ()
        
        self.add (self.text)
        self.add (self.image)
        
        self.set_visible_background (1)
        self.set_visible_border (1)
        self.set_visible_all (1)

    # -- catch relevant keypresses
    def on_update (self):
        # -- quit
        if adonthell.input_has_been_pushed (adonthell.SDLK_RETURN) or \
           adonthell.input_has_been_pushed (adonthell.SDLK_SPACE) or \
           adonthell.input_has_been_pushed (adonthell.SDLK_ESCAPE):
           
            # -- display second part of text
            if self.state == 1:
                self.text.set_text (_("There, inmidst your mistress' luggage, 
lies one of Master Fingolson's gems."))
                self.text.pack ()
                self.text.move (80, (self.height () - self.text.height ())/2)
                self.state = 2
                
            # -- end
            else:
                adonthell.gamedata_engine ().main_quit ()

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport a character from the barn into Silverhair's room

import adonthell
import events

class silverhair_to_brn:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir

    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)

        if p.get_val ("came_from_barn") == 1:
            p.set_val ("came_from_barn", 0)
            p.set_val ("on_veranda", 1)
            
            events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)
            adonthell.audio_fade_out_background (500)

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport a character from Silverhair's room, if allowed.

import adonthell
import events

def _(message): return message

class silverhair_to_fst:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir

    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)

        # -- Jelom not convinced of Silverhair's innocence
        if p.get_val ("came_from_barn") == 1:
            p.stand ()
            p.go_south ()
            p.speak (_("I better leave the way I came."))
        else:
            events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)
            adonthell.audio_fade_out_background (500)

--- NEW FILE ---
#
#  (C) Copyright 2001 Alexandre Courbot <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event for teleporting a character.
#
#    Teleport the character that triggered this event to another position


import adonthell
import events

class teleport:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir
    
    def run (self, submap, x, y, dir, name):
        events.switch_submap (adonthell.gamedata_get_character (name),
            self.smdest, self.xdest, self.ydest, self.destdir)

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport the player into the storageroom, if he has the
#    key.

import adonthell
import events

def _(message): return message

class to_storage:

    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir
        
    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)
        
        # -- pantry door closed?
        locked = adonthell.gamedata_get_quest ("demo").get_val("pantry_locked")
        if locked == 0 or locked == 1:
            adonthell.gamedata_get_quest ("demo").set_val("pantry_locked", 1)
            p.stand ()
            p.go_east ()
            p.speak (_("The door to the pantry is locked."))
        else:
            events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)

--- NEW FILE ---
#
#  (C) Copyright 2001 Kai Sterker <address@hidden>
#  Part of the Adonthell Project http://adonthell.linuxgames.com
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License.
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY.
#
#  See the COPYING file for more details
#

# -- Map Event to teleport a character from the barn onto 
#    the veranda

import adonthell
import events

class vnd_to_lft:
    # Parameters:
    # smdest: destination submap
    # xdest: X position on smdest
    # ydest: Y position on smdest
    # destdir: direction where to look at after the teleport
    def __init__ (self, eventinstance, smdest, xdest, ydest, destdir):
        self.smdest = smdest
        self.xdest = xdest
        self.ydest = ydest
        self.destdir = destdir

    def run (self, submap, x, y, dir, name):
        p = adonthell.gamedata_get_character (name)
        p.set_val ("on_veranda", 0)
            
        events.switch_submap (p, self.smdest, self.xdest, self.ydest, 
self.destdir)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]