Emistry

Utility: [SQL] Mission Board

Recommended Posts

File Name:

 Mission Board

[b]File Submitter[/b]: [url=http://rathena.org/board/user/241-emistry/]Emistry[/url]

[b]File Submitted[/b]: 01 Jan 2014

[b]File Category[/b]: [url=http://rathena.org/board/files/category/142-utilities/]Utilities[/url]

[b]Content Author[/b]: Emistry / AnnieRuru



original topic : [url="http://www.eathena.ws/board/index.php?showtopic=242306"]http://www.eathena.ws/board/index.php?showtopic=242306[/url]

this is actually a quite old topic , anyway i will just borrow the information written by Annieruru ..
it's one of my favourite script back in eAthena,[quote]
i know that there are serveral server out there who "manage" to make it to save "permanent" quest by using permanent global variable , well ... all i can say is that the method they are currently using are not really a good way ...[/quote][quote]
[size=3]ok ... this script allow admins to setup quests on the server[/size]
1 npc allow 40 missions, and allow up to 127 npc's, means total of 5080 quests can be created

best use on low rate and medium rate servers
server that likes to create lots of quests to keep players busy[/quote]

[size=4][background=rgb(255,255,255)]Credit to AnnieRuru and any other contributors from the pass....[/background][/size]
[hr]

[size=5][b]Installation :[/b][/size]
Just a basic simple instruction ...[list]
[*]download the NPC script and install into your server
[*]download the [url="http://pastebin.com/raw.php?i=misZD8cf"][ SQL Table ][/url] and load into youe mysql or phpmyadmin server.
[/list]
[size=5][b]Basic Configuration :[/b][/size][code=auto:1021] // gm level to access panel .gm_level = 90; // max no. of required monster .max_required_monster = 10; // max no. of required item .max_required_item = 10; // max no. of required mission ( un-implement yet ) .max_required_mission = 10; // max no. of available mission .max_mission_available = 50; // max value of integer input .max_integer_value = 30000; // max amount of mission per page .max_page_size = 30; // max mission per npc take by character .max_mission_per_char = 4; [/code]


[b][size=5]NPC Duplication :[/size][/b]

[code=auto:1447] // the number behind the NPC name must be NUMBER with range of ( 1 ~ 500 ) // the number should stay the same for eternity, if you change it frequently, it might affect your missions for each NPC. // ( to conclude, once you assigned the number, dont change it for the sake of your mission board ... ) prontera,151,171,4 duplicate(mission_board) Mission A#1 837 prontera,154,174,4 duplicate(mission_board) Mission B#2 837 prontera,156,176,4 duplicate(mission_board) Mission C#3 837 prontera,159,179,4 duplicate(mission_board) Mission D#4 837[/code]


take note the number behind the NPC is the index of each NPC ....
[color=#ff0000][b]once you assigned an index to a NPC, try not to change it in the future[/b][/color], since missions are assigned based on these index number.



[size=5][b]What's New in this Version :[/b][/size]
each npc probably can have more than 40 missions.
each NPC can have their own quests....or a quest that can share among any other NPCs.

  • 1 NPC can have many individual quests.
  • All / Certain NPCs share the same quests.
  • Only certains classes[i] ( include inherited classes ) [/i]may do the quests. However, base classes are alway able to pick the quests.


All the Quests will not be removed upon server restart / @reloadscript, which mean you dont have to re-setup all the quests everytime server restarted / reloaded.

** You may edit the required monsters for each mission, but will end up remove all the killing progress of each players who have taken the missions.

[size=5][b]Future TODO List :[/b][/size]

  • support party-assist , guild-assist to completing the quests .
  • pre-requisite mission or so-called chain missions.
  • custom variable as rewards.
  • etc


[i]( you may tell me if you have any ideas to improve this script )[/i]



[size=5][b]Screenshots :[/b][/size]
http://imgur.com/9zPLLab,LeCTXWI,iAMODwY,uM0G9b7,PtfRQU9,CzIDSja,LWeafsQ,WLcDMaW,Dx3y3fw,7UukU0t#0

uWNbLrD.gif

[hr]

just a scratching script and havent spent really much time to debug every single lines ...overall it still work fine ...[i]( still on holiday mood + school started again )[/i]
the structure of the scripts might look messy and hard to read .. >.< ... didnt really plan well on the structure of the scripts.[i] ( Emistry suck on planning )[/i]

There are some bugs i guess ... but i not really so sure is it come from this script or will it really bring big effect to the servers..
when playing with this script .... i think my char will failed to connect to server everytime I relog , does any of you facing this problem when using this script ??

AnnieRuru and other member who good at scripts, time for lecturers ... /gg


[b]SQL Mission file sharing ....[/b]
if anyone of you willing to share the SQL Mission Table with some quests inside , let me know =)


Click here to download this file

Share this post


Link to post
Share on other sites

I asked you to do this since 21 Dec .. means took you around 11 days

not so bad, around the same amount of time I took to write this 3 years ago

1st obvious bug

the menu

if I input the title name with the ":" symbol, the menu becomes 2 lines when players want to choose a quest

and the menu option number become mess up

2nd, the job limitation should default to everyone on, not everyone off

my way is use to limit certain jobs, but your way is force everyone to enable all jobs

3rd,

I have never complete the custom variable stuffs ...

means, the reward with a custom variable, can be use with achievement system or custom point currency

I plan to do that but I couldn't do it that time, thinking that you can do though

PS... I try dig as many bugs as I can until nobody wants to use this script /gg

4th

http://www.eathena.ws/board/index.php?s=&showtopic=241133&view=findpost&p=1318425

your script is able to hit string limitation when the menu is too long, cause client crash

seems your way of saving the variable is different than mine

can tell that immediately you are using SQL table instead of setarray

it also means your script would probably break the 5080 mission limit,

but still limited to the string length that a menu can gives

5th

Mission Offered by use wrong color, Red<=>Green is opposite

nvm seems like need to go through the [email protected]_progress variable once to get it done

a weird way though

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

btw ... thinking this should be remain at here...or script support section ... >.,

 

 

 

I asked you to do this since 21 Dec .. means took you around 11 days
not so bad, around the same amount of time I took to write this 3 years ago

actually it's not 11 days.... but around 3~4 days only ...( with the help of reference from the old eAthena topic of yours )

i was travel around...playing....partying for the past 2 week during the semester holiday ~ xD

so the script i believe isnot really good enough yet ..><

but i was planned to release it in public during new year ... so that can get more and more feedback to improve it instead of squeeze my brain for it..

 

 

 

if I input the title name with the ":" symbol, the menu becomes 2 lines when players want to choose a quest
and the menu option number become mess up

I see .... never thought of this ...xD  nice for reminding ... will keep this in mind.

 

 

 

my way is use to limit certain jobs, but your way is force everyone to enable all jobs

xP ..let them pick themselve ~ 

 

 

 

means, the reward with a custom variable, can be use with achievement system or custom point currency
I plan to do that but I couldn't do it that time, thinking that you can do though

ya ... i have added it into the TODO list of mine .. =)

and ...i forget to write it at above..LOL..

 

 

 

PS... I try dig as many bugs as I can until nobody wants to use this script

try /gg  haha ~

 

 

 

http://www.eathena.w...dpost&p=1318425
your script is able to hit string limitation when the menu is too long, cause client crash 

i see ...seem like i was mistaken about the limitation of menu .. my mind only telling me the client will fail if menu exist more than 100 option ..and it never remind me of the string limitation ...LOL..

 

erm..wait..i have added the "pagination" for the mission list ...

	// max amount of mission per page
	.max_page_size = 30;

i think this should be able to encounter this problem ?

 

still the script isnt fully added all the features like yours yet ~ will working on it after my university stuff done for the next few weeks...slowly dig some time for this..

>.<  my university just started their class at 31st december .. >.<

Share this post


Link to post
Share on other sites

btw ... thinking this should be remain at here...or script support section ... >.,

should get me review in PM 1st ...

you already bomb my pm so much

whats the difference having 1 more :ani_swt3:

 

 

erm..wait..i have added the "pagination" for the mission list ...

	// max amount of mission per page
	.max_page_size = 30;
i think this should be able to encounter this problem ?
yeah x.x

I only test by create 2 missions, so haven't try up above 30

 

still the script isnt fully added all the features like yours yet ~ will working on it after my university stuff done for the next few weeks...slowly dig some time for this..

already noticed that

like player couldn't drop a mission after they have picked

and swap mission order to make the npc looks more organized etc

actually you know, your sql way makes me re-think ... probably can go unlimited ... so its not limited by any script engine anymore

just now I look at the script too much

5th ...

I can't pick a mission <.<

[SQL]: DB error - Incorrect integer value: 'AnnieRuru' for column 'name' at row
1
[Debug]: at d:\rathena\src\map\script.c:14885 - INSERT INTO `player_mission` VAL
UES ( 444132381,62120,2000000,150000,'AnnieRuru','',1388568855,NOW(),'0000-00-00
 00:00:00' );
.... please ....

why are you using gettimetick(0), but not gettimetick(2) ?

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

 

 

you already bomb my pm so much

whats the difference having 1 more 

bomb more then ...xD  just like how your bunshin bomb my house ..

 

 

 

I only test by create 2 missions, so haven't try up above 30

i also create a few only ... but thinking that each title only 30character...+ around 10 character for level display .. + 30 quests per page..

the menu length ...probably around 1300 characters only .. hopefully enough ..

** anyone created alot missions..and willing to share it...pm me ...

 

 

 

like player couldn't drop a mission after they have picked

and swap mission order to make the npc looks more organized etc

/omg ?? what happened ...LOL ..

i was able to drop mission and pick mission as i recall .. >.< maybe i will try one more times ...

btw..i didnt do the mission swap ....because the doesnt look useful in quest mission... ??

maybe shall recheck this part ...probably i added some new column in sql and forget to add in the required data...

 

 

 

actually you know, your sql way makes me re-think ... probably can go unlimited ... so its not limited by any script engine anymore

probably can unlimit ... but not sure how it will affect the perfomance or maybe sql storage size etc..xD

but definitely can store really alot ...

 

 

 

why are you using gettimetick(0), but not gettimetick(2) ? 

i just random pick between 0 ~ 2 xD

just used to create an id to differentiate the value in sql ...

xP

anyway i think shouldnt be 0 ....the value should be 1 ~ 2 ...since 0 will lead to repeating same number after some time ...

Share this post


Link to post
Share on other sites

Future TODO List :

  • support party-assist , guild-assist to completing the quests .
  • pre-requisite mission or so-called chain missions.
  • etc

 

Great!Bravo!

Share this post


Link to post
Share on other sites

i want to suggest a custom variable reward settings

 

for example #pvppoints + 10

Share this post


Link to post
Share on other sites

Stuck on "Edit NPC Limitation", last step.

not shown NPC are available, somebody can fix this?

 

i am used last svn rathena.

 

But nice work :)

Share this post


Link to post
Share on other sites

Stuck on "Edit NPC Limitation", last step.

not shown NPC are available, somebody can fix this?

 

i am used last svn rathena.

 

But nice work :)

