dandcvs / KGAutoPlay

20 stars 12 forks source link

Workshop upgrades in iron will #5

Closed wx00 closed 5 years ago

wx00 commented 5 years ago

I found it automatically do unnecessary upgrades in iron will, so I added the following lines in autoWorkshop() before the loop to skip those upgrades.

let IWignores = ['Register', 'Hoes', 'Axes', 'Drills', 'Huts', 'Geodesy', 'Augmentations', 'Astrophysicists', 'Logistics'];
let check_str = (str, checklist) => checklist.some((s) => str.toLowerCase().includes(s.toLowerCase()));
if (gamePage.ironWill) {
    btn = btn.filter(res => !check_str(res.id, IWignores));
}

I think this is important, since resources are very limited in ironwill, so I make an issue here. It's a very simple idea, you can use the code as-is or make your own version as you want.

Also I change the definition of btn in autoWorkshop() to

btn = gamePage.tabs[3].buttons.filter(res => res.model.metadata.unlocked && !res.model.metadata.researched); 

to remove a layer of if in the loop, it also reduces the size of btn to be processed.

I changed my local version quite a lot (mainly on formats, make it easier for me to read and modify), so I can't easily make a PR or patch here.

dandcvs commented 5 years ago

Good idea, also i added some tehs as (Telecommunication, engineers*). On wiki iw page says what : Ironwood Huts (prerequisite of Silos), so I added all id manually rather than using a mask.

wx00 commented 5 years ago

I've check Ironwood Huts in upgrade list, it's id is "ironwood", other huts are "***Huts". So I just use "huts" as filter keyword and not added special case for ironwood.

I didn't think of late-game upgrades in iron will.. Good to also have those in list..