Example #1
0
    def load(self, filename):

        # Store filename for later use
        self.filename = filename
        self.document = xml.dom.minidom.parse(self.filename)

        # Let's asume this is a valid file and
        # the needed elements are there.

        # Load the playtime for profiling reasons
        playTimeElement = self.document.getElementsByTagName("playtime")[0]
        self.seconds = int(playTimeElement.getAttribute("seconds"))
        self.startTime = self.engine.getTicks()

        # Start by loading the records, because they are needed by the map
        recordsElement = self.document.getElementsByTagName("records")[0]
        self.records = str(recordsElement.firstChild.data).split()

        # Now we can safely load the map
        mapElement = self.document.getElementsByTagName("map")[0]
        self.currentMap = self.mapLoader.loadMap(
            str(mapElement.getAttribute("filename")))
        self.currentMap.setCurrentLayer(int(mapElement.getAttribute("layer")))
        self.mapManager.setCurrentMap(self.currentMap)

        # Now that we have a map we can place the player in it
        playerElement = self.document.getElementsByTagName("player")[0]
        self.player = annchienta.Person(
            str(playerElement.getAttribute("name")),
            str(playerElement.getAttribute("config")))
        playerPosition = annchienta.Point(
            annchienta.IsometricPoint, int(playerElement.getAttribute("isox")),
            int(playerElement.getAttribute("isoy")))

        # Add the player to the map and give him control
        self.currentMap.addObject(self.player, playerPosition)
        self.player.setInputControl()
        self.mapManager.cameraFollow(self.player)
        self.mapManager.cameraPeekAt(self.player, True)

        # Load our inventory
        inventoryElement = self.document.getElementsByTagName("inventory")[0]
        self.inventory = Inventory.Inventory(inventoryElement)

        # Load the team
        teamElement = self.document.getElementsByTagName("team")[0]
        self.team = map(Ally.Ally,
                        teamElement.getElementsByTagName("combatant"))
Example #2
0
    def load(self, filename):
        self.filename = filename
        self.document = xml.dom.minidom.parse(self.filename)

        # Let's asume this is a valid file and
        # the needed elements are there.

        # <PLAYER>
        playerElement = self.document.getElementsByTagName("player")[0]
        self.player = annchienta.Person(
            str(playerElement.getAttribute("name")),
            str(playerElement.getAttribute("xmlfile")))
        point = None
        if playerElement.hasAttribute("isox"):
            point = annchienta.Point(annchienta.IsometricPoint,
                                     int(playerElement.getAttribute("isox")),
                                     int(playerElement.getAttribute("isoy")))
        if playerElement.hasAttribute("tilex"):
            point = annchienta.Point(annchienta.TilePoint,
                                     int(playerElement.getAttribute("tilex")),
                                     int(playerElement.getAttribute("tiley")))
        self.player.setPosition(point)

        # <TEAM>
        teamElement = self.document.getElementsByTagName("team")[0]
        self.team = map(lambda e: combatant.Ally(e),
                        teamElement.getElementsByTagName("combatant"))

        # <RECORDS>
        recordsElement = self.document.getElementsByTagName("records")[0]
        self.records = recordsElement.firstChild.data.split()

        # <MAP>
        # Load this after <RECORDS> because <RECORDS> might influence <MAP>.
        mapElement = self.document.getElementsByTagName("map")[0]
        self.currentMap = annchienta.Map(
            str(mapElement.getAttribute("filename")))
        self.currentMap.setCurrentLayer(int(mapElement.getAttribute("layer")))
        self.mapManager.setCurrentMap(self.currentMap)

        # Stuff to do when everything is loaded
        self.player.setInputControl()
        self.currentMap.addObject(self.player)
        self.mapManager.cameraFollow(self.player)
        self.inputManager.setInputControlledPerson(self.player)
Example #3
0
mapManager = annchienta.getMapManager()
videoManager = annchienta.getVideoManager()
partyManager = PartyManager.getPartyManager()
sceneManager = SceneManager.getSceneManager()

currentMap = partyManager.getCurrentMap()

partyManager.addRecord("inaran_cave3_scene")

# Create a whole bunch of objects/persons and set them to
# their positions.
august = partyManager.getPlayer()
augustPosition = august.getPosition().to(annchienta.TilePoint)

march = annchienta.Person("march", "locations/common/march.xml")
currentMap.addObject(
    march,
    annchienta.Point(annchienta.TilePoint, augustPosition.x + 1,
                     augustPosition.y))

avril = annchienta.Person("avril", "locations/common/avril.xml")
currentMap.addObject(
    avril,
    annchienta.Point(annchienta.TilePoint, augustPosition.x,
                     augustPosition.y + 1))

# Init our dialog.
sceneManager.initDialog([august, march, avril])

