Skip to content

Instantly share code, notes, and snippets.

@jacobrosenthal
Last active December 28, 2020 21:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacobrosenthal/d537a8b1b8c57e59af53978e5b015bde to your computer and use it in GitHub Desktop.
Save jacobrosenthal/d537a8b1b8c57e59af53978e5b015bde to your computer and use it in GitHub Desktop.
/**
* Remember, you have access these globals:
* 1. df - Just like the df object in your console.
* 2. ui - For interacting with the game's user interface.
* 3. plugin - To register the plugin, plus other helpful things.
*
* Let's log these to the console when you run your plugin!
*/
console.log(df, ui, plugin);
class Plugin {
clock;
constructor() {
let clock = setInterval(() => {
const planets = Array.from(df.getMyPlanets())
.filter(p => (Date.now() > (p.artifactLockedTimestamp + (12 * 60 * 60)) * 1000))
.sort((a, b) => parseInt(a.locationId, 16) - parseInt(b.locationId, 16));
for (const planet of planets) {
df.withdrawArtifact(planet.locationId);
}
}, 1000 * 60 * 10);
this.clock = clock;
}
async render(container) {
container.style.width = '50';
}
destroy() {
clearInterval(this.clock);
}
}
/**
* And don't forget to register it!
*/
plugin.register(new Plugin());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment