Skip to content

Commit

Permalink
Display UHV goals in scoreboard (#47)
Browse files Browse the repository at this point in the history
* Add the display of uhv

* Add option
  • Loading branch information
VDuchauffour authored May 26, 2024
1 parent bea6e9a commit 717e5f9
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Assets/Config/Advanced Scoreboard.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<option id="StabilityValue" key="Stability Value"
type="boolean" default="True"
get="isShowStabilityValue" set="setShowStabilityValue" dirtyBit="Score"/>
<option id="UHV" key="UHV"
type="boolean" default="True"
get="isShowUHV" set="setShowUHV" dirtyBit="Score"/>

<list id="DisplayName" key="Display Name"
type="int" default="2" listType="string"
Expand Down
9 changes: 7 additions & 2 deletions Assets/Python/BUG/Scoreboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
Z_DEPTH = -0.3

# Columns IDs
NUM_PARTS = 28
NUM_PARTS = 29
(
ALIVE,
WAR,
Expand Down Expand Up @@ -56,6 +56,7 @@
NET_STATS,
OOS,
PLAGUE,
UHV,
STABILITY_LEVEL,
STABILITY_VALUE,
) = range(NUM_PARTS)
Expand Down Expand Up @@ -119,6 +120,7 @@ def init():
columns.append(Column("H", WORST_ENEMY, FIXED, smallSymbol(FontSymbols.ANGRY_POP_CHAR)))
columns.append(Column("M", WHEOOH, FIXED, smallSymbol(FontSymbols.OCCUPATION_CHAR)))
columns.append(Column("Q", CITIES, DYNAMIC))
columns.append(Column("$", UHV, DYNAMIC))
columns.append(Column("^", STABILITY_LEVEL, DYNAMIC))
columns.append(Column("+", STABILITY_VALUE, DYNAMIC))
columns.append(Column("*", WAITING, FIXED, smallText("*")))
Expand Down Expand Up @@ -286,14 +288,17 @@ def setReligion(self, value):
def setAttitude(self, value):
self._set(ATTITUDE, smallText(value))

def setUHV(self, count, color):
text = u"<color=%s>%d/3</color>" % (color, count)
self._set(UHV, smallText(text)) # type: ignore
def setStabilityLevel(self, value):
self._set(STABILITY_LEVEL, smallText(value))

def setStabilityValue(self, value):
_level = str(value)
if value > 0:
_level = "+" + _level
self._set(STABILITY_VALUE, smallText(" (%s)" % _level))
self._set(STABILITY_VALUE, smallText(" (%s)" % _level)) # type: ignore

def setWontTalk(self):
self._set(WONT_TALK)
Expand Down
3 changes: 2 additions & 1 deletion Assets/Python/BUG/Tabs/BugScoreOptionsTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,13 @@ def create(self, screen):

self.addCheckbox(screen, col3, "Scores__Delta")
self.addCheckbox(screen, col3, "Scores__DeltaIncludeCurrent")
self.addCheckbox(screen, col3, "Scores__StabilityValue")
# self.addLabel(screen, col3, "Scores_Icons", "Icons:")
self.addCheckbox(screen, col3, "Scores__Attitude")
self.addCheckbox(screen, col3, "Scores__WorstEnemy")
self.addCheckbox(screen, col3, "Scores__WHEOOH")
self.addCheckbox(screen, col3, "Scores__Cities")
self.addCheckbox(screen, col3, "Scores__UHV")
self.addCheckbox(screen, col3, "Scores__StabilityValue")

screen.attachHSeparator(column, column + "Sep")

Expand Down
11 changes: 9 additions & 2 deletions Assets/Python/screens/CvMainInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
from RFCUtils import (
StabilityOverlayCiv,
calculate_gold_rate,
countAchievedGoals,
getGoalsColor,
prosecute,
saint,
showPersecutionPopup,
Expand Down Expand Up @@ -9111,14 +9113,19 @@ def updateScoreStrings(self):
if bAlignIcons:
scores.setWHEOOH()
# BUG - WHEOOH - end
# Rhye - start victory
if bAlignIcons and ScoreOpt.isShowUHV():
count = countAchievedGoals(ePlayer)
color = getGoalsColor(ePlayer)
scores.setUHV(count, color)
# Rhye - end victory
# Rhye - start stability
stability_value, _, stability_symbol = stability(
ePlayer
)
if bAlignIcons:
scores.setStabilityLevel(stability_symbol)
if ScoreOpt.isShowStabilityValue():
if bAlignIcons:
if ScoreOpt.isShowStabilityValue():
scores.setStabilityValue(stability_value)
# Rhye - end stability
# BUG - Num Cities - start
Expand Down
Loading

0 comments on commit 717e5f9

Please sign in to comment.