summaryrefslogtreecommitdiff
path: root/doc/sample/npc_dynamic_shop.txt
diff options
context:
space:
mode:
authoreuphyy <euphyy@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-10-03 23:13:33 +0000
committereuphyy <euphyy@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-10-03 23:13:33 +0000
commitbafe9ca1ceaac5554b4716b7b5b4911c3f40a51d (patch)
tree65732204e49c51946b48244eabaeae2747cc7e81 /doc/sample/npc_dynamic_shop.txt
parentd4cec2529589b43bb4fd70ba79589bc1bb75da98 (diff)
downloadhercules-bafe9ca1ceaac5554b4716b7b5b4911c3f40a51d.tar.gz
hercules-bafe9ca1ceaac5554b4716b7b5b4911c3f40a51d.tar.bz2
hercules-bafe9ca1ceaac5554b4716b7b5b4911c3f40a51d.tar.xz
hercules-bafe9ca1ceaac5554b4716b7b5b4911c3f40a51d.zip
* Standardization of doc\sample\ folder.
* Deleted doc\sample\PCLoginEvent.txt, which contained outdated information. * Follow-up r16812, fixed file encoding. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16813 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'doc/sample/npc_dynamic_shop.txt')
-rw-r--r--doc/sample/npc_dynamic_shop.txt139
1 files changed, 74 insertions, 65 deletions
diff --git a/doc/sample/npc_dynamic_shop.txt b/doc/sample/npc_dynamic_shop.txt
index 79d0c4fdb..b6ed48808 100644
--- a/doc/sample/npc_dynamic_shop.txt
+++ b/doc/sample/npc_dynamic_shop.txt
@@ -1,86 +1,95 @@
-- shop dyn_shop1 -1,501:50
+//===== rAthena Script =======================================
+//= Sample: Dynamic Shop
+//===== By: ==================================================
+//= rAthena Dev Team
+//===== Current Version: =====================================
+//= 20101219
+//===== Description: =========================================
+//= Contains commands needed for a dynamic shop.
+//============================================================
+
+// Dummy shop to insert items into:
+- shop dyn_shop1 -1,501:50.
prontera,181,200,4 script Dynamic Shop 123,{
-callshop "dyn_shop1",0;
-npcshopattach "dyn_shop1";
-end;
+ callshop "dyn_shop1",0;
+ npcshopattach "dyn_shop1";
+ end;
OnSellItem:
-for(set @i, 0; @i < getarraysize(@sold_nameid); set @i, @i + 1){
- if(countitem(@sold_nameid[@i]) < @sold_quantity[@i] || @sold_quantity[@i] <= 0){
- mes "omgh4x!";
- close;
- }
- if(@sold_nameid[@i] == 501){
- delitem 501, @sold_quantity[@i];
- set $@rpotsleft, $@rpotsleft + @sold_quantity[@i];
- set Zeny, Zeny + @sold_quantity[@i]*20;
- } else {
- if(@sold_nameid[@i] == 502){
- delitem 502, @sold_quantity[@i];
- set $@opotsleft, $@opotsleft + @sold_quantity[@i];
- set Zeny, Zeny + @sold_quantity[@i]*100;
- } else {
- mes "Sorry, I don't need your items.";
+ for(set @i, 0; @i < getarraysize(@sold_nameid); set @i, @i + 1){
+ if(countitem(@sold_nameid[@i]) < @sold_quantity[@i] || @sold_quantity[@i] <= 0){
+ mes "omgh4x!";
close;
+ } else if(@sold_nameid[@i] == 501){
+ delitem 501, @sold_quantity[@i];
+ set $@rpotsleft, $@rpotsleft + @sold_quantity[@i];
+ set Zeny, Zeny + @sold_quantity[@i]*20;
+ } else {
+ if(@sold_nameid[@i] == 502){
+ delitem 502, @sold_quantity[@i];
+ set $@opotsleft, $@opotsleft + @sold_quantity[@i];
+ set Zeny, Zeny + @sold_quantity[@i]*100;
+ } else {
+ mes "Sorry, I don't need your items.";
+ close;
+ }
}
}
-}
-deletearray @sold_quantity, getarraysize(@sold_quantity);
-deletearray @sold_nameid, getarraysize(@sold_nameid);
-mes "Deal completed.";
-close;
+ deletearray @sold_quantity, getarraysize(@sold_quantity);
+ deletearray @sold_nameid, getarraysize(@sold_nameid);
+ mes "Deal completed.";
+ close;
OnBuyItem:
-for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){
- if(@bought_quantity[@i] <= 0){
- mes "omgh4x!";
- close;
- }
- if(@bought_nameid[@i] == 501){
- if(@bought_quantity[@i] > $@rpotsleft){
- if($@rpotsleft > 0){
- set @bought_quantity[@i], $@rpotsleft;
+ for(set @i, 0; @i < getarraysize(@bought_nameid); set @i, @i + 1){
+ if(@bought_quantity[@i] <= 0){
+ mes "omgh4x!";
+ close;
+ } else if(@bought_nameid[@i] == 501){
+ if(@bought_quantity[@i] > $@rpotsleft){
+ if($@rpotsleft > 0){
+ set @bought_quantity[@i], $@rpotsleft;
+ } else {
+ mes "We are out of red potions!";
+ close;
+ }
+ }
+ if(Zeny >= 40*@bought_quantity[@i]){
+ set Zeny, Zeny - 40*@bought_quantity[@i];
+ getitem 501, @bought_quantity[@i];
+ set $@rpotsleft, $@rpotsleft - @bought_quantity[@i];
} else {
- mes "We are out of red potions!";
+ mes "You have insufficient cash.";
close;
}
- }
- if(Zeny >= 40*@bought_quantity[@i]){
- set Zeny, Zeny - 40*@bought_quantity[@i];
- getitem 501, @bought_quantity[@i];
- set $@rpotsleft, $@rpotsleft - @bought_quantity[@i];
} else {
- mes "You have insufficient cash.";
- close;
- }
- } else {
- if(@bought_quantity[@i] > $@opotsleft){
- if($@opotsleft > 0){
- set @bought_quantity[@i], $@opotsleft;
+ if(@bought_quantity[@i] > $@opotsleft){
+ if($@opotsleft > 0){
+ set @bought_quantity[@i], $@opotsleft;
+ } else {
+ mes "We are out of orange potions!";
+ close;
+ }
+ }
+ if(Zeny >= 200*@bought_quantity[@i]){
+ set Zeny, Zeny - 200*@bought_quantity[@i];
+ getitem 502, @bought_quantity[@i];
+ set $@opotsleft, $@opotsleft - @bought_quantity[@i];
} else {
- mes "We are out of orange potions!";
+ mes "You have insufficient cash.";
close;
}
}
- if(Zeny >= 200*@bought_quantity[@i]){
- set Zeny, Zeny - 200*@bought_quantity[@i];
- getitem 502, @bought_quantity[@i];
- set $@opotsleft, $@opotsleft - @bought_quantity[@i];
- } else {
- mes "You have insufficient cash.";
- close;
- }
}
-}
-deletearray @bought_quantity, getarraysize(@bought_quantity);
-deletearray @bought_nameid, getarraysize(@bought_nameid);
-mes "Trade done.";
-close;
+ deletearray @bought_quantity, getarraysize(@bought_quantity);
+ deletearray @bought_nameid, getarraysize(@bought_nameid);
+ mes "Trade done.";
+ close;
OnInit:
-npcshopitem "dyn_shop1", 501,40,502,200;
-set $@rpotsleft, 10;
-set $@opotsleft, 10;
-end;
+ npcshopitem "dyn_shop1", 501,40,502,200;
+ set $@rpotsleft, 10;
+ set $@opotsleft, 10;
+ end;
} \ No newline at end of file