示例#1
0
    def __init__(self, instance_id, rcon):
        self.id = instance_id
        self.rcon = rcon

        self.map_rotation = None
        self.current_map = None
        self.next_map = None
        self.last_map_change = None
        self.is_transitioning = False

        self.players = []
        self.ids = []

        self.team1 = None
        self.team2 = None

        self.update()

        path = Path(f'rotations/{str(self.id)}.json')
        if os.path.exists(path) and instances.Instance(
                self.id).uses_custom_rotation:
            try:
                self.import_rotation(fp=path)
            except:
                pass
示例#2
0
    def _get_selected_instance(self, user_id, guild_id=None):
        if user_id not in self.selected_instance:
            self.selected_instance[user_id] = -1

        try:
            instances.Instance(self.selected_instance[user_id])
        except:
            try:
                self.selected_instance[
                    user_id] = instances.get_available_instances(
                        user_id, guild_id)[0][0].id
            except:
                self.selected_instance[user_id] = -1

        return self.selected_instance[user_id]
示例#3
0
 def delete_instance(self, instance_id):
     if instance_id in self.instances:
         del self.instances[instance_id]
     instances.Instance(instance_id).delete()