dts_warper.txt 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965
  1. //===== eAthena Script =======================================
  2. //= Dungeon Teleport Service
  3. //===== By: ==================================================
  4. //= Evera
  5. //===== Current Version: =====================================
  6. //= 2.3a
  7. //===== Compatible With: =====================================
  8. //= eAthena
  9. //===== Description: =========================================
  10. //= Cool Event Corp NPCs vs. Kafra Dungeon Teleport Service and voting system.
  11. //= This is a special event on official servers where there's a
  12. //= big competition between Kafra Corp. and Cool Event Corp.
  13. //= To warp to selected levels of certain dungeons.
  14. //= Also includes Cool Event Corp HQ NPCs.
  15. //===== Variables: ===========================================
  16. //=Server - $dtsvote = Variable for # of votes
  17. //= = Positive = Cool Corp winning
  18. //= = Negative = Kafra Corp winning
  19. //= $dts = Variable for DTS status
  20. //= = (1<<0) Election
  21. //= = (1<<1) Cool Corp Enabled
  22. //= = (1<<2) Kafra Enabled
  23. //= = (1<<3) No winner last election
  24. //= = (1<<4) Cool Corp won last election
  25. //= = (1<<5) Kafra won last election
  26. //= $dtsday = Week count for dts vote count, used for resetting players' votes
  27. //=Character - dtseligible = eligibility status, 0 not eligible yet, 1 eligible.
  28. //= = $dtsday used when MISC_QUEST|128, and signifies that person already voted.
  29. //= MISC_QUEST = |128 = eligible and voted.
  30. //=NPC Func. - arg(0) = 0, Cool Event Corp Voting Staff; 1, Kafra Corp Voting Staff
  31. //= arg(1) = Kafra only, Cool Corp script does not use. Changes illus for different sprites.
  32. //= = 0 = 4_f_kafra6 (yellow ponytail, classic outfit, spr 112)
  33. //= = 1 = 4_f_kafra5 (pink hair, classic outfit, spr 113)
  34. //= = 2 = 4_f_kafra4 (orange short hair, classic outfit, spr 114)
  35. //= = 3 = 4_f_kafra3 (brown bangs, classic outfit, spr 115)
  36. //= = 4 = 4_f_kafra2 (brown ponytale, classic outfit, spr 116)
  37. //= = 5 = 4_f_kafra1 (blue hair, classic outfit, spr 117)
  38. //= = 6 = 4_f_agentkafra (purp hair, black outfit, spr 859)
  39. //= = 7 = 4_f_kafra8 (blue hair, brown outfit, spr 860)
  40. //= = 8 = 4_f_kafra9 (red hair, brown outfit, spr 861)
  41. //=Temporary - @dtstemp = Temporary buffer, used in GM vote-fixing
  42. //= @dtstemps$ = Temporary buffer, like above, but a string.
  43. //= $@dtstempg = Temporary buffer, but global
  44. //===== Additional Comments: =================================
  45. //= Some unofficial translations, some unofficial dungeon warps
  46. //= Also includes unofficial GM-enabled tweaking for script
  47. //= Includes NPCs in Cool Event Corp headquarters
  48. //= If new locations are found of this NPC, please report on forums
  49. //= http://www.eathena.ws/board/index.php?showforum=106
  50. //= Base level 60 required to vote
  51. //===== Version History: ====================================
  52. //= 1.0 Initial release [Evera]
  53. //= 1.1 SVN release, removed from major town (found true info after research),
  54. //= put more arg(2) parameters, fixed a few bugs [Evera]
  55. //= 1.2 Mushed some variables together, optimized a bit [Evera]
  56. //= 1.3 Removed selfconfig [Evera]
  57. //= 1.4 Changed global variables to read from 3 global variables, updated names,
  58. //= fixed array bug [Evera]
  59. //= 1.5 Mushed voting varialbes into 1 variable. [Evera]
  60. //= 1.6 Removed Duplicates [Silent]
  61. //= 1.7 Fixed bug of DTS_Admin not running by itself [Evera]
  62. //= 1.8 Changed requirement to lvl 60 [Evera]
  63. //= 1.9 Removed global eligibility option [Evera]
  64. //= 2.0 Fixed zeny bug [Evera]
  65. //= 2.1 Fixed headers with and updated with newer information [Evera]
  66. //= 2.2 Changed dtseligible 2 to MISC_QUEST|128, to clean up variable usage. [Evera]
  67. //= Also added F_ClearGarbage function to the scripts. [Evera]
  68. //= 2.3 Changed dtseligible to be $dtsday when MISC_QUEST|128
  69. //= Added $dtsday for vote session counter
  70. //= Fixed bug that involved having both warpers enabled at the same time. [Evera]
  71. //= New $dtsday system and bug fix[Evera]
  72. //= 2.3a fixed 2 bugs with comparision [Lupus]
  73. //============================================================
  74. //Yuno
  75. yuno.gat,153,191,4 script Cool Event Voting Staff::CoolEventVotingStaff01 874,{
  76. callfunc "F_DTS_Warp",0,0;
  77. }
  78. yuno.gat,162,191,6 script Kafra Voting Staff#01 861,{
  79. callfunc "F_DTS_Warp",1,8;
  80. }
  81. //Lighthalzen
  82. lighthalzen.gat,154,60,6 script Cool Event Voting Staff::CoolEventVotingStaff02 874,{
  83. callfunc "F_DTS_Warp",0,0;
  84. }
  85. //Prontera
  86. prontera.gat,147,125,4 script Cool Event Voting Staff::CoolEventVotingStaff03 874,{
  87. callfunc "F_DTS_Warp",0,0;
  88. }
  89. prontera.gat,164,125,6 script Kafra Voting Staff#02 115,{
  90. callfunc "F_DTS_Warp",1,3;
  91. }
  92. //Cool Event Staff Headquarters NPCs
  93. //Kudiuu (Maintenance Guy)
  94. lhz_in02.gat,20,274,6 script Maintenance Guy 851,{
  95. mes "[Kudiuu]";
  96. mes "Holy...!";
  97. mes "Will this place";
  98. mes "ever get cleaned up?!";
  99. mes "*Cough cough* There's";
  100. mes "so much dust here, it's";
  101. mes "almost a health hazard!";
  102. close;
  103. }
  104. //Cesuna (Zondaman at desk)
  105. lhz_in02.gat,36,284,1 script Cool Event Staff#01 874,{
  106. mes "[Cesuna]";
  107. mes "Ack! I'm totally";
  108. mes "swamped with all this";
  109. mes "work! But I don't wannna";
  110. mes "do any of it. That's it!";
  111. mes "I totally need a break";
  112. next;
  113. mes "[Cesuna]";
  114. mes "*Sigh...*";
  115. mes "I wonder if Saera";
  116. mes "would ever consider";
  117. mes "going out with me?";
  118. mes "That would be nice~";
  119. close;
  120. }
  121. //Jellarin (Event planner)
  122. lhz_in02.gat,40,279,3 script Event Planner 833,{
  123. mes "[Jellarin]";
  124. mes "I don't like this.";
  125. mes "But I don't like that";
  126. mes "idea either. What will";
  127. mes "I do for a new event, eh?";
  128. next;
  129. mes "[Jellarin]";
  130. mes "I need something";
  131. mes "major, something that'll";
  132. mes "really shake up the world,";
  133. mes "something epochal, but what?";
  134. mes "Hey, do you have any ideas";
  135. close;
  136. }
  137. //Baoto (Cool Event Manager)
  138. lhz_in02.gat,110,283,5 script Cool Event Manager 853,{
  139. mes "[Baoto]";
  140. mes "Hmmm...";
  141. mes "The employees seem";
  142. mes "to be having too much";
  143. mes "fun amongst themselves";
  144. mes "recently. This does not";
  145. mes "bode well at all...";
  146. next;
  147. mes "[Baoto]";
  148. mes "It looks like I'm";
  149. mes "just going to have to";
  150. mes "start cracking that whip";
  151. mes "more often and much";
  152. mes "harder. Ha ha ha ha!";
  153. close;
  154. }
  155. //Saera (Secretary), contains GM menu
  156. lhz_in02.gat,36,274,3 script Cool Event Staff#02 831,{
  157. callfunc "F_ClearGarbage"; //Clear outdated, unused variables
  158. if($dts == 0){
  159. set $dts,$dts|(1<<0); //Sets NPCs to election mode if first time running
  160. set $dts,$dts|(1<<3);
  161. }
  162. if($dts&(1<<1) && $dts&(1<<2) || $dts&(1<<0) && $dts&(1<<1) || $dts&(1<<0) && $dts&(1<<2)){
  163. if($dts&(1<<0)) set $dts,$dts&~(1<<0);
  164. if($dts&(1<<1)) set $dts,$dts&~(1<<1);
  165. if($dts&(1<<2)) set $dts,$dts&~(1<<2);
  166. set $dts,$dts|(1<<0);
  167. }
  168. if($dts&(1<<4) && $dts&(1<<5) || $dts&(1<<3) && $dts&(1<<4) || $dts&(1<<3) && $dts&(1<<5)){
  169. if($dts&(1<<3)) set $dts,$dts&~(1<<3);
  170. if($dts&(1<<4)) set $dts,$dts&~(1<<4);
  171. if($dts&(1<<5)) set $dts,$dts&~(1<<5);
  172. set $dts,$dts|(1<<3);
  173. }
  174. mes "[Saera]";
  175. mes "Welcome to the";
  176. mes "temporary headquarters";
  177. mes "of Cool Event Corporation";
  178. mes "How may I help you today?";
  179. next;
  180. if(getgmlevel()>=40){ //Unofficial Text, GM-configurable settings for Event (GM level above 40 required)
  181. mes "[Saera]";
  182. mes "Why, I didn't even";
  183. mes "notice you there,";
  184. mes strcharinfo(0)+". What would";
  185. mes "you like to do today?";
  186. next;
  187. menu "Fix Vote",Lfixvote,
  188. "Set current teleporter",Lsettele,
  189. "Set last election winner",Lsetlast,
  190. "Manually run vote check",Lmanuvotecheck,
  191. "Normal menu please",-;
  192. mes "[Saera]";
  193. mes "Ok";
  194. next;
  195. }
  196. menu "Temporary headquarters?",Ltemphead,
  197. "Voting",Lvoting,"No, thanks.",Lnothx;
  198. Ltemphead:
  199. mes "[Saera]";
  200. mes "Our headquarters building";
  201. mes "is currently undergoing";
  202. mes "reconstruction, so we are";
  203. mes "basing our operations in";
  204. mes "this place for the meantime";
  205. close;
  206. Lvoting:
  207. mes "[Saera]";
  208. mes "Currently, Kafra Corporation";
  209. mes "and Cool Event Corp are working";
  210. mes "on a collaborative program that";
  211. mes "will provide direct teleport";
  212. mes "services to dungeons.";
  213. next;
  214. mes "[Saera]";
  215. mes "Due to technical issues,";
  216. mes "both companies cannot provide";
  217. mes "teleport services to the same";
  218. mes "dungeon. Therefore, we will be";
  219. mes "selecting our valued customers";
  220. mes "to choose the company they want.";
  221. next;
  222. if((dtseligible == 0 || dtseligible == 3) && baselevel >= 60 && MISC_QUEST&128 == 0) set dtseligible,1;
  223. //Clear previous var of dtseligible,3 being tried for eligibility already
  224. if(dtseligible != $dtsday && baselevel >= 60 && MISC_QUEST&128){
  225. set MISC_QUEST,MISC_QUEST&~128;
  226. set dtseligible,1;
  227. }
  228. switch(dtseligible){
  229. default:
  230. mes "[Saera]";
  231. mes "Only a limited number of";
  232. mes "voters will be chosen, so";
  233. mes "you can check your voting";
  234. mes "eligibility at the headquarters";
  235. mes "of both participating companies.";
  236. mes "Thank you for your patronage~";
  237. close;
  238. break;
  239. case 1:
  240. mes "[Saera]";
  241. mes "It appears that you are";
  242. mes "eligible to vote";
  243. mes "so please cast your";
  244. mes "vote at any Voting Staff";
  245. mes "representative. Thank you~";
  246. close;
  247. break;
  248. case 2:
  249. mes "[Saera]";
  250. mes "You are eligible to vote, but";
  251. mes "you have already voted. Thank";
  252. mes "you for your participation";
  253. close;
  254. break;
  255. }
  256. Lnothx:
  257. mes "[Saera]";
  258. mes "Thank you.";
  259. mes "Have a good day.";
  260. close;
  261. //GM options start
  262. Lfixvote: //Fix Vote
  263. mes "[Saera]";
  264. mes "Umm, sure..";
  265. if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
  266. if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
  267. if($dtsv == 0) mes "The vote is currently tied.";
  268. mes "To who would you like to give votes to?";
  269. next;
  270. menu "Kafra",-,"Cool Event Corp",Lfixcool;
  271. Lfixkafra: //Fixing vote for Kafra
  272. mes "[Saera]";
  273. if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
  274. if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes."; //multiplied by -1 because var is negative
  275. if($dtsv == 0) mes "The vote is currently tied.";
  276. mes "Please input the amount you wish to give to Kafra Corp";
  277. input @dtstemp; //Set buffer for Kafra vote
  278. next;
  279. mes "[Saera]";
  280. mes "You inputted "+@dtstemp+" for Kafra";
  281. if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
  282. if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
  283. if($dtsv == 0) mes "The vote is currently tied.";
  284. mes "Are you sure you would like to";
  285. mes "make these changes?";
  286. next;
  287. menu "Yes",-,"No",Lnothx;
  288. set $dtsv,$dtsv-@dtstemp; //Set buffer to Kafra vote
  289. mes "[Saera]";
  290. mes "Okay, you fixed the vote";
  291. mes "of Kafra Corp.";
  292. if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
  293. if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
  294. if($dtsv == 0) mes "The vote is currently tied.";
  295. close;
  296. Lfixcool: //Fixing vote for cool corp
  297. mes "[Saera]";
  298. mes "Let me find the papers...";
  299. if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
  300. if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
  301. if($dtsv == 0) mes "The vote is currently tied.";
  302. mes "Please input new vote for Cool Event Corp";
  303. input @dtstemp; //Set buffer for Cool vote
  304. next;
  305. mes "[Saera]";
  306. mes "You inputted "+@dtstemp+" for Cool Event Corp";
  307. if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
  308. if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
  309. if($dtsv == 0) mes "The vote is currently tied.";
  310. mes "Are you sure you would like to";
  311. mes "make these changes?";
  312. next;
  313. menu "Yes",-,"No",Lnothx; //Confirmaiton
  314. set $dtsv,@dtsv+@dtstemp; //Set buffer to Cool vote
  315. mes "[Saera]";
  316. mes "Okay, you fixed the vote";
  317. mes "of Cool Event Corp.";
  318. if($dtsv > 0) mes "Cool Event Corp is currently winning by "+$dtsv+" votes.";
  319. if($dtsv < 0) mes "Kafra Corp is currently winning by "+$dtsv*-1+" votes.";
  320. if($dtsv == 0) mes "The vote is currently tied.";
  321. close;
  322. Lsettele: //Set current DTS tele
  323. mes "[Saera]";
  324. mes "Type Kafra for Kafra-enabled warp,";
  325. mes "Cool for Cool Event Corp-enabled";
  326. mes "warp ,Election for election mode,";
  327. mes "or Cancel to cancel.";
  328. if($dts&(1<<0)) mes "The election is currently in election mode.";
  329. if($dts&(1<<1)) mes "Cool Event Corp is currently the DTS warper.";
  330. if($dts&(1<<2)) mes "Kafra Corp is currently the DTS warper.";
  331. next;
  332. input @dtstemps$; //Typed in choices to prevent mistakes
  333. mes "Let me find the papers...";
  334. next;
  335. if(@dtstemps$ == "Election" || @dtstemps$ == "election"){
  336. if($dts&(1<<1)){
  337. set $dts,$dts&~(1<<1); //Removes previous winner
  338. set $dts,$dts|(1<<0); //Changes status to election
  339. }
  340. if($dts&(1<<2)){
  341. set $dts,$dts&~(1<<2);
  342. set $dts,$dts|(1<<0);
  343. }
  344. mes "[Saera]";
  345. mes "Set to election mode.";
  346. close;
  347. }
  348. if(@dtstemps$ == "Cool" || @dtstemps$ == "cool"){
  349. if($dts&(1<<0)){
  350. set $dts,$dts&~(1<<0);
  351. set $dts,$dts|(1<<1);
  352. }
  353. if($dts&(1<<2)){
  354. set $dts,$dts&~(1<<2);
  355. set $dts,$dts|(1<<1);
  356. }
  357. mes "[Saera]";
  358. mes "Cool Event Corp. is now the DTS warper.";
  359. close;
  360. }
  361. if(@dtstemps$ == "Kafra" || @dtstemps$ == "kafra"){
  362. if($dts&(1<<1)){
  363. set $dts,$dts&~(1<<1);
  364. set $dts,$dts|(1<<2);
  365. }
  366. if($dts&(1<<0)){
  367. set $dts,$dts&~(1<<0);
  368. set $dts,$dts|(1<<2);
  369. }
  370. mes "[Saera]";
  371. mes "Kafra Corp. is now the DTS warper.";
  372. close;
  373. }
  374. if(@dtstemps$ == "Cancel" || @dtstemps$ == "cancel") goto Lnothx;
  375. mes "[Saera]";
  376. mes "Please input a correct name for the election";
  377. next;
  378. goto Lsettele;
  379. Lsetlast: //Set last winner
  380. mes "[Saera]";
  381. mes "Type Kafra for election records to show Kafra,";
  382. mes "Cool for Cool for election records to show Cool Event Corp,";
  383. mes "None for no winner in election records,";
  384. mes "or Cancel to cancel.";
  385. if($dts&(1<<3)) mes "There was no previous winner";
  386. if($dts&(1<<4)) mes "Cool Event Corp was the last winner";
  387. if($dts&(1<<5)) mes "Kafra Corp was the last winner";
  388. next;
  389. input @dtstemps$;
  390. mes "[Saera]";
  391. mes "Let me find the papers...";
  392. next;
  393. if(@dtstemps$ == "None" || @dtstemps$ == "none"){
  394. if($dts&(1<<4)){
  395. set $dts,$dts&~(1<<4); //removes last winner
  396. set $dts,$dts|(1<<3); //sets current last winner
  397. }
  398. if($dts&(1<<5)){
  399. set $dts,$dts&~(1<<5);
  400. set $dts,$dts|(1<<3);
  401. }
  402. mes "[Saera]";
  403. mes "Set records to show no previous winner.";
  404. close;
  405. }
  406. if(@dtstemps$ == "Cool" || @dtstemps$ == "cool"){
  407. if($dts&(1<<3)){
  408. set $dts,$dts&~(1<<3);
  409. set $dts,$dts|(1<<4);
  410. }
  411. if($dts&(1<<5)){
  412. set $dts,$dts&~(1<<5);
  413. set $dts,$dts|(1<<4);
  414. }
  415. mes "[Saera]";
  416. mes "Cool Event Corp. is now the previous winner.";
  417. close;
  418. }
  419. if(@dtstemps$ == "Kafra" || @dtstemps$ == "kafra"){
  420. if($dts&(1<<3)){
  421. set $dts,$dts&~(1<<3);
  422. set $dts,$dts|(1<<5);
  423. }
  424. if($dts&(1<<4)){
  425. set $dts,$dts&~(1<<4);
  426. set $dts,$dts|(1<<5);
  427. }
  428. mes "[Saera]";
  429. mes "Kafra Corp. is now the previous winner.";
  430. close;
  431. }
  432. if(@dtstemps$ == "Cancel" || @dtstemps$ == "cancel") goto Lnothx;
  433. mes "[Saera]";
  434. mes "Please input a correct name";
  435. mes "for previous winner";
  436. next;
  437. goto Lsetlast;
  438. Lmanuvotecheck:
  439. mes "[Saera]";
  440. mes "Are you sure you would like to run";
  441. mes "the vote check again?";
  442. next;
  443. menu "Yes",Lmanuvoteyes,"No",Lnothx;
  444. Lmanuvoteyes:
  445. if($dtsday<4 || $dtsday>=100) set $dtsday,4;
  446. else set $dtsday,$dtsday+1;
  447. if($dts&(1<<1) && $dts&(1<<2) || $dts&(1<<0) && $dts&(1<<1) || $dts&(1<<0) && $dts&(1<<2)){
  448. if($dts&(1<<0)) set $dts,$dts&~(1<<0);
  449. if($dts&(1<<1)) set $dts,$dts&~(1<<1);
  450. if($dts&(1<<2)) set $dts,$dts&~(1<<2);
  451. set $dts,$dts|(1<<0);
  452. }
  453. if($dts&(1<<4) && $dts&(1<<5) || $dts&(1<<3) && $dts&(1<<4) || $dts&(1<<3) && $dts&(1<<5)){
  454. if($dts&(1<<3)) set $dts,$dts&~(1<<3);
  455. if($dts&(1<<4)) set $dts,$dts&~(1<<4);
  456. if($dts&(1<<5)) set $dts,$dts&~(1<<5);
  457. set $dts,$dts|(1<<3);
  458. }
  459. if($dtsv == 0){
  460. set $@dtstemp,rand(1,2);
  461. if($@dtstemp == 1) set $dtsv,$dtsv+100;
  462. else set $dtsv,$dtsv-100;
  463. }
  464. if($dtsv > 0){
  465. if($dts&(1<<3)) set $dts,$dts&~(1<<3); //removes last winner varialbes
  466. if($dts&(1<<4)) set $dts,$dts&~(1<<4);
  467. if($dts&(1<<5)) set $dts,$dts&~(1<<5);
  468. if($dts&(1<<0)){
  469. set $dts,$dts&~(1<<0); //removes winner variable
  470. set $dts,$dts|(1<<3); //sets last winner varialbe
  471. set $dts,$dts|(1<<1); //sets current winner variable
  472. }
  473. if($dts&(1<<1)) set $dts,$dts|(1<<4);
  474. if($dts&(1<<2)){
  475. set $dts,$dts&~(1<<2);
  476. set $dts,$dts|(1<<1);
  477. set $dts,$dts|(1<<5);
  478. }
  479. set $dtsv,0;
  480. }
  481. else{
  482. if($dts&(1<<3)) set $dts,$dts&~(1<<3);
  483. if($dts&(1<<4)) set $dts,$dts&~(1<<4);
  484. if($dts&(1<<5)) set $dts,$dts&~(1<<5);
  485. if($dts&(1<<0)){
  486. set $dts,$dts&~(1<<0);
  487. set $dts,$dts|(1<<2);
  488. set $dts,$dts|(1<<3);
  489. }
  490. if($dts&(1<<1)){
  491. set $dts,$dts&~(1<<1);
  492. set $dts,$dts|(1<<2);
  493. set $dts,$dts|(1<<4);
  494. }
  495. if($dts&(1<<2)) set $dts,$dts|(1<<5);
  496. set $dtsv,0;
  497. }
  498. mes "[Saera]";
  499. mes "Vote check run again.";
  500. if($dts&(1<<0)) mes "The election is currently in election mode.";
  501. if($dts&(1<<1)) mes "Cool Event Corp is currently the DTS warper.";
  502. if($dts&(1<<2)) mes "Kafra Corp is currently the DTS warper.";
  503. close;
  504. }
  505. //Function for Voting Staff NPC
  506. function script F_DTS_Warp {
  507. callfunc "F_ClearGarbage"; //Clear outdated, unused variables
  508. if($dts == 0){ //Sets NPCs to election mode if first time running
  509. set $dts,$dts|(1<<0);
  510. set $dts,$dts|(1<<3);
  511. }
  512. if((dtseligible == 0 || dtseligible == 3) && baselevel >= 60 && MISC_QUEST&128 == 0) set dtseligible,1; //Clear previous var of dtseligible,3 being tried for eligibility already
  513. if(dtseligible != $dtsday && baselevel >= 60 && MISC_QUEST&128){
  514. set MISC_QUEST,MISC_QUEST&~128;
  515. set dtseligible,1;
  516. }
  517. switch(getarg(0)){
  518. case 0:
  519. cutin "zonda_01",2;
  520. mes "[Cool Event Corp. Voting Staff]";
  521. mes "Hello! Don't forget to make";
  522. mes "your voice be heard and make";
  523. mes "sure you vote in the elections";
  524. mes "between Cool Event Corp. and";
  525. mes "Kafra Corporation for control of";
  526. mes "the Dungeon Teleport Service!";
  527. break;
  528. case 1:
  529. switch(getarg(1)){
  530. case 0: cutin "kafra_06",2; break; //Finding arguments to find which illust to use
  531. case 1: cutin "kafra_05",2; break; //Used Red hair "kafra_09" for black outfit kafra
  532. case 2: cutin "kafra_04",2; break; //because I couldn't find a suitable illust
  533. case 3: cutin "kafra_03",2; break;
  534. case 4: cutin "kafra_02",2; break;
  535. case 5: cutin "kafra_01",2; break;
  536. case 6: cutin "kafra_09",2; break;
  537. case 7: cutin "kafra_08",2; break;
  538. case 8: cutin "kafra_09",2; break;
  539. default: cutin "kafra_09",2; break;
  540. }
  541. mes "[Kafra Voting Staff]";
  542. mes "Greetings, adventurer.";
  543. mes "As you may be aware, we";
  544. mes "are holding an election to";
  545. mes "provide the Dungeon Teleport";
  546. mes "Service. How may I help you?";
  547. break;
  548. }
  549. next;
  550. menu "Reason for Election",Lelection,"Cast a Vote",Lvote,
  551. "Use Teleport Service",Lteleport,"Cancel",Lcancel;
  552. Lelection: //Reason for election explanation
  553. switch(getarg(0)){
  554. case 0:
  555. mes "[Cool Event Corp. Voting Staff]";
  556. mes "Cool Event Corp. has been";
  557. mes "planning to provide a new";
  558. mes "Dungeon Teleport Service to";
  559. mes "its customers, a service not";
  560. mes "already provided by the Kafra";
  561. mes "Corporation. However...";
  562. next;
  563. mes "[Cool Event Corp. Voting Staff]";
  564. mes "Kafra Corporation, which";
  565. mes "already monopolizes the";
  566. mes "public teleportation market,";
  567. mes "actually also had plans to";
  568. mes "provide a similar service.";
  569. next;
  570. mes "[Cool Event Corp. Voting Staff]";
  571. mes "Because of technological";
  572. mes "limitations, only one company";
  573. mes "can be chosen as the provider";
  574. mes "of this Dungeon Teleport Service.";
  575. mes "Hence, we will let the customers";
  576. mes "decide through these elections.";
  577. next;
  578. mes "[Cool Event Corp. Voting Staff]";
  579. mes "Multiple elections will be";
  580. mes "held so that our customers";
  581. mes "can test out the special services";
  582. mes "of each company for themselves.";
  583. mes "However, keep in mind that you";
  584. mes "must be eligible in order to vote.";
  585. next;
  586. mes "[Cool Event Corp. Voting Staff]";
  587. mes "For voter eligibility";
  588. mes "details, please visit our";
  589. mes "headquarters in the city of";
  590. mes "Lighthalzen located in the";
  591. mes "Schwaltzvalt Republic.";
  592. mes "Thank you for your time.";
  593. break;
  594. case 1:
  595. mes "[Kafra Voting Staff]";
  596. mes "Cool Event Corp and the";
  597. mes "Kafra Corporation have both";
  598. mes "been planning to provide a";
  599. mes "Teleport Service to dungeons.";
  600. next;
  601. mes "[Kafra Voting Staff]";
  602. mes "But due to technological";
  603. mes "limitations, only one company";
  604. mes "can serve as provider for this";
  605. mes "Dungeon Teleport Service at a";
  606. mes "time. There, both companies have";
  607. mes "agreed to hold special elections";
  608. next;
  609. mes "[Kafra Voting Staff]";
  610. mes "Each company has its own";
  611. mes "policies and guarantees in";
  612. mes "regards to the Dungeon Teleport";
  613. mes "Service, and in this election, the";
  614. mes "customers will ultimately decide";
  615. mes "and choose what's best for them.";
  616. next;
  617. mes "[Kafra Voting Staff]";
  618. mes "For now, the Dungeon";
  619. mes "Teleport Service will be";
  620. mes "provided in a series of trial";
  621. mes "periods. This way, customers can";
  622. mes "see the benefits of both companies";
  623. mes "before making the final decision";
  624. next;
  625. mes "[Kafra Voting Staff]";
  626. mes "If you are qualified,";
  627. mes "please vote in each election";
  628. mes "to decide which company will";
  629. mes "provide the Dungeon Teleport";
  630. mes "Service for the next trial period.";
  631. mes "Thank you for your support~";
  632. break;
  633. }
  634. goto Lend;
  635. Lvote: //If you clicked you wanted to vote
  636. if(dtseligible == 1) goto Leligible; //Var check if eligible
  637. Lnoteligible: //Text displayed if wanted to vote, but not eligible/voted
  638. switch(getarg(0)){
  639. case 0:
  640. mes "[Cool Event Corp. Voting Staff]";
  641. mes "I'm sorry, but you are not";
  642. mes "eligible to vote at this time.";
  643. mes "Please visit our headquarters";
  644. mes "in Lighthalzen for information";
  645. mes "related to acquiring voting";
  646. mes "rights. Thank you for your time.";
  647. break;
  648. case 1:
  649. mes "[Kafra Voting Staff]";
  650. mes "Oh, I'm so sorry, but you";
  651. mes "are currently not qualified to";
  652. mes "vote. For voting qualification";
  653. mes "information, please visit the";
  654. mes "Al De Baran Kafra Headquarters.";
  655. mes "Thank you and have a nice day.";
  656. break;
  657. }
  658. goto Lend;
  659. Leligible: //Text displayed if eligible to vote
  660. if(MISC_QUEST&128 && $dtsday == dtseligible) goto Lnoteligible; //Var check if voted
  661. switch(getarg(0)){
  662. case 0:
  663. mes "[Cool Event Corp. Voting Staff]"; //Unofficial text
  664. mes "Checking your credentials, you";
  665. mes "are able to vote for the";
  666. mes "Dungeon Teleport Service";
  667. mes "elections. Who would you like";
  668. mes "to vote for?";
  669. break;
  670. case 1:
  671. mes "[Kafra Voting Staff]";
  672. mes "It appears that you qualify";
  673. mes "to vote for the Dungeon";
  674. mes "Teleport Service elections.";
  675. mes "Who would you like to vote for"; //End Unofficial text
  676. break;
  677. }
  678. next;
  679. menu "Cool Event Corp.",Lvotecool,"Kafra Corp.",Lvotekafra;
  680. Lvotecool:
  681. set $dtsv,$dtsv+1; //Adds 1 to cool count
  682. set MISC_QUEST,MISC_QUEST|128; //Sets var so that you can't vote over and over
  683. set dtseligible,$dtsday;
  684. switch(getarg(0)){
  685. case 0:
  686. mes "[Cool Event Corp. Voting Staff]";
  687. mes "Thank you for voting for us.";
  688. mes "Your vote has been counted,";
  689. mes "and we appreciate your input";
  690. mes "Thank you and have a good day.";
  691. break;
  692. case 1:
  693. mes "[Kafra Voting Staff]";
  694. mes "We thank you for your vote.";
  695. mes "Your opinion matters very much";
  696. mes "and has been counted for Cool";
  697. mes "Event Corp.";
  698. break;
  699. }
  700. goto Lend;
  701. Lvotekafra:
  702. setd $dtsv,$dtsv-1; //Adds 1 to kafra count
  703. set MISC_QUEST,MISC_QUEST|128; //Sets var to prevent cheating
  704. set dtseligible,$dtsday;
  705. switch(getarg(0)){
  706. case 0:
  707. mes "[Cool Event Corp. Voting Staff]"; //Unofficial Text
  708. mes "Thank you for your opinion.";
  709. mes "Your vote for Kafra corp.";
  710. mes "has been counted. Thank";
  711. mes "you and have a good day.";
  712. break;
  713. case 1:
  714. mes "[Kafra Voting Staff]";
  715. mes "Your vote for us has been";
  716. mes "counted. We thank you very";
  717. mes "much for your input, and";
  718. mes "we hope that we meet your";
  719. mes "adventuring needs and";
  720. mes "standards of excellence.";
  721. break;
  722. }
  723. goto Lend; //End Unofficial text
  724. Lteleport: //Selected Teleport
  725. switch(getarg(0)){
  726. case 0:
  727. if($dts&(1<<0)){
  728. mes "[Cool Event Corp. Voting Staff]";
  729. mes "I'm sorry, but the";
  730. mes "Dungeon Teleport Service is";
  731. mes "unavailable during elections";
  732. mes "and will be reactivated after the";
  733. mes "election results are announced.";
  734. mes "Thank you and have a nice day.";
  735. goto Lend;
  736. }
  737. if($dts&(1<<1)) goto Lteleenabled;
  738. mes "[Cool Event Corp. Voting Staff]"; //Text if Kafra won DTS elect.
  739. mes "I'm sorry, but Cool Event";
  740. mes "Corp. does not currently offer";
  741. mes "the Dungeon Teleport Service";
  742. mes "due to the results of the last";
  743. mes "election. Please vote for us";
  744. mes "next time, alright? Good day~";
  745. break;
  746. case 1:
  747. if($dts&(1<<0)){
  748. mes "[Kafra Voting Staff]";
  749. mes "Sorry, but the elections for";
  750. mes "which Dungeon Teleport System";
  751. mes "to use is currently going on";
  752. mes "right now. We are unable to";
  753. mes "vote until results are announced";
  754. goto Lend;
  755. }
  756. if($dts&(1<<2)) goto Lteleenabled;
  757. mes "[Kafra Voting Staff]";
  758. mes "We're sorry, but Kafra Corp";
  759. mes "doesn't currently offer the";
  760. mes "Dungeon Teleport System due";
  761. mes "to last election's results,";
  762. mes "Please vote for Kafra Corp";
  763. mes "next time~";
  764. break;
  765. }
  766. goto Lend;
  767. Lteleenabled: //Shows DTS tele selections
  768. cleararray @dtswarpmap$[0],"",getarraysize(@dtswarpmap$);
  769. cleararray @dtswarp$[0],"",getarraysize(@dtswarp$);
  770. switch(getarg(0)){
  771. case 0:
  772. mes "[Cool Event Corp. Voting Staff]";
  773. mes "Please remember that we";
  774. mes "cannot accept Free Warp Tickets";
  775. mes "or award Special Reserve Points";
  776. mes "for this service. Now, please";
  777. mes "choose your destination.";
  778. setarray @dtswarpmap$[0],"Bailand, Level 4","Clock Tower, Basement 3";
  779. setarray @dtswarp$[0],@dtswarpmap$[0]+" -> 4,000z",
  780. @dtswarpmap$[1]+" -> 4,000z","Cancel";
  781. if($dts&(1<<4)){
  782. set @dtswarpmap$[2],"Glastheim Entrance";
  783. setarray @dtswarp$[2],@dtswarpmap$[2]+" -> 4,000z","Cancel";
  784. }
  785. break;
  786. case 1:
  787. mes "[Kafra Voting Staff]";
  788. mes "Thank you for choosing the";
  789. mes "Dungeon Teleport Service";
  790. mes "Please keep in mind that the";
  791. mes "Free Warp Tickets and Kafra";
  792. mes "Special Reserve Points do not";
  793. mes "apply in this special service.";
  794. setarray @dtswarpmap$[0],"Toy Factory, Level 2","Clock Tower, Level 3";
  795. setarray @dtswarp$[0],@dtswarpmap$[0]+" -> 4,000z",
  796. @dtswarpmap$[1]+" -> 4,000z","Cancel";
  797. if($dts&(1<<5)){
  798. set @dtswarpmap$[2],"Lava Dungeon, Level 2";
  799. setarray @dtswarp$[2],@dtswarpmap$[2]+" -> 4,000z","Cancel";
  800. }
  801. break;
  802. }
  803. next;
  804. switch(select(@dtswarp$[0],@dtswarp$[1],@dtswarp$[2],@dtswarp$[3])){
  805. case 1:
  806. set @num, 0;
  807. break;
  808. case 2:
  809. set @num, 1;
  810. break;
  811. case 3:
  812. set @num, 2;
  813. break;
  814. case 4:
  815. set @num, 3;
  816. break;
  817. }
  818. Lwarp:
  819. if (@dtswarp$[@num] == "Cancel") goto Lcancel;
  820. if (Zeny<4000) goto Lnomoney;
  821. set Zeny, Zeny-4000;
  822. if (@dtswarpmap$[@num] == "Toy Factory, Level 2") warp "xmas_dun02.gat",130,123;
  823. //Maps to warp to
  824. if (@dtswarpmap$[@num] == "Clock Tower, Level 3") warp "alde_dun03.gat",265,22;
  825. if (@dtswarpmap$[@num] == "Lava Dungeon, Level 2") warp "mag_dun02.gat",47,40;
  826. if (@dtswarpmap$[@num] == "Bailand, Level 4") warp "iz_dun03.gat",32,63;
  827. if (@dtswarpmap$[@num] == "Clock Tower, Basement 3") warp "alde_dun03.gat",277,178;
  828. if (@dtswarpmap$[@num] == "Glastheim Entrance") warp "glast_01.gat",375,304;
  829. cutin "", 255;
  830. end;
  831. Lnomoney:
  832. switch(getarg(0)){
  833. case 0:
  834. mes "[Cool Event Corp. Voting Staff]"; //Unofficial Text
  835. mes "Umm, apparently you don't have";
  836. mes "adequate funds for your";
  837. mes "selected warp. Please check";
  838. mes "that you have the correct amount";
  839. mes "of money, and try again later";
  840. break;
  841. case 1:
  842. mes "[Kafra Voting Staff]";
  843. mes "It appears as if you don't";
  844. mes "have enough zeny for the warp";
  845. mes "Please check your funds and";
  846. mes "try again.";
  847. break;
  848. }
  849. goto Lend; //End unofficial text
  850. Lcancel: //Selected Cancel on first menu
  851. switch(getarg(0)){
  852. case 0:
  853. mes "[Cool Event Corp. Voting Staff]";
  854. mes "Cool Event Corp. is always";
  855. mes "working to make sure that";
  856. mes "not only are our customers";
  857. mes "satisfied, but that we also";
  858. mes "exceed your utmost standards.";
  859. mes "Thank you and have a good day.";
  860. break;
  861. case 1:
  862. mes "[Kafra Voting Staff]";
  863. mes "We, here at Kafra Corporation,";
  864. mes "are alwyas endeavoring to provide";
  865. mes "you with the best services. We hope";
  866. mes "that we meet your adventuring needs";
  867. mes "and the standards of excellence.";
  868. break;
  869. }
  870. goto Lend;
  871. Lend:
  872. close2;
  873. cutin "", 255;
  874. end;
  875. }
  876. //Elections administration NPC (hidden)
  877. - script DTS_Admin -1,{
  878. OnSun0100: //Works only at 1am on sunday
  879. if($dtsday<4 || $dtsday>=100) set $dtsday,4;
  880. else set $dtsday,$dtsday+1;
  881. if($dts == 0){
  882. set $dts,$dts|(1<<0);
  883. set $dts,$dts|(1<<3);
  884. }
  885. if($dts&(1<<1) && $dts&(1<<2) || $dts&(1<<0) && $dts&(1<<1) || $dts&(1<<0) && $dts&(1<<2)){
  886. if($dts&(1<<0)) set $dts,$dts&~(1<<0);
  887. if($dts&(1<<1)) set $dts,$dts&~(1<<1);
  888. if($dts&(1<<2)) set $dts,$dts&~(1<<2);
  889. set $dts,$dts|(1<<0);
  890. }
  891. if($dts&(1<<4) && $dts&(1<<5) || $dts&(1<<3) && $dts&(1<<4) || $dts&(1<<3) && $dts&(1<<5)){
  892. if($dts&(1<<3)) set $dts,$dts&~(1<<3);
  893. if($dts&(1<<4)) set $dts,$dts&~(1<<4);
  894. if($dts&(1<<5)) set $dts,$dts&~(1<<5);
  895. set $dts,$dts|(1<<3);
  896. }
  897. if($dtsv == 0){ //If tied, gives random side 100 votes
  898. set $@dtstemp,rand(1,2);
  899. if($@dtstemp == 1) set $dtsv,$dtsv+100;
  900. else set $dtsv,$dtsv-100;
  901. }
  902. if($dtsv > 0){
  903. if($dts&(1<<3)) set $dts,$dts&~(1<<3);
  904. if($dts&(1<<4)) set $dts,$dts&~(1<<4);
  905. if($dts&(1<<5)) set $dts,$dts&~(1<<5);
  906. if($dts&(1<<0)){
  907. set $dts,$dts&~(1<<0);
  908. set $dts,$dts|(1<<1);
  909. set $dts,$dts|(1<<3);
  910. }
  911. if($dts&(1<<1)) set $dts,$dts|(1<<4);
  912. if($dts&(1<<2)){
  913. set $dts,$dts&~(1<<2);
  914. set $dts,$dts|(1<<1);
  915. set $dts,$dts|(1<<5);
  916. }
  917. set $dtsv,0;
  918. }
  919. else{
  920. if($dts&(1<<3)) set $dts,$dts&~(1<<3);
  921. if($dts&(1<<4)) set $dts,$dts&~(1<<4);
  922. if($dts&(1<<5)) set $dts,$dts&~(1<<5);
  923. if($dts&(1<<0)){
  924. set $dts,$dts&~(1<<0);
  925. set $dts,$dts|(1<<2);
  926. set $dts,$dts|(1<<3);
  927. }
  928. if($dts&(1<<1)){
  929. set $dts,$dts&~(1<<1);
  930. set $dts,$dts|(1<<2);
  931. set $dts,$dts|(1<<4);
  932. }
  933. if($dts&(1<<2)) set $dts,$dts|(1<<5);
  934. set $dtsv,0;
  935. }
  936. end;
  937. }