diff options
Diffstat (limited to 'npc/merchants/grandpa_pharmacist.txt')
-rw-r--r-- | npc/merchants/grandpa_pharmacist.txt | 162 |
1 files changed, 162 insertions, 0 deletions
diff --git a/npc/merchants/grandpa_pharmacist.txt b/npc/merchants/grandpa_pharmacist.txt new file mode 100644 index 000000000..bad02c3f1 --- /dev/null +++ b/npc/merchants/grandpa_pharmacist.txt @@ -0,0 +1,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((countitem(getarg(1)) < @herbnum) && (getarg(1) != 0)) 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((countitem(getarg(1))/@herbnum < @amount) && (countitem(getarg(1)) != 0)) 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((countitem(getarg(1))/@herbnum < @amount) && (countitem(getarg(1)) != 0)) goto L_NdHerbs;
+ if(countitem(713) < @amount) goto L_NdBottle;
+ if(Zeny < (getarg(2)*@amount)) goto L_NdZeny;
+
+ L_End:
+ mes "[Grampa Pharmacist]";
+ mes "Here are your " +getarg(4)+ " potions.";
+ delitem getarg(0), (@amount*@herbnum);
+ if(getarg(1) != 0) delitem getarg(1), (@amount*@herbnum);
+ delitem 713, @amount;
+ set Zeny, Zeny - (getarg(2)*@amount);
+ getitem getarg(3), @amount;
+ 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;
+}
|