sceneManager.speak(
Example #4
0
    partyManager.addRecord("kimen_inspected_plant")

    sceneManager.speak(august,
                       "What are these plants? Let's have a closer look...")

    sceneManager.quitDialog()

    # Calculate new positions and add actors.
    plantPosition = plant.getPosition().to(annchienta.TilePoint)

    august.setPosition(
        annchienta.Point(annchienta.TilePoint, plantPosition.x + 1,
                         plantPosition.y + 1))

    march = annchienta.Person("march", "locations/common/march.xml")
    currentMap.addObject(
        march,
        annchienta.Point(annchienta.TilePoint, plantPosition.x + 2,
                         plantPosition.y + 1))

    avril = annchienta.Person("avril", "locations/common/avril.xml")
    currentMap.addObject(
        avril,
        annchienta.Point(annchienta.TilePoint, plantPosition.x + 1,
                         plantPosition.y + 2))

    captain = annchienta.Person("captain", "locations/kimen/captain.xml")
    currentMap.addObject(
        captain,
        annchienta.Point(annchienta.TilePoint, plantPosition.x + 1,
Example #5
0
import annchienta, scene, party

partyManager = party.getPartyManager()
sceneManager = scene.getSceneManager()

# If we have inyse or not.
inyseInParty = partyManager.hasRecord("tetia_met_inyse")

baniran = annchienta.getPassiveObject()
player = partyManager.player
esana = annchienta.Person("esana", "locations/prison/esana.xml")
inyse = 0
if inyseInParty:
    inyse = annchienta.Person("inyse", "locations/tetia/inyse.xml")

sceneManager.initDialog([baniran, player, esana] +
                        ([inyse] if inyseInParty else []))

pp = player.getPosition().to(annchienta.IsometricPoint)
bp = baniran.getPosition().to(annchienta.IsometricPoint)
ep = annchienta.Point(annchienta.IsometricPoint,
                      pp.x + (30 if bp.x < pp.x else -30), pp.y)
ip = annchienta.Point(annchienta.IsometricPoint, pp.x, pp.y + 30)

esana.setPosition(pp)
partyManager.currentMap.addObject(esana)
if inyseInParty:
    inyse.setPosition(pp)
    partyManager.currentMap.addObject(inyse)
    sceneManager.move([inyse, esana], [ip, ep])
else:
Example #6
0
        "I need to find out what happened... I must find the others! I must speak to them!"
    )
    sceneManager.text(
        "Click and hold left mouse button to move. Click objects to interact with them if you're close enough. Alternatively, use the arrow keys to move and the spacebar to interact."
    )
    sceneManager.quitDialog()
    partyManager.refreshMap()

# The event with the guard.
if partyManager.hasRecord("prison_awakening") and not partyManager.hasRecord(
        "prison_guard") and passiveName == "bars":

    partyManager.addRecord("prison_guard")

    # Create a guard and set his position.
    guard = annchienta.Person("guard", "locations/prison/guard.xml")
    partyManager.currentMap.addObject(guard)
    guard.setPosition(annchienta.Point(annchienta.IsometricPoint, 30, 140))

    # Init the dialog.
    sceneManager.initDialog([guard, player])

    # Follow the guard walking to Aelaan.
    p = player.getPosition().to(annchienta.IsometricPoint)
    sceneManager.move(guard,
                      annchienta.Point(annchienta.IsometricPoint, 30, p.y))
    sceneManager.move(guard,
                      annchienta.Point(annchienta.IsometricPoint, 74, p.y))
    guard.lookAt(player)
    player.lookAt(guard)
Example #7
0

# Fuction that adapts Kator's stats to the players
def adapt(jelobatEnemy):
    stats = [
        "strength", "defense", "magic", "resistance", "health", "maxhealth"
    ]
    for stat in stats:
        s = int(1.5 *
                sum(map(lambda t: t.status.get(stat), partyManager.team)))
        jelobatEnemy.status.set(stat, s)


# Persons for scenes
player = partyManager.player
esana = annchienta.Person("esana", "locations/prison/esana.xml")
inyse = annchienta.Person("inyse", "locations/tetia/inyse.xml")
jelobat = annchienta.Person("jelobat", "locations/anpere/jelobat.xml")

# Set positions.
jelobat.setPosition(annchienta.Point(annchienta.TilePoint, 11, 6))
esana.setPosition(annchienta.Point(annchienta.TilePoint, 9, 14))
inyse.setPosition(annchienta.Point(annchienta.TilePoint, 11, 14))
player.setPosition(annchienta.Point(annchienta.TilePoint, 13, 14))

# Add persons to map
thisMap.addObject(esana)
thisMap.addObject(inyse)
thisMap.addObject(jelobat)

thisMap.depthSort()
Example #8
0
import annchienta
import PartyManager, SceneManager

mapManager = annchienta.getMapManager()
videoManager = annchienta.getVideoManager()
partyManager = PartyManager.getPartyManager()
sceneManager = SceneManager.getSceneManager()

currentMap = partyManager.getCurrentMap()

august = partyManager.getPlayer()

# Addobject and stuff...
march = annchienta.Person("march", "locations/common/march.xml")
avril = annchienta.Person("avril", "locations/common/avril.xml")
enthavos = annchienta.Person("enthavos", "locations/unknown/enthavos.xml")

position = august.getPosition().to(annchienta.TilePoint)
currentMap.addObject(
    march, annchienta.Point(annchienta.TilePoint, position.x + 1, position.y))
currentMap.addObject(
    avril, annchienta.Point(annchienta.TilePoint, position.x + 2, position.y))
currentMap.addObject(enthavos, annchienta.Point(annchienta.TilePoint, 19, 23))
sceneManager.initDialog([august, march, avril, enthavos])
august.lookAt(enthavos)
march.lookAt(enthavos)
avril.lookAt(enthavos)

sceneManager.speak(enthavos, "Good. I have been waiting for you.")
sceneManager.speak(avril, "En... Enthavos?!")
sceneManager.speak(august, "What the?")
Example #9
0
import annchienta, scene, party
import combatant, xml.dom.minidom
import battle

mapManager = annchienta.getMapManager()
audioManager = annchienta.getAudioManager()
partyManager = party.getPartyManager()
sceneManager = scene.getSceneManager()

inyse = partyManager.currentMap.getPerson("inyse")
player = partyManager.player
esana = annchienta.Person("esana", "locations/prison/esana.xml")
esana.setPosition(annchienta.Point(annchienta.TilePoint, 7, 2))
partyManager.currentMap.addObject(esana)

sceneManager.initDialog([inyse, player, esana])

player.lookAt(inyse)
esana.lookAt(inyse)

sceneManager.speak(player, "Inyse! What is happening?")
sceneManager.speak(inyse, "Do I look like I know?")
sceneManager.speak(player,
                   "But who sent these? How did these ghosts get here?")
sceneManager.speak(
    inyse, "I'm not sure, but apparently, someone who doesn't like us.")
sceneManager.speak(player,
                   "Come on, Esana, we have to help! Inyse, are you alright?")
sceneManager.speak(
    inyse,
    "Could've taken them on my own, but fine. Might have gotten nasty if one more had shown up."
Example #10
0
mapManager = annchienta.getMapManager()
videoManager = annchienta.getVideoManager()
partyManager = PartyManager.getPartyManager()
sceneManager = SceneManager.getSceneManager()

currentMap = partyManager.getCurrentMap()

partyManager.addRecord("fleet_met_pirates")

# Create a whole bunch of objects/persons and set them to
# their positions.
august = partyManager.getPlayer()
august.setPosition(annchienta.Point(annchienta.TilePoint, 4, 4))

march = annchienta.Person("march", "locations/common/march.xml")
currentMap.addObject(march, annchienta.Point(annchienta.TilePoint, 4, 5))

avril = annchienta.Person("avril", "locations/common/avril.xml")
currentMap.addObject(avril, annchienta.Point(annchienta.TilePoint, 4, 6))

pirate1 = annchienta.Person("emenver", "locations/fleet/pirate1.xml")
currentMap.addObject(pirate1, annchienta.Point(annchienta.TilePoint, 7, 5))

pirate2 = annchienta.Person("hoche", "locations/fleet/pirate2.xml")
currentMap.addObject(pirate2, annchienta.Point(annchienta.TilePoint, 7, 6))

# Init our dialog.
sceneManager.initDialog([august, march, avril, pirate1, pirate2])

# Set correct headings and animations.
Example #11
0
mapManager = annchienta.getMapManager()
videoManager = annchienta.getVideoManager()
partyManager = PartyManager.getPartyManager()
sceneManager = SceneManager.getSceneManager()

currentMap = partyManager.getCurrentMap()

partyManager.addRecord("facilities_met_banver")

# Create a whole bunch of objects/persons and set them to
# their positions.
august = partyManager.getPlayer()
august.setPosition(annchienta.Point(annchienta.TilePoint, 8, 12))

march = annchienta.Person("march", "locations/common/march.xml")
currentMap.addObject(march, annchienta.Point(annchienta.TilePoint, 9, 12))

avril = annchienta.Person("avril", "locations/common/avril.xml")
currentMap.addObject(avril, annchienta.Point(annchienta.TilePoint, 7, 12))

ship = annchienta.StaticObject("ship", "locations/facilities/ship.xml")
currentMap.addObject(ship, annchienta.Point(annchienta.TilePoint, 5, 6))

kyzano = annchienta.Person("kyzano", "locations/unknown/enthavos.xml")
currentMap.addObject(kyzano, annchienta.Point(annchienta.TilePoint, 7, 7))

banver = annchienta.Person("banver", "locations/facilities/banver.xml")
currentMap.addObject(banver, annchienta.Point(annchienta.TilePoint, 7, 8))

soldier1 = annchienta.Person("soldier", "locations/facilities/soldier.xml")