mission_main.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. //===== rAthena Script =======================================
  2. //= Guild Mission - Core Script
  3. //===== Description: =========================================
  4. //= Template for guild mission added in episode 14.3
  5. //===== Changelogs: ==========================================
  6. //= [Official Conversion]
  7. //= 1.0 First version [Secretdataz]
  8. //= 1.1 Fixed potential exploit from original Aegis script. [Secretdataz]
  9. //============================================================
  10. - script gld_mission#core -1,{
  11. function brief;
  12. function mob_brief;
  13. function calcexp;
  14. function calcjobexp;
  15. if (!checkweight(1201,3)){
  16. mes "You have too many items to proceed with the quest.";
  17. mes "Please lighten your load and try again.";
  18. close;
  19. }
  20. .@zone$ = strnpcinfo(2);
  21. if(.@zone$ == "gqaldeg"){
  22. .@zoneid = 3;
  23. .@edition = 1;
  24. } else if(.@zone$ == "gqaru"){
  25. .@zoneid = 4;
  26. .@edition = 2;
  27. } else if(.@zone$ == "gqgefg"){
  28. .@zoneid = 2;
  29. .@edition = 1;
  30. } else if(.@zone$ == "gqpayg"){
  31. .@zoneid = 1;
  32. .@edition = 1;
  33. } else if(.@zone$ == "gqprtg"){
  34. .@zoneid = 0;
  35. .@edition = 1;
  36. } else if(.@zone$ == "gqsch"){
  37. .@zoneid = 5;
  38. .@edition = 2;
  39. } else if(.@zone$ == "gqtealde"){
  40. .@zoneid = 6;
  41. .@edition = 3;
  42. } else if(.@zone$ == "gqteprt"){
  43. .@zoneid = 7;
  44. .@edition = 3;
  45. } else {
  46. // Custom error message.
  47. debugmes "Guild mission script called from an unknown agit region [" + .@zone$ + "].";
  48. end;
  49. }
  50. .@npcname$ = .npcname$[.@zoneid];
  51. mes .@npcname$;
  52. mes "We provide missions and daily quests that you can complete in the region of " + .region$[.@zoneid] + ".";
  53. mes "There are simple daily quests as well as missions that you have to complete within the siege hours only. So, think about it~";
  54. next;
  55. switch(select("Conquering " + .region$[.@zoneid], "Guild Dungeon Daily Quests", "About quests", "I don't need it.")){
  56. case 1: // Conquering.
  57. .@gid = getcharid(2);
  58. if(.@gid && is_guild_leader() == true){
  59. .@time_check1 = checkquest(.conquer_delay_questid[.@zoneid], PLAYTIME);
  60. if(.@time_check1 == 0){
  61. mes .@npcname$;
  62. mes "It's been less than an hour since the last time we've checked!";
  63. mes "Come back when the waiting time is over.";
  64. next;
  65. mes .@npcname$;
  66. mes "If you have luck on your side, you'll have good results.";
  67. close;
  68. } else if(.@time_check1 == 2){
  69. erasequest .conquer_delay_questid[.@zoneid];
  70. mes .@npcname$;
  71. mes "I have confirmed that the waiting time for conquering missions has ended.";
  72. mes "I'll delete unnecessary records for you.";
  73. close;
  74. } else {
  75. .@siege_check = (.@edition == 1 ? agitcheck() : .@edition == 2 ? agitcheck2() : agitcheck3());
  76. .@time = atoi(gettimestr("%H%M",4));
  77. .@after_time = ((.weekday[.@zoneid] == gettime(4)) && ((.@time > .start_time[.@zoneid]) && (.@time < .end_time[.@zoneid])));
  78. if(.@siege_check && .@after_time){
  79. mes .@npcname$;
  80. mes "According to ^4d4dffthe number of fortresses that your guild has conquered at this very moment,^000000 I'll give you a reward.";
  81. mes "Do you want to check right now? You're aware that ^4d4dffthe number can change even as we speak,^000000 right?";
  82. next;
  83. if(select("I'll come back later.","Let's check right now!") == 1){
  84. mes .@npcname$;
  85. mes "Right. Life is all about timing.";
  86. mes "Come back when it's shining the most.";
  87. close;
  88. } else {
  89. .@total = 0;
  90. for(.@i = 0; .@i < 5; ++.@i){
  91. .@total += (.@gid == getcastledata(.castle$[.@i+.@zoneid*5],CD_GUILD_ID));
  92. }
  93. if(!.@total){
  94. mes .@npcname$;
  95. mes "Unfortunately, there is no fortress that your guild has conquered.";
  96. mes "Try again!";
  97. close;
  98. } else {
  99. mes .@npcname$;
  100. if(.@total == 5)
  101. mes "Incredible.";
  102. else
  103. mes "Currently, the total number of fortresses that your guild has conquered";
  104. for(.@i = 0; .@i < 5; ++.@i){
  105. mes getcastlename(.castle$[.@i+.@zoneid*5]) + (.@gid == getcastledata(.castle$[.@i+.@zoneid*5],CD_GUILD_ID) ? ": ^4d4dffOccupied^000000" : "");
  106. }
  107. if(.@total == 5)
  108. mes "Your guild has conquered " + .region$[.@zoneid] + "!";
  109. else
  110. mes "is " + .@total + "!";
  111. next;
  112. mes .@npcname$;
  113. mes "I'll give you a reward accordingly. I hope you make good use of it.";
  114. mes "You have an hour of waiting time until the next report. Keep that in mind and try again.";
  115. setquest .conquer_delay_questid[.@zoneid];
  116. getitem 6489,.@total;
  117. getitem 6615,.@total;
  118. getitem 12888,.@total;
  119. close;
  120. }
  121. }
  122. } else {
  123. mes .@npcname$;
  124. mes "I'm sorry but you can complete this mission only during the siege hours. I'm afraid I can't do anything here.";
  125. close;
  126. }
  127. }
  128. } else {
  129. mes .@npcname$;
  130. mes "I'm sorry but conquering missions are for guild masters only.";
  131. mes "Members should try guild dungeon daily quests instead.";
  132. close;
  133. }
  134. break;
  135. case 2: // Daily Quests
  136. mes .@npcname$;
  137. mes "These are missions that you can complete in guild dungeons of " + .region$[.@zoneid] + " area.";
  138. mes "You can cancel them if you want to. Feel free to challenge yourself.";
  139. next;
  140. .@cancel_index = (.@edition == 1 ? 3 : 2);
  141. for(.@i = 0; .@i < 3; ++.@i){
  142. if(.daily_hunting_questid[.@zoneid*3 + .@i])
  143. .@menu$ = .@menu$ + .region$[.@zoneid] + " Mission " + (.@i+1) + (isbegin_quest(.daily_hunting_questid[.@zoneid*3 + .@i]) ? " ^4d4dffCheck the result^000000" : "") + ":";
  144. }
  145. .@sel = select(.@menu$) - 1;
  146. .@index = .@zoneid*3 + .@sel;
  147. if(.@sel == .@cancel_index){
  148. mes .@npcname$;
  149. mes "You don't need to rush since these missions take place in guild dungeons.";
  150. mes "Feel free to give it a try whenever you want to.";
  151. close;
  152. }
  153. if(BaseLevel < .level_req[.@index]){
  154. mes .@npcname$;
  155. mes "Hmm, unfortunately, this mission is limited to users with ^4d4dfflevel " + .level_req[.@index] + "^000000 or higher only.";
  156. mes "Your level is not high enough.";
  157. close;
  158. }
  159. .@hunting = checkquest(.daily_hunting_questid[.@index], HUNTING);
  160. .@playtime = checkquest(.daily_delay_questid[.@index], PLAYTIME);
  161. if(.@hunting > -1){
  162. if(.@hunting == 2){
  163. mes .@npcname$;
  164. mes "Oh, you've done a good job.";
  165. mes "It isn't much, but hopefully it will be helpful.";
  166. setquest .daily_delay_questid[.@index];
  167. erasequest .daily_hunting_questid[.@index];
  168. getexp calcexp(.@zoneid,.@index),calcjobexp(.@edition);
  169. getitem 6615,1;
  170. } else {
  171. mes .@npcname$;
  172. mes "Hmm? It seems like you haven't completed the mission yet..";
  173. mes "Is there any problem?";
  174. next;
  175. if(select("No.","Give up the quest.") == 1){
  176. mes .@npcname$;
  177. mes "I'm not sure how long you can use the guild dungeon, but good luck.";
  178. close;
  179. } else {
  180. mes .@npcname$;
  181. mes "Well, no one's forcing you.";
  182. mes "Do whatever you like to do.";
  183. mes "I'll cancel the mission then.";
  184. erasequest .daily_hunting_questid[.@index];
  185. close;
  186. }
  187. }
  188. } else {
  189. if(.@playtime == 0 || .@playtime == 1){
  190. mes .@npcname$;
  191. mes "The rule is set here so that you're only allowed to complete one mission each day.";
  192. mes "I would like you to come back when the waiting time is over.";
  193. close;
  194. } else if(.@playtime == 2){
  195. erasequest .daily_delay_questid[.@index];
  196. mes .@npcname$;
  197. mes "I have confirmed that the waiting time for this mission is over.";
  198. mes "I'll delete the records used for confirmation.";
  199. mes "Now, give it a try to complete the quest!";
  200. close;
  201. } else {
  202. mes .@npcname$;
  203. mes "This is the " + .ordinal$[.@sel] + " mission in " + .region$[.@zoneid] + ".";
  204. brief(.daily_hunting_questid[.@index]);
  205. next;
  206. mes .@npcname$;
  207. if(mob_brief(.daily_hunting_questid[.@index]))
  208. mes "I'll reward you accordingly upon completing this mission.";
  209. else
  210. mes "I'll give you experience points in return.";
  211. next;
  212. if(select("Accept it.","Reject it.") == 1){
  213. mes .@npcname$;
  214. mes "Entrance to the guild dungeon is restricted. But it's not like you can't find a way to go there, either.";
  215. mes "I'll pray for your success in fighting those monsters.";
  216. setquest .daily_hunting_questid[.@index];
  217. close;
  218. } else {
  219. mes .@npcname$;
  220. mes "Well, do as you wish.";
  221. close;
  222. }
  223. }
  224. }
  225. break;
  226. case 3: // About quests
  227. mes .@npcname$;
  228. mes "It's not difficult at all.";
  229. mes "I give a reward ^4d4dffdepending on how many fortresses you have conquered.^000000";
  230. mes "^4d4dffThe type and quality of the reward depend on the number of conquered fortresses at the very moment I check.^000000";
  231. next;
  232. mes .@npcname$;
  233. mes "And of course, I check during the siege hours only.";
  234. mes "^4d4dffReceiving a reward is followed by an hour of waiting time. So you'd better figure out the right timing as well.^000000";
  235. next;
  236. mes .@npcname$;
  237. mes "If you are a master of a guild that is currently participating in siege battles, you should give it a try.";
  238. next;
  239. mes .@npcname$;
  240. mes "Guild dungeon daily quests consist of combat quests that you can complete in guild dungeons.";
  241. mes "It's simple.";
  242. close;
  243. case 4: // I don't need it.
  244. mes .@npcname$;
  245. mes "You're really something else~!";
  246. close;
  247. }
  248. end;
  249. OnInit:
  250. setarray .castle$[0],
  251. "prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
  252. "payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
  253. "gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
  254. "aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
  255. "arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
  256. "schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05",
  257. "te_aldecas1","te_aldecas2","te_aldecas3","te_aldecas4","te_aldecas5",
  258. "te_prtcas01","te_prtcas02","te_prtcas03","te_prtcas04","te_prtcas05";
  259. setarray .npcname$[0],
  260. "[Altir]","[Alshine]","[Denev]","[Tarazed]","[Mirah]","[Almark]","[Becrux]","[Acrux]";
  261. setarray .region$[0],
  262. "Valkyrie Realm","Greenwood Lake","Britoria","Luina","Valfreyja","Nidhoggur","Kafragarten","Gloria";
  263. setarray .weekday[0], // Day of the week. 0 = Sunday, 6 = Saturday.
  264. 0,0,0,0,0,0,6,6;
  265. setarray .start_time[0],
  266. 2200,2200,2200,2200,2200,2200,2200,2200;
  267. setarray .end_time[0],
  268. 2230,2230,2230,2230,2230,2230,2230,2230;
  269. setarray .conquer_delay_questid[0], // Quest ID for cooldowns
  270. 7517,7520,7519,7518,7522,7521,7524,7523;
  271. setarray .level_req[0], // Level requirement for quests. There are 2-3 quests per region
  272. 100,120,120, //prt
  273. 100,120,120, //pay
  274. 100,120,120, //gef
  275. 100,120,120, //alde
  276. 90,90,0, //aru
  277. 90,90,0, //sch
  278. 70,70,0, //tealde
  279. 70,70,0; //teprt
  280. setarray .max_level[0], // Exp increase cap for quests. 0 for unlimited/not exist
  281. 130,140,0, //prt
  282. 130,140,0, //pay
  283. 130,140,0, //gef
  284. 130,140,0, //alde
  285. 120,120,0, //aru
  286. 120,120,0, //sch
  287. 99,99,0, //tealde
  288. 99,99,0; //teprt
  289. setarray .daily_hunting_questid[0], //Quest ID for daily quests.
  290. 7525,7526,7527, //prt
  291. 7534,7535,7536, //pay
  292. 7531,7532,7533, //gef
  293. 7528,7529,7530, //alde
  294. 7539,7540,0, //aru
  295. 7537,7538,0, //sch
  296. 7561,7562,0, //tealde
  297. 7541,7542,0; //teprt
  298. setarray .daily_delay_questid[0], //Quest ID for mob hunting check.
  299. 7543,7544,7545, //prt
  300. 7552,7553,7554, //pay
  301. 7549,7550,7551, //gef
  302. 7546,7547,7548, //alde
  303. 7557,7558,0, //aru
  304. 7555,7556,0, //sch
  305. 7563,7564,0, //tealde
  306. 7559,7560,0; //teprt
  307. setarray .ordinal$[0],"first","second","third";
  308. end;
  309. function brief {
  310. switch(getarg(0)){
  311. case 7527:
  312. case 7530:
  313. case 7533:
  314. case 7536:
  315. mes "It is to deal with the powerful creatures that appear in the Corridor of the Abyss.";
  316. break;
  317. default:
  318. mes "It is to eliminate the monsters that appear in the guild dungeon.";
  319. break;
  320. }
  321. return;
  322. }
  323. function mob_brief {
  324. switch(getarg(0)){
  325. case 7525:
  326. mes "You should hunt 50 or more Caterpillars and Creamy Fear monsters..";
  327. break;
  328. case 7526:
  329. mes "Hunt down 30 or more of all 3 types of Abyss Kobolds.";
  330. break;
  331. case 7527:
  332. mes "^4d4dffYou should kill furious 'Pyuriel' and warrior 'Lora'.^000000";
  333. return 1;
  334. case 7528:
  335. mes "^4d4dffHunt 50 or more of Giant Hornets and Ancient Worms, respectively.^000000";
  336. break;
  337. case 7529:
  338. mes "^4d4dffHunt 40 or more of Killer Mantises and 50 or more of Angra Mantises.^000000";
  339. break;
  340. case 7530:
  341. mes "They are ^4d4dff'Elvira' and 'Gioia,' which is a strange mechanical creature of heroes' tears.^000000";
  342. return 1;
  343. case 7531:
  344. mes "^4d4dffHunt 50 or more Zombie Masters and Wraith Deads, respectively.^000000";
  345. break;
  346. case 7532:
  347. mes "^4d4dffHunt 50 GLD_DARK_SHADOW, 20 GLD_DARK_FRAME, and 20 GLD_DARK_PRIEST monsters.^000000";
  348. break;
  349. case 7533:
  350. mes "They are ^4d4dff'Kades' and 'Rudo' who wander around the dead's hill.^000000";
  351. return 1;
  352. case 7534:
  353. mes "^4d4dffHunt 50 or more Gullinbursti and Leib Olmai, respectively.^000000";
  354. break;
  355. case 7535:
  356. mes "^4d4dffHunt 45 or more Skeleton General, 20 or more Am Mut and 25 or more Gajomart, respectively.^000000";
  357. break;
  358. case 7536:
  359. mes "^4d4dffThey are Old Empire's General 'Daehyon' and Guard 'Soheon'.^000000";
  360. return 1;
  361. case 7537:
  362. mes "^4d4dffHunt 50 or more Hell Apocalypse and Zakudam, respectively.^000000";
  363. break;
  364. case 7538:
  365. mes "^4d4dffHunt 35 or more Heavy Metaling and Cobalt Mineral, respectively.^000000";
  366. break;
  367. case 7539:
  368. mes "^4d4dffHunt more than 50 Banshee Masters and 30 Beholder Masters.^000000";
  369. break;
  370. case 7540:
  371. mes "^4d4dffHunt 50 Aunoes, and 20 Fanats.^000000";
  372. break;
  373. case 7541:
  374. mes "^4d4dffHunt 30 or more Knight, Blacksmith, Assassin, respectively.^000000";
  375. break;
  376. case 7542:
  377. mes "^4d4dffHunt 30 or more Wizard, Priest, Hunter respectively.^000000";
  378. break;
  379. case 7561:
  380. mes "^4d4dffHunt 30 or more, Crusader, Rogue, Alchemist, respectively.^000000";
  381. break;
  382. case 7562:
  383. mes "^4d4dffHunt 30 or more Sage, Monk, Bard, respectively.^000000";
  384. break;
  385. }
  386. return 0;
  387. }
  388. function calcexp {
  389. .@zoneid = getarg(0);
  390. .@index = getarg(1);
  391. .@maxlevel = .max_level[.@index];
  392. .@isboss = (.@zoneid < 4 && !((.@index+1)%3));
  393. if(!.@isboss && BaseLevel > .@maxlevel){
  394. return 1000 * (100 + ((.@maxlevel - 100) * 3));
  395. } else {
  396. return 1000 * (100 + ((BaseLevel - 100) * 3)) * (1 + .@isboss);
  397. }
  398. }
  399. function calcjobexp {
  400. .@edition = getarg(0);
  401. if(.@edition == 3){
  402. if(jobcanentermap("te_prtcas01")){
  403. if (JobLevel > 50)
  404. return 1000 * (50 + ((JobLevel - 50) * 3));
  405. else
  406. return 5000;
  407. } else {
  408. debugmes "Unexpected case for Job: " + Class + "(" + jobname(Class) + ") for gld_mission#core::calcjobexp";
  409. return 0;
  410. }
  411. } else if(.@edition == 2 ) {
  412. if(JobLevel > 50)
  413. return 1000 * (50 + ((JobLevel - 50) * 3));
  414. else
  415. return 3000;
  416. } else {
  417. return 5000 * JobLevel;
  418. }
  419. return 0;
  420. }
  421. }