viewing paste topic/4726- mission_board_2.4a | Athena

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