summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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;
}