def getPlayers(self): all_players = database.getAll("players") guild_players = [] for player_id, name, guild_id, avatar in all_players: if guild_id == self.guild.id: guild_players.append(guildlib.Player(id=player_id)) return guild_players
def getEmptyProgressField(): """ Выводит поле ачей для гильдий Используется при создании гильдии или при перезапуске ачей, чтобы обозначить, что все ачи не пройдены """ achis = database.getAll("achis") or '' progress = ["0"] * len(achis) return " ".join(progress)
def getGuilds(): guild_ids = database.getAll("guilds", "id") return [Guild(id=id) for id in guild_ids]
def removePlayersFromGuild(guild_id): players = [Player(id=id) for id in database.getAll("players", "id")] for player in players: if player.guild_id == guild_id: player.set("guild_id", 0)
def main(): logger.debug("Updating all guilds...") guild_ids = database.getAll("guilds", field="id") for guild_id in guild_ids: updateGuild(guild_id) refreshGuilds()
def getPlayerCount(self): """ Возвращает только игроков с гильдией """ player_guilds = database.getAll("players", field="guild_id") player_guilds = [g for g in player_guilds if g != 0] return len(player_guilds)
def getTotalAmountOfWaves(self): """ Получение всех волн всех ачей для подсчета прохождения """ if achi_is_active: all_achi_waves = database.getAll("achis", "waves") all_achi_waves = [len(w.split(" ")) - 1 for w in all_achi_waves] return sum(all_achi_waves)
def getGuildList(self): logger.debug("Getting guild list...") guilds = database.getAll("guilds", "id") guilds = [guildlib.Guild(id=g) for g in guilds] return self.makeFancyGuildList(guilds), len(guilds)
def getHighestEweekId(): eweek_ids = database.getAll(parent="eweeks", field="id") return max(eweek_ids)