21 lines
1.1 KiB
JavaScript
21 lines
1.1 KiB
JavaScript
// Navigate through visible controls, without mutating application state.
|
|
export async function chooseProvince(page,code){
|
|
const current=await page.evaluate(()=>shanheDebug.state());
|
|
if(current.entryCity)await page.locator('#atlas-back').click();
|
|
const selected=current.entryProvince;
|
|
if(selected===code)return;
|
|
if(selected)await page.locator('#atlas-back').click();
|
|
if(code)await page.locator('#reference [data-province="'+code+'"] text').click();
|
|
}
|
|
export async function setDifficulty(page,{speed,bounce,snap}){
|
|
if(!await page.locator('#confirm-journey').isVisible())await page.locator('#start').click();
|
|
if(speed!==undefined&&speed!==4)throw Error("Timed drop modes were removed; choose snap difficulty instead.");
|
|
if(snap!==undefined)await page.locator('#modal [data-snap="'+snap+'"]').click();
|
|
if(bounce!==undefined)await page.locator('#modal [data-bounce="'+bounce+'"]').click();
|
|
}
|
|
|
|
export async function startJourney(page,selector='#start'){
|
|
if(!await page.locator('#confirm-journey').isVisible())await page.locator(selector).click();
|
|
await page.locator('#confirm-journey').click();
|
|
}
|