summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
Diffstat (limited to 'doc')
-rw-r--r--doc/sample/npc_trader_sample.txt58
-rw-r--r--doc/script_commands.txt64
2 files changed, 122 insertions, 0 deletions
diff --git a/doc/sample/npc_trader_sample.txt b/doc/sample/npc_trader_sample.txt
new file mode 100644
index 000000000..abc87f6b4
--- /dev/null
+++ b/doc/sample/npc_trader_sample.txt
@@ -0,0 +1,58 @@
+//===== Hercules Script =======================================
+//= Sample: NPC Trader
+//===== By: ==================================================
+//= Hercules Dev Team
+//===== Current Version: =====================================
+//= 20131223
+//===== Description: =========================================
+//= Demonstrates NPC Trader.
+//============================================================
+
+/* ordinary zeny trader */
+prontera,152,151,1 trader TestTrader 952,{
+ OnInit:
+ sellitem 2115;
+ end;
+}
+/* ordinary cash trader */
+prontera,152,152,1 trader TestTraderCash 952,{
+ OnInit:
+ tradertype(NST_CASH);
+ sellitem 2115;
+ end;
+}
+/* custom npc trader */
+prontera,153,152,1 trader TestCustom2 952,{
+ OnInit:
+ tradertype(NST_CUSTOM);
+ sellitem 501,2;
+ end;
+
+/* allows currency to be item 501 and 502 */
+OnCountFunds:
+ setcurrency(countitem(501),countitem(502));
+ end;
+
+/* receives @price (total cost) and @points (the secondary input field for cash windows) */
+OnPayFunds:
+ dispbottom "Hi: price="+@price+" and points="+@points;
+ if( countitem(502) < @points || countitem(501) < @price-@points )
+ end;
+ delitem 502,@points;
+ delitem 501,@price-@points;
+ purchaseok();
+ end;
+}
+/* demonstrates Market Trader */
+prontera,150,160,6 trader HaiMarket 952,{
+OnInit:
+ tradertype(NST_MARKET);
+ sellitem 501,-1,49;
+ end;
+
+OnClock0000://resupplies red potions on midnight
+OnMyResupply:
+ if( shopcount(501) < 20 )
+ sellitem 501,-1,49;
+ end;
+} \ No newline at end of file
diff --git a/doc/script_commands.txt b/doc/script_commands.txt
index 9186ba714..f5f2d7d9c 100644
--- a/doc/script_commands.txt
+++ b/doc/script_commands.txt
@@ -1120,6 +1120,7 @@ From here on, we will have the commands sorted as follow:
9.- Battleground commands.
10.- Mercenary commands.
11.- Queue commands.
+12.- NPC Trader commands
=====================
@@ -8471,3 +8472,66 @@ Deletes a queue iterator from memory and returns 1 when it fails,
otherwise 0 is returned.
---------------------------------------
+
+======================
+|12.- NPC Trader Commands.|
+======================
+---------------------------------------
+Commands that control NPC Trader Shops
+See /doc/sample/npc_trader_sample.txt
+
+---------------------------------------
+
+*openshop({NPC_Name});
+
+opens the trader shop from the currently-attached npc unless,
+when the optional NPC_Name param is used.
+
+---------------------------------------
+
+*sellitem <Item_ID>{,<price>{,<qty>}};
+
+adds (or modifies) <Item_ID> data to the shop,
+when <price> is not provided (or when it is -1) itemdb default is used.
+qty is only necessary for NST_MARKET trader types.
+
+when <Item_ID> is already in the shop,
+the previous data (price/qty), is overwritten with the new.
+
+---------------------------------------
+
+*stopselling <Item_ID>;
+
+attempts to remove <Item_ID> from the current shop list.
+
+---------------------------------------
+
+*setcurrency <Val1>{,<Val2>};
+
+updates the currently attached player shop funds.
+
+---------------------------------------
+
+*tradertype(<Type>);
+
+Modifies the npc trader type, item list is cleared upon modifiying the value.
+By default, all npcs staart with tradertype(NST_ZENY);
+
+- NST_ZENY (0) Normal Zeny Shop
+- NST_CASH (1) Normal Cash Shop
+- NST_MARKET (2) Normal NPC Market Shop (where items have limited availability and need to be refurbished)
+- NST_CUSTOM (3) Custom Shop (any currency, item/var/etca, check sample)
+
+---------------------------------------
+
+*purchaseok();
+
+Signs that the transaction (on a NST_CUSTOM trader) has been successful.
+
+---------------------------------------
+
+*shopcount(<Item_ID>);
+
+Returns the amount of still-available <Item_ID> in the shop (on a NST_MARKET trader).
+
+---------------------------------------