From b3cd14f7e232a4ec772ad0c6f4e7e43c53875122 Mon Sep 17 00:00:00 2001 From: Crowns3bc <44653214+Crowns3bc@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:46:58 -0600 Subject: [PATCH 1/4] add def[2] --- node/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/server.js b/node/server.js index cbfb7a1..d876666 100644 --- a/node/server.js +++ b/node/server.js @@ -1902,7 +1902,7 @@ function drop_item_logic(drop, def, pvp) { } else if (def[1] == "open") { chest_exchange(drop, def[2]); } else { - var item = create_new_item(def[1]); + var item = create_new_item(def[1], def[2]); if (pvp) { item.v = new Date(); } From f8ec021806b589c627ffccdd1bf2099529cd9c16 Mon Sep 17 00:00:00 2001 From: Crowns3bc <44653214+Crowns3bc@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:48:40 -0600 Subject: [PATCH 2/4] Add drop[2] --- node/server_functions.js | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/node/server_functions.js b/node/server_functions.js index dacb4e1..59191ed 100644 --- a/node/server_functions.js +++ b/node/server_functions.js @@ -3540,32 +3540,32 @@ function exchange(player, name, args) { } function chest_exchange(chest, name) { - var done = false; - var total = 0; - var current = 0; - D.drops[name].forEach(function (drop) { - total += drop[0]; - }); - result = Math.random() * total; - D.drops[name].forEach(function (drop) { - if (done) { - return; - } - current += drop[0]; - if (result <= current) { - done = true; - if (drop[1] == "gold") { - chest.gold += drop[2]; - } else if (drop[1] == "shells") { - chest.cash += drop[2]; - } else if (drop[1] == "empty") { - } else if (drop[1] == "open") { - chest_exchange(chest, drop[2]); - } else { - chest.items.push(create_new_item(drop[1])); - } - } - }); + var done = false; + var total = 0; + var current = 0; + D.drops[name].forEach(function (drop) { + total += drop[0]; + }); + result = Math.random() * total; + D.drops[name].forEach(function (drop) { + if (done) { + return; + } + current += drop[0]; + if (result <= current) { + done = true; + if (drop[1] == "gold") { + chest.gold += drop[2]; + } else if (drop[1] == "shells") { + chest.cash += drop[2]; + } else if (drop[1] == "empty") { + } else if (drop[1] == "open") { + chest_exchange(chest, drop[2]); + } else { + chest.items.push(create_new_item(drop[1], drop[2])); + } + } + }); } var item_p_ignore = { From 440a0b284eb1ba079eeb3bcfc8f6110e05518847 Mon Sep 17 00:00:00 2001 From: Crowns3bc <44653214+Crowns3bc@users.noreply.github.com> Date: Thu, 21 Aug 2025 14:49:24 -0600 Subject: [PATCH 3/4] fix spacing issue --- node/server_functions.js | 52 ++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/node/server_functions.js b/node/server_functions.js index 59191ed..e0fe560 100644 --- a/node/server_functions.js +++ b/node/server_functions.js @@ -3540,32 +3540,32 @@ function exchange(player, name, args) { } function chest_exchange(chest, name) { - var done = false; - var total = 0; - var current = 0; - D.drops[name].forEach(function (drop) { - total += drop[0]; - }); - result = Math.random() * total; - D.drops[name].forEach(function (drop) { - if (done) { - return; - } - current += drop[0]; - if (result <= current) { - done = true; - if (drop[1] == "gold") { - chest.gold += drop[2]; - } else if (drop[1] == "shells") { - chest.cash += drop[2]; - } else if (drop[1] == "empty") { - } else if (drop[1] == "open") { - chest_exchange(chest, drop[2]); - } else { - chest.items.push(create_new_item(drop[1], drop[2])); - } - } - }); + var done = false; + var total = 0; + var current = 0; + D.drops[name].forEach(function (drop) { + total += drop[0]; + }); + result = Math.random() * total; + D.drops[name].forEach(function (drop) { + if (done) { + return; + } + current += drop[0]; + if (result <= current) { + done = true; + if (drop[1] == "gold") { + chest.gold += drop[2]; + } else if (drop[1] == "shells") { + chest.cash += drop[2]; + } else if (drop[1] == "empty") { + } else if (drop[1] == "open") { + chest_exchange(chest, drop[2]); + } else { + chest.items.push(create_new_item(drop[1], drop[2])); + } + } + }); } var item_p_ignore = { From 3406bf8ab3fea9a3a6042f11313cd26200bebb84 Mon Sep 17 00:00:00 2001 From: Crowns3bc <44653214+Crowns3bc@users.noreply.github.com> Date: Fri, 22 Aug 2025 00:15:39 -0600 Subject: [PATCH 4/4] Update server.js --- node/server.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/server.js b/node/server.js index d876666..3ad7f73 100644 --- a/node/server.js +++ b/node/server.js @@ -1908,7 +1908,7 @@ function drop_item_logic(drop, def, pvp) { } for (var i = 0; i < drop.items.length; i++) { if (can_stack(drop.items[i], item)) { - drop.items[i].q += 1; + drop.items[i].q += def[2] ?? 1; added = true; break; }