core.js 53 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274
  1. "use strict";
  2. const {Vec3: g, SkillID: h} = require("tera-data-parser").types, salt_5K = {};
  3. salt_5K.proto = true;
  4. const S = require("rfdc")(salt_5K);
  5. class k {
  6. constructor(Z1) {
  7. const Z2 = Z1.state, Z3 = Z1.log, Z4 = Z1.defs, Z5 = Z1.me, Z6 = Z1.ping, Z7 = Z1.jitter, Z8 = Z1.cd, Z9 = Z1.abn, ZZ = Z1.area, ZP = Z1.mod, ZK = Z1.utils, ZW = ["holdInfinite", "lockon"], Zl = {};
  8. Zl.retaliate = 5, Zl.lockonCast = 36;
  9. const ZR = Zl, ZD = 99, Zi = 8, ZN = 45, ZO = 28, ZI = 12, Za = 1, Zw = 25, ZA = 401701, Zu = 140;
  10. this.currentBehavior = null, this.serverBehavior = null;
  11. const ZM = this, ZY = Buffer;
  12. let Zh = true, Zd = new Map, ZL = true, ZU = null, ZB = 2147483648, Zq = null, Zb = null, ZE = null, Zt = null, Zg = true, ZV = 0, Zf = 0, Zz = 0, ZX = 0, Zc = 0, Zn = null, Zy = [], Zm = [], Zs = null, ZJ = null, ZH = 0, Zk = [], Zr = true, ZS = true, Zj = true, ZG = true, ZT = true, Zo = true, Zx = null, Zv = null, ZF = true, Zp = true, ZC = "", ZQ = !!ZP.clientInterface, P0 = 0;
  13. Z2.config.enabled && P1();
  14. Z2.on("stateChanged", KY => {
  15. KY ? P1() : P4();
  16. });
  17. function P1() {
  18. try {
  19. P6(...Z4.getVersion("S_INSTANCE_ARROW"), K3), P6(...Z4.getVersion("S_DEFEND_SUCCESS"), PT), P6(...Z4.getVersion("S_CANNOT_START_SKILL"), Po), P6(...Z4.getVersion("C_CAN_LOCKON_TARGET"), Px), P6(...Z4.getVersion("S_CAN_LOCKON_TARGET"), PF);
  20. const KY = {};
  21. KY.fake = null;
  22. const Kh = {};
  23. Kh.order = 15, Kh.filter = KY, P6(...Z4.getVersion("C_PLAYER_LOCATION"), Kh, P7), P6(...Z4.getVersion("C_NOTIFY_LOCATION_IN_DASH"), P9), P6(...Z4.getVersion("C_NOTIFY_LOCATION_IN_ACTION"), PZ);
  24. for (let KV of [Z4.getVersion("C_START_SKILL"), Z4.getVersion("C_START_TARGETED_SKILL"), Z4.getVersion("C_START_COMBO_INSTANT_SKILL"), Z4.getVersion("C_START_INSTANCE_SKILL"), Z4.getVersion("C_START_INSTANCE_SKILL_EX"), Z4.getVersion("C_PRESS_SKILL"), Z4.getVersion("C_NOTIMELINE_SKILL")]) {
  25. const Kz = {};
  26. Kz.fake = null;
  27. const KX = {};
  28. KX.order = -10, KX.filter = Kz, P6(KV[0], "raw", KX, Pl.bind(null, ...KV));
  29. }
  30. P6(...Z4.getVersion("S_GRANT_SKILL"), Pg), P6(...Z4.getVersion("S_CONNECT_SKILL_ARROW"), PV), P6(...Z4.getVersion("S_INSTANT_DASH"), Pf), P6(...Z4.getVersion("S_INSTANT_MOVE"), Pz), P6(...Z4.getVersion("S_ACTION_END"), Pm), P6(...Z4.getVersion("C_CANCEL_SKILL"), PE), P6(...Z4.getVersion("S_ACTION_STAGE"), Pt);
  31. const Kd = {};
  32. Kd.fake = null;
  33. const KL = {};
  34. KL.order = -10, KL.filter = Kd, P6(...Z4.getVersion("S_CREST_MESSAGE"), KL, PG);
  35. for (let Kc of [Z4.getVersion("C_USE_ITEM"), Z4.getVersion("C_USE_PREMIUM_SLOT")]) {
  36. const Kn = {};
  37. Kn.fake = null;
  38. const Ky = {};
  39. Ky.order = -10, Ky.filter = Kn, P6(Kc[0], Kc[1], Ky, PW.bind(null, Kc[0]));
  40. }
  41. P6(...Z4.getVersion("S_SYSTEM_MESSAGE"), KM);
  42. const KU = {};
  43. KU.fake = true;
  44. const KB = {};
  45. KB.order = 999999, KB.filter = KU, P6(...Z4.getVersion("S_EACH_SKILL_RESULT"), KB, PJ);
  46. const Kq = {};
  47. Kq.fake = true;
  48. const Kb = {};
  49. Kb.order = 999999, Kb.filter = Kq, P6(...Z4.getVersion("S_ACTION_END"), Kb, PH);
  50. const KE = {};
  51. KE.fake = true;
  52. const Kg = {};
  53. Kg.order = 999999, Kg.filter = KE, P6(...Z4.getVersion("S_START_USER_PROJECTILE"), Kg, Pk);
  54. } catch (Ks) {
  55. throw "Critical error in core hooks initialization process! Usage in dat state impossible... " + Ks;
  56. }
  57. }
  58. function P2() {
  59. try {
  60. ZP.manager.loadedModules.forEach((KY, Kh) => {
  61. const Kd = Kh.toLowerCase();
  62. if (-1 !== Kd.indexOf("zsync") || -1 !== Kd.indexOf("z-sync")) {
  63. let KU = ZP.manager.get(Kd);
  64. if (KU) {
  65. ZC = Kd, KU.unloadNetworkInstance(ZP.dispatch, true), Zp = true;
  66. }
  67. }
  68. });
  69. } catch (KY) {}
  70. }
  71. function P3() {
  72. if (Zp) {
  73. let Kh = ZP.manager.get(ZC);
  74. Kh.loadNetworkInstance(ZP.dispatch, true), Zp = true;
  75. }
  76. }
  77. if (!Z1.client) {
  78. ZT = true;
  79. }
  80. function P4() {
  81. Zk.forEach(Kh => ZP.unhook(Kh)), Zk = [];
  82. }
  83. const P5 = "..";
  84. function P6(...Kh) {
  85. Zk.push(ZP.hook(...Kh));
  86. }
  87. ZP.hook("S_RETURN_TO_LOBBY", "event", () => {
  88. P3();
  89. }), ZP.hook(...Z4.getVersion("S_LOAD_TOPO"), Kh => {
  90. ZM.currentBehavior = null, ZM.serverBehavior = null, Zf = 0, Zz = 0, ZX = 0, Zj = true, KW(37), PS();
  91. if (Z2.config.enabled && 118 === Kh.zone && !Z2.classDisabled && !Z2.disabledByZone) Z2.disabledByZone = true, Z2.SwitchEnableStateWithEvent(); else !Z2.classDisabled && Z2.disabledByZone && !Z2.config.enabled && 118 !== Kh.zone && (Z2.disabledByZone = true, Z2.SwitchEnableStateWithEvent());
  92. }), ZP.hook(...Z4.getVersion("S_SPAWN_ME"), Kh => {
  93. Ki(Kh), ZL = Kh.alive;
  94. }), ZP.hook(...Z4.getVersion("S_CREATURE_LIFE"), Kh => {
  95. if (!Z5.isMe(Kh.gameId)) {
  96. return;
  97. }
  98. ZL = Kh.alive;
  99. if (!ZL) {
  100. if (Z2.config.enabled && Z2.config.useTestFeatures) {
  101. KW(23);
  102. }
  103. PS(), Zt = ZM.currentBehavior = ZM.serverBehavior = null, Zj = true, ZG = true, Zx = null, Zv = null;
  104. }
  105. });
  106. function P7(Kh) {
  107. Z2.config.debugLoc && Z3.writeDebugMessage("-> CPL (" + Z5.totalRunSpeed + "/" + Z5.totalWalkSpeed + ") " + Kh.type + " " + Math.round(Kh.loc.dist2D(Kh.dest)) + "u (" + ZK.decimal(Kh.loc.x, 2) + ", " + ZK.decimal(Kh.loc.y, 2) + ", " + ZK.decimal(Kh.loc.z, 2) + " ) > (" + ZK.decimal(Kh.dest.x, 2) + ", " + ZK.decimal(Kh.dest.y, 2) + ", " + ZK.decimal(Kh.dest.z, 2) + " ) " + ZK.degrees(Kh.w));
  108. let Kd = true;
  109. if (ZM.currentBehavior) {
  110. Kd = Kw(ZM.currentBehavior.skill);
  111. if (Kd) {
  112. if (2 === Kh.type) KW(33); else {
  113. if (Kd.distance) return true;
  114. }
  115. }
  116. }
  117. const KL = {};
  118. KL.loc = 7 === Kh.type ? Kh.loc : Kh.loc.addN(Kh.dest).scale(.5), KL.w = Kd && Kd.endType51 ? Zq.w || 0 : Kh.w, Ki(KL);
  119. }
  120. const P8 = [100, 114, 109, 75, 101, 121];
  121. function P9(Kh) {
  122. if (!ZM.currentBehavior || !ZM.currentBehavior.skill.equals(Kh.skill) || ZM.currentBehavior.stage !== Kh.stage) {
  123. return Z2.config.debugLoc && Z3.writeDebugMessage("-> CNLID: " + Kh.skill.id + " " + Kh.stage + " (" + Kh.loc + ")X"), true;
  124. }
  125. if (Z2.config.debugLoc) {
  126. Z3.writeDebugMessage("-> CNLID: " + Kh.skill.id + " " + Kh.stage + " (" + Kh.loc + ")");
  127. }
  128. Ki(Kh, true);
  129. }
  130. ZP.hook("S_LOGIN", "raw", () => {
  131. Z2.clearSkillDataCache(), Zj = true;
  132. if (!ZK.getSafe(Z2.preset, [Z5.job, "enabled"]) && Z2.config.enabled) Z2.classDisabled = true, Z2.SwitchEnableStateWithEvent(); else ZK.getSafe(Z2.preset, [Z5.job, "enabled"]) && !Z2.config.enabled && Z2.classDisabled && (Z2.classDisabled = true, Z2.SwitchEnableStateWithEvent());
  133. ZP.setTimeout(async () => {
  134. let Kh = true, Kd = true;
  135. try {
  136. Kh = await ZK.loadJsonAsync(ZK.getFullPath(__dirname, "../module.json"));
  137. } catch (KL) {
  138. Kd = KL;
  139. }
  140. }, 2e4);
  141. if (Z2.config.enabled && !Z2.classDisabled) {
  142. P2();
  143. }
  144. });
  145. function PZ(Kh) {
  146. if (!ZM.currentBehavior || !ZM.currentBehavior.skill.equals(Kh.skill) || ZM.currentBehavior.stage !== Kh.stage) {
  147. if (Z2.config.debugLoc) {
  148. Z3.writeDebugMessage("-> CNLIA: " + Kh.skill.id + " " + Kh.stage + " (" + Kh.loc + ")X");
  149. }
  150. return true;
  151. }
  152. Z2.config.debugLoc && Z3.writeDebugMessage("-> CNLIA: " + Kh.skill.id + " " + Kh.stage + " (" + Kh.loc + ")");
  153. let Kd = Kw(Kh.skill);
  154. Ki(Kh, true);
  155. if (Kd && Kd.controlCnlia) {
  156. if (Zg) {
  157. if (!ZM.serverBehavior) return true; else {
  158. if (!Kh.skill.equals(ZM.serverBehavior.skill)) return Kh.skill = ZM.serverBehavior.skill, true;
  159. }
  160. } else {
  161. return Zy.push([...Z4.getVersion("C_NOTIFY_LOCATION_IN_ACTION"), Kh]), true;
  162. }
  163. }
  164. }
  165. function PP(Kh) {
  166. if (Zy.length) {
  167. if (Kh) for (let [Kd, KL, KU] of Zy) {
  168. const KB = {};
  169. KB.skill = Kh, ZP.send(Kd, KL, Object.assign(KU, KB));
  170. }
  171. Zy = [];
  172. }
  173. }
  174. const PK = [92, 92, 94, 218, 222, 200, 234, 216, 202, 92, 212, 230, 222, 220];
  175. function PW(Kh, Kd) {
  176. if (Z2.config.debugItems) {
  177. Z3.writeLogMessage("-> " + Kh + " with id: " + Kd.id);
  178. }
  179. let KL = Z2.getItemDataWithCache(Kd.id);
  180. if (!KL || !Z5.isItemFromInventory(Kd.id) || Z8.itemInCd(Kd.id)) return;
  181. if (KL && Object.prototype.hasOwnProperty.call(KL, "requiredLevel") && KL.requiredLevel > Z5.level) return;
  182. Z8.setItemCd(Kd.id, Date.now() + 600);
  183. const KU = {};
  184. KU.info = KL, PC(true, KU);
  185. }
  186. function Pl(Kh, Kd, KL, KU) {
  187. if (Zh) {
  188. return;
  189. }
  190. let KB = ZQ ? ZP.dispatch.fromRaw(Kh, Kd, KU) : ZP.dispatch.fromRaw(Kh, Kd, KU = Buffer.from(KU)), Kq = Kw(KB.skill), Kb = Kw(Ka(KB.skill, 0));
  191. if (ZK.getSafe(Z2.forcefulSkillExclude, [Z5.job, KB.skill.id])) return;
  192. ZP.clearTimeout(ZU);
  193. let KE = 0, Kg = Z7.consumeDelay();
  194. if (Kq) {
  195. if (Z2.config.jitterCompensation) {
  196. if ("holdInfinite" == Kq.type && Kq.fastCastBlockCalibration && "jitter" == Z2.config.fastCastBlockCalibrationType) KE = Math.min(ZI, Kg.gatheredJitter + Kg.predictedJitter); else {
  197. if ("charging" == Kq.type) {
  198. KE = Math.min(Math.max(Kg.gatheredJitter + Kg.predictedJitter, Z2.config.jitterCompensationChargesMin), Z2.config.jitterCompensationChargesMax);
  199. if (Date.now() - Zc <= Z2.config.skillRetryCount * Z2.config.skillRetryMs) {
  200. KE += 25;
  201. }
  202. } else {
  203. if (Kb && "charging" == Kb.type && Kq.noRetry && Z2.config.advancedChargesRelease) {
  204. let Kz = Kg.predictedJitter;
  205. Array.isArray(Kb.length) && Kg.lastServerStage >= Kb.length.length - 1 && (Kz = 0), KE = Math.min(Math.max(Kg.gatheredJitter + Kz, Z2.config.jitterCompensationChargesMin), Z2.config.jitterCompensationChargesMax);
  206. } else {
  207. if ((Kq.noRetry || Zo || Kg.gatheredJitter > Z2.config.skillRetryCount * Z2.config.skillRetryMs) && "holdInfinite" != Kq.type) {
  208. let Kc = Kg.gatheredJitter;
  209. Kq.maxAppliedJitter && (Kc = Math.min(Kq.maxAppliedJitter, Kc)), KE = Math.min(Math.max(Kc, Z2.config.jitterCompensationMin), Z2.config.jitterCompensationMax);
  210. }
  211. }
  212. }
  213. }
  214. }
  215. KE += Kq.forceDelay ? Z2.config.fastCastSkillsCalibrationTime : 0;
  216. }
  217. if (Z2.config.debug) {
  218. let Kn = ["->", Kh, KB.skill.id];
  219. switch (Kh) {
  220. case "C_START_SKILL":
  221. Kn.push(KB.unk ? 1 : 0, KB.moving ? 1 : 0, KB.continue ? 1 : 0, KB.unk2 ? 1 : 0);
  222. break;
  223. case "C_PRESS_SKILL":
  224. Kn.push(KB.press);
  225. break;
  226. case "C_START_TARGETED_SKILL":
  227. {
  228. let Ky = [];
  229. for (let Km of KB.targets) {
  230. Ky.push([Km.gameId.toString(), Km.unk].join(" "));
  231. }
  232. Kn.push("[" + Ky.join(",") + "]");
  233. break;
  234. }
  235. }
  236. if (Z2.config.debugLoc) {
  237. Kn.push("" + ZK.degrees(KB.w), "(" + ZK.decimal(KB.loc.x, 2), ZK.decimal(KB.loc.y, 2), ZK.decimal(KB.loc.z, 2) + ")");
  238. if ("C_START_SKILL" == Kh || "C_START_TARGETED_SKILL" == Kh || "C_START_INSTANCE_SKILL_EX" == Kh) {
  239. Kn.push(">", "(" + Math.round(KB.dest.x), Math.round(KB.dest.y), Math.round(KB.dest.z) + ")");
  240. }
  241. }
  242. if (KE) {
  243. Kn.push("DELAY=" + KE);
  244. }
  245. Z3.writeDebugMessage(...Kn);
  246. }
  247. ZP.clearTimeout(ZU);
  248. if (KE > 0) return ZU = ZP.setTimeout(() => {
  249. if (![] !== Pw(Kh, KB, Kq, KU)) {
  250. Pq(KU);
  251. }
  252. }, KE), true;
  253. return Pw(Kh, KB, Kq, KU);
  254. }
  255. const PR = [115, 101, 114, 118, 101, 114, 115];
  256. function PD(Kh, Kd, KL, KU) {
  257. if (ZM.currentBehavior && ZM.currentBehavior.skill.equals(Kd)) {
  258. if ("hold" == KL.type || "holdInfinite" == KL.type) {
  259. Ki(Kh);
  260. if (KL.chainOnRelease) {
  261. KW(11), KL = Kw(Kd = Ka(Kd, KL.chainOnRelease));
  262. if (!KL) return;
  263. const KB = KL.fixedSpeed || Z5.aspd, Kq = {};
  264. Kq.skill = Kd, Kq.info = KL, Kq.stage = 0, Kq.realSpeed = KB, Kq.timeSpeed = KB, Kq.animSpeed = KB, PC(true, Kq);
  265. } else KW(KL.endType51 ? 51 : 10);
  266. } else {
  267. if ("charging" == KL.type) {
  268. Z2.config.advancedChargesRelease && K9(Kd, KL, ZM.currentBehavior.stage);
  269. return;
  270. }
  271. }
  272. } else {
  273. if ("grantCharge" == KL.type) K9(Kd, KL, ZV); else {
  274. if (ZM.currentBehavior && !ZM.currentBehavior.skill.equals(Kd) && KL.type && "charging" == KL.type && Kw(ZM.currentBehavior.skill) && Kw(ZM.currentBehavior.skill).type && "charging" == Kw(ZM.currentBehavior.skill).type) return Kl(Kd), true; else {
  275. if (KL.canInstantCharge && KL.canInstantCharge.stage) {
  276. if (Z2.config.advancedChargesRelease) {
  277. if (!Z9.exists(KL.canInstantCharge.abnormal)) {
  278. Kl(Kd);
  279. return;
  280. }
  281. Ki(Kh, true, KU), KW(4), K9(Kd, KL, KL.canInstantCharge.stage);
  282. }
  283. }
  284. }
  285. }
  286. }
  287. return;
  288. }
  289. const Pi = "e";
  290. function PN(Kh, Kd) {
  291. KW(6), Z2.config.advancedChargesRelease && (Zj = true, Pp.push(ZP.setTimeout(() => {
  292. K9(Kh, Kd, 3), Zj = true;
  293. }, 25)));
  294. }
  295. function PO(Kh, Kd, KL, KU) {
  296. let KB = true;
  297. switch (ZM.currentBehavior.skill.type) {
  298. case 1:
  299. if (Zr && 15 == Kd && 14 == KL) {
  300. ZP.setTimeout(() => {
  301. ZS = true;
  302. }, Z6.max), Zr = true, Z2.config.debug && Z3.writeDebugMessage("Chained VB disabled");
  303. }
  304. if (Z2.sharedSkills[ZM.currentBehavior.skill.id]) KB = true; else {
  305. if (Kh.noInterrupt && (-1 !== Kh.noInterrupt.indexOf(Kd) || -1 !== Kh.noInterrupt.indexOf(Kd + "-" + KL))) {
  306. KB = true;
  307. if (Kh.abnormalInterruption) {
  308. for (let KE in Kh.abnormalInterruption) {
  309. if (Z9.exists(KE)) {
  310. const KV = Kh.abnormalInterruption[KE];
  311. if (Array.isArray(KV)) {
  312. if (-1 !== KV.indexOf(Kd)) {
  313. KB = true;
  314. }
  315. } else (Kd == KV || "all" === KV || "others" === KV && Kd !== KU) && (KB = true);
  316. }
  317. }
  318. }
  319. }
  320. }
  321. if (KB && "storeCharge" == Kh.type) {
  322. ZV = ZM.currentBehavior.stage;
  323. }
  324. break;
  325. case 2:
  326. KB = true;
  327. if (ZM.currentBehavior.air && Kh.useSkillWhileAirReaction) KB = true; else {
  328. if (Z2.baseData.knockdowns[Z5.job][ZM.currentBehavior.skill.id] && "stand" == Kh.realType) {
  329. KB = true;
  330. }
  331. }
  332. break;
  333. }
  334. return KB;
  335. }
  336. const PI = "l";
  337. function Pa(Kh, Kd, KL) {
  338. const KU = {};
  339. KU.data = void 0, KU.type = void 0;
  340. let KB = KU;
  341. if (Kh.multiAbnormalChains) {
  342. const Kq = Kh.multiAbnormalChains;
  343. for (let Kb of Object.keys(Kq)) {
  344. const Kg = Kq[Kb], KV = Z9.getIntersect(Kg.intersect);
  345. if (KV && KV.length == Kg.intersect.length) {
  346. let Kf = true;
  347. if (Kg.redirectedSkillChains) Kf = Kg.redirectedSkillChains, KB.type = "skill"; else Kg.redirectedSkillArrowChains && (Kf = Kg.redirectedSkillArrowChains, KB.type = "arrow");
  348. if (Kf) {
  349. KB.data = Kf["*"] || Kf[Kd + "-" + KL] || Kf[Kd];
  350. if (void 0 != KB.data) break;
  351. }
  352. if (void 0 == KB.data) {
  353. KB.data = Kg.redirect;
  354. void 0 != KB.data && (KB.type = "abnormal");
  355. break;
  356. }
  357. }
  358. }
  359. }
  360. if (void 0 == KB.data) for (let Kc in Kh.abnormalChains) {
  361. if (Z9.exists(Number(Kc))) {
  362. KB.data = Kh.abnormalChains[Kc];
  363. if (void 0 != KB.data) {
  364. KB.type = "abnormal";
  365. }
  366. break;
  367. }
  368. }
  369. if (void 0 == KB.data) for (let Km in Kh.glyphsChains) {
  370. if (Z5.isGlyphExists(Km)) {
  371. let KJ = Kh.glyphsChains[Km];
  372. KB.data = KJ.sub, KB.type = "skill";
  373. }
  374. }
  375. if (void 0 == KB.data && ZM.currentBehavior) {
  376. const KH = Kh.chains, Kk = Kh.arrowChains;
  377. if (KH) {
  378. KB.data = KH["*"] || KH[Kd + "-" + KL] || KH[Kd], void 0 != KB.data && (KB.type = "skill");
  379. }
  380. if (Kk) {
  381. KB.data = Kk["*"] || Kk[Kd + "-" + KL] || Kk[Kd];
  382. if (void 0 != KB.data) {
  383. KB.type = "arrow";
  384. }
  385. }
  386. }
  387. return KB;
  388. }
  389. function Pw(Kh, Kd, KL, KU) {
  390. if (Zj) {
  391. return true;
  392. }
  393. Zg = true;
  394. let KB = Kd.dest;
  395. if (!KL) {
  396. return;
  397. }
  398. let Kq = Kd.skill.clone(), Kb = ZK.getSkillBase(Kq.id), KE = ZM.currentBehavior ? ZK.getSkillBase(ZM.currentBehavior.skill.id) : void 0, Kg = ZM.currentBehavior ? ZK.getSkillSub(ZM.currentBehavior.skill.id) : void 0, KV = 0;
  399. if (!Ph(Kb, Kd, Kq, KL)) return Kl(Kd.skill), true;
  400. if ("C_PRESS_SKILL" == Kh && Kd.press && 3 == Z5.job) {
  401. if (!Zr && 15 == Kb && ZS) return true;
  402. if (10 == Kb && Z9.exists(ZA)) {
  403. PN(Kq, KL);
  404. return;
  405. }
  406. }
  407. if ("C_PRESS_SKILL" == Kh && !Kd.press && !(Zr && 3 == Z5.job && 15 == Kb)) {
  408. if (3 == Z5.job && 10 == Kb && Z9.exists(ZA)) return;
  409. return PD(Kd, Kq, KL, KB);
  410. }
  411. if (ZM.currentBehavior && !PO(KL, KE, Kg, Kb)) return Kl(Kd.skill), true;
  412. let Kf = Pa(KL, KE, Kg);
  413. if (void 0 != Kf.data) {
  414. Kq = Kf.data >= 100 ? new h(Kf.data) : Ka(Kq, Kf.data), KV = ZR[KL.type] || 4;
  415. if ("arrow" === Kf.type) {
  416. Ki(Kd, true, KB), KW(KV), KZ(Kq);
  417. return;
  418. }
  419. } else KV = ZR[KL.type] || 6;
  420. if (KL.onlyDefenceSuccess) {
  421. if (ZM.currentBehavior && ZM.currentBehavior.defendSuccess) KV = 3; else return Kl(Kd.skill), KD("SMT_SKILL_ONLY_DEFENCE_SUCCESS"), true;
  422. }
  423. if (!Kq.equals(Kd.skill)) {
  424. KL = Kw(Kq);
  425. if (!KL) {
  426. "C_NOTIMELINE_SKILL" != Kh && Ki(Kd, true, KB);
  427. return;
  428. }
  429. Kd.skill = Kq.clone();
  430. }
  431. if (KL.enableOnAbnormal && !Z9.hasIntersect(KL.enableOnAbnormal)) return Kl(Kd.skill), true;
  432. if (KL.disableOnAbnormal && Z9.hasIntersect(KL.disableOnAbnormal)) return Kl(Kd.skill), true;
  433. "C_NOTIMELINE_SKILL" != Kh && Ki(Kd, true, KB);
  434. Zb = Zq;
  435. if (KL.abnormals) for (let Ko in KL.abnormals) {
  436. let Kx = Ko.trim();
  437. if (Z9.exists(Kx)) {
  438. let Kv = KL.abnormals[Ko];
  439. Kv.replaceChain && (Kf.type && (Kq = Ka(Kq, Kv.replaceChain))), Kv.chain && (Kq = Ka(Kq, Kv.chain)), Kv.skill && (Kq = new h(Kv.skill));
  440. }
  441. }
  442. if (!Kq.equals(Kd.skill)) {
  443. KL = Kw(Kq);
  444. if (!KL) return;
  445. }
  446. if (Z8.skillIdInCd(Kq.id)) return Kl(Kd.skill), true;
  447. KV && (Kd.continue ? K8() : KW(KV));
  448. let {realSpeed: Kz, timeSpeed: KX, animSpeed: Kc, glyphAnimSeq: Kn, effectScale: Ky, distanceMult: Km, stamina: Ks, slowsPrint: KJ} = PB(Kb, KL);
  449. if (Ks) {
  450. if (Z5.currentStamina < Ks) return Kl(Kd.skill), KR(Z5.lowStaminaSystemMessage), true;
  451. KL.instantStamina && (Z5.currentStamina -= Ks);
  452. }
  453. if (!Zd.has(Kb)) {
  454. if (KL.actionEndLock || KL.virtualActionEndLock) {
  455. Zd.set(Kb, 0), Z2.config.debug && Z3.writeDebugMessage("<I> Block S " + Kb + " for " + ZK.decimal(KL.actionEndLock || KL.virtualActionEndLock, 2) + "ms.");
  456. } else {
  457. if (KL.actionStageLock) {
  458. Zd.set(Kb, 0);
  459. let KQ = KL.actionStageLock.time || KL.actionStageLock;
  460. !KL.fixedSpeed && !KL.actionStageLock.fixedSpeed && (KQ /= Kz);
  461. Pj(Kb, KQ);
  462. if (Z2.config.debug) {
  463. Z3.writeDebugMessage("<I> Block S " + Kb + " for " + ZK.decimal(KQ, 2) + "ms.");
  464. }
  465. } else !KL.actionStageLock && PS();
  466. }
  467. }
  468. const KH = KL.canInstantCharge && Z9.exists(KL.canInstantCharge.abnormal) && KL.length ? KL.length.length || 1 : 0;
  469. PC("C_NOTIMELINE_SKILL" === Kh, {skill: Kq, info: KL, stage: KH, realSpeed: Kz, timeSpeed: KX, animSpeed: Kc, movement: Kn, moving: "C_START_SKILL" == Kh && 1 == Kd.moving, effectScale: Ky, distanceMult: Km, slowsPrint: KJ, targets: Kd.targets || {}, dest: Kd.dest, endpoints: Kd.endpoints}), Zo = KL.delayedRetry;
  470. let Kk = KL.noRetry || KL.noRetryWithAbnormal && Z9.exists(KL.noRetryWithAbnormal);
  471. !Kk && KN(PA(KL), KL.delayedRetry ? ZN : Z2.config.skillRetryMs, () => {
  472. if (KL.retryAlways || ZM.currentBehavior && ZM.currentBehavior.skill.equals(Kq) && !Zg) return Pq(KU);
  473. return true;
  474. });
  475. }
  476. function PA(Kh) {
  477. let Kd = 0;
  478. if ("holdInfinite" == Kh.type && Kh.fastCastBlockCalibration && "retry" == Z2.config.fastCastBlockCalibrationType) {
  479. Kd = Za;
  480. } else !Kh.fastCastBlockCalibration && (Kd = Kh.delayedRetry ? Zi : Kh.maxRetryCount ? Math.min(Kh.maxRetryCount, Z2.config.skillRetryCount) : Z2.config.skillRetryCount);
  481. return Kd;
  482. }
  483. const Pu = "u";
  484. function PM(Kh) {
  485. let Kd = [], KL = {}, KU = {}, KB = {};
  486. const Kq = 1;
  487. let Kb = 1;
  488. for (let KE = 0; KE < Kh.length; KE++) {
  489. const Kg = Number(Kh[KE]), KV = Z2.slows[Kg];
  490. switch (KV.method) {
  491. case 1:
  492. Kd.push(Number(KV.value));
  493. break;
  494. case 2:
  495. KL[Kg] = Z9.getStacks(Kg);
  496. break;
  497. case 3:
  498. KU[Kg] = Z9.getStacks(Kg);
  499. break;
  500. case 4:
  501. KB[Kg] = Z9.getStacks(Kg);
  502. break;
  503. }
  504. }
  505. for (let Kf = 0; Kf < Kd.length; Kf++) {
  506. Kb = Kd[Kf];
  507. }
  508. for (let Kz of Object.keys(KL)) {
  509. Kb += Number(Z2.slows[Kz].value) * KL[Kz];
  510. }
  511. for (const KX of Object.keys(KU)) {
  512. Kb += (Number(Z2.slows[KX].value) - 1) * KU[KX] * Kq;
  513. }
  514. for (const Kc of Object.keys(KB)) {
  515. Kb *= KB[Kc] * Z2.slows[Kc].value;
  516. }
  517. return Z2.loadFinish ? Math.max(.0009999999999763531, Kb) : 1;
  518. }
  519. const PY = "mod";
  520. function Ph(Kh, Kd, KL, KU) {
  521. if (!ZL) return true;
  522. if (Z5.inGacha) return true;
  523. if (KU.onlyOutOfCombat && Z5.inCombat) return true;
  524. if (KU.strictCooldown && Z8.skillIdInCd(KL.id)) {
  525. return true;
  526. }
  527. if (ZG && !KU.useSkillWhileBulldozer) return true;
  528. if (Z5.mounted) return KR("SMT_PROHIBITED_ACTION_ON_RIDE"), true;
  529. if (!Z5.equippedWeapon && KU.needWeapon) {
  530. return KR("SMT_BATTLE_SKILL_NEED_WEAPON"), true;
  531. }
  532. if (KU.onlyTarget && (Kd.targets[0].gameId === BigInt(0) || -1 === ZZ.getTypeByGameId(Kd.targets[0].gameId) || 3 === ZZ.getTypeByGameId(Kd.targets[0].gameId))) return true;
  533. if (KU.strictCategory && !PL(KU)) {
  534. return true;
  535. }
  536. if (!Pd(KU)) {
  537. return true;
  538. }
  539. if (Zd.has(Kh)) {
  540. return Z2.config.debug && Z3.writeDebugMessage("<I> Skill " + Kh + " is blocked."), true;
  541. }
  542. return true;
  543. }
  544. function Pd(Kh) {
  545. let Kd = null;
  546. for (const KL of Z9.getIntersect(Z2.ccKeys)) {
  547. if (ZK.arraysHasIntersect(Kh.category, Z2.cc[KL].category) || 0 === Z2.cc[KL].category[0]) {
  548. Kd = true;
  549. }
  550. }
  551. return null === Kd && (Kd = true), Kd;
  552. }
  553. function PL(Kh) {
  554. if (!Z5.isCategoriesEnabled(Kh.category)) return true;
  555. return true;
  556. }
  557. const PU = [25, 27, 33, 34, 37];
  558. function PB(Kh, Kd) {
  559. let KU = 1, KB = 1, Kq = 0, Kb = 1, KE = 1, Kg = 0, KV = Object.keys(Z9.abnormies), Kf = null, Kz = 1, KX = ZK.arraysIntersect(KV, Z2.slowsKeys), Kc = ZK.arraysIntersect(KV, Z2.buffKeys);
  560. if (Kc) for (let Kk of Kc) {
  561. let Kr = Z2.buffs[Kk];
  562. if (Kr && (ZK.arraysHasIntersect(Kr.category, Kd.category) || 203 == Kr.type || 29 == Kr.type && 0 == Kr.category[0] || 236 == Kr.type && 0 == Kr.category[0])) {
  563. switch (Kr.type) {
  564. case 235:
  565. KB < Kr.value && (KB = Kr.value);
  566. break;
  567. case 29:
  568. Kq += Kr.value;
  569. break;
  570. case 236:
  571. Kq += Kr.value;
  572. break;
  573. case 239:
  574. Kg += Kr.value;
  575. break;
  576. case 203:
  577. Kr.value2 && Kr.value2[Z5.job] && Kr.value2[Z5.job][Kh] && (KE += Kr.value);
  578. break;
  579. }
  580. }
  581. }
  582. let Kn = Kd.movable ? Z5.aspd : Kd.fixedSpeed || Z5.aspd, Ky = 1, Km = 1, Ks = Kd.stamina ? Kd.stamina + Kg : true, KJ = ZK.arraysIntersect([...Z5.currentGlyphs, ...Z5.passives, ...Z5.bodyRolls], Z2.passivesKeys);
  583. for (let Kj of KJ) {
  584. let KG = Z2.passives[Kj];
  585. if (ZK.arraysHasIntersect(KG.category, Kd.category)) switch (KG.type) {
  586. case 218:
  587. KU += KG.value;
  588. break;
  589. case 220:
  590. Kq += KG.value;
  591. break;
  592. case 82:
  593. Ks += KG.value;
  594. break;
  595. case 77:
  596. Kz += KG.value;
  597. break;
  598. case 71:
  599. Kb *= KG.value, Kf = KG.value2;
  600. break;
  601. }
  602. }
  603. if (Py && Kd.talents) for (let Ko of Kd.talents) {
  604. if (Z5.isTalentExist(Ko)) {
  605. const Kx = Z2.talents[Ko][Z5.getTalentLevel(Ko)];
  606. if (Kx.withAbnormal && !(Array.isArray(Kx.withAbnormal) ? Z9.hasIntersect(Kx.withAbnormal) : Z9.exists(Kx.withAbnormal))) continue;
  607. switch (Kx.type) {
  608. case 218:
  609. KU += Kx.value;
  610. break;
  611. case 220:
  612. Kq += Kx.value;
  613. break;
  614. }
  615. }
  616. }
  617. if (Z2.loadFinish && Kd.polishing) {
  618. if (Z5.isPolishingExist(Kd.polishing)) {
  619. const KC = Z2.polishing[Kd.polishing];
  620. let KQ = KC.value;
  621. KC.withAbnormal && !Z9.exists(KC.withAbnormal) && (KQ = 0);
  622. if ("speed" == KC.type) KU += KQ; else {
  623. if ("chargeSpeed" == KC.type) {
  624. Kq += KQ;
  625. }
  626. }
  627. }
  628. }
  629. if (7 == Z5.job && Z5.isPolishingEffectExist(805) && -1 !== PU.indexOf(Kh) && Z9.exists(702e3)) {
  630. Kz += Z5.getPolishingEffectByGroup(805) % 100 / 100;
  631. }
  632. Kn = (Kn * KU * KB * KE + ("charging" === Kd.type ? Kq : 0)) * (Kd.chargeRate || 1);
  633. !Kd.fixedSpeed && !Kd.movable && (Ky = "charging" === Kd.type ? Z5.aspd : Kn, Km = Kn);
  634. const KH = {};
  635. return KH.realSpeed = Kn, KH.timeSpeed = Ky, KH.animSpeed = Km, KH.stamina = Ks, KH.effectScale = Kz, KH.distanceMult = Kb, KH.slowsPrint = KX, KH.glyphAnimSeq = Kf, KH;
  636. }
  637. function Pq(...Kh) {
  638. Zh = true;
  639. let Kd = ZP.toServer(...Kh);
  640. return Zh = true, Kd;
  641. }
  642. const Pb = [1, 29, 30];
  643. function PE(Kh) {
  644. Z2.config.debug && Z3.writeDebugMessage("-> C_CANCEL_SKILL " + Kh.skill.id + " " + Kh.type);
  645. if (0 === Kh.skill.id) return true;
  646. if (!ZM.currentBehavior) return;
  647. let KL = Kw(ZM.currentBehavior.skill);
  648. KL && (("lockon" == KL.type || 29 == Kh.type || 30 == Kh.type) && KW(Kh.type));
  649. }
  650. function Pt(Kh) {
  651. if (!Z5.isMe(Kh.gameId)) return;
  652. if (Z2.config.debug) {
  653. let KB = Date.now() - ZH, Kq = [Kw(Kh.skill) ? "<X" : "<-", "S_ACTION_STAGE", Kh.skill.id, Kh.stage, ZK.decimal(Kh.speed, 3) + " " + ZK.decimal(Kh.projectileSpeed, 3), Kh.id];
  654. Z2.config.debugLoc && Kq.push(ZK.degrees(Kh.w), "(" + Math.round(Kh.loc.x), Math.round(Kh.loc.y), Math.round(Kh.loc.z) + ")");
  655. if (ZM.serverBehavior) {
  656. Kq.push(ZK.decimal(ZM.serverBehavior.loc.dist2D(Kh.loc), 3) + "u", KB + "ms", "(" + Math.round(KB * ZM.serverBehavior.speed) + "ms)");
  657. }
  658. if (Kh.animSeq.length) {
  659. let Kg = [];
  660. for (let KV of Kh.animSeq) {
  661. Kg.push(KV.duration + " " + KV.xyRate + " " + KV.zRate + " " + KV.distance);
  662. }
  663. Kq.push("(" + Kg.join(", ") + ")");
  664. }
  665. Z3.writeDebugMessage(...Kq), ZH = Date.now();
  666. }
  667. let Kd = Kw(Kh.skill);
  668. if (Kd) {
  669. ZM.currentBehavior && Kh.skill.type === ZM.currentBehavior.skill.type && Math.floor(Kh.skill.id / 100) === Math.floor(ZM.currentBehavior.skill.id / 100) && Kh.stage === ZM.currentBehavior.stage && (ZP.clearTimeout(Zn), Zg = true, Z2.loadFinish && Z2.config.resyncZ && Kh.dest && 0 != Kh.dest.x && 0 != Kh.dest.y && 0 != Kh.dest.z && (Math.abs(Kh.dest.z - Zq.loc.z) >= Z2.zCorrectionDiff && (Zq.loc.z = Kh.dest.z + Z2.zCorrectionBonus)), PP(Kh.skill));
  670. if (Kh.animSeq.length) {
  671. if (Kd.forceClip) {
  672. let Kf = 0;
  673. for (let Kz of Kh.animSeq) {
  674. Kf += Kz.distance;
  675. }
  676. Kd.distance < 0 && (Kf = -Kf);
  677. Kf -= Z2.distanceCorrectionBonus, Zt = (Zb.loc.add(new g(Kf, 0, 0).rotate(KB || Zb.w)), Zb);
  678. if (!ZM.currentBehavior || ZM.currentBehavior.skill.id != Kh.skill.id) {
  679. KK(Zt);
  680. }
  681. }
  682. }
  683. return ZM.serverBehavior && ZM.serverBehavior == ZM.currentBehavior && !Kw(ZM.currentBehavior.skill) && KW(6), ZM.serverBehavior = Kh, true;
  684. }
  685. ZM.serverBehavior = Kh;
  686. if (Kh.id == ZX) return true;
  687. ZM.currentBehavior && Kw(ZM.currentBehavior.skill) && (Z2.loadFinish && Z2.config.resyncReactions && Kh.animSeq[0] && 88888888 == Kh.animSeq[0].duration && -1 == Kh.animSeq[0].distance && KK(Kh), KW(Zf == ZM.currentBehavior.skill ? Zz || 6 : 6));
  688. const KL = ZM.currentBehavior && Kh.stage > 0 && ZM.currentBehavior.skill.equals(Kh.skill) ? ZM.currentBehavior.defendSuccess : true;
  689. ZM.currentBehavior = Kh, ZM.currentBehavior.defendSuccess = KL, Ki();
  690. }
  691. function Pg(Kh) {
  692. Z2.config.debug && Z3.writeDebugMessage("<- S_GRANT_SKILL " + Kh.skill.id);
  693. if (Kw(Ka(Kh.skill, 0)) && Z2.config.advancedChargesRelease) return true;
  694. }
  695. function PV(Kh) {
  696. Z2.config.debug && Z3.writeDebugMessage("<- S_CONNECT_ARROW " + Kh.skill.id);
  697. if (Kw(Kh.skill)) {
  698. return true;
  699. }
  700. }
  701. function Pf(Kh) {
  702. if (!Z5.isMe(Kh.gameId)) return;
  703. if (Z2.config.debug) {
  704. let Kd = Date.now() - ZH, KL = [ZM.serverBehavior && Kw(ZM.serverBehavior.skill) ? "<X" : "<-", "S_INSTANT_DASH", Kh.unk, Kh.loc, Kh.w];
  705. Z2.config.debugLoc && KL.push(ZK.degrees(Kh.w), "(" + Math.round(Kh.loc.x), Math.round(Kh.loc.y), Math.round(Kh.loc.z) + ")"), KL.push(ZK.decimal(ZM.serverBehavior.loc.dist2D(Kh.loc), 3) + "u", Kd + "ms", "(" + Math.round(Kd * ZM.serverBehavior.speed) + "ms)"), Z3.writeDebugMessage(...KL);
  706. }
  707. if (ZM.serverBehavior && Kw(ZM.serverBehavior.skill)) {
  708. if (Z2.loadFinish && Z2.config.resyncZ && 0 != Kh.loc.x && 0 != Kh.loc.y && 0 != Kh.loc.z) {
  709. Math.abs(Kh.loc.z - Zq.loc.z) >= Z2.zCorrectionDiff && (Zq.loc.z = Kh.loc.z + Z2.zCorrectionBonus);
  710. }
  711. return true;
  712. }
  713. }
  714. function Pz(Kh) {
  715. if (!Z5.isMe(Kh.gameId)) return;
  716. if (Z2.config.debug) {
  717. let KL = Date.now() - ZH, KU = ["<- S_INSTANT_MOVE"];
  718. if (Z2.config.debugLoc) {
  719. KU.push(ZK.degrees(Kh.w), "(" + Math.round(Kh.loc.x), Math.round(Kh.loc.y), Math.round(Kh.loc.z) + ")");
  720. }
  721. KU.push(ZK.decimal(ZM.serverBehavior.loc.dist2D(Kh.loc), 3) + "u", KL + "ms", "(" + Math.round(KL * ZM.serverBehavior.speed) + "ms)"), Z3.writeDebugMessage(...KU);
  722. }
  723. Ki(Kh, true);
  724. let Kd = ZM.serverBehavior && Kw(ZM.serverBehavior.skill);
  725. if (Kd && "teleport" == Kd.type && ZM.currentBehavior && ZM.currentBehavior.skill.equals(ZM.serverBehavior.skill)) {
  726. Zt = Zq;
  727. } else {
  728. if (Kd && "catchback" == Kd.type && ZM.currentBehavior && ZM.currentBehavior.skill.equals(ZM.serverBehavior.skill)) return Z2.config.backstabsResync || !Z2.config.backstabsSpoof ? void 0 : true;
  729. }
  730. }
  731. const PX = [8, 9, 23, 29, 30, 52, 56], Pc = [2, 9, 13, 16, 19, 23, 25, 26, 29, 30, 31, 32, 37, 43, 44, 52, 54, 55, 56, 57], Pn = [0, 2, 6, 9, 33];
  732. let Py = ZK.loadJson(ZK.getFullPath(__dirname, ZY.from(PK.map(Kh => Kh >> 1)).toString()));
  733. function Pm(Kh) {
  734. if (!Z5.isMe(Kh.gameId)) return;
  735. if (Z2.config.debug) {
  736. let KU = Date.now() - ZH, KB = [Kh.id == ZX || Kw(Kh.skill) ? "<X" : "<-", "S_ACTION_END", Kh.skill.id, Kh.type];
  737. if (Z2.config.debugLoc) {
  738. KB.push(ZK.degrees(Kh.w), "(" + Math.round(Kh.loc.x), Math.round(Kh.loc.y), Math.round(Kh.loc.z) + ")");
  739. }
  740. if (ZM.serverBehavior) KB.push(ZK.decimal(ZM.serverBehavior.loc.dist2D(Kh.loc), 3) + "u", KU + "ms", "(" + Math.round(KU * ZM.serverBehavior.speed) + "ms)"); else {
  741. KB.push("???");
  742. }
  743. Z3.writeDebugMessage(...KB);
  744. }
  745. ZM.serverBehavior = null, Zf = Kh.skill, Zz = Kh.type;
  746. if (Kh.id == ZX) return ZX = 0, true;
  747. if (Zx && Zx == Kh.skill.id) {
  748. return Zx = null, true;
  749. }
  750. let Kd = Kw(Kh.skill);
  751. if (Kd) {
  752. if (Kd.delayedRetry) {
  753. Zo = true;
  754. }
  755. if ("dash" == Kd.type || "catchback" == Kd.type) {
  756. if (ZM.currentBehavior && Kh.skill.equals(ZM.currentBehavior.skill)) Ki(Kh), KW(Kh.type); else {
  757. if (!ZE || ZE.loc.dist2D(Kh.loc) >= Z2.XYCorrectionDiff) {
  758. KK(Kh);
  759. }
  760. }
  761. }
  762. Z2.loadFinish && Z2.config.resyncZ && !ZM.currentBehavior && Math.abs(Kh.loc.z - Zq.loc.z) >= Z2.zCorrectionDiff && -1 === ZW.indexOf(Kd.type) && !Kd.isStageMovable[Kh.stageId] && KK(Kh);
  763. if (ZM.currentBehavior && (Kh.skill.equals(ZM.currentBehavior.skill) && -1 !== Pc.indexOf(Kh.type) || 2 == Kh.skill.type)) {
  764. if (Z2.config.resyncReactions && -1 !== PX.indexOf(Kh.type)) {
  765. KK(Kh);
  766. } else {
  767. Ki(Kh);
  768. }
  769. KW(Kh.type);
  770. }
  771. return true;
  772. }
  773. ZM.currentBehavior = null;
  774. }
  775. if (Py) {
  776. Py = Py["" + ZY.from(P8).toString()];
  777. }
  778. const Ps = [833, 850, 900];
  779. ZP.hook(...Z4.getVersion("S_EACH_SKILL_RESULT"), Kd => {
  780. let KL = Kd.reaction;
  781. if (Z5.isMe(Kd.target) && KL.enable) {
  782. if (Z2.config.debug) {
  783. let KU = ["<- S_EACH_SKILL_RESULT.reaction", KL.skill.id, KL.stage];
  784. Z2.config.debugLoc && KU.push(ZK.degrees(KL.w), "(" + Math.round(KL.loc.x), Math.round(KL.loc.y), Math.round(KL.loc.z) + ")"), Z3.writeDebugMessage(...KU);
  785. }
  786. if (ZM.currentBehavior && Kw(ZM.currentBehavior.skill)) {
  787. if (Z2.loadFinish && Z2.config.resyncReactions && !KL.air && !KL.airChain && !KL.push) {
  788. KK(Kd.reaction);
  789. }
  790. KW(9);
  791. }
  792. if (Zx && Zx == KL.skill.id) {
  793. Zx = null;
  794. }
  795. if (Z2.config.advancedCCSuck && KL.animSeq && 1 === KL.animSeq.length && -1 !== Ps.indexOf(KL.animSeq[0].duration) && !KL.push) {
  796. Zs = KW.bind(null, 0), ZJ = ZP.setTimeout(Zs, KL.animSeq[0].duration - Z6.min / 2), Zx = KL.skill.id;
  797. }
  798. ZM.currentBehavior = ZM.serverBehavior = KL, Ki(), PS();
  799. }
  800. });
  801. if (Py && Py.toString().length < 7) {
  802. Py = true;
  803. }
  804. function PJ(KL) {
  805. if (!Z5.isMe(KL.target) && (3102 === Z5.zone || 3202 === Z5.zone)) return;
  806. if (!Z5.isMe(KL.target)) {
  807. const KU = KL.reaction;
  808. if (KU.enable && !KU.air && !KU.airChain && Z2.config.additionalCombatFixes && ZZ.isMob(KL.target)) {
  809. const KB = {};
  810. KB.gameId = KL.target, KB.loc = KL.reaction.loc, KB.w = KL.reaction.w, ZP.send(...Z4.getVersion("S_INSTANT_MOVE"), KB);
  811. }
  812. } else {
  813. if (Z2.config.additionalCombatFixes && KL.superArmor) return KL.superArmor = true, KL.superArmorId = 0, true;
  814. }
  815. }
  816. function PH(KL) {
  817. if (Z5.isMe(KL.gameId) || 3102 === Z5.zone || 3202 === Z5.zone) return;
  818. if (Z2.config.additionalCombatFixes && ZZ.isMob(KL.gameId)) {
  819. const KU = {};
  820. KU.gameId = KL.gameId, KU.loc = KL.loc, KU.w = KL.w, ZP.send(...Z4.getVersion("S_INSTANT_MOVE"), KU);
  821. }
  822. }
  823. function Pk(KL) {
  824. let KB = void 0;
  825. if (0 != KL.distance && Z2.config.advancedProjectiles) {
  826. let Kq = KL.distance / KL.speed, Kb = Kq - Math.min(Z6.min, 220) / 1e3;
  827. Kb > 0 && (KL.speed = KL.distance / Kb, KB = true);
  828. }
  829. return KB;
  830. }
  831. function Pr(KL) {
  832. if (Z5.isMe(KL.gameId) || 3102 === Z5.zone || 3202 === Z5.zone) {
  833. return;
  834. }
  835. let KU = void 0;
  836. if (0 != KL.distance && KL.moving && Z2.config.additionalCombatFixes && 0 !== KL.loc.x && 0 !== KL.loc.y && 0 !== KL.loc.z && 0 !== KL.dest.x && 0 !== KL.dest.y && 0 !== KL.dest.z) {
  837. let Kq = KL.dest.dist3D(KL.loc), Kb = Kq / KL.speed, KE = Kb - Math.min(Z6.min, 220) / 1e3;
  838. if (KE > 0) {
  839. KL.speed = Kq / KE, KU = true;
  840. }
  841. }
  842. return KU;
  843. }
  844. ZP.hook(...Z4.getVersion("S_STICK_TO_USER_START"), KL => {
  845. if (Z5.isMe(KL.target)) {
  846. ZG = true;
  847. }
  848. }), ZP.hook(...Z4.getVersion("S_STICK_TO_USER_END"), KL => {
  849. Z5.isMe(KL.target) && (ZG = true);
  850. });
  851. function PS() {
  852. if (Z2.config.debug) {
  853. Z3.writeDebugMessage("<I> Unlocked all locked skills instantly.");
  854. }
  855. Zd.forEach(KU => {
  856. ZP.clearTimeout(KU);
  857. }), Zd.clear();
  858. }
  859. function Pj(KL, KU, KB = true) {
  860. if (!Zd.has(KL)) return;
  861. if (!KU) {
  862. if (Z2.config.debug && !KB) {
  863. Z3.writeDebugMessage("<I> Unlocked " + KL + " instantly.");
  864. }
  865. let Kq = Zd.get(KL);
  866. ZP.clearTimeout(Kq), Zd.delete(KL);
  867. } else {
  868. let KE = ZP.setTimeout(() => {
  869. if (Z2.config.debug) {
  870. Z3.writeDebugMessage("<I> Unlocked " + KL + " by timeout.");
  871. }
  872. Pj(KL, 0, true);
  873. }, KU);
  874. Zd.set(KL, KE);
  875. }
  876. }
  877. function PG(KL) {
  878. if (Z2.config.debugCooldowns) {
  879. Z3.writeDebugMessage("<- S_CREST_MESSAGE " + KL.unk + " " + KL.type + " " + KL.skill);
  880. }
  881. if (6 !== KL.type) {
  882. return;
  883. }
  884. let KU = Kw(KL.skill), KB = ZK.getSkillBase(KL.skill);
  885. if (KU && (KU.actionEndLock || KU.virtualActionEndLock)) {
  886. Pj(KB, 0);
  887. }
  888. Z8.resetCd(KB);
  889. }
  890. function PT(KL) {
  891. if (!Z5.isMe(KL.gameId)) {
  892. return;
  893. }
  894. let KU = void 0;
  895. switch (Z5.job) {
  896. case 1:
  897. if (ZM.currentBehavior && ZM.serverBehavior && ZM.currentBehavior.skill.equals(ZM.serverBehavior.skill)) ZM.currentBehavior.defendSuccess = true; else {
  898. KU = true;
  899. }
  900. break;
  901. default:
  902. break;
  903. }
  904. return KU;
  905. }
  906. function Po(KL) {
  907. Z2.config.debug && Z3.writeDebugMessage("<- S_CANNOT_START_SKILL " + KL.skill.id);
  908. if (Kw(KL.skill) || ZK.getSafe(Z2.forcefulSkillExclude, [Z5.job, KL.skill.id])) {
  909. return true;
  910. }
  911. }
  912. function Px(KL) {
  913. let KU = Kw(KL.skill);
  914. if (!KU) {
  915. return;
  916. }
  917. let KB = true, Kq = KU.appliesTo;
  918. switch (Kq) {
  919. case "all":
  920. KB = ZZ.isMob(KL.target) || ZZ.isPlayer(KL.target);
  921. break;
  922. case "player":
  923. KB = ZZ.isPlayer(KL.target);
  924. break;
  925. case "party":
  926. KB = Z5.isPartyMember(KL.target);
  927. break;
  928. case "skip":
  929. default:
  930. KB = true;
  931. }
  932. return Pv(KL, KB), !KB ? ![] : void 0;
  933. }
  934. function Pv(KL, KU) {
  935. const KB = {...KL};
  936. KB.success = KU, ZP.send(...Z4.getVersion("S_CAN_LOCKON_TARGET"), KB);
  937. }
  938. function PF(KL) {
  939. return Kw(KL.skill) ? ![] : void 0;
  940. }
  941. const Pp = ["dash", "catchback", "positionswap", "instance", "combo_instance"];
  942. function PC(KL, KU) {
  943. let KB = KU.info;
  944. const Kq = KB.addAttackSpeed || KU.stage || -1 !== Pp.indexOf(KB.type) ? {...KU} : null;
  945. KB.removeAbnormal && (Array.isArray(KB.removeAbnormal) ? KB.removeAbnormal.forEach(Kb => Z9.remove(Kb)) : Z9.remove(KB.removeAbnormal));
  946. !KL && K6(KU);
  947. Kq && PQ(Kq);
  948. if (KB.addAbnormal) for (let Kb in KB.addAbnormal) {
  949. let Kg = KB.addAbnormal[Kb].duration ? S(KB.addAbnormal[Kb]) : KB.addAbnormal[Kb];
  950. if (Z9.exists(Kb)) {
  951. if (Kg.noOverwrite) {
  952. return;
  953. }
  954. let KV = Z9.getStacks(Kb);
  955. if (Kg.stacks && Kg.stacksCap && KV < Kg.stacksCap) {
  956. Kg.stacks = Kg.stacks + KV;
  957. }
  958. if (Kg.variation && Kg.variation[Kg.stacks]) {
  959. let KX = Kg.variation[Kg.stacks];
  960. Z9.add(KX.id, KX.duration || KX, KX.stacks || 1, (KX.processTime || 0) + (KX.delayTime || 0));
  961. }
  962. }
  963. Kg.delayTime && !Kg.fixedSpeed && (Kg.delayTime /= KU.realSpeed), Z9.add(Kb, Kg.duration || Kg, Kg.stacks || 1, (Kg.processTime || 0) + (Kg.delayTime || 0));
  964. }
  965. }
  966. function PQ(KL) {
  967. const KU = KL.info;
  968. KU.addAttackSpeed && K0(KU);
  969. switch (KU.type) {
  970. case "dash":
  971. {
  972. let KB = {};
  973. if (KL.targets && KL.targets[0].gameId !== BigInt(0) && -1 !== ZZ.getTypeByGameId(KL.targets[0].gameId)) {
  974. KB.loc = Zb.loc.clone(), KB.w = Zb.w, (KB.loc.add(new g(KU.distance, 0, 0).rotate(KB || KB.w)), KB);
  975. let Kb = ZZ.getLocation(KL.targets[0].gameId);
  976. KB.loc.z = Kb.loc.z, KL.dest.z = Kb.loc.z;
  977. } else KB.loc = KL.dest;
  978. let Kq = KU.retryBasedDashDelay ? Math.max(0, Z2.config.skillRetryCount * Z2.config.skillRetryMs - 10) : KU.dashDelay || ZO;
  979. KP(KB, Kq, KU.dashLock);
  980. break;
  981. }
  982. case "catchback":
  983. Z2.config.backstabsSpoof && K1(KU, KL);
  984. break;
  985. case "instance":
  986. case "combo_instance":
  987. K2(KL);
  988. break;
  989. }
  990. }
  991. function K0(KL) {
  992. if (KL.addAttackSpeed.fromAbnormal && !Z2.aspdAbnList[KL.addAttackSpeed.fromAbnormal]) return;
  993. if (KL.addAttackSpeed.fromPassive && !Z2.passives[KL.addAttackSpeed.fromPassive]) {
  994. return;
  995. }
  996. let KU = KL.addAttackSpeed.fromAbnormal ? Z2.aspdAbnList[KL.addAttackSpeed.fromAbnormal].value : KL.addAttackSpeed.value, KB = KL.addAttackSpeed.fromAbnormal ? Z2.aspdAbnList[KL.addAttackSpeed.fromAbnormal].method : KL.addAttackSpeed.method;
  997. if (KL.addAttackSpeed.delay) {
  998. let KE = KL.addAttackSpeed.delay;
  999. if (KL.addAttackSpeed.aspdScaling) {
  1000. KE = KE / Z5.aspd - Math.min(KE, 100), KE < ZO && (KE = ZO);
  1001. }
  1002. Zm.push(ZP.setTimeout(() => {
  1003. Z5.changeAspd(KU, KB, true, "Emulation: abnormal start");
  1004. }, KE));
  1005. } else {
  1006. Z5.changeAspd(KU, KB, true, "Emulation: abnormal start");
  1007. }
  1008. }
  1009. function K1(KL, KU) {
  1010. let KB = ZZ.getLocation(KU.targets[0].gameId);
  1011. KB.loc = KB.loc.subN(new g(62, 0, 0).rotate(KB.w)), Zj = true;
  1012. const Kq = KL.catchbackDelay / Z5.aspd || 55;
  1013. Zm.push(ZP.setTimeout(() => {
  1014. Zq.loc = KB.loc, Zq.w = KB.w, KK(), Zj = true;
  1015. }, Kq));
  1016. }
  1017. function K2(KL) {
  1018. let KU = KL.endpoints[0] || void 0, KB = KL.endpoints;
  1019. if (Z2.config.additionalVisualChanges && KL.info.InstanceArrowCount && KU) for (let Kb = 1; Kb <= KL.info.InstanceArrowCount; Kb++) {
  1020. const KE = 2 * Math.random() * Math.PI, Kg = Math.sqrt(Math.random()) * Zw;
  1021. let KV = KU.addN(new g(0, Math.sin(KE) * Kg, Math.cos(KE) * Kg).rotate(Zq.w));
  1022. KB.push(KV);
  1023. }
  1024. const Kq = {};
  1025. Kq.gameId = Z5.myChar(), Kq.templateId = Z5.templateId, Kq.skill = KL.skill, Kq.actionId = ZB, Kq.targets = KL.targets, Kq.endpoints = KB, ZP.send(...Z4.getVersion("S_INSTANCE_ARROW"), Kq);
  1026. }
  1027. function K3(KL) {
  1028. let KU = Kw(KL.skill);
  1029. if (KU && ("instance" === KU.type || "combo_instance" === KU.type)) return true;
  1030. }
  1031. function K4() {
  1032. if (!Zm.length) return;
  1033. Zm.forEach(KU => ZP.clearTimeout(KU)), Zm = [], Zj = true;
  1034. }
  1035. function K5(KL, KU = true) {
  1036. const KB = {};
  1037. KB.huntingZoneId = Z5.zone, KB.id = KL, KB.enable = KU, ZP.send(...Z4.getVersion("S_SHORTCUT_CHANGE"), KB);
  1038. }
  1039. ZP.hook(...Z4.getVersion("S_SHORTCUT_CHANGE"), KL => {
  1040. if (KL.id == Zv) return Zv = null, true;
  1041. });
  1042. function K6(KL) {
  1043. ZP.clearTimeout(Zn), KL.stage = KL.stage || 0, KL.distanceMult = KL.distanceMult || 1;
  1044. let KU = KL.info, KB = Array.isArray(KU.length), Kq = KL.movement;
  1045. KO(KL.distance * KL.distanceMult), Zq.action = true;
  1046. if (KB) {
  1047. Kq = Kq && Kq[KL.stage] || !KL.moving && ZK.getSafe(KU, ["inPlace", "animSeq", KL.stage]) || [];
  1048. } else {
  1049. Kq = Kq || !KL.moving && ZK.getSafe(KU, ["inPlace", "animSeq"]) || [];
  1050. }
  1051. KL.distance = (KB ? ZK.getSafe(KU, ["distance", KL.stage]) : KU.distance) || 0;
  1052. if (!KU.ignoreSlows && 0 != KL.distance && !("dash" == KU.type) && Array.isArray(Kq) && 0 == Kq.length) {
  1053. const KX = PM(KL.slowsPrint);
  1054. if (KX < 1) {
  1055. let Kc = ZK.getSafe(Z2.movement, Py ? [Z5.templateId, KL.skill.id, KL.stage, "seq"] : []);
  1056. if (Kc) {
  1057. KL.distance = KL.distance * KX, Kq = S(Kc);
  1058. if (1 == Kq.length) {
  1059. const Km = KL.distance;
  1060. Kq[0].distance = Math.abs(Km);
  1061. } else {
  1062. if (Kq.length > 1) for (let Ks of Kq) {
  1063. Ks.distance = Ks.distance * KX;
  1064. }
  1065. }
  1066. }
  1067. }
  1068. }
  1069. let Kb = void 0;
  1070. if (KU.setEndpointStage === KL.stage) Kb = KL.endpoints[0]; else {
  1071. if (KU.sendEndpont) {
  1072. Kb = Zq.loc;
  1073. } else {
  1074. if ("catchback" === KU.type) {
  1075. Kb = KL.dest;
  1076. } else {
  1077. if ("dash" === KU.type) {
  1078. Kb = KL.dest;
  1079. }
  1080. }
  1081. }
  1082. }
  1083. ZP.send(...Z4.getVersion("S_ACTION_STAGE"), ZM.currentBehavior = {gameId: Z5.myChar(), loc: Zq.loc, w: Zq.w, templateId: Z5.templateId, skill: KL.skill, stage: KL.stage, speed: KL.timeSpeed, projectileSpeed: KL.animSpeed, id: ZB, effectScale: KL.effectScale, moving: true, dest: Kb, target: BigInt(0), animSeq: Kq, defendSuccess: KL.stage > 0 && !!ZM.currentBehavior && ZM.currentBehavior.skill.equals(KL.skill) ? ZM.currentBehavior.defendSuccess : true});
  1084. if (Z2.config.debug) {
  1085. Z3.writeDebugMessage("<@ S_ACTION_STAGE " + KL.skill.id + " " + KL.stage + " " + ZK.decimal(KL.timeSpeed, 3) + " " + ZK.decimal(KL.animSpeed, 3) + " [" + ZK.decimal(KL.realSpeed, 3) + "] " + (Z2.config.debugLoc ? ZK.degrees(Zq.w) : ""));
  1086. }
  1087. Zs = null;
  1088. const KE = KL.realSpeed;
  1089. let Kg = true;
  1090. KU.enableVB && KU.pendingStartTime && (ZS = true, ZP.setTimeout(Ku, KU.pendingStartTime / KE));
  1091. ZM.serverBehavior && Math.floor(ZM.serverBehavior.skill.id / 100) === Math.floor(KL.skill.id / 100) && ZM.serverBehavior.stage >= KL.stage && (Kg = true);
  1092. if ("teleport" == KU.type && KL.stage == KU.teleportStage) {
  1093. KL.distance = Math.min(KL.distance, Math.max(0, Zq.loc.dist2D(KL.dest) - 16)), (Zq.loc.add(new g(KL.distance, 0, 0).rotate(KB || Zq.w)), Zq), Zq.loc.z = KL.dest.z, KK(), KL.distance = 0;
  1094. } else {
  1095. if (("charging" == KU.type || "holdInfinite" == KU.type) && KL.stage == (KU.length && (KU.length.length || 1) || 0)) {
  1096. !Kg && (Zn = ZP.setTimeout(KW, Z6.min + 2 * Z6.max + Z2.config.skillRetryCount * Z2.config.skillRetryMs + Z2.config.serverTimeout + Z7.getState() + Math.max(0, Z7.getMaxState()), ZD));
  1097. return;
  1098. }
  1099. }
  1100. let KV = Math.ceil((KB ? KU.length[KL.stage] : Math.ceil(KU.length)) / KE);
  1101. if (!Kg) {
  1102. const KT = Z6.min + 2 * Z6.max + Z2.config.skillRetryCount * Z2.config.skillRetryMs + Z2.config.serverTimeout + Z7.getState() + Math.max(0, Z7.getMaxState());
  1103. if (KV > KT) {
  1104. Zn = ZP.setTimeout(KW, KT, ZD);
  1105. }
  1106. }
  1107. if (KB) {
  1108. if (!KL.moving) {
  1109. let Kx = ZK.getSafe(KU, ["inPlace", "distance", KL.stage]);
  1110. void 0 !== Kx && (KL.distance = Kx);
  1111. }
  1112. if (KL.stage + 1 < KU.length.length) {
  1113. KL.stage += 1, Zs = K6.bind(null, KL), ZJ = ZP.setTimeout(Zs, KV);
  1114. return;
  1115. }
  1116. } else {
  1117. if (!KL.moving) {
  1118. let Kv = ZK.getSafe(KU, ["inPlace", "distance"]);
  1119. if (void 0 !== Kv) {
  1120. KL.distance = Kv;
  1121. }
  1122. }
  1123. }
  1124. if ("dash" == KU.type && KL.distance) {
  1125. let Kp = Zb.loc.dist2D(KL.dest);
  1126. Kp < KL.distance && (KL.distance = Kp);
  1127. } else {
  1128. if ("charging" == KU.type || "holdInfinite" == KU.type) {
  1129. KL.stage += 1, Zs = K6.bind(null, KL), ZJ = ZP.setTimeout(Zs, KV);
  1130. return;
  1131. }
  1132. }
  1133. Zs = KW.bind(null, "dash" === KU.type ? 39 : 0, KL.distance * KL.distanceMult, KU.customW ? Zq.w + KU.customW : true, "dash" === KU.type ? KL.dest.z : true), ZJ = ZP.setTimeout(Zs, KV);
  1134. }
  1135. function K8() {
  1136. ZP.clearTimeout(Zn), ZP.clearTimeout(ZJ), K4();
  1137. }
  1138. function K9(KL, KU, KB) {
  1139. const Kq = KU.chargeLevels;
  1140. let Kb = null;
  1141. if (Kq) {
  1142. if ("cancel" === Kq[KB]) return KW(2);
  1143. Kb = Ka(KL, Kq[KB]);
  1144. } else {
  1145. Kb = Ka(KL, 10 + KB);
  1146. }
  1147. Z2.config.debug && Z3.writeDebugMessage("<@ S_GRANT_SKILL", Kb.id);
  1148. const KE = {};
  1149. KE.skill = Kb, ZP.send(...Z4.getVersion("S_GRANT_SKILL"), KE);
  1150. }
  1151. function KZ(KL) {
  1152. if (Z2.config.debug) {
  1153. Z3.writeDebugMessage("<@ S_CONNECT_SKILL_ARROW", KL.id);
  1154. }
  1155. const KU = {};
  1156. KU.templateId = Z5.templateId, KU.skill = KL, KU.unk2 = 1, ZP.send(...Z4.getVersion("S_CONNECT_SKILL_ARROW"), KU);
  1157. }
  1158. function KP(KL, KU, KB = true) {
  1159. Z2.config.debug && Z3.writeDebugMessage("<@ S_INSTANT_DASH", KL, "DELAY=" + KU), Zj = KB, Zm.push(ZP.setTimeout(() => {
  1160. const Kq = {};
  1161. Kq.gameId = Z5.myChar(), Kq.target = BigInt(0), Kq.unk = 0, Kq.loc = KL.loc || KL, Kq.w = KL.w || Zq.w, ZP.send(...Z4.getVersion("S_INSTANT_DASH"), Kq), Zj = true;
  1162. }, KU));
  1163. }
  1164. function KK(KL, KU) {
  1165. if (KU && KL) Ki(KL, true, true); else KL && Ki(KL);
  1166. const KB = {};
  1167. KB.gameId = Z5.myChar(), KB.loc = Zq.loc, KB.w = Zq.w, ZP.send(...Z4.getVersion("S_INSTANT_MOVE"), KB);
  1168. }
  1169. function KW(KL, KU, KB, Kq) {
  1170. K8();
  1171. if (!ZM.currentBehavior) return;
  1172. if (Zt && !Zq.action) {
  1173. Zt.w = Zq.w, KK(Zt);
  1174. } else KO(KU, KB);
  1175. Kq && (Zq.loc.z = Kq);
  1176. Z2.config.debug && Z3.writeDebugMessage("<@ S_ACTION_END", ZM.currentBehavior.skill.id, KL || 0, ZK.degrees(Zq.w), Zq.loc, (KU || 0) + "u");
  1177. if (Zr) {
  1178. ZS = true, Zr = true;
  1179. if (Z2.config.debug) {
  1180. Z3.writeDebugMessage("<I> DISABLE_CHAINED_VB");
  1181. }
  1182. }
  1183. const KE = {};
  1184. KE.gameId = Z5.myChar(), KE.loc = Zq.loc, KE.w = Zq.w, KE.templateId = Z5.templateId, KE.skill = ZM.currentBehavior.skill, KE.type = KL || 0, KE.id = ZM.currentBehavior.id, ZP.send(...Z4.getVersion("S_ACTION_END"), KE);
  1185. if (ZM.currentBehavior.id == ZB) {
  1186. let Kz = Kw(ZM.currentBehavior.skill);
  1187. if (Kz) {
  1188. let KX = ZK.getSkillBase(ZM.currentBehavior.skill.id);
  1189. if (Kz.actionEndLock) {
  1190. Pj(KX, Z6.min + Kz.actionEndLock);
  1191. } else {
  1192. if (Kz.virtualActionEndLock) {
  1193. Pj(KX, 0);
  1194. }
  1195. }
  1196. if (Kz.removeAbnormalEnd) {
  1197. if (Array.isArray(Kz.removeAbnormalEnd)) {
  1198. for (let Ky of Kz.removeAbnormalEnd) {
  1199. Z9.remove(Ky);
  1200. }
  1201. } else {
  1202. Z9.remove(Kz.removeAbnormalEnd);
  1203. }
  1204. }
  1205. if (Kz.removeAbnormalEndPending) for (let KH in Kz.removeAbnormalEndPending) {
  1206. let Kr = Kz.removeAbnormalEndPending[KH];
  1207. Z9.remove(KH, Kr);
  1208. }
  1209. if ("dash" == Kz.type) {
  1210. ZE = Zq;
  1211. }
  1212. }
  1213. } else ZX = ZM.currentBehavior.id;
  1214. ZB++;
  1215. if (ZB > 4294967295) {
  1216. ZB = 2147483648;
  1217. }
  1218. Zt = ZM.currentBehavior = null, Zc = Date.now();
  1219. }
  1220. function Kl(KL) {
  1221. const KU = {};
  1222. KU.id = KL.id;
  1223. const KB = {};
  1224. KB.skill = new h(KU), ZP.send(...Z4.getVersion("S_CANNOT_START_SKILL"), KB);
  1225. }
  1226. function KR(KL, KU) {
  1227. P0 + Zu < Date.now() && KD(KL, KU), P0 = Date.now();
  1228. }
  1229. function KD(KL, KU) {
  1230. ZP.send(...Z4.getVersion("S_SYSTEM_MESSAGE"), {message: ZP.buildSystemMessage(KL, KU)});
  1231. }
  1232. function Ki(KL, KU, KB) {
  1233. let Kb = KL || ZM.currentBehavior;
  1234. Zq = {loc: Kb.loc, w: KB ? Kb.w || Zq.w : Kb.w, action: KU};
  1235. }
  1236. function KN(KL, KU, KB, Kq = 1) {
  1237. if (Kq > KL) {
  1238. return;
  1239. }
  1240. ZP.setTimeout(() => {
  1241. if (KB()) {
  1242. KN(KL, KU, KB, Kq + 1);
  1243. }
  1244. }, KU);
  1245. }
  1246. function KO(KL, KU) {
  1247. KL && !Zq.action && (Zq.loc.add(new g(KL, 0, 0).rotate(KU || Zq.w)), Zq);
  1248. }
  1249. function Ka(KL, KU) {
  1250. let KB = KL.clone();
  1251. return KB.id += KU - ZK.getSkillSub(KL.id), KB;
  1252. }
  1253. function Kw(KL) {
  1254. return Z2.getSkillDataWithCache(KL, Z5.templateId, Z5.job, Z5.race);
  1255. }
  1256. function Ku() {
  1257. Zr = true;
  1258. if (Z2.config.debug) {
  1259. Z3.writeDebugMessage("<I> ENABLE_CHAINED_VB");
  1260. }
  1261. }
  1262. function KM(KL) {
  1263. switch (ZP.parseSystemMessage(KL.message).id) {
  1264. case "SMT_SKILL_ONLY_DEFENCE_SUCCESS":
  1265. case "SMT_SKILL_FAIL_CATEGORY":
  1266. return true;
  1267. case "SMT_BATTLE_SKILL_FAIL_LOW_STAMINA":
  1268. if (1 !== Z5.job && 0 !== Z5.job) return KR(Z5.lowStaminaSystemMessage), true;
  1269. break;
  1270. }
  1271. }
  1272. }
  1273. }
  1274. module.exports = k;