Browse Source

Added "Merry Badger" NPC to iRO Eden, and other tweaks. (credits: @SkittleNugget, pull #44)
Follow-up 957f495: 'preg_match' will still be compiled for users with PCRE disabled. (tid:92024)

Signed-off-by: Euphy <euphy.raliel@rathena.org>

Euphy 11 năm trước cách đây
mục cha
commit
007b88f2bb
2 tập tin đã thay đổi với 198 bổ sung21 xóa
  1. 190 19
      npc/re/quests/eden/eden_iro.txt
  2. 8 2
      src/map/script.c

+ 190 - 19
npc/re/quests/eden/eden_iro.txt

@@ -3,7 +3,7 @@
 //===== By: ==================================================
 //= -SkittleNugget-
 //===== Current Version: =====================================
-//= 1.3
+//= 1.4
 //===== Compatible With: =====================================
 //= rAthena Project
 //===== Description: =========================================
@@ -14,6 +14,7 @@
 //= 1.1 Edited and added more NPCs, lots of placeholders. [Euphy]
 //= 1.2 Added VIP NPCs and features. [Euphy]
 //= 1.3 Added Mail Annex Station scripts, commented out. [Euphy]
+//= 1.4 Added Merry Badger. [Euphy/-SkittleNugget-]
 //============================================================
 
 // Acolyte Warper (part of other/acolyte_warp.txt)
@@ -141,6 +142,10 @@ moc_para01,26,15,3	script	Primo d'Buffer	790,{
 		mes "[Primo d'Buffer]";
 		mes "My orders are to help out any Adventurer marked as VIP with special Buffs!";
 		mes "Currently I will give you ^ff0000+7 to all of your Stats for 30 minutes^000000 if you are VIP.";
+		next;
+		mes "[Primo d'Buffer]";
+		mes "If you would like to be VIP, you can use WarpPortal to ^FF8C42Power-UP^000000 your game account with VIP Status. Of course there are many other advantages to being VIP, like higher EXP and Drop Rates, more Storage, and special buff NPCs like me!";
+		mes "Happy Journeys!";
 		close;
 	}
 	mes "I can also tell that you have been blessed with '^007FFFVIP Status^000000'.";
@@ -542,8 +547,7 @@ L_Exchange:
 		close;
 	}
 	mes "[Trader Machine]";
-	mes "That's a total of "+.@amount;
-	mes getitemname(getarg(2))+".";
+	mes "That's a total of "+.@amount+" "+getitemname(getarg(2))+".";
 	mes "Is this correct?";
 	next;
 	if(select("Yes, give them to me!:No, wait not yet.") == 2)
@@ -560,6 +564,185 @@ L_Exchange:
 	close;
 }
 
