summaryrefslogtreecommitdiff
path: root/npc/005-4/tolchi.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/005-4/tolchi.txt')
-rw-r--r--npc/005-4/tolchi.txt94
1 files changed, 94 insertions, 0 deletions
diff --git a/npc/005-4/tolchi.txt b/npc/005-4/tolchi.txt
index 133e6a3fe..117ae7ad8 100644
--- a/npc/005-4/tolchi.txt
+++ b/npc/005-4/tolchi.txt
@@ -20,6 +20,7 @@
function quest_second;
function quest_third;
function tolchi_arrows;
+ function tolchi_tweaks;
/////////////////////////////////////////////////////////////////////////////
@q = getq(CandorQuest_Tolchi);
@@ -61,6 +62,9 @@
case 4:
quest_third();
break;
+ case 5:
+ tolchi_tweaks();
+ break;
default:
quest_close();
goodbye;
@@ -230,6 +234,96 @@ function tolchi_arrows {
close;
}
+// Supreme Tweaking
+function tolchi_tweaks {
+ // Price: the sky is the limit
+ .@price=max(120, 200-(@q*25));
+ mesn;
+ mes l("Hmm, no, not really. However, I can try my hand at tweaking an item options :3");
+ next;
+ mesn;
+ mesq l("Options are %s. Any craftsman can make them. Adventurers tend to be the best craftsman in the world.", b(l("item dependant bonuses")));
+ next;
+ mesn;
+ mesq l("Usually you can only tweak if the item already have another option, but I am Tolchi. So, which item you want to tweak?");
+ next;
+
+ // Request and confirm
+ .@id=requestitemindex();
+ if (!csys_Confirm(.@id))
+ return false;
+
+ // Find numeric ID
+ delinventorylist();
+ getinventorylist();
+ .@handle=@inventorylist_id[.@id];
+
+ // Multiple
+ if (countitem(.@handle) != 1) {
+ mesn;
+ mesq l("Sorry, but you have multiple %s.", getitemlink(.@handle));
+ close;
+ }
+
+ // Calculate price
+ .@lv=getiteminfo(.@handle, ITEMINFO_ELV);
+ .@price=.@lv**3; // Cubic function to determine price.
+ // Lv 1: 3 GP | Lv 10: 1kGP | Lv 20: 8kGP | Lv 40: 64kGP | Lv 60: 216kGP
+ // Lv 80: 512k GP | Lv 100: 1 Million GP!
+ mesn;
+ mesq l("That will be %s GP. Are you sure?", col(format_number(.@price), 1));
+ next;
+
+ if (Zeny < .@price || askyesno() == ASK_NO) {
+ close2;
+ goodbye;
+ } else {
+ mes "";
+ // Okay, time to force a tweaking
+ Zeny=Zeny-.@price;
+
+ // Options which Tolchi knows
+ setarray .@vartps, 0,
+ IOPT_RICHNESS, 11,
+ IOPT_EXPGAIN, 9,
+ IOPT_CRITDMG, 25,
+ VAR_HPACCELERATION, 30,
+ VAR_MAXHPAMOUNT, 35;
+
+ // Select a bonus and purge it
+ .@vartp=relative_array_random(.@vartps);
+ .@popindex=getarrayindex(.@vartp);
+ deletearray(.@popindex, 1);
+ deletearray(.@popindex, 1);
+
+ // Apply the bonus
+ setitemoptionbyindex(.@id, 0, .@vartp, .@bonus);
+
+ // Re-roll: Easier for lower levels. Equip based.
+ if (rand2(1000) < 250-(.@lv*2)) {
+ .@vartp=relative_array_random(.@vartps);
+ .@popindex=getarrayindex(.@vartp);
+ deletearray(.@popindex, 1);
+ deletearray(.@popindex, 1);
+ setitemoptionbyindex(.@id, 1, .@vartp, .@bonus);
+ }
+
+ // Final re-roll: Easier for lower levels. Equip based. Nearly impossible.
+ if (rand2(10000) < 250-(.@lv*2)) {
+ .@vartp=relative_array_random(.@vartps);
+ .@popindex=getarrayindex(.@vartp);
+ deletearray(.@popindex, 1);
+ deletearray(.@popindex, 1);
+ setitemoptionbyindex(.@id, 1, .@vartp, .@bonus);
+ }
+
+ mesn;
+ mesc l("Well, here you are. I hope you enjoy ^^", 3);
+ close;
+ }
+ close;
+}
+
OnTimer1000:
domovestep;