The bank as five pages: bank, properties, stocks, passbook and fellow managers

The hall with its hot spots is gone; each service is a page of its own with a
picture and its figures. The properties hang on an estate agent's board, and
what the club owns carries a stamp. The page for dealings between managers
appears only where more than one human plays.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-16 00:17:25 +01:00
1 parent e14b2f2374
commit 964a4ae35d
27 files changed
+407 -520

No files matched your search

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 984 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 979 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 MiB

+150
View File
@@ -161,6 +161,156 @@
1,
1
]
},
"bank.scene.savings": {
"file": "bank-savings.png",
"sha256": "2f0ac60e735d9299b2d2dd3c98bb4e90c66834f3af8968577feff3d03f8543d3",
"crop": [
0,
0,
1,
1
]
},
"bank.scene.properties": {
"file": "bank-properties.png",
"sha256": "7b9c6ae2526cf8631a8f71aac093b6147e478ffb0c21df67e05542681ab27eeb",
"crop": [
0,
0,
1,
1
]
},
"bank.scene.stocks": {
"file": "bank-stocks.png",
"sha256": "89eae73444c7c81d18b2158bdb5651ae379921c6569e7ddbbd6efa0a330cb0ad",
"crop": [
0,
0,
1,
1
]
},
"bank.scene.overview": {
"file": "bank-hall.png",
"sha256": "99588ae770f38b758064572c47242c590e97dda3a8f382fcabf081cf32a3a942",
"crop": [
0,
0,
1,
1
]
},
"bank.scene.players": {
"file": "bank-players.png",
"sha256": "64392b21bfac5a9ae51e08948be27115afba52588013b0d386e22c06afaa120b",
"crop": [
0,
0,
1,
1
]
},
"bank.home.0": {
"file": "bank-home-0.png",
"sha256": "eed1fdb1bdea7ff49712895524add29af8a9b1be598e65fdbd011cb836e1156f",
"crop": [
0,
0,
1,
1
]
},
"bank.home.1": {
"file": "bank-home-1.png",
"sha256": "5df522f41d497c36b029fb85a0358a4c45247a85e172055d8b53d9e2c8d211bd",
"crop": [
0,
0,
1,
1
]
},
"bank.home.2": {
"file": "bank-home-2.png",
"sha256": "79caab1c8c3635a157f2c016cdaea8ac1ee18b5db23e815ad16470320b3e2c39",
"crop": [
0,
0,
1,
1
]
},
"bank.home.3": {
"file": "bank-home-3.png",
"sha256": "cc1b12bce82818d22a3bf9572d79bf25041be861baadd54e8d1378015adba1f2",
"crop": [
0,
0,
1,
1
]
},
"bank.home.4": {
"file": "bank-home-4.png",
"sha256": "b4225c1617dc6c39d031b3c16995ca4513c7faba42e98fb18b5aeb66968c842d",
"crop": [
0,
0,
1,
1
]
},
"bank.home.5": {
"file": "bank-home-5.png",
"sha256": "cd51afe7175a4d04f5757a95166bd31e44cce1bd065a1bf2860f8881e2ac7aaf",
"crop": [
0,
0,
1,
1
]
},
"bank.home.6": {
"file": "bank-home-6.png",
"sha256": "631ac77939524e37fe27b4a79aca7d47eaa40e3885bb076b979f9ecf98c448ef",
"crop": [
0,
0,
1,
1
]
},
"bank.home.7": {
"file": "bank-home-7.png",
"sha256": "68668dbfac8e233a8825e013add3a63470509eddd8266fe15e82022c685c919b",
"crop": [
0,
0,
1,
1
]
},
"bank.home.8": {
"file": "bank-home-8.png",
"sha256": "63ca49dc34336951dd90c7a3b33482ca4b882a51512b245c72054c8a108b653a",
"crop": [
0,
0,
1,
1
]
},
"bank.home.9": {
"file": "bank-home-9.png",
"sha256": "111afb4d8a30ac5115b0c6838b96fc47c80a9693d1da0c2135f8316efc13f3ba",
"crop": [
0,
0,
1,
1
]
}
}
}
+1 -226
View File
@@ -1,227 +1,2 @@
/* SPDX-License-Identifier: GPL-3.0-only */
.bank-page {position:absolute;left:0;right:0;top:0;bottom:0;color:var(--text);}
.bank-scene {position:absolute;left:0;top:60dp;width:2612dp;height:1470.016746dp;border:2dp var(--border);border-radius:20dp;overflow:hidden;}
.bank-hotspots {position:absolute;left:0;right:0;top:0;bottom:0;}
.bank-hotspot,.bank-hotspot:hover {position:absolute;padding:0;border:0dp;border-radius:10dp;background-color:transparent;decorator:none;}
.bank-hotspot:focus-visible {border:4dp var(--accent);}
#bank-interaction-hint {position:absolute;left:40dp;right:40dp;bottom:25dp;min-height:90dp;display:flex;align-items:center;justify-content:center;text-align:center;font-size:32dp;line-height:46.4dp;}
.bank-overlay {position:absolute;left:0;right:0;top:0;bottom:0;border:2dp var(--border);border-radius:20dp;background-color:#243441f7;color:var(--text);font-size:34dp;}
.bank-overlay>h2 {position:absolute;left:50dp;right:50dp;top:40dp;text-align:center;font-size:40dp;line-height:45dp;font-weight:normal;}
.bank-actions {position:absolute;left:50dp;right:50dp;bottom:35dp;height:84dp;display:flex;gap:30dp;}
.bank-actions .bank-control {flex:1;min-width:0;height:84dp;padding:12dp 24dp;font-size:32dp;border-radius:12dp;background-color:transparent;decorator:linear-gradient(180deg,#c1d1e31c,#869eb312);}
.savings-overlay {background-color:#1c2d3bba;}
.passbook {position:absolute;left:254dp;top:35dp;width:2100dp;height:1301.109375dp;color:#342c27;}
.passbook-left,.passbook-right {position:absolute;top:30dp;bottom:30dp;width:924dp;font-size:34dp;line-height:49.3dp;}
.passbook-left {left:63dp;}
.passbook-right {right:63dp;}
.passbook h2 {position:absolute;left:0;right:0;top:0;text-align:center;font-size:52dp;line-height:60dp;font-weight:normal;color:#8b3c32;}
.passbook h3 {position:absolute;left:0;right:0;top:90dp;font-size:46dp;line-height:54dp;font-weight:bold;text-transform:uppercase;color:#423628;}
.passbook-left p {position:absolute;left:0;right:0;}
.passbook-note-one {top:184dp;}
.passbook-note-two {top:273.296875dp;}
.passbook-note-three {top:411.890625dp;}
.passbook-right h2 {color:#5b4837;}
.passbook-right output {position:absolute;left:0;right:0;top:140dp;text-align:right;font-size:54dp;line-height:62dp;}
.property-row {position:absolute;left:50dp;right:50dp;height:650dp;display:flex;align-items:center;gap:50dp;}
.owned-property {top:115dp;}
.offered-property {top:765dp;}
.property-description {flex:1;min-width:0;font-size:34dp;line-height:47.6dp;}
.property-description h3 {font-size:34dp;font-weight:normal;line-height:44.2dp;margin:10dp 0 30dp;}
.property-description p {margin:20dp 0;}
.property-picture {width:1000dp;height:570dp;flex-shrink:0;padding:0;border:2dp var(--border);border-radius:16dp;background-color:#172431;overflow:hidden;display:flex;align-items:center;justify-content:center;}
.property-empty {display:block;width:100%;height:100%;background-color:#242323;}
.stock-table {position:absolute;left:50dp;top:115dp;width:1718dp;height:1320dp;font-size:32dp;}
.stock-row {display:flex;align-items:center;height:103.333333dp;}
.stock-row.stock-head {height:80dp;}
.stock-row>div {width:399.333333dp;flex-shrink:0;text-align:right;color:#d8c892;}
.stock-row>div:first-child {width:520dp;text-align:left;}
.stock-head>div {color:var(--text);}
.stock-name {font-size:32dp;padding:8dp 15dp;border:0dp;border-radius:8dp;background-color:transparent;color:var(--text);}
.stock-name[aria-pressed=true] {background-color:var(--selected);color:var(--accent);}
.stock-chart {position:absolute;left:1818dp;top:115dp;width:740dp;height:1320dp;background-color:#172938;border-radius:16dp;overflow:hidden;}
.credit-portrait {position:absolute;left:50dp;top:135dp;width:620dp;height:515dp;border-radius:16dp;overflow:hidden;}
.credit-facts {position:absolute;left:740dp;top:195dp;width:1818dp;height:395dp;font-size:34dp;line-height:39dp;}
.credit-fact {position:absolute;left:0;right:0;height:63dp;display:flex;justify-content:space-between;}
.credit-fact>span,.credit-fact>strong {display:block;width:891.5dp;font-weight:normal;}
.credit-fact>strong {text-align:right;white-space:nowrap;color:#b9d8e2;}
#bank-term {width:190dp;height:63dp;padding:12dp 30dp 12dp 12dp;text-align:left;border:2dp var(--border);border-radius:10dp;background-color:#263744;color:var(--text);font-size:30dp;}
.credit-schedule {position:absolute;left:50dp;right:50dp;top:686dp;height:642.78125dp;border:2dp var(--border);border-radius:18dp;background-color:#1a303fe6;}
.credit-schedule-caption {position:absolute;left:36dp;right:36dp;top:28dp;height:106.390625dp;}
.credit-schedule-caption h3 {font-size:32dp;line-height:41.59375dp;font-weight:normal;color:var(--text);}
.credit-schedule-amount {position:absolute;left:0;top:51.59375dp;font-size:42dp;line-height:54.796875dp;color:var(--accent);}
.credit-schedule-amount>span {padding:0 16dp;color:var(--muted);}
.credit-schedule-context {position:absolute;right:0;top:0;text-align:right;}
.credit-schedule-context>span {display:inline-block;padding:10dp 22dp;border:2dp var(--border);border-radius:12dp;background-color:var(--soft);font-size:28dp;line-height:36.4dp;}
.credit-schedule-context>p {margin-top:14dp;font-size:28dp;line-height:33.8dp;color:var(--muted);}
.credit-chart {position:absolute;left:36dp;top:152.390625dp;width:2432dp;height:420dp;}
.credit-schedule-note {position:absolute;left:36dp;right:36dp;top:580.390625dp;font-size:28dp;line-height:36.390625dp;color:var(--muted);}
.bank-note {font-size:28dp;line-height:42dp;color:var(--muted);}
.credit-note {position:absolute;left:50dp;right:50dp;top:1346.78125dp;line-height:39.1875dp;}
.bank-overview {position:absolute;left:110dp;right:110dp;top:175dp;font-size:40dp;line-height:45dp;}
.bank-overview-row {height:113dp;display:flex;justify-content:space-between;gap:45dp;}
.bank-overview-row>span,.bank-overview-row>strong {display:block;width:50%;font-weight:normal;}
.bank-overview-row>strong {text-align:right;color:#b9d8e2;}
.bank-overview-total {height:90dp;border-top:5dp var(--border);padding-top:40dp;}
.overview-note {position:absolute;left:50dp;right:50dp;bottom:50dp;}
body.silver .bank-overlay {background-color:#f7f3e9fc;color:#233443;}
body.silver .savings-overlay {background-color:#fcf9f190;}
body.silver .property-picture {background-color:#fcf9f190;}
body.silver .stock-chart {background-color:#fcf9f190;}
body.silver .stock-row>div {color:#805b18;}
body.silver .stock-head>div,body.silver .stock-name {color:#233443;}
body.silver .credit-fact>strong,body.silver .bank-overview-row>strong {color:#233443;}
body.silver #bank-term {background-color:#ffffffad;color:#233443;}
body.silver .credit-schedule {background-color:#fcf9f190;}
body.silver .bank-actions .bank-control {decorator:linear-gradient(180deg,#ffffffd8,#e9e1cf99);}
body.matchday .bank-overlay {background-color:#2c2c32fc;color:#efeded;}
body.matchday .savings-overlay {background-color:#1d1e2466;}
body.matchday .property-picture,body.matchday .stock-chart {background-color:#1d1e2466;}
body.matchday .stock-row>div {color:#e1c68b;}
body.matchday .stock-head>div,body.matchday .stock-name {color:#efeded;}
body.matchday .credit-fact>strong,body.matchday .bank-overview-row>strong {color:#efeded;}
body.matchday #bank-term {background-color:#191a208a;color:#efeded;}
body.matchday .credit-schedule {background-color:#1d1e2466;}
body.matchday .bank-actions .bank-control {decorator:linear-gradient(180deg,#e8d6dc12,#a1a0aa0d);}
/* each service of the hall carries its name on a paper tag */
.bank-hotspot {display:flex;align-items:flex-end;justify-content:center;}
.bank-tag {display:block;flex-shrink:0;margin-bottom:10dp;padding:6dp 22dp;border:2dp #7b725f88;border-radius:6dp;background-color:#fbfaf6f0;color:#233443;font-family:Display;font-size:34dp;line-height:44dp;white-space:nowrap;}
.bank-hotspot:hover .bank-tag {background-color:#ffffff;border-color:#25617a;}
/* --- The bank's services: sheets of the house with a head, tabs, figures and charts. --- */
body {--bank-gold:#d9bd7c;--bank-panel:#ffffff0a;}
body.silver {--bank-gold:#9a7a3a;--bank-panel:#ffffff8c;}
.bank-overlay,body.silver .bank-overlay,body.matchday .bank-overlay {border:2dp var(--paper-edge);border-radius:10dp;background-color:transparent;decorator:linear-gradient(175deg,var(--paper-top),var(--paper-bottom));color:var(--text);}
.bank-head {position:absolute;left:0;right:0;top:0;height:150dp;display:flex;align-items:center;padding:0 60dp;border-bottom:4dp var(--bank-gold);}
.bank-brand {display:flex;flex-direction:column;flex-shrink:0;}
.bank-brand strong {display:block;font-family:Display;font-size:30dp;line-height:38dp;font-weight:normal;letter-spacing:3dp;color:var(--bank-gold);}
.bank-brand span {display:block;font-family:Display;font-size:60dp;line-height:68dp;}
.bank-tabs {display:flex;gap:14dp;margin-left:auto;}
.bank-tabs .bank-tab {height:72dp;padding:0 34dp;border:2dp var(--rule);border-radius:36dp;background-color:transparent;decorator:none;font-size:32dp;color:var(--text);}
.bank-tabs .bank-tab:hover {background-color:var(--hover);}
.bank-tabs .bank-tab.selected {border-color:var(--bank-gold);background-color:var(--bank-gold);color:#1d232a;}
.bank-insight {border:2dp var(--rule);border-radius:8dp;padding:16dp 30dp;background-color:var(--bank-panel);}
.bank-insight h4 {display:block;margin:0 0 6dp 0;font-family:Display;font-size:34dp;line-height:44dp;font-weight:bold;color:var(--bank-gold);}
.bank-insight p {margin:0;font-size:32dp;line-height:46dp;}
.bank-part-track {height:14dp;border-radius:7dp;background-color:var(--rule);overflow:hidden;}
.bank-part-track>div {height:14dp;border-radius:7dp;background-color:var(--bank-gold);}
/* overview */
.bank-ring {position:absolute;left:90dp;top:230dp;width:860dp;height:860dp;}
.bank-ring-centre {position:absolute;left:0;top:330dp;width:860dp;text-align:center;}
.bank-ring-centre span {display:block;font-size:34dp;line-height:44dp;color:var(--muted);}
.bank-ring-centre strong {display:block;font-family:Display;font-size:58dp;line-height:76dp;font-weight:bold;}
.bank-parts {position:absolute;left:1080dp;right:60dp;top:240dp;}
.bank-part {height:150dp;}
.bank-part.plain {height:92dp;border-top:2dp var(--rule);padding-top:22dp;}
.bank-part-line {display:flex;align-items:center;height:76dp;font-size:40dp;}
.bank-part-line span,.bank-part-line strong {display:block;flex-shrink:0;}
.bank-part-line .chip {width:30dp;height:30dp;border-radius:15dp;margin-right:24dp;}
.bank-part-line .chip.none {background-color:transparent;}
.bank-part-line .label {flex:1;}
.bank-part-line strong {font-family:Display;font-size:48dp;font-weight:bold;text-align:right;}
.bank-part-line .share {width:220dp;text-align:right;font-size:34dp;color:var(--muted);}
.overview-insight {position:absolute;left:90dp;right:60dp;top:1180dp;}
.overview-note {bottom:40dp;}
/* stocks */
.stock-table {left:60dp;top:190dp;width:1500dp;height:1340dp;font-size:32dp;}
.stock-row {height:98dp;border-bottom:2dp var(--rule);}
.stock-row.stock-head {height:70dp;color:var(--muted);}
.stock-row.chosen {background-color:var(--selected);}
.stock-row>div,body.silver .stock-row>div,body.matchday .stock-row>div {width:250dp;color:var(--text);}
.stock-row>div:first-child {width:460dp;}
.stock-row>div:nth-child(2) {width:290dp;display:flex;justify-content:flex-end;}
.stock-name[aria-pressed=true] {background-color:transparent;color:var(--text);font-weight:bold;}
.stock-move {display:inline-block;font-size:30dp;}
.stock-move.up {color:var(--win);}
.stock-move.down {color:var(--loss);}
.stock-move.flat {color:var(--muted);}
.stock-detail {position:absolute;left:1620dp;right:60dp;top:190dp;height:1340dp;}
.stock-detail h3 {display:block;margin:0;font-family:Display;font-size:54dp;line-height:64dp;font-weight:bold;}
.stock-quote {display:flex;align-items:baseline;gap:26dp;height:96dp;}
.stock-quote strong {display:block;font-family:Display;font-size:84dp;line-height:96dp;font-weight:bold;}
.stock-quote .stock-move {font-size:38dp;}
.stock-chart,body.silver .stock-chart,body.matchday .stock-chart {position:relative;left:0;top:0;width:920dp;height:500dp;margin-top:10dp;border:2dp var(--rule);border-radius:8dp;background-color:var(--bank-panel);}
.stock-legend {display:flex;align-items:center;height:56dp;margin:0;font-size:26dp;color:var(--muted);}
.stock-legend .key {display:block;width:36dp;height:8dp;border-radius:4dp;margin:0 12dp 0 26dp;}
.stock-legend .key.course {margin-left:0;background-color:#9ac7d8;}
body.silver .stock-legend .key.course {background-color:#25617a;}
.stock-legend .key.average {background-color:var(--bank-gold);}
.stock-legend .key.high {width:16dp;height:16dp;border-radius:8dp;background-color:var(--win);}
.stock-legend .key.low {width:16dp;height:16dp;border-radius:8dp;background-color:var(--loss);}
.stock-tiles {display:flex;flex-wrap:wrap;gap:14dp;width:932dp;}
.stock-tile {width:296dp;height:128dp;border:2dp var(--rule);border-radius:8dp;display:flex;flex-direction:column;align-items:center;justify-content:center;background-color:var(--bank-panel);}
.stock-tile strong {display:block;font-family:Display;font-size:42dp;line-height:52dp;font-weight:bold;white-space:nowrap;}
.stock-tile span {display:block;font-size:26dp;line-height:34dp;color:var(--muted);}
.stock-tile.up strong {color:var(--win);}
.stock-tile.down strong {color:var(--loss);}
.stock-detail .bank-insight {margin-top:20dp;}
.stock-detail .bank-insight p {font-size:30dp;line-height:42dp;}
/* properties */
.property-card {position:absolute;top:200dp;width:1216dp;height:1330dp;border:2dp var(--rule);border-radius:10dp;background-color:var(--bank-panel);padding:28dp 32dp;}
.property-card.owned-property {left:60dp;}
.property-card.offered-property {left:1336dp;}
.property-card h3 {display:block;margin:0 0 18dp 0;font-size:30dp;line-height:40dp;font-weight:normal;letter-spacing:2dp;color:var(--bank-gold);}
.property-card h4 {display:block;margin:26dp 0 10dp 0;font-family:Display;font-size:54dp;line-height:66dp;font-weight:bold;}
.property-card .property-picture {width:1150dp;height:654dp;border:2dp var(--paper-edge);border-radius:8dp;}
.property-empty,body.silver .property-empty {display:flex;align-items:center;justify-content:center;width:100%;height:100%;background-color:var(--rule);}
.property-empty span {display:block;font-size:34dp;color:var(--muted);}
.bank-fact {display:flex;align-items:center;justify-content:space-between;height:70dp;border-bottom:2dp var(--rule);font-size:34dp;}
.bank-fact span,.bank-fact strong {display:block;}
.bank-fact strong {font-family:Display;font-size:40dp;font-weight:bold;}
.property-hint {margin:22dp 0 0 0;font-size:28dp;color:var(--muted);}
/* savings: the passbook lies on the sheet */
.savings-overlay,body.silver .savings-overlay,body.matchday .savings-overlay {background-color:transparent;}
.passbook {left:256dp;top:210dp;border-radius:44dp;overflow:hidden;}
.passbook-cash {position:absolute;left:0;right:0;top:240dp;text-align:right;font-size:34dp;color:#5b4837;}
/* credit */
.credit-portrait {left:60dp;top:200dp;border:2dp var(--paper-edge);border-radius:8dp;}
.credit-facts.engine-credit {left:750dp;right:60dp;top:196dp;width:auto;height:520dp;}
.engine-credit .credit-fact {height:62dp;border-bottom:2dp var(--rule);align-items:center;font-size:32dp;}
.engine-credit .credit-fact>span {width:auto;}
.engine-credit .credit-fact>strong,body.silver .engine-credit .credit-fact>strong {width:auto;font-family:Display;font-size:36dp;font-weight:bold;color:var(--text);}
.engine-credit .credit-fact .bank-control {width:620dp;height:52dp;font-size:32dp;border:2dp var(--bank-gold);border-radius:8dp;}
.credit-schedule,body.silver .credit-schedule,body.matchday .credit-schedule {left:60dp;right:60dp;top:770dp;border:2dp var(--rule);border-radius:10dp;background-color:var(--bank-panel);}
.credit-schedule.engine-credit {height:620dp;}
.credit-schedule-caption h3 {font-family:Display;font-size:40dp;font-weight:bold;}
.credit-tiles {position:absolute;left:36dp;right:36dp;top:110dp;width:auto;}
.credit-tiles .stock-tile {width:780dp;height:170dp;}
.credit-tiles .stock-tile strong {font-size:54dp;line-height:66dp;}
.credit-progress {position:absolute;left:36dp;right:36dp;top:330dp;}
.credit-progress-label {display:flex;justify-content:space-between;height:60dp;font-size:32dp;}
.credit-progress-label span,.credit-progress-label strong {display:block;}
.credit-schedule.engine-credit .credit-schedule-note {top:auto;bottom:28dp;}
.bank-actions {left:60dp;right:60dp;}
/* second pass */
.stock-row {height:104dp;}
.stock-row>div,body.silver .stock-row>div,body.matchday .stock-row>div {flex:1;width:auto;}
.stock-row>div:first-child {flex:none;width:430dp;}
.stock-row>div:nth-child(2) {flex:none;width:300dp;}
.stock-row>div:last-child {padding-right:24dp;}
.stock-name,.stock-name.control-button {justify-content:flex-start;text-align:left;}
.stock-chart,body.silver .stock-chart,body.matchday .stock-chart {height:500dp;}
.stock-legend span {display:block;flex-shrink:0;}
.stock-tile {height:138dp;}
.bank-market {position:absolute;left:90dp;right:60dp;top:1370dp;height:400dp;}
.bank-market h4 {display:block;margin:0 0 8dp 0;font-family:Display;font-size:34dp;line-height:44dp;font-weight:bold;color:var(--bank-gold);}
.bank-market-bars {display:flex;height:340dp;}
.bank-market-column {flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;}
.bank-market-column .rise {height:150dp;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;border-bottom:2dp var(--rule);width:100%;}
.bank-market-column .fall {height:150dp;display:flex;flex-direction:column;align-items:center;justify-content:flex-start;width:100%;}
.bank-market-column .bar {width:64dp;border-radius:4dp;}
.bank-market-column .bar.up {background-color:var(--win);}
.bank-market-column .bar.down {background-color:var(--loss);}
.bank-market-column span {display:block;font-size:24dp;line-height:30dp;color:var(--muted);}
.bank-market-column strong {display:block;font-size:26dp;line-height:36dp;font-weight:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}
.property-prices {margin-top:22dp;}
.property-prices h5 {display:block;margin:0 0 8dp 0;font-size:28dp;line-height:38dp;font-weight:normal;letter-spacing:2dp;color:var(--bank-gold);}
.property-price {display:flex;align-items:center;height:44dp;font-size:28dp;}
.property-price span {display:block;flex-shrink:0;}
.property-price .name {width:340dp;}
.property-price .bank-part-track {flex:1;}
.property-price .sum {width:300dp;text-align:right;}
.property-price.chosen .name,.property-price.chosen .sum {font-weight:bold;}
.property-price.chosen .bank-part-track>div {background-color:#25617a;}
.bank-market-column strong {width:100%;text-align:center;flex-shrink:0;height:36dp;}
.credit-schedule.engine-credit {height:780dp;}
.credit-schedule.engine-credit .credit-tiles .stock-tile {height:210dp;}
.credit-schedule.engine-credit .credit-progress {top:390dp;}
/* The bank is five pages of the notebook now: its styles are the bk-* rules in pages.rcss. */
+63
View File
@@ -773,3 +773,66 @@ body.midnight .cp-map-name,body.matchday .cp-map-name {color:#f0ece2;font-effect
.ad-strip-item strong {display:block;font-family:Display;font-weight:normal;font-size:40dp;white-space:nowrap;}
.ad-board-no {font-size:21dp;}
.ad-board-face strong {font-size:28dp;line-height:34dp;}
/* --- bank: five pages. A picture with a line of writing opens each of them --- */
.bk-banner {position:relative;display:block;flex:none;overflow:hidden;border:2dp var(--p-div);border-radius:45dp;}
.bk-banner-art {position:absolute;left:0;top:0;display:block;}
.bk-banner-over {position:absolute;left:0;bottom:0;display:block;width:100%;padding:18dp 36dp 20dp;background-color:#201e1dd1;}
.bk-banner-over strong {display:block;font-family:Display;font-weight:normal;font-size:56dp;line-height:64dp;white-space:nowrap;color:#f9f4ed;}
.bk-banner-d {display:block;font-size:27dp;line-height:34dp;white-space:nowrap;color:#e6dccb;}
.bk-reading {display:block;font-size:28dp;line-height:38dp;}
.bk-ring {display:block;flex:none;width:400dp;height:400dp;}
.bk-part {display:block;margin-bottom:9dp;font-size:29dp;line-height:42dp;}
.bk-part span {display:block;white-space:nowrap;}
.bk-part strong {display:block;font-weight:bold;white-space:nowrap;}
.bk-part .pg-bar {display:block;flex:none;height:14dp;margin-top:2dp;}
.bk-part .pg-bar div {height:14dp;}
.bk-chip {display:block;flex:none;width:22dp;height:22dp;border-radius:11dp;}
.bk-share {flex:none;width:118dp;text-align:right;}
.bk-credit-line {align-items:center;min-height:62dp;border-bottom:2dp var(--p-row);}
.pg-root .pg-btn.bk-edit {height:52dp;padding:0 27dp;border-color:var(--p-a5);background-color:var(--p-a1);font-family:Modern;font-size:29dp;font-weight:bold;color:var(--p-a9);}
.pg-root .pg-btn.bk-wide {width:100%;height:76dp;}
.pg-root .bk-select {width:400dp;height:60dp;padding:0 27dp;border:2dp var(--p-div);border-radius:30dp;background-color:var(--p-bg);font-family:Modern;font-size:29dp;color:var(--p-text);}
.bk-tiles {display:flex;flex-wrap:wrap;gap:11dp;}
.bk-tile {display:block;flex:none;width:352dp;padding:11dp 22dp;border:2dp var(--p-div);border-radius:27dp;background-color:var(--p-bg);}
.bk-tile strong {display:block;font-family:Display;font-weight:normal;font-size:38dp;line-height:46dp;white-space:nowrap;}
.bk-tile span {display:block;font-size:24dp;line-height:30dp;color:var(--p-n7);}
.bk-chart {display:block;flex:none;overflow:hidden;}
/* the passbook: a ruled page in the manager's hand */
.bk-passbook {position:relative;display:block;flex:none;padding:45dp 54dp 40dp;border:2dp #cdbf96;border-radius:18dp;background-color:#fbf6e3;color:#3a332b;}
.bk-passbook-head {display:block;margin-bottom:22dp;padding-bottom:14dp;border-bottom:4dp #56633f;font-family:Display;font-size:40dp;line-height:50dp;color:#3d472b;}
.bk-passbook-line {display:flex;align-items:flex-end;justify-content:space-between;height:92dp;border-bottom:2dp #9fb7c4;font-size:30dp;}
.bk-passbook-line span {display:block;padding-bottom:9dp;color:#645c50;}
.bk-passbook-line strong {display:block;font-family:Pencil;font-weight:bold;font-size:58dp;line-height:70dp;white-space:nowrap;color:#23415c;}
.bk-passbook-note {display:block;margin-top:27dp;font-family:Pencil;font-size:42dp;line-height:52dp;color:#8c491a;transform:rotate(-1deg);}
/* the board of the estate agent */
.bk-board {display:flex;flex:none;flex-wrap:wrap;gap:22dp 24dp;padding:36dp 30dp 22dp;border:5dp #8a6a44;border-radius:27dp;background-color:#cfa877;}
.bk-home,.bk-home:hover,.bk-home:focus,.bk-home:disabled {position:relative;display:block;flex:none;width:524dp;height:508dp;padding:16dp 16dp 0;margin:0;border:2dp #d9cfbb;border-radius:9dp;background-color:#fffdf8;decorator:none;text-align:left;opacity:1;transform:rotate(-0.5deg);}
.bk-home.odd,.bk-home.odd:hover,.bk-home.odd:disabled {transform:rotate(0.6deg);}
.bk-home:hover {border-color:#c8733c;}
.bk-home.sel,.bk-home.sel:hover {border:5dp #c8733c;padding:13dp 13dp 0;}
.bk-pin {position:absolute;left:50%;top:-18dp;display:block;width:32dp;height:32dp;margin-left:-16dp;border:3dp #6b2318;border-radius:16dp;background-color:#c8452f;}
.bk-home-art {position:relative;display:block;width:492dp;height:382dp;overflow:hidden;border-radius:5dp;}
.bk-home strong {display:block;margin-top:9dp;font-family:Display;font-weight:normal;font-size:34dp;line-height:42dp;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#2e2b25;}
.bk-home-price {display:block;font-family:Modern;font-size:27dp;line-height:34dp;white-space:nowrap;color:#645c50;}
.bk-home:disabled .bk-home-art,.bk-home[disabled] .bk-home-art {opacity:.7;}
.bk-home:disabled .bk-home-price,.bk-home[disabled] .bk-home-price {color:#8c491a;}
.bk-home[disabled],.bk-home[disabled]:hover {border-color:#d9cfbb;background-color:#f3e6cf;}
.bk-stamp {position:absolute;left:66dp;top:128dp;display:block;width:360dp;padding:9dp 0;border:7dp #a8452f;border-radius:14dp;background-color:#fff8edd9;text-align:center;transform:rotate(-11deg);}
.bk-stamp span {display:block;font-family:Display;font-size:44dp;line-height:52dp;letter-spacing:4dp;color:#a8452f;}
.bk-stamp small {display:block;font-family:Modern;font-size:24dp;line-height:30dp;font-weight:bold;letter-spacing:2dp;color:#a8452f;}
/* the list of the stocks */
.bk-row,.bk-row:hover,.bk-row:focus {display:flex;flex:none;align-items:center;gap:18dp;width:100%;height:92dp;padding:0 14dp;margin:0;border:0dp;border-top:2dp var(--p-row);border-radius:0dp;background-color:transparent;decorator:none;font-family:Modern;font-size:30dp;color:var(--p-text);text-align:left;}
.bk-row:hover {background-color:var(--p-n2);}
.bk-row.sel,.bk-row.sel:hover {background-color:var(--p-a1);}
.bk-row.head {height:62dp;border-top-width:0dp;font-size:23dp;font-weight:bold;letter-spacing:1dp;color:var(--p-n7);}
.bk-row span {display:block;white-space:nowrap;}
.bk-name {flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;font-weight:bold;}
.bk-row.head .bk-name {font-weight:bold;}
.bk-spark {flex:none;width:216dp;}
.bk-num {flex:none;width:170dp;text-align:right;}
.bk-num.wide {width:230dp;}
.bk-move {display:block;font-weight:bold;white-space:nowrap;}
.bk-move.up {color:var(--p-s8);}
.bk-move.down {color:var(--p-a8);}
.bk-move.flat {color:var(--p-n7);font-weight:normal;}
+12 -47
View File
@@ -1,14 +1,20 @@
// SPDX-License-Identifier: GPL-3.0-only
// The page of the bank a marker of the notebook stands for; "" for any other route.
std::string App::bank_view_of(const std::string &route) {
return route == "bank" ? "credit" : route == "properties" || route == "stocks" || route == "savings" || route == "players" ? route : std::string();
}
bool App::bank_action(const std::string &action, Rml::Element *target) {
if (menu_ != "bank" || (!source_ && !engine_mode_) || !world_) return false;
if (action == "close") {
if (bank_view_ == "entrance") return false;
bank_view_ = "entrance";
bank_hint_.clear();
focus_after_render_ = "window-close";
if (action == "bank-property" && target) {
// a house on the board is chosen: it is the one bought and sold
const auto index = target->GetAttribute<int>("data-id", -1);
if (bank_view_ != "properties" || index < 0 || index > 5) return true;
bank_property_ = bank_owned_ = index;
focus_after_render_ = "bank-property-" + std::to_string(index);
refresh();
return true;
}
if (action == "bank-soon") return true;
if (action == "bank-view" && target) {
const auto view = target->GetAttribute<Rml::String>("data-view", "");
if (view != "properties" && view != "stocks" && view != "overview" && view != "savings" && view != "credit") return true;
@@ -101,29 +107,7 @@ bool App::bank_event(Rml::Event &event) {
auto *target = event.GetTargetElement();
const bool keyboard = type == "keydown";
const auto key = keyboard ? Rml::Input::KeyIdentifier(event.GetParameter<int>("key_identifier", 0)) : Rml::Input::KI_UNKNOWN;
if (bank_view_ != "entrance" && ((keyboard && key == Rml::Input::KI_ESCAPE) ||
(type == "mouseup" && event.GetParameter<int>("button", 0) == 1))) {
if (keyboard)
if (auto *select = dynamic_cast<Rml::ElementFormControlSelect *>(element("bank-term"));
select && select->IsSelectBoxVisible()) {
select->CancelSelectBox();
select->Focus(true);
dirty_ = true;
event.StopImmediatePropagation();
return true;
}
bank_action("close", nullptr);
event.StopImmediatePropagation();
return true;
}
if (type == "contextmenu" && bank_view_ != "entrance") { event.StopImmediatePropagation(); return true; }
if (type == "click" && bank_view_ != "entrance")
for (auto *node = target; node && node != doc_; node = node->GetParentNode())
if (node->GetAttribute<Rml::String>("data-action", "") == "close") {
bank_action("close", node);
event.StopImmediatePropagation();
return true;
}
(void)key;
if (!engine_mode_ && type == "change" && target->GetId() == "bank-term") {
auto *select = dynamic_cast<Rml::ElementFormControlSelect *>(target);
if (!select || bank_view_ != "credit" || snap().state.at("debt") != 0) return true;
@@ -141,24 +125,5 @@ bool App::bank_event(Rml::Event &event) {
event.StopImmediatePropagation();
return true;
}
if (bank_view_ == "entrance" && (type == "mousemove" || type == "focus")) {
const auto hint = [&](Rml::Element *from) {
for (auto *node = from; node && node != doc_; node = node->GetParentNode())
if (node->HasAttribute("data-bank-hint")) return node->GetAttribute<Rml::String>("data-bank-hint", "");
return Rml::String();
};
auto text = hint(target);
// RmlUI dispatches focus to the whole new ancestor chain before updating
// Context's focus pointer. Ancestor notifications must not erase a hint
// just supplied by the actual hotspot. The close button resets it.
if (type == "focus" && text.empty() && target->GetId() != "window-close") return false;
if (type == "mousemove" && text.empty()) text = hint(context_->GetFocusElement());
if (bank_hint_ != text) {
bank_hint_ = text;
if (auto *label = element("bank-interaction-hint"))
label->SetInnerRML("<span>" + esc(text.empty() ? "Ein Element in der Bankhalle auswählen." : text) + "</span>");
dirty_ = true;
}
}
return false;
}
+144 -218
View File
@@ -1,4 +1,16 @@
// SPDX-License-Identifier: GPL-3.0-only
// Who plays this career as a human: the page "Spieler" exists only where there is more than one.
Json App::bank_players() const {
try {
if (engine_mode_) return engine_manager_value_.is_object() && engine_manager_value_.contains("people") ? engine_career_context().at("active_managers") : Json::array();
if (source_ && world_) return demo_career_context(snap().state, *snap().world).at("active_managers");
} catch (const std::exception &) {
}
return Json::array();
}
// Finanzen > Bank, Immobilien, Aktien, Sparbuch, Spieler: five pages of one menu. `bank_view_`
// says which: "credit" (the bank with what the club owns and its loan), "properties", "stocks",
// "savings" or "players".
std::string App::render_bank() {
const auto projected = engine_mode_ ? engine_bank_projection(engine_data_) : Json();
const auto snapshot = engine_mode_ ? Snapshot{0, world_, projected.at("state")} : snap();
@@ -7,59 +19,18 @@ std::string App::render_bank() {
const auto bank_money = [&](int64_t value) { return engine_mode_ ? money(value, {{"code", "EUR"}, {"minor_units", 2}}) : cash(value); };
const int property_count = int(assets.at("properties").size()), stock_count = int(assets.at("stocks").size());
if (!summary.value("ok", false)) return {};
if (bank_view_ != "properties" && bank_view_ != "stocks" && bank_view_ != "savings" && bank_view_ != "players") bank_view_ = "credit";
if (bank_view_ == "players" && bank_players().size() < 2) bank_view_ = "credit";
const auto &finance = snapshot.state.at("finance");
bank_property_ = std::clamp(bank_property_, 0, property_count - 1);
bank_stock_ = std::clamp(bank_stock_, 0, stock_count - 1);
bank_owned_ = std::clamp(bank_owned_, 0, property_count - 1);
if (finance.at("properties")[size_t(bank_owned_)] == 0)
for (int i = 0; i < property_count; ++i)
if (finance.at("properties")[size_t(i)] != 0) { bank_owned_ = i; break; }
const auto actions = [&](const char *left, const char *lk, const char *right, const char *rk) {
return "<nav class=\"bank-actions\">" +
btn("bank-calc", left, "bank-control", "id=\"bank-" + std::string(lk) + "\" data-kind=\"" + lk + "\"") +
btn("bank-calc", right, "bank-control", "id=\"bank-" + std::string(rk) + "\" data-kind=\"" + rk + "\"") + "</nav>";
bank_owned_ = bank_property_; // the board has one chosen property: it is bought and sold
const auto calc = [&](const char *label, const char *kind, const std::string &css, bool on = true) {
return pg_button("bank-calc", label, css, "id=\"bank-" + std::string(kind) + "\" data-kind=\"" + kind + "\"" + (on ? "" : " disabled=\"disabled\""));
};
const auto kv = [](const std::string &key, const std::string &value, const std::string &css = std::string()) {
return "<div class=\"pg-kv\"><span>" + key + "</span><strong" + (css.empty() ? std::string() : " class=\"" + css + "\"") + ">" + value + "</strong></div>";
};
// A data set may carry the newer hall picture or only the first one; each has its own
// places for the five services.
const bool newer_hall = !renderer_.image("art.bank-hall-v2.png", false, 3000).token.empty();
std::string out = "<div class=\"bank-page\"><div class=\"bank-scene\">" +
img(newer_hall ? "art.bank-hall-v2.png" : "art.bank-hall-v1.png", 2608, 1466.016746, false, false, 3000);
if (bank_view_ == "entrance") {
struct Service { const char *id, *label, *hint; double x, y, w, h; };
const std::array<Service, 5> services = newer_hall ? std::array<Service, 5>{{
{"properties", "Immobilien", "Immobilien – Gebäude ansehen, kaufen oder verkaufen.", 14, 23, 23, 43},
{"stocks", "Aktien", "Aktien – Kurse und Bestände ansehen, Aktien kaufen oder verkaufen.", 49, 4, 45, 26},
{"overview", "Finanzübersicht", "Finanzübersicht – Konto, Sparbuch, Immobilien, Aktien und Kredit im Überblick.", 44, 48, 14, 17},
{"savings", "Sparbuch", "Sparbuch – Guthaben ansehen, Geld einzahlen oder abheben.", 78, 55, 12, 11},
{"credit", "Kredit", "Kredit – Laufzeit wählen, einen Kredit aufnehmen oder tilgen.", 81, 32, 15, 22}}}
: std::array<Service, 5>{{
{"properties", "Immobilien", "Immobilien – Gebäude ansehen, kaufen oder verkaufen.", .5, 18.5, 17.5, 43.5},
{"stocks", "Aktien", "Aktien – Kurse und Bestände ansehen, Aktien kaufen oder verkaufen.", 30, 30, 13.5, 19.5},
{"overview", "Finanzübersicht", "Finanzübersicht – Konto, Sparbuch, Immobilien, Aktien und Kredit im Überblick.", 30.5, 49.5, 13, 14.5},
{"savings", "Sparbuch", "Sparbuch – Guthaben ansehen, Geld einzahlen oder abheben.", 85, 60, 6.5, 7.5},
{"credit", "Kredit", "Kredit – Laufzeit wählen, einen Kredit aufnehmen oder tilgen.", 85.3, 31.5, 13.7, 27.5}}};
out += "<div class=\"bank-hotspots\">";
for (const auto &s : services)
out += btn("bank-view", std::string("<span class=\"bank-tag\">") + s.label + "</span>", "bank-hotspot", "id=\"bank-view-" + std::string(s.id) +
"\" data-view=\"" + s.id + "\" data-bank-hint=\"" + esc(s.hint) + "\" aria-label=\"" + s.label +
"\" style=\"left:" + scalar(s.x) + "%;top:" + scalar(s.y) + "%;width:" + scalar(s.w) + "%;height:" + scalar(s.h) + "%;\"");
out += "</div>";
}
out += "</div>";
if (bank_view_ == "entrance")
return out + "<p id=\"bank-interaction-hint\" role=\"status\" aria-live=\"polite\"><span>" +
esc(bank_hint_.empty() ? "Ein Element in der Bankhalle auswählen." : bank_hint_) + "</span></p></div>";
// Every service of the bank shares one head: the house's name, the service, and tabs that
// lead to the other services without a walk back through the hall.
const std::array<std::pair<const char *, const char *>, 5> bank_tabs{{{"overview", "Übersicht"}, {"stocks", "Aktien"}, {"properties", "Immobilien"}, {"savings", "Sparbuch"}, {"credit", "Kredit"}}};
std::string service;
for (const auto &[id, label] : bank_tabs) if (bank_view_ == id) service = label;
out += "<section class=\"bank-overlay " + esc(bank_view_) + "-overlay\"><header class=\"bank-head\"><div class=\"bank-brand\"><strong>Waldpark Bank</strong><span>" +
service + "</span></div><nav class=\"bank-tabs\" aria-label=\"Bankdienste\">";
for (const auto &[id, label] : bank_tabs)
out += btn("bank-view", label, std::string("bank-tab") + (bank_view_ == id ? " selected" : ""),
"id=\"bank-tab-" + std::string(id) + "\" data-view=\"" + id + "\" aria-pressed=\"" + (bank_view_ == id ? "true" : "false") + "\"");
out += "</nav></header>";
const auto one = [](double value) {
std::ostringstream text;
text << std::fixed << std::setprecision(1) << value;
@@ -72,9 +43,9 @@ std::string App::render_bank() {
in_property = summary.at("properties").get<int64_t>(), in_stock = summary.at("stocks").get<int64_t>();
const int64_t wealth = std::max<int64_t>(0, in_cash) + in_deposit + in_property + in_stock;
const auto share = [&](int64_t part) { return wealth > 0 ? one(std::max<int64_t>(0, part) * 100.0 / wealth) + " %" : std::string("—"); };
const std::string ink = theme_ == "silver" ? "#233443" : "#e8eef2", faint = theme_ == "silver" ? "#4a433430" : "#dfeaf530",
up = theme_ == "silver" ? "#3f7d63" : "#8fd3ad", down = theme_ == "silver" ? "#a23f45" : "#f0a6a7",
gold = theme_ == "silver" ? "#9a7a3a" : "#d9bd7c", line = theme_ == "silver" ? "#25617a" : "#9ac7d8";
const bool light = theme_ == "silver";
const std::string ink = light ? "#2e2b25" : "#f0ece2", faint = light ? "#3a332b24" : "#f0ece224", up = light ? "#56633f" : "#a3ba7c", down = light ? "#a8452f" : "#f0a08a",
gold = "#d08a1e", line = light ? "#8c491a" : "#e0a25f";
// an engine name arrives in capitals
const auto calm_name = [](std::string name) {
bool first = true;
@@ -104,54 +75,65 @@ std::string App::render_bank() {
}
return history;
};
// a picture with a line of writing on its lower edge: every page of the bank begins with one
const auto banner = [&](const std::string &art, double w, double h, const std::string &kicker, const std::string &value, const std::string &detail) {
return "<div class=\"bk-banner\" style=\"width:" + pg(w) + ";height:" + pg(h) + ";\"><span class=\"bk-banner-art\">" + img(art, w * 2.25, h * 2.25, false, true, 1800) + "</span><div class=\"bk-banner-over\"><span class=\"ad-tile-k\">" + esc(pg_upper(kicker)) +
"</span><strong>" + esc(value) + "</strong>" + (detail.empty() ? std::string() : "<span class=\"bk-banner-d\">" + esc(detail) + "</span>") + "</div></div>";
};
std::string out = "<section class=\"pg-page\" id=\"bank-page\">";
if (bank_view_ == "savings") {
out += "<div class=\"passbook\">" + img("art.bank-passbook-v1.png", 2100, 1293.109375, false, false, 2400) +
"<div class=\"passbook-left\"><h2>Waldpark Bank</h2><h3>Sparbuch</h3><p class=\"passbook-note-one\">Bitte beachten Sie:</p>"
"<p class=\"passbook-note-two\">" + std::string(engine_mode_ ? "Einzahlungen und Abhebungen werden nach Bestätigung im Spielstand verbucht." : "Einzahlungen und Abhebungen werden hier als fiktive Vorschau verbucht.") + "</p>"
"<p class=\"passbook-note-three\">" + (engine_mode_ ? "Anteil am Vermögen: " + share(in_deposit) : std::string("2,5 % Beispielzins")) + "</p></div><div class=\"passbook-right\"><h2>Guthaben</h2><output>" +
esc(bank_money(snapshot.state.at("deposit").get<int64_t>())) + "</output><p class=\"passbook-cash\">Auf dem Konto: " + esc(bank_money(in_cash)) + "</p></div></div>" + actions("Einzahlen", "deposit", "Abheben", "withdraw");
page_title_ = "Sparbuch";
page_hint_ = "Waldpark Bank";
const auto deposit = snapshot.state.at("deposit").get<int64_t>();
out += "<div class=\"pg-row pg-grow\" style=\"align-items:stretch;\">" + banner("bank.scene.savings", 640, 648, "Guthaben auf dem Sparbuch", bank_money(deposit), share(in_deposit) + " des Vermögens") +
"<div class=\"pg-col pg-grow\"><div class=\"bk-passbook\"><span class=\"bk-passbook-head\">Waldpark Bank · Sparbuch</span>";
// the page of the passbook: what is written in it today
for (const auto &[label, value] : std::array<std::pair<const char *, std::string>, 4>{{{"Guthaben", bank_money(deposit)}, {"Auf dem Konto", bank_money(in_cash)}, {"Vermögen gesamt", bank_money(wealth)}, {"Anteil Sparbuch", share(in_deposit)}}})
out += "<div class=\"bk-passbook-line\"><span>" + std::string(label) + "</span><strong>" + esc(value) + "</strong></div>";
out += "<span class=\"bk-passbook-note\">" + std::string(deposit > 0 ? "Liegt sicher. Rest bleibt auf dem Konto." : in_cash > 0 ? "Noch nichts zurückgelegt!" : "Erst muss Geld aufs Konto.") + "</span></div><span class=\"pg-sp\"></span><span class=\"pg-mut\" style=\"display:block;\">" +
std::string(engine_mode_ ? "Einzahlungen und Abhebungen werden nach Bestätigung im Spielstand verbucht." : "Einzahlungen und Abhebungen werden hier als fiktive Vorschau verbucht.") + "</span><div class=\"pg-row\" style=\"" + pg_css("gap:8px;") + "\">" +
calc("Einzahlen", "deposit", "primary block") + calc("Abheben", "withdraw", "block") + "</div></div></div>";
} else if (bank_view_ == "properties") {
const auto &owned = assets.at("properties")[size_t(bank_owned_)], &offer = assets.at("properties")[size_t(bank_property_)];
const auto count = finance.at("properties")[size_t(bank_owned_)].get<int64_t>();
// the board of an estate agent: every house a note pinned to it; what the club owns is stamped
static constexpr std::array<const char *, 4> coming{"Stadthaus", "Penthouse", "Siedlungshaus", "Altbau-Reihenhaus"};
int64_t houses = 0;
for (const auto &held : finance.at("properties")) houses += held.get<int64_t>();
const auto fact = [](const std::string &label, const std::string &value) { return "<div class=\"bank-fact\"><span>" + label + "</span><strong>" + value + "</strong></div>"; };
out += "<div class=\"property-card owned-property\"><h3>Dein Bestand</h3>" +
btn("property-owned-next", count ? img(engine_mode_ ? owned.at("image").get<std::string>() : "bank.property." + std::to_string(bank_owned_), 1150, 653.5, false, false, 1400)
: "<span class=\"property-empty\"><span>Noch keine Immobilie im Bestand</span></span>", "property-picture", "id=\"property-owned-next\" aria-label=\"Nächste eigene Immobilie\" " + std::string(count ? "" : "disabled")) +
(count ? "<h4>" + esc(calm_name(owned.at("name").get<std::string>())) + "</h4>" + fact("Im Bestand", number(count) + " Stück") +
fact("Wert heute", esc(bank_money(count * owned.at("price").get<int64_t>())))
: "<h4>Kein Bestand</h4>" + fact("Immobilienwert", esc(bank_money(in_property))) + fact("Anteil am Vermögen", share(in_property))) +
"<div class=\"property-prices\"><h5>Preise im Vergleich · " + number(houses) + " im Bestand</h5>";
{
int64_t dearest = 1;
for (const auto &item : assets.at("properties")) dearest = std::max(dearest, item.at("price").get<int64_t>());
for (int i = 0; i < property_count; ++i) {
const auto &item = assets.at("properties")[size_t(i)];
out += "<div class=\"property-price" + std::string(i == bank_property_ ? " chosen" : "") + "\"><span class=\"name\" title=\"" + esc(item.at("name").get<std::string>()) + "\">" + esc(calm_name(item.at("name").get<std::string>())) +
"</span><div class=\"bank-part-track\"><div style=\"width:" + scalar(item.at("price").get<int64_t>() * 100.0 / dearest) + "%;\"></div></div><span class=\"sum\">" +
esc(bank_money(item.at("price").get<int64_t>())) + "</span></div>";
}
page_title_ = "Immobilien";
page_hint_ = number(houses) + " im Bestand · Wert " + bank_money(in_property);
out += "<div class=\"bk-board\">";
for (int i = 0; i < 10; ++i) {
const bool real = i < property_count;
const auto count = real ? finance.at("properties")[size_t(i)].get<int64_t>() : 0;
const auto name = real ? calm_name(assets.at("properties")[size_t(i)].at("name").get<std::string>()) : std::string(coming[size_t(std::min(3, i - property_count))]);
const auto price = real ? bank_money(assets.at("properties")[size_t(i)].at("price").get<int64_t>()) : std::string("Bald im Angebot");
const bool chosen = real && i == bank_property_;
out += btn(real ? "bank-property" : "bank-soon", "<span class=\"bk-pin\"></span><span class=\"bk-home-art\">" + img("bank.home." + std::to_string(i), 492, 382, false, true, 800) +
(count > 0 ? "<span class=\"bk-stamp\"><span>EIGENTÜMER</span>" + (count > 1 ? "<small>" + number(count) + " Stück</small>" : std::string()) + "</span>" : std::string()) + "</span><strong>" + esc(name) + "</strong><span class=\"bk-home-price\">" +
esc(price) + "</span>", std::string("bk-home") + (chosen ? " sel" : "") + (i % 2 ? " odd" : ""),
"id=\"bank-property-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\" aria-pressed=\"" + (chosen ? "true" : "false") + "\" aria-label=\"" + esc(name + ", " + price + (count > 0 ? ", " + number(count) + " im Bestand" : "")) + "\" " +
(real ? "" : "disabled=\"disabled\""));
}
out += "</div></div>";
out += "<div class=\"property-card offered-property\"><h3>Kaufangebot " + std::to_string(bank_property_ + 1) + " von " + std::to_string(property_count) + "</h3>" +
btn("property-next", img(engine_mode_ ? offer.at("image").get<std::string>() : "bank.property." + std::to_string(bank_property_), 1150, 653.5, false, false, 1400),
"property-picture", "id=\"property-next\" aria-label=\"Nächstes Immobilienangebot\"") +
"<h4>" + esc(calm_name(offer.at("name").get<std::string>())) + "</h4>" + fact("Kaufpreis", esc(bank_money(offer.at("price").get<int64_t>()))) +
fact("Anteil am Konto", in_cash > 0 ? one(offer.at("price").get<int64_t>() * 100.0 / in_cash) + " %" : std::string("—")) +
(offer.contains("maxToBuy") ? fact("Bezahlbar", number(offer.at("maxToBuy").get<int64_t>()) + " Stück") : std::string()) +
"<p class=\"property-hint\">Das Bild anklicken, um das nächste Angebot zu sehen.</p></div>" +
actions("Kaufen", "property-buy", "Verkaufen", "property-sell");
const auto &offer = assets.at("properties")[size_t(bank_property_)];
const auto held = finance.at("properties")[size_t(bank_property_)].get<int64_t>();
const auto price = offer.at("price").get<int64_t>();
out += "</div><div class=\"pg-row pg-grow\" style=\"align-items:stretch;\"><div class=\"pg-panel pg-row pg-grow\" style=\"" + pg_css("gap:22px;padding:10px 16px;") + "\"><div style=\"width:" + pg(300) + ";\">" + pg_kicker("Ausgewählt") +
"<h3 class=\"pg-h\" style=\"font-size:" + pg(24) + ";line-height:" + pg(30) + ";\">" + esc(calm_name(offer.at("name").get<std::string>())) + "</h3><strong class=\"pg-big\">" + esc(bank_money(price)) + "</strong></div><div class=\"pg-grow\">" +
kv("Im Bestand", number(held) + " Stück") + kv("Wert heute", esc(bank_money(held * price))) + kv("Anteil am Konto", in_cash > 0 ? one(price * 100.0 / in_cash) + " %" : std::string("—")) +
(offer.contains("maxToBuy") ? kv("Bezahlbar", number(offer.at("maxToBuy").get<int64_t>()) + " Stück") : kv("Auf dem Konto", esc(bank_money(in_cash)))) + "</div></div><div class=\"pg-col\" style=\"width:" + pg(300) + ";flex:none;justify-content:center;" + pg_css("gap:8px;") + "\">" +
calc("Kaufen", "property-buy", "primary bk-wide") + calc("Verkaufen", "property-sell", "bk-wide", held > 0) + "<span class=\"pg-mut\" style=\"display:block;text-align:center;font-size:" + pg(12.5) + ";\">Ein Haus am Brett anklicken, dann kaufen oder verkaufen.</span></div></div>";
} else if (bank_view_ == "stocks") {
const auto move = [&](double from, double to) {
if (from <= 0) return std::string("<span class=\"stock-move flat\">—</span>");
if (from <= 0) return std::string("<span class=\"bk-move flat\">—</span>");
const double change = (to - from) * 100.0 / from;
return std::string("<span class=\"stock-move ") + (change > 0.05 ? "up" : change < -0.05 ? "down" : "flat") + "\">" +
(change > 0.05 ? "▲ +" : change < -0.05 ? "▼ −" : "") + one(std::abs(change)) + " %</span>";
return std::string("<span class=\"bk-move ") + (change > 0.05 ? "up" : change < -0.05 ? "down" : "flat") + "\">" + (change > 0.05 ? "▲ +" : change < -0.05 ? "▼ −" : "") + one(std::abs(change)) + " %</span>";
};
out += "<div class=\"stock-table\"><div class=\"stock-row stock-head\">";
for (const auto *label : {"Wert", "30 Tage", "Kurs", "zum Vortag", "Bestand"}) out += "<div><span>" + std::string(label) + "</span></div>";
out += "</div>";
int held_papers = 0;
for (const auto &held : finance.at("stocks")) if (held.get<int64_t>() > 0) ++held_papers;
page_title_ = "Aktien";
page_hint_ = "Depotwert " + bank_money(in_stock);
out += "<div class=\"pg-row pg-grow\" style=\"align-items:stretch;\"><div class=\"pg-col pg-grow\" style=\"" + pg_css("gap:10px;") + "\">" + banner("bank.scene.stocks", 700, 96, "Depot", bank_money(in_stock), std::to_string(held_papers) + " von " + std::to_string(stock_count) + " Papieren im Bestand") +
"<div class=\"pg-panel pg-col pg-grow\" style=\"" + pg_css("gap:0px;padding:4px 14px;") + "\"><div class=\"bk-row head\"><span class=\"bk-name\">WERT</span><span class=\"bk-spark\">30 TAGE</span><span class=\"bk-num\">KURS</span><span class=\"bk-num wide\">ZUM VORTAG</span><span class=\"bk-num\">BESTAND</span></div>";
for (int i = 0; i < stock_count; ++i) {
const auto &s = assets.at("stocks")[size_t(i)];
const auto history = course(i);
@@ -163,27 +145,27 @@ std::string App::render_bank() {
spark += "<polyline points=\"" + points + "\" fill=\"none\" stroke=\"" + (history.back() >= history.front() ? up : down) + "\" stroke-width=\"4\" stroke-linejoin=\"round\" stroke-linecap=\"round\"/>";
}
spark += "</svg>";
out += "<div class=\"stock-row" + std::string(i == bank_stock_ ? " chosen" : "") + "\"><div>" + btn("bank-stock", esc(s.at("name").get<std::string>()), "stock-name",
"id=\"bank-stock-" + std::to_string(i) + "\" data-bank-stock=\"" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) +
"\" aria-pressed=\"" + (i == bank_stock_ ? "true" : "false") + "\"") + "</div><div>" + picture(renderer_.diagram("bank-spark-" + std::to_string(i), spark, 480), 240, 60) +
"</div><div><span>" + number(s.at("price").get<int64_t>() / factor) + "</span></div><div>" + move(s.at("previous").get<double>(), s.at("price").get<double>()) +
"</div><div><span>" + number(finance.at("stocks")[size_t(i)].get<int64_t>()) + "</span></div></div>";
const bool chosen = i == bank_stock_;
out += btn("bank-stock", "<span class=\"bk-name\">" + esc(s.at("name").get<std::string>()) + "</span><span class=\"bk-spark\">" + picture(renderer_.diagram("bank-spark-" + std::to_string(i) + "-" + theme_, spark, 480), 216, 54) + "</span><span class=\"bk-num\">" +
number(s.at("price").get<int64_t>() / factor) + "</span><span class=\"bk-num wide\">" + move(s.at("previous").get<double>(), s.at("price").get<double>()) + "</span><span class=\"bk-num\">" + number(finance.at("stocks")[size_t(i)].get<int64_t>()) + "</span>",
std::string("bk-row") + (chosen ? " sel" : ""), "id=\"bank-stock-" + std::to_string(i) + "\" data-bank-stock=\"" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\" aria-pressed=\"" + (chosen ? "true" : "false") + "\"");
}
out += "</div>";
out += "</div></div>";
// the chosen stock: its course with a five-day average, its range, and what the numbers say
const auto &chosen = assets.at("stocks")[size_t(bank_stock_)];
const auto history = course(bank_stock_);
const double price = chosen.at("price").get<double>() / factor;
out += "<div class=\"stock-detail\"><h3>" + esc(chosen.at("name").get<std::string>()) + "</h3><div class=\"stock-quote\"><strong>" + number(chosen.at("price").get<int64_t>() / factor) +
"</strong>" + move(chosen.at("previous").get<double>(), chosen.at("price").get<double>()) + "</div>";
const auto held = finance.at("stocks")[size_t(bank_stock_)].get<int64_t>();
out += "<div class=\"pg-col\" style=\"width:" + pg(520) + ";flex:none;" + pg_css("gap:10px;") + "\"><div class=\"pg-panel pg-col pg-grow\" style=\"" + pg_css("gap:8px;padding:12px 16px;") + "\"><div class=\"pg-row\" style=\"justify-content:space-between;align-items:flex-end;\"><div>" +
pg_kicker("Ausgewähltes Papier") + "<h3 class=\"pg-h\" style=\"font-size:" + pg(24) + ";line-height:" + pg(30) + ";\">" + esc(chosen.at("name").get<std::string>()) + "</h3></div><div class=\"pg-row\" style=\"" + pg_css("gap:10px;") + "\"><strong class=\"pg-big\">" +
number(chosen.at("price").get<int64_t>() / factor) + "</strong>" + move(chosen.at("previous").get<double>(), chosen.at("price").get<double>()) + "</div></div>";
if (history.size() > 1) {
const double lo = *std::min_element(history.begin(), history.end()), hi = *std::max_element(history.begin(), history.end());
const double floor = lo * .97, ceiling = std::max(floor + 1., hi * 1.03);
const auto px = [&](size_t at) { return 30 + at * 860.0 / (history.size() - 1); };
const auto py = [&](double value) { return 470 - (value - floor) / (ceiling - floor) * 430; };
std::string svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 920 500\"><defs><linearGradient id=\"under\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"" +
line + "\" stop-opacity=\".32\"/><stop offset=\"1\" stop-color=\"" + line + "\" stop-opacity=\".02\"/></linearGradient></defs>";
for (int row = 0; row < 5; ++row) svg += "<line x1=\"30\" y1=\"" + scalar(40 + row * 107.5) + "\" x2=\"890\" y2=\"" + scalar(40 + row * 107.5) + "\" stroke=\"" + faint + "\" stroke-width=\"2\"/>";
const auto py = [&](double value) { return 450 - (value - floor) / (ceiling - floor) * 420; };
std::string svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 920 470\"><defs><linearGradient id=\"under\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"" + line + "\" stop-opacity=\".3\"/><stop offset=\"1\" stop-color=\"" + line +
"\" stop-opacity=\".02\"/></linearGradient></defs>";
for (int row = 0; row < 5; ++row) svg += "<line x1=\"30\" y1=\"" + scalar(30 + row * 105) + "\" x2=\"890\" y2=\"" + scalar(30 + row * 105) + "\" stroke=\"" + faint + "\" stroke-width=\"2\"/>";
std::string points, average;
size_t high_at = 0, low_at = 0;
for (size_t at = 0; at < history.size(); ++at) {
@@ -196,11 +178,9 @@ std::string App::render_bank() {
average += scalar(px(at)) + "," + scalar(py(sum / 5)) + " ";
}
}
svg += "<polygon points=\"30,470 " + points + "890,470\" fill=\"url(#under)\"/><polyline points=\"" + average + "\" fill=\"none\" stroke=\"" + gold +
"\" stroke-width=\"4\" stroke-dasharray=\"12 9\"/><polyline points=\"" + points + "\" fill=\"none\" stroke=\"" + line +
"\" stroke-width=\"6\" stroke-linejoin=\"round\" stroke-linecap=\"round\"/><circle cx=\"" + scalar(px(high_at)) + "\" cy=\"" + scalar(py(history[high_at])) +
"\" r=\"9\" fill=\"" + up + "\"/><circle cx=\"" + scalar(px(low_at)) + "\" cy=\"" + scalar(py(history[low_at])) + "\" r=\"9\" fill=\"" + down +
"\"/><circle cx=\"" + scalar(px(history.size() - 1)) + "\" cy=\"" + scalar(py(history.back())) + "\" r=\"10\" fill=\"" + line + "\" stroke=\"" + ink + "\" stroke-width=\"3\"/></svg>";
svg += "<polygon points=\"30,450 " + points + "890,450\" fill=\"url(#under)\"/><polyline points=\"" + average + "\" fill=\"none\" stroke=\"" + gold + "\" stroke-width=\"4\" stroke-dasharray=\"12 9\"/><polyline points=\"" + points + "\" fill=\"none\" stroke=\"" + line +
"\" stroke-width=\"6\" stroke-linejoin=\"round\" stroke-linecap=\"round\"/><circle cx=\"" + scalar(px(high_at)) + "\" cy=\"" + scalar(py(history[high_at])) + "\" r=\"9\" fill=\"" + up + "\"/><circle cx=\"" + scalar(px(low_at)) + "\" cy=\"" + scalar(py(history[low_at])) +
"\" r=\"9\" fill=\"" + down + "\"/><circle cx=\"" + scalar(px(history.size() - 1)) + "\" cy=\"" + scalar(py(history.back())) + "\" r=\"10\" fill=\"" + line + "\" stroke=\"" + ink + "\" stroke-width=\"3\"/></svg>";
double mean = 0, spread = 0;
for (const double value : history) mean += value;
mean /= double(history.size());
@@ -208,78 +188,37 @@ std::string App::render_bank() {
spread = mean > 0 ? std::sqrt(spread / double(history.size())) * 100.0 / mean : 0;
const double trend = history.front() > 0 ? (history.back() - history.front()) * 100.0 / history.front() : 0;
const double below = hi > 0 ? (hi - history.back()) * 100.0 / hi : 0;
const auto held = finance.at("stocks")[size_t(bank_stock_)].get<int64_t>();
const auto tile = [](const std::string &label, const std::string &value, const char *tone = "") {
return "<div class=\"stock-tile " + std::string(tone) + "\"><strong>" + value + "</strong><span>" + label + "</span></div>";
const auto tile = [](const std::string &label, const std::string &value, const std::string &tone = std::string()) {
return "<div class=\"bk-tile\"><strong class=\"" + tone + "\">" + value + "</strong><span>" + label + "</span></div>";
};
out += "<div class=\"stock-chart\" role=\"img\" aria-label=\"" + std::string(engine_mode_ ? "Kursverlauf aus dem Spielstand für " : "Erfundener Kursverlauf für ") +
esc(chosen.at("name").get<std::string>()) + "\">" + picture(renderer_.diagram("bank-stock", svg, 1840), 920, 500) + "</div>"
"<div class=\"stock-legend\"><span class=\"key course\"></span><span>Kurs</span><span class=\"key average\"></span><span>Fünf-Tage-Schnitt</span><span class=\"key high\"></span><span>Hoch</span><span class=\"key low\"></span><span>Tief</span></div>"
"<div class=\"stock-tiles\">" +
tile("Hoch", number(int64_t(std::llround(hi)))) + tile("Tief", number(int64_t(std::llround(lo)))) +
tile(std::to_string(history.size()) + " Tage", (trend > 0 ? "+" : trend < 0 ? "−" : "") + one(std::abs(trend)) + " %", trend > 0.05 ? "up" : trend < -0.05 ? "down" : "") +
tile("Schwankung", one(spread) + " %") + tile("Depotwert", esc(bank_money(held * chosen.at("price").get<int64_t>()))) +
(chosen.contains("maxToBuy") ? tile("Kaufbar", number(chosen.at("maxToBuy").get<int64_t>())) : tile("Bestand", number(held))) + "</div>"
"<div class=\"bank-insight\"><h4>Analyse</h4><p>" +
std::string(trend > 5 ? "Aufwärtstrend: " : trend < -5 ? "Abwärtstrend: " : "Seitwärtsbewegung: ") + "über " + std::to_string(history.size()) + " Tage " +
(trend > 0 ? "+" : trend < 0 ? "−" : "") + one(std::abs(trend)) + " %. " +
(below < 0.5 ? "Der Kurs steht am Hoch dieses Zeitraums." : "Der Kurs liegt " + one(below) + " % unter dem Hoch dieses Zeitraums.") + " " +
(spread > 12 ? "Das Papier schwankt stark." : spread > 5 ? "Das Papier schwankt mäßig." : "Das Papier läuft ruhig.") + "</p></div>";
(void)price;
} else out += "<p class=\"player-card-none\">Für dieses Papier liegt noch kein Kursverlauf vor.</p>";
out += "</div>" + actions("Kaufen", "stock-buy", "Verkaufen", "stock-sell");
} else if (bank_view_ == "credit") {
if (engine_mode_) return out + engine_credit_view() + "</section></div>";
out += "<div class=\"credit-portrait\">" + img("art.bank-adviser-v1.png", 620, 515, false, false, 1000) +
"</div><div class=\"credit-facts\">";
const auto fact = [&](const char *label, const std::string &value, int row) {
constexpr std::array<int, 5> y{0, 83, 166, 273, 356};
return "<div class=\"credit-fact\" style=\"top:" + std::to_string(y[size_t(row)]) + "dp;\"><span>" + label + "</span><strong>" + value + "</strong></div>";
};
out += fact("Restschuld", esc(bank_money(summary.at("debt").get<int64_t>())), 0) + fact("Beispielzins", "8 % pro Jahr", 1);
std::string select = "<select id=\"bank-term\" aria-label=\"Kreditlaufzeit\" " + std::string(summary.at("debt") == 0 ? "" : "disabled") + ">";
for (const auto &term : demo_bank_terms()) select += "<option value=\"" + std::to_string(term.get<int>()) + "\" " +
std::string(term == finance.at("term") ? "selected" : "") + ">" + std::to_string(term.get<int>()) + " Monate</option>";
out += fact("Laufzeit", select + "</select>", 2) + fact("Monatsrate, Beispiel", esc(bank_money(summary.at("monthly_rate").get<int64_t>())), 3) +
fact("Maximaler Kredit", esc(bank_money(5000000 * finance_currency_factor(*world_))), 4) + "</div>";
const int term = finance.at("term");
const auto principal = summary.at("schedule_principal").get<int64_t>();
std::string svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"2240\" height=\"420\" viewBox=\"0 0 2240 420\">"
"<defs><linearGradient id=\"fill\" x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\"><stop offset=\"0\" stop-color=\"" + line + "\" stop-opacity=\".28\"/>"
"<stop offset=\"1\" stop-color=\"" + line + "\" stop-opacity=\".02\"/></linearGradient></defs>";
for (int i = 0; i < 5; ++i) {
const auto y = 30 + i * 77.5;
svg += "<line x1=\"220\" y1=\"" + scalar(y) + "\" x2=\"2180\" y2=\"" + scalar(y) + "\" stroke=\"" + faint + "\" stroke-width=\"2\"/>"
"<text x=\"184\" y=\"" + scalar(y + 9) + "\" text-anchor=\"end\" fill=\"" + ink + "\" font-size=\"28\" font-family=\"Arial, Liberation Sans, sans-serif\">" +
esc(bank_money((principal * (4 - i) + 2) / 4)) + "</text>";
out += "<div class=\"bk-chart\" role=\"img\" aria-label=\"" + std::string(engine_mode_ ? "Kursverlauf aus dem Spielstand für " : "Erfundener Kursverlauf für ") + esc(chosen.at("name").get<std::string>()) + "\">" +
picture(renderer_.diagram("bank-stock-" + theme_, svg, 1840), 1098, 561) + "</div><div class=\"pg-legend\"><span class=\"pg-legend-item\"><span class=\"pg-legend-mark\" style=\"background-color:" + line +
";\"></span><span>Kurs</span></span><span class=\"pg-legend-item\"><span class=\"pg-legend-mark\" style=\"background-color:" + gold + ";\"></span><span>Fünf-Tage-Schnitt</span></span><span class=\"pg-legend-item\"><span class=\"pg-legend-mark\" style=\"background-color:" + up +
";\"></span><span>Hoch</span></span><span class=\"pg-legend-item\"><span class=\"pg-legend-mark\" style=\"background-color:" + down + ";\"></span><span>Tief</span></span></div><div class=\"bk-tiles\">" +
tile("Hoch", number(int64_t(std::llround(hi)))) + tile("Tief", number(int64_t(std::llround(lo)))) + tile(std::to_string(history.size()) + " Tage", (trend > 0 ? "+" : trend < 0 ? "−" : "") + one(std::abs(trend)) + " %", trend > 0.05 ? "ad-plus" : trend < -0.05 ? "ad-minus" : "") +
tile("Schwankung", one(spread) + " %") + tile("Depotwert", esc(bank_money(held * chosen.at("price").get<int64_t>()))) + (chosen.contains("maxToBuy") ? tile("Kaufbar", number(chosen.at("maxToBuy").get<int64_t>())) : tile("Bestand", number(held))) +
"</div><span class=\"pg-mut bk-reading\">" + std::string(trend > 5 ? "Aufwärtstrend: " : trend < -5 ? "Abwärtstrend: " : "Seitwärtsbewegung: ") + "über " + std::to_string(history.size()) + " Tage " + (trend > 0 ? "+" : trend < 0 ? "−" : "") + one(std::abs(trend)) + " %. " +
(below < 0.5 ? "Der Kurs steht am Hoch dieses Zeitraums." : "Der Kurs liegt " + one(below) + " % unter dem Hoch dieses Zeitraums.") + " " + (spread > 12 ? "Das Papier schwankt stark." : spread > 5 ? "Das Papier schwankt mäßig." : "Das Papier läuft ruhig.") + "</span>";
} else out += "<div class=\"pg-empty\"><span>Für dieses Papier liegt noch kein Kursverlauf vor.</span></div>";
out += "</div><div class=\"pg-row\" style=\"" + pg_css("gap:8px;") + "\">" + calc("Kaufen", "stock-buy", "primary block") + calc("Verkaufen", "stock-sell", "block", held > 0) + "</div></div></div>";
} else if (bank_view_ == "players") {
// the other humans of this career; dealings between them are not in the game yet
const auto people = bank_players();
page_title_ = "Spieler";
page_hint_ = std::to_string(people.size()) + " Manager an einem Tisch";
out += "<div class=\"pg-row pg-grow\" style=\"align-items:stretch;\">" + banner("bank.scene.players", 700, 648, "Unter Managern", "Geschäfte mit Mitspielern", "Noch nicht im Spiel") + "<div class=\"pg-col pg-grow\"><div class=\"pg-panel pg-col\" style=\"" + pg_css("gap:6px;") + "\">" +
pg_kicker("Mitspieler");
for (const auto &person : people) {
const auto *club = world_->find("clubs", person.value("club", ""));
out += "<div class=\"fl-manager\">" + (club ? crest(club, 72) : std::string()) + "<div><strong>" + esc(person.value("name", "")) + "</strong><span class=\"pg-mut\">" + esc(club ? world_->name(*club) : std::string()) + "</span></div></div>";
}
const int interval = term <= 12 ? 3 : term <= 24 ? 6 : 12;
std::vector<int> labels;
for (int month = 0; month <= term; month += interval) labels.push_back(month);
if (labels.back() != term) labels.push_back(term);
for (const int month : labels) {
svg += "<text x=\"" + scalar(220 + double(month) / term * 1960) + "\" y=\"394\" text-anchor=\"" +
std::string(month == 0 ? "start" : month == term ? "end" : "middle") + "\" fill=\"" + ink +
"\" font-size=\"28\" font-family=\"Arial, Liberation Sans, sans-serif\">" + (month == 0 ? "Heute" : std::to_string(month) + (month == term ? " Monate" : "")) + "</text>";
}
std::string points;
for (const auto &point : summary.at("schedule")) points += scalar(220 + point.at("month").get<double>() / term * 1960) + "," +
scalar(340 - point.at("remaining").get<double>() / principal * 310) + " ";
svg += "<path d=\"M220 340 L220 30 L2180 340 Z\" fill=\"url(#fill)\"/><polyline points=\"" + points + "\" fill=\"none\" stroke=\"" +
line + "\" stroke-width=\"6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle cx=\"220\" cy=\"30\" r=\"9\" fill=\"" + gold + "\"/>"
"<circle cx=\"2180\" cy=\"340\" r=\"9\" fill=\"" + gold + "\"/></svg>";
out += "<figure class=\"credit-schedule\"><div class=\"credit-schedule-caption\"><h3>Restschuld über die Laufzeit</h3><p class=\"credit-schedule-amount\">" +
esc(bank_money(principal)) + " <span>→</span> " + esc(bank_money(0)) + "</p><div class=\"credit-schedule-context\"><span>" + std::to_string(term) +
" Monate</span><p>" + (summary.at("schedule_example") == true ? "Beispiel · kein laufender Kredit" : "Aktueller Kredit") +
"</p></div></div><div class=\"credit-chart\" role=\"img\" aria-label=\"Restschuld über " + std::to_string(term) +
" Monate bei gleichmäßiger Tilgung ohne Zinsen\">" + picture(renderer_.diagram("bank-credit", svg, 2400), 2432, 420) +
"</div><p class=\"credit-schedule-note\">Gleichmäßige monatliche Tilgung · Restschuld ohne Zinsen</p></figure>"
"<p class=\"bank-note credit-note\">Fiktiver Kredit. Im POC erfolgen keine Zins- oder Ratenbuchungen.</p>" + actions("Aufnehmen", "loan", "Tilgen", "repay");
} else if (bank_view_ == "overview") {
// where the money lies: a ring by share, the four places with their sums, and a reading of it
out += "</div><span class=\"pg-sp\"></span><span class=\"pg-mut\" style=\"display:block;\">Hier sollen Manager einander Geld leihen und Geschäfte abschließen können. Das Spiel kennt solche Geschäfte noch nicht; die Seite zeigt vorerst nur, wer mitspielt.</span></div></div>";
} else {
// the bank: where the money lies, and the loan
page_title_ = "Bank";
page_hint_ = "Waldpark Bank · Vermögen und Kredit";
struct Part { const char *label; int64_t value; const char *colour; };
const std::array<Part, 4> parts{{{"Konto", std::max<int64_t>(0, in_cash), "#2f6f8f"}, {"Sparbuch", in_deposit, "#c9a24a"},
{"Immobilien", in_property, "#6f8a52"}, {"Aktien", in_stock, "#a8574f"}}};
const std::array<Part, 4> parts{{{"Konto", std::max<int64_t>(0, in_cash), "#2b6f8f"}, {"Sparbuch", in_deposit, "#d08a1e"}, {"Immobilien", in_property, "#56633f"}, {"Aktien", in_stock, "#a8452f"}}};
const double around = 2 * 3.14159265358979 * 300;
std::string ring = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 800 800\"><circle cx=\"400\" cy=\"400\" r=\"300\" fill=\"none\" stroke=\"" + faint + "\" stroke-width=\"110\"/>";
double turned = 0;
@@ -287,58 +226,45 @@ std::string App::render_bank() {
if (wealth <= 0 || part.value <= 0) continue;
const double length = around * double(part.value) / double(wealth);
if (part.value == wealth) { ring += "<circle cx=\"400\" cy=\"400\" r=\"300\" fill=\"none\" stroke=\"" + std::string(part.colour) + "\" stroke-width=\"110\"/>"; break; }
ring += "<circle cx=\"400\" cy=\"400\" r=\"300\" fill=\"none\" stroke=\"" + std::string(part.colour) + "\" stroke-width=\"110\" stroke-dasharray=\"" + scalar(length) + " " +
scalar(around - length) + "\" stroke-dashoffset=\"" + scalar(-turned) + "\" transform=\"rotate(-90 400 400)\"/>";
ring += "<circle cx=\"400\" cy=\"400\" r=\"300\" fill=\"none\" stroke=\"" + std::string(part.colour) + "\" stroke-width=\"110\" stroke-dasharray=\"" + scalar(length) + " " + scalar(around - length) + "\" stroke-dashoffset=\"" + scalar(-turned) + "\" transform=\"rotate(-90 400 400)\"/>";
turned += length;
}
ring += "</svg>";
out += "<div class=\"bank-ring\">" + picture(renderer_.diagram("bank-ring", ring, 1600), 860, 860) + "<div class=\"bank-ring-centre\"><span>Vermögen</span><strong>" +
esc(bank_money(wealth)) + "</strong></div></div><div class=\"bank-parts\">";
out += "<div class=\"pg-row pg-grow\" style=\"align-items:stretch;\"><div class=\"pg-col\" style=\"width:" + pg(590) + ";flex:none;" + pg_css("gap:10px;") + "\">" + banner("bank.scene.overview", 590, 196, "Vermögen", bank_money(wealth), "Konto, Sparbuch, Immobilien und Aktien") +
"<div class=\"pg-panel pg-row pg-grow\" style=\"" + pg_css("gap:16px;padding:12px 16px;") + "\"><div class=\"bk-ring\">" + picture(renderer_.diagram("bank-ring-" + theme_, ring, 900), 400, 400) + "</div><div class=\"pg-grow\">";
const Part *largest = &parts[0];
for (const auto &part : parts) {
if (part.value > largest->value) largest = &part;
const double width = wealth > 0 ? std::max<int64_t>(0, part.value) * 100.0 / wealth : 0;
out += "<div class=\"bank-part\"><div class=\"bank-part-line\"><span class=\"chip\" style=\"background-color:" + std::string(part.colour) + ";\"></span><span class=\"label\">" + part.label +
"</span><strong>" + esc(bank_money(std::string(part.label) == "Konto" ? in_cash : part.value)) + "</strong><span class=\"share\">" + share(part.value) +
"</span></div><div class=\"bank-part-track\"><div style=\"width:" + scalar(width) + "%;background-color:" + part.colour + ";\"></div></div></div>";
out += "<div class=\"bk-part\"><div class=\"pg-row\" style=\"" + pg_css("gap:8px;") + "\"><span class=\"bk-chip\" style=\"background-color:" + std::string(part.colour) + ";\"></span><span class=\"pg-grow\">" + part.label + "</span><strong>" +
esc(bank_money(std::string(part.label) == "Konto" ? in_cash : part.value)) + "</strong><span class=\"pg-mut bk-share\">" + share(part.value) + "</span></div><div class=\"pg-bar\"><div style=\"width:" + scalar(width) + "%;background-color:" + part.colour + ";\"></div></div></div>";
}
if (engine_mode_)
out += "<div class=\"bank-part plain\"><div class=\"bank-part-line\"><span class=\"chip none\"></span><span class=\"label\">Kreditlinie</span><strong>" +
esc(bank_money(summary.at("credit_line").get<int64_t>())) + "</strong><span class=\"share\"></span></div></div>";
else
out += "<div class=\"bank-part plain\"><div class=\"bank-part-line\"><span class=\"chip none\"></span><span class=\"label\">Kredit</span><strong>−" +
esc(bank_money(summary.at("debt").get<int64_t>())) + "</strong><span class=\"share\"></span></div></div>"
"<div class=\"bank-part plain\"><div class=\"bank-part-line\"><span class=\"chip none\"></span><span class=\"label\">Saldo</span><strong>" +
esc(bank_money(summary.at("net").get<int64_t>())) + "</strong><span class=\"share\"></span></div></div>";
out += "</div><div class=\"bank-insight overview-insight\"><h4>Analyse</h4><p>";
out += engine_mode_ ? kv("Kreditlinie", esc(bank_money(summary.at("credit_line").get<int64_t>()))) : kv("Kredit", "−" + esc(bank_money(summary.at("debt").get<int64_t>()))) + kv("Saldo", esc(bank_money(summary.at("net").get<int64_t>())));
out += "</div></div><span class=\"pg-mut bk-reading\">";
if (wealth > 0) {
const int64_t invested = in_deposit + in_property + in_stock;
out += "Größter Posten: " + std::string(largest->label) + " mit " + share(largest->value) + " des Vermögens. " +
(invested > 0 ? "Angelegt in Sparbuch, Immobilien und Aktien sind " + share(invested) + "."
: std::string("Bisher ist nichts angelegt: Das ganze Vermögen liegt auf dem Konto."));
(invested > 0 ? "Angelegt in Sparbuch, Immobilien und Aktien sind " + share(invested) + "." : std::string("Bisher ist nichts angelegt: Das ganze Vermögen liegt auf dem Konto."));
} else out += "Es ist kein Vermögen vorhanden.";
out += "</p></div>";
// the market at a glance: every stock's change over its recorded days
std::vector<std::pair<std::string, double>> market;
double widest = 1;
for (int i = 0; i < stock_count; ++i) {
const auto history = course(i);
if (history.size() < 2 || history.front() <= 0) continue;
const double change = (history.back() - history.front()) * 100.0 / history.front();
market.emplace_back(assets.at("stocks")[size_t(i)].at("name").get<std::string>(), change);
widest = std::max(widest, std::abs(change));
out += "</span></div><div class=\"pg-col pg-grow\" style=\"" + pg_css("gap:10px;") + "\">";
if (engine_mode_) out += engine_credit_view();
else {
const int term = finance.at("term");
std::string select = "<select id=\"bank-term\" class=\"bk-select\" aria-label=\"Kreditlaufzeit\" " + std::string(summary.at("debt") == 0 ? "" : "disabled") + ">";
for (const auto &months : demo_bank_terms()) select += "<option value=\"" + std::to_string(months.get<int>()) + "\" " + std::string(months == finance.at("term") ? "selected" : "") + ">" + std::to_string(months.get<int>()) + " Monate</option>";
const auto principal = summary.at("schedule_principal").get<int64_t>();
// the debt over the months: a straight line down to nothing
std::string svg = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1000 300\"><path d=\"M20 20V270H980\" fill=\"none\" stroke=\"" + faint + "\" stroke-width=\"3\"/><path d=\"M20 270L20 30L980 270Z\" fill=\"" + line + "\" fill-opacity=\".14\"/>";
std::string points;
for (const auto &point : summary.at("schedule")) points += scalar(20 + point.at("month").get<double>() / term * 960) + "," + scalar(270 - point.at("remaining").get<double>() / std::max<double>(1, double(principal)) * 240) + " ";
svg += "<polyline points=\"" + points + "\" fill=\"none\" stroke=\"" + line + "\" stroke-width=\"6\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/><circle cx=\"20\" cy=\"30\" r=\"9\" fill=\"" + gold + "\"/><circle cx=\"980\" cy=\"270\" r=\"9\" fill=\"" + gold + "\"/></svg>";
out += "<div class=\"pg-panel pg-col pg-grow\" style=\"" + pg_css("gap:6px;padding:12px 16px;") + "\">" + pg_kicker("Kredit") + kv("Restschuld", esc(bank_money(summary.at("debt").get<int64_t>()))) + kv("Beispielzins", "8 % pro Jahr") +
"<div class=\"pg-kv\"><span>Laufzeit</span>" + select + "</select></div>" + kv("Monatsrate, Beispiel", esc(bank_money(summary.at("monthly_rate").get<int64_t>()))) + kv("Maximaler Kredit", esc(bank_money(5000000 * finance_currency_factor(*world_)))) +
"<div class=\"bk-chart\" role=\"img\" aria-label=\"Restschuld über " + std::to_string(term) + " Monate bei gleichmäßiger Tilgung ohne Zinsen\">" + picture(renderer_.diagram("bank-credit-" + theme_, svg, 1800), 1200, 360) + "</div><span class=\"pg-mut\" style=\"display:block;\">" +
esc(bank_money(principal)) + " über " + std::to_string(term) + " Monate · " + (summary.at("schedule_example") == true ? "Beispiel, kein laufender Kredit" : "aktueller Kredit") + ". Fiktiver Kredit ohne Zins- und Ratenbuchungen.</span></div><div class=\"pg-row\" style=\"" +
pg_css("gap:8px;") + "\">" + calc("Aufnehmen", "loan", "primary block") + calc("Tilgen", "repay", "block") + "</div>";
}
if (!market.empty()) {
out += "<div class=\"bank-market\"><h4>Aktienmarkt · Veränderung über die aufgezeichneten Tage</h4><div class=\"bank-market-bars\">";
for (const auto &[name, change] : market) {
const double height = std::abs(change) / widest * 120;
out += "<div class=\"bank-market-column\"><div class=\"rise\">" + (change > 0 ? "<span>+" + one(change) + " %</span><div class=\"bar up\" style=\"height:" + scalar(height) + "dp;\"></div>" : std::string()) +
"</div><div class=\"fall\">" + (change <= 0 ? "<div class=\"bar down\" style=\"height:" + scalar(height) + "dp;\"></div><span>−" + one(std::abs(change)) + " %</span>" : std::string()) +
"</div><strong>" + esc(name) + "</strong></div>";
}
out += "</div></div>";
}
out += "<p class=\"bank-note overview-note\">" + std::string(engine_mode_ ? "Bestände und Kurse aus dem Spielstand." : "Erfundene Bestände · Änderungen betreffen ausschließlich die Bankvorschau.") + "</p>";
out += "</div></div>";
}
return out + "</section></div>";
return out + "</section>";
}
+4 -1
View File
@@ -705,6 +705,9 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
// the investments are the second page of advertising
const bool investments = route == "investments";
if (investments) route = "advertising";
// ... and the bank has five
const auto bank_page = bank_view_of(route);
if (!bank_page.empty()) route = "bank";
if(source_&&!demo_career_menu_available(snap().state,route)){message(snap().state.at("career").value("ended",false)?"Diese Partie ist beendet. Bitte ein neues Spiel beginnen oder einen Spielstand laden.":"Dieses Vereinsmenü ist für die Nationalmannschaft nicht verfügbar.");return;}
if (route == "kickoff")
return;
@@ -719,7 +722,7 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
message("Diese native Ansicht wird im nächsten Menüpaket übertragen.");
return;
}
if (route == "bank") { bank_view_ = "entrance"; bank_hint_.clear(); }
if (route == "bank") { bank_view_ = bank_page.empty() ? "credit" : bank_page; bank_hint_.clear(); }
if (route == "advertising") { advertising_page_ = investments ? "investments" : "advertising"; advertising_selected_ = -1; advertising_offer_ = 0; }
if (route == "stadium") { if (!stadium_view_.is_object()) stadium_view_ = Json::object(); stadium_view_["view"] = surroundings ? "panorama" : "inside"; stadium_focus_.clear(); }
menu_ = route;
+1 -1
View File
@@ -501,7 +501,7 @@ void App::engine_event(Rml::Event &event) {
else if (action == "engine-open" && id == "friendlies") { menu_ = id; planning_dialog_.clear(); engine_friendly_sync(); refresh(); }
else if (action == "engine-open" && (id == "calendar" || id == "postpone")) { menu_ = id; engine_move_id_.clear(); calendar_month_ = -1; calendar_anim_.clear(); engine_calendar_sync(); refresh(); }
else if (action == "engine-open" && id == "contracts") { menu_ = id; engine_contracts_clear(false); contracts_player_.clear(); engine_contract_scroll_ = 0.f; refresh(); }
else if (action == "engine-open" && id == "bank") { bank_view_ = "entrance"; bank_hint_.clear(); menu_ = "bank"; refresh(); }
else if (action == "engine-open" && !bank_view_of(id).empty()) { bank_view_ = bank_view_of(id); bank_hint_.clear(); menu_ = "bank"; refresh(); }
else if (action == "engine-open" && id == "save") engine_save();
else if (action == "engine-open" && (id == "training" || id == "tactics")) { engine_sports_reset(); menu_ = id; refresh(); }
else if (action == "engine-open" && id == "lineup") { menu_ = "lineup"; lineup_selected_.clear(); lineup_reset_scroll_ = true; refresh(); }
+15 -13
View File
@@ -98,10 +98,10 @@ bool App::engine_bank_action(const std::string &action, Rml::Element *target) {
open_amount(std::move(request)); return true;
}
std::string App::engine_credit_view() {
std::string out = "<div class=\"credit-portrait\">" + img("art.bank-adviser-v1.png", 620, 515, false, false, 1000) + "</div>";
std::string out;
Json data;
try { data = engine_credit_projection(engine_data_, engine_credit_); }
catch (const std::exception &) { return out + "<p class=\"bank-note\">Der Bankkredit ist in diesem Kontext nicht verfügbar.</p>"; }
catch (const std::exception &) { return "<div class=\"pg-panel pg-grow\"><div class=\"pg-empty\"><span>Der Bankkredit ist in diesem Kontext nicht verfügbar.</span></div></div>"; }
// the original's labels arrive in capitals: one capital per word reads calmer
const auto calm = [](std::string text) {
bool first = true;
@@ -116,26 +116,28 @@ std::string App::engine_credit_view() {
}
return text;
};
out += "<div class=\"credit-facts engine-credit\">";
// the loan as the bank states it: every figure a line; what may be changed is a button
out += "<div class=\"pg-panel pg-col pg-grow\" style=\"" + pg_css("gap:4px;padding:12px 16px;") + "\">" + pg_kicker("Kredit");
int64_t total = 0, paid = 0;
for (size_t i = 0; i < 8; ++i) {
const auto &f = data.at("fields")[i]; const auto value = f.at("value").get<int64_t>();
if (i == 1) total = value;
if (i == 5) paid = value;
const auto text = i == 3 || i == 4 ? number(value) + " Monate" : money(value * 100, {{"code", "EUR"}, {"minor_units", 2}});
out += "<div class=\"credit-fact\" style=\"top:" + std::to_string(i * 64) + "dp;\"><span>" + esc(calm(engine_text(f.at("label")))) + "</span><strong>";
if (data.at("saved")[0] == 0 && f.at("editable") == true) out += btn("engine-credit-edit", esc(text), "bank-control", "id=\"engine-credit-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"");
else out += esc(text);
out += "</strong></div>";
out += "<div class=\"pg-kv bk-credit-line\"><span>" + esc(calm(engine_text(f.at("label")))) + "</span>";
if (data.at("saved")[0] == 0 && f.at("editable") == true) out += pg_button("engine-credit-edit", esc(text), "bk-edit", "id=\"engine-credit-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"");
else out += "<strong>" + esc(text) + "</strong>";
out += "</div>";
}
out += "</div><figure class=\"credit-schedule engine-credit\"><div class=\"credit-schedule-caption\"><h3>Kreditvorschau</h3></div><div class=\"stock-tiles credit-tiles\">";
out += "<div class=\"bk-tiles\" style=\"margin-top:" + pg(8) + ";\">";
for (const auto &[label, key] : std::array<std::pair<const char *, const char *>, 3>{{{"Gebühren", "fees"}, {"Erstattung", "refund"}, {"Bereits getilgt", "principalPaid"}}})
out += "<div class=\"stock-tile\"><strong>" + esc(engine_price(data.at(key))) + "</strong><span>" + label + "</span></div>";
out += "<div class=\"bk-tile\"><strong>" + esc(engine_price(data.at(key))) + "</strong><span>" + label + "</span></div>";
// how much of the whole sum is paid back
const double done = total > 0 ? std::clamp(double(paid) * 100.0 / double(total), 0.0, 100.0) : 0;
out += "</div><div class=\"credit-progress\"><div class=\"credit-progress-label\"><span>Zurückgezahlt</span><strong>" + (total > 0 ? std::to_string(int(std::lround(done))) + " %" : std::string("kein Kredit")) +
"</strong></div><div class=\"bank-part-track\"><div style=\"width:" + scalar(done) + "%;\"></div></div></div>";
out += "<p class=\"credit-schedule-note\">" + std::string(data.at("saved")[0] == 0 ? "Die Bank berechnet Laufzeit, Raten und Gebühren. Gebucht wird erst nach deiner Bestätigung." : "Laufender Kredit · Änderungen folgen mit vollständiger Gebührenvorschau.") + "</p></figure>";
out += "<nav class=\"bank-actions\">" + btn("engine-credit-reset", "Zurücksetzen", "bank-control", "id=\"engine-credit-reset\"") + btn("engine-credit-apply", "Verbindlich buchen", "bank-control", "id=\"engine-credit-apply\" " + std::string(engine_credit_edits_.empty() ? "disabled" : "")) + "</nav>";
out += "</div><div class=\"bk-part\"><div class=\"pg-row\" style=\"justify-content:space-between;\"><span>Zurückgezahlt</span><strong>" + (total > 0 ? std::to_string(int(std::lround(done))) + " %" : std::string("kein Kredit")) +
"</strong></div>" + pg_bar(done, "sage") + "</div><span class=\"pg-sp\"></span><span class=\"pg-mut\" style=\"display:block;\">" +
std::string(data.at("saved")[0] == 0 ? "Die Bank berechnet Laufzeit, Raten und Gebühren. Gebucht wird erst nach deiner Bestätigung." : "Laufender Kredit · Änderungen folgen mit vollständiger Gebührenvorschau.") + "</span></div>";
out += "<div class=\"pg-row\" style=\"" + pg_css("gap:8px;") + "\">" + pg_button("engine-credit-reset", "Zurücksetzen", "block", "id=\"engine-credit-reset\"") +
pg_button("engine-credit-apply", "Verbindlich buchen", "primary block", "id=\"engine-credit-apply\" " + std::string(engine_credit_edits_.empty() ? "disabled=\"disabled\"" : "")) + "</div>";
return out;
}
+11 -5
View File
@@ -15,7 +15,7 @@ const std::vector<NotebookSection> &notebook_sections() {
{"team", "Mannschaft", {"lineup", "tactics", "training", "camp", "strengths", "scorers"}},
{"transfers", "Transfers", {"transfer", "contracts"}},
{"club", "Verein", {"stadium", "periphery", "environment", "advertising", "investments"}},
{"finance", "Finanzen", {"balance", "bank", "toto"}},
{"finance", "Finanzen", {"balance", "bank", "properties", "stocks", "savings", "players", "toto"}},
{"fixtures", "Spielplan", {"calendar", "league", "tables", "other", "friendlies", "postpone", "indoor"}},
{"records", "Statistik", {"statistics", "stat-trend", "stat-winners", "stat-records", "stat-players", "achievements", "almanac", "fairplay", "highscore"}},
{"inbox", "Posteingang", {"news"}},
@@ -26,7 +26,7 @@ std::string notebook_page_label(const std::string &route) {
static const std::map<std::string, std::string> labels = {
{"lineup", "Aufstellung"}, {"tactics", "Taktik"}, {"training", "Training"}, {"camp", "Trainingslager"}, {"strengths", "Stärken"},
{"scorers", "Spielerstatistik"}, {"transfer", "Transfermarkt"}, {"contracts", "Verträge"}, {"stadium", "Stadion"}, {"periphery", "Peripherie"}, {"environment", "Umfeld"},
{"advertising", "Werbung"}, {"investments", "Investitionen"}, {"balance", "Bilanz"}, {"bank", "Bank"}, {"toto", "Toto"}, {"calendar", "Kalender"}, {"league", "Ligaspiele"},
{"advertising", "Werbung"}, {"investments", "Investitionen"}, {"balance", "Bilanz"}, {"bank", "Bank"}, {"properties", "Immobilien"}, {"stocks", "Aktien"}, {"savings", "Sparbuch"}, {"players", "Spieler"}, {"toto", "Toto"}, {"calendar", "Kalender"}, {"league", "Ligaspiele"},
{"tables", "Tabellen"}, {"other", "Übrige Spiele"}, {"friendlies", "Testspiele"}, {"postpone", "Verlegen"}, {"indoor", "Halle"},
{"statistics", "Analyse"}, {"stat-trend", "Verlauf"}, {"stat-winners", "Sieger"}, {"stat-records", "Rekorde"}, {"stat-players", "Spieler"}, {"achievements", "Erfolge"}, {"almanac", "Almanach"}, {"fairplay", "Fairplay"}, {"highscore", "Highscore"},
{"news", "Nachrichten"}, {"settings", "Einstellungen"}, {"save", "Speichern"}, {"load", "Laden"}, {"newplayer", "Manager"}};
@@ -197,26 +197,32 @@ std::string App::notebook_shell(const std::function<bool(const std::string &)> &
out += btn("home-do", "<span class=\"nb-sub-face tone-n3\"></span><span class=\"nb-sub-number\">+</span>", "nb-sub add", "id=\"page-home-add\" data-id=\"new\" aria-label=\"Neue Seite\" style=\"transform:translateY(16dp) rotate(1deg);\"");
}
size_t n = 0;
// a marker the book does not show: the pages of the archive in the demo, and the page for
// dealings between managers where only one human plays
const bool alone = bank_players().size() < 2;
const auto hidden = [&](const char *r) { return (!engine_mode_ && std::string_view(r).starts_with("stat-")) || (alone && std::string_view(r) == "players"); };
const auto shown = size_t(std::count_if(section.routes.begin(), section.routes.end(), [&](const char *r) { return !hidden(r); }));
for (const char *r : section.routes) {
if (hidden(r)) continue;
// the statistics are one menu with several pages; the demo has only its first
const bool part = std::string_view(r).starts_with("stat-") || std::string_view(r) == "statistics";
if (!engine_mode_ && std::string_view(r).starts_with("stat-")) continue;
// the ground is one menu with two pages: the stadium and what stands around it
const bool ground = std::string_view(r) == "stadium" || std::string_view(r) == "periphery";
// so is advertising: the sponsors' contracts, and what the club invests itself
const bool commerce = std::string_view(r) == "advertising" || std::string_view(r) == "investments";
const bool here = ground ? menu_ == "stadium" && (stadium_view_.value("view", std::string("inside")) == "panorama") == (std::string_view(r) == "periphery")
: !bank_view_of(r).empty() ? menu_ == "bank" && bank_view_ == bank_view_of(r)
: commerce ? menu_ == "advertising" && (advertising_page_ == "investments") == (std::string_view(r) == "investments")
: part && engine_mode_ ? menu_ == "statistics" && statistics_page_ == r : notebook_menu() == r;
if (here) {
kicker = std::string(section.label) + " · " + std::to_string(n + 1) + " / " + std::to_string(section.routes.size());
kicker = std::string(section.label) + " · " + std::to_string(n + 1) + " / " + std::to_string(shown);
heading = notebook_page_label(r);
}
out += open(r, "<span class=\"nb-sub-face tone-" + std::string(sub_tones[n % sub_tones.size()]) + "\"></span><span class=\"nb-sub-number\">" + std::to_string(n + 1) + "</span><span class=\"nb-sub-label\">" + notebook_page_label(r) + "</span>",
std::string("nb-sub") + (here ? " active" : ""),
"id=\"page-" + std::string(r) + "\" aria-pressed=\"" + (here ? "true" : "false") + "\" style=\"transform:translateY(" + (here ? std::string("-13") : std::to_string(sub_rest[n % sub_rest.size()])) + "dp) rotate(" +
scalar(sub_turns[n % sub_turns.size()]) + "deg);\"",
enabled(part ? "statistics" : ground ? "stadium" : commerce ? "advertising" : r));
enabled(part ? "statistics" : ground ? "stadium" : commerce ? "advertising" : !bank_view_of(r).empty() ? "bank" : r));
++n;
}
}
+1 -1
View File
@@ -6,7 +6,7 @@
// sheet of the old format, shown scaled inside the book.
bool App::page_native() const {
if (scene_ == "managerhub") return true;
static const std::set<std::string> native{"advertising", "camp", "toto", "settings", "save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"};
static const std::set<std::string> native{"bank", "advertising", "camp", "toto", "settings", "save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"};
if (menu_ == "calendar" || menu_ == "postpone" || menu_ == "lineup") return notebook_page() && engine_mode_;
// a national coach arranges friendlies on the older sheet
if (menu_ == "friendlies") return notebook_page() && engine_mode_ && engine_data_.contains("desktop") && engine_data_.at("desktop").at("meta").at("scope").at("role") == "club";
-5
View File
@@ -239,11 +239,6 @@ std::string App::render_menu(const std::string &key) {
else
throw editor::Error("Diese native Ansicht ist noch nicht verfügbar.");
std::string heading = key == "postpone" ? "Spiel verlegen" : title(key);
if (key == "bank" && bank_view_ != "entrance") {
const std::map<std::string, std::string> labels = {{"savings", "Sparbuch"}, {"properties", "Immobilien"},
{"stocks", "Aktien"}, {"credit", "Kredit"}, {"overview", "Finanzübersicht"}};
if (labels.contains(bank_view_)) heading += " · " + labels.at(bank_view_);
}
return "<div class=\"fill menu-layer\" style=\"z-index:100;\">" +
window(heading, body) +
(key == "statistics" ? render_statistics_trophy() : "") + "</div>";
+5 -3
View File
@@ -470,7 +470,9 @@ class App final : public Rml::EventListener {
bool amount_select_all_ = false, amount_caret_end_ = false;
// the offered value is still as it was opened: the first digit key replaces it
bool amount_untouched_ = false;
std::string bank_view_ = "entrance", bank_hint_;
std::string bank_view_ = "credit", bank_hint_; // the page of the bank that is open
Json bank_players() const;
static std::string bank_view_of(const std::string &route);
int bank_property_ = 0, bank_owned_ = 0, bank_stock_ = 11;
bool balance_future_ = false;
// the balance sheet's what-if calculation (finance_simulation.inc)
@@ -702,7 +704,7 @@ class App final : public Rml::EventListener {
if (page) club_mark.clear();
return (page ? "<div class=\"nb-sheet-layer\" style=\"top:" + scalar(notebook_top()) + "dp;\"><div class=\"window nb-sheet" + std::string(page_native() ? " pg-root" : "") + arriving + "\"><div class=\"titlebar\">"
: "<div class=\"sheet-under first" + arriving + "\"></div><div class=\"sheet-under second" + arriving + "\"></div><div class=\"window" + arriving + "\"><div class=\"titlebar\"" + club_rule + ">") +
(close ? btn("close", "<span>×</span>", "close", "id=\"window-close\" aria-label=\"" + std::string(menu_ == "bank" && bank_view_ != "entrance" ? "Zurück zur Bankhalle" : "Fenster schließen") + "\"")
(close ? btn("close", "<span>×</span>", "close", "id=\"window-close\" aria-label=\"" + std::string("Fenster schließen") + "\"")
: "<span style=\"width:76dp;\"></span>") +
"<h1>" + esc(heading) + "</h1>" + club_mark + "</div>" + window_art() + "<div class=\"content\">" +
content + "</div>" + (amount_ ? render_amount() : "") + "</div>" + (page ? "</div>" : "");
@@ -823,7 +825,7 @@ class App final : public Rml::EventListener {
contracts_player_.clear();
contract_draft_ = Json();
contracts_world_.reset();
bank_view_ = "entrance";
bank_view_ = "credit";
bank_hint_.clear();
balance_future_ = false;
balance_sim_ = false;