gldfunc_ev_agit.txt 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. //===== eAthena Script =======================================
  2. //= War of Emperium Guild Event AgitStart/AgitBreak Functions
  3. //===== By: ==================================================
  4. //= jAthena - kalen (1.0)
  5. //= 1.1 by Akaru, ho|yAnge|X, and Valaris
  6. //===== Current Version: =====================================
  7. //= 1.8
  8. //===== Compatible With: =====================================
  9. //= eAthena SVN; RO Episode 4+
  10. //===== Description: =========================================
  11. //= F_AgitStart is in charge of spawning Emperium and mobs in castles
  12. //= when WoE is started.
  13. //= F_AgitBreak resets guild castle data when a castle has been taken over.
  14. //= It then sets the data for the new guild master if there is one.
  15. //=======================================
  16. //= Break down of arguments used in F_AgitStart:
  17. //= arg(0): name of specific guild castle.
  18. //= arg(1): name of specific agit castle script.
  19. //= arg(2): x1 for Emperium coordinates.
  20. //= arg(3): y1 for Emperium coordinates.
  21. //= Break down of arguments used in F_AgitBreak:
  22. //= arg(0): name of specific guild castle.
  23. //= arg(1): name of specific OnRevCastle label.
  24. //===== Additional Comments: =================================
  25. //= v1.2: All OnAgitStart and OnAgitBreak calls will use these functions.[kobra_k88]
  26. //= v1.2a: Added OnAgitEnd function.[kobra_k88]
  27. //= 1.3 Added code for abandoning captured castles on /breakguild [Lupus]
  28. //= 1.3a fixed Defence / Economy underflow [Lupus] thanks2 kyoki
  29. //= 1.4 updated a couple mapannounces in OnAgitBreak. [L0ne_W0lf]
  30. //= 1.5 Changed the names of the Kafra from "Service" to "Staff" [L0ne_W0lf]
  31. //= 1.6 Fixed the OnAgitBreak message being map-only and not global. (Lil DomX) [L0ne_W0lf]
  32. //= 1.7 Updated functions, got rid of the various gotos. [L0ne_W0lf]
  33. //= Castles can be conquered as long as they un-owned.
  34. //= 1.8 Fixed Guardian data being overwritten when castle ownership changes. [L0ne_W0lf]
  35. // Data will only be saved for guardians if you have the Guaridan Research.
  36. // It works this way to deal with a bug on ownership change.
  37. //============================================================
  38. // Function for OnAgitStart =========================================
  39. function script F_AgitStart {
  40. set .@map$, getarg(0);
  41. set .@castle$, getarg(1);
  42. set .@empx, getarg(2);
  43. set .@empy, getarg(3);
  44. MapRespawnGuildID .@map$,GetCastleData(.@map$,1),2;
  45. monster .@map$,.@empx,.@empy,"Emperium",1288,1,"Agit_"+.@castle$+"::OnAgitBreak";
  46. GvgOn .@map$;
  47. if (GetCastleData(.@map$,1) != 0) return;
  48. if (compare(.@map$,"aldeg_cas")) {
  49. areamonster .@map$,0,0,300,300,"--ja--",1117,10;
  50. areamonster .@map$,0,0,300,300,"--ja--",1132,4;
  51. areamonster .@map$,0,0,300,300,"--ja--",1219,2;
  52. areamonster .@map$,0,0,300,300,"--ja--",1205,1;
  53. areamonster .@map$,0,0,300,300,"--ja--",1216,10;
  54. areamonster .@map$,0,0,300,300,"--ja--",1193,17;
  55. areamonster .@map$,0,0,300,300,"--ja--",1269,9;
  56. areamonster .@map$,0,0,300,300,"--ja--",1276,7;
  57. areamonster .@map$,0,0,300,300,"--ja--",1208,3;
  58. areamonster .@map$,0,0,300,300,"--ja--",1275,1;
  59. areamonster .@map$,0,0,300,300,"--ja--",1268,1;
  60. areamonster .@map$,0,0,300,300,"--ja--",1272,1;
  61. monster .@map$,.@empx+1,.@empy,"--ja--",1272,1;
  62. monster .@map$,.@empx-1,.@empy,"--ja--",1270,4;
  63. monster .@map$,.@empx,.@empy+1,"--ja--",1268,1;
  64. monster .@map$,.@empx,.@empy-1,"--ja--",1219,1;
  65. monster .@map$,.@empx,.@empy,"--ja--",1276,5;
  66. return;
  67. }
  68. else if (compare(.@map$,"gefg_cas")) {
  69. areamonster .@map$,0,0,300,300,"--ja--",1117,10;
  70. areamonster .@map$,0,0,300,300,"--ja--",1263,11;
  71. areamonster .@map$,0,0,300,300,"--ja--",1102,10;
  72. areamonster .@map$,0,0,300,300,"--ja--",1130,10;
  73. areamonster .@map$,0,0,300,300,"--ja--",1140,20;
  74. areamonster .@map$,0,0,300,300,"--ja--",1163,9;
  75. areamonster .@map$,0,0,300,300,"--ja--",1275,1;
  76. areamonster .@map$,0,0,300,300,"--ja--",1219,1;
  77. areamonster .@map$,0,0,300,300,"--ja--",1150,1;
  78. areamonster .@map$,0,0,300,300,"--ja--",1159,1;
  79. monster .@map$,.@empx+1,.@empy,"--ja--",1203,1;
  80. monster .@map$,.@empx-1,.@empy,"--ja--",1087,1;
  81. monster .@map$,.@empx,.@empy+1,"--ja--",1213,7;
  82. monster .@map$,.@empx,.@empy-1,"--ja--",1189,7;
  83. return;
  84. }
  85. else if (compare(.@map$,"payg_cas")) {
  86. areamonster .@map$,0,0,300,300,"--ja--",1277,10;
  87. areamonster .@map$,0,0,300,300,"--ja--",1208,10;
  88. areamonster .@map$,0,0,300,300,"--ja--",1262,5;
  89. areamonster .@map$,0,0,300,300,"--ja--",1102,5;
  90. areamonster .@map$,0,0,300,300,"--ja--",1150,1;
  91. areamonster .@map$,0,0,300,300,"--ja--",1115,1;
  92. areamonster .@map$,0,0,300,300,"--ja--",1129,11;
  93. areamonster .@map$,0,0,300,300,"--ja--",1276,5;
  94. areamonster .@map$,0,0,300,300,"--ja--",1282,4;
  95. areamonster .@map$,0,0,300,300,"--ja--",1253,5;
  96. monster .@map$,.@empx,.@empy,"--ja--",1150,1;
  97. monster .@map$,.@empx,.@empy,"--ja--",1115,1;
  98. monster .@map$,.@empx,.@empy+1,"--ja--",1208,6;
  99. monster .@map$,.@empx,.@empy-1,"--ja--",1276,5;
  100. return;
  101. }
  102. else if (compare(.@map$,"prtg_cas")) {
  103. areamonster .@map$,0,0,300,300,"--ja--",1163,15;
  104. areamonster .@map$,0,0,300,300,"--ja--",1132,10;
  105. areamonster .@map$,0,0,300,300,"--ja--",1219,5;
  106. areamonster .@map$,0,0,300,300,"--ja--",1268,5;
  107. areamonster .@map$,0,0,300,300,"--ja--",1251,1;
  108. areamonster .@map$,0,0,300,300,"--ja--",1252,1;
  109. areamonster .@map$,0,0,300,300,"--ja--",1276,5;
  110. areamonster .@map$,0,0,300,300,"--ja--",1259,1;
  111. areamonster .@map$,0,0,300,300,"--ja--",1283,1;
  112. areamonster .@map$,0,0,300,300,"--ja--",1275,1;
  113. areamonster .@map$,0,0,300,300,"--ja--",1200,1;
  114. monster .@map$,.@empx+1,.@empy,"--ja--",1268,1;
  115. monster .@map$,.@empx-1,.@empy,"--ja--",1251,1;
  116. monster .@map$,.@empx,.@empy+1,"--ja--",1252,1;
  117. monster .@map$,.@empx,.@empy-1,"--ja--",1219,2;
  118. monster .@map$,.@empx,.@empy,"--ja--",1276,5;
  119. return;
  120. }
  121. }
  122. // Function for OnGuildBreak ======================================
  123. function script F_GuildBreak {
  124. set .@map$, getarg(0);
  125. set .@castle$, getarg(1);
  126. killmonsterall .@map$;
  127. Announce "Guild Base [" + GetCastleName(.@map$) + "] has been abandoned.",0;
  128. disablenpc "Kafra Staff#"+.@castle$;
  129. SetCastleData .@map$,0,0;
  130. return;
  131. }
  132. // Function for OnAgitBreak ======================================
  133. function script F_AgitBreak {
  134. set .@map$, getarg(0);
  135. set .@castle$, getarg(1);
  136. set .@GID,getcharid(2);
  137. if (.@GID <= 0) return;
  138. set .@Economy,GetCastleData(.@map$,2) - 5;
  139. if (.@Economy < 0) set .@Economy, 0;
  140. SetCastleData .@map$, 2, .@Economy;
  141. set .@Defence,GetCastleData(.@map$,3) - 5;
  142. if (.@Defence < 0) set .@Defence, 0;
  143. SetCastleData .@map$, 3, .@Defence;
  144. SetCastleData .@map$,1, .@GID;
  145. MapAnnounce .@map$,"The emperium has been destroyed.",bc_map,0x00CCFF;
  146. Announce "The [" + GetCastleName(.@map$) + "] castle has been conquered by the [" + GetGuildName(.@GID) + "] guild.",bc_all;
  147. GetCastleData .@map$,0,"::OnRecvCastle"+.@castle$;
  148. disablenpc "Kafra Staff#"+.@castle$;
  149. // remove investment data and kafra
  150. for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
  151. SetCastleData .@map$, .@i, 0;
  152. // if the new guild doesn't have Guardian Research, erase guardians
  153. if( getgdskilllv(.@GID,10002) == 0 )
  154. for( set .@i, 10; .@i <= 17; set .@i, .@i+1 )
  155. SetCastleData .@map$, .@i, 0;
  156. return;
  157. }
  158. // Function for OnAgitEnd ======================================
  159. function script F_AgitEnd {
  160. set .@map$, getarg(0);
  161. set .@castle$, getarg(1);
  162. GvgOff .@map$;
  163. // Disable the following if statment to keep empty
  164. // castles from being aquired after after WoE ends.
  165. if (GetCastleData(.@map$,1) == 0) return;
  166. MapRespawnGuildID .@map$,GetCastleData(.@map$,1),4;
  167. KillMonster .@map$,"Agit_"+.@castle$+"::OnAgitBreak";
  168. end;
  169. }