dts_warper.txt 32 KB

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