viewing paste Mission Board v2.4 | Athena

Posted on the
  1. //	~~~~~ Please use this latest int__ function that support negative numbers ~~~~~
  2. function	script	int__	{
  3. 	set .@num, getarg(0);
  4. 	if ( .@num == 0 || .@num > 2147483647 || .@num < -2147483647 ) return getarg(0);
  5. 	set .@l, (.@num > 0)? getstrlen(.@num +"") : getstrlen(.@num +"") -1;
  6. 	while ( .@i < .@l ) {
  7. 		set .@temp, .@num % pow(10,.@i+1) / pow(10,.@i);
  8. 		set .@num$, ( ( (.@i+1) % 3 == 0 && .@i+1 != .@l )?",":"" ) + ( (.@num > 0)?.@temp:~(.@temp)+1 ) + .@num$;
  9. 		set .@i, .@i +1;
  10. 	}
  11. 	return ((.@num > 0)?"":"-")+ .@num$;
  12. }
  13.  
  14. //===== eAthena Script ============================================
  15. //= Mission Board
  16. //===== By: =======================================================
  17. //= ~AnnieRuru~
  18. //===== Current Version: ==========================================
  19. //= 2.4
  20. //===== Compatible With: ==========================================
  21. //= eAthena 14764 Trunk TXT/SQL
  22. //===== Description: ==============================================
  23. //= allow admin to setup their own quests dynamically
  24. //===== Topic =====================================================
  25. //= http://www.eathena.ws/board/index.php?showtopic=242306
  26. //===== Additional Comments: ======================================
  27. //= mainly optimize the script
  28. //=================================================================
  29.  
  30. -	script	mission board#127::ms_b_	-1,{
  31. 	mes "["+ strnpcinfo(1) +"]";
  32. 	if ( atoi( strnpcinfo(2) ) <= 0 || atoi( strnpcinfo(2) ) > 127 ) {
  33. 		mes "This board is currently down";
  34. 		mes "Please report to GM";
  35. 		mes "Reason: Invalid NPC ID";
  36. 		close;
  37. 	}
  38. 	if ( .duplicate_id ) {
  39. 		set .@size, getarraysize(.duplicate_id);
  40. 		for ( set .@i, 0; .@i < .@size; set .@i, .@i +1 ) {
  41. 			if ( .duplicate_id[.@i] == atoi( strnpcinfo(2) ) ) {
  42. 				mes "This board is currently down";
  43. 				mes "Please report to GM";
  44. 				mes "Reason: duplicate NPC ID#"+ strnpcinfo(2);
  45. 				close;
  46. 			}
  47. 		}
  48. 	}
  49. 	if ( .loading == 1 ) {
  50. 		mes "The board is currently loading mission data";
  51. 		mes "Please wait";
  52. 		close;
  53. 	}
  54. 	if ( @ms_b_loading == 1 ) {
  55. 		mes "The board is currently loading player data";
  56. 		mes "Please wait";
  57. 		close;
  58. 	}
  59. 	mes "Please select an option below:";
  60. 	set @slot, 0;
  61. 	next;
  62. 	for ( set .@i, 1; .@i <= 4; set .@i, .@i +1 ) {
  63. 		if ( getd("@ms_b_m_"+ .@i) ) {
  64. 			if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") == "" ) {
  65. 				dispbottom "Mission Board: Your Mission#"+ .@i +" has deleted because it is no longer available";
  66. 				deletearray getd("@ms_b_m_"+ .@i);
  67. 				setd "ms_b_m_"+ .@i +"$", "";
  68. 				deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  69. 			}
  70. 			else if ( getd("@ms_b_m_"+ .@i +"[1]") && getd("@ms_b_m_"+ .@i +"[1]") <= gettimetick(2) ) {
  71. 				dispbottom "Mission #1: "+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") +" has Time Up !";
  72. 				deletearray getd("@ms_b_m_"+ .@i);
  73. 				setd "ms_b_m_"+ .@i +"$", "";
  74. 				deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  75. 			}
  76. 		}
  77. 	}
  78. 	set .@size, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2)) );
  79. 	for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  80. 		if ( getd("@ms_b_n_"+ strnpcinfo(2) +"[0]") != atoi( gettimestr("%Y%m%d", 9) ) && getd(".ms_b_m_"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ||
  81. 			getd(".ms_b_m_"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) {
  82. 				deletearray getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]"), 1;
  83. 				set .@i, .@i -1 ;
  84. 		}
  85. 	}
  86. 	if ( getd("@ms_b_n_"+ strnpcinfo(2) +"[1]") ) {
  87. 		setd "ms_b_n_"+ strnpcinfo(2) +"$",	gettimestr("%Y%m%d", 9);
  88. 		set .@size, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2) ) );
  89. 		for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  90. 			setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  91. 		setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#";
  92. 	}
  93. 	else
  94. 		setd "ms_b_n_"+ strnpcinfo(2) +"$", "";
  95. 	switch ( select ( "Submit a mission", "Give up a mission", "Accept a mission", ( getgmlevel() < 99 )?"":"^FF0000Administrator Settings^000000" ) ) {
  96. 		case 1:
  97. 			mes "["+ strnpcinfo(1) +"]";
  98. 			set @slot, select(
  99. 				"#1 "+( ( @ms_b_m_1[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  100. 				"#2 "+( ( @ms_b_m_2[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  101. 				"#3 "+( ( @ms_b_m_3[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  102. 				"#4 "+( ( @ms_b_m_4[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]"):"^FF0000Empty" )+"^000000");
  103. 			if ( getd("@ms_b_m_"+ @slot +"[0]") == 0 ) {
  104. 				mes "You have selected an Empty slot";
  105. 				mes "Please try again";
  106. 				close;
  107. 			}
  108. 			callsub L_showprogress;
  109. 			mes "Are you sure you want to submit the selected mission?";
  110. 			next;
  111. 			if ( select ( "Yes", "No" ) == 2 ) close;
  112. 			mes "["+ strnpcinfo(1) +"]";
  113. 			if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[11]") != atoi( strnpcinfo(2) ) ) {
  114. 				mes "Please submit this mission to:";
  115. 				mes "^0000FF"+ .ms_b_name$[ getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[11]") ] +"^000000";
  116. 				close;
  117. 			}
  118. 			set .@size, getarraysize( getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  119. 			for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  120. 				if ( getd("@ms_b_m_"+ @slot +"["+( .@i/2 +2 )+"]") < getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1)+"]") ) {
  121. 					mes "You do not meet the requirement to submit this mission";
  122. 					mes "Please check the monster count";
  123. 					close;
  124. 				}
  125. 			}
  126. 			set .@size, getarraysize( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  127. 			for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  128. 				if ( countitem( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") )  < getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1)+"]") ) {
  129. 					mes "You do not meet the requirement to submit this mission";
  130. 					mes "Please check the item requirements";
  131. 					close;
  132. 				}
  133. 			}
  134. 			if ( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) ) {
  135. 				getinventorylist;
  136. 				deletearray @inventorylist_id, @inventorylist_count;
  137. 				deletearray @inventorylist_amount, @inventorylist_count;
  138. 				deletearray @inventorylist_equip, @inventorylist_count;
  139. 				deletearray @inventorylist_refine, @inventorylist_count;
  140. 				deletearray @inventorylist_identify, @inventorylist_count;
  141. 				deletearray @inventorylist_attribute, @inventorylist_count;
  142. 				deletearray @inventorylist_card1, @inventorylist_count;
  143. 				deletearray @inventorylist_card2, @inventorylist_count;
  144. 				deletearray @inventorylist_card3, @inventorylist_count;
  145. 				deletearray @inventorylist_card4, @inventorylist_count;
  146. 				set .@size, getarraysize( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  147. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  148. 					set .@itemweight, .@itemweight + getiteminfo( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]"), 6 ) * getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]");
  149. 				}
  150. 				if ( @inventorylist_count > 95 || weight + .@itemweight > maxweight ) {
  151. 					mes "You are overweight, please clean up some inventory space";
  152. 					set @inventorylist_count, 0;
  153. 					close;
  154. 				}
  155. 				set @inventorylist_count, 0;
  156. 			}
  157. 			mes "Mission completed!";
  158. 			mes " ";
  159. 			set .@size, getarraysize( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  160. 			for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  161. 				delitem getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]"), getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1)+"]");
  162. 			mes "[Rewards]";
  163. 			if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") ) {
  164. 				mes "Base Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") ) +"^000000";
  165. 				dispbottom "Mission Reward > Base Exp : "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") );
  166. 				set baseexp, baseexp + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]");
  167. 			}
  168. 			if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") ) {
  169. 				mes "Job Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") ) +"^000000";
  170. 				dispbottom "Mission Reward > Job Exp : "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") );
  171. 				set jobexp, jobexp + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]");
  172. 			}
  173. 			if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) {
  174. 				mes "Zeny : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) +"^000000";
  175. 				dispbottom "Mission Reward > "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) +" Zeny";
  176. 				set zeny, zeny + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]");
  177. 			}
  178. 			if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) {
  179. 				mes "Cash Point : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) +"^000000";
  180. 				dispbottom "Mission Reward > "+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) +" Cash Points";
  181. 				set #CASHPOINTS, #CASHPOINTS + getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]");
  182. 			}
  183. 			set .@size, getarraysize( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  184. 			for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  185. 				mes "Item : ^0000FF"+ getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"^000000";
  186. 				getitem getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]"), getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]");
  187. 			}
  188. 			if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[6]") ) {
  189. 				set .@size, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2) ) );
  190. 				setd "@ms_b_n_"+ strnpcinfo(2) +"[0]", gettimestr("%Y%m%d", 9);
  191. 				setd "@ms_b_n_"+ strnpcinfo(2) +"["+ .@size +"]", getd("@ms_b_m_"+ @slot +"[0]");
  192. 				setd "ms_b_n_"+ strnpcinfo(2) +"$",	gettimestr("%Y%m%d", 9);
  193. 				for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  194. 					setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  195. 				setd "ms_b_n_"+ strnpcinfo(2) +"$", getd("ms_b_n_"+ strnpcinfo(2) +"$") +"#";
  196. 			}
  197. 			deletearray getd("@ms_b_m_"+ @slot);
  198. 			setd "ms_b_m_"+ @slot +"$", "";
  199. 			deltimer "ms_b_::OnQuest"+ @slot +"TimeUp";
  200. 			set @slot, 0;
  201. 			close;
  202. 		case 2:
  203. 			mes "["+ strnpcinfo(1) +"]";
  204. 			set @slot, select(
  205. 				"#1 "+( ( @ms_b_m_1[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  206. 				"#2 "+( ( @ms_b_m_2[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  207. 				"#3 "+( ( @ms_b_m_3[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  208. 				"#4 "+( ( @ms_b_m_4[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]"):"^FF0000Empty" )+"^000000");
  209. 			if ( getd("@ms_b_m_"+ @slot +"[0]") == 0 ) {
  210. 				mes "You have selected an Empty slot";
  211. 				mes "Please try again";
  212. 				close;
  213. 			}
  214. 			callsub L_showprogress;
  215. 			mes "Are you sure that you want to give up this mission?";
  216. 			next;
  217. 			if ( select ( "Yes", "No" ) == 2 ) close;
  218. 			mes "["+ strnpcinfo(1) +"]";
  219. 			mes "^0000FF"+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"$[0]") +"^000000";
  220. 			mes " ";
  221. 			mes "Mission has given up successfully";
  222. 			deletearray getd("@ms_b_m_"+ @slot);
  223. 			setd "ms_b_m_"+ @slot +"$", "";
  224. 			deltimer "ms_b_::OnQuest"+ @slot +"TimeUp";
  225. 			set @slot, 0;
  226. 			close;
  227. 		case 3:
  228. 			mes "["+ strnpcinfo(1) +"]";
  229. 			if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  230. 				mes "There is no mission available";
  231. 				close;
  232. 			}
  233. 			set .@slot, select(
  234. 				"#1 "+( ( @ms_b_m_1[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  235. 				"#2 "+( ( @ms_b_m_2[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  236. 				"#3 "+( ( @ms_b_m_3[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]"):"^FF0000Empty" )+"^000000",
  237. 				"#4 "+( ( @ms_b_m_4[0] )?"^0000FF"+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]"):"^FF0000Empty" )+"^000000");
  238. 			if ( getd("@ms_b_m_"+ .@slot +"[0]") ) {
  239. 				mes "The slot that you selected already has a mission";
  240. 				close;
  241. 			}
  242. 			mes "Select a mission to accept below:";
  243. 			if ( basejob == Job_Novice || basejob == Job_SuperNovice ) set .@basejob, pow(2,0);
  244. 			else if ( basejob == Job_Swordman ) set .@basejob, pow(2,1);
  245. 			else if ( basejob == Job_Mage ) set .@basejob, pow(2,2);
  246. 			else if ( basejob == Job_Archer ) set .@basejob, pow(2,3);
  247. 			else if ( basejob == Job_Acolyte ) set .@basejob, pow(2,4);
  248. 			else if ( basejob == Job_Merchant ) set .@basejob, pow(2,5);
  249. 			else if ( basejob == Job_Thief ) set .@basejob, pow(2,6);
  250. 			else if ( basejob == Job_Knight ) set .@basejob, pow(2,7);
  251. 			else if ( basejob == Job_Priest ) set .@basejob, pow(2,8);
  252. 			else if ( basejob == Job_Wizard ) set .@basejob, pow(2,9);
  253. 			else if ( basejob == Job_Blacksmith ) set .@basejob, pow(2,10);
  254. 			else if ( basejob == Job_Hunter ) set .@basejob, pow(2,11);
  255. 			else if ( basejob == Job_Assassin ) set .@basejob, pow(2,12);
  256. 			else if ( basejob == Job_Crusader ) set .@basejob, pow(2,13);
  257. 			else if ( basejob == Job_Monk ) set .@basejob, pow(2,14);
  258. 			else if ( basejob == Job_Sage ) set .@basejob, pow(2,15);
  259. 			else if ( basejob == Job_Rogue ) set .@basejob, pow(2,16);
  260. 			else if ( basejob == Job_Alchemist ) set .@basejob, pow(2,17);
  261. 			else if ( basejob == Job_Bard || basejob == Job_Dancer ) set .@basejob, pow(2,18);
  262. 			else if ( basejob == Job_Taekwon ) set .@basejob, pow(2,19);
  263. 			else if ( basejob == Job_Star_Gladiator ) set .@basejob, pow(2,20);
  264. 			else if ( basejob == Job_Soul_Linker ) set .@basejob, pow(2,21);
  265. 			else if ( basejob == Job_Gunslinger ) set .@basejob, pow(2,22);
  266. 			else if ( basejob == Job_Ninja ) set .@basejob, pow(2,23);
  267. 			next;
  268. 			while (1) {
  269. 				set .@menu$, "";
  270. 				set .@i, 0;
  271. 				set .@size1, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  272. 				set .@size2, getarraysize( getd("@ms_b_n_"+ strnpcinfo(2)) );
  273. 				while ( .@i < .@size1 ) {
  274. 					set .@j, 1;
  275. 					while ( .@j < .@size2 && getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@j +"]") != getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") )
  276. 						set .@j, .@j +1 ;
  277. 					set .@color$, "^00AA00";
  278. 					if ( .@j != .@size2 && .@size2 ||
  279. 						@ms_b_m_1[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  280. 						@ms_b_m_2[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  281. 						@ms_b_m_3[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  282. 						@ms_b_m_4[0] == getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") ||
  283. 						getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[3]") && ( baselevel < getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[3]") || baselevel > getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[4]") ) ||
  284. 						getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[2]") && getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[2]") & .@basejob == 0 )
  285. 						set .@color$, "^FF0000";
  286. 					set .@menu$, .@menu$ + .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$") +":";
  287. 					set .@i, .@i +1 ;
  288. 				}
  289. 				set .@menu, select(.@menu$) -1;
  290. 				set .@m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  291. 				mes "["+ strnpcinfo(1) +"]";
  292. 				mes "^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[0]") +"^000000";
  293. 				mes "Description: ^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[1]") +"^000000";
  294. 				if ( getd(".ms_b_m_"+ .@m_id +"[6]") ) {
  295. 					for ( set .@i, 1; .@i < .@size2; set .@i, .@i +1 ) {
  296. 						if ( getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") == .@m_id ) break;
  297. 					}
  298. 					mes "Status : "+( ( .@i == .@size2 || getd("@ms_b_n_"+ strnpcinfo(2)) == 0 )?"^FF0000Incomplete":"^00CC00Completed" )+"^000000";
  299. 				}
  300. 				mes " ";
  301. 				set .@size, getarraysize( getd(".ms_b_t_"+ .@m_id) );
  302. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  303. 					mes "Require Mobs : ^0000FF"+ getd(".ms_b_t_"+ .@m_id +"["+ (.@i +1) +"]") +" "+ getmonsterinfo( getd(".ms_b_t_"+ .@m_id +"["+ .@i +"]") , 0) +"^000000";
  304. 				set .@size, getarraysize( getd(".ms_b_ir_"+ .@m_id) );
  305. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  306. 					mes "Require Items : ^0000FF"+ getd(".ms_b_ir_"+ .@m_id +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ir_"+ .@m_id +"["+ .@i +"]") ) +"^000000";
  307. 				mes " ";
  308. 				if ( getd(".ms_b_m_"+ .@m_id +"[6]") || getd(".ms_b_m_"+ .@m_id +"[3]") || getd(".ms_b_m_"+ .@m_id +"[5]") || getd(".ms_b_m_"+ .@m_id +"[2]") ) {
  309. 					mes "[^FF0000Limitations^000000]";
  310. 					if ( getd(".ms_b_m_"+ .@m_id +"[6]") )
  311. 						mes "Can do : "+( ( getd(".ms_b_m_"+ .@m_id +"[6]") == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  312. 					if ( getd(".ms_b_m_"+ .@m_id +"[3]") )
  313. 						mes "Base Level :"+( ( getd(".ms_b_m_"+ .@m_id +"[3]") )?"  ^0000FF"+ getd(".ms_b_m_"+ .@m_id +"[3]") +( ( getd(".ms_b_m_"+ .@m_id +"[3]") != getd(".ms_b_m_"+ .@m_id +"[4]") )?"~"+ getd(".ms_b_m_"+ .@m_id +"[4]"):"" )+"^000000":"" );
  314. 					if ( getd(".ms_b_m_"+ .@m_id +"[5]") )
  315. 						mes "Time Limit : ^FF0000"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") /60 )?getd(".ms_b_m_"+ .@m_id +"[5]") /60 +" hour"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?" ":"" ):"" )+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?getd(".ms_b_m_"+ .@m_id +"[5]") %60 +" min":"" )+"^000000";
  316. 					if ( getd(".ms_b_m_"+ .@m_id +"[2]") ) {
  317. 						deletearray .@joblimit;
  318. 						for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  319. 							if ( getd(".ms_b_m_"+ .@m_id +"[2]") & pow( 2, .@i ) ) {
  320. 								set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  321. 							}
  322. 						}
  323. 						set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  324. 						set .@size, getarraysize(.@joblimit);
  325. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  326. 							set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  327. 						mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  328. 					}
  329. 					mes " ";
  330. 				}
  331. 				mes "[^009900Rewards^000000]";
  332. 				if ( getd(".ms_b_m_"+ .@m_id +"[7]") )
  333. 					mes "Base Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[7]") ) +"^000000";
  334. 				if ( getd(".ms_b_m_"+ .@m_id +"[8]") )
  335. 					mes "Job Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[8]") ) +"^000000";
  336. 				if ( getd(".ms_b_m_"+ .@m_id +"[9]") )
  337. 					mes "Zeny : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[9]") ) +"^000000";
  338. 				if ( getd(".ms_b_m_"+ .@m_id +"[10]") )
  339. 					mes "Cash Point : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ .@m_id +"[10]") ) +"^000000";
  340. 				set .@size, getarraysize( getd(".ms_b_ia_"+ .@m_id ) );
  341. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  342. 					mes "Item : ^0000FF"+ getd(".ms_b_ia_"+ .@m_id +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ia_"+ .@m_id +"["+ .@i +"]") ) +"^000000";
  343. 				next;
  344. 				if ( select ( "Accept current mission", "Pick another" ) == 1 ) {
  345. 					for ( set .@i, 1; .@i < .@size2; set .@i, .@i +1 ) {
  346. 						if ( getd("@ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") == .@m_id ) {
  347. 							mes "["+ strnpcinfo(1) +"]";
  348. 							mes "You have completed this mission";
  349. 							set .@break, 1;
  350. 							next;
  351. 							break;
  352. 						}
  353. 					}
  354. 					if ( .@break == 0 && ( @ms_b_m_1[0] == .@m_id || @ms_b_m_2[0] == .@m_id || @ms_b_m_3[0] == .@m_id || @ms_b_m_4[0] == .@m_id ) ) {
  355. 						mes "["+ strnpcinfo(1) +"]";
  356. 						mes "You already taken this mission";
  357. 						set .@break, 1;
  358. 						next;
  359. 					}
  360. 					if ( .@break == 0 && getd(".ms_b_m_"+ .@m_id +"[3]") && ( baselevel < getd(".ms_b_m_"+ .@m_id +"[3]") || baselevel > getd(".ms_b_m_"+ .@m_id +"[4]") ) ) {
  361. 						mes "["+ strnpcinfo(1) +"]";
  362. 						mes "Your current level is not allowed to do this mission";
  363. 						set .@break, 1;
  364. 						next;
  365. 					}
  366. 					if ( .@break == 0 && getd(".ms_b_m_"+ .@m_id +"[2]") ) {
  367. 						if ( getd(".ms_b_m_"+ .@m_id +"[2]") & .@basejob == 0 ) {
  368. 							mes "["+ strnpcinfo(1) +"]";
  369. 							mes "Your current job class is not allowed to do this mission";
  370. 							set .@break, 1;
  371. 							next;
  372. 						}
  373. 					}
  374. 					if ( .@break == 0 ) break;
  375. 				}
  376. 				set .@break, 0;
  377. 			}
  378. 			mes "["+ strnpcinfo(1) +"]";
  379. 			mes "You have accepted a mission:";
  380. 			mes "^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[0]") +"^000000";
  381. 			if ( getd(".ms_b_m_"+ .@m_id +"[5]") ) {
  382. 				mes "Time Left : ^FF0000"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") /60 )?getd(".ms_b_m_"+ .@m_id +"[5]") /60 +" hour"+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?" ":"" ):"" )+( ( getd(".ms_b_m_"+ .@m_id +"[5]") %60 )?getd(".ms_b_m_"+ .@m_id +"[5]") %60 +" min":"" )+"^000000";
  383. 				addtimer getd(".ms_b_m_"+ .@m_id +"[5]") * 60 * 1000, "ms_b_::OnQuest"+ .@slot +"TimeUp";
  384. 				setd "@ms_b_m_"+ .@slot +"[1]", gettimetick(2) + getd(".ms_b_m_"+ .@m_id +"[5]") * 60;
  385. 			}
  386. 			setd "@ms_b_m_"+ .@slot +"[0]", .@m_id;
  387. 			setd "ms_b_m_"+ .@slot +"$", getd("@ms_b_m_"+ .@slot +"[0]") +"#"+ getd("@ms_b_m_"+ .@slot +"[1]");
  388. 			close;
  389. 		case 4:
  390. 			if ( getgmlevel() < 99 ) end;
  391. 			while (1) {
  392. 				mes "["+ strnpcinfo(1) +"]";
  393. 				mes "Please select an option below:";
  394. 				next;
  395. 				switch ( select ( "Setup a mission", "Edit a mission", "Remove a mission", "Swap mission order" ) ) {
  396. 					case 1:
  397. 						if ( $ms_b_id >= 99999 ) {
  398. 							mes "["+ strnpcinfo(1) +"]";
  399. 							mes "This is the end, you can't create anymore missions";
  400. 							close;
  401. 						}
  402. 						else if ( getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) ) == 40 ) {
  403. 							mes "["+ strnpcinfo(1) +"]";
  404. 							mes "Each NPC are only allowed to setup 40 missions";
  405. 							next;
  406. 							break;
  407. 						}
  408. 						deletearray @tmp_ms_b_m_$;
  409. 						deletearray @tmp_ms_b_m_;
  410. 						deletearray @tmp_ms_b_t_;
  411. 						deletearray @tmp_ms_b_ir_;
  412. 						deletearray @tmp_ms_b_ia_;
  413. 						if ( callsub( L_setupmission, 0 ) == 0 ) {
  414. 							deletearray @tmp_ms_b_m_$;
  415. 							deletearray @tmp_ms_b_m_;
  416. 							deletearray @tmp_ms_b_t_;
  417. 							deletearray @tmp_ms_b_ir_;
  418. 							deletearray @tmp_ms_b_ia_;
  419. 							break;
  420. 						}
  421. 						set $ms_b_id, $ms_b_id +1 ;
  422. 						setd ".ms_b_n_"+ strnpcinfo(2) +"["+ getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) ) +"]", $ms_b_id;
  423. 						setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd(".ms_b_n_"+ strnpcinfo(2) +"[0]");
  424. 						set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  425. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  426. 							setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd("$ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  427. 						set @tmp_ms_b_m_[11], strnpcinfo(2);
  428. 						copyarray getd(".ms_b_m_"+ $ms_b_id +"$"), @tmp_ms_b_m_$, 128;
  429. 						copyarray getd(".ms_b_m_"+ $ms_b_id), @tmp_ms_b_m_, 128;
  430. 						copyarray getd(".ms_b_t_"+ $ms_b_id ), @tmp_ms_b_t_, 128;
  431. 						copyarray getd(".ms_b_ir_"+ $ms_b_id ), @tmp_ms_b_ir_, 128;
  432. 						copyarray getd(".ms_b_ia_"+ $ms_b_id ), @tmp_ms_b_ia_, 128;
  433. 						setarray getd("$ms_b_m_"+ $ms_b_id +"$"),
  434. 							@tmp_ms_b_m_$[0],
  435. 							@tmp_ms_b_m_$[1],
  436. 							( ( @tmp_ms_b_m_[2] )?@tmp_ms_b_m_[2]:"" )+"#"+( ( @tmp_ms_b_m_[3] )?@tmp_ms_b_m_[3]:"" )+"#"+( ( @tmp_ms_b_m_[4] )?@tmp_ms_b_m_[4]:"" )+"#"+( ( @tmp_ms_b_m_[5] )?@tmp_ms_b_m_[5]:"" )+"#"+( ( @tmp_ms_b_m_[6] )?@tmp_ms_b_m_[6]:"" )+"#"+( ( @tmp_ms_b_m_[7] )?@tmp_ms_b_m_[7]:"" )+"#"+( ( @tmp_ms_b_m_[8] )?@tmp_ms_b_m_[8]:"" )+"#"+( ( @tmp_ms_b_m_[9] )?@tmp_ms_b_m_[9]:"" )+"#"+( ( @tmp_ms_b_m_[10] )?@tmp_ms_b_m_[10]:"" )+"#"+( ( @tmp_ms_b_m_[11] )?@tmp_ms_b_m_[11]:"" )+"#"+( ( @tmp_ms_b_m_[12] )?@tmp_ms_b_m_[12]:"" )+"#"+( ( @tmp_ms_b_m_[13] )?@tmp_ms_b_m_[13]:"" ),
  437. 							( ( @tmp_ms_b_t_[0] )?@tmp_ms_b_t_[0]:"" )+"#"+( ( @tmp_ms_b_t_[1] )?@tmp_ms_b_t_[1]:"" )+"#"+( ( @tmp_ms_b_t_[2] )?@tmp_ms_b_t_[2]:"" )+"#"+( ( @tmp_ms_b_t_[3] )?@tmp_ms_b_t_[3]:"" )+"#"+( ( @tmp_ms_b_t_[4] )?@tmp_ms_b_t_[4]:"" )+"#"+( ( @tmp_ms_b_t_[5] )?@tmp_ms_b_t_[5]:"" )+"#"+( ( @tmp_ms_b_t_[6] )?@tmp_ms_b_t_[6]:"" )+"#"+( ( @tmp_ms_b_t_[7] )?@tmp_ms_b_t_[7]:"" )+"#"+( ( @tmp_ms_b_t_[8] )?@tmp_ms_b_t_[8]:"" )+"#"+( ( @tmp_ms_b_t_[9] )?@tmp_ms_b_t_[9]:"" )+"#"+( ( @tmp_ms_b_t_[10] )?@tmp_ms_b_t_[10]:"" )+"#"+( ( @tmp_ms_b_t_[11] )?@tmp_ms_b_t_[11]:"" )+"#"+( ( @tmp_ms_b_t_[12] )?@tmp_ms_b_t_[12]:"" )+"#"+( ( @tmp_ms_b_t_[13] )?@tmp_ms_b_t_[13]:"" )+"#"+( ( @tmp_ms_b_t_[14] )?@tmp_ms_b_t_[14]:"" )+"#"+( ( @tmp_ms_b_t_[15] )?@tmp_ms_b_t_[15]:"" )+"#"+( ( @tmp_ms_b_ir_[0] )?@tmp_ms_b_ir_[0]:"" )+"#"+( ( @tmp_ms_b_ir_[1] )?@tmp_ms_b_ir_[1]:"" )+"#"+( ( @tmp_ms_b_ir_[2] )?@tmp_ms_b_ir_[2]:"" )+"#"+( ( @tmp_ms_b_ir_[3] )?@tmp_ms_b_ir_[3]:"" )+"#"+( ( @tmp_ms_b_ir_[4] )?@tmp_ms_b_ir_[4]:"" )+"#"+( ( @tmp_ms_b_ir_[5] )?@tmp_ms_b_ir_[5]:"" )+"#"+( ( @tmp_ms_b_ir_[6] )?@tmp_ms_b_ir_[6]:"" )+"#"+( ( @tmp_ms_b_ir_[7] )?@tmp_ms_b_ir_[7]:"" )+"#"+( ( @tmp_ms_b_ir_[8] )?@tmp_ms_b_ir_[8]:"" )+"#"+( ( @tmp_ms_b_ir_[9] )?@tmp_ms_b_ir_[9]:"" )+"#"+( ( @tmp_ms_b_ia_[0] )?@tmp_ms_b_ia_[0]:"" )+"#"+( ( @tmp_ms_b_ia_[1] )?@tmp_ms_b_ia_[1]:"" )+"#"+( ( @tmp_ms_b_ia_[2] )?@tmp_ms_b_ia_[2]:"" )+"#"+( ( @tmp_ms_b_ia_[3] )?@tmp_ms_b_ia_[3]:"" )+"#"+( ( @tmp_ms_b_ia_[4] )?@tmp_ms_b_ia_[4]:"" )+"#"+( ( @tmp_ms_b_ia_[5] )?@tmp_ms_b_ia_[5]:"" )+"#"+( ( @tmp_ms_b_ia_[6] )?@tmp_ms_b_ia_[6]:"" )+"#"+( ( @tmp_ms_b_ia_[7] )?@tmp_ms_b_ia_[7]:"" )+"#"+( ( @tmp_ms_b_ia_[8] )?@tmp_ms_b_ia_[8]:"" )+"#"+( ( @tmp_ms_b_ia_[9] )?@tmp_ms_b_ia_[9]:"" );
  438. 						deletearray @tmp_ms_b_m_$;
  439. 						deletearray @tmp_ms_b_m_;
  440. 						deletearray @tmp_ms_b_t_;
  441. 						deletearray @tmp_ms_b_ir_;
  442. 						deletearray @tmp_ms_b_ia_;
  443. 						mes " ";
  444. 						mes "Mission has setup successfully";
  445. 						next;
  446. 						break;
  447. 					case 2:
  448. 						mes "["+ strnpcinfo(1) +"]";
  449. 						if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  450. 							mes "There is no mission available to edit.";
  451. 							next;
  452. 							break;
  453. 						}
  454. 						mes "Select a mission below to edit:";
  455. 						next;
  456. 						if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 0 ) set .@color$, "^0000FF";
  457. 						else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 1 ) set .@color$, "^00CC00";
  458. 						else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 2 ) set .@color$, "^FF0000";
  459. 						set .@menu$, "^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"$");
  460. 						set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  461. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  462. 							if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) set .@color$, "^0000FF";
  463. 							else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ) set .@color$, "^00CC00";
  464. 							else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 2 ) set .@color$, "^FF0000";
  465. 							set .@menu$, .@menu$ +":^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$");
  466. 						}
  467. 						set .@menu$, .@menu$ +":^000000 - back";
  468. 						set .@menu, select(.@menu$) -1;
  469. 						if ( .@menu == .@size ) break;
  470. 						set @m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  471. 						deletearray @tmp_ms_b_m_$;
  472. 						deletearray @tmp_ms_b_m_;
  473. 						deletearray @tmp_ms_b_t_;
  474. 						deletearray @tmp_ms_b_ir_;
  475. 						deletearray @tmp_ms_b_ia_;
  476. 						copyarray @tmp_ms_b_m_$, getd("$ms_b_m_"+ @m_id +"$"), 128;
  477. 						copyarray @tmp_ms_b_m_, getd(".ms_b_m_"+ @m_id ), 128;
  478. 						copyarray @tmp_ms_b_t_, getd(".ms_b_t_"+ @m_id ), 128;
  479. 						copyarray @tmp_ms_b_ir_, getd(".ms_b_ir_"+ @m_id ), 128;
  480. 						copyarray @tmp_ms_b_ia_, getd(".ms_b_ia_"+ @m_id ), 128;
  481. 						if ( callsub( L_setupmission, 1 ) == 0 ) {
  482. 							deletearray @tmp_ms_b_m_$;
  483. 							deletearray @tmp_ms_b_m_;
  484. 							deletearray @tmp_ms_b_t_;
  485. 							deletearray @tmp_ms_b_ir_;
  486. 							deletearray @tmp_ms_b_ia_;
  487. 							set @m_id, 0;
  488. 							break;
  489. 						}
  490. 						copyarray getd(".ms_b_m_"+ @m_id +"$"), @tmp_ms_b_m_$, 128;
  491. 						copyarray getd(".ms_b_m_"+ @m_id), @tmp_ms_b_m_, 128;
  492. 						copyarray getd(".ms_b_t_"+ @m_id ), @tmp_ms_b_t_, 128;
  493. 						copyarray getd(".ms_b_ir_"+ @m_id ), @tmp_ms_b_ir_, 128;
  494. 						copyarray getd(".ms_b_ia_"+ @m_id ), @tmp_ms_b_ia_, 128;
  495. 						setarray getd("$ms_b_m_"+ @m_id +"$"),
  496. 							@tmp_ms_b_m_$[0],
  497. 							@tmp_ms_b_m_$[1],
  498. 							( ( @tmp_ms_b_m_[2] )?@tmp_ms_b_m_[2]:"" )+"#"+( ( @tmp_ms_b_m_[3] )?@tmp_ms_b_m_[3]:"" )+"#"+( ( @tmp_ms_b_m_[4] )?@tmp_ms_b_m_[4]:"" )+"#"+( ( @tmp_ms_b_m_[5] )?@tmp_ms_b_m_[5]:"" )+"#"+( ( @tmp_ms_b_m_[6] )?@tmp_ms_b_m_[6]:"" )+"#"+( ( @tmp_ms_b_m_[7] )?@tmp_ms_b_m_[7]:"" )+"#"+( ( @tmp_ms_b_m_[8] )?@tmp_ms_b_m_[8]:"" )+"#"+( ( @tmp_ms_b_m_[9] )?@tmp_ms_b_m_[9]:"" )+"#"+( ( @tmp_ms_b_m_[10] )?@tmp_ms_b_m_[10]:"" )+"#"+( ( @tmp_ms_b_m_[11] )?@tmp_ms_b_m_[11]:"" )+"#"+( ( @tmp_ms_b_m_[12] )?@tmp_ms_b_m_[12]:"" )+"#"+( ( @tmp_ms_b_m_[13] )?@tmp_ms_b_m_[13]:"" ),
  499. 							( ( @tmp_ms_b_t_[0] )?@tmp_ms_b_t_[0]:"" )+"#"+( ( @tmp_ms_b_t_[1] )?@tmp_ms_b_t_[1]:"" )+"#"+( ( @tmp_ms_b_t_[2] )?@tmp_ms_b_t_[2]:"" )+"#"+( ( @tmp_ms_b_t_[3] )?@tmp_ms_b_t_[3]:"" )+"#"+( ( @tmp_ms_b_t_[4] )?@tmp_ms_b_t_[4]:"" )+"#"+( ( @tmp_ms_b_t_[5] )?@tmp_ms_b_t_[5]:"" )+"#"+( ( @tmp_ms_b_t_[6] )?@tmp_ms_b_t_[6]:"" )+"#"+( ( @tmp_ms_b_t_[7] )?@tmp_ms_b_t_[7]:"" )+"#"+( ( @tmp_ms_b_t_[8] )?@tmp_ms_b_t_[8]:"" )+"#"+( ( @tmp_ms_b_t_[9] )?@tmp_ms_b_t_[9]:"" )+"#"+( ( @tmp_ms_b_t_[10] )?@tmp_ms_b_t_[10]:"" )+"#"+( ( @tmp_ms_b_t_[11] )?@tmp_ms_b_t_[11]:"" )+"#"+( ( @tmp_ms_b_t_[12] )?@tmp_ms_b_t_[12]:"" )+"#"+( ( @tmp_ms_b_t_[13] )?@tmp_ms_b_t_[13]:"" )+"#"+( ( @tmp_ms_b_t_[14] )?@tmp_ms_b_t_[14]:"" )+"#"+( ( @tmp_ms_b_t_[15] )?@tmp_ms_b_t_[15]:"" )+"#"+( ( @tmp_ms_b_ir_[0] )?@tmp_ms_b_ir_[0]:"" )+"#"+( ( @tmp_ms_b_ir_[1] )?@tmp_ms_b_ir_[1]:"" )+"#"+( ( @tmp_ms_b_ir_[2] )?@tmp_ms_b_ir_[2]:"" )+"#"+( ( @tmp_ms_b_ir_[3] )?@tmp_ms_b_ir_[3]:"" )+"#"+( ( @tmp_ms_b_ir_[4] )?@tmp_ms_b_ir_[4]:"" )+"#"+( ( @tmp_ms_b_ir_[5] )?@tmp_ms_b_ir_[5]:"" )+"#"+( ( @tmp_ms_b_ir_[6] )?@tmp_ms_b_ir_[6]:"" )+"#"+( ( @tmp_ms_b_ir_[7] )?@tmp_ms_b_ir_[7]:"" )+"#"+( ( @tmp_ms_b_ir_[8] )?@tmp_ms_b_ir_[8]:"" )+"#"+( ( @tmp_ms_b_ir_[9] )?@tmp_ms_b_ir_[9]:"" )+"#"+( ( @tmp_ms_b_ia_[0] )?@tmp_ms_b_ia_[0]:"" )+"#"+( ( @tmp_ms_b_ia_[1] )?@tmp_ms_b_ia_[1]:"" )+"#"+( ( @tmp_ms_b_ia_[2] )?@tmp_ms_b_ia_[2]:"" )+"#"+( ( @tmp_ms_b_ia_[3] )?@tmp_ms_b_ia_[3]:"" )+"#"+( ( @tmp_ms_b_ia_[4] )?@tmp_ms_b_ia_[4]:"" )+"#"+( ( @tmp_ms_b_ia_[5] )?@tmp_ms_b_ia_[5]:"" )+"#"+( ( @tmp_ms_b_ia_[6] )?@tmp_ms_b_ia_[6]:"" )+"#"+( ( @tmp_ms_b_ia_[7] )?@tmp_ms_b_ia_[7]:"" )+"#"+( ( @tmp_ms_b_ia_[8] )?@tmp_ms_b_ia_[8]:"" )+"#"+( ( @tmp_ms_b_ia_[9] )?@tmp_ms_b_ia_[9]:"" );
  500. 						deletearray @tmp_ms_b_m_$;
  501. 						deletearray @tmp_ms_b_m_;
  502. 						deletearray @tmp_ms_b_t_;
  503. 						deletearray @tmp_ms_b_ir_;
  504. 						deletearray @tmp_ms_b_ia_;
  505. 						set @m_id, 0;
  506. 						mes " ";
  507. 						mes "Mission has edited successfully";
  508. 						next;
  509. 						break;
  510. 					case 3:
  511. 						mes "["+ strnpcinfo(1) +"]";
  512. 						if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  513. 							mes "There is no mission available to remove.";
  514. 							next;
  515. 							break;
  516. 						}
  517. 						mes "Select a mission below to delete:";
  518. 						next;
  519. 						if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 0 ) set .@color$, "^0000FF";
  520. 						else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 1 ) set .@color$, "^00CC00";
  521. 						else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 2 ) set .@color$, "^FF0000";
  522. 						set .@menu$, "^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"$");
  523. 						set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  524. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  525. 							if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) set .@color$, "^0000FF";
  526. 							else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ) set .@color$, "^00CC00";
  527. 							else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 2 ) set .@color$, "^FF0000";
  528. 							set .@menu$, .@menu$ +":^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$");
  529. 						}
  530. 						set .@menu$, .@menu$ +":^000000 - back";
  531. 						set .@menu, select(.@menu$) -1;
  532. 						if ( .@menu == .@size ) break;
  533. 						mes "["+ strnpcinfo(1) +"]";
  534. 						mes "Are you sure that you want to delete the selected mission?";
  535. 						mes " ";
  536. 						set .@m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  537. 						if ( getd(".ms_b_m_"+ .@m_id +"[6]") == 0 ) set .@color$, "^0000FF";
  538. 						else if ( getd(".ms_b_m_"+ .@m_id +"[6]") == 1 ) set .@color$, "^00CC00";
  539. 						else if ( getd(".ms_b_m_"+ .@m_id +"[6]") == 2 ) set .@color$, "^FF0000";
  540. 						mes "^996600"+ .@m_id +". "+ .@color$ + getd("$ms_b_m_"+ .@m_id +"$") +"^000000";
  541. 						mes "Description: ^0000FF"+ getd("$ms_b_m_"+ .@m_id +"$[1]") +"^000000";
  542. 						next;
  543. 						if ( select ( "No", "Yes" ) == 1 ) break;
  544. 						mes "["+ strnpcinfo(1) +"]";
  545. 						mes "Mission has deleted successfully";
  546. 						mes " ";
  547. 						mes "^996600"+ .@m_id +". "+ .@color$ + getd("$ms_b_m_"+ .@m_id +"$") +"^000000";
  548. 						deletearray getd(".ms_b_m_"+ .@m_id +"$");
  549. 						deletearray getd(".ms_b_m_"+ .@m_id );
  550. 						deletearray getd(".ms_b_t_"+ .@m_id );
  551. 						deletearray getd(".ms_b_ir_"+ .@m_id );
  552. 						deletearray getd(".ms_b_ia_"+ .@m_id );
  553. 						deletearray getd("$ms_b_m_"+ .@m_id +"$");
  554. 						deletearray getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]"), 1;
  555. 						setd "$ms_b_n_"+ strnpcinfo(2) +"$", ( ( getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") )?getd(".ms_b_n_"+ strnpcinfo(2) +"[0]"):"" );
  556. 						set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  557. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  558. 							setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd("$ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"#";
  559. 						next;
  560. 						break;
  561. 					case 4:
  562. 						mes "["+ strnpcinfo(1) +"]";
  563. 						if ( getd(".ms_b_n_"+ strnpcinfo(2) ) == 0 ) {
  564. 							mes "There is no mission available to swap";
  565. 							next;
  566. 							break;
  567. 						}
  568. 						mes "Select a mission below to swap:";
  569. 						next;
  570. 						if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 0 ) set .@color$, "^0000FF";
  571. 						else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 1 ) set .@color$, "^00CC00";
  572. 						else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"[6]") == 2 ) set .@color$, "^FF0000";
  573. 						set .@menu$, "^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"[0]") +"$");
  574. 						set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2)) );
  575. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 ) {
  576. 							if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 0 ) set .@color$, "^0000FF";
  577. 							else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 1 ) set .@color$, "^00CC00";
  578. 							else if ( getd(".ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"[6]") == 2 ) set .@color$, "^FF0000";
  579. 							set .@menu$, .@menu$ +":^996600"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +". "+ .@color$ + getd("$ms_b_m_"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]") +"$");
  580. 						}
  581. 						set .@menu$, .@menu$ +":^000000 - back";
  582. 						set .@menu, select(.@menu$) -1;
  583. 						if ( .@menu == .@size ) break;
  584. 						mes "["+ strnpcinfo(1) +"]";
  585. 						mes "mission selected :";
  586. 						set .@m_id1, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]");
  587. 						if ( getd(".ms_b_m_"+ .@m_id1 +"[6]") == 0 ) set .@color1$, "^0000FF";
  588. 						else if ( getd(".ms_b_m_"+ .@m_id1 +"[6]") == 1 ) set .@color1$, "^00CC00";
  589. 						else if ( getd(".ms_b_m_"+ .@m_id1 +"[6]") == 2 ) set .@color1$, "^FF0000";
  590. 						mes "^996600"+ .@m_id1 +". "+ .@color1$ + getd("$ms_b_m_"+ .@m_id1 +"$") +"^000000";
  591. 						mes " ";
  592. 						mes "Please select another mission to be swapped:";
  593. 						next;
  594. 						set .@menu2, select(.@menu$) -1;
  595. 						if ( .@menu2 == .@size ) break;
  596. 						mes "["+ strnpcinfo(1) +"]";
  597. 						mes "Missions has swapped successfully";
  598. 						set .@m_id2, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu2 +"]");
  599. 						if ( getd(".ms_b_m_"+ .@m_id2 +"[6]") == 0 ) set .@color2$, "^0000FF";
  600. 						else if ( getd(".ms_b_m_"+ .@m_id2 +"[6]") == 1 ) set .@color2$, "^00CC00";
  601. 						else if ( getd(".ms_b_m_"+ .@m_id2 +"[6]") == 2 ) set .@color2$, "^FF0000";
  602. 						mes "^996600"+ .@m_id1 +". "+ .@color1$ + getd("$ms_b_m_"+ .@m_id1 +"$") +"^000000";
  603. 						mes "^996600"+ .@m_id2 +". "+ .@color2$ + getd("$ms_b_m_"+ .@m_id2 +"$") +"^000000";
  604. 						setd ".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu +"]", .@m_id2;
  605. 						setd ".ms_b_n_"+ strnpcinfo(2) +"["+ .@menu2 +"]", .@m_id1;
  606. 						setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd(".ms_b_n_"+ strnpcinfo(2) +"[0]");
  607. 						set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  608. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  609. 							setd "$ms_b_n_"+ strnpcinfo(2) +"$", getd("$ms_b_n_"+ strnpcinfo(2) +"$") +"#"+ getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]");
  610. 						next;
  611. 						break;
  612. 				}
  613. 			}
  614. 	}
  615. 	close;
  616. OnQuest1TimeUp:
  617. 	dispbottom "Mission #1: "+ getd("$ms_b_m_"+ @ms_b_m_1[0] +"$[0]") +" has Time Up";
  618. 	deletearray @ms_b_m_1;
  619. 	set ms_b_m_1$, "";
  620. 	end;
  621. OnQuest2TimeUp:
  622. 	dispbottom "Mission #2: "+ getd("$ms_b_m_"+ @ms_b_m_2[0] +"$[0]") +" has Time Up";
  623. 	deletearray @ms_b_m_2;
  624. 	set ms_b_m_2$, "";
  625. 	end;
  626. OnQuest3TimeUp:
  627. 	dispbottom "Mission #3: "+ getd("$ms_b_m_"+ @ms_b_m_3[0] +"$[0]") +" has Time Up";
  628. 	deletearray @ms_b_m_3;
  629. 	set ms_b_m_3$, "";
  630. 	end;
  631. OnQuest4TimeUp:
  632. 	dispbottom "Mission #4: "+ getd("$ms_b_m_"+ @ms_b_m_4[0] +"$[0]") +" has Time Up";
  633. 	deletearray @ms_b_m_4;
  634. 	set ms_b_m_4$, "";
  635. 	end;
  636. L_showprogress:
  637. 	mes "^0000FF"+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"$[0]") +"^000000";
  638. 	mes "Description: ^0000FF"+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"$[1]") +"^000000";
  639. 	mes " ";
  640. 	mes "[^804000Mission Progress^000000]";
  641. 	if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[5]") ) {
  642. 		set .@left, getd("@ms_b_m_"+ @slot +"[1]") - gettimetick(2);
  643. 		set .@hour, .@left / 3600;
  644. 		set .@min, .@left % 3600 / 60;
  645. 		set .@sec, .@left % 60;
  646. 		mes "Time Left:  ^FF0000"+( ( .@hour )?.@hour +" hour ":"" )+( ( .@hour || .@min )?.@min +" min ":"" )+ .@sec +" sec^000000";
  647. 	}
  648. 	set .@size, getarraysize( getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  649. 	for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  650. 		mes "Mobs : ^0000FF"+ getmonsterinfo( getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") , 0) +"^000000 ["+( ( getd("@ms_b_m_"+ @slot +"["+( .@i/2 +2 )+"]") > getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") )?getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]"):getd("@ms_b_m_"+ @slot +"["+( .@i/2 +2 )+"]") ) +"/"+ getd(".ms_b_t_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +"]";
  651. 	set .@size, getarraysize( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  652. 	for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  653. 		mes "Items : ^0000FF"+ getitemname( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"^000000 ["+ countitem( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"/"+ getd(".ms_b_ir_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +"]";
  654. 	mes " ";
  655. 	mes "[^009900Rewards^000000]";
  656. 	if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") )
  657. 		mes "Base Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[7]") ) +"^000000";
  658. 	if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") )
  659. 		mes "Job Exp : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[8]") ) +"^000000";
  660. 	if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") )
  661. 		mes "Zeny : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[9]") ) +"^000000";
  662. 	if ( getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") )
  663. 		mes "Cash Point : ^0000FF"+ callfunc("int__", getd(".ms_b_m_"+ getd("@ms_b_m_"+ @slot +"[0]") +"[10]") ) +"^000000";
  664. 	set .@size, getarraysize( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") ) );
  665. 	for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  666. 		mes "Item : ^0000FF"+ getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ (.@i +1) +"]") +" "+ getitemname( getd(".ms_b_ia_"+ getd("@ms_b_m_"+ @slot +"[0]") +"["+ .@i +"]") ) +"^000000";
  667. 	mes " ";
  668. 	return;
  669. L_setupmission:
  670. 	while (1) {
  671. 		mes "["+ strnpcinfo(1) +"]";
  672. 		mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  673. 		mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  674. 		mes " ";
  675. 		if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  676. 			mes "Require mobs : ^FF0000Incomplete^000000";
  677. 		set .@size, getarraysize(@tmp_ms_b_t_);
  678. 		for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  679. 			mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  680. 		if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  681. 			mes "Require items : ^FF0000Incomplete^000000";
  682. 		set .@size, getarraysize(@tmp_ms_b_ir_);
  683. 		for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  684. 			mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  685. 		mes " ";
  686. 		if ( @tmp_ms_b_m_[6] || @tmp_ms_b_m_[3] || @tmp_ms_b_m_[5] || @tmp_ms_b_m_[2] ) {
  687. 			mes "[^FF0000Limitations^000000]";
  688. 			if ( @tmp_ms_b_m_[6] )
  689. 				mes "Can do : "+( ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  690. 			if ( @tmp_ms_b_m_[3] )
  691. 				mes "Base Level :"+( ( @tmp_ms_b_m_[3] )?"  ^0000FF"+ @tmp_ms_b_m_[3] +( ( @tmp_ms_b_m_[3] != @tmp_ms_b_m_[4] )?"~"+ @tmp_ms_b_m_[4]:"" )+"^000000":"" );
  692. 			if ( @tmp_ms_b_m_[5] )
  693. 				mes "Time Limit : ^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000";
  694. 			if ( @tmp_ms_b_m_[2] ) {
  695. 				deletearray .@joblimit;
  696. 				for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  697. 					if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  698. 						set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  699. 					}
  700. 				}
  701. 				set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  702. 				set .@size, getarraysize(.@joblimit);
  703. 				for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  704. 					set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  705. 				mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  706. 			}
  707. 			mes " ";
  708. 		}
  709. 		mes "[^009900Rewards^000000]";
  710. 		if ( @tmp_ms_b_m_[7] || @tmp_ms_b_m_[8] || @tmp_ms_b_m_[9] || @tmp_ms_b_m_[10] || @tmp_ms_b_ia_ )
  711. 			set .@color_reward$, "";
  712. 		else {
  713. 			mes "^FF0000Incomplete^000000";
  714. 			set .@color_reward$, "  - ^FF0000Incomplete^000000";
  715. 		}
  716. 		if ( @tmp_ms_b_m_[7] )
  717. 			mes "Base Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[7] ) +"^000000";
  718. 		if ( @tmp_ms_b_m_[8] )
  719. 			mes "Job Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[8] ) +"^000000";
  720. 		if ( @tmp_ms_b_m_[9] )
  721. 			mes "Zeny : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[9] ) +"^000000";
  722. 		if ( @tmp_ms_b_m_[10] )
  723. 			mes "Cash Point : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[10] ) +"^000000";
  724. 		set .@size, getarraysize(@tmp_ms_b_ia_);
  725. 		for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  726. 			mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  727. 		next;
  728. 		if ( @tmp_ms_b_m_$[0] != "" && @tmp_ms_b_m_$[1] != "" && ( @tmp_ms_b_t_ || @tmp_ms_b_ir_ ) &&
  729. 			( @tmp_ms_b_m_[7] || @tmp_ms_b_m_[8] || @tmp_ms_b_m_[9] || @tmp_ms_b_m_[10] || @tmp_ms_b_ia_ ) )
  730. 			set .@color_all$, "^00CC00";
  731. 		else
  732. 			set .@color_all$, "^FF0000";
  733. 		set .@setupmenu, select (
  734. 			"Important Settings"+( ( @tmp_ms_b_m_$[0] != "" && @tmp_ms_b_m_$[1] != "" && ( @tmp_ms_b_t_ || @tmp_ms_b_ir_ ) )?"":"  - ^FF0000Incomplete^000000" ),
  735. 			"Mission Limitations",
  736. 			"Rewards"+ .@color_reward$,
  737. 			.@color_all$ +"Complete "+( ( getarg(0) )?"Edit":"Setup" )+"^000000",
  738. 			"- back" );
  739. 		switch ( .@setupmenu ) {
  740. 			case 1:
  741. 				while (1) {
  742. 					mes "["+ strnpcinfo(1) +"]";
  743. 					mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  744. 					mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  745. 					mes " ";
  746. 					if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  747. 						mes "Require mobs : ^FF0000Incomplete^000000";
  748. 					set .@size, getarraysize(@tmp_ms_b_t_);
  749. 					for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  750. 						mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  751. 					if ( @tmp_ms_b_t_ == 0 && @tmp_ms_b_ir_ == 0 )
  752. 						mes "Require items : ^FF0000Incomplete^000000";
  753. 					set .@size, getarraysize(@tmp_ms_b_ir_);
  754. 					for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  755. 						mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  756. 					next;
  757. 					set .@importantmenu, select (
  758. 						"Mission Name"+( ( @tmp_ms_b_m_$[0] != "" )?"":"  - ^FF0000Incomplete^000000" ),
  759. 						"Description"+( ( @tmp_ms_b_m_$[1] != "" )?"":"  - ^FF0000Incomplete^000000" ),
  760. 						"Require Mobs",
  761. 						"Require Items",
  762. 						"- back" );
  763. 					switch ( .@importantmenu ) {
  764. 						case 1:
  765. 							mes "["+ strnpcinfo(1) +"]";
  766. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  767. 							mes " ";
  768. 							mes "Input the mission name";
  769. 							next;
  770. 							input .@tmp$;
  771. 							mes "["+ strnpcinfo(1) +"]";
  772. 							if ( getstrlen(.@tmp$) > 60 ) {
  773. 								mes "Mission name must not more than 60 characters";
  774. 								next;
  775. 								break;
  776. 							}
  777. 							else if ( compare ( .@tmp$, ":" ) || compare ( .@tmp$, "^" ) ) {
  778. 								mes "Mission name must not allow to use these symbols";
  779. 								mes "-> : <- colon";
  780. 								mes "-> ^ <- caret";
  781. 								next;
  782. 								break;
  783. 							}
  784. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  785. 							mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  786. 							mes " ";
  787. 							mes "Are you sure to change the name to";
  788. 							mes "^0000FF"+ .@tmp$ +"^000000";
  789. 							next;
  790. 							if ( select ( "Yes", "No" ) == 2 ) break;
  791. 							set @tmp_ms_b_m_$[0], .@tmp$;
  792. 							break;
  793. 						case 2:
  794. 							mes "["+ strnpcinfo(1) +"]";
  795. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  796. 							mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  797. 							mes " ";
  798. 							mes "Input the descriptions";
  799. 							next;
  800. 							set .@tmp1$, "";
  801. 							set .@tmp2$, "";
  802. 							set .@tmp3$, "";
  803. 							set .@tmp, 0;
  804. 							do {
  805. 								set .@tmp, .@tmp +1 ;
  806. 								input getd(".@tmp"+ .@tmp +"$");
  807. 							} while ( getstrlen( getd(".@tmp"+ .@tmp +"$") ) > 50 && .@tmp < 3 );
  808. 							mes "["+ strnpcinfo(1) +"]";
  809. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  810. 							mes "Description: "+( ( @tmp_ms_b_m_$[1] != "" )?"^0000FF"+ @tmp_ms_b_m_$[1]:"^FF0000Incomplete" )+"^000000";
  811. 							mes " ";
  812. 							mes "Are you sure to change description to";
  813. 							mes "^0000FF"+ .@tmp1$ + .@tmp2$ + .@tmp3$ +"^000000";
  814. 							next;
  815. 							if ( select ( "Yes", "No" ) == 2 ) break;
  816. 							set @tmp_ms_b_m_$[1], .@tmp1$ + .@tmp2$ + .@tmp3$;
  817. 							break;
  818. 						case 3:
  819. 							if ( getarg(0) ) {
  820. 								mes "["+ strnpcinfo(1) +"]";
  821. 								mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  822. 								mes " ";
  823. 								mes "Require Mobs are not allow to edit";
  824. 								next;
  825. 								break;
  826. 							}
  827. 							while (1) {
  828. 								mes "["+ strnpcinfo(1) +"]";
  829. 								mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  830. 								mes " ";
  831. 								if ( @tmp_ms_b_t_ == 0 )
  832. 									mes "Require mobs :";
  833. 								set .@size, getarraysize(@tmp_ms_b_t_);
  834. 								for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  835. 									mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  836. 								next;
  837. 								set .@mobmenu, select ( "Add a monster requirement", "Remove a monster requirement", "- back" );
  838. 								switch ( .@mobmenu ) {
  839. 									case 1:
  840. 										mes "["+ strnpcinfo(1) +"]";
  841. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  842. 										mes " ";
  843. 										if ( @tmp_ms_b_t_ == 0 )
  844. 											mes "Require mobs :";
  845. 										set .@size, getarraysize(@tmp_ms_b_t_);
  846. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  847. 											mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  848. 										mes " ";
  849. 										if ( .@size == 16 ) {
  850. 											mes "Require mobs are only allow up to 8 different kinds";
  851. 											next;
  852. 											break;
  853. 										}
  854. 										mes "Input monster ID";
  855. 										next;
  856. 										input .@tmp, 0, 9999;
  857. 										mes "["+ strnpcinfo(1) +"]";
  858. 										if ( .@tmp == 0 ) {
  859. 											mes "Invalid monster ID";
  860. 											next;
  861. 											break;
  862. 										}
  863. 										else if ( getmonsterinfo(.@tmp, 1) == -1 ) {
  864. 											mes "Invalid monster ID";
  865. 											next;
  866. 											break;
  867. 										}
  868. 										if ( @tmp_ms_b_t_ == 0 )
  869. 											mes "Require mobs :";
  870. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  871. 											mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  872. 										mes " ";
  873. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  874. 											if ( .@tmp == @tmp_ms_b_t_[.@i] ) break;
  875. 										}
  876. 										if ( .@i != .@size ) {
  877. 											mes "Monster ^0000FF"+ getmonsterinfo(.@tmp, 0) +"^000000 is Repeated";
  878. 											next;
  879. 											break;
  880. 										}
  881. 										mes "Require mobs : ^0000FF"+ getmonsterinfo(.@tmp, 0) +"^000000";
  882. 										mes "Input an amount need to be hunt";
  883. 										next;
  884. 										input .@tmp2, 0, 999;
  885. 										if ( .@tmp2 == 0 ) {
  886. 											mes "["+ strnpcinfo(1) +"]";
  887. 											mes "Invalid amount";
  888. 											next;
  889. 										}
  890. 										else
  891. 											setarray @tmp_ms_b_t_[ .@size ], .@tmp, .@tmp2;
  892. 										break;
  893. 									case 2:
  894. 										mes "["+ strnpcinfo(1) +"]";
  895. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  896. 										mes " ";
  897. 										if ( @tmp_ms_b_t_ == 0 ) {
  898. 											mes "There are no monster to remove";
  899. 											next;
  900. 											break;
  901. 										}
  902. 										set .@size, getarraysize(@tmp_ms_b_t_);
  903. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  904. 											mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  905. 										mes " ";
  906. 										mes "Select a mob to delete";
  907. 										next;
  908. 										set .@menu$, "^0000FF"+ @tmp_ms_b_t_[1] +" "+ getmonsterinfo(@tmp_ms_b_t_, 0);
  909. 										for ( set .@i, 2; .@i < .@size; set .@i, .@i +2 )
  910. 											set .@menu$, .@menu$ +":"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0);
  911. 										set .@menu$, .@menu$ +"^000000:- back";
  912. 										set .@menu, select(.@menu$) -1;
  913. 										if ( .@menu == .@size /2 ) break;
  914. 										deletearray @tmp_ms_b_t_[ .@menu *2 ], 2;
  915. 									case 3:
  916. 								}
  917. 								if ( .@mobmenu == 3 ) break;
  918. 							}
  919. 							break;
  920. 						case 4:
  921. 							while (1) {
  922. 								mes "["+ strnpcinfo(1) +"]";
  923. 								mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  924. 								mes " ";
  925. 								if ( @tmp_ms_b_ir_ == 0 )
  926. 									mes "Require items :";
  927. 								set .@size, getarraysize(@tmp_ms_b_ir_);
  928. 								for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  929. 									mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  930. 								next;
  931. 								set .@item_require_menu, select ( "add item requirement", "remove a require item", "- back" );
  932. 								switch ( .@item_require_menu ) {
  933. 									case 1:
  934. 										mes "["+ strnpcinfo(1) +"]";
  935. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  936. 										mes " ";
  937. 										if ( @tmp_ms_b_ir_ == 0 )
  938. 											mes "Require items : ";
  939. 										set .@size, getarraysize(@tmp_ms_b_ir_);
  940. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  941. 											mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  942. 										mes " ";
  943. 										if ( .@size == 10 ) {
  944. 											mes "Require items are only allow up to 5 different kinds";
  945. 											next;
  946. 											break;
  947. 										}
  948. 										mes "Input item ID";
  949. 										next;
  950. 										input .@tmp, 0, 32767;
  951. 										mes "["+ strnpcinfo(1) +"]";
  952. 										if ( getitemname(.@tmp) == "null" ) {
  953. 											mes "Invalid item ID";
  954. 											next;
  955. 											break;
  956. 										}
  957. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  958. 										mes " ";
  959. 										if ( @tmp_ms_b_ir_ == 0 )
  960. 											mes "Require items : ";
  961. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  962. 											mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  963. 										mes " ";
  964. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  965. 											if ( .@tmp == @tmp_ms_b_ir_[.@i] ) break;
  966. 										}
  967. 										if ( .@i != .@size ) {
  968. 											mes "Item ^0000FF"+ getitemname(.@tmp) +"^000000 is repeated";
  969. 											next;
  970. 											break;
  971. 										}
  972. 										mes "Require items : ^0000FF"+ getitemname(.@tmp) +"^000000";
  973. 										mes "input the amount required for this item";
  974. 										next;
  975. 										input .@tmp2, 0, 30000;
  976. 										if ( .@tmp2 == 0 ) {
  977. 											mes "["+ strnpcinfo(1) +"]";
  978. 											mes "Invalid amount";
  979. 											next;
  980. 										}
  981. 										else
  982. 											setarray @tmp_ms_b_ir_[ .@size ], .@tmp, .@tmp2;
  983. 										break;
  984. 									case 2:
  985. 										mes "["+ strnpcinfo(1) +"]";
  986. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  987. 										mes " ";
  988. 										if ( @tmp_ms_b_ir_ == 0 ) {
  989. 											mes "There are no item to be remove";
  990. 											next;
  991. 											break;
  992. 										}
  993. 										set .@size, getarraysize(@tmp_ms_b_ir_);
  994. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  995. 											mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  996. 										mes " ";
  997. 										mes "Select an item to delete";
  998. 										next;
  999. 										set .@menu$, "^0000FF"+ @tmp_ms_b_ir_[1] +" "+ getitemname(@tmp_ms_b_ir_);
  1000. 										for ( set .@i, 2; .@i < .@size; set .@i, .@i +2 )
  1001. 											set .@menu$, .@menu$ +":"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]);
  1002. 										set .@menu$, .@menu$ +"^000000:- back";
  1003. 										set .@menu, select(.@menu$) -1;
  1004. 										if ( .@menu == .@size /2 ) break;
  1005. 										deletearray @tmp_ms_b_ir_[ .@menu *2 ], 2;
  1006. 									case 3:
  1007. 								}
  1008. 								if ( .@item_require_menu == 3 ) break;
  1009. 							}
  1010. 						case 5:
  1011. 					}
  1012. 					if ( .@importantmenu == 5 ) break;
  1013. 				}
  1014. 				break;
  1015. 			case 2:
  1016. 				while (1) {
  1017. 					mes "["+ strnpcinfo(1) +"]";
  1018. 					mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1019. 					mes " ";
  1020. 					mes "[^FF0000Limitations^000000]";
  1021. 					mes "Can do : "+( ( @tmp_ms_b_m_[6] == 0 )?"^0000FFRepeatedly": ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  1022. 					mes "Base Level :"+( ( @tmp_ms_b_m_[3] )?"  ^0000FF"+ @tmp_ms_b_m_[3] +( ( @tmp_ms_b_m_[3] != @tmp_ms_b_m_[4] )?"~"+ @tmp_ms_b_m_[4]:"" )+"^000000":"" );
  1023. 					mes "Time Limit : "+( ( @tmp_ms_b_m_[5] )?"^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000":"" );
  1024. 					if ( @tmp_ms_b_m_[2] == 0 )
  1025. 						mes "Job Limit : ^FF0000<none>^000000";
  1026. 					else {
  1027. 						deletearray .@joblimit;
  1028. 						for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  1029. 							if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  1030. 								set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  1031. 							}
  1032. 						}
  1033. 						set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  1034. 						set .@size, getarraysize(.@joblimit);
  1035. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  1036. 							set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  1037. 						mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  1038. 					}
  1039. 					next;
  1040. 					set .@limitmenu, select ( "Mission Status (Can do)", "Base Level", "Time Limit", "Job limitation", "- back" );
  1041. 					switch ( .@limitmenu ) {
  1042. 						case 1:
  1043. 							mes "["+ strnpcinfo(1) +"]";
  1044. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1045. 							mes " ";
  1046. 							mes "Can do : "+( ( @tmp_ms_b_m_[6] == 0 )?"^0000FFRepeatedly": ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  1047. 							mes "Please select a status";
  1048. 							next;
  1049. 							switch ( select ( "^0000FFRepeatedly^000000", "^00CC00Everyday^000000", "^FF0000Only Once^000000" ) ) {
  1050. 								case 1: set @tmp_ms_b_m_[6], 0; break;
  1051. 								case 2: set @tmp_ms_b_m_[6], 1; break;
  1052. 								case 3: set @tmp_ms_b_m_[6], 2;
  1053. 							}
  1054. 							break;
  1055. 						case 2:
  1056. 							mes "["+ strnpcinfo(1) +"]";
  1057. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1058. 							mes " ";
  1059. 							mes "Base Level :";
  1060. 							mes " ";
  1061. 							mes "Input starting range";
  1062. 							next;
  1063. 							input .@tmp, 0, 1000;
  1064. 							if ( .@tmp == 0 ) {
  1065. 								mes "["+ strnpcinfo(1) +"]";
  1066. 								mes "invalid value";
  1067. 								set @tmp_ms_b_m_[3], 0;
  1068. 								set @tmp_ms_b_m_[4], 0;
  1069. 								next;
  1070. 								break;
  1071. 							}
  1072. 							mes "["+ strnpcinfo(1) +"]";
  1073. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1074. 							mes " ";
  1075. 							mes "Base Level : ^0000FF"+ .@tmp +"~^000000";
  1076. 							mes " ";
  1077. 							mes "Input ending range";
  1078. 							next;
  1079. 							input .@tmp2, 0, 1000;
  1080. 							if ( .@tmp2 == 0 ) {
  1081. 								mes "["+ strnpcinfo(1) +"]";
  1082. 								mes "invalid value";
  1083. 								set @tmp_ms_b_m_[3], 0;
  1084. 								set @tmp_ms_b_m_[4], 0;
  1085. 								next;
  1086. 								break;
  1087. 							}
  1088. 							else if ( .@tmp > .@tmp2 ) {
  1089. 								mes "["+ strnpcinfo(1) +"]";
  1090. 								mes "Ending range cannot higher than starting range";
  1091. 								next;
  1092. 								break;
  1093. 							}
  1094. 							else
  1095. 								setarray @tmp_ms_b_m_[3], .@tmp, .@tmp2;
  1096. 							break;
  1097. 						case 3:
  1098. 							mes "["+ strnpcinfo(1) +"]";
  1099. 							mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1100. 							mes " ";
  1101. 							mes "Time Limit : "+( ( @tmp_ms_b_m_[5] )?"^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000":"" );
  1102. 							mes "      1 = 1 minute";
  1103. 							mes "    60 = 1 hour";
  1104. 							mes "1440 = 1 day";
  1105. 							next;
  1106. 							input @tmp_ms_b_m_[5], 0, 1440;
  1107. 							break;
  1108. 						case 4:
  1109. 							while (1) {
  1110. 								mes "["+ strnpcinfo(1) +"]";
  1111. 								mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1112. 								mes " ";
  1113. 								if ( @tmp_ms_b_m_[2] == 0 )
  1114. 									mes "Job Limit : ^FF0000<none>^000000";
  1115. 								else {
  1116. 									deletearray .@joblimit;
  1117. 									for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  1118. 										if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  1119. 											set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  1120. 										}
  1121. 									}
  1122. 									set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  1123. 									set .@size, getarraysize(.@joblimit);
  1124. 									for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  1125. 										set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  1126. 									mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  1127. 								}
  1128. 								next;
  1129. 								set .@menu$, ( ( @tmp_ms_b_m_[2] & pow( 2, 0 ) )?"^00CC00":"^FF0000" )+ .jobname$;
  1130. 								for ( set .@i, 1; .@i < 24; set .@i,.@i +1 )
  1131. 									set .@menu$, .@menu$ +":"+( ( @tmp_ms_b_m_[2] & pow( 2, .@i ) )?"^00CC00":"^FF0000" )+ .jobname$[.@i];
  1132. 								set .@menu$, .@menu$ +":^000000- back";
  1133. 								set .@menu, select(.@menu$) -1;
  1134. 								if ( .@menu == 24 ) break;
  1135. 								set @tmp_ms_b_m_[2], @tmp_ms_b_m_[2] ^ pow( 2, .@menu );
  1136. 							}
  1137. 							break;
  1138. 						case 5:
  1139. 					}
  1140. 					if ( .@limitmenu == 5 ) break;
  1141. 				}
  1142. 				break;
  1143. 			case 3:
  1144. 				while (1) {
  1145. 					mes "["+ strnpcinfo(1) +"]";
  1146. 					mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1147. 					mes " ";
  1148. 					mes "[^009900Rewards^000000]";
  1149. 					mes "Base Exp : "+( ( @tmp_ms_b_m_[7] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[7] ):"^FF00000" ) +"^000000";
  1150. 					mes "Job Exp : "+( ( @tmp_ms_b_m_[8] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[8] ):"^FF00000" ) +"^000000";
  1151. 					mes "Zeny : "+( ( @tmp_ms_b_m_[9] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[9] ):"^FF00000" ) +"^000000 ";
  1152. 					mes "Cash Point : "+( ( @tmp_ms_b_m_[10] )?"^0000FF"+ callfunc("int__", @tmp_ms_b_m_[10] ):"^FF00000" ) +"^000000";
  1153. 					if ( @tmp_ms_b_ia_ == 0 )
  1154. 						mes "Item : ";
  1155. 					set .@size, getarraysize(@tmp_ms_b_ia_);
  1156. 					for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1157. 						mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1158. 					next;
  1159. 					set .@rewardmenu, select ( "Base Exp", "Job Exp", "Zeny", "Cash Points", "Item Rewards", "- back" );
  1160. 					switch ( .@rewardmenu ) {
  1161. 						case 1:
  1162. 							input @tmp_ms_b_m_[7], 0, 2000000000;
  1163. 							break;
  1164. 						case 2:
  1165. 							input @tmp_ms_b_m_[8], 0, 2000000000;
  1166. 							break;
  1167. 						case 3:
  1168. 							input @tmp_ms_b_m_[9], 0, 2000000000;
  1169. 							break;
  1170. 						case 4:
  1171. 							input @tmp_ms_b_m_[10], 0, 2000000000;
  1172. 							break;
  1173. 						case 5:
  1174. 							while (1) {
  1175. 								mes "["+ strnpcinfo(1) +"]";
  1176. 								mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1177. 								mes " ";
  1178. 								if ( @tmp_ms_b_ia_ == 0 )
  1179. 									mes "Item :";
  1180. 								set .@size, getarraysize(@tmp_ms_b_ia_);
  1181. 								for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1182. 									mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1183. 								next;
  1184. 								set .@item_reward_menu, select ( "Add an item reward", "Remove an item reward", "- back" );
  1185. 								switch ( .@item_reward_menu ) {
  1186. 									case 1:
  1187. 										mes "["+ strnpcinfo(1) +"]";
  1188. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1189. 										mes " ";
  1190. 										if ( @tmp_ms_b_ia_ == 0 )
  1191. 											mes "Item : ";
  1192. 										set .@size, getarraysize(@tmp_ms_b_ia_);
  1193. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1194. 											mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1195. 										mes " ";
  1196. 										if ( .@size == 10 ) {
  1197. 											mes "Items Rewards are only allow up to 5 different kinds";
  1198. 											next;
  1199. 											break;
  1200. 										}
  1201. 										mes "Input item id";
  1202. 										next;
  1203. 										input .@tmp, 0, 32767;
  1204. 										mes "["+ strnpcinfo(1) +"]";
  1205. 										if ( getitemname(.@tmp) == "null" ) {
  1206. 											mes "Invalid item id";
  1207. 											next;
  1208. 											break;
  1209. 										}
  1210. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1211. 										mes " ";
  1212. 										if ( @tmp_ms_b_ia_ == 0 )
  1213. 											mes "Item : ";
  1214. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1215. 											mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1216. 										mes " ";
  1217. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  1218. 											if ( .@tmp == @tmp_ms_b_ia_[.@i] ) break;
  1219. 										}
  1220. 										if ( .@i != .@size ) {
  1221. 											mes "Item ^0000FF"+ getitemname(.@tmp) +"^000000 is repeated";
  1222. 											next;
  1223. 											break;
  1224. 										}
  1225. 										mes "Item : ^0000FF"+ getitemname(.@tmp) +"^000000";
  1226. 										mes "Input the amount rewards for this item";
  1227. 										next;
  1228. 										input .@tmp2, 0, 30000;
  1229. 										if ( .@tmp2 == 0 ) {
  1230. 											mes "["+ strnpcinfo(1) +"]";
  1231. 											mes "Invalid amount";
  1232. 											next;
  1233. 										}
  1234. 										else
  1235. 											setarray @tmp_ms_b_ia_[ .@size ], .@tmp, .@tmp2;
  1236. 										break;
  1237. 									case 2:
  1238. 										mes "["+ strnpcinfo(1) +"]";
  1239. 										mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1240. 										mes " ";
  1241. 										if ( @tmp_ms_b_ia_ == 0 ) {
  1242. 											mes "There is no item rewards to remove";
  1243. 											next;
  1244. 											break;
  1245. 										}
  1246. 										set .@size, getarraysize(@tmp_ms_b_ia_);
  1247. 										for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1248. 											mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1249. 										mes " ";
  1250. 										mes "Select an item rewards to delete";
  1251. 										next;
  1252. 										set .@menu$, "^0000FF"+ @tmp_ms_b_ia_[1] +" "+ getitemname(@tmp_ms_b_ia_);
  1253. 										for ( set .@i, 2; .@i < .@size; set .@i, .@i +2 )
  1254. 											set .@menu$, .@menu$ +":"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]);
  1255. 										set .@menu$, .@menu$ +"^000000:- back";
  1256. 										set .@menu, select(.@menu$) -1;
  1257. 										if ( .@menu == .@size /2 ) break;
  1258. 										deletearray @tmp_ms_b_ia_[ .@menu *2 ], 2;
  1259. 									case 3:
  1260. 								}
  1261. 								if ( .@item_reward_menu == 3 ) break;
  1262. 							}
  1263. 						case 6:
  1264. 					}
  1265. 					if ( .@rewardmenu == 6 ) break;
  1266. 				}
  1267. 				break;
  1268. 			case 4:
  1269. 				mes "["+ strnpcinfo(1) +"]";
  1270. 				if ( @tmp_ms_b_m_$[0] != "" && @tmp_ms_b_m_$[1] != "" && ( @tmp_ms_b_t_ || @tmp_ms_b_ir_ ) &&
  1271. 					( @tmp_ms_b_m_[7] || @tmp_ms_b_m_[8] || @tmp_ms_b_m_[9] || @tmp_ms_b_m_[10] || @tmp_ms_b_ia_ ) ) {
  1272. 					mes "mission ID: ^996600"+( ( getarg(0) == 0 )?$ms_b_id +1:@m_id )+"^000000";
  1273. 					mes "Name : ^0000FF"+ @tmp_ms_b_m_$[0] +"^000000";
  1274. 				}
  1275. 				else {
  1276. 					mes "Name : "+( ( @tmp_ms_b_m_$[0] != "" )?"^0000FF"+ @tmp_ms_b_m_$[0]:"^FF0000Incomplete" )+"^000000";
  1277. 					mes " ";
  1278. 					mes "Some field are still Incomplete !";
  1279. 					next;
  1280. 					break;
  1281. 				}
  1282. 				mes "Description: ^0000FF"+ @tmp_ms_b_m_$[1] +"^000000";
  1283. 				mes " ";
  1284. 				set .@size, getarraysize(@tmp_ms_b_t_);
  1285. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1286. 					mes "Require mobs : ^0000FF"+ @tmp_ms_b_t_[.@i +1] +" "+ getmonsterinfo(@tmp_ms_b_t_[.@i], 0) +"^000000";
  1287. 				set .@size, getarraysize(@tmp_ms_b_ir_);
  1288. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1289. 					mes "Require items : ^0000FF"+ @tmp_ms_b_ir_[.@i +1] +" "+ getitemname(@tmp_ms_b_ir_[.@i]) +"^000000";
  1290. 					mes " ";
  1291. 				if ( @tmp_ms_b_m_[6] || @tmp_ms_b_m_[3] || @tmp_ms_b_m_[5] || @tmp_ms_b_m_[2] ) {
  1292. 					mes "[^FF0000Limitations^000000]";
  1293. 					if ( @tmp_ms_b_m_[6] )
  1294. 						mes "Can do : "+( ( @tmp_ms_b_m_[6] == 1 )?"^00CC00Everyday":"^FF0000Only Once" )+"^000000";
  1295. 					if ( @tmp_ms_b_m_[3] )
  1296. 						mes "Base Level :"+( ( @tmp_ms_b_m_[3] )?"  ^0000FF"+ @tmp_ms_b_m_[3] +( ( @tmp_ms_b_m_[3] != @tmp_ms_b_m_[4] )?"~"+ @tmp_ms_b_m_[4]:"" )+"^000000":"" );
  1297. 					if ( @tmp_ms_b_m_[5] )
  1298. 						mes "Time Limit : ^FF0000"+( ( @tmp_ms_b_m_[5] /60 )?@tmp_ms_b_m_[5] /60 +" hour"+( ( @tmp_ms_b_m_[5] %60 )?" ":"" ):"" )+( ( @tmp_ms_b_m_[5] %60 )?@tmp_ms_b_m_[5] %60 +" min":"" )+"^000000";
  1299. 					if ( @tmp_ms_b_m_[2] ) {
  1300. 						deletearray .@joblimit;
  1301. 						for ( set .@i, 0; .@i < 24; set .@i, .@i +1 ) {
  1302. 							if ( @tmp_ms_b_m_[2] & pow( 2, .@i ) ) {
  1303. 								set .@joblimit[ getarraysize(.@joblimit) ], .@i +1;
  1304. 							}
  1305. 						}
  1306. 						set .@joblimit$, .jobname$[ .@joblimit[0] -1 ];
  1307. 						set .@size, getarraysize(.@joblimit);
  1308. 						for ( set .@i, 1; .@i < .@size; set .@i, .@i +1 )
  1309. 							set .@joblimit$, .@joblimit$ +", "+ .jobname$[ .@joblimit[.@i] -1 ];
  1310. 						mes "Job Limit : ^00CC00"+ .@joblimit$ +"^000000";
  1311. 					}
  1312. 					mes " ";
  1313. 				}
  1314. 				mes "[^009900Rewards^000000]";
  1315. 				if ( @tmp_ms_b_m_[7] )
  1316. 					mes "Base Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[7] ) +"^000000";
  1317. 				if ( @tmp_ms_b_m_[8] )
  1318. 					mes "Job Exp : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[8] ) +"^000000";
  1319. 				if ( @tmp_ms_b_m_[9] )
  1320. 					mes "Zeny : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[9] ) +"^000000";
  1321. 				if ( @tmp_ms_b_m_[10] )
  1322. 					mes "Cash Point : ^0000FF"+ callfunc("int__", @tmp_ms_b_m_[10] ) +"^000000";
  1323. 				set .@size, getarraysize(@tmp_ms_b_ia_);
  1324. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1325. 					mes "Item : ^0000FF"+ @tmp_ms_b_ia_[.@i +1] +" "+ getitemname(@tmp_ms_b_ia_[.@i]) +"^000000";
  1326. 				return 1;
  1327. 			case 5:
  1328. 				return 0;
  1329. 		}
  1330. 	}
  1331. 	end;
  1332. OnInit:
  1333. 	set .loading, 1;
  1334. 	set .total_npc, .total_npc +1 ;
  1335. 	if ( atoi( strnpcinfo(2) ) <= 0 || atoi( strnpcinfo(2) ) > 127 ) {
  1336. 		debugmes "Mission Board: invalid npc id #"+ strnpcinfo(2);
  1337. 		goto L_load_finish;
  1338. 	}
  1339. 	else if ( .ms_b_name$[ atoi( strnpcinfo(2) ) ] != "" ) {
  1340. 		debugmes "Mission Board: duplicate npc id #"+ strnpcinfo(2);
  1341. 		set .duplicate_id[ getarraysize(.duplicate_id) ], atoi( strnpcinfo(2) );
  1342. 		goto L_load_finish;
  1343. 	}
  1344. 	set .ms_b_name$[ atoi( strnpcinfo(2) ) ], strnpcinfo(1);
  1345. 	explode .@ms_b_n_$, getd("$ms_b_n_"+ strnpcinfo(2) +"$"), "#";
  1346. 	set .@ex_size, getarraysize(.@ms_b_n_$);
  1347. 	set .@i, 0;
  1348. 	while ( .@i < .@ex_size ) {
  1349. 		setd ".ms_b_n_"+ strnpcinfo(2) +"["+ .@i +"]", atoi( .@ms_b_n_$[.@i] );
  1350. 		set .@i, .@i +1 ;
  1351. 	}
  1352. 	set .@size, getarraysize( getd(".ms_b_n_"+ strnpcinfo(2) ) );
  1353. 	while ( .@id < .@size ) {
  1354. 		set .@m_id, getd(".ms_b_n_"+ strnpcinfo(2) +"["+ .@id +"]");
  1355. 		explode .@ms_b_m_$[2], getd("$ms_b_m_"+ .@m_id +"$[2]"), "#";
  1356. 		set .@ex_size, getarraysize(.@ms_b_m_$);
  1357. 		set .@i, 0;
  1358. 		while ( .@i < .@ex_size ) {
  1359. 			setd ".ms_b_m_"+ .@m_id +"["+ .@i +"]", atoi( .@ms_b_m_$[.@i] );
  1360. 			set .@i, .@i +1 ;
  1361. 		}
  1362. 		explode .@ms_b_t_$, getd("$ms_b_m_"+ .@m_id +"$[3]"), "#";
  1363. 		set .@ex_size, getarraysize(.@ms_b_t_$);
  1364. 		set .@i, 0;
  1365. 		while ( .@i < .@ex_size ) {
  1366. 			setd ".ms_b_t_"+ .@m_id +"["+ .@i +"]", atoi( .@ms_b_t_$[.@i] );
  1367. 			set .@i, .@i +1 ;
  1368. 		}		
  1369. 		copyarray getd(".ms_b_ir_"+ .@m_id), getd(".ms_b_t_"+ .@m_id +"[16]"), 10;
  1370. 		copyarray getd(".ms_b_ia_"+ .@m_id), getd(".ms_b_t_"+ .@m_id +"[26]"), 10;
  1371. 		deletearray getd(".ms_b_t_"+ .@m_id +"[16]"), 20;
  1372. 		set .@id, .@id +1 ;
  1373. 		sleep 1;
  1374. 	}
  1375. L_load_finish:
  1376. 	set .finish, .finish +1;
  1377. 	if ( .finish == .total_npc ) {
  1378. 		set .finish, 0;
  1379. 		set .total_npc, 0;
  1380. 		set .loading, 0;
  1381. 		setarray .jobname$,	"(Super) Novice","Swordman","Mage","Archer","Acolyte","Merchant","Thief","Knight","Priest","Wizard","Blacksmith","Hunter","Assassin","Crusader","Monk","Sage","Rogue","Alchemist","Bard/Dancer","Taekwon","Star Gladiator","Soul Linker","Gunslinger","Ninja";
  1382. 	}
  1383. 	end;
  1384. }
  1385.  
  1386. -	script	mission	-1,{
  1387. OnWhisperGlobal:
  1388. 	if ( getvariableofnpc( .loading, "ms_b_") == 1 ) {
  1389. 		dispbottom "Mission Board: Loading Mission Data ......";
  1390. 		end;
  1391. 	}
  1392. 	if ( @ms_b_loading == 1 ) {
  1393. 		dispbottom "Mission Board: Loading Player Data ......";
  1394. 		end;
  1395. 	}
  1396. 	for ( set .@i, 1; .@i <= 4; set .@i, .@i +1 ) {
  1397. 		if ( getd("@ms_b_m_"+ .@i) ) {
  1398. 			if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") == "" ) {
  1399. 				dispbottom "Mission Board: Your Mission#"+ .@i +" has deleted because it is no longer available";
  1400. 				deletearray getd("@ms_b_m_"+ .@i);
  1401. 				setd "ms_b_m_"+ .@i +"$", "";
  1402. 				deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  1403. 			}
  1404. 			else if ( getd("@ms_b_m_"+ .@i +"[1]") && getd("@ms_b_m_"+ .@i +"[1]") <= gettimetick(2) ) {
  1405. 				dispbottom "Mission #1: "+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@i +"[0]") +"$[0]") +" has Time Up";
  1406. 				deletearray getd("@ms_b_m_"+ .@i);
  1407. 				setd "ms_b_m_"+ .@i +"$", "";
  1408. 				deltimer "ms_b_::OnQuest"+ .@i +"TimeUp";
  1409. 			}
  1410. 		}
  1411. 	}
  1412. 	dispbottom "[Mission Progress]";
  1413. 	if ( @ms_b_m_1 == 0 && @ms_b_m_2 == 0 && @ms_b_m_3 == 0 && @ms_b_m_4 == 0 ) {
  1414. 		dispbottom ">> no mission";
  1415. 		end;
  1416. 	}
  1417. 	for ( set .@j, 1; .@j <= 4; set .@j, .@j +1 ) {
  1418. 		if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1419. 			dispbottom "   -----------------------";
  1420. 			dispbottom "   Mission #"+ .@j +":  "+ getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]");
  1421. 			if ( getvariableofnpc( getd(".ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"[5]"), "ms_b_" ) ) {
  1422. 				set .@left, getd("@ms_b_m_"+ .@j +"[1]") - gettimetick(2);
  1423. 				set .@hour, .@left / 3600;
  1424. 				set .@min, .@left % 3600 / 60;
  1425. 				set .@sec, .@left % 60;
  1426. 				dispbottom "       Time Left:  "+( ( .@hour )?.@hour +" hour ":"" )+( ( .@hour || .@min )?.@min +" min ":"" )+ .@sec +" sec";
  1427. 			}
  1428. 			if ( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) ) {
  1429. 				dispbottom "       Require mobs:";
  1430. 				set .@size, getarraysize( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1431. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1432. 					dispbottom "           "+ getmonsterinfo( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) , 0) +" ["+( ( getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") > getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ) )?getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ):getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") ) +"/"+ getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ) +"]";
  1433. 			}
  1434. 			if ( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) ) {
  1435. 				dispbottom "       Require items:";
  1436. 				set .@size, getarraysize( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1437. 				for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 )
  1438. 					dispbottom "           "+ getitemname( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) ) +" ["+ countitem( getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) ) +"/"+ getvariableofnpc( getd(".ms_b_ir_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ (.@i +1) +"]"), "ms_b_" ) +"]";
  1439. 			}
  1440. 		}
  1441. 	}
  1442. 	dispbottom "   -----------------------";
  1443. 	end;
  1444. OnNPCKillEvent:
  1445. 	set .@killedrid, killedrid;
  1446. 	if ( getvariableofnpc( .loading, "ms_b_") == 1 ) end;
  1447. 	if ( getcharid(1) == 0 ) {
  1448. 		if ( @ms_b_loading == 1 ) end;
  1449. 		for ( set .@j, 1; .@j <= 4; set .@j, .@j +1 ) {
  1450. 			if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1451. 				if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]") == "" ) {
  1452. 					dispbottom "Mission Board: Your Mission#"+ .@j +" has deleted because it is no longer available";
  1453. 					deletearray getd("@ms_b_m_"+ .@j);
  1454. 					setd "ms_b_m_"+ .@j +"$", "";
  1455. 					deltimer "ms_b_::OnQuest"+ .@j +"TimeUp";
  1456. 				}
  1457. 				else {
  1458. 					set .@size, getarraysize( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1459. 					for ( set .@i, 0; .@i < .@size; set .@i, .@i +2 ) {
  1460. 						if ( .@killedrid == getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) && getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") < getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) ) {
  1461. 							setd "@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]", getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +1;
  1462. 							dispbottom "Mission #"+ .@j +". You have killed "+ getmonsterinfo( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ), 0 ) +" ["+ getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +"/"+ getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) +"]";
  1463. 							setd "ms_b_m_"+ .@j +"$", getd("@ms_b_m_"+ .@j +"[0]") +"#"+( ( getd("@ms_b_m_"+ .@j +"[1]") )?getd("@ms_b_m_"+ .@j +"[1]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[2]") )?getd("@ms_b_m_"+ .@j +"[2]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[3]") )?getd("@ms_b_m_"+ .@j +"[3]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[4]") )?getd("@ms_b_m_"+ .@j +"[4]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[5]") )?getd("@ms_b_m_"+ .@j +"[5]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[6]") )?getd("@ms_b_m_"+ .@j +"[6]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[7]") )?getd("@ms_b_m_"+ .@j +"[7]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[8]") )?getd("@ms_b_m_"+ .@j +"[8]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[9]") )?getd("@ms_b_m_"+ .@j +"[9]"):"" );
  1464. 						}
  1465. 					}
  1466. 				}
  1467. 			}
  1468. 		}
  1469. 		end;
  1470. 	}
  1471. 	getmapxy .@map1$, .@x1, .@y1, 0;
  1472. 	getpartymember getcharid(1), 1;
  1473. 	getpartymember getcharid(1), 2;
  1474. 	set .@k, 0;
  1475. 	while ( .@k < $@partymembercount ) {
  1476. 		if ( isloggedin( $@partymemberaid[.@k], $@partymembercid[.@k] ) ) {
  1477. 			attachrid $@partymemberaid[.@k];
  1478. 			getmapxy .@map2$, .@x2, .@y2, 0;
  1479. 			if ( @ms_b_loading == 0 && .@map1$ == .@map2$ && distance(.@x1,.@y1,.@x2,.@y2) <= 30 ) {
  1480. 				set .@j, 1;
  1481. 				while ( .@j <= 4 ) {
  1482. 					if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1483. 						if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]") == "" ) {
  1484. 							dispbottom "Mission Board: Your Mission#"+ .@j +" has deleted because it is no longer available";
  1485. 							deletearray getd("@ms_b_m_"+ .@j);
  1486. 							setd "ms_b_m_"+ .@j +"$", "";
  1487. 							deltimer "ms_b_::OnQuest"+ .@j +"TimeUp";
  1488. 						}
  1489. 						else {
  1490. 							set .@i, 0;
  1491. 							set .@size, getarraysize( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") ), "ms_b_" ) );
  1492. 							while ( .@i < .@size ) {
  1493. 								if ( .@killedrid == getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ) && getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") < getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) ) {
  1494. 									setd "@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]", getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +1;
  1495. 									dispbottom "Mission #"+ .@j +". You have killed "+ getmonsterinfo( getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+ .@i +"]"), "ms_b_" ), 0 ) +" ["+ getd("@ms_b_m_"+ .@j +"["+( .@i/2 +2 )+"]") +"/"+ getvariableofnpc( getd(".ms_b_t_"+ getd("@ms_b_m_"+ .@j +"[0]") +"["+( .@i +1 )+"]"), "ms_b_" ) +"]";
  1496. 									setd "ms_b_m_"+ .@j +"$", getd("@ms_b_m_"+ .@j +"[0]") +"#"+( ( getd("@ms_b_m_"+ .@j +"[1]") )?getd("@ms_b_m_"+ .@j +"[1]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[2]") )?getd("@ms_b_m_"+ .@j +"[2]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[3]") )?getd("@ms_b_m_"+ .@j +"[3]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[4]") )?getd("@ms_b_m_"+ .@j +"[4]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[5]") )?getd("@ms_b_m_"+ .@j +"[5]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[6]") )?getd("@ms_b_m_"+ .@j +"[6]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[7]") )?getd("@ms_b_m_"+ .@j +"[7]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[8]") )?getd("@ms_b_m_"+ .@j +"[8]"):"" )+"#"+( ( getd("@ms_b_m_"+ .@j +"[9]") )?getd("@ms_b_m_"+ .@j +"[9]"):"" );
  1497. 								}
  1498. 								set .@i, .@i +2 ;
  1499. 							}
  1500. 						}
  1501. 					}
  1502. 					set .@j, .@j +1 ;
  1503. 				}
  1504. 			}
  1505. 		}
  1506. 		set .@k, .@k +1 ;
  1507. 	}
  1508. 	end;
  1509. OnPCLoginEvent:
  1510. 	set @ms_b_loading, 1;
  1511. 	set .@j, 1;
  1512. 	while ( .@j <= 4 ) {
  1513. 		if ( getd("ms_b_m_"+ .@j +"$") != "" ) {
  1514. 			explode getd(".@ms_b_m_"+ .@j +"$"), getd("ms_b_m_"+ .@j +"$"), "#";
  1515. 			set .@ex_size, getarraysize( getd(".@ms_b_m_"+ .@j +"$") );
  1516. 			set .@i, 0;
  1517. 			while ( .@i < .@ex_size ) {
  1518. 				setd "@ms_b_m_"+ .@j +"["+ .@i +"]", atoi( getd(".@ms_b_m_"+ .@j +"$["+ .@i +"]") );
  1519. 				set .@i, .@i +1 ;
  1520. 			}
  1521. 		}
  1522. 		set .@j, .@j +1 ;
  1523. 	}
  1524. 	sleep2 1;
  1525. 	set .@l, 0;
  1526. 	while ( .@npc_id < 128 ) {
  1527. 		if ( getvariableofnpc( .ms_b_name$[.@npc_id], "ms_b_" ) != "" ) {
  1528. 			explode getd(".@ms_b_n_"+ .@npc_id +"$"), getd("ms_b_n_"+ .@npc_id +"$"), "#";
  1529. 			set .@ex_size, getarraysize( getd(".@ms_b_n_"+ .@npc_id +"$") );
  1530. 			set .@i, 0;
  1531. 			while ( .@i < .@ex_size ) {
  1532. 				setd "@ms_b_n_"+ .@npc_id +"["+ .@i +"]", atoi( getd(".@ms_b_n_"+ .@npc_id +"$["+ .@i +"]") );
  1533. 				set .@i, .@i +1 ;
  1534. 			}
  1535. 			sleep2 1;
  1536. 		}
  1537. 		set .@npc_id, .@npc_id +1 ;
  1538. 	}
  1539. 	sleep2 1;
  1540. 	set @ms_b_loading, 0;
  1541. 	if ( getvariableofnpc( .loading, "ms_b_" ) == 0 ) {
  1542. 		set .@j, 1;
  1543. 		while ( .@j <= 4 ) {
  1544. 			if ( getd("@ms_b_m_"+ .@j +"[0]") ) {
  1545. 				if ( getd("$ms_b_m_"+ getd("@ms_b_m_"+ .@j +"[0]") +"$[0]") == "" ) {
  1546. 					dispbottom "Mission Board: Your Mission#"+ .@j +" has deleted because it is no longer available";
  1547. 					deletearray getd("@ms_b_m_"+ .@j);
  1548. 					setd "ms_b_m_"+ .@j +"$", "";
  1549. 				}
  1550. 				else if ( getd("@ms_b_m_"+ .@j +"[1]") ) {
  1551. 					if ( getd("@ms_b_m_"+ .@j +"[1]") > gettimetick(2) )
  1552. 						addtimer ( getd("@ms_b_m_"+ .@j +"[1]") - gettimetick(2) ) *1000, "ms_b_::OnQuest"+ .@j +"TimeUp";
  1553. 					else
  1554. 						doevent "ms_b_::OnQuest"+ .@j +"TimeUp";
  1555. 				}
  1556. 			}
  1557. 			set .@j, .@j +1 ;
  1558. 		}
  1559. 	}
  1560. 	end;
  1561. }
  1562.  
  1563. //	create more missions by using npc duplicates
  1564. //	display name can be anything, but the hidden name #1 #2 #35 must be a number within 1 ~ 126
  1565. //	Note: npc display name plus the hidden name must not more than 23 characters
  1566. prontera,158,191,5	duplicate(ms_b_)	Prontera Mission 1#1	837
  1567. prontera,158,184,5	duplicate(ms_b_)	Prontera Mission 2#2	837
  1568. prontera,158,188,5	duplicate(ms_b_)	Payon Mission#3	837
Viewed 581 times, submitted by unknown.