Skip to content

Commit

Permalink
feat(religion): Auto-refine tears and TCs
Browse files Browse the repository at this point in the history
You can now set a threshold at which tears and TCs will be refined into higher-class resources.

Fixes #19
  • Loading branch information
oliversalzburg committed Jan 7, 2023
1 parent 17509be commit 0bc8a59
Show file tree
Hide file tree
Showing 12 changed files with 406 additions and 248 deletions.
10 changes: 5 additions & 5 deletions packages/userscript/source/BonfireManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class BonfireManager implements Automation {
// We need to perform the process like this to avoid UI confirmations
// for selling items.
// Sell all pastures (to regain the resources).
button.controller.sellInternal(button.model, 0);
button.controller.sellInternal!(button.model, 0);
// Manually update the metadata, as we bypassed the full selling logic.
pastureMeta.on = 0;
pastureMeta.val = 0;
Expand Down Expand Up @@ -145,7 +145,7 @@ export class BonfireManager implements Automation {
const prices = mustExist(aqueductMeta.stages)[1].prices;
if (this._bulkManager.singleBuildPossible(aqueductMeta, prices, 1)) {
const button = mustExist(this.getBuildButton("aqueduct", 0));
button.controller.sellInternal(button.model, 0);
button.controller.sellInternal!(button.model, 0);
aqueductMeta.on = 0;
aqueductMeta.val = 0;
aqueductMeta.stage = 1;
Expand Down Expand Up @@ -206,7 +206,7 @@ export class BonfireManager implements Automation {
const prices = mustExist(libraryMeta.stages)[1].prices;
if (this._bulkManager.singleBuildPossible(libraryMeta, prices, 1)) {
const button = mustExist(this.getBuildButton("library", 0));
button.controller.sellInternal(button.model, 0);
button.controller.sellInternal!(button.model, 0);
libraryMeta.on = 0;
libraryMeta.val = 0;
libraryMeta.stage = 1;
Expand Down Expand Up @@ -235,7 +235,7 @@ export class BonfireManager implements Automation {
const prices = mustExist(amphitheatreMeta.stages)[1].prices;
if (this._bulkManager.singleBuildPossible(amphitheatreMeta, prices, 1)) {
const button = mustExist(this.getBuildButton("amphitheatre", 0));
button.controller.sellInternal(button.model, 0);
button.controller.sellInternal!(button.model, 0);
amphitheatreMeta.on = 0;
amphitheatreMeta.val = 0;
amphitheatreMeta.stage = 1;
Expand All @@ -257,7 +257,7 @@ export class BonfireManager implements Automation {
const steamworks = this._host.gamePage.bld.getBuildingExt("steamworks");
if (steamworks.meta.val && steamworks.meta.on === 0) {
const button = mustExist(this.getBuildButton("steamworks"));
button.controller.onAll(button.model);
button.controller.onAll!(button.model);
}
}

Expand Down
Loading

0 comments on commit 0bc8a59

Please sign in to comment.