+// Merry Badger
+//============================================================
+moc_para01,13,22,4	script	Merry Badger#xch	882,{
+	mes "[Merry Badger]";
+	mes "Hello there!  I'm Merry Badger and I was hired to exchange the ^00CC00Eden Merit Badges^000000!";
+	next;
+	mes "[Merry Badger]";
+	mes "I can take your Merit Badges and give you some useful stuff, or I can take some of your stuff and give you some Eden Merit Badges.";
+	mes "As I get more authorization I can offer more things to trade with you, so definitely keep me in mind when visiting the Eden Group.";
+	next;
+	switch(select("Redeem Badges:Trade in FOR badges:Exchange Rates:15 Job Manuals - 1 JM Box")) {
+	case 1:
+		while(1) {
+			mes "[Merry Badger]";
+			mes "Sure thing, I have several options currently for your badges!";
+			next;
+			switch(select("This week's Special:2 EMB for 10 KVM Badge:2 EMB for 10 Bravery Medals:2 EMB for 10 Valor Medals:5 EMB for 5 Medium Life Potion:5 EMB for 5 Life Insurance:5 EMB for 5 Token of Siegfried:7 EMB for 1 Job Battle Manual:8 EMB for 1 Reset Stone:Nothing Now")){
+			case 1:
+				if (countitem(6495) < 3) {
+					mes "[Merry Badger]";
+					mes "You don't have enough ^00CC00Eden Merit Badges^000000. Let's start over!";
+					break;
+				}
+				mes "[Merry Badger]";
+				mes "Ok, I have a special for 3 Merit Badges. This week I'll give you ^00CC0040 Light Granule^000000, ^0066CC40 Gun Powder^000000, ^00CC003 Izidor^000000, ^0066CC10 Prickly Fruit^000000, ^00CC001 Mandragora Flowerpot^000000, and ^0066CC3 Elder Branch^000000.";
+				next;
+				switch(select("Yes:No")) {
+				case 1:
+					delitem 6495,3; //Para_Logro_Badge
+					getitem 7938,40; //Light_Granule
+					getitem 6244,40; //Gun_Power
+					getitem 709,3; //Izidor
+					getitem 576,10; //Prickly_Fruit
+					getitem 6217,1; //Mandragora_Flowerpot
+					getitem 7939,3; //Elder_Branch
+					mes "[Merry Badger]";
+					mes "There you go! What else would you like?";
+					break;
+				case 2:
+					mes "[Merry Badger]";
+					mes "I understand, let's see if you'd like something different!";
+					break;
+				}
+				break;
+			case 2:
+				callsub L_Exchange,2,6376,10; //KVM_Badge
+				break;
+			case 3:
+				callsub L_Exchange,2,7828,10; //BF_Badge1
+				break;
+			case 4:
+				callsub L_Exchange,2,7829,10; //BF_Badge2
+				break;
+			case 5:
+				callsub L_Exchange,5,14535,5; //Med_Life_Potion
+				break;
+			case 6:
+				callsub L_Exchange,5,12209,5; //Insurance
+				break;
+			case 7:
+				callsub L_Exchange,5,7621,5; //Token_Of_Siegfried
+				break;
+			case 8:
+				callsub L_Exchange,7,14592,1; //Job_Manual50
+				break;
+			case 9:
+				callsub L_Exchange,8,6320,1; //Premium_Reset_Stone
+				break;
+			case 10:
+				mes "[Merry Badger]";
+				mes "Wonderful!";
+				mes "I'll be here if you ever want to exchange for Eden Merit Badges!";
+				close;
+			}
+			next;
+		}
+	case 2:
+		mes "[Merry Badger]";
+		mes "I have a limited selection as of right now, but here is what I can offer to get 1 Eden Merit Badge!";
+		next;
+		switch(select("Etc Items:Cancel")) {
+		case 1:
+			while(1) {
+				switch(select("5x Old Purple Box:Nothing")) {
+				case 1:
+					mes "[Merry Badger]";
+					if (countitem(617) < 5)
+						mes "You don't have enough of that to get 1 Eden Merit Badge. Lets start over!";
+					else {
+						mes "Wonderful, what else do you want?"; //custom dialogue
+						delitem 617,5; //Old_Violet_Box
+						getitem 6495,1; //Para_Logro_Badge
+					}
+					break;
+				case 2:
+					mes "[Merry Badger]";
+					mes "Wonderful!";
+					mes "I'll be here if you ever want to exchange for Eden Merit Badges!";
+					close;
+				}
+				next;
+			}
+		case 2:
+			mes "[Merry Badger]";
+			mes "Well that is OK, if you want to see what I offer just ask!";
+			close;
+		}
+	case 3:
+		mes "[Merry Badger]";
+		mes "This is what I'll give you for your ^00CC00Eden Merit Badges^000000!";
+		mes "Ok, I have a special for 3 Merit Badges. This week I'll give you ^00CC0040 Light Granule^000000, ^0066CC40 Gun Powder^000000, ^00CC003 Izidor^000000, ^0066CC10 Prickly Fruit^000000, ^00CC001 Mandragora Flowerpot^000000, and ^0066CC3 Elder Branch^000000.";
+		mes "^00CC002 Eden Merit Badges^000000 = ^0066CC10x KVM Badge^000000";
+		mes "^00CC002 Eden Merit Badges^000000 = ^0066CC10x Bravery Medals^000000";
+		mes "^00CC002 Eden Merit Badges^000000 = ^0066CC10x Valor Medals^000000";
+		mes "^00CC005 Eden Merit Badges^000000 = ^0066CC5x Medium Life Potion^000000";
+		mes "^00CC005 Eden Merit Badges^000000 = ^0066CC5x Life Insurance^000000";
+		mes "^00CC005 Eden Merit Badges^000000 = ^0066CC5x Token Of Siegfried^000000";
+		mes "^00CC007 Eden Merit Badges^000000 = ^0066CC1x Job Battle Manual^000000";
+		mes "^00CC008 Eden Merit Badges^000000 = ^0066CC1x Reset Stone^000000";
+		next;
+		mes "[Merry Badger]";
+		mes "This is what you can give me to get ^00CC001 Eden Merit Badge^000000!";
+		mes "^0066CC5x Old Purple Box^000000";
+		close;
+	case 4:
+		mes "[Merry Badger]";
+		mes "I was strong armed into giving this, but you are worth it!";
+		mes "Do you want to exchange 15 Job Manuals to get 1 Tradable box of 10 Job Manuals?";
+		mes "I know 15 does not equal 10, but boxes are expensive you know.";
+		next;
+		if (countitem(14592) < 15) {
+			mes "[Merry Badger]";
+			mes "You don't have 15 or more Job Manuals to get 1 Box!";
+			close;
+		}
+		//custom dialogue below
+		switch(select("Yes:No")) {
+		case 1:
+			mes "[Merry Badger]";
+			mes "Wonderful, what else do you want?";
+			delitem 14592,15; //Job_Manual50
+			getitem 13990,1; //Job_Manual50_Box
+			close;
+		case 2:
+			mes "[Merry Badger]";
+			mes "Wonderful!";
+			mes "I'll be here if you ever want to exchange for Eden Merit Badges!";
+			close;
+		}
+	}
+	end;
+
+//callsub L_Exchange,<badge cost>,<item id>,<amount>;
+L_Exchange:
+	if (countitem(6495) < getarg(0)) {
+		mes "[Merry Badger]";
+		mes "You don't have enough ^00CC00Eden Merit Badges^000000. Let's start over!";
+		return;
+	}
+	mes "[Merry Badger]";
+	mes sprintf("Ok, I can give you ^ff0000%s^000000 for ^0066CC%d of your Eden Merit Badge(s)^000000.",
+				callfunc("F_InsertPlural",getarg(2),getitemname(getarg(1))), getarg(0));
+	mes "Do you want to?";
+	next;
+	switch(select("Yes:No")) {
+	case 1:
+		mes "[Merry Badger]";
+		mes "There you go! What else would you like?";
+		delitem 6495, getarg(0); //Para_Logro_Badge
+		getitem getarg(1),getarg(2);
+		break;
+	case 2:
+		mes "[Merry Badger]";
+		mes "I understand, let's see if you'd like something different!";
+		break;
+	}
+	return;
+}
+
 // Kafra Stacker
 //============================================================
 moc_para01,41,169,2	script	Kafra Stacker#eden	749,{
