2024-06-11 17:27:26 +01:00
|
|
|
import { ExampleBot } from '../ExampleBot';
|
2025-01-17 23:37:54 +00:00
|
|
|
import type { GameObject} from '../../lib';
|
|
|
|
|
import { Utils } from '../../lib';
|
2024-06-11 17:27:26 +01:00
|
|
|
|
|
|
|
|
class TaskInventory extends ExampleBot
|
|
|
|
|
{
|
2025-01-17 23:37:54 +00:00
|
|
|
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(() =>
|
|
|
|
|
{
|
|
|
|
|
|
2025-01-17 23:37:54 +00:00
|
|
|
}).catch((err: unknown) =>
|
2024-06-11 17:27:26 +01:00
|
|
|
{
|
|
|
|
|
console.error(err);
|
|
|
|
|
});
|