Browse Source

commonized ammo_boxes.txt ammo_dealer.txt kunai_maker.txt

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10696 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lupus 18 years ago
parent
commit
ce8c510e51
4 changed files with 62 additions and 82 deletions
  1. 1 0
      npc/Changelog.txt
  2. 24 28
      npc/merchants/ammo_boxes.txt
  3. 21 24
      npc/merchants/ammo_dealer.txt
  4. 16 30
      npc/merchants/kunai_maker.txt

+ 1 - 0
npc/Changelog.txt

@@ -1,6 +1,7 @@
 Date		Added
 ======
 2007/06/05
+	* Optimized, commonized and got rid of extra @vars: ammo_boxes.txt,ammo_dealer.txt,kunai_maker.txt [Lupus]
 	* Fixed a bug in Thanatos Tower quest. [SinSloth]
 2007/06/04
 	* Updated versions in some merchants scripts [Lupus]

+ 24 - 28
npc/merchants/ammo_boxes.txt

@@ -39,23 +39,21 @@ que_ng,187,149,3	script	Magazine Dealer Kenny	83,{
 	mes "Spheres at a lower weight!";
 	mes "Come on! Take a look!";
 	next;
-	switch( select( "Lightning Sphere Pack","Blind Sphere Pack","Poison Sphere Pack","Freezing Sphere Pack","Flare Sphere Pack","Bullet Casing","Shell of Blood Casing","Silver Bullet Casing","Cancel" ))
-	{
-		case 1: callfunc "Func_Casing",13204,12144; break;
-		case 2: callfunc "Func_Casing",13206,12145; break;
-		case 3: callfunc "Func_Casing",13205,12146; break;
-		case 4: callfunc "Func_Casing",13207,12147; break;
-		case 5: callfunc "Func_Casing",13203,12148; break;
-		case 6: callfunc "Func_Casing",13200,12149; break;
-		case 7: callfunc "Func_Casing",13202,12150; break;
-		case 8: callfunc "Func_Casing",13201,12151; break;
-		case 9: 
-		default:
-			mes "[Kenny]";
-			mes "Alright. If there's";
-			mes "something else I can help";
-			mes "you with, please tell me.";
-			close;
+	switch(select("Lightning Sphere Pack","Blind Sphere Pack","Poison Sphere Pack","Freezing Sphere Pack","Flare Sphere Pack","Bullet Casing","Shell of Blood Casing","Silver Bullet Casing","Cancel")) {
+	case 1: callfunc "Func_Casing",13204,12144; break;
+	case 2: callfunc "Func_Casing",13206,12145; break;
+	case 3: callfunc "Func_Casing",13205,12146; break;
+	case 4: callfunc "Func_Casing",13207,12147; break;
+	case 5: callfunc "Func_Casing",13203,12148; break;
+	case 6: callfunc "Func_Casing",13200,12149; break;
+	case 7: callfunc "Func_Casing",13202,12150; break;
+	case 8: callfunc "Func_Casing",13201,12151; break;
+	default:
+		mes "[Kenny]";
+		mes "Alright. If there's";
+		mes "something else I can help";
+		mes "you with, please tell me.";
+		close;
 	}
 	close;
 }
@@ -77,30 +75,28 @@ function	script		Func_Casing	{
 	mes "You can trade a maximum of 50.";
 	mes "Input 0 if you want to cancel.";
 	next;
-	input .@caser_amount;
+	input .@amount;
 	mes "[Kenny]";
-	if(.@caser_amount < 1) {
+	if(.@amount < 1) {
 		mes "Alright. If there's";
 		mes "something else I can help";
 		mes "you with, please tell me.";
 		close;
 	}
-	if(.@caser_amount > 50)	{
+	if(.@amount > 50)	{
 		mes "You've exceeded the limit!";
 		mes "Try again next time?";
 		close;
 	}
-	set .@caser_bullet, .@caser_amount * 500;
-	
 	//Weight checking
-	if(checkweight(getarg(1), .@caser_amount) != 1)	{
+	if(checkweight(getarg(1), .@amount) != 1)	{
 		mes "You are overweight.";
 		mes "Please clear your inventory.";
 		close;
 	}
 	
 	//Materials checking
-	if(countitem(getarg(0)) < .@caser_bullet) {
+	if(countitem(getarg(0)) < .@amount * 500) {
 		mes "Huh......";
 		mes "You don't have enough";
 		mes "materials to trade for";
@@ -111,7 +107,7 @@ function	script		Func_Casing	{
 	}
 	
 	//Zeny checking
-	if(Zeny < .@caser_bullet) {
+	if(Zeny < .@amount * 500) {
 		mes "Erm... You don't have enough money.";
 		mes "The fee is 500 zeny";
 		mes "Check your zeny and come again.";
@@ -124,8 +120,8 @@ function	script		Func_Casing	{
 		mes "I'll get you the Packs right away.";
 	else
 		mes "I'll get you the Casings right away.";
-	set Zeny, Zeny - .@caser_bullet;
-	delitem getarg(0), .@caser_bullet;
-	getitem getarg(1), .@caser_amount;
+	set Zeny, Zeny - .@amount * 500;
+	delitem getarg(0), .@amount * 500;
+	getitem getarg(1), .@amount;
 	close;
 }

+ 21 - 24
npc/merchants/ammo_dealer.txt

@@ -13,7 +13,7 @@
 //= 1.1 Converted from Aegis [Paradox924X]
 //= 1.2 More optimized conversion [Legionaire]
 //= 1.2a Removed .GATs [Lupus]
-//= 1.3 Fixed [Playtester]
+//= 1.3 Fixed [Playtester] Optimized. Got rid of @vars [Lupus]
 //============================================================
 
 que_ng,187,156,3	script	Bullet Dealer Tony	86,{
@@ -31,18 +31,18 @@ que_ng,187,156,3	script	Bullet Dealer Tony	86,{
 		mes "And pay money~!";
 		next;
 		switch(select("Poison Sphere:Flare Sphere:Lighting Sphere:Blind Sphere:Freezing Sphere:Cancel")) {
-			case 1: callfunc "Bullet_Trade",937,10,13205; break;
-			case 2: callfunc "Bullet_Trade",7097,2,13203; break;
-			case 3: callfunc "Bullet_Trade",7053,3,13204; break;
-			case 4: callfunc "Bullet_Trade",1024,5,13206; break;
-			case 5: callfunc "Bullet_Trade",7054,2,13207; break;
-			case 6:
-				mes "[Tony]";
-				mes "Mmm~ Okay~";
-				mes "Please visit again~";
-				mes "I, Bullet-tooth Tony,";
-				mes "Will always be here~!!!";
-				close;
+		case 1: callfunc "Bullet_Trade",937,10,13205; break;
+		case 2: callfunc "Bullet_Trade",7097,2,13203; break;
+		case 3: callfunc "Bullet_Trade",7053,3,13204; break;
+		case 4: callfunc "Bullet_Trade",1024,5,13206; break;
+		case 5: callfunc "Bullet_Trade",7054,2,13207; break;
+		default:
+			mes "[Tony]";
+			mes "Mmm~ Okay~";
+			mes "Please visit again~";
+			mes "I, Bullet-tooth Tony,";
+			mes "Will always be here~!!!";
+			close;
 		}
 	}
 	mes "I'm a trader who supplies";
@@ -70,27 +70,24 @@ function	script	Bullet_Trade	{
 	mes "The maximum number you can trade is 500.";
 	mes "If you want to cancel, input 0.";
 	next;
-	input .@input;
-	set @tony,.@input;
-	set @tony1,.@input;
-	set @tony2,.@input * getarg(1);
+	input .@amount;
 	mes "[Tony]";
-	if (.@input < 1 || .@input > 500) {
+	if (.@amount < 1 || .@amount > 500) {
 		mes "Invalid Amount!";
 		mes "Enter again~!";
 		close;
-	} else if ((countitem(1010) >= @tony) && (countitem(1011) >= @tony1) && (countitem(getarg(0)) >= @tony2)) {
-		if (checkweight(getarg(2),.@input * 30) == 0) {
+	} else if (countitem(1010) >= .@amount && countitem(1011) >= .@amount && countitem(getarg(0)) >= (.@amount*getarg(1))) {
+		if (checkweight(getarg(2),.@amount * 30) == 0) {
 			mes "I cannot give it to you because your inventory is full. Come back after your inventory has more space.";
 			close;
 		} else {
 			mes "Oh~ Good!";
 			mes "Trade number checked!";
 			mes "I'll trade immediately.";
-			delitem 1010,@tony;
-			delitem 1011,@tony1;
-			delitem getarg(0),@tony2;
-			getitem getarg(2),.@input * 30;
+			delitem 1010,.@amount;
+			delitem 1011,.@amount;
+			delitem getarg(0),.@amount * getarg(1);
+			getitem getarg(2),.@amount * 30;
 			close;
 		}
 	} else {

+ 16 - 30
npc/merchants/kunai_maker.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= eAthena dev team
 //===== Current Version: =====================================
-//= 1.2
+//= 1.2a
 //===== Compatible With: =====================================
 //= eAthena 1.0
 //===== Description: =========================================
@@ -14,22 +14,19 @@
 //=	  id of the 2 required items plus the amount. Can trade
 //= 	  up to 500 units (5,000 kunais) at once. [erKURITA]
 //= 1.1 Officialized script [Playtester]
-//= 1.2 Optimized/cleaned up a bit [ultramage]
+//= 1.2a Optimized/cleaned up a bit [ultramage]
 //============================================================
 
 que_ng,72,29,3	script	Kunai Merchant Kashin	83,{
-	
-	if(BaseJob != Job_Ninja)
-	{
-		mes "[Kashin]";
+
+	mes "[Kashin]";	
+	if(BaseJob != Job_Ninja) {
 		mes "I am Kashin of the Wind. I distribute trade items to the shadows.";
 		next;
 		mes "[Kashin]";
 		mes "It doesn't seem like you are a Ninja... Just take a good look around and be on your way.";
 		close;
 	}
-	
-	mes "[Kashin]";
 	mes "I'm Kashin!";
 	mes "If you're ever short on Shurikens, come and see me.";
 	next;
@@ -38,15 +35,13 @@ que_ng,72,29,3	script	Kunai Merchant Kashin	83,{
 	mes "Choose what you want.";
 	next;
 
-	switch(select("Poison Kunais:Frost Kunais:Wind Kunais:Earth Kunais:Fire Kunais:Cancel"))
-	{
+	switch(select("Poison Kunais:Frost Kunais:Wind Kunais:Earth Kunais:Fire Kunais:Cancel")) {
 	//usage: callfunc "Kunai_Trade",itemreqid1,itemreqct1,itemreqid2,itemreqct2,itemidtrade;
 	case 1: callfunc "Kunai_Trade",13250,20,7524,1,13259; break;
 	case 2: callfunc "Kunai_Trade",13251,8,7522,2,13255; break;
 	case 3: callfunc "Kunai_Trade",13252,4,7523,2,13257; break;
 	case 4: callfunc "Kunai_Trade",13253,2,7524,1,13256; break;
 	case 5: callfunc "Kunai_Trade",13254,1,7521,2,13258; break;
-	case 6:
 	default:
 		mes "[Kashin]";
 		mes "Hmm~ Ok~";
@@ -66,44 +61,35 @@ function	script	Kunai_Trade	{
 	mes "You can trade up to 500 packs at a time.";
 	mes "If you don't want to trade, just enter 0 as the amount.";
 	next;
+	input .@amount;
 
-	input .@trade;
-
-	if(.@trade < 1)
-	{
-		mes "[Kashin]";
+	mes "[Kashin]";
+	if(.@amount < 1) {
 		mes "Hmm~ Ok~";
 		mes "Come again~";
 		mes "I, Kashin of the Wind, will always be at this place.";
 		close;
 	}
-	if(.@trade > 500)
-	{
-		mes "[Kashin]";
+	if(.@amount > 500) {
 		mes "You've exceeded the input amount!";
 		mes "Enter a valid number next time~!";
 		close;
 	}
-	if(countitem(getarg(0)) < .@trade*getarg(1) || countitem(getarg(2)) < .@trade*getarg(3))
-	{
-		mes "[Kashin]";
+	if(countitem(getarg(0)) < .@amount*getarg(1) || countitem(getarg(2)) < .@amount*getarg(3)) {
 		mes "Hmm... this is no good~";
 		mes "You don't have enough materials to trade in for the amount of Kunai's that you want.";
 		mes "Bring some more if you want this amount.";
 		close;
  	}
-	if(checkweight(getarg(4), .@trade*10) == 0)
-	{
-		mes "[Kashin]";
+	if(checkweight(getarg(4), .@amount*10) == 0) {
 		mes "Your bag is too full to carry the trade items. Come back after you made room for the traded items.";
 		close;
 	}
-	mes "[Kashin]";
 	mes "Ok~ Very well!";
 	mes "Amount verified!";
 	mes "Here are your traded items.";
-	delitem getarg(0),getarg(1)*.@trade;
-	delitem getarg(2),getarg(3)*.@trade;
-	getitem getarg(4),10*.@trade;
+	delitem getarg(0),getarg(1)*.@amount;
+	delitem getarg(2),getarg(3)*.@amount;
+	getitem getarg(4),10*.@amount;
 	close;
-}
+}