Advertisement
Sarada-L2

Fix Vip Data Day 31 aCis, mega?

Aug 31st, 2023
397
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.81 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P aCis_gameserver
  3. diff --git java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip15days.java
  4. index a8cb40a..7d1872d 100644
  5. --- java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip15days.java
  6. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip15days.java
  7. @@ -66,68 +66,68 @@
  8. if (_daysleft < 30 && _daysleft > 0)
  9. {
  10. while (_daysleft > 0)
  11. {
  12. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  13. calendar.roll(Calendar.MONTH, true);
  14. if (calendar.get(Calendar.DATE) == 30)
  15. {
  16. if (calendar.get(Calendar.MONTH) == 11)
  17. calendar.roll(Calendar.YEAR, true);
  18. calendar.roll(Calendar.MONTH, true);
  19.  
  20. }
  21. calendar.roll(Calendar.DATE, true);
  22. _daysleft--;
  23. }
  24. }
  25.  
  26. end_day = calendar.getTimeInMillis();
  27. VipManager.getInstance().updateVip(activeChar.getObjectId(), end_day);
  28. }
  29. else
  30. {
  31. long end_day;
  32. final Calendar calendar = Calendar.getInstance();
  33. - if (mes >= 30)
  34. + if (mes >= 31)
  35. {
  36. - while (mes >= 30)
  37. + while (mes >= 31)
  38. {
  39. if (calendar.get(Calendar.MONTH) == 11)
  40. calendar.roll(Calendar.YEAR, true);
  41. calendar.roll(Calendar.MONTH, true);
  42. - mes -= 30;
  43. + mes -= 31;
  44. }
  45. }
  46.  
  47. - if (mes < 30 && mes > 0)
  48. + if (mes < 31 && mes > 0)
  49. {
  50. while (mes > 0)
  51. {
  52. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  53. calendar.roll(Calendar.MONTH, true);
  54. - if (calendar.get(Calendar.DATE) == 30)
  55. + if (calendar.get(Calendar.DATE) == 31)
  56. {
  57. if (calendar.get(Calendar.MONTH) == 11)
  58. calendar.roll(Calendar.YEAR, true);
  59. calendar.roll(Calendar.MONTH, true);
  60.  
  61. }
  62. calendar.roll(Calendar.DATE, true);
  63. mes--;
  64. }
  65. }
  66.  
  67. end_day = calendar.getTimeInMillis();
  68. VipManager.getInstance().addVip(activeChar.getObjectId(), end_day);
  69. }
  70.  
  71. long _daysleft;
  72. final long now = Calendar.getInstance().getTimeInMillis();
  73. long duration = VipManager.getInstance().getVipDuration(activeChar.getObjectId());
  74. final long endDay = duration;
  75. _daysleft = ((endDay - now) / 86400000);
  76. if (_daysleft < 270)
  77. {
  78. //activeChar.sendPacket(new ExShowScreenMessage("Your Vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".", 10000));
  79. activeChar.sendMessage("Your vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".");
  80. }
  81. diff --git java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip24h.java
  82. index fced7e6..747a4b6 100644
  83. --- java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip24h.java
  84. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip24h.java
  85. @@ -80,68 +80,68 @@
  86. if (_daysleft < 30 && _daysleft > 0)
  87. {
  88. while (_daysleft > 0)
  89. {
  90. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  91. calendar.roll(Calendar.MONTH, true);
  92. if (calendar.get(Calendar.DATE) == 30)
  93. {
  94. if (calendar.get(Calendar.MONTH) == 11)
  95. calendar.roll(Calendar.YEAR, true);
  96. calendar.roll(Calendar.MONTH, true);
  97.  
  98. }
  99. calendar.roll(Calendar.DATE, true);
  100. _daysleft--;
  101. }
  102. }
  103.  
  104. end_day = calendar.getTimeInMillis();
  105. VipManager.getInstance().updateVip(activeChar.getObjectId(), end_day);
  106. }
  107. else
  108. {
  109. long end_day;
  110. final Calendar calendar = Calendar.getInstance();
  111. - if (mes >= 30)
  112. + if (mes >= 31)
  113. {
  114. - while (mes >= 30)
  115. + while (mes >= 31)
  116. {
  117. if (calendar.get(Calendar.MONTH) == 11)
  118. calendar.roll(Calendar.YEAR, true);
  119. calendar.roll(Calendar.MONTH, true);
  120. - mes -= 30;
  121. + mes -= 31;
  122. }
  123. }
  124.  
  125. - if (mes < 30 && mes > 0)
  126. + if (mes < 31 && mes > 0)
  127. {
  128. while (mes > 0)
  129. {
  130. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  131. calendar.roll(Calendar.MONTH, true);
  132. - if (calendar.get(Calendar.DATE) == 30)
  133. + if (calendar.get(Calendar.DATE) == 31)
  134. {
  135. if (calendar.get(Calendar.MONTH) == 11)
  136. calendar.roll(Calendar.YEAR, true);
  137. calendar.roll(Calendar.MONTH, true);
  138.  
  139. }
  140. calendar.roll(Calendar.DATE, true);
  141. mes--;
  142. }
  143. }
  144.  
  145. end_day = calendar.getTimeInMillis();
  146. VipManager.getInstance().addVip(activeChar.getObjectId(), end_day);
  147. }
  148.  
  149. long _daysleft;
  150. final long now = Calendar.getInstance().getTimeInMillis();
  151. long duration = VipManager.getInstance().getVipDuration(activeChar.getObjectId());
  152. final long endDay = duration;
  153. _daysleft = ((endDay - now) / 86400000);
  154. if (_daysleft < 270)
  155. {
  156. //activeChar.sendPacket(new ExShowScreenMessage("Your Vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".", 10000));
  157. activeChar.sendMessage("Your vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".");
  158. }
  159. diff --git java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip30days.java
  160. index 0f168b6..3a846a3 100644
  161. --- java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip30days.java
  162. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip30days.java
  163. @@ -66,68 +66,68 @@
  164. if (_daysleft < 30 && _daysleft > 0)
  165. {
  166. while (_daysleft > 0)
  167. {
  168. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  169. calendar.roll(Calendar.MONTH, true);
  170. if (calendar.get(Calendar.DATE) == 30)
  171. {
  172. if (calendar.get(Calendar.MONTH) == 11)
  173. calendar.roll(Calendar.YEAR, true);
  174. calendar.roll(Calendar.MONTH, true);
  175.  
  176. }
  177. calendar.roll(Calendar.DATE, true);
  178. _daysleft--;
  179. }
  180. }
  181.  
  182. end_day = calendar.getTimeInMillis();
  183. VipManager.getInstance().updateVip(activeChar.getObjectId(), end_day);
  184. }
  185. else
  186. {
  187. long end_day;
  188. final Calendar calendar = Calendar.getInstance();
  189. - if (mes >= 30)
  190. + if (mes >= 31)
  191. {
  192. - while (mes >= 30)
  193. + while (mes >= 31)
  194. {
  195. if (calendar.get(Calendar.MONTH) == 11)
  196. calendar.roll(Calendar.YEAR, true);
  197. calendar.roll(Calendar.MONTH, true);
  198. - mes -= 30;
  199. + mes -= 31;
  200. }
  201. }
  202.  
  203. - if (mes < 30 && mes > 0)
  204. + if (mes < 31 && mes > 0)
  205. {
  206. while (mes > 0)
  207. {
  208. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  209. calendar.roll(Calendar.MONTH, true);
  210. - if (calendar.get(Calendar.DATE) == 30)
  211. + if (calendar.get(Calendar.DATE) == 31)
  212. {
  213. if (calendar.get(Calendar.MONTH) == 11)
  214. calendar.roll(Calendar.YEAR, true);
  215. calendar.roll(Calendar.MONTH, true);
  216.  
  217. }
  218. calendar.roll(Calendar.DATE, true);
  219. mes--;
  220. }
  221. }
  222.  
  223. end_day = calendar.getTimeInMillis();
  224. VipManager.getInstance().addVip(activeChar.getObjectId(), end_day);
  225. }
  226.  
  227. long _daysleft;
  228. final long now = Calendar.getInstance().getTimeInMillis();
  229. long duration = VipManager.getInstance().getVipDuration(activeChar.getObjectId());
  230. final long endDay = duration;
  231. _daysleft = ((endDay - now) / 86400000);
  232. if (_daysleft < 270)
  233. {
  234. //activeChar.sendPacket(new ExShowScreenMessage("Your Vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".", 10000));
  235. activeChar.sendMessage("Your vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".");
  236. }
  237. diff --git java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip7days.java
  238. index e7da521..e376a8e 100644
  239. --- java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip7days.java
  240. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/custom/Vip7days.java
  241. @@ -80,68 +80,68 @@
  242. if (_daysleft < 30 && _daysleft > 0)
  243. {
  244. while (_daysleft > 0)
  245. {
  246. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  247. calendar.roll(Calendar.MONTH, true);
  248. if (calendar.get(Calendar.DATE) == 30)
  249. {
  250. if (calendar.get(Calendar.MONTH) == 11)
  251. calendar.roll(Calendar.YEAR, true);
  252. calendar.roll(Calendar.MONTH, true);
  253.  
  254. }
  255. calendar.roll(Calendar.DATE, true);
  256. _daysleft--;
  257. }
  258. }
  259.  
  260. end_day = calendar.getTimeInMillis();
  261. VipManager.getInstance().updateVip(activeChar.getObjectId(), end_day);
  262. }
  263. else
  264. {
  265. long end_day;
  266. final Calendar calendar = Calendar.getInstance();
  267. - if (mes >= 30)
  268. + if (mes >= 31)
  269. {
  270. - while (mes >= 30)
  271. + while (mes >= 31)
  272. {
  273. if (calendar.get(Calendar.MONTH) == 11)
  274. calendar.roll(Calendar.YEAR, true);
  275. calendar.roll(Calendar.MONTH, true);
  276. - mes -= 30;
  277. + mes -= 31;
  278. }
  279. }
  280.  
  281. - if (mes < 30 && mes > 0)
  282. + if (mes < 31 && mes > 0)
  283. {
  284. while (mes > 0)
  285. {
  286. if (calendar.get(Calendar.DATE) == 28 && calendar.get(Calendar.MONTH) == 1)
  287. calendar.roll(Calendar.MONTH, true);
  288. - if (calendar.get(Calendar.DATE) == 30)
  289. + if (calendar.get(Calendar.DATE) == 31)
  290. {
  291. if (calendar.get(Calendar.MONTH) == 11)
  292. calendar.roll(Calendar.YEAR, true);
  293. calendar.roll(Calendar.MONTH, true);
  294.  
  295. }
  296. calendar.roll(Calendar.DATE, true);
  297. mes--;
  298. }
  299. }
  300.  
  301. end_day = calendar.getTimeInMillis();
  302. VipManager.getInstance().addVip(activeChar.getObjectId(), end_day);
  303. }
  304.  
  305. long _daysleft;
  306. final long now = Calendar.getInstance().getTimeInMillis();
  307. long duration = VipManager.getInstance().getVipDuration(activeChar.getObjectId());
  308. final long endDay = duration;
  309. _daysleft = ((endDay - now) / 86400000);
  310. if (_daysleft < 270)
  311. {
  312. //activeChar.sendPacket(new ExShowScreenMessage("Your Vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".", 10000));
  313. activeChar.sendMessage("Your vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".");
  314. }
  315. diff --git java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedVipFree.java
  316. index 919dcf7..c3e1f30 100644
  317. --- java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedVipFree.java
  318. +++ java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/VoicedVipFree.java
  319. @@ -85,71 +85,71 @@
  320. {
  321. while (_daysleft > 0L)
  322. {
  323. if ((calendar.get(5) == 28) && (calendar.get(2) == 1))
  324. {
  325. calendar.roll(2, true);
  326. }
  327. if (calendar.get(5) == 30)
  328. {
  329. if (calendar.get(2) == 11)
  330. {
  331. calendar.roll(1, true);
  332. }
  333. calendar.roll(2, true);
  334. }
  335. calendar.roll(5, true);
  336. _daysleft -= 1L;
  337. }
  338. }
  339. long end_day = calendar.getTimeInMillis();
  340. VipManager.getInstance().updateVip(activeChar.getObjectId(), end_day);
  341. }
  342. else
  343. {
  344. Calendar calendar = Calendar.getInstance();
  345. - if (activeChar._vip_days >= 30)
  346. + if (activeChar._vip_days >= 31)
  347. {
  348. - while (activeChar._vip_days >= 30)
  349. + while (activeChar._vip_days >= 31)
  350. {
  351. if (calendar.get(2) == 11)
  352. {
  353. calendar.roll(1, true);
  354. }
  355. calendar.roll(2, true);
  356. - activeChar._vip_days -= 30;
  357. + activeChar._vip_days -= 31;
  358. }
  359. }
  360. - if ((activeChar._vip_days < 30) && (activeChar._vip_days > 0))
  361. + if ((activeChar._vip_days < 31) && (activeChar._vip_days > 0))
  362. {
  363. while (activeChar._vip_days > 0)
  364. {
  365. if ((calendar.get(5) == 28) && (calendar.get(2) == 1))
  366. {
  367. calendar.roll(2, true);
  368. }
  369. - if (calendar.get(5) == 30)
  370. + if (calendar.get(5) == 31)
  371. {
  372. if (calendar.get(2) == 11)
  373. {
  374. calendar.roll(1, true);
  375. }
  376. calendar.roll(2, true);
  377. }
  378. calendar.roll(5, true);
  379. activeChar._vip_days -= 1;
  380. }
  381. }
  382. long end_day = calendar.getTimeInMillis();
  383. VipManager.getInstance().addVip(activeChar.getObjectId(), end_day);
  384. }
  385. long now = Calendar.getInstance().getTimeInMillis();
  386. long duration = VipManager.getInstance().getVipDuration(activeChar.getObjectId());
  387. long endDay = duration;
  388. long _daysleft = (endDay - now) / 86400000L;
  389. if (_daysleft < 270L)
  390. {
  391. //activeChar.sendPacket(new ExShowScreenMessage("Your Vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".", 10000));
  392. activeChar.sendMessage("Your Vip privileges ends at " + new SimpleDateFormat("dd MMM, HH:mm").format(new Date(duration)) + ".");
  393. }
  394.  
  395. //}
  396.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement