From 816946a0d95ed7ea0fb3e964d30b1dd7cbea371f Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Thu, 14 Mar 2024 19:49:17 -0400 Subject: [PATCH 1/4] Fix bug with Giveaways This fixes a bug with giveaways. Giveaways would previously list all of the participants of a giveaway in the mail, but at some point a breaking change occurred, and instead it lists [object Object] multiple times. --- node/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/server.js b/node/server.js index b4fae70..665fca1 100644 --- a/node/server.js +++ b/node/server.js @@ -13202,7 +13202,7 @@ setInterval(function () { to: winner.name, subject: "You've won a giveaway!", message: - "Congratulations, you won " + player.name + "'s giveaway. Participants were: " + list.join(", "), + "Congratulations, you won " + player.name + "'s giveaway. Participants were: " + list.map(e=>e.name).join(", "), rid: randomStr(50), retries: 5, item: mitem, From 15da79028aa0e9894c4726d2110fa20526f9f344 Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Thu, 14 Mar 2024 19:53:28 -0400 Subject: [PATCH 2/4] Fix formatting for ESLint --- node/server.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/server.js b/node/server.js index 665fca1..5f8f9c2 100644 --- a/node/server.js +++ b/node/server.js @@ -13202,7 +13202,11 @@ setInterval(function () { to: winner.name, subject: "You've won a giveaway!", message: - "Congratulations, you won " + player.name + "'s giveaway. Participants were: " + list.map(e=>e.name).join(", "), + "Congratulations, you won " + + player.name + + "'s giveaway. Participants were: " + + list.map((e) => e.name).join(", "), + rid: randomStr(50), rid: randomStr(50), retries: 5, item: mitem, From c935df7624d87d74e90ce2591c575d8e3eeb9ceb Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Thu, 14 Mar 2024 19:55:26 -0400 Subject: [PATCH 3/4] Fix duplicate key --- node/server.js | 1 - 1 file changed, 1 deletion(-) diff --git a/node/server.js b/node/server.js index 5f8f9c2..5c29c05 100644 --- a/node/server.js +++ b/node/server.js @@ -13207,7 +13207,6 @@ setInterval(function () { "'s giveaway. Participants were: " + list.map((e) => e.name).join(", "), rid: randomStr(50), - rid: randomStr(50), retries: 5, item: mitem, }, From 72d322398897206a3f90d1d5e082f0665038573b Mon Sep 17 00:00:00 2001 From: FreezePhoenix <24441367+FreezePhoenix@users.noreply.github.com> Date: Fri, 15 Mar 2024 17:18:51 -0400 Subject: [PATCH 4/4] Fix another bug with Giveaways If a player was not on the server when the giveaway ended, or their inventory was full, then the server would push `{ name: undefined }` into the list of players that could win the giveaway. This would send the item into the abyss, as it would error while the server would try to mail the item, preventing it from being recovered. --- node/server.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/node/server.js b/node/server.js index 5c29c05..9c71ff5 100644 --- a/node/server.js +++ b/node/server.js @@ -13168,12 +13168,12 @@ setInterval(function () { player.slots[slot].giveaway--; if (!player.slots[slot].giveaway) { var list = []; - player.slots[slot].list.forEach(function (p) { - var p = get_player(p); - if (p && p.esize) { - list.push(p); + player.slots[slot].list.forEach(function (name) { + var player = get_player(name); + if (player && player.esize) { + list.push(player); } else if (!mode.prevent_external) { - list.push({ name: p }); + list.push({ name }); } }); if (!list.length) {