Ejemplo n.º 1
0
            new
        )

    def ql_info(room, new):
        for line in sage.buffer:
            if line[:-1] == room.name:
                line.output += ansi.grey(' (%s) (%s)' % (room.area, room.id))
                if new:
                    line.output += ansi.grey(' [new]')



    sage.defer_to_prompt(ql_info, room, new)


room.connect(room_info)


def init():
    mapdata.load()


def shutdown(**kwargs):
    if mapdata.new > 0:
        print("Mapper: %s new rooms added" % mapdata.new)
        mapdata.save()

pre_shutdown.connect(shutdown)


def pre_reload():
Ejemplo n.º 2
0

@xplr_aliases.exact(pattern="xdef", intercept=True)
def xdef(alias):
    sage.echo(player.defences)


@xplr_aliases.exact(pattern="xplr mine", intercept=True)
def xmine(alias):
    from mapper.mapper import mapdata, itemdata
    explr.path = None
    explr.times['last_action'] = time.time()
    explr.state = State.PROSP
    explr.visited = set()
    srooms = itemdata.find_rooms_with('stronghold')
    srooms = mapdata.limit_room_dist(player.room.id, srooms, 1000)
    explr.mine_rooms = mapdata.find_rooms_near(srooms, 6)
    print explr.mine_rooms


player_connected.connect(explr.connect)
ping.connect(explr.ping)

room.connect(explr.room_updated)
room_add_item.connect(explr.room_updated)
room_add_player.connect(explr.room_updated)
room_players.connect(explr.room_updated)
room_remove_item.connect(explr.room_updated)
room_remove_player.connect(explr.room_updated)
skills.connect(explr.skills_update)
Ejemplo n.º 3
0
# interception to False means the original command passes through
@room_aliases.exact(pattern="ql", intercept=False)
def ql(alias):

    # enable the exits trigger
    room_triggers('exits').enable()

    # send to Achaea
    #send('ql')


@room_triggers.regex(
    "^You see (a single exit leading|exits leading) ([a-z, \(\)]+)\.$",
    enabled=False)
def exits(trigger):
    exit_str = trigger.groups[1]
    exit_str = exit_str.replace('and', '')
    exits = [ansi.bold_white(e.strip()) for e in exit_str.split(',')]
    new_str = ', '.join(exits)
    trigger.line.output = "Exits: " + new_str

    # now disable this trigger
    trigger.disable()


def on_room_update(**kwargs):
    room_triggers('exits').enable()


room_signal.connect(
    on_room_update)  # Enable the room exits trigger on room change
Ejemplo n.º 4
0
        sage.buffer.insert(len(sage.buffer) - 1,
                           'Who: ' + players)  # Insert line above exits in QL


def on_room_update(signal, room):
    def update_players():
        # use of global isn't encouraged, but in this case it was a simple solution
        global last_room

        # we get room events even if we don't change rooms. eg: squinting.
        if player.room.id == last_room:
            return

        last_room = player.room.id
        write_players()

    # Why defer to prompt? Because GMCP data and the actual lines from Achaea don't always come
    # at the same time. To make sure we don't get out of sync, we defer to the prompt when
    # everything should be ready.
    sage.defer_to_prompt(update_players)


# Connect to the GMCP Room.Info signal
room_signal.connect(on_room_update)


# Write players when we just do QL as well
@who_aliases.exact(pattern='ql', intercept=False)
def ql(alias):
    sage.defer_to_prompt(write_players)
Ejemplo n.º 5
0
@room_triggers.regex("^([a-z'_-]+)([0-9]+)[ ]+.*$", enabled=False)
def ih(trigger):
    short_name = trigger.groups[0]
    itemid = long(trigger.groups[1])
    itemdata.add_shortname(itemid, short_name)
    trigger.line.gag()


@room_triggers.regex("^Number of objects: [0-9]+$", enabled=False)
def ih_over(trigger):
    room_triggers('ih').disable()
    trigger.disable()
    trigger.line.gag()


