close war and manage tie
This commit is contained in:
parent
d766befd31
commit
71e987304b
7 changed files with 185 additions and 55 deletions
|
|
@ -13,12 +13,12 @@ from warchron.controller.dtos import (
|
|||
ParticipantOption,
|
||||
TreeSelection,
|
||||
WarDTO,
|
||||
WarParticipantDTO,
|
||||
ObjectiveDTO,
|
||||
SectorDTO,
|
||||
ChoiceDTO,
|
||||
BattleDTO,
|
||||
CampaignParticipantScoreDTO,
|
||||
WarParticipantScoreDTO,
|
||||
)
|
||||
from warchron.view.helpers import (
|
||||
format_campaign_label,
|
||||
|
|
@ -362,16 +362,35 @@ class View(QtWidgets.QMainWindow, Ui_MainWindow):
|
|||
table.setItem(row, 1, desc_item)
|
||||
table.resizeColumnsToContents()
|
||||
|
||||
def display_war_participants(self, participants: List[WarParticipantDTO]) -> None:
|
||||
def display_war_participants(
|
||||
self,
|
||||
participants: List[WarParticipantScoreDTO],
|
||||
objectives: List[ObjectiveDTO],
|
||||
) -> None:
|
||||
table = self.warParticipantsTable
|
||||
table.clearContents()
|
||||
base_cols = ["Player", "Faction", "Victory"]
|
||||
headers = base_cols + [obj.name for obj in objectives]
|
||||
table.setColumnCount(len(headers))
|
||||
table.setHorizontalHeaderLabels(headers)
|
||||
table.setRowCount(len(participants))
|
||||
table.setIconSize(QSize(48, 16))
|
||||
for row, part in enumerate(participants):
|
||||
name_item = QtWidgets.QTableWidgetItem(part.player_name)
|
||||
fact_item = QtWidgets.QTableWidgetItem(part.faction)
|
||||
name_item.setData(Qt.ItemDataRole.UserRole, part.id)
|
||||
if part.rank_icon:
|
||||
name_item.setIcon(part.rank_icon)
|
||||
faction_item = QtWidgets.QTableWidgetItem(part.faction)
|
||||
VP_item = QtWidgets.QTableWidgetItem(str(part.victory_points))
|
||||
name_item.setData(Qt.ItemDataRole.UserRole, part.war_participant_id)
|
||||
table.setItem(row, 0, name_item)
|
||||
table.setItem(row, 1, fact_item)
|
||||
table.setItem(row, 1, faction_item)
|
||||
table.setItem(row, 2, VP_item)
|
||||
col = 3
|
||||
for obj in objectives:
|
||||
value = part.narrative_points.get(obj.id, 0)
|
||||
NP_item = QtWidgets.QTableWidgetItem(str(value))
|
||||
table.setItem(row, col, NP_item)
|
||||
col += 1
|
||||
table.resizeColumnsToContents()
|
||||
|
||||
def _on_major_changed(self, value: int) -> None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue