summaryrefslogtreecommitdiff
path: root/npc/merchants/grandpa_pharmacist.txt
blob: 869ef036e25cd3296b16cbf2404a015a314a95ee (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
//===== eAthena Script =======================================
//= Grandpa Pharmacist
//===== By: ==================================================
//= kobra_k88
//===== Current Version: =====================================
//= 1.2
//===== Compatible With: =====================================
//= eAthena 7.15 +
//===== Description: =========================================
//= Trade in items for potions
//===============================
//= Breakdown of arguments used
//= arg(0): first item id#
//= arg(1): 2nd item id# if needed, or else use 0
//= arg(2): zeny cost
//= arg(3): potion id#
//= arg(4): potion name
//===== Additional Comments: =================================
//= Fully working
//= 1.1 Negative input bug fixed [Lupus]
//= 1.2 Created a subfunc for the potion making part.  Added more
//= input/zeny exploit checks. Added Lupus's "loopless" technique.[kobra_k88]
//============================================================


alberta_in.gat,16,28,4	script	Grampa Pharmacist	61,{
	mes "[Grampa Pharmacist]";
	mes "Hmmm... what do you want...?";
	next;
	menu "Make Potion",M_Make, "Talk",M_Talk, "Information",M_Info, "Cancel",M_End;
	
	M_Make:
		mes "[Grampa Pharmacist]";
		mes "Did you prepare all the items needed? If so what potion do you want?";
		M_Menu:
		next;
		menu "Red Potion",M_0, "Orange Potion",M_1, "Yellow Potion",M_2,
			 "White Potion",M_3, "Blue Potion",M_4, "Green Potion",M_5,
			 "Nah, I change my mind.",M_End;
		
		M_0:
			callsub sF_Make, 507, 0, 2, 501, "red";
			goto M_Menu;
		M_1:
			callsub sF_Make, 507, 508, 5, 502, "orange";
			goto M_Menu;
		M_2:
			callsub sF_Make, 508, 0, 10, 503, "yellow";
			goto M_Menu;
		M_3:
			callsub sF_Make, 509, 0, 20, 504, "white";
			goto M_Menu;
		M_4:
			callsub sF_Make, 510, 0, 30, 505, "blue";
			goto M_Menu;
		M_5:
			callsub sF_Make, 511, 0, 3, 506, "green";
			goto M_Menu;

	M_Talk:
		mes "[Grampa Pharmacist]";
		mes "The right type of medicinal Herbs can replenish a person's HP or SP";
		mes ". ~Sigh~ I'm starting to reminisce about my youth.... a sign that I";
		mes "must be getting old.....";
		next;
		mes "[Grampa Pharmacist]";
		mes "... A potion is merely an, 'easy to use', form of medicinal  Herbs";
		mes "..... nothing more and nothing less.";
		close;
	M_Info:
		mes "[Grampa Pharmacist]";
		mes "~Sigh~... you young ones can be quite bothersome.. Fine, I will";
		mes "explain to you how potions work....";
		next;
		mes "[Grampa Pharmacist]";
		mes "Though the bennefits from consuming the various Herbs found around";
		mes "Rune-Midgard are great... by refining them into potions, the";
		mes "effects of the Herbs are dramatically enhanced.";
		next;
		mes "[Grampa Pharmacist]";
		mes "The process of refining herbs into potions is a special one that I";
		mes "created.  For a small fee I can make any potion you desire.";
		next;
		mes "[Grampa Pharmacist]";
		mes "^FF5533Red Potion^000000 - 2 Red Herbs, 1 Empty Bottle, 2 Zeny fee.";
		mes "^FF8000Orange Potion^000000 - 1 Red Herb, 1 Yellow Herb, 1 Empty Bottle, 5 Zeny fee.";
		mes "^E8CF20Yellow Potion^000000 - 2 Yellow Herbs, 1 Empty Bottle, 10 Zeny fee.";
		next;
		mes "[Grampa Pharmacist]";
		mes "^999999White Potion^000000 -  2 White Herbs, 1 Empty Bottle, 20 Zeny fee.";
		mes "^3355FFBlue Potion^000000 - 2 Blue Herbs, 1 Empty Bottle, 30 Zeny fee.";
		mes "^00B000Green Potion^000000 - 2 Green Herbs, 1 Empty Bottle, 3 Zeny fee.";
		close;
	M_End:
		mes "[Grampa Pharmacist]";
		mes "Didn't you have something to say?!";
		close;

// Subfunction for making potions
//================================
sF_Make:
	set @herbnum, 2;
	if(getarg(1) != 0) set @herbnum, 1;
	if(countitem(getarg(0)) < @herbnum) goto L_NdHerbs;
	if(getarg(1) != 0) if(countitem(getarg(1)) < @herbnum) goto L_NdHerbs;
	if(countitem(713) < 1) goto L_NdBottle;
	if(Zeny < getarg(2)) goto L_NdZeny;

	mes "[Grampa Pharmacist]";
	mes "How many?";
	next;
	menu "As many as possible.",sM_0a, "I will set the amount.",sM_0b, "Nah, forget about it",M_End;

	sM_0a:
		set @amount, 1000;
		if(zeny/getarg(2) < @amount) set @amount, zeny/getarg(2);
		if(countitem(getarg(0))/@herbnum < @amount) set @amount, countitem(getarg(0))/@herbnum;
		if(getarg(1) != 0) if (countitem(getarg(1))/@herbnum < @amount) set @amount, countitem(getarg(1))/@herbnum;
		if(countitem(713) < @amount) set @amount, countitem(713);
		if(@amount > 0) goto L_End;
		mes "[Grampa Pharmacist]";
		mes "Jeez... you don't even have the right items.....";
		close;
		
	sM_0b:
		input @amount;
		if(@amount<1 || @amount>1000) goto L_BadAmnt;
		if(countitem(getarg(0))/@herbnum < @amount) goto L_NdHerbs;
		if(getarg(1) != 0) if (countitem(getarg(1))/@herbnum < @amount) goto L_NdHerbs;
		if(countitem(713) < @amount) goto L_NdBottle;
		if(Zeny < (getarg(2)*@amount)) goto L_NdZeny;

	L_End:
		set Zeny, Zeny - (getarg(2)*@amount);
		delitem getarg(0), (@amount*@herbnum);
		if(getarg(1) != 0) delitem getarg(1), (@amount*@herbnum);
		delitem 713, @amount;
		getitem getarg(3), @amount;
		mes "[Grampa Pharmacist]";
		mes "Here are your " +getarg(4)+ " potions.";
		close;

	L_NdBottle:
		mes "[Grampa Pharmacist]";
		mes "You don't have enough empty bottles to put the medicine in you idiot!!";
		return;

	L_NdHerbs:
		mes "[Grampa Pharmacist]";
		mes "You rascal! What did you expect from me? You didn't even bring all of the right herbs!";
		return;

	L_NdZeny:
		mes "[Grampa Pharmacist]";
		mes "You don't have enough zeny for that many potions.";
		return;

	L_BadAmnt:
		mes "[Grampa Pharmacist]";
		mes "What?! That's not a valid amount!";	
		return;
}