follow the way how duplicated npc are named.

// the number behind the NPC name must be above 1000 ( if you had not changed another )
// you can have 127 npcs.
 
prontera,151,171,4	duplicate(mission_board)	Prontera Mission::1001	837
prontera,155,171,4	duplicate(mission_board)	Byalan Mission::1002	837
prontera,159,171,4	duplicate(mission_board)	Payon Cave Mission::1003	837

1001 ~ 1127

Share this post


Link to post
Share on other sites

I have same result, i am add this for end script:

// the number behind the NPC name must be above 1000 ( if you had not changed another )
// you can have 127 npcs.

prontera,151,171,4	duplicate(mission_board)	Prontera Mission::1001	837
prontera,155,171,4	duplicate(mission_board)	Byalan Mission::1002	837
prontera,159,171,4	duplicate(mission_board)	Payon Cave Mission::1003	837
//prontera,159,175,4	duplicate(mission_board)	Mission 1::1003	837
//prontera,159,171,4	duplicate(mission_board)	Mission 2::1004	837
//prontera,159,171,4	duplicate(mission_board)	Mission 3::1005	837
//prontera,159,171,4	duplicate(mission_board)	Mission 4::1006	837
prontera,155,175,4	duplicate(mission_board)	Prontera Mission::1007	837

u2ERH1m.jpg

 

  • Running script is well, not have error, just debug from your script
  • MySQL have done imported
  • Last have done add duplicate NPC with same name, but different ID ( 1007 ), still not shown.

Thanks for advice Emistry

 

:D

Edited by Code Hunter

Share this post


Link to post
Share on other sites

post your full script.

 

is this setup quest step ??

did you added any npc to offer this quest when you setup the quest ??

Share this post


Link to post
Share on other sites

This full script

/*

DROP TABLE IF EXISTS `mission_board`;
CREATE TABLE IF NOT EXISTS `mission_board` (
`id` int(11) unsigned NOT NULL,
`title` varchar(30) NOT NULL default '',
`desc` varchar(255) NOT NULL default '',
`mob_list` varchar(50) NOT NULL default '',
`mob_qty` varchar(50) NOT NULL default '',
`item_list` varchar(50) NOT NULL default '',
`item_qty` varchar(50) NOT NULL default '',
`class_limitation` int(11) unsigned NOT NULL default '0',
`class_branch` int(11) unsigned NOT NULL default '0',
`min_lv` smallint(6) unsigned NOT NULL default '1',
`max_lv` smallint(6) unsigned NOT NULL default '99',
`repeat` smallint(6) unsigned NOT NULL default '0',
`duration` int(11) unsigned NOT NULL default '0',
`reward_list` varchar(50) NOT NULL default '',
`reward_qty` varchar(50) NOT NULL default '',
`base_exp` int(11) unsigned NOT NULL default '0',
`job_exp` int(11) unsigned NOT NULL default '0',
`zeny` int(11) unsigned NOT NULL default '0',
`cash` int(11) unsigned NOT NULL default '0',
`aid` int(11) unsigned NOT NULL default '0',
`name` varchar(30) NOT NULL default '',
`time_update` datetime NOT NULL default '0000-00-00 00:00:00',
`npc_id` varchar(255) NOT NULL default '',
`redo_delay` smallint(6) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;


DROP TABLE IF EXISTS `player_mission`;
CREATE TABLE IF NOT EXISTS `player_mission` (
`id` int(11) unsigned NOT NULL,
`mission_id` int(11) unsigned NOT NULL,
`aid` int(11) unsigned NOT NULL default '0',
`cid` int(11) unsigned NOT NULL default '0',
`name` varchar(30) NOT NULL default '',
`mob_hunt` varchar(50) NOT NULL default '',
`expire` int(11) unsigned NOT NULL default '0',
`starting` datetime NOT NULL default '0000-00-00 00:00:00',
`completion` datetime NOT NULL default '0000-00-00 00:00:00',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

*/



- script mission_board -1,{
[email protected]_level = getgmlevel();
[email protected]_name$ = strnpcinfo(1);
[email protected]_npc_num = ( atoi( strnpcinfo(3) ) - .name_offset_num );


query_sql( "SELECT COUNT(`id`) FROM `mission_board` WHERE `npc_id` LIKE '%|"[email protected]_npc_num+"|%' ",[email protected]_count );
query_sql( "SELECT `id`,`mission_id`,`mob_hunt`,`expire` FROM `player_mission` WHERE `mission_id` IN ( SELECT `id` FROM `mission_board` WHERE `npc_id` LIKE '%|"[email protected]_npc_num+"|%' ) AND `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00' ",[email protected],[email protected]_id,[email protected]_hunt$,[email protected] );
[email protected]_mission_size = getarraysize( [email protected] );

mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "A mission board may provide various missions for adventures. Each players may pick ";
mes " ^FF0000"+.max_mission_per_char+" missions^000000";
mes "from each mission npc.";
next;
switch( select( ( [email protected]_mission_size )?"Submit Mission":"",
( [email protected]_mission_size < .max_mission_per_char )?"Pick Mission":"",
( [email protected]_mission_size )?"Drop Mission":"",
( [email protected]_level < .gm_level || [email protected]_count )?"":"^FF0000[GM] Update Mission^000000",
( [email protected]_level < .gm_level )?"":"^FF0000[GM] Setup Mission^000000",
( [email protected]_level < .gm_level || [email protected]_count )?"":"^FF0000[GM] Delete Mission^000000" ) ){
Case 1:
[email protected]_time = gettimetick(2);
query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"[email protected]_npc_num+"|%' AND `id` IN ( SELECT `mission_id` FROM `player_mission` WHERE `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00' )",[email protected]_id,[email protected]$,[email protected]_lv,[email protected]_lv );
[email protected] = getarraysize( [email protected]_id );
for( [email protected] = 0; [email protected] < [email protected]; [email protected]++ ){
if( [email protected][[email protected]] < [email protected]_time )
[email protected]_menu$ = [email protected]_menu$ + "^FF0000[Expired]^000000";
[email protected]_menu$ = [email protected]_menu$ + "["[email protected]_lv[[email protected]]+"~"[email protected]_lv[[email protected]]+"] "[email protected]$[[email protected]] +":";
}
[email protected] = select( [email protected]_menu$ ) - 1;

if( [email protected][[email protected]] < [email protected]_time ){
dispbottom " ~ Mission expired "+callsub( OnTime2Str,( gettimetick(2) + ( [email protected]_time - [email protected][[email protected]] ) ) )+" ago.";
dispbottom " ~ You may drop this mission.";
close;
}

// get mission data from sql
query_sql( "SELECT * FROM `mission_board` WHERE `id` = "[email protected]_id[[email protected]]+" LIMIT 1",
[email protected]_id,
[email protected]$,
[email protected]$,
[email protected]_list$,
[email protected]_qty$,
[email protected]_list$,
[email protected]_qty$,
[email protected]_job_bitmask,
[email protected]_branch_bitmask,
[email protected]_lv,
[email protected]_lv,
[email protected],
[email protected],
[email protected]_list$,
[email protected]_qty$,
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected]$,
[email protected]_update$,
[email protected]_id$,
[email protected]_delay
);

// explode all saved strings to array value.
[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
if( [email protected]_size )
callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
if( [email protected]_size )
callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
if( [email protected]_size )
callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_npc_size = callsub( OnExplodeArray,[email protected]_id$,[email protected]_npc_array$,1 );

setarray [email protected]_range,[email protected]_lv,[email protected]_lv;

// display the information of mission
[email protected] = callsub( OnDisplayMissionInfo,
[email protected]_id,
[email protected]$,
[email protected]$,
[email protected]_range,
[email protected],
[email protected][[email protected]],
[email protected]_list,
[email protected]_qty,
[email protected]_list,
[email protected]_qty,
[email protected]_job_bitmask,
[email protected]_branch_bitmask,
[email protected],
[email protected],
[email protected],
[email protected],
[email protected]_list,
[email protected]_qty,
[email protected]_npc_array$,
[email protected]_update$,
[email protected]_delay,
1|2|4|8
);

// submit mission or not
if( [email protected] ){
message strcharinfo(0),"Failed to submit this mission.";
}else{
next;
if( select( "Submit Completed Mission","Cancel" ) == 1 ){
for( [email protected] = ( @ms_size - 1 ); [email protected] >= 0; [email protected] )
if( @ms_list$[[email protected]] == ""[email protected]_id ){
mes "^0055FF[ "[email protected]_name$+" ]^000000";
query_sql( "UPDATE `player_mission` SET `completion` = NOW() WHERE `cid` = "+getcharid(0)+" AND `mission_id` = "[email protected]_id );
mes "Mission accomplished.";
@ms_size--;

// clear requirement.
setd( "@ms_"[email protected]_id+"_expire" ),0;
deletearray getd( "@ms_"[email protected]_id+"_list" );
deletearray getd( "@ms_"[email protected]_id+"_qty" );
deletearray getd( "@ms_"[email protected]_id+"_hunt" );
if( [email protected]_size )
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
debugmes getitemname( [email protected]_list[[email protected]] )+" - "[email protected]_qty[[email protected]];
}
// delitem [email protected]_list[[email protected]],[email protected]_qty[[email protected]];

mes "Gained some mission's rewards.";
// rewards
getexp [email protected],[email protected];
if( [email protected]_size )
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ )
getitem [email protected]_list[[email protected]],[email protected]_qty[[email protected]];
#CASHPOINTS += [email protected];
Zeny += [email protected];
break;
}
mes "Something went wrong ..";
}
}
break;
Case 2:
// get info from SQL.
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
deletearray [email protected];
query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"[email protected]_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 "[email protected],[email protected],[email protected]$,[email protected]_lv,[email protected]_lv );
[email protected] += .max_page_size;
[email protected] = getarraysize( [email protected] );
if( [email protected] ){
mes "There are no other available missions to pick.";
close;

}else{
mes "Pick a mission.";
[email protected]_menu$ = "";
for( [email protected] = 0; [email protected] < [email protected]; [email protected]++ )
[email protected]_menu$ = [email protected]_menu$ + "["[email protected]_lv[[email protected]]+"~"[email protected]_lv[[email protected]]+"] "[email protected]$[[email protected]] +":";
}
next;
[email protected] = select( [email protected]_menu$+"- next page" ) - 1;
}while( [email protected] == [email protected] );

