summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpanikon <panikon@zoho.com>2014-05-10 15:46:32 -0300
committerpanikon <panikon@zoho.com>2014-05-10 15:46:32 -0300
commitd689201d7b42d26948f5013b6985ec2c4e5beac3 (patch)
treec17580543d79c8eeeb036ef1e0ba447b287e0c2d
parent7fc4d0ce2bce6e896ad4aa5d16348f14e5039189 (diff)
downloadhercules-d689201d7b42d26948f5013b6985ec2c4e5beac3.tar.gz
hercules-d689201d7b42d26948f5013b6985ec2c4e5beac3.tar.bz2
hercules-d689201d7b42d26948f5013b6985ec2c4e5beac3.tar.xz
hercules-d689201d7b42d26948f5013b6985ec2c4e5beac3.zip
Changed set_reg behavior on pc_setparam failure, now it won't simply END the script, if
a dialog window is open it'll also CLOSE it. Corrected Zeny formula in THQS
-rw-r--r--npc/custom/quests/thq/THQS_TTShop.txt30
-rw-r--r--src/map/script.c6
2 files changed, 25 insertions, 11 deletions
diff --git a/npc/custom/quests/thq/THQS_TTShop.txt b/npc/custom/quests/thq/THQS_TTShop.txt
index f25b09c7b..266a20cb5 100644
--- a/npc/custom/quests/thq/THQS_TTShop.txt
+++ b/npc/custom/quests/thq/THQS_TTShop.txt
@@ -3,7 +3,7 @@
//===== By: ==================================================
//= Fredzilla
//===== Current Version: =====================================
-//= 1.1
+//= 1.2a
//===== Description: =========================================
//= Start for Treasure hunter quests
//===== Additional Comments: =================================
@@ -13,6 +13,7 @@
//= 1.1 - balanced some prices, fixed 1 missing label
//= removed Executioner&Mysteltain swords [Lupus]
//= 1.2 - Optmized and fixed small error [Panikon]
+//= 1.2a - Fixed zeny formula [Panikon]
//============================================================
prt_in,159,172,0 warp thqwrp 3,3,yuno_in01,123,155
@@ -60,21 +61,30 @@ OnInit:
// Trades tokens
// getarg(0) - number of tokens to be traded
function script thqs_trade_token {
- .@type = getarg(0);
- if( .@type == 4 )
+ @type = getarg(0);
+ if( @type == 4 )
close;
+
+ // 10^0, 10^1, 10^2
+ @type -= 1;
+ @price = pow(10, @type);
+
// 10^3, 10^4, 10^5
- .@type += 2; // So we can use pow later to determine the qt of Zeny
+ @type += 3; // So we can use pow later to determine the qt of Zeny
+ @prize = pow(1000, @type);
- if( #Treasure_Token < .@type ) {
+ if( #Treasure_Token < @price ) {
mes "You don't have enough tokens!";
close;
}
- mes ".@type "+.@type;
-
- mes "pow(1000,.@type);" + pow(10,.@type);
- #Treasure_Token -= .@type;
- Zeny += pow(1000,.@type);
+
+ if( Zeny == MAX_ZENY ) {
+ mes "You can't add more zeny to your character";
+ close;
+ }
+
+ Zeny += @prize;
+ #Treasure_Token -= @price;
close;
}
diff --git a/src/map/script.c b/src/map/script.c
index 4195e40fc..b432e6720 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -2924,7 +2924,11 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co
if( st != NULL ) {
ShowError("script:set_reg: failed to set param '%s' to %d.\n", name, val);
script->reportsrc(st);
- st->state = END;
+ // Instead of just stop the script execution we let the character close
+ // the window if it was open.
+ st->state = (sd->state.dialog) ? CLOSE : END;
+ if( st->state == CLOSE )
+ clif->scriptclose(sd, st->oid);
}
return 0;
}