dts_warper.txt 32 KB

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