summaryrefslogtreecommitdiff
path: root/npc/merchants/advanced_refiner.txt
blob: 9632f95f774a2b7b6caf1a8ca580741248564207 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
//================= Hercules Script =======================================
//=       _   _                     _
//=      | | | |                   | |
//=      | |_| | ___ _ __ ___ _   _| | ___  ___
//=      |  _  |/ _ \ '__/ __| | | | |/ _ \/ __|
//=      | | | |  __/ | | (__| |_| | |  __/\__ \
//=      \_| |_/\___|_|  \___|\__,_|_|\___||___/
//================= License ===============================================
//= This file is part of Hercules.
//= http://herc.ws - http://github.com/HerculesWS/Hercules
//=
//= Copyright (C) 2012-2015  Hercules Dev Team
//= Copyright (C)  Euphy
//= Copyright (C)  Yommy
//= Copyright (C)  Zephyrus
//= Copyright (C)  L0ne_W0lf
//=
//= Hercules is free software: you can redistribute it and/or modify
//= it under the terms of the GNU General Public License as published by
//= the Free Software Foundation, either version 3 of the License, or
//= (at your option) any later version.
//=
//= This program is distributed in the hope that it will be useful,
//= but WITHOUT ANY WARRANTY; without even the implied warranty of
//= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//= GNU General Public License for more details.
//=
//= You should have received a copy of the GNU General Public License
//= along with this program.  If not, see <http://www.gnu.org/licenses/>.
//=========================================================================
//= Advanced Refiner
//================= Description ===========================================
//= Refiner that uses Enriched ores to increase upgrade success.
//================= Additional Comments ===================================
//= After a conversation with Doddler, it's been established that the
//= advanced refiner works similar the the "Bubble Gum" item.
//= The success percentage is not "increased" however, if it fails you get
//= a second try. This tries twice at the same time, effectively giving you
//= a re-roll on your attempt.
//= - Dialog is only partly official to iRO.
//= - Uses the iRO position for this NPC.
//================= Current Version =======================================
//= 1.5
//=========================================================================

payon,157,146,6	script	Suhnbi#cash	4_M_03,{
	disable_items;
	mes "[Suhnbi]";
	mes "I am the Armsmith";
	mes "I can refine all kinds of weapons,";
	mes "armor and equipment, so let me";
	mes "know what you want to refine.";
	next;

	setarray .@position$[1], "Head","Body","Left hand","Right hand","Robe","Shoes","Accessory 1","Accessory 2","Head 2","Head 3";
	.@menu$ = "";
	for(.@i = 1; .@i<=10; ++.@i) {
		if (getequipisequiped(.@i)) {
			.@menu$ += .@position$[.@i] + "-" + "[" + getequipname(.@i) + "]";
			.@equipped = 1;
		}
		.@menu$ += ":";
	}
	if (.@equipped == 0) {
		mes "[Suhnbi]";
		mes "I don't think I can refine any items you have...";
		close;
	}
	.@part = select(.@menu$);

	if (!getequipisequiped(.@part)) //custom check
		close;
	if (!getequipisenableref(.@part)) {
		mes "[Suhnbi]";
		mes "Go find another Blacksmith. You can't refine this thing.";
		close;
	}
	if (getequiprefinerycnt(.@part) >= 10) {
		mes "[Suhnbi]";
		mes "Hmm... someone perfected this already. I don't think I can work on it further.";
		close;
	}

	// Make sure you have the neccessary items and Zeny to refine your items
	// Determines chance of failure and verifies that you want to continue.
	switch(getequipweaponlv(.@part)) {
		case 1: callsub S_RefineValidate,1,7620,50,.@part; break;
		case 2: callsub S_RefineValidate,2,7620,200,.@part; break;
		case 3: callsub S_RefineValidate,3,7620,5000,.@part; break;
		case 4: callsub S_RefineValidate,4,7620,20000,.@part; break;
		default: callsub S_RefineValidate,0,7619,2000,.@part; break;
	}

	mes "[Suhnbi]";
	mes "Clang! Clang! Clang!";
	if (getequippercentrefinery(.@part, REFINE_CHANCE_TYPE_ENRICHED) > rand(100)) {
		successrefitem .@part;
		next;
		emotion e_no1;
		mes "[Suhnbi]";
		mes "There you go! It's done.";
		mes "It's been a while since I've made such a fine "+((getequipweaponlv(.@part))?"weapon":"armor")+". You must be happy because it has become stronger!";
		close;
	}
	failedrefitem .@part;
	next;
	emotion (!rand(5))?e_cash:e_omg;
	mes "[Suhnbi]";
	mes "Uuuuuuuuuummmmmph!!!";
	next;
	mes "[Suhnbi]";
	mes "...";
	mes ".....";
	mes ".......Huhuhuhuhu~";
	mes "........It was your choice and my ability, no regret.";
	close;

S_RefineValidate:
	mes "[Suhnbi]";
	if (getarg(0))
		mes "You want to refine a level " + getarg(0) + " weapon?";
	mes "To refine that, you'll need to have one ^ff9999" + getitemname(getarg(1)) + "^000000 and " + getarg(2) + " zeny.";
	mes "Would you like to continue?";
	next;
	if(select("Yes", "No") == 1) {
		if (getequippercentrefinery(getarg(3), REFINE_CHANCE_TYPE_ENRICHED) < 100) {
			if (getarg(0)) {
				mes "[Suhnbi]";
				mes "Wow!!";
				mes "This weapon probably";
				mes "looks like it's been refined...";
				mes "many times...";
				mes "It may break if";
				mes "you refine it again.";
				next;
				mes "And if it breaks,";
				mes "you can't use it anymore!";
				mes "All the cards in it and the properties ^ff0000will be lost^000000!";
				mes "^ff0000Besides, the equipment will break!^000000";
				mes "Are you sure you still want to continue?";
				next;
				if(select("Yes", "No") == 2) {
					mes "[Suhnbi]";
					mes "Good.";
					mes "Because if the weapon breaks from unreasonable refining, then I get a bad mood, too.";
					close;
				}
			} else {
				mes "[Suhnbi]";
				mes "Giggle. Giggle. Oh, you have guts, daring to refine this.";
				mes "You know it's pretty risky, don't you?";
				next;
				mes "If your defensive equipment is broken, you'll never be able to use it again.";
				mes "Even your cards and your modifications will ^ff0000completely disappear^000000.";
				//mes "Everything will disappear. As in... GONE!";
				mes "Do you really wish to continue?";
				next;
				if(select("Yes", "No") == 2) {
					mes "[Suhnbi]";
					mes "What nonsense. You waste my precious time.";
					mes "Get lost, punk.";
					close;
				}
			}
		}
		if (countitem(getarg(1)) > 0 && Zeny > getarg(2)) {
			delitem getarg(1),1;
			Zeny -= getarg(2);
			return;
		}
		mes "[Suhnbi]";
		mes "Are these all you have?";
		mes "I'm very sorry, but I can't do anything without all the materials. Besides, I deserve some payments for my work, don't I?";
		close;
	}
	mes "[Suhnbi]";
	mes "I can't help it even if you're not happy about it...";
	close;
}