Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
fix(trade): Embassy build limit behaves wrong
Browse files Browse the repository at this point in the history
  • Loading branch information
oliversalzburg committed Oct 9, 2022
1 parent 2d6e454 commit d8092a6
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/userscript/source/TradeManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,10 @@ export class TradeManager implements Automation {

const name = racePanels[panelIndex].race.name;
const race = this._host.gamePage.diplomacy.get(name);
const max = this.settings.buildEmbassies.items[name].max;
const max =
this.settings.buildEmbassies.items[name].max === -1
? Number.POSITIVE_INFINITY
: this.settings.buildEmbassies.items[name].max;

if (!this.settings.buildEmbassies.items[name].enabled || max <= race.embassyLevel) {
continue;
Expand Down Expand Up @@ -333,6 +336,10 @@ export class TradeManager implements Automation {
emBulk.priceSum += nextPrice;
emBulk.val += 1;
refreshRequired = true;

if (emBulk.max <= emBulk.val) {
continue;
}
} else {
bulkTracker.splice(raceIndex, 1);
--raceIndex;
Expand Down

0 comments on commit d8092a6

Please sign in to comment.