viewing paste Unknown #10669 | Athena

Posted on the
  1. -	script	mission_board	-1,{
  2. .@gm_level = getgmlevel();
  3. .@npc_name$ = strnpcinfo(1);
  4. .@mission_npc_num = atoi( strnpcinfo(2) );
  5.  
  6. // check npc if it's a valid npc with number 1 ~ 500
  7. if( !.@mission_npc_num || .@mission_npc_num > 500 ){
  8. 	message strcharinfo(0),"This NPC isnt working, invalid <'"+strnpcinfo(2)+"'>";
  9. 	disablenpc strnpcinfo(0);
  10. 	end;
  11. }
  12.  
  13. // to assign offset index.
  14. .@mission_npc_num--;
  15. query_sql( "SELECT COUNT(`id`) FROM `mission_board` WHERE `npc_id` LIKE '%|"+.@mission_npc_num+"|%' ",.@mission_count );
  16. query_sql( "SELECT `id`,`mission_id`,`mob_hunt` FROM `player_mission` WHERE `mission_id` IN ( SELECT `id` FROM `mission_board` WHERE `npc_id` LIKE '%|"+.@mission_npc_num+"|%' ) AND `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00' ",.@id,.@mission_id,.@mob_hunt$ );
  17. .@current_mission_size = getarraysize( .@id );
  18.  
  19. mes "^0055FF[ "+.@npc_name$+" ]^000000";
  20. 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";
  21. next;
  22. mes "^0055FF[ "+.@npc_name$+" ]^000000";
  23. mes "Every player may pick up to ^FF0000"+.max_mission_per_char+" missions^000000 from the Mission Board.";
  24. next;
  25. switch( select( ( .@current_mission_size )?"Submit Mission":"",
  26. 				( .@current_mission_size < .max_mission_per_char )?"Pick Mission":"",
  27. 				( .@current_mission_size )?"Drop Mission":"",
  28. 				( .@gm_level < .gm_level || !.@mission_count )?"":"^FF0000[GM] Update Mission^000000",
  29. 				( .@gm_level < .gm_level )?"":"^FF0000[GM] Setup Mission^000000",
  30. 				( .@gm_level < .gm_level || !.@mission_count  )?"":"^FF0000[GM] Delete Mission^000000" ) ){
  31. 	Case 1:
  32.  
  33. 		// get mission data from sql
  34. 		query_sql( "SELECT * FROM `mission_board` WHERE `id` = "+.@mission_id[.@i]+" LIMIT 1",
  35. 			.@mission_id,
  36. 			.@title$,
  37. 			.@description$,
  38. 			.@mob_list$,
  39. 			.@mob_qty$,
  40. 			.@item_list$,
  41. 			.@item_qty$,
  42. 			.@base_job_bitmask,
  43. 			.@job_branch_bitmask,
  44. 			.@min_lv,
  45. 			.@max_lv,
  46. 			.@repeatable,
  47. 			.@timelimit,
  48. 			.@reward_list$,
  49. 			.@reward_qty$,
  50. 			.@baseexp,
  51. 			.@jobexp,
  52. 			.@zeny,
  53. 			.@cash,
  54. 			.@aid,
  55. 			.@name$,
  56. 			.@time_update$,
  57. 			.@npc_id$,
  58. 			.@redo_delay
  59. 		);
  60.  
  61. 		// explode all saved strings to array value.
  62. 		.@monster_size = callsub( OnExplodeArray,.@mob_list$,.@monster_list,0 );
  63. 		if( .@monster_size )
  64. 			callsub( OnExplodeArray,.@mob_qty$,.@monster_qty,0 );
  65.  
  66. 		.@item_size = callsub( OnExplodeArray,.@item_list$,.@item_list,0 );
  67. 		if( .@item_size )
  68. 			callsub( OnExplodeArray,.@item_qty$,.@item_qty,0 );
  69.  
  70. 		.@reward_size = callsub( OnExplodeArray,.@reward_list$,.@reward_list,0 );
  71. 		if( .@reward_size )
  72. 			callsub( OnExplodeArray,.@reward_qty$,.@reward_qty,0 );
  73.  
  74. 		.@selected_npc_size = callsub( OnExplodeArray,.@npc_id$,.@selected_npc_array$,1 );
  75.  
  76. 		setarray .@level_range,.@min_lv,.@max_lv;
  77.  
  78. 		// display the information of mission
  79. 		.@result = callsub( OnDisplayMissionInfo,
  80. 					.@mission_id,
  81. 					.@title$,
  82. 					.@description$,
  83. 					.@level_range,
  84. 					.@repeatable,
  85. 					.@expire[.@i],
  86. 					.@monster_list,
  87. 					.@monster_qty,
  88. 					.@item_list,
  89. 					.@item_qty,
  90. 					.@base_job_bitmask,
  91. 					.@job_branch_bitmask,
  92. 					.@baseexp,
  93. 					.@jobexp,
  94. 					.@cash,
  95. 					.@zeny,
  96. 					.@reward_list,
  97. 					.@reward_qty,
  98. 					.@selected_npc_array$,
  99. 					.@time_update$,
  100. 					.@redo_delay,
  101. 					1|2|4|8
  102. 				);
  103.  
  104. 		// check completed how many times.
  105. 		if( .@repeatable[.@i] ){
  106. 			query_sql( "SELECT COUNT(`id`),TIMESTAMPDIFF( HOUR,`completion`,NOW() ),DATE_ADD( `completion`, INTERVAL "+.@redo_delay+" HOUR) FROM `player_mission` WHERE `mission_id` = "+.@id[.@i]+" AND `completion` <> '0000-00-00 00:00:00'",.@mission_completed,.@diff_delay,.@day$ );
  107. 			if( .@repeatable[.@i] && ( ( .@mission_completed >= .@repeatable[.@i] ) || ( .@diff_delay && .@diff_delay <= .@redo_delay ) ) ){
  108. 				next;
  109. 				mes "^0055FF[ "+.@npc_name$+" ]^000000";
  110. 				mes " ";
  111. 				if( .@mission_completed >= .@repeatable[.@i] ){
  112. 					mes "You can't pick this mission, you have already completed this mission "+.@mission_completed+" time(s). You may only do it that many times.";
  113. 					close;
  114. 				}
  115. 				if( .@diff_delay && .@diff_delay <= .@redo_delay ){
  116. 					mes "You cant pick this mission, you have mission redo delay isnt finish yet.";
  117. 					mes "Approximate : ^FF0000"+.@day$+"^000000";
  118. 					close;
  119. 				}
  120. 			}
  121. 		}
  122.  
  123. 		// submit mission or not
  124. 		if( .@result ){
  125. 			message strcharinfo(0),"Failed to submit this mission.";
  126. 		}else{
  127. 			next;
  128. 			if( select( "Submit Completed Mission","Cancel" ) == 1 ){
  129. 				for( .@ms = ( @ms_size - 1 ); .@ms >= 0; .@ms-- )
  130. 					if( @ms_list$[.@ms] == ""+.@mission_id ){
  131. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  132. 						query_sql( "UPDATE `player_mission` SET `completion` = NOW() WHERE `cid` = "+getcharid(0)+" AND `mission_id` = "+.@mission_id );
  133. 						mes "Mission accomplished.";
  134. 						@ms_size--;
  135.  
  136. 						// clear requirement.
  137. 						setd( "@ms_"+.@mission_id+"_expire" ),0;
  138. 						deletearray getd( "@ms_"+.@mission_id+"_list" );
  139. 						deletearray getd( "@ms_"+.@mission_id+"_qty" );
  140. 						deletearray getd( "@ms_"+.@mission_id+"_hunt" );
  141. 						if( .@item_size )
  142. 							for( .@i = 0; .@i < .@item_size; .@i++ ){
  143. 								debugmes getitemname( .@item_list[.@i] )+" - "+.@item_qty[.@i];
  144. 							}
  145. 								// delitem .@item_list[.@i],.@item_qty[.@i];
  146.  
  147. 						mes "Here are your rewards!";
  148. 						// rewards
  149. 						getexp .@baseexp,.@jobexp;
  150. 						if( .@reward_size )
  151. 							for( .@i = 0; .@i < .@reward_size; .@i++ )
  152. 								getitem .@reward_list[.@i],.@reward_qty[.@i];
  153. 						#CASHPOINTS += .@cash;
  154. 						Zeny += .@zeny;
  155. 						break;
  156. 					}
  157. 				mes " ";
  158. 			}
  159. 		}
  160. 		break;
  161. 	Case 2:
  162. 		// get info from SQL.
  163. 		do{
  164. 			mes "^0055FF[ "+.@npc_name$+" ]^000000";
  165. 			deletearray .@id;
  166. 			query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"+.@mission_npc_num+"|%' AND `id` NOT IN ( SELECT `mission_id` FROM `player_mission` WHERE `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00' ) LIMIT "+.max_page_size+" OFFSET "+.@offset,.@id,.@title$,.@min_lv,.@max_lv );
  167. 			.@offset += .max_page_size;
  168. 			.@size = getarraysize( .@id );
  169. 			if( !.@size ){
  170. 				mes "There are no other available missions to pick.";
  171. 				close;
  172.  
  173. 			}else{
  174. 				mes "Pick a mission~";
  175. 				mes "Reminder, the EXP reward that may look like very little is still going to be multiplied by 30 times, which is what our Quest EXP rates are set to!";
  176. 				.@mission_menu$ = "";
  177. 				for( .@i = 0; .@i < .@size; .@i++ )
  178. 					.@mission_menu$ = .@mission_menu$ + "["+.@min_lv[.@i]+"~"+.@max_lv[.@i]+"] "+.@title$[.@i] +":";
  179. 			}
  180. 			next;
  181. 			.@i = select( .@mission_menu$+ ( ( .@size < .max_page_size )?"":"- next page" ) ) - 1;
  182. 		}while( .@i == .@size );
  183.  
  184. 		query_sql( "SELECT * FROM `mission_board` WHERE `id` = "+.@id[.@i]+" LIMIT 1",
  185. 			.@mission_id,
  186. 			.@title$,
  187. 			.@description$,
  188. 			.@mob_list$,
  189. 			.@mob_qty$,
  190. 			.@item_list$,
  191. 			.@item_qty$,
  192. 			.@base_job_bitmask,
  193. 			.@job_branch_bitmask,
  194. 			.@min_lv,
  195. 			.@max_lv,
  196. 			.@repeatable,
  197. 			.@timelimit,
  198. 			.@reward_list$,
  199. 			.@reward_qty$,
  200. 			.@baseexp,
  201. 			.@jobexp,
  202. 			.@zeny,
  203. 			.@cash,
  204. 			.@aid,
  205. 			.@name$,
  206. 			.@time_update$,
  207. 			.@npc_id$,
  208. 			.@redo_delay
  209. 		);
  210.  
  211. 		// explode all saved strings to array value.
  212. 		.@monster_size = callsub( OnExplodeArray,.@mob_list$,.@monster_list,0 );
  213. 		.@monster_size = callsub( OnExplodeArray,.@mob_qty$,.@monster_qty,0 );
  214.  
  215. 		.@item_size = callsub( OnExplodeArray,.@item_list$,.@item_list,0 );
  216. 		.@item_size = callsub( OnExplodeArray,.@item_qty$,.@item_qty,0 );
  217.  
  218. 		.@reward_size = callsub( OnExplodeArray,.@reward_list$,.@reward_list,0 );
  219. 		.@reward_size = callsub( OnExplodeArray,.@reward_qty$,.@reward_qty,0 );
  220.  
  221. 		.@selected_npc_size = callsub( OnExplodeArray,.@npc_id$,.@selected_npc_array$,1 );
  222.  
  223. 		setarray .@level_range,.@min_lv,.@max_lv;
  224.  
  225. 		// display the information of mission
  226. 		.@result = callsub( OnDisplayMissionInfo,
  227. 				.@mission_id,
  228. 				.@title$,
  229. 				.@description$,
  230. 				.@level_range,
  231. 				.@repeatable,
  232. 				( .@timelimit + gettimetick(2) ),
  233. 				.@monster_list,
  234. 				.@monster_qty,
  235. 				.@item_list,
  236. 				.@item_qty,
  237. 				.@base_job_bitmask,
  238. 				.@job_branch_bitmask,
  239. 				.@baseexp,
  240. 				.@jobexp,
  241. 				.@cash,
  242. 				.@zeny,
  243. 				.@reward_list,
  244. 				.@reward_qty,
  245. 				.@selected_npc_array$,
  246. 				.@time_update$,
  247. 				.@redo_delay,
  248. 				1|8
  249. 		);
  250.  
  251. 		// check completed how many times.
  252. 		if( .@repeatable[.@i] ){
  253. 			query_sql( "SELECT COUNT(`id`),TIMESTAMPDIFF( HOUR,`completion`,NOW() ),DATE_ADD( `completion`, INTERVAL "+.@redo_delay+" HOUR) FROM `player_mission` WHERE `mission_id` = "+.@id[.@i]+" AND `completion` <> '0000-00-00 00:00:00'",.@mission_completed,.@diff_delay,.@day$ );
  254. 			if( .@repeatable[.@i] && ( ( .@mission_completed >= .@repeatable[.@i] ) || ( .@diff_delay && .@diff_delay <= .@redo_delay ) ) ){
  255. 				next;
  256. 				mes "^0055FF[ "+.@npc_name$+" ]^000000";
  257. 				mes " ";
  258. 				if( .@mission_completed >= .@repeatable[.@i] ){
  259. 					mes "You can't pick this mission, you have already completed this mission "+.@mission_completed+" time(s). You may only do it that many times.";
  260. 					close;
  261. 				}
  262. 				if( .@diff_delay && .@diff_delay <= .@redo_delay ){
  263. 					mes "You cant pick this mission, you have mission redo delay isnt finish yet.";
  264. 					mes "Approximate : ^FF0000"+.@day$+"^000000";
  265. 					close;
  266. 				}
  267. 			}
  268. 		}
  269.  
  270. 		if( .@result ){
  271. 			message strcharinfo(0),"Failed to pick this mission.";
  272. 		}else{
  273. 			if( select( "Pick Mission","Cancel" ) == 1 ){
  274. 				query_sql( "INSERT INTO `player_mission` VALUES ( "+gettimetick(2)+","+.@mission_id+","+getcharid(3)+","+getcharid(0)+",'"+escape_sql( strcharinfo(0) )+"','',"+( .@timelimit + gettimetick(2) )+",NOW(),'0000-00-00 00:00:00' );" );
  275. 				message strcharinfo(0),"Picked Mission # "+.@mission_id;
  276.  
  277. 				@ms_list$[ @ms_size ] = ""+.@mission_id;
  278. 				@ms_size++;
  279.  
  280. 				copyarray getd( "@ms_"+.@mission_id+"_list[0]" ),.@monster_list[0],.@monster_size;
  281. 				copyarray getd( "@ms_"+.@mission_id+"_qty[0]" ),.@monster_qty[0],.@monster_size;
  282. 				deletearray getd( "@ms_"+.@mission_id+"_hunt" );
  283. 				addtimer ( .@timelimit * 1000 ),.npc_name$+"::OnTimeCheck";
  284. 			}
  285. 		}
  286. 		break;
  287. 	Case 3:
  288. 		query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"+.@mission_npc_num+"|%' AND `id` IN ( SELECT `mission_id` FROM `player_mission` WHERE `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00' )",.@id,.@title$,.@min_lv,.@max_lv );
  289. 		.@id_size = getarraysize( .@id );
  290. 		for( .@i = 0; .@i < .@id_size; .@i++ )
  291. 			.@mission_menu$ = .@mission_menu$ + "["+.@min_lv[.@i]+"~"+.@max_lv[.@i]+"] "+.@title$[.@i] +":";
  292. 		mes "^0055FF[ "+.@npc_name$+" ]^000000";
  293. 		mes "Pick a Mission to remove.";
  294. 		next;
  295. 		.@i = select( .@mission_menu$ ) - 1;
  296. 		mes "^0055FF[ "+.@npc_name$+" ]^000000";
  297. 		mes "Please confirm that you want to remove ^0055FFMission # "+.@id[.@i]+"^000000.";
  298. 		mes "Title: ^0055FF"+.@title$[.@i]+"^000000";
  299. 		mes "^777777NOTE: Any progress you've made for this mission will be lost!^000000";
  300. 		if( select( "Don't drop mission.","Drop mission." ) == 2 ){
  301. 			message strcharinfo(0),"Dropped Mission # "+.@id[.@i];
  302. 			query_sql( "DELETE FROM `player_mission` WHERE `mission_id` = "+.@id[.@i]+" AND `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00'" );
  303. 			setd( "@ms_"+.@id[.@i]+"_expire" ),0;
  304. 			deletearray getd( "@ms_"+.@id[.@i]+"_list" );
  305. 			deletearray getd( "@ms_"+.@id[.@i]+"_qty" );
  306. 			deletearray getd( "@ms_"+.@id[.@i]+"_hunt" );
  307. 			for( .@ms = 0; .@ms < @ms_size; .@ms++ )
  308. 				if( ""+.@id[.@i] == @ms_list$[.@ms] ){
  309. 					deletearray @ms_list$[.@ms],1;
  310. 					@ms_size--;
  311. 					break;
  312. 				}
  313. 		}
  314. 		break;
  315. 	Case 4:
  316. 		// get info from SQL.
  317. 		do{
  318. 			mes "^0055FF[ "+.@npc_name$+" ]^000000";
  319. 			deletearray .@id;
  320. 			query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"+.@mission_npc_num+"|%' LIMIT "+.max_page_size+" OFFSET "+.@offset,.@id,.@title$,.@min_lv,.@max_lv );
  321. 			.@offset += .max_page_size;
  322. 			.@size = getarraysize( .@id );
  323. 			if( !.@size ){
  324. 				mes "There are no available mission to update.";
  325. 				close;
  326.  
  327. 			}else{
  328. 				mes "Pick a mission.";
  329. 				.@mission_menu$ = "";
  330. 				for( .@i = 0; .@i < .@size; .@i++ )
  331. 					.@mission_menu$ = .@mission_menu$ + "["+.@min_lv[.@i]+"~"+.@max_lv[.@i]+"] "+.@title$[.@i] +":";
  332. 			}
  333. 			next;
  334. 			.@i = select( .@mission_menu$+ ( ( .@size < .max_page_size )?"":"- next page" ) ) - 1;
  335. 		}while( .@i == .@size );
  336. 		query_sql( "SELECT * FROM `mission_board` WHERE `id` = "+.@id[.@i],
  337. 			.@new_mission_id,
  338. 			.@title$,
  339. 			.@description$,
  340. 			.@mob_list$,
  341. 			.@mob_qty$,
  342. 			.@item_list$,
  343. 			.@item_qty$,
  344. 			.@base_job_bitmask,
  345. 			.@job_branch_bitmask,
  346. 			.@min_lv,
  347. 			.@max_lv,
  348. 			.@repeatable,
  349. 			.@timelimit,
  350. 			.@reward_list$,
  351. 			.@reward_qty$,
  352. 			.@baseexp,
  353. 			.@jobexp,
  354. 			.@zeny,
  355. 			.@cash,
  356. 			.@aid,
  357. 			.@name$,
  358. 			.@time_update$,
  359. 			.@npc_id$,
  360. 			.@redo_delay
  361. 		);
  362. 		// explode all saved strings to array value.
  363. 		.@monster_size = callsub( OnExplodeArray,.@mob_list$,.@monster_list,0 );
  364. 		.@monster_size = callsub( OnExplodeArray,.@mob_qty$,.@monster_qty,0 );
  365.  
  366. 		.@item_size = callsub( OnExplodeArray,.@item_list$,.@item_list,0 );
  367. 		.@item_size = callsub( OnExplodeArray,.@item_qty$,.@item_qty,0 );
  368.  
  369. 		.@reward_size = callsub( OnExplodeArray,.@reward_list$,.@reward_list,0 );
  370. 		.@reward_size = callsub( OnExplodeArray,.@reward_qty$,.@reward_qty,0 );
  371.  
  372. 		.@selected_npc_size = callsub( OnExplodeArray,.@npc_id$,.@selected_npc_array$,1 );
  373.  
  374. 		setarray .@level_range,.@min_lv,.@max_lv;
  375.  
  376. 	Case 5:
  377. 		do{
  378. 			mes "^0055FF[ "+.@npc_name$+" ]^000000";
  379. 			// display the information of mission
  380. 			callsub( OnDisplayMissionInfo,
  381. 				.@new_mission_id,
  382. 				.@title$,
  383. 				.@description$,
  384. 				.@level_range,
  385. 				.@repeatable,
  386. 				( .@timelimit + gettimetick(2) ),
  387. 				.@monster_list,
  388. 				.@monster_qty,
  389. 				.@item_list,
  390. 				.@item_qty,
  391. 				.@base_job_bitmask,
  392. 				.@job_branch_bitmask,
  393. 				.@baseexp,
  394. 				.@jobexp,
  395. 				.@cash,
  396. 				.@zeny,
  397. 				.@reward_list,
  398. 				.@reward_qty,
  399. 				.@selected_npc_array$,
  400. 				.@time_update$,
  401. 				.@redo_delay,
  402. 				0
  403. 			);
  404.  
  405. 			// check if required info complete for setup mission
  406. 			.@incomplete = 0;
  407. 			if( .@title$ == "" ) .@incomplete |= 1;
  408. 			if( .@description$ == "" ) .@incomplete |= 2;
  409. 			if( !.@monster_size && !.@item_size ) .@incomplete |= 4;
  410. 			if( getarraysize( .@level_range ) != 2 || !.@base_job_bitmask || !.@job_branch_bitmask ) .@incomplete |= 8;
  411. 			if( !.@reward_size && !.@baseexp && !.@jobexp && !.@cash && !.@zeny ) .@incomplete |= 16;
  412. 			if( !.@selected_npc_size ) .@incomplete |= 32;
  413.  
  414. 			.@main_option = select( "Edit Title "+(( .@incomplete & 1 )?"^FF0000-incomplete-^000000":"" ),
  415. 							"Edit Description "+(( .@incomplete & 2 )?"^FF0000-incomplete-^000000":"" ),
  416. 							"Edit Monster List "+(( .@incomplete & 4 )?"^FF0000-incomplete-^000000":( ( !.@monster_size )?"^777777-none-^000000":"" )),
  417. 							"Edit Item List "+(( .@incomplete & 4 )?"^FF0000-incomplete-^000000":( ( !.@item_size )?"^777777-none-^000000":"" )),
  418. 							"Edit Class/Level Limitation "+(( .@incomplete & 8 )?"^FF0000-incomplete-^000000":"" ),
  419. 							"Edit Time/Repeat/Mission Limitation ",
  420. 							"Edit Reward List "+(( .@incomplete & 16 )?"^FF0000-incomplete-^000000":"" ),
  421. 							"Edit NPC Limitation "+(( .@incomplete & 32 )?"^FF0000-incomplete-^000000":"" ),
  422. 							( .@incomplete )?"":"^0055FF - Complete Setup Mission^000000" );
  423. 			next;				
  424. 			switch( .@main_option ){
  425. 				Case 1:
  426. 					mes "^0055FF[ "+.@npc_name$+" ]^000000";
  427. 					mes "Enter Title";
  428. 					mes "^777777( Length: 4 ~ 30 )^000000";
  429. 					while( input( .@title$,4,30 ) );
  430. 					.@input_result = replacestr( .@title$,":"," " );
  431. 					break;
  432. 				Case 2:
  433. 					.@description$ = "";
  434. 					do{
  435. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  436. 						mes "Enter Description";
  437. 						mes "^777777( Length: 4 ~ 255 )^000000";
  438. 						mes " ";
  439. 						mes "^0055FF"+.@description$+"^000000";
  440. 						.@length = getstrlen( .@description$ );
  441. 						do{
  442. 							.@input_result = input( .@temp_input$,4,255 );
  443. 							if( .@input_result )
  444. 								message strcharinfo(0),"Input length must between 4 ~ 255";
  445. 						}while( .@input_result );
  446. 						.@description$ = .@description$ + " "+ .@temp_input$;
  447. 						mes "^0055FF"+.@temp_input$+"^000000";
  448. 						.@length = getstrlen( .@description$ );
  449. 						next;
  450. 					}while( select( ( .@length >= 255 )?"":"add more ^777777( left "+( 255 - .@length )+" words )^000000","-back" ) == 1 );
  451. 					.@description$  = replacestr( .@description$,":"," " );
  452. 					break;
  453. 				Case 3:
  454. 					if( .@new_mission_id ){
  455. 						dispbottom "Editing monster list might caused unwanted behaviours of scripts.  Which may included :";
  456. 						dispbottom " > Script/Missions isnt working properly.";
  457. 						dispbottom " > Deletion of player mission's progress.";
  458. 						dispbottom " > etc.";
  459. 						dispbottom "Overall it's not suggested to edit monster list that you have set early.";
  460. 						dispbottom "( Recommend for Re-Adding mission, if needed )";
  461. 					}
  462. 					do{
  463. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  464. 						mes "Monsters to kill:";
  465. 						if( .@monster_size ){
  466. 							.@mob_menu$ = "";
  467. 							.@current_mob_list$ = "|";
  468. 							deletearray .@current_mob$;
  469. 							for( .@i = 0; .@i < .@monster_size; .@i++ ){
  470. 								.@mob_name$ = getmonsterinfo( .@monster_list[.@i],MOB_NAME );
  471. 								.@mob_menu$ = .@mob_menu$ + .@monster_qty[.@i] +" x "+.@mob_name$ +":";
  472. 								mes " ^777777 ~ "+.@monster_qty[.@i]+" x "+.@mob_name$+"^000000";
  473. 								.@current_mob_list$ = .@current_mob_list$ + .@monster_list[.@i] +"|";
  474. 							}
  475.  
  476. 						}else{
  477. 							mes " ^777777 ~ Unavailable ^000000";
  478. 						}
  479. 						mes " ";
  480. 						.@option = select( ( .@monster_size >= .max_required_monster )?"":"Add Monster",( .@monster_size )?"Delete Monster":"","- Back" );
  481. 						switch( .@option ){
  482. 							Case 1:
  483. 								mes "Enter Monster ID";
  484. 								do{
  485. 									input .@mob_id;
  486. 									if( !.@mob_id ) break;
  487. 									.@mob_name$ = getmonsterinfo( .@mob_id,MOB_NAME );
  488. 								}while( .@mob_name$ == "null" );
  489. 								if( .@mob_name$ != "null" && .@mob_id ){
  490. 									mes "How many "+.@mob_name$+" need to hunt ?";
  491. 									input .@amount,0,30000;
  492. 									if( .@amount ){
  493. 										if( compare( "|"+.@current_mob_list$+"|","|"+.@mob_id+"|" ) ){
  494. 											for( .@i = 0; .@i < .@monster_size; .@i++ )
  495. 												if( .@monster_list[.@i] == .@mob_id ){
  496. 													.@monster_qty[.@i] += .@amount;
  497. 													break;
  498. 												}
  499.  
  500. 										}else{
  501. 											.@monster_list[.@monster_size] = .@mob_id;
  502. 											.@monster_qty[.@monster_size] = .@amount;
  503. 											.@monster_size++;
  504. 										}
  505. 									}
  506. 								}
  507. 								break;
  508. 							Case 2:
  509. 								mes "^0055FF[ "+.@npc_name$+" ]^000000";
  510. 								mes "Pick a Monster to Remove.";
  511. 								.@i = select( .@mob_menu$+"- Back" ) - 1;
  512. 								if( .@i < .@monster_size ){
  513. 									deletearray .@monster_list[.@i],1;
  514. 									deletearray .@monster_qty[.@i],1;
  515. 									.@monster_size--;
  516. 								}
  517. 							default: break;
  518. 						}
  519. 						if( .@option < 3 ) next;
  520. 					}while( .@option < 3 );
  521. 					break;
  522. 				Case 4:
  523. 					do{
  524. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  525. 						mes "Required Item List: ";
  526. 						if( .@item_size ){
  527. 							.@item_menu$ = "";
  528. 							.@current_item_list$ = "|";
  529. 							deletearray .@current_item$;
  530. 							for( .@i = 0; .@i < .@item_size; .@i++ ){
  531. 								.@item_name$ = getitemname( .@item_list[.@i] );
  532. 								.@item_menu$ = .@item_menu$ + .@item_qty[.@i] +"x "+.@item_name$ +":";
  533. 								mes " ^777777 ~ "+.@item_qty[.@i]+" x "+.@item_name$+"^000000";
  534. 								.@current_item_list$ = .@current_item_list$ + .@item_list[.@i] + "|";
  535. 							}
  536.  
  537. 						}else{
  538. 							mes " ^777777 ~ Unavailable ^000000";
  539. 						}
  540. 						mes " ";
  541. 						.@option = select( ( .@item_size >= .max_required_item )?"":"Add Item",( .@item_size )?"Delete Item":"","- Back" );
  542. 						switch( .@option ){
  543. 							Case 1:
  544. 								do{
  545. 									input .@item_id;
  546. 									if( !.@item_id ) break;
  547. 									.@item_name$ = getitemname( .@item_id );
  548. 								}while( .@item_name$ == "null" || .@item_name$ == "" );
  549. 								if( .@item_id && .@item_name$ != "null" && .@item_name$ != "" ){
  550. 									mes "How many "+.@item_name$+" need to collect ?";
  551. 									input .@amount,0,30000;
  552. 									if( .@amount ){
  553. 										if( compare( "|"+.@current_item_list$+"|","|"+.@item_id+"|" ) ){
  554. 											for( .@i = 0; .@i < .@item_size; .@i++ )
  555. 												if( .@item_list[.@i] == .@item_id ){
  556. 													.@item_qty[.@i] += .@amount;
  557. 													break;
  558. 												}
  559. 										}else{
  560. 											.@item_list[.@item_size] = .@item_id;
  561. 											.@item_qty[.@item_size] = .@amount;
  562. 											.@item_size++;
  563. 										}
  564. 									}
  565. 								}
  566. 								break;
  567. 							Case 2:
  568. 								mes "^0055FF[ "+.@npc_name$+" ]^000000";
  569. 								mes "Pick an Item to Remove.";
  570. 								.@i = select( .@item_menu$+" - Back" ) - 1;
  571. 								if( .@i < .@item_size ){
  572. 									mes "Removed "+.@item_qty[.@i]+" x "+getitemname( .@item_list[.@i] );
  573. 									deletearray .@item_list[.@i],1;
  574. 									deletearray .@item_qty[.@i],1;
  575. 									.@item_size--;
  576. 								}
  577. 							default: break;
  578. 						}
  579. 						if( .@option < 3 ) next;
  580. 					}while( .@option < 3 );
  581. 					break;
  582. 				Case 5: // class limitation
  583. 					if( !.@base_job_bitmask ){
  584. 						// enable all job by default.
  585. 						for( .@i = 0; .@i < .base_job_size; .@i++ ){
  586. 							.@bitmask_value = ( 1 << .@i );
  587. 							.@base_job_bitmask |= .@bitmask_value;
  588. 						}
  589. 						// enable all inherited classes by default.
  590. 						for( .@i = 0; .@i < .job_branch_size; .@i++ ){
  591. 							.@bitmask_value = ( 1 << .@i );
  592. 							.@job_branch_bitmask |= .@bitmask_value;
  593. 						}
  594. 					}
  595.  
  596. 					do{
  597. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  598. 						mes "Level Range: "+( ( .@level_range[1] )? "^777777"+.@level_range[0]+" ~ "+.@level_range[1]:"^FF0000-incomplete-" )+"^000000";
  599. 						mes "Available Job Setting";
  600. 						if( .@base_job_bitmask ){
  601. 							for( .@i = 0; .@i < .base_job_size; .@i++ )
  602. 								if( .@base_job_bitmask & ( 1 << .@i ) )
  603. 									mes " ^777777 ~ "+jobname( roclass( .base_job[.@i] ) )+" ^000000";
  604. 						}else{
  605. 							mes " ^FF0000 -incomplete-^000000";
  606. 						}
  607. 						mes " ";
  608. 						mes "Inherited Branch Setting";
  609. 						if( .@job_branch_bitmask ){
  610. 							for( .@i = 0; .@i < .job_branch_size; .@i++ )
  611. 								if( .@job_branch_bitmask & ( 1 << .@i ) )
  612. 									mes " ^777777 ~ "+.job_branch_name$[.@i]+" ^000000";	
  613. 						}else{
  614. 							mes " ^FF0000 -incomplete-^000000";
  615. 						}	
  616. 						next;
  617. 						.@option = select( "Edit Base Job","Edit Job Branch","Edit Level Range","- Back" );
  618. 						switch( .@option ){
  619. 							Case 1:
  620. 								dispbottom "[ Base Job Class ] RED = Disable , GREEN = Enable";
  621. 								do{
  622. 									mes "^0055FF[ "+.@npc_name$+" ]^000000";
  623. 									mes "Available Job List:";
  624. 									.@base_job_menu$ = "";
  625. 									for( .@i = 0; .@i < .base_job_size; .@i++ ){
  626. 										.@job_name$ = jobname( roclass( .base_job[.@i] ) );
  627. 										if( .@base_job_bitmask & ( 1 << .@i ) )
  628. 											mes " ^777777 ~ "+.@job_name$+" ^000000";						
  629. 										.@base_job_menu$ = .@base_job_menu$ + (( .@base_job_bitmask & ( 1 << .@i ) )?"^4EEE94":"^FF0000" ) + .@job_name$ +"^000000:";
  630. 									}
  631. 									next;
  632. 									.@i = select( .@base_job_menu$+"- Back" ) - 1;
  633. 									if( .@i < .base_job_size ){
  634. 										.@bitmask_value = ( 1 << .@i );
  635. 										if( .@base_job_bitmask & .@bitmask_value )
  636. 											.@base_job_bitmask -= .@bitmask_value;
  637. 										else
  638. 											.@base_job_bitmask |= .@bitmask_value;
  639. 									}
  640. 								}while( .@i < .base_job_size );
  641. 								break;
  642. 							Case 2:
  643. 								dispbottom "[ Inherited Job Branch ] RED = Disable , GREEN = Enable";
  644. 								do{
  645. 									mes "^0055FF[ "+.@npc_name$+" ]^000000";
  646. 									mes "Inherited Job Branch List:";
  647. 									.@job_branch_menu$ = "";
  648. 									for( .@i = 0; .@i < .job_branch_size; .@i++ ){
  649. 										if( .@job_branch_bitmask & ( 1 << .@i ) )
  650. 											mes " ^777777 ~ "+.job_branch_name$[.@i]+" ^000000";						
  651. 										.@job_branch_menu$ = .@job_branch_menu$ + (( .@job_branch_bitmask & ( 1 << .@i ) )?"^4EEE94":"^FF0000" ) + .job_branch_name$[.@i] +"^000000:";
  652. 									}
  653. 									next;
  654. 									.@i = select( .@job_branch_menu$+"- Back" ) - 1;
  655. 									if( .@i < .job_branch_size ){
  656. 										.@bitmask_value = ( 1 << .@i );
  657. 										if( .@job_branch_bitmask & .@bitmask_value )
  658. 											.@job_branch_bitmask -= .@bitmask_value;
  659. 										else
  660. 											.@job_branch_bitmask |= .@bitmask_value;
  661. 									}
  662. 								}while( .@i < .job_branch_size );
  663. 								break;
  664. 							Case 3:
  665. 								mes "^0055FF[ "+.@npc_name$+" ]^000000";
  666. 								mes "Minimum Level";
  667. 								input .@level_range[0],1,.server_max_level ;
  668. 								mes "Maximum Level";
  669. 								input .@level_range[1],.@level_range[0],.server_max_level;
  670. 							default: break;
  671. 						}
  672. 						if( .@option < 4 ) next;
  673. 					}while( .@option < 4 );
  674. 					break;
  675. 				Case 6: // mission limitation
  676. 					do{
  677. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  678. 						mes "Can do: ^777777"+( ( !.@repeatable )?"Unlimited times":""+.@repeatable )+" time(s)^000000";
  679. 						mes "Redo Delay: ^777777"+( ( !.@redo_delay )?"Unavailable":callsub( OnTime2Str,( ( .@redo_delay * 3600 ) + gettimetick(2) ) ))+"^000000";
  680. 						mes "Time Limit: ^777777"+( ( !.@timelimit )?"Unavailable":callsub( OnTime2Str,( .@timelimit + gettimetick(2) ) ) )+"^000000";
  681. 						.@option = select( "Edit Repeatable Status","Edit Time Limit","Edit Re-do Delay","Edit Required Mission","- Back" );
  682. 						switch( .@option ){
  683. 							Case 1:
  684. 								mes "How many time can this mission repeat ??";
  685. 								mes "^777777( 0 = unlimited )^000000";
  686. 								input .@repeatable,0,100;
  687. 								break;
  688. 							Case 2:
  689. 								mes "Time Limit of mission";
  690. 								mes "      1 = 1 minute";
  691. 								mes "    60 = 1 hour";
  692. 								mes "1440 = 1 day";
  693. 								input .@timelimit,0,50000;
  694. 								.@timelimit *= 60;
  695. 								break;
  696. 							Case 3:
  697. 								mes "Time Delay to re-take the mission";
  698. 								mes "     1 =  1 hour";
  699. 								mes "   24 =  1 day";
  700. 								mes " 720 = 30 day";
  701. 								input .@redo_delay,0,50000;
  702. 								break;
  703. 							Case 4:
  704. 								mes "This is not fully implemented yet.. still in beta test";
  705. 								break;
  706.  
  707. 								do{
  708. 									mes "Required Mission:";
  709. 									if( .@required_mission_size ){
  710. 										for( .@i = 0; .@i < .@required_mission_size; .@i++ ){
  711. 											mes " ^777777 ~ "+.@required_mission$[.@i]+"^000000";
  712. 											.@required_mission_menu$ = .@required_mission_menu$ + .@required_mission$[.@i] +":";
  713. 										}
  714.  
  715. 									}else{
  716. 										mes "^777777 none ^000000";
  717. 									}
  718. 									next;
  719. 									.@sub_option = select( ( .@required_mission_size < .max_required_mission )?"Add required mission":"",
  720. 														( .@required_mission_size )?"Remove required mission":"",
  721. 														"- Back");
  722. 									switch( .@sub_option ){
  723. 										Case 1:
  724. 											mes "Enter mission ID";
  725. 											mes "^777777( enter 0 to cancel )^000000";
  726. 											do{
  727. 												input .@mission_id$;
  728. 												if( .@mission_id$ == "0" ) break;
  729. 											}while( compare( "|"+.@required_mission_menu$+"|","|"+.@mission_id$+"|" ) );
  730. 											.@mission_id$ = replacestr( .@mission_id$,":","" );
  731. 											if( .@mission_id$ != "0" ){
  732. 												.@required_mission$[.@required_mission_size] = .@mission_id$;
  733. 												.@required_mission_size++;
  734. 											}
  735. 											break;
  736. 										Case 2:
  737. 											mes "Select a mission to remove.";
  738. 											.@i = select( .@required_mission_menu$ ) - 1;
  739. 											deletearray .@required_mission$[.@i],1;
  740. 										default: break;
  741. 									}
  742. 								}while( .@sub_option < 3 );
  743. 							default: break;
  744. 						}
  745. 						if( .@option < 5 ) next;
  746. 					}while( .@option < 5 );
  747. 					break;
  748. 				Case 7: // reward list
  749. 					do{
  750. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  751. 						mes "Zeny: ^777777"+( ( .@zeny )? .@zeny:"None" )+"^000000";
  752. 						mes "Reward Item List: ";
  753. 						if( .@reward_size ){
  754. 							.@reward_menu$ = "";
  755. 							deletearray .@current_reward$;
  756. 							for( .@i = 0; .@i < .@reward_size; .@i++ ){
  757. 								.@reward_name$ = getitemname( .@reward_list[.@i] );
  758. 								.@reward_menu$ = .@item_menu$ + .@reward_qty[.@i] +"x "+.@reward_name$ +":";
  759. 								.@current_reward$[.@i] = .@reward_name$;
  760. 								mes " ^777777 ~ "+.@reward_qty[.@i]+" x "+.@reward_name$+"^000000";
  761. 							}
  762. 							.@current_reward_list$ = implode( .@current_reward$,"|" );
  763.  
  764. 						}else{
  765. 							mes " ^777777 ~ none ^000000";
  766. 						}
  767. 						mes "Base EXP: ^777777"+( ( .@baseexp )? .@baseexp:"None" )+"^000000";
  768. 						mes "Job EXP: ^777777"+( ( .@jobexp )? .@jobexp:"None" )+"^000000";
  769. 						mes " ";
  770. 						next;
  771. 						.@option = select( ( .@reward_size >= .max_required_item )?"":"Add Item Reward",
  772. 										( .@reward_size )?"Delete Item Reward":"",
  773. 										"Edit Cash Reward",
  774. 										"Edit Zeny Reward",
  775. 										"Edit Base EXP Reward",
  776. 										"Edit Job EXP Reward",
  777. 										"- Back" );
  778. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  779. 						switch( .@option ){
  780. 							Case 1:
  781. 								mes "Enter Reward Item ID";
  782. 								do{
  783. 									input .@reward_id;
  784. 									if( !.@reward_id ) break;
  785. 									.@reward_name$ = getitemname( .@reward_id );
  786. 								}while( .@reward_name$ == "null" || .@reward_name$ == "" );
  787. 								if( .@reward_id && .@reward_name$ != "null" && .@reward_name$ != "" ){
  788. 									mes "How many "+.@reward_name$+" will be rewarded ?";
  789. 									input .@amount,0,30000;
  790. 									if( .@amount ){
  791. 										if( compare( "|"+.@current_reward_list$+"|","|"+.@reward_name$+"|" ) ){
  792. 											for( .@i = 0; .@i < .@reward_size; .@i++ )
  793. 												if( .@reward_list[.@i] == .@item_id ){
  794. 													.@reward_qty[.@i] += .@amount;
  795. 													break;
  796. 												}
  797. 										}else{
  798. 											.@reward_list[.@reward_size] = .@reward_id;
  799. 											.@reward_qty[.@reward_size] = .@amount;
  800. 											.@reward_size++;
  801. 										}
  802. 									}
  803. 								}
  804. 								break;
  805. 							Case 2:
  806. 								mes "Pick an Reward to Remove.";
  807. 								.@i = select( .@reward_menu$ ) - 1;
  808. 								mes "Removed "+.@reward_qty[.@i]+"x "+getitemname( .@reward_list[.@i] );
  809. 								deletearray .@reward_list[.@i],1;
  810. 								deletearray .@reward_qty[.@i],1;
  811. 								.@reward_size--;
  812. 								break;
  813. 							Case 3:
  814. 								mes "How many Cash will be given ?";
  815. 								mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
  816. 								input .@cash,0,.max_integer_value;
  817. 								break;
  818. 							Case 4:
  819. 								mes "How many Zeny will be given ?";
  820. 								mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
  821. 								input .@zeny,0,.max_integer_value;
  822. 								break;
  823. 							Case 5:
  824. 								mes "How many Base EXP reward ?";
  825. 								mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
  826. 								input .@baseexp,0,.max_integer_value;
  827. 								break;
  828. 							Case 6:
  829. 								mes "How many Job EXP reward ?";
  830. 								mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
  831. 								input .@jobexp,0,.max_integer_value;
  832. 							default: break;
  833. 						}
  834. 						next;
  835. 					}while( .@option < 7 );
  836. 					break;
  837. 				Case 8: // npc limitation
  838. 					mes "^0055FF[ "+.@npc_name$+" ]^000000";
  839. 					mes "By default, the mission will be available from each mission board npc ^FF0000unless you have specified which NPC may offer this mission.^000000";
  840. 					mes " ";
  841. 					mes "Just pick all the NPC that may offer this mission if you wish.";
  842. 					next;
  843. 					if( !getarraysize( .@selected_npc_array$ ) )
  844. 						for( .@i = 0; .@i < .mission_npc_count; .@i++ ){
  845. 							.@selected_npc_array$[.@i] = ""+.@i;
  846. 							.@selected_npc_size++;
  847. 						}
  848. 					dispbottom "[ NPC Limitation ] RED = Disable , GREEN = Enable";
  849.  
  850. 					do{
  851. 						mes "^0055FF[ "+.@npc_name$+" ]^000000";
  852. 						mes "Mission offered by: ";
  853. 						.@selected_npc_menu$ = "";
  854. 						if( .@selected_npc_size >= 2 ){
  855. 							.@selected_npc$ = "|"+implode( .@selected_npc_array$,"|" )+"|";
  856. 						}else{
  857. 							.@selected_npc$ = "|"+.@selected_npc_array$+"|";
  858. 						}
  859. 						for( .@i = 0; .@i < .mission_npc_count; .@i++ ){
  860. 							getmapxy( .@map$,.@x,.@y,1,.npc_unique_list$[.@i] );
  861. 							.@sub_npc_name$ = ( ( compare( "|"+.@selected_npc$+"|","|"+.@i+"|" ) )?"^44EE00":"^FF0000" );
  862. 							.@sub_npc_name$ = .@sub_npc_name$ + .npc_name_list$[.@i];
  863. 							mes "^777777("+.@map$+") "+.@sub_npc_name$;
  864. 							.@selected_npc_menu$ = .@selected_npc_menu$ + .@sub_npc_name$ +":";
  865. 						}
  866. 						next;
  867. 						.@option = select( .@selected_npc_menu$+"^000000- Back" ) - 1;
  868. 						if( .@option < .mission_npc_count ){
  869. 							if( compare( "|"+.@selected_npc$+"|","|"+.@option+"|" ) )
  870. 								.@selected_npc_array$[.@option] = "";
  871. 							else
  872. 								.@selected_npc_array$[.@option] = ""+.@option;
  873. 							.@selected_npc_size = getarraysize( .@selected_npc_array$ );
  874. 						}
  875. 						// dispbottom "["+rand(10,99)+"] "+implode( .@selected_npc_array$,"|" );
  876. 					}while( .@option < .mission_npc_count );
  877. 					break;
  878. 				default: break;
  879. 			}
  880. 			next;
  881. 		}while( .@main_option < 9 );
  882.  
  883. 		// finalise all variable
  884. 		if( .@monster_size ){
  885. 			.@final_mob_list$ = "|";
  886. 			.@final_mob_qty$ = "|";
  887. 			for( .@i = 0; .@i < .@monster_size; .@i++ ){
  888. 				.@final_mob_list$ = .@final_mob_list$ + .@monster_list[.@i] +"|";
  889. 				.@final_mob_qty$ = .@final_mob_qty$ + .@monster_qty[.@i] +"|";
  890. 			}	
  891. 		}
  892.  
  893. 		if( .@item_size ){
  894. 			.@final_item_list$ = "|";
  895. 			.@final_item_qty$ = "|";
  896. 			for( .@i = 0; .@i < .@item_size; .@i++ ){
  897. 				.@final_item_list$ = .@final_item_list$ + .@item_list[.@i] +"|";
  898. 				.@final_item_qty$ = .@final_item_qty$ + .@item_qty[.@i] +"|";
  899. 			}
  900. 		}
  901.  
  902. 		if( .@reward_size ){
  903. 			.@final_reward_list$ = "|";
  904. 			.@final_reward_qty$ = "|";
  905. 			for( .@i = 0; .@i < .@reward_size; .@i++ ){
  906. 				.@final_reward_list$ = .@final_reward_list$ + .@reward_list[.@i] +"|";
  907. 				.@final_reward_qty$ = .@final_reward_qty$ + .@reward_qty[.@i] +"|";
  908. 			}
  909. 		}
  910.  
  911. 		if( .@selected_npc_size ){
  912. 			.@final_npc_list$ = "|";
  913. 			for( .@i = 0; .@i < .@selected_npc_size; .@i++ )
  914. 				.@final_npc_list$ = .@final_npc_list$ + .@selected_npc_array$[.@i] +"|";
  915. 		}
  916.  
  917. 		if( !.@new_mission_id ){
  918. 			.@new_mission_id = gettimetick(2);
  919. 			message strcharinfo(0),"Mission # "+.@new_mission_id+" has been added.";
  920. 		}else{
  921. 			message strcharinfo(0),"Mission # "+.@new_mission_id+" has been updated.";
  922. 			// attach and inform other online players.
  923. 			callsub( OnRemoveMission,.@new_mission_id,"A GM updated Mission # "+.@new_mission_id );
  924. 		}
  925.  
  926. 		// add new mission into SQL
  927. 		query_sql( 
  928. 			"REPLACE INTO `mission_board` VALUES ( " +
  929. 				.@new_mission_id+", " +
  930. 				"'"+escape_sql( .@title$ )+"', " +
  931. 				"'"+escape_sql( .@description$ )+"', " +
  932. 				"'"+escape_sql( .@final_mob_list$ )+"', " +
  933. 				"'"+escape_sql( .@final_mob_qty$ )+"', " +
  934. 				"'"+escape_sql( .@final_item_list$ )+"', " +
  935. 				"'"+escape_sql( .@final_item_qty$ )+"', " +
  936. 				.@base_job_bitmask+", " +
  937. 				.@job_branch_bitmask+", " +
  938. 				.@level_range[0]+", " +
  939. 				.@level_range[1]+", " +
  940. 				.@repeatable+", " +
  941. 				.@timelimit+", " +
  942. 				"'"+escape_sql( .@final_reward_list$ )+"', " +
  943. 				"'"+escape_sql( .@final_reward_qty$ )+"', " +
  944. 				.@baseexp+", " +
  945. 				.@jobexp+", " +
  946. 				.@zeny+", " +
  947. 				.@cash+", " +
  948. 				getcharid(3)+", " +
  949. 				"'"+escape_sql( strcharinfo(0) )+"', " +
  950. 				"NOW(), " +
  951. 				"'"+escape_sql( .@final_npc_list$ )+"', " +
  952. 				.@redo_delay +
  953. 			" ); " 
  954. 		);
  955. 		break;
  956. 	Case 6: // delete mission
  957. 		do{
  958. 			mes "^0055FF[ "+.@npc_name$+" ]^000000";
  959. 			deletearray .@id;
  960. 			query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"+.@mission_npc_num+"|%' LIMIT "+.max_page_size+" OFFSET "+.@offset,.@id,.@title$,.@min_lv,.@max_lv );
  961. 			.@offset += .max_page_size;
  962. 			.@size = getarraysize( .@id );
  963. 			if( !.@size ){
  964. 				mes "There are no available mission to update.";
  965. 				close;
  966.  
  967. 			}else{
  968. 				mes "Pick a mission.";
  969. 				for( .@i = 0; .@i < .@size; .@i++ )
  970. 					.@mission_menu$ = .@mission_menu$ + "["+.@min_lv[.@i]+"~"+.@max_lv[.@i]+"] "+.@title$[.@i] +":";
  971. 			}
  972. 			next;
  973. 			.@i = select( .@mission_menu$+ ( ( .@size < .max_page_size )?"":"- next page" ) ) - 1;
  974. 		}while( .@i == .@size );
  975. 		.@mission_id = .@id[.@i];
  976. 		mes "^0055FF[ "+.@npc_name$+" ]^000000";
  977. 		mes "Are you sure to remove this mission ?";
  978. 		if( select( "Ýes, remove mission.","Delete Mission" ) == 2 ){
  979. 			query_sql( "DELETE FROM `mission_board` WHERE `id` = "+.@mission_id+" LIMIT 1" );
  980. 			mes "Removed mission from mission list.";
  981.  
  982. 			// attach other online players and remove the missions.
  983. 			callsub( OnRemoveMission,.@mission_id,"A GM removed Mission # "+.@mission_id );
  984. 			query_sql( "DELETE FROM `player_mission` WHERE `completion` = '0000-00-00 00:00:00' AND `mission_id` = "+.@mission_id );
  985. 			mes "Removed mission from all players.";
  986. 		}
  987. 	default: break;
  988. }
  989. close;
  990.  
  991. OnInit:
  992. initnpctimer "mission_board";
  993. // initialize settings
  994. if( strnpcinfo(0) == "mission_board" ){
  995.  
  996. 	// gm level to access panel
  997. 	.gm_level = 90;
  998. 	// max no. of required monster
  999. 	.max_required_monster = 10;
  1000. 	// max no. of required item
  1001. 	.max_required_item = 10;
  1002. 	// max no. of required mission ( un-implement yet )
  1003. 	.max_required_mission = 10;
  1004. 	// max no. of available mission
  1005. 	.max_mission_available = 50;
  1006. 	// max value of integer input
  1007. 	.max_integer_value = 2000000000;
  1008. 	// max amount of mission per page
  1009. 	.max_page_size = 30;
  1010. 	// max mission per npc take by character
  1011. 	.max_mission_per_char = 3;
  1012.  
  1013. 	// predefined values.
  1014. 	.npc_name$ = strnpcinfo(0);
  1015. 	.server_max_level = getbattleflag( "max_lv" );
  1016. 	setarray .base_job,
  1017. 		EAJ_SWORDMAN,
  1018. 		EAJ_MAGE,
  1019. 		EAJ_ARCHER,
  1020. 		EAJ_ACOLYTE,
  1021. 		EAJ_MERCHANT,
  1022. 		EAJ_THIEF,
  1023. 		EAJ_TAEKWON,
  1024. 		EAJ_GUNSLINGER,
  1025. 		EAJ_NINJA;
  1026. 	.base_job_size = getarraysize( .base_job );
  1027. 	setarray .job_branch_name$,
  1028. 		"2-1 Classes",
  1029. 		"2-2 Classes",
  1030. 		"Rebirth Classes",
  1031. 		"Baby Classes",
  1032. 		"Third Classes";
  1033. 	setarray .job_branch,
  1034. 		EAJL_2_1,
  1035. 		EAJL_2_2,
  1036. 		EAJL_UPPER,
  1037. 		EAJL_BABY,
  1038. 		EAJL_THIRD;
  1039. 	.job_branch_size = getarraysize( .job_branch );
  1040. 	bindatcmd "mission", strnpcinfo(0)+"::OnCommand";
  1041.  
  1042. }else{
  1043. 	// delay the process
  1044. 	.@num = atoi( strnpcinfo(2) );
  1045. 	if( .@num && .@num <= 500 && .mission_npc_count < 100 ){
  1046. 		sleep( .@num + 1 );
  1047. 		.npc_name_list$[ .mission_npc_count ] = strnpcinfo(1);
  1048. 		.npc_unique_list$[ .mission_npc_count ] = strnpcinfo(0);
  1049. 		debugmes "["+.mission_npc_count+"]"+.npc_name_list$[ .mission_npc_count ]+"|"+.npc_unique_list$[ .mission_npc_count ];
  1050. 		.mission_npc_count++;
  1051. 		end;
  1052.  
  1053. 	}else if( !.@num ){
  1054. 		debugmes "[Removed] "+strnpcinfo(0)+", invalid <num:'"+strnpcinfo(2)+"'>";
  1055. 	}else if( .mission_npc_count >= 100 ){
  1056. 		debugmes "[Skipped] "+strnpcinfo(0)+", max: 100 Total NPC.";
  1057. 	}
  1058. 	disablenpc strnpcinfo(0);
  1059. }
  1060. end;
  1061.  
  1062. // just used to display how many total Mission Board NPC.
  1063. OnTimer1000:
  1064. 	stopnpctimer;
  1065. 	debugmes "[ Mission Board ] Total NPC Loaded : "+.mission_npc_count+" ...";
  1066. 	end;
  1067.  
  1068. OnCommand:
  1069. 	if ( strnpcinfo(0) == .npc_name$ ) {
  1070. 		if ( @ms_size ) {
  1071. 			for ( .@i = 0; .@i < @ms_size; .@i++ ) {
  1072. 				.@mob_size = getarraysize( getd( "@ms_"+ @ms_list$[.@i] +"_list" ) );
  1073. 				query_sql "select title, item_list, item_qty from mission_board where id = "+ @ms_list$[.@i], .@title$, .@item_id$, .@item_amount$;
  1074. 				if ( .@mob_size ) {
  1075. 					for ( .@j = 0; .@j < .@mob_size; .@j++ )
  1076. //						dispbottom "[Mission '"+ .@title$ +"' Progress] Hunted "+ getd( "@ms_"+ @ms_list$[.@i] +"_hunt["+ .@j +"]" ) +"x "+ getmonsterinfo( getd( "@ms_"+ @ms_list$[.@i] +"_list["+ .@j +"]" ), MOB_NAME );
  1077. 						dispbottom "[Mission '"+ .@title$ +"' Progress] Hunted "+ getd( "@ms_"+ @ms_list$[.@i] +"_hunt["+ .@j +"]" ) +"/"+ getd( "@ms_"+ @ms_list$[.@i] +"_qty[" + .@j +"]" ) +" x "+ getmonsterinfo( getd( "@ms_"+ @ms_list$[.@i] +"_list["+ .@j +"]" ), MOB_NAME );
  1078. 					explode .@item_id_array$, .@item_id$, "|";
  1079. 					explode .@item_amount_array$, .@item_amount$, "|";
  1080. 					.@size = getarraysize( .@item_id_array$ );
  1081. 					for ( .@j = 1; .@j < .@size; .@j++ )
  1082. 						dispbottom "[Mission '"+ .@title$ +"' Progress] Collected "+ countitem( atoi( .@item_id_array$[.@j] ) ) +"/"+ .@item_amount_array$[.@j] +" x "+ getitemname( atoi( .@item_id_array$[.@j] ) );
  1083. 				}
  1084. 			}
  1085. 		}
  1086. 	}
  1087. 	end;
  1088.  
  1089. // OnWhisperGlobal:
  1090. OnPCLoginEvent:
  1091. if( strnpcinfo(0) == .npc_name$ ){
  1092. 	.@timetick = gettimetick(2);
  1093. 	query_sql( "SELECT `mission_id`,`expire`,`mob_hunt` FROM `player_mission` WHERE `completion` = '0000-00-00 00:00:00' AND `cid` = "+getcharid(0),@ms_list$,.@expire,.@mob_hunt$ );
  1094. 	@ms_size = getarraysize( @ms_list$ );
  1095. 	if( @ms_size )
  1096. 		for( .@i = 0; .@i < @ms_size; .@i++ ){
  1097. 			if( .@timetick < .@expire[.@i] ){
  1098. 				.@timeleft = ( .@expire[.@i] - .@timetick );
  1099. 				addtimer ( .@timeleft * 1000 ),.npc_name$+"::OnTimeCheck";
  1100. 				//dispbottom "[ Mission Progress : "+@ms_list$[.@i]+" , expire in "+callsub( OnTime2Str,( .@timeleft + .@timetick ) )+" ]";
  1101. 				query_sql( "SELECT `mob_list`,`mob_qty` FROM `mission_board` WHERE `id` = "+@ms_list$[.@i],.@mob_list$,.@mob_qty$ );
  1102.  
  1103. 				setd( "@ms_"+@ms_list$[.@i]+"_expire" ),.@expire[.@i];
  1104. 				if( callsub( OnExplodeArray,.@mob_list$[.@i],getd( "@ms_"+@ms_list$[.@i]+"_list" ),0 ) ){
  1105. 					callsub( OnExplodeArray,.@mob_hunt$[.@i],getd( "@ms_"+@ms_list$[.@i]+"_qty" ),0 );
  1106. 					.@monster_size = callsub( OnExplodeArray,.@mob_hunt$[.@i],getd( "@ms_"+@ms_list$[.@i]+"_hunt" ),0 );
  1107. 					// for( .@mob = 0; .@mob < .@monster_size; .@mob++ )
  1108. 						// dispbottom  " ~ killed "+getd( "@ms_"+@ms_list$[.@i]+"_hunt["+.@mob+"]" )+"/"+getd( "@ms_"+@ms_list$[.@i]+"_qty["+.@mob+"]" )+" x "+getmonsterinfo( getd( "@ms_"+@ms_list$[.@i]+"_list["+.@mob+"]" ),MOB_NAME );
  1109. 				}
  1110. 			}
  1111. 		}
  1112. }
  1113. end;
  1114.  
  1115. OnPCLogoutEvent:
  1116. if( strnpcinfo(0) == .npc_name$ ){
  1117. 	if( @ms_size )
  1118. 		for( .@ms = 0; .@ms < @ms_size; .@ms++ ){
  1119. 			debugmes "Saving "+@ms_list$[.@ms];
  1120. 			.@mob_size = getarraysize( getd( "@ms_"+@ms_list$[.@ms]+"_list" ) );
  1121. 			if( .@mob_size ){
  1122. 				copyarray .@temp_array[0],getd( "@ms_"+@ms_list$[.@ms]+"_list[0]" ),.@mob_size;
  1123. 				.@mob_hunt$ = "|";
  1124. 				for( .@mob = 0; .@mob < .@mob_size; .@mob++ )
  1125. 					.@mob_hunt$ = .@mob_hunt$ + getd( "@ms_"+@ms_list$[.@ms]+"_hunt["+.@mob+"]" ) +"|";
  1126. 				query_sql( "UPDATE `player_mission` SET `mob_hunt` = '"+escape_sql( .@mob_hunt$ )+"' WHERE `mission_id` = "+@ms_list$[.@ms]+" AND `completion` = '0000-00-00 00:00:00' AND `cid` = "+getcharid(0) );
  1127. 			}
  1128. 		}
  1129. }
  1130. end;
  1131.  
  1132. OnNPCKillEvent:
  1133. if( strnpcinfo(0) == .npc_name$ ){
  1134. 	if( @ms_size ){
  1135. 		.@map$ = strcharinfo(3);
  1136.  
  1137. 		// by default mission wont work in PVP,GVG,Instance,Event maps
  1138. 		if( compare( .@map$,"@" ) || getmapflag( .@map$,mf_gvg ) || getmapflag( .@map$,mf_pvp )){
  1139. 			//dispbottom "[Mission Board] PvP, GvG, Instance and Event Map , include monsters will not affect Mission Progress.";
  1140. 			end;
  1141. 		}
  1142.  
  1143. 		.@timetick = gettimetick(2);
  1144. 		for( .@ms = ( @ms_size - 1 ); .@ms >= 0; .@ms-- ){
  1145. 				.@mob_size = getarraysize( getd( "@ms_"+@ms_list$[.@ms]+"_list" ) );
  1146. 				if( .@mob_size ){
  1147. 					copyarray .@temp_array[0],getd( "@ms_"+@ms_list$[.@ms]+"_list[0]" ),.@mob_size;
  1148. 					for( .@mob = 0; .@mob_size; .@mob++ )
  1149. 						if( .@temp_array[.@mob] == killedrid ){
  1150. 							.@value = getd( "@ms_"+@ms_list$[.@ms]+"_hunt["+.@mob+"]" ) + 1;
  1151. 							setd( "@ms_"+@ms_list$[.@ms]+"_hunt["+.@mob+"]" ),.@value;
  1152. 							dispbottom "[Mission #"+@ms_list$[.@ms]+" Progress] You have killed "+.@value+"x "+getmonsterinfo( .@temp_array[.@mob],MOB_NAME );
  1153. 							break;
  1154. 						}
  1155. 					deletearray .@temp_array;
  1156. 				}
  1157. 			}
  1158. 		}
  1159. 	}
  1160. end;
  1161.  
  1162. OnRemoveMission:
  1163. 	.@mission_id = getarg(0);
  1164. 	.@message$ = getarg(1);
  1165.  
  1166. 	query_sql( "SELECT `aid`,`cid` FROM `player_mission` WHERE `cid` IN ( SELECT `char_id` FROM `char` WHERE `online` = 1 ) AND `mission_id` = "+.@mission_id+" AND `completion` = '0000-00-00 00:00:00' LIMIT 128",.@aid,.@cid );
  1167. 	.@aid_size = getarraysize( .@aid );
  1168. 	.@i = 0;
  1169. 	.@origin_aid = getcharid(3);
  1170. 	while( .@i < .@aid_size ){
  1171. 		if( isloggedin( .@aid[.@i],.@cid[.@i] ) ){
  1172. 			attachrid( .@aid[.@i] );
  1173. 			for( .@ms = @ms_size; .@ms >= 0; .@ms-- )
  1174. 				if( @ms_list$[.@ms] == ""+.@mission_id ){
  1175. 					message strcharinfo(0),.@message$;
  1176. 					dispbottom "Please visit Mission NPC to gain latest information.";
  1177. 					setd( "@ms_"+@ms_list$[.@ms]+"_expire" ),0;
  1178. 					deletearray getd( "@ms_"+@ms_list$[.@ms]+"_list" );
  1179. 					deletearray getd( "@ms_"+@ms_list$[.@ms]+"_qty" );
  1180. 					deletearray getd( "@ms_"+@ms_list$[.@ms]+"_hunt" );
  1181. 					deletearray @ms_list$[.@ms],1;
  1182. 					@ms_size--;
  1183. 					break;
  1184. 				}
  1185. 			detachrid;
  1186. 			.@count++;
  1187. 		}
  1188. 		.@i++;
  1189. 	}
  1190. 	attachrid( .@origin_aid );
  1191. 	dispbottom "Total "+.@count+" online players affected.";
  1192. 	return;
  1193.  
  1194. // usage :
  1195. // .@timeleft = callsub( OnTime2Str,<time> );
  1196. OnTime2Str:
  1197. 	.@time = getarg(0);
  1198. 	.@left = ( .@time - gettimetick(2) );
  1199. 	.@hour = ( .@left / 3600 );
  1200. 	.@min = ( .@left % 3600 / 60 );
  1201. 	.@sec = ( .@left % 60 );
  1202. 	if( !.@left ) 
  1203. 		return "none";
  1204. 	else
  1205. 		return "^777777"+( ( .@hour )? .@hour+" hr ":"" ) + ( ( .@hour || .@min )? .@min+" min ":"" ) +.@sec+" sec^000000";
  1206.  
  1207.  
  1208. // usage : 
  1209. // .@new_array_size = callsub( OnExplodeArray,<old string variable>,<new array variable>,<save '0'> );
  1210. OnExplodeArray:
  1211. 	.@type = getarg(2);
  1212. 	explode( getarg(0),getarg(0),"|" );
  1213. 	.@size = getarraysize( getarg(0) );
  1214. 	while( .@i < .@size ){
  1215. 		if( !.@type ){
  1216. 			.@value = atoi( getelementofarray( getarg(0),.@i ) );
  1217. 			if( .@value ){
  1218. 				set getelementofarray( getarg(1),.@new_size ),.@value;
  1219. 				.@new_size++;
  1220. 			}
  1221. 		}else{
  1222. 			set getelementofarray( getarg(1),.@new_size ),getelementofarray( getarg(0),.@i );
  1223. 			.@new_size++;
  1224. 		}
  1225. 		.@i++;
  1226. 	}
  1227.  
  1228. 	return .@new_size;
  1229.  
  1230.  
  1231. // display mission information + optional progress checking
  1232. OnDisplayMissionInfo:
  1233. 		.@mission_id = getarg(0);
  1234. 		.@title$ = getarg(1);
  1235. 		.@description$ = getarg(2);
  1236. 		.@repeatable = getarg(4);
  1237. 		.@timelimit = getarg(5);
  1238. 		.@monster_size = getarraysize( getarg(6) );
  1239. 		.@item_size = getarraysize( getarg(8) );
  1240. 		.@base_job_bitmask = getarg(10);
  1241. 		.@job_branch_bitmask = getarg(11);
  1242. 		.@baseexp = getarg(12);
  1243. 		.@jobexp = getarg(13);
  1244. 		.@cash = getarg(14);
  1245. 		.@zeny = getarg(15);
  1246. 		.@reward_size = getarraysize( getarg(16) );
  1247. 		.@selected_npc_size = getarraysize( getarg(18) );
  1248. 		.@time_update$ = getarg(19);
  1249. 		.@redo_delay = getarg(20);
  1250. 		.@check_progress = getarg(21);
  1251.  
  1252. 		if( .@check_progress & 8 )
  1253. 			.@eac = eaclass();
  1254.  
  1255. 		// display mission info
  1256. 		mes ""+(( .@mission_id )? "^FF0000Mission ID # "+.@mission_id:" " )+"^000000";
  1257. 		mes "Title: "+( ( .@title$ != "" )?"^777777"+.@title$:"^FF0000-incomplete-" )+"^000000";
  1258. 		mes "Description: "+( ( .@description$ != "" )?"^777777"+.@description$:"^FF0000-incomplete-" )+"^000000";
  1259. 		mes "Level Range: "+( ( getelementofarray( getarg(3),0 ) )? "^777777"+getelementofarray( getarg(3),0 )+" ~ "+getelementofarray( getarg(3),1 ):"^FF0000-incomplete-" )+"^000000";
  1260. 		if( .@check_progress & 1 )
  1261. 			if( BaseLevel >= getelementofarray( getarg(3),0 ) && BaseLevel <= getelementofarray( getarg(3),1 ) )
  1262. 				.@lv_progress = 1;
  1263.  
  1264. 		mes "Can do: ^777777"+( ( !.@repeatable )?"Repeatedly":.@repeatable+" time(s)" )+"^000000";
  1265. 		mes "Re-do Delay: ^777777"+( ( !.@redo_delay )?"Unavailable":callsub( OnTime2Str,( ( .@redo_delay * 3600 ) + gettimetick(2) ) ) )+"^000000";
  1266.  
  1267. 		.@word$ = (( !.@monster_size && !.@item_size )?"^FF0000Incomplete":"^777777Unavailable" );
  1268. 		mes "Monsters to kill: "+( ( .@monster_size )?"":.@word$ )+"^000000";
  1269. 		if( .@monster_size )
  1270. 			for( .@i = 0; .@i < .@monster_size; .@i++ ){
  1271. 				.@mob_id = getelementofarray( getarg(6),.@i );
  1272. 				.@quantity = getelementofarray( getarg(7),.@i );
  1273. 				if( .@check_progress & 2 ){
  1274. 					.@killed_count = getd( "@ms_"+.@mission_id+"_hunt["+.@i+"]" );
  1275. 					if( .@killed_count >= .@quantity ){
  1276. 						.@monster_progress++;
  1277. 						.@temp_color$ = "44EE99";
  1278. 					}else{
  1279. 						.@temp_color$ = "FF0000";
  1280. 					}
  1281. 				}
  1282. 				mes " ^777777"+.@quantity+" x "+getmonsterinfo( .@mob_id,MOB_NAME )+"  "+( ( .@check_progress & 2 )?"^"+.@temp_color$+"(killed "+.@killed_count+")":"" )+"^000000";
  1283. 			}
  1284. 		mes "Items to collect: "+( ( .@item_size )?"":.@word$ )+"^000000";
  1285. 		if( .@item_size )
  1286. 			for( .@i = 0; .@i < .@item_size; .@i++ ){
  1287. 				.@item_id = getelementofarray( getarg(8),.@i );
  1288. 				.@quantity = getelementofarray( getarg(9),.@i );
  1289. 				.@item_type = getiteminfo( .@item_id,2 );
  1290. 				if( .@check_progress & 4 ){
  1291. 					.@item_count = countitem( .@item_id );
  1292. 					if( .@item_count >= .@quantity ){
  1293. 						.@item_progress++;
  1294. 						.@temp_color$ = "44EE99";
  1295. 					}else{
  1296. 						.@temp_color$ = "FF0000";
  1297. 					}
  1298. 				}
  1299. 				mes " ^777777"+.@quantity+" x "+getitemname( .@item_id )+" "+( ( .@item_type == 4 || .@item_type == 5 )?"["+getitemslots( .@item_id )+"]":"" )+"  "+( ( .@check_progress & 4 )?"^"+.@temp_color$+"(have "+.@item_count+")":"" )+"^000000";
  1300. 			}
  1301. 		mes " ";
  1302. 		mes "EXP Rewards: ";
  1303. 		mes "^777777 ~ Base EXP: "+( ( .@baseexp )? .@baseexp:"None" )+"^000000";
  1304. 		mes "^777777 ~ Job EXP: "+( ( .@jobexp )? .@jobexp:"None" )+"^000000";
  1305. 		mes " ";
  1306. 		mes "Item / Zeny Rewards: "+( ( .@reward_size )?"":"^777777Unavailable" )+"^000000";
  1307. 		mes "^777777  ~ "+( ( .@zeny )? .@zeny+" Zeny":"  ~ No Zeny Reward" )+"^000000";
  1308. 		if( .@reward_size )
  1309. 			for( .@i = 0; .@i < .@reward_size; .@i++ ){
  1310. 				.@item_id = getelementofarray( getarg(16),.@i );
  1311. 				.@item_type = getiteminfo( .@item_id,2 );
  1312. 				mes " ^777777 ~ "+getelementofarray( getarg(17),.@i )+" x "+getitemname( .@item_id )+" "+( ( .@item_type == 4 || .@item_type == 5 )?"["+getitemslots( .@item_id )+"]":"" )+"^000000";
  1313. 			}
  1314. 		mes " ";
  1315.  
  1316. 			if( .@time_update$ != "0000-00-00 00:00:00" && .@time_update$ != "" ){
  1317. 			mes "Last Mission Update:";
  1318. 			mes "^777777"+.@time_update$+"^000000";
  1319. 		}
  1320.  
  1321. 		if( .@check_progress ){
  1322. 			if( .@check_progress & 1 && !.@lv_progress ){
  1323. 				dispbottom "[Failed] Your level didnt meet the requirements.";
  1324. 				.@check_result |= 1;
  1325. 			}
  1326. 			if( .@check_progress & 2 && .@monster_size != .@monster_progress ){
  1327. 				dispbottom "[Failed] Your Monsters Hunt didnt meet the requirements.";
  1328. 				.@check_result |= 2;
  1329. 			}
  1330. 			if( .@check_progress & 4 && .@item_size != .@item_progress ){
  1331. 				dispbottom "[Failed] Your Items collecting didnt meet the requirements.";
  1332. 				.@check_result |= 4;
  1333. 			}
  1334. 		}
  1335. 	return .@check_result;	
  1336. }
  1337.  
  1338.  
  1339. // the number behind the NPC name must be NUMBER with range of ( 1 ~ 500 )
  1340. // the number should stay the same for eternity, if you change it frequently, it might affect your missions for each NPC.
  1341. // ( to conclude, once you assigned the number, dont change it for the sake of your mission board ... )
  1342.  
  1343. harmonia,173,90,1	duplicate(mission_board)	Mission Board#1	837
  1344. //prontera,105,238,4	duplicate(mission_board)	Mission B#2	837
  1345. //prontera,105,236,4	duplicate(mission_board)	Mission C#3	837
  1346. //prontera,105,234,4	duplicate(mission_board)	Mission D#4	837
  1347.  
  1348. //prontera,108,238,4	duplicate(mission_board)	Mission E#5	837
  1349. //prontera,108,236,4	duplicate(mission_board)	Mission F#6	837
  1350. //prontera,108,234,4	duplicate(mission_board)	Mission G#7	837
  1351. //prontera,108,232,4	duplicate(mission_board)	Mission H#8
Viewed 306 times, submitted by unknown.