Exemplo n.º 1
0
Arquivo: city.py Projeto: kimch2/x8623
 def get_faction_ranking(self, ranking):
     faction_rankers = convert_list_to_dict(
         ranking.get_range_by_score(
             "-inf", "+inf", count=10, withscores=True),
         dictcls=OrderedDict)
     factions = Faction.batch_load(
         faction_rankers.keys(),
         ["entityID", "name", "level"])
     for faction in factions:
         score = faction_rankers[faction.entityID]
         faction_rankers[faction.entityID] = {
             "name": faction.name,
             "score": score,
             "level": FactionRankRanking.get_score(faction.factionID) or 1,
         }
     faction_rankers = sorted(
         faction_rankers.values(), key=lambda s: s["score"], reverse=True)
     return faction_rankers
Exemplo n.º 2
0
Arquivo: city.py Projeto: kimch2/x8623
 def get_panel(self, p, rsp):
     rsp.faction_rank = CityDungeonKillRanking.get_rank(p.factionID)
     rsp.self_rank = CityDungeonSelfRanking.get_rank(p.entityID)
     faction_rankers = convert_list_to_dict(
         CityDungeonKillRanking.get_range_by_score(
             "-inf", "+inf", count=10, withscores=True),
         dictcls=OrderedDict)
     factions = Faction.batch_load(
         faction_rankers.keys(),
         ["entityID", "name", "level"])
     for faction in factions:
         if not faction:
             continue
         score = faction_rankers[faction.entityID]
         faction_rankers[faction.entityID] = {
             "name": faction.name,
             "score": score,
             "level": FactionRankRanking.get_score(faction.factionID) or 1,
         }
     player_rankers = convert_list_to_dict(
         CityDungeonSelfRanking.get_range_by_score(
             "-inf", "+inf", count=10, withscores=True),
         dictcls=OrderedDict)
     players = Player.batch_load(
         player_rankers.keys(),
         ["entityID", "name", "faction_name", "level"])
     for player in players:
         score = player_rankers[player.entityID]
         player_rankers[player.entityID] = {
             "name": player.name,
             "score": score,
             "level": player.level,
             "name2": player.faction_name,
         }
     rsp.faction_ranking = sorted(
         faction_rankers.values(), key=lambda s: s["score"], reverse=True)
     rsp.self_ranking = sorted(
         player_rankers.values(), key=lambda s: s["score"], reverse=True)
     rsp.top_prototypeID = p.prototypeID
     rsp.current_info = self.get_current_info(p)
     rsp.top_member_info = self.get_top_member_info(p)
     rsp.reds = g_redManager.get_red_messages(
         module=RedModuleType.CityDungeon)