This commit is contained in:
2026-01-31 22:34:20 -05:00
parent 9acd38c94b
commit 7b326a112e
15 changed files with 3608 additions and 213 deletions

View File

@@ -30,6 +30,45 @@ module.exports = {
'.trade': {
desc: 'Bot will take trade requests',
async function(from){
// Check if bot has StoragePlugin
if (this.plunginsLoaded['Storage']) {
// Storage bot flow
await this.say('/trade accept');
let window = await this.once('windowOpen');
// Collect items received from player
const itemsReceived = [];
const customerSlots = [5, 6, 7, 8, 14, 15, 16, 17, 23, 24, 25, 26];
for (const slotNum of customerSlots) {
const item = window.slots[slotNum];
if (item) {
itemsReceived.push({
name: item.name,
id: item.type,
count: item.count,
nbt: item.nbt
});
}
}
// Confirm and log trade
this.bot.moveSlotItem(37, 37);
// Wait for trade to complete
await this.once('windowClose');
// Handle the trade items
if (itemsReceived.length > 0) {
await this.plunginsLoaded['Storage'].handleTrade(from, itemsReceived);
this.whisper(from, `Received ${itemsReceived.length} item type(s). Sorting into storage.`);
} else {
this.whisper(from, `No items received.`);
}
return;
}
// Original sign-based flow for non-storage bots
/*
todo