Skip to content

Commit

Permalink
feat: park value record
Browse files Browse the repository at this point in the history
  • Loading branch information
mrmagic2020 committed Jun 19, 2024
1 parent 36f83fb commit 3e5abf1
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 24 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,24 @@ and this project adheres to [Semantic Versioning].

- Add advanced statistics (BETA; for guest happiness only).

- Add park value record in group Finance.

### Changed

- Reword some UI elements for better clarity.

- Adjusted colour scheme for warning prompts to match game style.
- Adjust colour scheme for warning prompts to match game style.

- Move "Delete all data" button into advanced options.

- "SHIFT+D" shortcut key now opens the Advanced Options menu in title screen.

- Toolbox menu item is replaced with Advanced Options.

- Company value record is now dynamically updated and reflects the highest value achieved within the save file.

- Move park value record to group Finance.

### Removed

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion lib/exporter.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ type PlayerDataType =
| "action_server_chat"

type ParkAndScenarioDataType =
| "park_value"
| "park_size"
| "park_rating"
| "park_rating_ave"
Expand Down Expand Up @@ -106,6 +105,8 @@ type FinanceDataType =
| "total_expenditure"
| "company_value"
| "company_value_record"
| "park_value"
| "park_value_record"

type FinanceBranchDataType =
| "income_player_action"
Expand Down
22 changes: 21 additions & 1 deletion src/data/finance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,24 @@ namespace FinanceData {
}

function updateCompanyValueRecord(): void {
if (interval.isPaused) return
baseData.local.finance.company_value_record.store.set(
scenario.companyValueRecord
Math.max(
baseData.local.finance.company_value_record.store.get(),
park.companyValue
)
)
}

function updateParkValue(): void {
if (interval.isPaused) return
baseData.local.finance.park_value.store.set(park.value)
}

function updateParkValueRecord(): void {
if (interval.isPaused) return
baseData.local.finance.park_value_record.store.set(
Math.max(baseData.local.finance.park_value_record.store.get(), park.value)
)
}

Expand All @@ -84,6 +100,8 @@ namespace FinanceData {
updateExpenditure()
updateCompanyValue()
updateCompanyValueRecord()
updateParkValue()
updateParkValueRecord()
}

/**
Expand All @@ -99,6 +117,8 @@ namespace FinanceData {
tick = 0
updateCompanyValue()
updateCompanyValueRecord()
updateParkValue()
updateParkValueRecord()
}
})

Expand Down
20 changes: 13 additions & 7 deletions src/data/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ const branchData: BranchData = {
* Accessed by the UI to display data.
* @see BranchData
*/
const baseData: BaseData = {
const baseData = {
global: {
update_frequency: new DataEntry({
key: GOBAL + ".update_frequency",
Expand Down Expand Up @@ -325,12 +325,6 @@ const baseData: BaseData = {
})
},
park_and_scenario: {
park_value: new DataEntry({
key: LOCAL + ".park_value",
store: store<number>(
context.getParkStorage().get(LOCAL + ".park_value", 0)
)
}),
park_size: new DataEntry({
key: LOCAL + ".park_size",
store: store<number>(
Expand Down Expand Up @@ -616,6 +610,18 @@ const baseData: BaseData = {
key: LOCAL + ".company_value_record",
temporary: true,
store: store<number>(0)
}),
park_value: new DataEntry({
key: LOCAL + ".park_value",
store: store<number>(
context.getParkStorage().get(LOCAL + ".park_value", 0)
)
}),
park_value_record: new DataEntry({
key: LOCAL + ".park_value_record",
store: store<number>(
context.getParkStorage().get(LOCAL + ".park_value_record", 0)
)
})
},
options: {
Expand Down
1 change: 0 additions & 1 deletion src/data/park_and_scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ namespace ParkAndScenarioData {
* Updates the park data by setting the park value and park rating.
*/
function updateParkData(): void {
baseData.local.park_and_scenario.park_value.store.set(park.value)
baseData.local.park_and_scenario.park_rating.store.set(park.rating)
}

Expand Down
3 changes: 2 additions & 1 deletion src/languages/locale/en-GB.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"action_server_join": "Join server: {PALESILVER}{INT32}",
"action_server_chat": "Chat: {PALESILVER}{INT32}",

"park_value": "Park value: {PALESILVER}{CURRENCY2DP}",
"park_size": "Park size: {PALESILVER}{COMMA32} tiles",
"park_rating_current": "Current: {PALESILVER}{COMMA2DP32}",
"park_rating_ave": "Average (all time): {PALESILVER}{COMMA2DP32}",
Expand Down Expand Up @@ -114,6 +113,8 @@
"finance_total_profit": "Total Profit: {PALESILVER}{CURRENCY2DP}",
"finance_company_value": "Company Value: {PALESILVER}{CURRENCY2DP}",
"finance_company_value_record": "Company Value Record: {PALESILVER}{CURRENCY2DP}",
"finance_park_value": "Park Value: {PALESILVER}{CURRENCY2DP}",
"finance_park_value_record": "Park Value Record: {PALESILVER}{CURRENCY2DP}",

"options_update_running": "{GREEN}Running",
"options_update_manual": "{YELLOW}Manual",
Expand Down
3 changes: 2 additions & 1 deletion src/languages/locale/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
"action_server_join": "进入服务器:{PALESILVER}{INT32}",
"action_server_chat": "聊天消息:{PALESILVER}{INT32}",

"park_value": "园区价值:{PALESILVER}{CURRENCY2DP}",
"park_size": "园区面积:{PALESILVER}{COMMA32} tiles",
"park_rating_current": "当前:{PALESILVER}{COMMA2DP32}",
"park_rating_ave": "平均值:{PALESILVER}{COMMA2DP32}",
Expand Down Expand Up @@ -114,6 +113,8 @@
"finance_total_profit": "总利润:{PALESILVER}{CURRENCY2DP}",
"finance_company_value": "公司价值:{PALESILVER}{CURRENCY2DP}",
"finance_company_value_record": "公司价值最高纪录:{PALESILVER}{CURRENCY2DP}",
"finance_park_value": "园区价值:{PALESILVER}{CURRENCY2DP}",
"finance_park_value_record": "园区价值最高纪录:{PALESILVER}{CURRENCY2DP}",

"options_update_running": "{GREEN}运行中",
"options_update_manual": "{YELLOW}手动更新",
Expand Down
33 changes: 22 additions & 11 deletions src/ui/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -647,17 +647,6 @@ function getWindowParams(): WindowParams {
groupbox({
text: language.ui.main.groupbox.park_and_scenario.title,
content: [
// Park Value
label({
text: compute(
baseData.local.park_and_scenario.park_value.store,
(value) =>
context.formatString(
language.ui.main.label.park_value,
value
)
)
}),
// Park Size
label({
text: compute(
Expand Down Expand Up @@ -1209,6 +1198,28 @@ function getWindowParams(): WindowParams {
}
),
tooltip: language.ui.main.tooltip.finance_company_value_record
}),
// Park Value
label({
text: compute(
baseData.local.finance.park_value.store,
(value) =>
context.formatString(
language.ui.main.label.finance_park_value,
value
)
)
}),
// Park Value Record
label({
text: compute(
baseData.local.finance.park_value_record.store,
(value) =>
context.formatString(
language.ui.main.label.finance_park_value_record,
value
)
)
})
]
})
Expand Down

0 comments on commit 3e5abf1

Please sign in to comment.