Ejemplo n.º 1
0
 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
Ejemplo n.º 2
0
    def getEmptyProgressField():
        """ Выводит поле ачей для гильдий

			Используется при создании гильдии
			или при перезапуске ачей, чтобы
			обозначить, что все ачи не пройдены
		"""
        achis = database.getAll("achis") or ''
        progress = ["0"] * len(achis)
        return " ".join(progress)
Ejemplo n.º 3
0
def getGuilds():
    guild_ids = database.getAll("guilds", "id")
    return [Guild(id=id) for id in guild_ids]
Ejemplo n.º 4
0
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)
Ejemplo n.º 5
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()
Ejemplo n.º 6
0
 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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 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)
Ejemplo n.º 9
0
def getHighestEweekId():
    eweek_ids = database.getAll(parent="eweeks", field="id")
    return max(eweek_ids)