Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions modules/other/SunGeckoMacro.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ const SUN_GECKO_COMBAT_ORIGIN = {
};

const WARP_WIZARD_DELAY_TICKS = 40;
const MINIMUM_MOTES = 5000;

class SunGecko extends ModuleBase {
constructor() {
Expand Down Expand Up @@ -135,6 +136,7 @@ class SunGecko extends ModuleBase {

this.on('tick', () => {
if (!Player.getPlayer()) return;

switch (this.state) {
case States.WAITING:
break;
Expand Down Expand Up @@ -167,6 +169,26 @@ class SunGecko extends ModuleBase {
OverlayManager.incrementTrackedValue(this.oid, 'essence', essenceAmount);
}

getMotesFromScoreboard() {
try {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this a try catch

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not
(ai)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not (ai)

tell the ai to fix it then

const lines = Scoreboard.getLines();
if (!lines) return null;

for (const line of lines) {
const lineText = ChatLib.removeFormatting(String(line));
const match = lineText.match(/Motes\s*[:\-]?\s*([\d,]+)/i);
if (!match) continue;

const motes = Number(match[1].replace(/,/g, ''));
return Number.isFinite(motes) ? motes : null;
}
} catch (e) {
console.error('V5 Caught error' + e + e.stack);
}

return null;
}

countNearbyBlocks() {
const player = Player.getPlayer();
if (!player) return 0;
Expand Down Expand Up @@ -308,6 +330,11 @@ class SunGecko extends ModuleBase {
this.scheduleState(States.DETERMIN, 40);
return;
}
var motes = this.getMotesFromScoreboard();
if (motes !== null && motes < MINIMUM_MOTES) {
this.toggle(false);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Say it in chat! Don't toggle off without stating the reason.

return;
}

if (Guis.guiName() !== null) {
this.clickMenuItem(ORUO.menuItem);
Expand Down