Files

37 lines
906 B
TypeScript
Raw Permalink Normal View History

2024-06-11 17:27:26 +01:00
import { ExampleBot } from '../ExampleBot';
import type { GameObject} from '../../lib';
import { Utils } from '../../lib';
2024-06-11 17:27:26 +01:00
class TaskInventory extends ExampleBot
{
public async onConnected(): Promise<void>
2024-06-11 17:27:26 +01:00
{
let attachments: GameObject[] = [];
while(!attachments.length)
{
await Utils.sleep(1000);
attachments = this.bot.currentRegion.objects.getObjectsByParent(this.bot.agent.localID);
}
console.log('Got ' + attachments.length + ' attachments');
for(const obj of attachments)
{
await obj.updateInventory();
for(const task of obj.inventory)
{
console.log('Found task inventory item ' + task.name);
}
}
console.log('Finished!');
}
}
new TaskInventory().run().then(() =>
{
}).catch((err: unknown) =>
2024-06-11 17:27:26 +01:00
{
console.error(err);
});