summaryrefslogtreecommitdiff
path: root/npc/guild/gldfunc_treasure.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/guild/gldfunc_treasure.txt')
-rw-r--r--npc/guild/gldfunc_treasure.txt58
1 files changed, 32 insertions, 26 deletions
diff --git a/npc/guild/gldfunc_treasure.txt b/npc/guild/gldfunc_treasure.txt
index 1d728b376..2b6b1ab8a 100644
--- a/npc/guild/gldfunc_treasure.txt
+++ b/npc/guild/gldfunc_treasure.txt
@@ -3,7 +3,7 @@
//===== By: ==================================================
//= holyAngelX (1.0) Akaru and ho|yAnge|X (1.1)
//===== Current Version: =====================================
-//= 1.9
+//= 2.0
//===== Compatible With: =====================================
//= eAthena 1+; RO Episode 4+
//===== Description: =========================================
@@ -46,6 +46,7 @@
//= 1.7 Box Count fix by Zoc. Now it spawns 1st/2nd Treasure Chest 50%/50% [Lupus]
//= 1.8 Official Treasure Spawn in Novice Castles. Had to add +1 in odd/even formula to leave correct ID of NG Treasure Box 8) [Lupus]
//= 1.9 Added F_TreasProtect to remove players who are not guild master from treasure room. [L0ne_W0lf]
+//= 2.0 Updated F_GldTreas, no longer uses gotos, swapped out for a 'for' loop. [L0ne_W0lf]
//============================================================
@@ -53,26 +54,32 @@
// Treasure Spawning Function
//================================================
function script F_GldTreas {
- if(getarg(10) == 1) goto L_SPAWN;
- setcastledata getarg(0),4,0;
- setcastledata getarg(0),5,0;
- killmonster getarg(0),"Treasure_"+getarg(1)+"::OnDied";
- if(GetCastleData(getarg(0),2) > 100 || GetCastleData(getarg(0),1) == 0) return;
- //sets the counter variable = to the box number amount
- if(getarg(0) == "nguild_prt" || getarg(0) == "nguild_alde" || getarg(0) == "nguild_gef" || getarg(0) == "nguild_pay" ) {
- //Novice Castles can't have more than 1 Treasure Chest
- set getarg(2),1;
- }else{
- set getarg(2),GetCastleData(getarg(0),2)/5+4;
- }
- if (getarg(2) <= 0) return;
- set getarg(3), getarg(2); //sets the counter variable = to the box number amount
+ if(getarg(10) != 1) {
+ setcastledata getarg(0),4,0;
+ setcastledata getarg(0),5,0;
+
+ // Why on earth are we killing old treasure chest spawns?
+ //killmonster getarg(0),"Treasure_"+getarg(1)+"::OnDied";
+
+ // Don't spawn treasures if Castle is empty, or Eco is greater than 100
+ if(GetCastleData(getarg(0),2) > 100 || GetCastleData(getarg(0),1) == 0) return;
-L_SPAWN:
- set getarg(4), getarg(5)+((getarg(3)+1) & 1); //sets the box id variable = to the box id
- areamonster getarg(0),getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
- set getarg(3), getarg(3) - 1;
- if(getarg(3) > 0) goto L_SPAWN;
+ // Only spawn one treasure chest for notice castles.
+ if (compare(getarg(0),"nguild"))
+ set getarg(2),1;
+ else
+ set getarg(2),GetCastleData(getarg(0),2)/5+4;
+
+ if (getarg(2) <= 0) return;
+
+ //sets the counter variable = to the box number amount
+ set getarg(3), getarg(2);
+ }
+ for (set .@i,1; .@i <= getarg(3) ; set .@i,.@i+1) {
+ // set treasure box ID
+ set getarg(4), getarg(5)+((getarg(3)+1) & 1);
+ areamonster getarg(0),getarg(6),getarg(7),getarg(8),getarg(9),"Treasure Chest",getarg(4),1,"Treasure_"+getarg(1)+"::OnDied";
+ }
return;
}
@@ -81,15 +88,14 @@ L_SPAWN:
//===============================================================
function script F_GldTreasSw {
mes " ";
- mes "There is little switch over here";
- mes "Would you like to pull the switch down?";
+ mes "There's a small lever. Will you pull it? ";
next;
- menu "Yes",M_1,"No",-;
- close;
-
- M_1:
+
+ if (select("Pull.:Do not.") == 1) {
warp getarg(0),getarg(1),getarg(2);
return;
+ }
+ close;
}
//==============================================================