display objective awards in participant tables
This commit is contained in:
parent
53b1fc916c
commit
f55106c260
8 changed files with 160 additions and 24 deletions
|
|
@ -1,6 +1,7 @@
|
|||
from typing import List, Tuple, TYPE_CHECKING, Dict
|
||||
|
||||
from PyQt6.QtWidgets import QMessageBox, QDialog
|
||||
from PyQt6.QtGui import QIcon
|
||||
|
||||
from warchron.constants import (
|
||||
RefreshScope,
|
||||
|
|
@ -53,12 +54,28 @@ class WarController:
|
|||
self.app.view.display_war_objectives(objectives_for_display)
|
||||
scores = ScoreService.compute_scores(war, ContextType.WAR, war.id)
|
||||
rows: List[WarParticipantScoreDTO] = []
|
||||
icon_map = {}
|
||||
vp_icon_map: dict[str, QIcon] = {}
|
||||
objective_icon_maps: Dict[str, Dict[str, QIcon]] = {}
|
||||
if war.is_over:
|
||||
icon_map = RankingIcon.compute_icons(war, ContextType.WAR, war_id, scores)
|
||||
vp_icon_map = RankingIcon.compute_icons(
|
||||
war, ContextType.WAR, war_id, scores
|
||||
)
|
||||
for obj in war.get_all_objectives():
|
||||
objective_icon_maps[obj.id] = RankingIcon.compute_icons(
|
||||
war,
|
||||
ContextType.WAR,
|
||||
f"{war.id}:{obj.id}",
|
||||
scores,
|
||||
objective_id=obj.id,
|
||||
)
|
||||
for war_part in war.get_all_war_participants():
|
||||
player_name = self.app.model.get_player_name(war_part.player_id)
|
||||
score = scores[war_part.id]
|
||||
objective_icons = {
|
||||
obj_id: icon_map[war_part.id]
|
||||
for obj_id, icon_map in objective_icon_maps.items()
|
||||
if war_part.id in icon_map
|
||||
}
|
||||
rows.append(
|
||||
WarParticipantScoreDTO(
|
||||
war_participant_id=war_part.id,
|
||||
|
|
@ -68,7 +85,8 @@ class WarController:
|
|||
victory_points=score.victory_points,
|
||||
narrative_points=dict(score.narrative_points),
|
||||
tokens=war.get_influence_tokens(war_part.id),
|
||||
rank_icon=icon_map.get(war_part.id),
|
||||
rank_icon=vp_icon_map.get(war_part.id),
|
||||
objective_icons=objective_icons,
|
||||
)
|
||||
)
|
||||
self.app.view.display_war_participants(rows, objectives_for_display)
|
||||
|
|
@ -133,6 +151,7 @@ class WarController:
|
|||
RefreshScope.WARS_TREE, item_type=ItemType.WAR, item_id=war_id
|
||||
)
|
||||
|
||||
# FIXME tie dialog with all participant even without tie
|
||||
def resolve_ties(
|
||||
self, war: War, contexts: List[TieContext]
|
||||
) -> Dict[Tuple[ContextType, str, int | None], Dict[str, bool]]:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue