Beispiel #1
0
def set_destination(_, xy):
    '''/goto x y  -- walk to given coordinates'''
    try:
        x, y = map(int, xy.split())
        mapserv.cmsg_player_change_dest(x, y)
    except ValueError:
        pass
Beispiel #2
0
def set_destination(_, xy):
    '''/goto x y  -- walk to given coordinates'''
    try:
        x, y = map(int, xy.split())
        mapserv.cmsg_player_change_dest(x, y)
    except ValueError:
        pass
Beispiel #3
0
def cmd_goto(nick, message, is_whisper, match):
    if not is_whisper:
        return

    try:
        x = int(match.group(1))
        y = int(match.group(2))
    except ValueError:
        return

    set_npc_owner(nick)
    plugins.autofollow.follow = ''
    mapserv.cmsg_player_change_dest(x, y)
Beispiel #4
0
def cmd_goto(nick, message, is_whisper, match):
    if not is_whisper:
        return

    try:
        x = int(match.group(1))
        y = int(match.group(2))
    except ValueError:
        return

    set_npc_owner(nick)
    plugins.autofollow.follow = ''
    mapserv.cmsg_player_change_dest(x, y)
Beispiel #5
0
def flooritem_appears(data):
    if not auto_pickup:
        return

    p_x = mapserv.player_pos['x']
    p_y = mapserv.player_pos['y']
    dist = distance(p_x, p_y, data.x, data.y)
    # debuglog.info('p.x=%d p.y=%d i.x=%d i.y=%d dist=%d',
    #               p_x, p_y, data.x, data.y, dist)
    if dist < 2:
        mapserv.cmsg_item_pickup(data.id)
    else:
        mapserv.cmsg_player_change_dest(data.x, data.y)
        # NOTE: will this object be garbage collected?
        Schedule(dist * 0.4, 0, mapserv.cmsg_item_pickup, data.id)
Beispiel #6
0
def cmd_goclose(nick, message, is_whisper, match):
    if not is_whisper:
        return

    x = mapserv.player_pos['x']
    y = mapserv.player_pos['y']

    if message.startswith('!left'):
        x -= 1
    elif message.startswith('!right'):
        x += 1
    elif message.startswith('!up'):
        y -= 1
    elif message.startswith('!down'):
        y += 1

    set_npc_owner(nick)
    plugins.autofollow.follow = ''
    mapserv.cmsg_player_change_dest(x, y)
Beispiel #7
0
def cmd_goclose(nick, message, is_whisper, match):
    if not is_whisper:
        return

    x = mapserv.player_pos['x']
    y = mapserv.player_pos['y']

    if message.startswith('!left'):
        x -= 1
    elif message.startswith('!right'):
        x += 1
    elif message.startswith('!up'):
        y -= 1
    elif message.startswith('!down'):
        y += 1

    set_npc_owner(nick)
    plugins.autofollow.follow = ''
    mapserv.cmsg_player_change_dest(x, y)
Beispiel #8
0
def walkto_and_action(obj, action_, min_distance=1):
    if obj.id in unreachable_ids:
        return

    global state
    global target
    global action

    if state == 'waiting_confirmation':
        return

    target = obj
    action = action_

    pp = mapserv.player_pos
    dist = distance(pp['x'], pp['y'], target.x, target.y)

    if dist <= min_distance:
        do_action(target, action)
    else:
        state = 'waiting_confirmation'
        _times['walk_request_time'] = time.time()
        mapserv.cmsg_player_change_dest(target.x, target.y)
Beispiel #9
0
def walkto_and_action(obj, action_, min_distance=1):
    if obj.id in unreachable_ids:
        return

    global state
    global target
    global action

    if state == 'waiting_confirmation':
        return

    target = obj
    action = action_

    pp = mapserv.player_pos
    dist = distance(pp['x'], pp['y'], target.x, target.y)

    if dist <= min_distance:
        do_action(target, action)
    else:
        state = 'waiting_confirmation'
        _times['walk_request_time'] = time.time()
        mapserv.cmsg_player_change_dest(target.x, target.y)
Beispiel #10
0
def player_move(data):
    if follow:
        b = mapserv.beings_cache[data.id]
        if b.name == follow:
            mapserv.cmsg_player_change_dest(data.coor_pair.dst_x,
                                            data.coor_pair.dst_y)
Beispiel #11
0
def player_move(data):
    if follow:
        b = mapserv.beings_cache[data.id]
        if b.name == follow:
            mapserv.cmsg_player_change_dest(data.coor_pair.dst_x,
                                            data.coor_pair.dst_y)
Beispiel #12
0
 def move_player(self, sender, touch):
     gx, gy = self.root.map_w.to_game_coords(touch.pos)
     Logger.info("move_player (%s, %s)", gx, gy)
     mapserv.cmsg_player_change_dest(gx, gy)
Beispiel #13
0
def set_destination(_, xy):
    try:
        x, y = map(int, xy.split())
        mapserv.cmsg_player_change_dest(x, y)
    except ValueError:
        pass