query_sql( "SELECT * FROM `mission_board` WHERE `id` = "[email protected][[email protected]]+" LIMIT 1",
[email protected]_id,
[email protected]$,
[email protected]$,
[email protected]_list$,
[email protected]_qty$,
[email protected]_list$,
[email protected]_qty$,
[email protected]_job_bitmask,
[email protected]_branch_bitmask,
[email protected]_lv,
[email protected]_lv,
[email protected],
[email protected],
[email protected]_list$,
[email protected]_qty$,
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected]$,
[email protected]_update$,
[email protected]_id$,
[email protected]_delay
);

// explode all saved strings to array value.
[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
[email protected]_size = callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
[email protected]_size = callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
[email protected]_size = callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_npc_size = callsub( OnExplodeArray,[email protected]_id$,[email protected]_npc_array$,1 );

setarray [email protected]_range,[email protected]_lv,[email protected]_lv;

// display the information of mission
[email protected] = callsub( OnDisplayMissionInfo,
[email protected]_id,
[email protected]$,
[email protected]$,
[email protected]_range,
[email protected],
( [email protected] + gettimetick(2) ),
[email protected]_list,
[email protected]_qty,
[email protected]_list,
[email protected]_qty,
[email protected]_job_bitmask,
[email protected]_branch_bitmask,
[email protected],
[email protected],
[email protected],
[email protected],
[email protected]_list,
[email protected]_qty,
[email protected]_npc_array$,
[email protected]_update$,
[email protected]_delay,
1|8
);

// check completed how many times.
if( [email protected][[email protected]] ){
query_sql( "SELECT COUNT(`id`),TIMESTAMPDIFF( HOUR,`completion`,NOW() ),DATE_ADD( `completion`, INTERVAL "[email protected]_delay+" HOUR) FROM `player_mission` WHERE `mission_id` = "[email protected][[email protected]]+" AND `completion` <> '0000-00-00 00:00:00'",[email protected]_completed,[email protected]_delay,[email protected]$ );
if( [email protected][[email protected]] && ( ( [email protected]_completed >= [email protected][[email protected]] ) || ( [email protected]_delay && [email protected]_delay <= [email protected]_delay ) ) ){
next;
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes " ";
if( [email protected]_completed >= [email protected][[email protected]] ){
mes "You cant pick this mission, you have mission completion reach the max repeatable attempt of "[email protected]_completed+" times.";
close;
}
if( [email protected]_delay && [email protected]_delay <= [email protected]_delay ){
mes "You cant pick this mission, you have mission redo delay isnt finish yet.";
mes "Approximate : ^FF0000"[email protected]$+"^000000";
close;
}
}
}

if( [email protected] ){
message strcharinfo(0),"Failed to pick this mission.";
}else{
if( select( "Pick Mission","Cancel" ) == 1 ){
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes " ";
query_sql( "INSERT INTO `player_mission` VALUES ( "+gettimetick(2)+","[email protected]_id+","+getcharid(3)+","+getcharid(0)+",'"+escape_sql( strcharinfo(0) )+"','',"+( [email protected] + gettimetick(2) )+",NOW(),'0000-00-00 00:00:00' );" );
mes "Picked ^0055FFMission # "[email protected]_id+"^000000";

@ms_list$[ @ms_size ] = ""[email protected]_id;
@ms_size++;

setd( "@ms_"[email protected]_id+"_expire" ),( [email protected] + gettimetick(2) );
copyarray getd( "@ms_"[email protected]_id+"_list[0]" ),[email protected]_list[0],[email protected]_size;
copyarray getd( "@ms_"[email protected]_id+"_qty[0]" ),[email protected]_qty[0],[email protected]_size;
deletearray getd( "@ms_"[email protected]_id+"_hunt" );
addtimer ( [email protected] * 1000 ),.npc_name$+"::OnTimeCheck";
}
}
break;
Case 3:
query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"[email protected]_npc_num+"|%' AND `id` IN ( SELECT `mission_id` FROM `player_mission` WHERE `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00' )",[email protected],[email protected]$,[email protected]_lv,[email protected]_lv );
[email protected]_size = getarraysize( [email protected] );
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ )
[email protected]_menu$ = [email protected]_menu$ + "["[email protected]_lv[[email protected]]+"~"[email protected]_lv[[email protected]]+"] "[email protected]$[[email protected]] +":";
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Pick a Mission to remove.";
next;
[email protected] = select( [email protected]_menu$ ) - 1;
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Confirm remove ^0055FFMission # "[email protected][[email protected]]+"^000000?";
mes "Title : ^0055FF"[email protected]$[[email protected]]+"^000000";
mes "^777777( this cant be un-done )^000000";
if( select( "nope","Confirm" ) == 2 ){
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Done removed.";
query_sql( "DELETE FROM `player_mission` WHERE `mission_id` = "[email protected][[email protected]]+" AND `cid` = "+getcharid(0)+" AND `completion` = '0000-00-00 00:00:00'" );
setd( "@ms_"[email protected][[email protected]]+"_expire" ),0;
deletearray getd( "@ms_"[email protected][[email protected]]+"_list" );
deletearray getd( "@ms_"[email protected][[email protected]]+"_qty" );
deletearray getd( "@ms_"[email protected][[email protected]]+"_hunt" );
for( [email protected] = 0; [email protected] < @ms_size; [email protected]++ )
if( ""[email protected][[email protected]] == @ms_list$[[email protected]] ){
deletearray @ms_list$[[email protected]],1;
@ms_size--;
break;
}
}
break;
Case 4:
// get info from SQL.
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
deletearray [email protected];
query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"[email protected]_npc_num+"|%' LIMIT "+.max_page_size+" OFFSET "[email protected],[email protected],[email protected]$,[email protected]_lv,[email protected]_lv );
[email protected] += .max_page_size;
[email protected] = getarraysize( [email protected] );
if( [email protected] ){
mes "There are no available mission to update.";
close;

}else{
mes "Pick a mission.";
[email protected]_menu$ = "";
for( [email protected] = 0; [email protected] < [email protected]; [email protected]++ )
[email protected]_menu$ = [email protected]_menu$ + "["[email protected]_lv[[email protected]]+"~"[email protected]_lv[[email protected]]+"] "[email protected]$[[email protected]] +":";
}
next;
[email protected] = select( [email protected]_menu$+"- next page" ) - 1;
}while( [email protected] == [email protected] );
query_sql( "SELECT * FROM `mission_board` WHERE `id` = "[email protected][[email protected]],
[email protected]_mission_id,
[email protected]$,
[email protected]$,
[email protected]_list$,
[email protected]_qty$,
[email protected]_list$,
[email protected]_qty$,
[email protected]_job_bitmask,
[email protected]_branch_bitmask,
[email protected]_lv,
[email protected]_lv,
[email protected],
[email protected],
[email protected]_list$,
[email protected]_qty$,
[email protected],
[email protected],
[email protected],
[email protected],
[email protected],
[email protected]$,
[email protected]_update$,
[email protected]_id$,
[email protected]_delay
);
// explode all saved strings to array value.
[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
[email protected]_size = callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
[email protected]_size = callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_size = callsub( OnExplodeArray,[email protected]_list$,[email protected]_list,0 );
[email protected]_size = callsub( OnExplodeArray,[email protected]_qty$,[email protected]_qty,0 );

[email protected]_npc_size = callsub( OnExplodeArray,[email protected]_id$,[email protected]_npc_array$,1 );

setarray [email protected]_range,[email protected]_lv,[email protected]_lv;

Case 5:
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
// display the information of mission
callsub( OnDisplayMissionInfo,
[email protected]_mission_id,
[email protected]$,
[email protected]$,
[email protected]_range,
[email protected],
( [email protected] + gettimetick(2) ),
[email protected]_list,
[email protected]_qty,
[email protected]_list,
[email protected]_qty,
[email protected]_job_bitmask,
[email protected]_branch_bitmask,
[email protected],
[email protected],
[email protected],
[email protected],
[email protected]_list,
[email protected]_qty,
[email protected]_npc_array$,
[email protected]_update$,
[email protected]_delay,
0
);

// check if required info complete for setup mission
[email protected] = 0;
if( [email protected]$ == "" ) [email protected] |= 1;
if( [email protected]$ == "" ) [email protected] |= 2;
if( [email protected]_size && [email protected]_size ) [email protected] |= 4;
if( getarraysize( [email protected]_range ) != 2 || [email protected]_job_bitmask || [email protected]_branch_bitmask ) [email protected] |= 8;
if( [email protected]_size && [email protected] && [email protected] && [email protected] && [email protected] ) [email protected] |= 16;
if( [email protected]_npc_size ) [email protected] |= 32;

[email protected]_option = select( "Edit Title "+(( [email protected] & 1 )?"^FF0000-incomplete-^000000":"" ),
"Edit Description "+(( [email protected] & 2 )?"^FF0000-incomplete-^000000":"" ),
"Edit Monster List "+(( [email protected] & 4 )?"^FF0000-incomplete-^000000":( ( [email protected]_size )?"^777777-none-^000000":"" )),
"Edit Item List "+(( [email protected] & 4 )?"^FF0000-incomplete-^000000":( ( [email protected]_size )?"^777777-none-^000000":"" )),
"Edit Class/Level Limitation "+(( [email protected] & 8 )?"^FF0000-incomplete-^000000":"" ),
"Edit Time/Repeat/Mission Limitation ",
"Edit Reward List "+(( [email protected] & 16 )?"^FF0000-incomplete-^000000":"" ),
"Edit NPC Limitation "+(( [email protected] & 32 )?"^FF0000-incomplete-^000000":"" ),
( [email protected] )?"":"^0055FF - Complete Setup Mission^000000" );
next;
switch( [email protected]_option ){
Case 1:
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Enter Title";
mes "^777777( Length: 4 ~ 30 )^000000";
while( input( [email protected]$,4,30 ) );
[email protected]_result = replacestr( [email protected]$,":"," " );
break;
Case 2:
[email protected]$ = "";
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Enter Description";
mes "^777777( Length: 4 ~ 255 )^000000";
mes " ";
mes "^0055FF"[email protected]$+"^000000";
[email protected] = getstrlen( [email protected]$ );
do{
[email protected]_result = input( [email protected]_input$,4,255 );
if( [email protected]_result )
message strcharinfo(0),"Input length must between 4 ~ 255";
}while( [email protected]_result );
[email protected]$ = [email protected]$ + " "+ [email protected]_input$;
mes "^0055FF"[email protected]_input$+"^000000";
[email protected] = getstrlen( [email protected]$ );
next;
}while( select( ( [email protected] >= 255 )?"":"add more ^777777( left "+( 255 - [email protected] )+" words )^000000","-back" ) == 1 );
[email protected]$ = replacestr( [email protected]$,":"," " );
break;
Case 3:
if( [email protected]_mission_id ){
dispbottom "Editing monster list might caused unwanted behaviours of scripts. Which may included :";
dispbottom " > Script/Missions isnt working properly.";
dispbottom " > Deletion of player mission's progress.";
dispbottom " > etc.";
dispbottom "Overall it's not suggested to edit monster list that you have set early.";
dispbottom "( Recommend for Re-Adding mission, if needed )";
}
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Monster List:";
if( [email protected]_size ){
[email protected]_menu$ = "";
deletearray [email protected]_mob$;
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_name$ = getmonsterinfo( [email protected]_list[[email protected]],MOB_NAME );
[email protected]_menu$ = [email protected]_menu$ + [email protected]_qty[[email protected]] +" x "[email protected]_name$ +":";
[email protected]_mob$[[email protected]] = [email protected]_name$;
mes " ^777777 ~ "[email protected]_qty[[email protected]]+" x "[email protected]_name$+"^000000";
}
[email protected]_mob_list$ = implode( [email protected]_mob$,"|" );
}else{
mes " ^777777 ~ none ^000000";
}
mes " ";
[email protected] = select( ( [email protected]_size >= .max_required_monster )?"":"Add Monster",( [email protected]_size )?"Delete Monster":"","- Back" );
switch( [email protected] ){
Case 1:
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Enter Monster ID";
do{
input [email protected]_id;
if( [email protected]_id ) break;
[email protected]_name$ = getmonsterinfo( [email protected]_id,MOB_NAME );
}while( [email protected]_name$ == "null" );
if( [email protected]_name$ != "null" ){
mes "How many "[email protected]_name$+" need to hunt ?";
input [email protected],0,30000;
if( [email protected] ){
if( compare( "|"[email protected]_mob_list$+"|","|"[email protected]_name$+"|" ) ){
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ )
if( [email protected]_list[[email protected]] == [email protected]_id ){
[email protected]_qty[[email protected]] += [email protected];
break;
}

}else{
[email protected]_list[[email protected]_size] = [email protected]_id;
[email protected]_qty[[email protected]_size] = [email protected];
[email protected]_size++;
}
}
}
break;
Case 2:
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Pick a Monster to Remove.";
[email protected] = select( [email protected]_menu$ ) - 1;
deletearray [email protected]_list[[email protected]],1;
deletearray [email protected]_qty[[email protected]],1;
[email protected]_size--;
default: break;
}
if( [email protected] < 3 ) next;
}while( [email protected] < 3 );
break;
Case 4:
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Required Item List: ";
if( [email protected]_size ){
[email protected]_menu$ = "";
deletearray [email protected]_item$;
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_name$ = getitemname( [email protected]_list[[email protected]] );
[email protected]_menu$ = [email protected]_menu$ + [email protected]_qty[[email protected]] +"x "[email protected]_name$ +":";
[email protected]_item$[[email protected]] = [email protected]_name$;
mes " ^777777 ~ "[email protected]_qty[[email protected]]+" x "[email protected]_name$+"^000000";
}
[email protected]_item_list$ = implode( [email protected]_item$,"|" );

}else{
mes " ^777777 ~ none ^000000";
}
mes " ";
[email protected] = select( ( [email protected]_size >= .max_required_item )?"":"Add Item",( [email protected]_size )?"Delete Item":"","- Back" );
switch( [email protected] ){
Case 1:
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Enter Item ID";
do{
input [email protected]_id;
if( [email protected]_id ) break;
[email protected]_name$ = getitemname( [email protected]_id );
}while( [email protected]_name$ == "null" || [email protected]_name$ == "" );
if( [email protected]_id && [email protected]_name$ != "null" && [email protected]_name$ != "" ){
mes "How many "[email protected]_name$+" need to collect ?";
input [email protected],0,30000;
if( [email protected] ){
if( compare( "|"[email protected]_item_list$+"|","|"[email protected]_name$+"|" ) ){
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ )
if( [email protected]_list[[email protected]] == [email protected]_id ){
[email protected]_qty[[email protected]] += [email protected];
break;
}
}else{
[email protected]_list[[email protected]_size] = [email protected]_id;
[email protected]_qty[[email protected]_size] = [email protected];
[email protected]_size++;
}
}
}
break;
Case 2:
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Pick an Item to Remove.";
[email protected] = select( [email protected]_menu$ ) - 1;
mes "Removed "[email protected]_qty[[email protected]]+" x "+getitemname( [email protected]_list[[email protected]] );
deletearray [email protected]_list[[email protected]],1;
deletearray [email protected]_qty[[email protected]],1;
[email protected]_size--;
default: break;
}
if( [email protected] < 3 ) next;
}while( [email protected] < 3 );
break;
Case 5: // class limitation
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Level Range : "+( ( [email protected]_range[1] )? "^777777"[email protected]_range[0]+" ~ "[email protected]_range[1]:"^FF0000-incomplete-" )+"^000000";
mes "Available Job Setting";
if( [email protected]_job_bitmask ){
for( [email protected] = 0; [email protected] < .base_job_size; [email protected]++ )
if( [email protected]_job_bitmask & ( 1 << [email protected] ) )
mes " ^777777 ~ "+jobname( roclass( .base_job[[email protected]] ) )+" ^000000";
}else{
mes " ^FF0000 -incomplete-^000000";
}
mes " ";
mes "Inherited Branch Setting";
if( [email protected]_branch_bitmask ){
for( [email protected] = 0; [email protected] < .job_branch_size; [email protected]++ )
if( [email protected]_branch_bitmask & ( 1 << [email protected] ) )
mes " ^777777 ~ "+.job_branch_name$[[email protected]]+" ^000000";
}else{
mes " ^FF0000 -incomplete-^000000";
}
next;
[email protected] = select( "Edit Base Job","Edit Job Branch","Edit Level Range","- Back" );
switch( [email protected] ){
Case 1:
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Available Job List:";
[email protected]_job_menu$ = "";
for( [email protected] = 0; [email protected] < .base_job_size; [email protected]++ ){
[email protected]_name$ = jobname( roclass( .base_job[[email protected]] ) );
if( [email protected]_job_bitmask & ( 1 << [email protected] ) )
mes " ^777777 ~ "[email protected]_name$+" ^000000";
[email protected]_job_menu$ = [email protected]_job_menu$ + (( [email protected]_job_bitmask & ( 1 << [email protected] ) )?"^4EEE94":"^FF0000" ) + [email protected]_name$ +"^000000:";
}
next;
[email protected] = select( [email protected]_job_menu$+" -Back" ) - 1;
if( [email protected] < .base_job_size ){
[email protected]_value = ( 1 << [email protected] );
if( [email protected]_job_bitmask & [email protected]_value )
[email protected]_job_bitmask -= [email protected]_value;
else
[email protected]_job_bitmask |= [email protected]_value;
}
}while( [email protected] < .base_job_size );
break;
Case 2:
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Inherited Job Branch List:";
[email protected]_branch_menu$ = "";
for( [email protected] = 0; [email protected] < .job_branch_size; [email protected]++ ){
if( [email protected]_branch_bitmask & ( 1 << [email protected] ) )
mes " ^777777 ~ "+.job_branch_name$[[email protected]]+" ^000000";
[email protected]_branch_menu$ = [email protected]_branch_menu$ + (( [email protected]_branch_bitmask & ( 1 << [email protected] ) )?"^4EEE94":"^FF0000" ) + .job_branch_name$[[email protected]] +"^000000:";
}
next;
[email protected] = select( [email protected]_branch_menu$+" - Back" ) - 1;
if( [email protected] < .job_branch_size ){
[email protected]_value = ( 1 << [email protected] );
if( [email protected]_branch_bitmask & [email protected]_value )
[email protected]_branch_bitmask -= [email protected]_value;
else
[email protected]_branch_bitmask |= [email protected]_value;
}
}while( [email protected] < .job_branch_size );
break;
Case 3:
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Minimum Level";
input [email protected]_range[0],1,.server_max_level ;
mes "Maximum Level";
input [email protected]_range[1],[email protected]_range[0],.server_max_level;
default: break;
}
next;
if( [email protected] < 4 ) next;
}while( [email protected] < 4 );
break;
Case 6: // mission limitation
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Repeatable: ^777777"+( ( [email protected] )?"unlimit":""[email protected] )+" time^000000";
mes "Redo Delay: ^777777"+( ( [email protected]_delay )?"none":callsub( OnTime2Str,( ( [email protected]_delay * 3600 ) + gettimetick(2) ) ))+"^000000";
mes "Time Limit: ^777777"+( ( [email protected] )?"none":callsub( OnTime2Str,( [email protected] + gettimetick(2) ) ) )+"^000000";
[email protected] = select( "Edit Repeatable Status","Edit Time Limit","Edit Re-do Delay","Edit Required Mission","- Back" );
switch( [email protected] ){
Case 1:
mes "How many time can this mission repeat ??";
mes "^777777( 0 = unlimited )^000000";
input [email protected],0,100;
break;
Case 2:
mes "Time Limit of mission";
mes " 1 = 1 minute";
mes " 60 = 1 hour";
mes "1440 = 1 day";
input [email protected],0,50000;
[email protected] *= 60;
break;
Case 3:
mes "Time Delay to re-take the mission";
mes " 1 = 1 hour";
mes " 24 = 1 day";
mes " 720 = 30 day";
input [email protected]_delay,0,50000;
break;
Case 4:
mes "This is not fully implemented yet.. still in beta test";
break;

do{
mes "Required Mission:";
if( [email protected]_mission_size ){
for( [email protected] = 0; [email protected] < [email protected]_mission_size; [email protected]++ ){
mes " ^777777 ~ "[email protected]_mission$[[email protected]]+"^000000";
[email protected]_mission_menu$ = [email protected]_mission_menu$ + [email protected]_mission$[[email protected]] +":";
}

}else{
mes "^777777 none ^000000";
}
next;
[email protected]_option = select( ( [email protected]_mission_size < .max_required_mission )?"Add required mission":"",
( [email protected]_mission_size )?"Remove required mission":"",
"- Back");
switch( [email protected]_option ){
Case 1:
mes "Enter mission ID";
mes "^777777( enter 0 to cancel )^000000";
do{
input [email protected]_id$;
if( [email protected]_id$ == "0" ) break;
}while( compare( "|"[email protected]_mission_menu$+"|","|"[email protected]_id$+"|" ) );
[email protected]_id$ = replacestr( [email protected]_id$,":","" );
if( [email protected]_id$ != "0" ){
[email protected]_mission$[[email protected]_mission_size] = [email protected]_id$;
[email protected]_mission_size++;
}
break;
Case 2:
mes "Select a mission to remove.";
[email protected] = select( [email protected]_mission_menu$ ) - 1;
deletearray [email protected]_mission$[[email protected]],1;
default: break;
}
}while( [email protected]_option < 3 );
default: break;
}
if( [email protected] < 5 ) next;
}while( [email protected] < 5 );
break;
Case 7: // reward list
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes " ";
mes "Cash : ^777777"+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes "Zeny : ^777777"+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes "Reward Item List: ";
if( [email protected]_size ){
[email protected]_menu$ = "";
deletearray [email protected]_reward$;
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_name$ = getitemname( [email protected]_list[[email protected]] );
[email protected]_menu$ = [email protected]_menu$ + [email protected]_qty[[email protected]] +"x "[email protected]_name$ +":";
[email protected]_reward$[[email protected]] = [email protected]_name$;
mes " ^777777 ~ "[email protected]_qty[[email protected]]+" x "[email protected]_name$+"^000000";
}
[email protected]_reward_list$ = implode( [email protected]_reward$,"|" );

}else{
mes " ^777777 ~ none ^000000";
}
mes "Base EXP : ^777777"+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes "Job EXP : ^777777"+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes " ";
next;
[email protected] = select( ( [email protected]_size >= .max_required_item )?"":"Add Item Reward",
( [email protected]_size )?"Delete Item Reward":"",
"Edit Cash Reward",
"Edit Zeny Reward",
"Edit Base EXP Reward",
"Edit Job EXP Reward",
"- Back" );
mes "^0055FF[ "[email protected]_name$+" ]^000000";
switch( [email protected] ){
Case 1:
mes "Enter Reward Item ID";
do{
input [email protected]_id;
if( [email protected]_id ) break;
[email protected]_name$ = getitemname( [email protected]_id );
}while( [email protected]_name$ == "null" || [email protected]_name$ == "" );
if( [email protected]_id && [email protected]_name$ != "null" && [email protected]_name$ != "" ){
mes "How many "[email protected]_name$+" will be rewarded ?";
input [email protected],0,30000;
if( [email protected] ){
if( compare( "|"[email protected]_reward_list$+"|","|"[email protected]_name$+"|" ) ){
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ )
if( [email protected]_list[[email protected]] == [email protected]_id ){
[email protected]_qty[[email protected]] += [email protected];
break;
}
}else{
[email protected]_list[[email protected]_size] = [email protected]_id;
[email protected]_qty[[email protected]_size] = [email protected];
[email protected]_size++;
}
}
}
break;
Case 2:
mes "Pick an Reward to Remove.";
[email protected] = select( [email protected]_menu$ ) - 1;
mes "Removed "[email protected]_qty[[email protected]]+"x "+getitemname( [email protected]_list[[email protected]] );
deletearray [email protected]_list[[email protected]],1;
deletearray [email protected]_qty[[email protected]],1;
[email protected]_size--;
break;
Case 3:
mes "How many Cash will be given ?";
mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
input [email protected],0,.max_integer_value;
break;
Case 4:
mes "How many Zeny will be given ?";
mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
input [email protected],0,.max_integer_value;
break;
Case 5:
mes "How many Base EXP reward ?";
mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
input [email protected],0,.max_integer_value;
break;
Case 6:
mes "How many Job EXP reward ?";
mes "^777777( value: 0 ~ "+.max_integer_value+" )^000000";
input [email protected],0,.max_integer_value;
default: break;
}
next;
}while( [email protected] < 7 );
break;
Case 8: // npc limitation
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "By default, the mission will be available from each mission board npc ^FF0000unless you have specified which NPC may offer this mission.^000000";
mes " ";
mes "Just pick all the NPC that may offer this mission if you wish.";
next;
if( !getarraysize( [email protected]_npc_array$ ) )
for( [email protected] = 1; [email protected] <= .mission_npc_count; [email protected]++ ){
[email protected]_npc_array$[[email protected]] = ""[email protected];
[email protected]_npc_size++;
}
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Mission offered by: ";
[email protected]_npc_menu$ = "";
if( [email protected]_npc_size >= 2 ){
[email protected]_npc$ = "|"+implode( [email protected]_npc_array$,"|" )+"|";
}else{
[email protected]_npc$ = "|"[email protected]_npc_array$+"|";
}
for( [email protected] = 1; [email protected] <= .mission_npc_count; [email protected]++ ){
getmapxy( [email protected]$,[email protected],[email protected],1,( .name_offset_num + [email protected] ) );
[email protected]_npc_name$ = "^777777("[email protected]$+") ";
[email protected]_npc_name$ = [email protected]_npc_name$ + ( ( compare( "|"[email protected]_npc$+"|","|"[email protected]+"|" ) )?"^44EE00":"^FF0000" );
// [email protected]_npc_name$ = [email protected]_npc_name$ + "["[email protected]$+","[email protected]+","[email protected]+"]";
[email protected]_npc_name$ = [email protected]_npc_name$ + .npc_name_list$[[email protected]] + "^000000";
mes ""[email protected]_npc_name$;
[email protected]_npc_menu$ = [email protected]_npc_menu$ + [email protected]_npc_name$ +":";
}
next;
[email protected] = select( [email protected]_npc_menu$+"-Back" );
if( [email protected] <= .mission_npc_count ){
if( compare( "|"[email protected]_npc$+"|","|"[email protected]+"|" ) )
[email protected]_npc_array$[[email protected]] = "";
else
[email protected]_npc_array$[[email protected]] = ""[email protected];
[email protected]_npc_size = getarraysize( [email protected]_npc_array$ );
}
}while( [email protected] <= .mission_npc_count );
break;
default: break;
}
next;
}while( [email protected]_option < 9 );