room.connect(update_room_contents)
room.connect(room_info)
room_add_item.connect(update_room_contents)
room_add_item.connect(add_items)


def init():
    mapdata.load()
    itemdata.load()


def shutdown(**kwargs):
    mapdata.save()
    itemdata.save()

Ejemplo n.º 6
0
@xplr_aliases.exact(pattern="xplr mine", intercept=True)
def xmine(alias):
    from mapper.mapper import mapdata, itemdata
    explr.path=None
    explr.times['last_action'] = time.time()
    explr.state = State.PROSP
    explr.visited = set()
    srooms = itemdata.find_rooms_with('stronghold')
    srooms = mapdata.limit_room_dist(player.room.id, srooms, 1000)
    explr.mine_rooms = mapdata.find_rooms_near(srooms, 6)
    print explr.mine_rooms






player_connected.connect(explr.connect)
ping.connect(explr.ping)

room.connect(explr.room_updated)
room_add_item.connect(explr.room_updated)
room_add_player.connect(explr.room_updated)
room_players.connect(explr.room_updated)
room_remove_item.connect(explr.room_updated)
room_remove_player.connect(explr.room_updated)
skills.connect(explr.skills_update)


Ejemplo n.º 7
0
        sage.buffer.insert(len(sage.buffer) - 1, 'Who: ' + players)  # Insert line above exits in QL


def on_room_update(signal, room):

    def update_players():
        # use of global isn't encouraged, but in this case it was a simple solution
        global last_room

        # we get room events even if we don't change rooms. eg: squinting.
        if player.room.id == last_room:
            return

        last_room = player.room.id
        write_players()

    # Why defer to prompt? Because GMCP data and the actual lines from Achaea don't always come
    # at the same time. To make sure we don't get out of sync, we defer to the prompt when
    # everything should be ready.
    sage.defer_to_prompt(update_players)


# Connect to the GMCP Room.Info signal
room_signal.connect(on_room_update)


# Write players when we just do QL as well
@who_aliases.exact(pattern='ql', intercept=False)
def ql(alias):
    sage.defer_to_prompt(write_players)
Ejemplo n.º 8
0
        sage.send('ih')

@room_triggers.regex("^([a-z'_-]+)([0-9]+)[ ]+.*$",enabled=False)
def ih(trigger):
    short_name = trigger.groups[0]
    itemid = long(trigger.groups[1])
    itemdata.add_shortname(itemid, short_name)
    trigger.line.gag()

@room_triggers.regex("^Number of objects: [0-9]+$",enabled=False)
def ih_over(trigger):
    room_triggers('ih').disable()
    trigger.disable()
    trigger.line.gag()

room.connect(update_room_contents)
room.connect(room_info)
room_add_item.connect(update_room_contents)
room_add_item.connect(add_items)


def init():
    mapdata.load()
    itemdata.load()


def shutdown(**kwargs):
    mapdata.save()
    itemdata.save()

pre_shutdown.connect(shutdown)
Ejemplo n.º 9
0

# interception to False means the original command passes through
@room_aliases.exact(pattern="ql", intercept=False)
def ql(alias):

    # enable the exits trigger
    room_triggers('exits').enable()

    # send to Achaea
    #send('ql')


@room_triggers.regex("^You see (a single exit leading|exits leading) ([a-z, \(\)]+)\.$", enabled=False)
def exits(trigger):
    exit_str = trigger.groups[1]
    exit_str = exit_str.replace('and', '')
    exits = [ansi.bold_white(e.strip()) for e in exit_str.split(',')]
    new_str = ', '.join(exits)
    trigger.line.output = "Exits: " + new_str

    # now disable this trigger
    trigger.disable()


def on_room_update(**kwargs):
    room_triggers('exits').enable()


room_signal.connect(on_room_update)  # Enable the room exits trigger on room change