Exemplo n.º 1
0
 def start_rollback(self, connection, mapname, start_x, start_y,
     end_x, end_y, ignore_indestructable = True):
     if self.rollback_in_progress:
         return S_ROLLBACK_IN_PROGRESS
     if mapname is None:
         map = self.rollback_map
     else:
         try:
             maps = check_rotation([mapname])
             if not maps:
                 return S_INVALID_MAP_NAME
             map = Map(maps[0]).data
         except MapNotFound as error:
             return error.message
     name = (connection.name if connection is not None
         else S_AUTOMATIC_ROLLBACK_PLAYER_NAME)
     message = S_ROLLBACK_COMMENCED.format(player = name)
     self.send_chat(message, irc = True)
     self.packet_generator = self.create_rollback_generator(self.map,
         map, start_x, start_y, end_x, end_y, ignore_indestructable)
     self.rollback_in_progress = True
     self.rollback_start_time = time.time()
     self.rollback_last_chat = self.rollback_start_time
     self.rollback_rows = 0
     self.rollback_total_rows = end_x - start_x
     self.cycle_call = LoopingCall(self.rollback_cycle)
     self.cycle_call.start(self.rollback_time_between_cycles)
Exemplo n.º 2
0
 def start_rollback(self, connection, mapname, start_x, start_y,
     end_x, end_y, ignore_indestructable = True):
     
     if self.rollback_handle is not None:
         return S_ROLLBACK_IN_PROGRESS
     if mapname is None:
         map = self.rollback_map
     else:
         try:
             maps = check_rotation([mapname])
             if not maps:
                 return S_INVALID_MAP_NAME
             map = Map(maps[0]).data
         except MapNotFound as error:
             return error.message
     name = (connection.name if connection is not None
         else S_AUTOMATIC_ROLLBACK_PLAYER_NAME)
     message = S_ROLLBACK_COMMENCED.format(player = name)
     self.send_chat(message, irc = True)
     generator = self.create_rollback_generator(self.map,
                 map, start_x, start_y, end_x, end_y, ignore_indestructable)
     self.rollback_handle = self.cbc_add(generator
         , self.rollback_time_between_progress_updates
         , self.rollback_callback
         , connection)
Exemplo n.º 3
0
 def start_rollback(self, connection, mapname, start_x, start_y,
     end_x, end_y, ignore_indestructable = True):
     if self.rollback_in_progress:
         return S_ROLLBACK_IN_PROGRESS
     if mapname is None:
         map = self.rollback_map
     else:
         try:
             maps = check_rotation([mapname])
             if not maps:
                 return S_INVALID_MAP_NAME
             map = Map(maps[0]).data
         except MapNotFound as error:
             return error.message
     name = (connection.name if connection is not None
         else S_AUTOMATIC_ROLLBACK_PLAYER_NAME)
     message = S_ROLLBACK_COMMENCED.format(player = name)
     self.send_chat(message, irc = True)
     self.packet_generator = self.create_rollback_generator(self.map,
         map, start_x, start_y, end_x, end_y, ignore_indestructable)
     self.rollback_in_progress = True
     self.rollback_start_time = time.time()
     self.rollback_last_chat = self.rollback_start_time
     self.rollback_rows = 0
     self.rollback_total_rows = end_x - start_x
     self.cycle_call = LoopingCall(self.rollback_cycle)
     self.cycle_call.start(self.rollback_time_between_cycles)
Exemplo n.º 4
0
        def start_rollback(self,
                           connection,
                           mapname,
                           start_x,
                           start_y,
                           end_x,
                           end_y,
                           ignore_indestructable=True):

            if self.rollback_handle is not None:
                return S_ROLLBACK_IN_PROGRESS
            if mapname is None:
                map = self.rollback_map
            else:
                try:
                    maps = check_rotation([mapname])
                    if not maps:
                        return S_INVALID_MAP_NAME
                    map = Map(maps[0]).data
                except MapNotFound as error:
                    return error.message
            name = (connection.name if connection is not None else
                    S_AUTOMATIC_ROLLBACK_PLAYER_NAME)
            message = S_ROLLBACK_COMMENCED.format(player=name)
            self.send_chat(message, irc=True)
            generator = self.create_rollback_generator(self.map, map, start_x,
                                                       start_y, end_x, end_y,
                                                       ignore_indestructable)
            self.rollback_handle = self.cbc_add(
                generator, self.rollback_time_between_progress_updates,
                self.rollback_callback, connection)
Exemplo n.º 5
0
def change_planned_map(connection, *pre_maps):
    name = connection.name
    protocol = connection.protocol

    # parse seed numbering
    maps, map_list = parse_maps(pre_maps)
    if not maps:
        return 'Invalid map name'
    
    map = maps[0]
    protocol.planned_map = check_rotation([map])[0]
    protocol.send_chat('%s changed next map to %s' % (name, map), irc = True)
Exemplo n.º 6
0
def change_planned_map(connection, *pre_maps):
    name = connection.name
    protocol = connection.protocol

    # parse seed numbering
    maps, map_list = parse_maps(pre_maps)
    if not maps:
        return 'Invalid map name'

    map = maps[0]
    protocol.planned_map = check_rotation([map])[0]
    protocol.send_chat('%s changed next map to %s' % (name, map), irc=True)
Exemplo n.º 7
0
 def show_result(self):
     result = self.votes_left()['name']
     if result == "extend":
         tl = self.protocol.set_time_limit(self.extension_time, True)
         span = prettify_timespan(tl * 60.0)
         self.protocol.send_chat('Mapvote ended. Current map will '
             'continue for %s.' % span, irc = True)
         self.protocol.autoschedule_votemap()
     else:
         self.protocol.send_chat('Mapvote ended. Next map will be: %s.' % 
             result, irc = True)
         self.protocol.planned_map = check_rotation([result])[0]
     self.set_cooldown()
Exemplo n.º 8
0
 def set_map_rotation(self, maps, now = True):
     try:
         maps = check_rotation(maps)
     except MapNotFound, e:
         return e
Exemplo n.º 9
0
 def set_map_rotation(self, maps, now=True):
     try:
         maps = check_rotation(maps)
     except MapNotFound, e:
         return e
Exemplo n.º 10
0
 def set_map_rotation(self, maps, now = True):
     try:
         maps = check_rotation(maps, os.path.join(RESOURCE_DIR,'maps'))
     except MapNotFound, e:
         return e
Exemplo n.º 11
0
 def set_map_rotation(self, maps, now = True):
     try:
         maps = check_rotation(maps, os.path.join(config_dir,'maps'))
     except MapNotFound, e:
         return e
Exemplo n.º 12
0
 def set_map_rotation(self, maps, now=True):
     try:
         maps = check_rotation(maps, os.path.join(RESOURCE_DIR, 'maps'))
     except MapNotFound, e:
         return e