// finalise all variable
if( [email protected]_size ){
[email protected]_mob_list$ = "|";
[email protected]_mob_qty$ = "|";
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_mob_list$ = [email protected]_mob_list$ + [email protected]_list[[email protected]] +"|";
[email protected]_mob_qty$ = [email protected]_mob_qty$ + [email protected]_qty[[email protected]] +"|";
}
}

if( [email protected]_size ){
[email protected]_item_list$ = "|";
[email protected]_item_qty$ = "|";
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_item_list$ = [email protected]_item_list$ + [email protected]_list[[email protected]] +"|";
[email protected]_item_qty$ = [email protected]_item_qty$ + [email protected]_qty[[email protected]] +"|";
}
}

if( [email protected]_size ){
[email protected]_reward_list$ = "|";
[email protected]_reward_qty$ = "|";
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_reward_list$ = [email protected]_reward_list$ + [email protected]_list[[email protected]] +"|";
[email protected]_reward_qty$ = [email protected]_reward_qty$ + [email protected]_qty[[email protected]] +"|";
}
}

if( [email protected]_npc_size ){
[email protected]_npc_list$ = "|";
for( [email protected] = 0; [email protected] < [email protected]_npc_size; [email protected]++ )
[email protected]_npc_list$ = [email protected]_npc_list$ + [email protected]_npc_array$[[email protected]] +"|";
}

