From 5d58c4554f4264a1ba546a31439216c90da527b0 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 1 Feb 2007 22:23:14 +0000 Subject: - Cleaned up the npcshop(add/del) item script commands, fixed a possible dangling pointer crash caused by their improper use of realloc. They no longer automatically attach the script to the shop, and they will return true/false based on whether the shop was found or not. - Added script command npcshopattach to enable attaching/detaching your script from any npc shop. - Updated doc/script_commands.txt with entries for npcshopitem, npcshopadditem, npcshopdelitem and npcshopattach git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@9769 54d463be-8e91-2dee-dedb-b68131a5f0ec --- doc/script_commands.txt | 55 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'doc') diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 102380148..81462e634 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -43,6 +43,8 @@ //= 2.11.20070109 - removed the unused flag argument in guildskill, added an //= optional argument to setcart,setfalcon,setriding and other cleanups //= [FlavioJS] +//= 2.12.20070201 - Added npcshopitem, npcshopadditem, npcshopdelitem and +//= npcshopattach [Skotlex] //===== Compatible With =================================== //= LOL, can be used by anyone hopefully //===== Description ======================================= @@ -3595,6 +3597,59 @@ itself). --------------------------------------- +*npcshopitem "",,{,,{,,{,...}}} + +This command lets you override the contents of an existing npc shop. The +current sell list will be wiped, and only the items specified with the price +specified will be for sale. + +The function returns 1 if shop was updated successfully, or 0 if not found. + +Note that you cannot use -1 to specify default selling price! + +--------------------------------------- + +*npcshopadditem "",,{,,{,,{,...}}} + +This command will add more items at the end of the selling list for the +specified npc shop. If you specify an item already for sell, that item will +appear twice on the sell list. + +The function returns 1 if shop was updated successfully, or 0 if not found. + +Note that you cannot use -1 to specify default selling price! + +--------------------------------------- + +*npcshopdelitem "",{,{,{,...}}} + +This command will remove items from the specified npc shop. +If the item to remove exists more than once on the shop, all instances will be +removed. + +Note that the function returns 1 even if no items were removed. The return +value is only to confirm that the shop was indeed found. + +--------------------------------------- + +*npcshopattach ""{,} + +This command will attach the current script to the given npc shop. +When a script is attached to a shop, the events "OnBuyItem" and "OnSellItem" +of your script will be executed whenever a player buys/sells from the shop. +Additionally, the arrays @bought_nameid[], @bought_quantity[] or @sold_nameid[] +and @sold_quantity[] will be filled up with the items and quantities +bought/sold. + +The optional parameter specifies whether to attach ("1") or detach ("0") from +the shop (the default is to attach). Note that detaching will detach any npc +attached to the shop, even if it's from another script, while attaching will +override any other script that may be already attached. + +The function returns 0 if the shop was not found, 1 otherwise. + +--------------------------------------- + *debugmes ""; This command will send the message to the server console (map-server window). It -- cgit v1.2.3-70-g09d2