diff --git a/archipelagoHelper.js b/archipelagoHelper.js index d93bc8e..242e6f5 100644 --- a/archipelagoHelper.js +++ b/archipelagoHelper.js @@ -100,15 +100,11 @@ client.items.on("itemsReceived", (items) => { loadCache(); //make sure the cache is loaded before sending any item to chat if (notifiedItems.includes(696969)){ onCountdown("TRUE"); } for (let i of items) { - // I'm sure that there was a reason to add 100000 to the id, but uh, clearly past delilah did not do me any favors - if (notifiedItems.includes(Number(i.id))) { continue; } - if (notifiedItems.includes(Number(i.id) + 100000)) { continue; } - if (Number(i.id) > 12400) { - notifiedItems.push(Number(i.id) + 100000); - } else { - notifiedItems.push(Number(i.id)) } + const itemKey = { id: Number(i.id), locationId: Number(i.locationId) }; + if (notifiedItems.some(notifiedItem => notifiedItem.id === itemKey.id && notifiedItem.locationId === itemKey.locationId)) { continue; } + notifiedItems.push(itemKey); messageUtil.saveItems(notifiedItems, fileName); - console.debug(`ID ${i.id}, Name ${i.name}, Sender ${i.sender}, Flags ${i.flags}`); + console.debug(`ID ${i.id}, Name ${i.name}, Sender ${i.sender}, Flags ${i.flags}, LocationId ${i.locationId}`); onItemReceived(i.id, i.name, i.sender, i.flags); } }) diff --git a/bot-get.js b/bot-get.js index eaf3d14..359a5ac 100644 --- a/bot-get.js +++ b/bot-get.js @@ -68,7 +68,7 @@ async function onItem(id, item, player, flags) { if (Math.random() < 0.6) { currently_dead = true; } const timedOutUser = await webhook.postInChat(messageUtil.generateRandomText(messageUtil.ITEM_TRAP, { item: item, player: player }), currently_dead, false); if (timedOutUser) { - console.log(`${timedOutUser} user died`); + console.log(`${timedOutUser} user died`); deathLink(timedOutUser); } } diff --git a/messageUtil.js b/messageUtil.js index 1b3cfb3..a4cabb4 100644 --- a/messageUtil.js +++ b/messageUtil.js @@ -104,7 +104,7 @@ function loadFiles() { } function myCallback() { - console.debug(`Saved ${jsonItems}`); + console.debug(`Saved ${jsonItems.length} items.`); } function saveItems(collectedItems, filename) { diff --git a/package.json b/package.json index a3c9a93..255166e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chatipelago", - "version": "1.2.6", + "version": "1.2.7", "description": "Chatipelago", "main": "app.js", "type": "module", diff --git a/webhook-put.js b/webhook-put.js index 8c6fe9b..69ac65f 100644 --- a/webhook-put.js +++ b/webhook-put.js @@ -67,17 +67,14 @@ async function postInChat(message, trap, bounced) { if (trap) { // Trap message triggers additional trap-related actions with response await sendMessage(message); - const response = await streamerbotclient.doAction(config.streamerbotActions.trapMessage, { - customEventResponse: true - }); + const response = await streamerbotclient.doAction( + config.streamerbotActions.trapMessage, + { "timedOutUser": "Chat" }, + { customEventResponse: true } + ); + console.debug('ResponseCustomEventResponseArgs:', response.customEventResponseArgs); + return response.customEventResponseArgs.randomUser0 || "Chat"; - // Extract the timedOutUser argument from the response - if (response.customEventResponseArgs && response.customEventResponseArgs.timedOutUser) { - console.log('Chat user died:', response.customEventResponseArgs.timedOutUser); - return response.customEventResponseArgs.timedOutUser; - } - - return response; } else if (bounced) { // Bounced message enables emote mode for 30 seconds await sendMessage(message);