if( [email protected]_mission_id ){
[email protected]_mission_id = gettimetick(1);
message strcharinfo(0),"Mission # "[email protected]_mission_id+" has been added.";
}else{
message strcharinfo(0),"Mission # "[email protected]_mission_id+" has been updated.";
// attach and inform other online players.
callsub( OnRemoveMission,[email protected]_mission_id,"A GM updated Mission # "[email protected]_mission_id );
}

// add new mission into SQL
query_sql(
"REPLACE INTO `mission_board` VALUES ( " +
[email protected]_mission_id+", " +
"'"+escape_sql( [email protected]$ )+"', " +
"'"+escape_sql( [email protected]$ )+"', " +
"'"+escape_sql( [email protected]_mob_list$ )+"', " +
"'"+escape_sql( [email protected]_mob_qty$ )+"', " +
"'"+escape_sql( [email protected]_item_list$ )+"', " +
"'"+escape_sql( [email protected]_item_qty$ )+"', " +
[email protected]_job_bitmask+", " +
[email protected]_branch_bitmask+", " +
[email protected]_range[0]+", " +
[email protected]_range[1]+", " +
[email protected]+", " +
[email protected]+", " +
"'"+escape_sql( [email protected]_reward_list$ )+"', " +
"'"+escape_sql( [email protected]_reward_qty$ )+"', " +
[email protected]+", " +
[email protected]+", " +
[email protected]+", " +
[email protected]+", " +
getcharid(3)+", " +
"'"+escape_sql( strcharinfo(0) )+"', " +
"NOW(), " +
"'"+escape_sql( [email protected]_npc_list$ )+"', " +
[email protected]_delay +
" ); "
);
break;
Case 6: // delete mission
do{
mes "^0055FF[ "[email protected]_name$+" ]^000000";
deletearray [email protected];
query_sql( "SELECT `id`,`title`,`min_lv`,`max_lv` FROM `mission_board` WHERE `npc_id` LIKE '%|"[email protected]_npc_num+"|%' LIMIT "+.max_page_size+" OFFSET "[email protected],[email protected],[email protected]$,[email protected]_lv,[email protected]_lv );
[email protected] += .max_page_size;
[email protected] = getarraysize( [email protected] );
if( [email protected] ){
mes "There are no available mission to update.";
close;

}else{
mes "Pick a mission.";
for( [email protected] = 0; [email protected] < [email protected]; [email protected]++ )
[email protected]_menu$ = [email protected]_menu$ + "["[email protected]_lv[[email protected]]+"~"[email protected]_lv[[email protected]]+"] "[email protected]$[[email protected]] +":";
}
next;
[email protected] = select( [email protected]_menu$+"- next page" ) - 1;
}while( [email protected] == [email protected] );
[email protected]_id = [email protected][[email protected]];
mes "^0055FF[ "[email protected]_name$+" ]^000000";
mes "Are you sure to remove this mission ?";
if( select( "nope","Delete Mission" ) == 2 ){
query_sql( "DELETE FROM `mission_board` WHERE `id` = "[email protected]_id+" LIMIT 1" );
mes "Removed mission from mission list.";

// attach other online players and remove the missions.
callsub( OnRemoveMission,[email protected]_id,"A GM removed Mission # "[email protected]_id );
query_sql( "DELETE FROM `player_mission` WHERE `completion` = '0000-00-00 00:00:00' AND `mission_id` = "[email protected]_id );
mes "Removed mission from all players.";
}
default: break;
}
close;

