Ejemplo n.º 1
0
#! /usr/bin/env python

from librpg.item import OrdinaryItem, OrdinaryInventory
from librpg.util import IdFactory

item_factory = IdFactory()


class Item19(OrdinaryItem):

    id = 19

    def __init__(self):
        OrdinaryItem.__init__(self, 'Item19')


item_factory.register(Item19)


class Item42(OrdinaryItem):

    id = 42

    def __init__(self):
        OrdinaryItem.__init__(self, 'Item42')


item_factory.register(Item42)


class Item66(OrdinaryItem):
Ejemplo n.º 2
0
from librpg.quest import *
from librpg.util import IdFactory

quest_factory = IdFactory()


# Quests ###################################################

class TeaAtFiveQuest(Quest):

    id = 'tea at five'

    class Step1(QuestStep):

        def custom_start(self):
            print 'Started Tea at Five step 1'

        def custom_finish(self):
            print 'Finished Tea at Five step 1'
            self.owner.reward(100)

    class Step2(QuestStep):

        def custom_start(self):
            print 'Started Tea at Five step 2'

        def custom_finish(self):
            print 'Finished Tea at Five step 2'
            self.owner.reward(300)

    def __init__(self, owner):
Ejemplo n.º 3
0
from librpg.util import IdFactory
from librpg.item import OrdinaryItem, Usable
from librpg.dialog import ChoiceDialog, MessageDialog
from librpg.path import tileset_path, item_icon_path


item_factory = IdFactory()


class SinglePartyTargetItem(OrdinaryItem, Usable):
    
    def use(self, party):
        dialog = ChoiceDialog('Use on whom?', party.chars)
        dialog.sync_open()
        
        target = party.chars[dialog.result]
        self.use_on_party_member(party.get_char(target))

    def get_icon_location(self):
        return ('item_icons.png', 0)

    def use_on_party_member(self, character):
        raise NotImplementedError('SinglePartyTargetItem.\
                                   use_on_party_member() is abstract')


class LogItem(OrdinaryItem):

    id = 'log'

    def __init__(self):
Ejemplo n.º 4
0
from librpg.quest import *
from librpg.util import IdFactory

quest_factory = IdFactory()

# Quests ###################################################


class TeaAtFiveQuest(Quest):

    id = 'tea at five'

    class Step1(QuestStep):
        def custom_start(self):
            print 'Started Tea at Five step 1'

        def custom_finish(self):
            print 'Finished Tea at Five step 1'
            self.owner.reward(100)

    class Step2(QuestStep):
        def custom_start(self):
            print 'Started Tea at Five step 2'

        def custom_finish(self):
            print 'Finished Tea at Five step 2'
            self.owner.reward(300)

    def __init__(self, owner):
        Quest.__init__(self, owner, 'Tea at Five',
                       [TeaAtFiveQuest.Step1, TeaAtFiveQuest.Step2])
Ejemplo n.º 5
0
#! /usr/bin/env python

from librpg.item import OrdinaryItem, OrdinaryInventory
from librpg.util import IdFactory

item_factory = IdFactory()


class Item19(OrdinaryItem):

    id = 19

    def __init__(self):
        OrdinaryItem.__init__(self, 'Item19')

item_factory.register(Item19)


class Item42(OrdinaryItem):

    id = 42

    def __init__(self):
        OrdinaryItem.__init__(self, 'Item42')

item_factory.register(Item42)


class Item66(OrdinaryItem):

    id = 66
Ejemplo n.º 6
0
from librpg.util import IdFactory
from librpg.item import OrdinaryItem, Usable
from librpg.dialog import ChoiceDialog, MessageDialog
from librpg.path import tileset_path, item_icon_path

item_factory = IdFactory()


class SinglePartyTargetItem(OrdinaryItem, Usable):
    def use(self, party):
        dialog = ChoiceDialog('Use on whom?', party.chars)
        dialog.sync_open()

        target = party.chars[dialog.result]
        self.use_on_party_member(party.get_char(target))

    def get_icon_location(self):
        return ('item_icons.png', 0)

    def use_on_party_member(self, character):
        raise NotImplementedError('SinglePartyTargetItem.\
                                   use_on_party_member() is abstract')


class LogItem(OrdinaryItem):

    id = 'log'

    def __init__(self):
        OrdinaryItem.__init__(self, 'Log')