summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-08 16:31:39 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-09-08 16:31:39 +0000
commit6df9ad7456c42dfc676822492130cc5f2575fe2f (patch)
tree8c7b533d5c74c5fdce505725e2c72554b6333422
parentee0cda87300b753d6877b9340970d70e42567dfe (diff)
downloadhercules-6df9ad7456c42dfc676822492130cc5f2575fe2f.tar.gz
hercules-6df9ad7456c42dfc676822492130cc5f2575fe2f.tar.bz2
hercules-6df9ad7456c42dfc676822492130cc5f2575fe2f.tar.xz
hercules-6df9ad7456c42dfc676822492130cc5f2575fe2f.zip
Made the checks in the dye maker npc more dynamic (also fixes missing 'countitem' bug)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11145 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--npc/merchants/dye_maker.txt45
1 files changed, 28 insertions, 17 deletions
diff --git a/npc/merchants/dye_maker.txt b/npc/merchants/dye_maker.txt
index d6753d3f1..4449c14a5 100644
--- a/npc/merchants/dye_maker.txt
+++ b/npc/merchants/dye_maker.txt
@@ -3,7 +3,7 @@
//===== By: ==================================================
//= eAthena Dev Team
//===== Current Version: =====================================
-//= 1.2b
+//= 1.3
//===== Compatible With: =====================================
//= eAthena SVN
//===== Description: =========================================
@@ -13,6 +13,7 @@
//= 1.1 Spell Checked [Nexon]
//= 1.2 Rescripted to Aegis 10.3 standard. [L0ne_W0lf]
//= 1.2b Fixed typos in variable names [ultramage]
+//= 1.3 Made the checks more dynamic [ultramage]
//============================================================
morocc_in,146,99,3 script Java Dullihan 58,{
@@ -101,49 +102,57 @@ S_MakeDye:
switch(getarg(0)) {
case 1:
mes "Mmm... I need 30 Red Herbs, 1 Counteragent, and 1 Empty Bottle to make Red Dyestuffs. The fee is only 3000 zeny to make it.";
- setarray .@item[0], 507,30, 0,0, 0,0, 0,0, 0,0;
+ setarray .@item[0], 507, 973, 713;
+ setarray .@count[0], 30, 1, 1;
set .@cost,3000;
set .@dyestuff,975;
break;
case 2:
mes "Mmm... I need 30 Yellow Herbs, 1 Couneragent, and 1 Empty Bottle to make Lemon Dyestuffs. The fee is only 3000 zeny to make it.";
- setarray .@item[0], 508,30, 0,0, 0,0, 0,0, 0,0;
+ setarray .@item[0], 508, 973, 713;
+ setarray .@count[0], 30, 1, 1;
set .@cost,3000;
set .@dyestuff,976;
break;
case 3:
mes "Mmm... I need 20 Blue Herbs, 1 Counteragent, and 1 Empty Bottle to make Cobaltblue Dyestuff. It's hard to use the Blue Herb, so the fee is going to be 3500 zeny.";
- setarray .@item[0], 510,20, 0,0, 0,0, 0,0, 0,0;
+ setarray .@item[0], 510, 973, 713;
+ setarray .@count[0], 20, 1, 1;
set .@cost,3500;
set .@dyestuff,978;
break;
case 4:
mes "Mmm... I need 5 Blue Herbs, 20 Green Herbs, 20 Yellow Herbs, 1 Counteragent, 1 Mixture, and 1 Empty Bottle to make Darkgreen Dyestuffs. Don't get all of the materials confused. The fee is only 5000 zeny.";
- setarray .@item[0], 510,5, 511,20, 508,20, 974,1, 0,0;
+ setarray .@item[0], 510, 511, 508, 974, 973, 713;
+ setarray .@count[0], 5, 20, 20, 1, 1, 1;
set .@cost,5000;
set .@dyestuff,979;
break;
case 5:
mes "Mmm... I need 20 Red Herbs, 20 Yellow Herbs, 1 Counteragent, 1 Mixture, and 1 Empty Bottle to make Orange Dyestuff. The fee is going to be 5000 zeny.";
- setarray .@item[0], 507,20, 508,20, 974,1, 0,0, 0,0;
+ setarray .@item[0], 507, 508, 974, 973, 713;
+ setarray .@count[0], 20, 20, 1, 1, 1;
set .@cost,5000;
set .@dyestuff,980;
break;
case 6:
mes "Mmm... I need 10 Blue Herbs, 30 Red Herbs, 1 Counteragent, 1 Mixture, and 1 Empty Bottle to make Violet Dyestuffs. The fee will be 5000 zeny.";
- setarray .@item[0], 510,10, 507,30, 974,1, 0,0, 0,0;
+ setarray .@item[0], 510, 507, 974, 973, 713;
+ setarray .@count[0], 10, 30, 1, 1, 1;
set .@cost,5000;
set .@dyestuff,981;
break;
case 7:
mes "Mmm... I need 30 White Herbs, 1 Counteragent, and 1 Empty bottle to make White Dyestuffs. The fee will be 3000 zeny.";
- setarray .@item[0], 509,30, 0,0, 0,0, 0,0, 0,0;
+ setarray .@item[0], 509, 973, 713;
+ setarray .@count[0], 30, 1, 1;
set .@cost,3000;
set .@dyestuff,982;
break;
case 8:
mes "Mmm... I need 30 of each Red, Yellow, and Green Herb, 5 Blue Herbs, 1 Counteragent, 1 Mixture, and 1 Empty Bottle. The process takes longer and more effort than the others, so it is going to be 7000 zeny.";
- setarray .@item[0], 507,30, 508,30, 511,30, 510,5, 974,1;
+ setarray .@item[0], 507, 508, 511, 510, 974, 973, 713;
+ setarray .@count[0], 30, 30, 30, 5, 1, 1, 1;
set .@cost,7000;
set .@dyestuff,983;
break;
@@ -158,21 +167,23 @@ S_MakeDye:
}
next;
if (select("Make Dyestuffs:Cancel") == 1) {
- if (.@item[0] < .@item[1] || .@item[2] < .@item[3] || .@item[4] < .@item[5] || .@item[6] < .@item[7] || .@item[8] < .@item[9] || countitem(973)== 0 || countitem(713) == 0 || Zeny < .@cost) {
+ set .@size, getarraysize(.@item);
+ // check requirements
+ for (set .@i,0 ; .@i < .@size ; set .@i,.@i+1)
+ countitem(.@item[.@i]) >= .@count[.@i];
+ if (.@i < .@size || Zeny < .@cost) {
mes "[Dye Maker Java Dullihan]";
mes "Hmmm. Not enough...";
mes "I don't think I'll be able to make the color you want with those materials. Why don't you go get some more materials...?";
close;
}
- delitem .@item[0],.@item[1];
- delitem .@item[2],.@item[3];
- delitem .@item[4],.@item[5];
- delitem .@item[6],.@item[7];
- delitem .@item[8],.@item[9];
- delitem 973,1; //Counteragent
- delitem 713,1; //Empty Bottle
+ // delete items
+ for (set .@i, 0; .@i < .@size ; set .@i, .@i+1)
+ delitem .@item[.@i], .@count[.@i];
set zeny,zeny-.@cost;
+ // get dyestuff
getitem .@dyestuff,1;
+
mes "[Dye Maker Java Dullihan]";
mes "Hmm... It came out pretty well. A very rich color. Of course I'll be trying harder to make a more charming color...";
next;