OnInit:
.name_offset_num = 1000;
// initialize settings
if( strnpcinfo(0) == "mission_board" ){

// gm level to access panel
.gm_level = 90;
// max no. of required monster
.max_required_monster = 10;
// max no. of required item
.max_required_item = 10;
// max no. of required mission ( un-implement yet )
.max_required_mission = 10;
// max no. of available mission
.max_mission_available = 50;
// max value of integer input
.max_integer_value = 2000000000;
// max amount of mission per page
.max_page_size = 30;
// max mission per npc take by character
.max_mission_per_char = 4;

// predefined values.
.npc_name$ = strnpcinfo(0);
.server_max_level = getbattleflag( "max_lv" );
setarray .base_job,
EAJ_SWORDMAN,
EAJ_MAGE,
EAJ_ARCHER,
EAJ_ACOLYTE,
EAJ_MERCHANT,
EAJ_THIEF,
EAJ_TAEKWON,
EAJ_GUNSLINGER,
EAJ_NINJA;
.base_job_size = getarraysize( .base_job );
setarray .job_branch_name$,
"2-1 Classes",
"2-2 Classes",
"Rebirth Classes",
"Baby Classes",
"Third Classes";
setarray .job_branch,
EAJL_2_1,
EAJL_2_2,
EAJL_UPPER,
EAJL_BABY,
EAJL_THIRD;
.job_branch_size = getarraysize( .job_branch );
sleep 1000;
debugmes "[ Mission Board ] NPC Loaded : "+.mission_npc_count+" ...";

}else{
.mission_npc_count++;
// save correct npc name to each index based on unique name
[email protected] = ( atoi( strnpcinfo(3) ) - .name_offset_num );
.npc_name_list$[ [email protected] ] = strnpcinfo(1);
// debugmes "["[email protected]+"]"+.npc_name_list$[ [email protected] ];
}
end;


// OnWhisperGlobal:
OnPCLoginEvent:
if( strnpcinfo(0) == .npc_name$ ){
[email protected] = gettimetick(2);
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$,[email protected],[email protected]_hunt$ );
@ms_size = getarraysize( @ms_list$ );
if( @ms_size )
for( [email protected] = 0; [email protected] < @ms_size; [email protected]++ ){
if( [email protected] < [email protected][[email protected]] ){
[email protected] = ( [email protected][[email protected]] - [email protected] );
addtimer ( [email protected] * 1000 ),.npc_name$+"::OnTimeCheck";
dispbottom "[ Mission Progress : "[email protected]_list$[[email protected]]+" , expire in "+callsub( OnTime2Str,( [email protected] + [email protected] ) )+" ]";
query_sql( "SELECT `mob_list`,`mob_qty` FROM `mission_board` WHERE `id` = "[email protected]_list$[[email protected]],[email protected]_list$,[email protected]_qty$ );

setd( "@ms_"[email protected]_list$[[email protected]]+"_expire" ),[email protected][[email protected]];
if( callsub( OnExplodeArray,[email protected]_list$[[email protected]],getd( "@ms_"[email protected]_list$[[email protected]]+"_list" ),0 ) ){
callsub( OnExplodeArray,[email protected]_hunt$[[email protected]],getd( "@ms_"[email protected]_list$[[email protected]]+"_qty" ),0 );
[email protected]_size = callsub( OnExplodeArray,[email protected]_hunt$[[email protected]],getd( "@ms_"[email protected]_list$[[email protected]]+"_hunt" ),0 );
// for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ )
// dispbottom " ~ killed "+getd( "@ms_"[email protected]_list$[[email protected]]+"_hunt["[email protected]+"]" )+"/"+getd( "@ms_"[email protected]_list$[[email protected]]+"_qty["[email protected]+"]" )+" x "+getmonsterinfo( getd( "@ms_"[email protected]_list$[[email protected]]+"_list["[email protected]+"]" ),MOB_NAME );
}
}
}
}
end;

OnPCLogoutEvent:
if( strnpcinfo(0) == .npc_name$ ){
if( @ms_size )
for( [email protected] = 0; [email protected] < @ms_size; [email protected]++ ){
debugmes "Saving "[email protected]_list$[[email protected]];
[email protected]_size = getarraysize( getd( "@ms_"[email protected]_list$[[email protected]]+"_list" ) );
if( [email protected]_size ){
copyarray [email protected]_array[0],getd( "@ms_"[email protected]_list$[[email protected]]+"_list[0]" ),[email protected]_size;
[email protected]_hunt$ = "|";
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ )
[email protected]_hunt$ = [email protected]_hunt$ + getd( "@ms_"[email protected]_list$[[email protected]]+"_hunt["[email protected]+"]" ) +"|";
query_sql( "UPDATE `player_mission` SET `mob_hunt` = '"+escape_sql( [email protected]_hunt$ )+"' WHERE `mission_id` = "[email protected]_list$[[email protected]]+" AND `completion` = '0000-00-00 00:00:00' AND `cid` = "+getcharid(0) );
}
}
}
end;

OnNPCKillEvent:
if( strnpcinfo(0) == .npc_name$ ){
if( @ms_size ){
[email protected] = gettimetick(2);
for( [email protected] = ( @ms_size - 1 ); [email protected] >= 0; [email protected] ){
if( getd( "@ms_"[email protected]_list$[[email protected]]+"_expire" ) < [email protected] ){
setd( "@ms_"[email protected]_list$[[email protected]]+"_expire" ),0;
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_list" );
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_qty" );
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_hunt" );
dispbottom "[Mission # "[email protected]_list$[[email protected]]+"] Mission removed due to expired. ";
deletearray @ms_list$[[email protected]],1;
@ms_size--;

}else{
[email protected]_size = getarraysize( getd( "@ms_"[email protected]_list$[[email protected]]+"_list" ) );
if( [email protected]_size ){
copyarray [email protected]_array[0],getd( "@ms_"[email protected]_list$[[email protected]]+"_list[0]" ),[email protected]_size;
for( [email protected] = 0; [email protected]_size; [email protected]++ )
if( [email protected]_array[[email protected]] == killedrid ){
[email protected] = getd( "@ms_"[email protected]_list$[[email protected]]+"_hunt["[email protected]+"]" ) + 1;
setd( "@ms_"[email protected]_list$[[email protected]]+"_hunt["[email protected]+"]" ),[email protected];
// dispbottom "[Mission # "[email protected]_list$[[email protected]]+" Progress] Hunted "[email protected]+" x "+getmonsterinfo( [email protected]_array[[email protected]],MOB_NAME );
break;
}
deletearray [email protected]_array;
}
}
}
}
}
end;