@@ -630,11 +813,11 @@ moc_para01,38,162,2	script	Code the Redeemer#Give1	405,{
 //============================================================
 /* Due to the irregularity of iRO's databases, some of these sprites may not display properly. */
 
-moc_para01,32,171,4	cashshop	Kafra Headgears#eden1	115,14024:500,14098:150,17081:300,14097:500,14094:1000,14017:400,14099:300
+moc_para01,32,171,6	cashshop	Kafra Headgears#eden1	115,14024:500,14098:150,17081:300,14097:500,14094:1000,14017:400,14099:300
 moc_para01,35,174,2	cashshop	Kafra Dye Shop#dyes2	114,6287:150
-moc_para01,36,170,2	cashshop	Kafra Consumables#eden3	112,13810:5,14167:400,16556:100,14111:75,14075:25,16419:30,14107:70,14104:50,14112:25,14082:30,14091:60,14088:30,14085:60,14169:40,14170:40,14172:40,14173:40,14171:40,14174:40,14159:100,14160:100,14161:100,14162:100,14163:100:14164:100,16420:1500
+moc_para01,37,170,2	cashshop	Kafra Consumables#eden3	112,13810:5,14167:400,16556:100,14111:75,14075:25,16419:30,14107:70,14104:50,14112:25,14082:30,14091:60,14088:30,14085:60,14169:40,14170:40,14172:40,14173:40,14171:40,14174:40,14159:100,14160:100,14161:100,14162:100,14163:100:14164:100,16420:1500
 moc_para01,32,174,2	cashshop	Kafra Rental Items#eden	721,16683:150,16682:50,14126:250,14125:250,16430:250,14137:250,14127:250,14118:250,14119:250,14132:250,16425:250,14124:250,14133:250,14130:250,16424:250,14136:250,14122:250,16426:250,14135:250,14134:250,14138:250,16428:250,16431:250,14139:250,14131:250,16429:250,16427:250
