From 9b3a8b61d9cdb5ca1c620237f3835d620cfb1cba Mon Sep 17 00:00:00 2001 From: David Coles Date: Sun, 13 Sep 2020 14:49:38 -0700 Subject: [PATCH 1/2] Add open/close_merchant to runner_functions --- runner_functions.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/runner_functions.js b/runner_functions.js index efd776e..9b9b497 100644 --- a/runner_functions.js +++ b/runner_functions.js @@ -443,6 +443,30 @@ function unequip(slot) // show_json(character.slots) => to see slot options parent.socket.emit("unequip",{slot:slot}); } +/** + * Open Merchant stand. + * + * @param {number} [num=0] Inventory slot containing merchant stand. + */ +function open_merchant(num) +{ + num = num || 0; + if(!character.items[num]) return; + if(G.items[character.items[num].name].type !== "stand") { + parent.d_text("CAN'T OPEN", character); + return; + } + parent.open_merchant(num); +} + +/** + * Close Merchant stand. + */ +function close_merchant() +{ + parent.close_merchant(); +} + function trade(num,trade_slot,price,quantity) // where trade_slot is 1 to 16 - example, trade(0,4,1000) puts the first item in inventory to the 4th trade slot for 1000 gold [27/10/16] { if(!is_string(trade_slot) || !trade_slot.startsWith("trade")) trade_slot="trade"+trade_slot; From a296119b10558bc912e415aa59f65b89b6fa44d8 Mon Sep 17 00:00:00 2001 From: David Coles Date: Thu, 17 Sep 2020 13:26:08 -0700 Subject: [PATCH 2/2] runner_functions: Use more intuitive name for opening merchant stand You open a merchant stand, you don't open the merchant. --- runner_functions.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runner_functions.js b/runner_functions.js index 9b9b497..d6b19b8 100644 --- a/runner_functions.js +++ b/runner_functions.js @@ -448,7 +448,7 @@ function unequip(slot) // show_json(character.slots) => to see slot options * * @param {number} [num=0] Inventory slot containing merchant stand. */ -function open_merchant(num) +function open_stand(num) { num = num || 0; if(!character.items[num]) return; @@ -462,7 +462,7 @@ function open_merchant(num) /** * Close Merchant stand. */ -function close_merchant() +function close_stand() { parent.close_merchant(); }