OnTimeCheck:
if( @ms_size ){
[email protected] = gettimetick(2);
for( [email protected] = ( @ms_size - 1 ); [email protected] >= 0; [email protected] ){
if( getd( "@ms_"[email protected]_list$[[email protected]]+"_expire" ) <= [email protected] ){
setd( "@ms_"[email protected]_list$[[email protected]]+"_expire" ),0;
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_list" );
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_qty" );
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_hunt" );
dispbottom "[Mission # "[email protected]_list$[[email protected]]+"] Mission removed due to expired. ";
deletearray @ms_list$[[email protected]],1;
@ms_size--;
}
}
}
end;

OnRemoveMission:
[email protected]_id = getarg(0);
[email protected]$ = getarg(1);

query_sql( "SELECT `aid`,`cid` FROM `player_mission` WHERE `cid` IN ( SELECT `char_id` FROM `char` WHERE `online` = 1 ) AND `mission_id` = "[email protected]_id+" AND `completion` = '0000-00-00 00:00:00' LIMIT 128",[email protected],[email protected] );
[email protected]_size = getarraysize( [email protected] );
[email protected] = 0;
[email protected]_aid = getcharid(3);
while( [email protected] < [email protected]_size ){
if( isloggedin( [email protected][[email protected]],[email protected][[email protected]] ) ){
attachrid( [email protected][[email protected]] );
for( [email protected] = @ms_size; [email protected] >= 0; [email protected] )
if( @ms_list$[[email protected]] == ""[email protected]_id ){
message strcharinfo(0),[email protected]$;
dispbottom "Please visit Mission NPC to gain latest information.";
setd( "@ms_"[email protected]_list$[[email protected]]+"_expire" ),0;
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_list" );
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_qty" );
deletearray getd( "@ms_"[email protected]_list$[[email protected]]+"_hunt" );
deletearray @ms_list$[[email protected]],1;
@ms_size--;
break;
}
detachrid;
[email protected]++;
}
[email protected]++;
}
attachrid( [email protected]_aid );
dispbottom "Total "[email protected]+" online players affected.";
return;

// usage :
// [email protected] = callsub( OnTime2Str,<time> );
OnTime2Str:
[email protected] = getarg(0);
[email protected] = ( [email protected] - gettimetick(2) );
[email protected] = ( [email protected] / 3600 );
[email protected] = ( [email protected] % 3600 / 60 );
[email protected] = ( [email protected] % 60 );
if( [email protected] )
return "none";
else
return "^777777"+( ( [email protected] )? [email protected]+" hr ":"" ) + ( ( [email protected] || [email protected] )? [email protected]+" min ":"" ) [email protected]+" sec^000000";


// usage :
// [email protected]_array_size = callsub( OnExplodeArray,<old string variable>,<new array variable>,<save '0'> );
OnExplodeArray:
[email protected] = getarg(2);
explode( getarg(0),getarg(0),"|" );
[email protected] = getarraysize( getarg(0) );
while( [email protected] < [email protected] ){
if( [email protected] ){
[email protected] = atoi( getelementofarray( getarg(0),[email protected] ) );
if( [email protected] ){
set getelementofarray( getarg(1),[email protected]_size ),[email protected];
[email protected]_size++;
}
}else{
set getelementofarray( getarg(1),[email protected]_size ),getelementofarray( getarg(0),[email protected] );
[email protected]_size++;
}
[email protected]++;
}

return [email protected]_size;


// display mission information + optional progress checking
OnDisplayMissionInfo:
[email protected]_id = getarg(0);
[email protected]$ = getarg(1);
[email protected]$ = getarg(2);
[email protected] = getarg(4);
[email protected] = getarg(5);
[email protected]_size = getarraysize( getarg(6) );
[email protected]_size = getarraysize( getarg(8) );
[email protected]_job_bitmask = getarg(10);
[email protected]_branch_bitmask = getarg(11);
[email protected] = getarg(12);
[email protected] = getarg(13);
[email protected] = getarg(14);
[email protected] = getarg(15);
[email protected]_size = getarraysize( getarg(16) );
[email protected]_npc_size = getarraysize( getarg(18) );
[email protected]_update$ = getarg(19);
[email protected]_delay = getarg(20);
[email protected]_progress = getarg(21);

if( [email protected]_progress & 8 )
[email protected] = eaclass();

// display mission info
mes ""+(( [email protected]_id )? "^FF0000Mission ID # "[email protected]_id:" " )+"^000000";
mes "Title : "+( ( [email protected]$ != "" )?"^777777"[email protected]$:"^FF0000-incomplete-" )+"^000000";
mes "Description : "+( ( [email protected]$ != "" )?"^777777"[email protected]$:"^FF0000-incomplete-" )+"^000000";
mes "Level Range : "+( ( getelementofarray( getarg(3),0 ) )? "^777777"+getelementofarray( getarg(3),0 )+" ~ "+getelementofarray( getarg(3),1 ):"^FF0000-incomplete-" )+"^000000";
if( [email protected]_progress & 1 )
if( BaseLevel >= getelementofarray( getarg(3),0 ) && BaseLevel <= getelementofarray( getarg(3),1 ) )
[email protected]_progress = 1;

mes "Repeatable: ^777777"+( ( [email protected] )?"unlimit":[email protected]+" time" )+"^000000";
mes "Redo Delay: ^777777"+( ( [email protected]_delay )?"none":callsub( OnTime2Str,( ( [email protected]_delay * 3600 ) + gettimetick(2) ) ) )+"^000000";
mes "Expire in: ^777777"+( ( [email protected] )?"none":callsub( OnTime2Str,[email protected] ) )+"^000000";
mes " ";

[email protected]$ = (( [email protected]_size && [email protected]_size )?"^FF0000incomplete":"^777777none" );
mes "Monster List : "+( ( [email protected]_size )?"":[email protected]$ )+"^000000";
if( [email protected]_size )
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_id = getelementofarray( getarg(6),[email protected] );
[email protected] = getelementofarray( getarg(7),[email protected] );
if( [email protected]_progress & 2 ){
[email protected]_count = getd( "@ms_"[email protected]_id+"_hunt["[email protected]+"]" );
if( [email protected]_count >= [email protected] ){
[email protected]_progress++;
[email protected]_color$ = "44EE99";
}else{
[email protected]_color$ = "FF0000";
}
}
mes " ^777777"[email protected]+" x "+getmonsterinfo( [email protected]_id,MOB_NAME )+" "+( ( [email protected]_progress & 2 )?"^"[email protected]_color$+"(killed "[email protected]_count+")":"" )+"^000000";
}
mes "Item List : "+( ( [email protected]_size )?"":[email protected]$ )+"^000000";
if( [email protected]_size )
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_id = getelementofarray( getarg(8),[email protected] );
[email protected] = getelementofarray( getarg(9),[email protected] );
[email protected]_type = getiteminfo( [email protected]_id,2 );
if( [email protected]_progress & 4 ){
[email protected]_count = countitem( [email protected]_id );
if( [email protected]_count >= [email protected] ){
[email protected]_progress++;
[email protected]_color$ = "44EE99";
}else{
[email protected]_color$ = "FF0000";
}
}
mes " ^777777"[email protected]+" x "+getitemname( [email protected]_id )+" "+( ( [email protected]_type == 4 || [email protected]_type == 5 )?"["+getitemslots( [email protected]_id )+"]":"" )+" "+( ( [email protected]_progress & 4 )?"^"[email protected]_color$+"(have "[email protected]_count+")":"" )+"^000000";
}
mes " ";
mes "Available Job Classes :";
if( [email protected]_job_bitmask ){
deletearray [email protected]_job$;
deletearray [email protected]_branch$;
[email protected]_job_size = 0;
[email protected]_branch_size = 0;
for( [email protected] = 0; [email protected] < .base_job_size; [email protected]++ )
if( [email protected]_job_bitmask & ( 1 << [email protected] ) ){
[email protected] = roclass( .base_job[[email protected]] );
[email protected]_job$[[email protected]_job_size] = jobname( [email protected] );
if( [email protected]_progress & 8 && BaseClass == [email protected] )
[email protected]_progress = 1;
[email protected]_job_size++;
}
mes " ^777777"+implode( [email protected]_job$,"," )+" ^000000";
if( [email protected]_branch_bitmask ){
for( [email protected] = 0; [email protected] < .job_branch_size; [email protected]++ )
if( [email protected]_branch_bitmask & ( 1 << [email protected] ) ){
if( [email protected]_progress & 8 && ( [email protected] & .job_branch[[email protected]] ) )
[email protected]_progress++;
[email protected]_branch$[[email protected]_branch_size] = .job_branch_name$[[email protected]];
[email protected]_branch_size++;
}
mes "Inherited: ^777777"+implode( [email protected]_branch$,", " )+" ^000000";
}
}else{
mes " ^FF0000-incomplete^000000";
}

mes " ";
mes "Reward List : ";
mes "^777777 ~ Base EXP: "+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes "^777777 ~ Job EXP: "+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes "^777777 ~ Cash: "+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes "^777777 ~ Zeny: "+( ( [email protected] )? [email protected]:"none" )+"^000000";
mes "Reward Item List: "+( ( [email protected]_size )?"":"^777777none" )+"^000000";
if( [email protected]_size )
for( [email protected] = 0; [email protected] < [email protected]_size; [email protected]++ ){
[email protected]_id = getelementofarray( getarg(16),[email protected] );
[email protected]_type = getiteminfo( [email protected]_id,2 );
mes " ^777777 ~ "+getelementofarray( getarg(17),[email protected] )+" x "+getitemname( [email protected]_id )+" "+( ( [email protected]_type == 4 || [email protected]_type == 5 )?"["+getitemslots( [email protected]_id )+"]":"" )+"^000000";
}
mes " ";