-moc_para01,36,172,2	cashshop	Kafra Costume#eden5	860,16974:300,16972:600,16973:150,16975:150,16977:150,17014:150,17015:150
+moc_para01,37,172,2	cashshop	Kafra Costume#eden5	860,16974:300,16972:600,16973:150,16975:150,16977:150,17014:150,17015:150
 moc_para01,35,168,1	cashshop	Kafra Utility Shop#eden	113,16677:25,13990:400,16396:100,16394:100,17106:500,6241:10,6240:10,6225:15,6226:15,14002:5,6294:500,7776:50,7619:30,7620:30,12208:40,14156:400,12210:40,14158:400,14042:50,14044:50,14046:50,14048:50,14114:50,14166:40,16418:500,16381:400,14165:100,14157:100,14178:100
 
 // Duplicate NPCs
@@ -667,7 +850,7 @@ OnTimer5000:
 }
 
 // Gym Pass Trainer "Ripped Cabus" (other/gympass)
-moc_para01,33,162,4	duplicate(Ripped Cabus#GymPass)	Ripped Callus#ed	899
+moc_para01,33,162,6	duplicate(Ripped Cabus#GymPass)	Ripped Callus#ed	899
 
 // RWC 2012 Enchanter "Goldenthiefberg" (events/RWC_2012.txt)
 // A combination of the slotter and enchanter, currently a placeholder.
@@ -701,18 +884,6 @@ moc_para01,29,35,4	script	Gramps#huntquests	866,{
 	//switch(select("Yes, I'll help.:Reward Me!:^ff0000I want to quit hunting^000000:^0000ffCan you warp me?^000000:Can you erase the timer?:What missions are you giving?:Give me Limited 3 day VIP:Tell me more about the VIP Access:No thanks, pops.")) {
 }
 
-moc_para01,13,22,4	script	Merry Badger#xch	882,{
-	mes "[Merry Badger]";
-	mes "Hello there!  I'm Merry Badger and I was hired to exchange the ^00CC00Eden Merit Badges^000000!";
-	next;
-	mes "[Merry Badger]";
-	mes "I can take your Merit Badges and give you some useful stuff, or I can take some of your stuff and give you some Eden Merit Badges.";
-	mes "As I get more authorization I can offer more things to trade with you, so definitely keep me in mind when visiting the Eden Group.";
-	close;
-	//next;
-	//switch(select("Redeem Badges:Trade in FOR badges:Exchange Rates:15 Job Manuals - 1 JM Box")) {
-}
-
 moc_para01,174,33,3	script	Bathory#2012spirits	1102,{
 	mes "[Bathory]";
 	mes "Eheeheeheehee! The spotlight is on Glast Heim this week, so I'm ferrying people there for a mere 1,000z!";

+ 8 - 2
src/map/script.c

@@ -18361,11 +18361,13 @@ BUILDIN_FUNC(defpattern);
 BUILDIN_FUNC(activatepset);
 BUILDIN_FUNC(deactivatepset);
 BUILDIN_FUNC(deletepset);
+#endif
 
 /** Regular expression matching
  * preg_match(<pattern>,<string>{,<offset>})
  */
 BUILDIN_FUNC(preg_match) {
+#ifdef PCRE_SUPPORT
 	pcre *re;
 	pcre_extra *pcreExtra;
 	const char *error;
@@ -18392,8 +18394,12 @@ BUILDIN_FUNC(preg_match) {
 		script_pushint(st,(r > 0) ? r : 30 / 3);
 
 	return SCRIPT_CMD_SUCCESS;
-}
+#else
+	ShowError("script:preg_match: cannot run without PCRE library enabled.\n");
+	script_pushint(st,0);
+	return SCRIPT_CMD_FAILURE;
 #endif
+}
 
 /// script command definitions
 /// for an explanation on args, see add_buildin_func
@@ -18663,8 +18669,8 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF(activatepset,"i"), // Activate a pattern set [MouseJstr]
 	BUILDIN_DEF(deactivatepset,"i"), // Deactive a pattern set [MouseJstr]
 	BUILDIN_DEF(deletepset,"i"), // Delete a pattern set [MouseJstr]
-	BUILDIN_DEF(preg_match,"ss?"),
 #endif
+	BUILDIN_DEF(preg_match,"ss?"),
 	BUILDIN_DEF(dispbottom,"s"), //added from jA [Lupus]
 	BUILDIN_DEF(getusersname,""),
 	BUILDIN_DEF(recovery,"i???"),