mes "Mission Offered by: "+( ( [email protected]_npc_size )?"":"^FF0000-incomplete" )+"^000000";
if( [email protected]_npc_size ){
if( [email protected]_npc_size >= 2 )
[email protected]_npc$ = "|"+implode( getarg(18),"|" )+"|";
else
[email protected]_npc$ = "|"+getarg(18)+"|";
for( [email protected] = 1; [email protected] <= .mission_npc_count; [email protected]++ )
if( ( compare( "|"[email protected]_npc$+"|","|"[email protected]+"|" ) ) ){
getmapxy( [email protected]$,[email protected],[email protected],1,( .name_offset_num + [email protected] ) );
[email protected]_npc_name$ = "^777777("[email protected]$+") ";
// [email protected]_npc_name$ = [email protected]_npc_name$ + "["[email protected]$+","[email protected]+","[email protected]+"]";
[email protected]_npc_name$ = [email protected]_npc_name$ + .npc_name_list$[[email protected]] + "^000000";
mes " ~ "[email protected]_npc_name$;
}



mes " ";
}
if( [email protected]_update$ != "0000-00-00 00:00:00" && [email protected]_update$ != "" ){
mes "Last Mission Update:";
mes "^777777"[email protected]_update$+"^000000";
}

if( [email protected]_progress ){
if( [email protected]_progress & 1 && [email protected]_progress ){
dispbottom "[Failed] Your level didnt meet the requirements.";
[email protected]_result |= 1;
}
if( [email protected]_progress & 2 && [email protected]_size != [email protected]_progress ){
dispbottom "[Failed] Your Monsters Hunt didnt meet the requirements.";
[email protected]_result |= 2;
}
if( [email protected]_progress & 4 && [email protected]_size != [email protected]_progress ){
dispbottom "[Failed] Your Items collecting didnt meet the requirements.";
[email protected]_result |= 4;
}
if( [email protected]_progress & 8 && ( [email protected]_progress || [email protected]_progress ) ){
dispbottom "[Failed] Your Class didnt meet the requirements.";
[email protected]_result |= 8;
}
}
return [email protected]_result;


}


// the number behind the NPC name must be above 1000 ( if you had not changed another )
// you can have 127 npcs.

prontera,151,171,4 duplicate(mission_board) Prontera Mission::1001 837
prontera,155,171,4 duplicate(mission_board) Byalan Mission::1002 837
prontera,159,171,4 duplicate(mission_board) Payon Cave Mission::1003 837
//prontera,159,175,4 duplicate(mission_board) Mission 1::1003 837
//prontera,159,171,4 duplicate(mission_board) Mission 2::1004 837
//prontera,159,171,4 duplicate(mission_board) Mission 3::1005 837
//prontera,159,171,4 duplicate(mission_board) Mission 4::1006 837
prontera,155,175,4 duplicate(mission_board) Prontera Mission::1007 837
I am not modify some codes, just add end line for duplicate NPC,

 

 

post your full script.

 

is this setup quest step ??

did you added any npc to offer this quest when you setup the quest ??

 

yes, screen shoot is a setup quest

not, i am not add any script.

 

Thanks Emistry

Share this post


Link to post
Share on other sites

for me it was working fine, players wera able to drop a mission after the picked up one

 

huh i got a lil. problem here

 

when adding gold acidus and blue acidus to the hunt quest, they weren't counted, they appeared like 1

same for green ferus and red ferus

 

i had to separate the quest, one for gold acidus and green ferus and another one for blue acidus and red ferus

 

any idea D:?!

 

Edit:

The script i have not changed it at all D:!

Share this post


Link to post
Share on other sites

@Code Hunter

seem fine for me ......

17oTxto.jpg

 

btw...the number behind NPC should not jump ..

 

 

@kido

could it be you added wrong mob id ? some monster are used for event only.

Share this post


Link to post
Share on other sites

/hmm

 

or maybe your script need some specify requirement?

 

i am try using last svn linux compiled with sql, then i am try using windows precompiled rAthena Revision 16797, it same, still not shown.

Share this post


Link to post
Share on other sites

http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=1260

gold acidus = 1713

blue acidus = 1716

abyss_02,0,0,0,0 monster Acidus 1713,10,600000,0,0

abyss_02,0,0,0,0 monster Acidus 1716,60,300000,0,0

areamonster [email protected]$,93,96,103,132,"Acidus",1716,10,[email protected]$;

areamonster [email protected]$,93,96,103,132,"Acidus",1713,10,[email protected]$;

apparently, the monster in abyss_02 can add the count, but if kill inside endless tower, its not

perhaps you should tell that ... this npc shouldn't setup outside instance npc ?

since all instance script has monster labels

@Code Hunter

I think his script doesn't have protection against skipping a npc ID

means, 1001,1002,1003,1004,1005,1006 ... must be in order ..

you can't do 1001,1005,1020,1030 ... it will bug

my old one, can jump ID, can detect which npc ID has fault and report it on that npc itself even

I think most people here ... doesn't read the error on map-server.exe console ... that might be the problem

that's why my script, if setup just slightly a little bug, the whole npc will down

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

I think his script doesn't have protection against skipping a npc ID

means, 1001,1002,1003,1004,1005,1006 ... must be in order ..

you can't do 1001,1005,1020,1030 ... it will bug

ya...just noticed it ...xD

but his problem seem like different ... in his screenshot, he cant see any npc name..O__O  but i can view the npc name..

weird..

 

anyway...detected a few possible bug ..xD 

gonna fix it when i have time ...

Share this post


Link to post
Share on other sites
@Code Hunter

I think his script doesn't have protection against skipping a npc ID

means, 1001,1002,1003,1004,1005,1006 ... must be in order ..

you can't do 1001,1005,1020,1030 ... it will bug

my old one, can jump ID, can detect which npc ID has fault and report it on that npc itself even

I think most people here ... doesn't read the error on map-server.exe console ... that might be the problem

that's why my script, if setup just slightly a little bug, the whole npc will down

 

 

Yes, i have to it. but still same, NPC not snown, thanks AnnieRuru

 

 

I think his script doesn't have protection against skipping a npc ID

means, 1001,1002,1003,1004,1005,1006 ... must be in order ..

you can't do 1001,1005,1020,1030 ... it will bug

ya...just noticed it ...xD

but his problem seem like different ... in his screenshot, he cant see any npc name..O__O  but i can view the npc name..

weird..

 

anyway...detected a few possible bug ..xD 

gonna fix it when i have time ...

 

 

Last try, i am insert manually quest to sql table "mission_board", still same the quest not shown to NPC.

 

Okey Emistry, thanks once again for advice.

 

:)

Share this post


Link to post
Share on other sites

@Emistry @AnnieRuru

 

that's what i'm saying D: i added the different IDs, for example:

kill 100 gold acidus 1713

and 100 blue acidus 1716

 

then this appears, like it was only 1 same mob D:

*see the video*

http://youtu.be/Nq4LflypE6g

Share this post


Link to post
Share on other sites

New Updates :

 Mission Board 1.2
  • Fixed mob/item adding bugs
  • Change how mission NPC naming
  • Enable All Classes by default when setup mission
  • Shorten some menu length
  • Auto remove NPC if it's named wrongly or max NPC reached.
 
feel free to report if you found any potential bugs / exploits..
  • Upvote 1

Share this post


Link to post
Share on other sites

woa excellente o:!!!

 

may i ask

should i deleted the sql table and re-add it?

with an @reloadscript by replacing the script file, should be make the changes too o:?

 

thankies emistry o:!!

Share this post


Link to post
Share on other sites

I think there's still a bug

the job branch doesn't enable a 1-1 job branch

if I'm a swordsman/archer/magician, I couldn't do any quest

@Kido

as long as the data structure has been planned out nicely .. there is no need to modify the sql table ..

though, I can kinda tell if emistry wants to add a custom variable as reward ... then need to do alter table in the future

Share this post


Link to post
Share on other sites

I think there's still a bug

the job branch doesn't enable a 1-1 job branch

if I'm a swordsman/archer/magician, I couldn't do any quest

erm...i remember that it's enabled for all 1-1 job by default ... i didnt add any settings to limit 1-1 job ...the job limitation work after 1-1 job.

 

 

woa excellente o:!!!

 

may i ask

should i deleted the sql table and re-add it?

with an @reloadscript by replacing the script file, should be make the changes too o:?

 

thankies emistry o:!!

just as annie stated, dont need to change it.  the only things that you might need to change is just the npc column. ( might affected when changing NPC number )

 

 

and if there are any changes regarding SQL table, normally i will inform it during the updates =)

 

though, I can kinda tell if emistry wants to add a custom variable as reward ... then need to do alter table in the future

yes... will have to alter the table to add this.. =)

Share this post


Link to post
Share on other sites

can't wait for it < 3 ty both

Share this post


Link to post
Share on other sites

I think there's still a bug

the job branch doesn't enable a 1-1 job branch

if I'm a swordsman/archer/magician, I couldn't do any quest

erm...i remember that it's enabled for all 1-1 job by default ... i didnt add any settings to limit 1-1 job ...the job limitation work after 1-1 job.
no ... its not

 

if( [email protected]_progress & 8 && ( [email protected] & .job_branch[[email protected]] ) )
[email protected]_progress++;
your script doesn't have 1-1 enable

when [email protected] if ( eaclass() & .job_branch ), 1-1 classes doesn't meet the requirement, thus [email protected]_progress becomes 0

thus it meet this condition

			if( [email protected]_progress & 8 && ( [email protected]_progress || [email protected]_progress ) ){
				dispbottom "[Failed] Your Class didnt meet the requirements.";
				[email protected]_result |= 8;
			}
I have tested in-game before I post, of course

I have debug your script with

			announce [email protected]_progress +" "+ [email protected]_progress +" "+ [email protected]_progress, 0;
			if( [email protected]_progress & 8 && ( [email protected]_progress || [email protected]_progress ) ){
				dispbottom "[Failed] Your Class didnt meet the requirements.";
				[email protected]_result |= 8;
			}
@job 0 -> novice, 9 0 0

@job 1 -> swordsman, 9 0 1

@job super novice, 9 1 0

Edited by AnnieRuru

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...