Advertisement
Sarada-L2

Vip System+Vip 2 Click Acis 394+

Mar 2nd, 2021
1,169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.91 KB | None | 0 0
  1. diff --git a/config/CustomMods/Donate.ini b/config/CustomMods/Donate.ini
  2. index e69de29..71feaed 100644
  3. --- a/config/CustomMods/Donate.ini
  4. +++ b/config/CustomMods/Donate.ini
  5. @@ -0,0 +1,59 @@
  6. +#=============================================================
  7. +# VIP System
  8. +#=============================================================
  9. +EnableVipSystem = True
  10. +
  11. +# Enable / Disable Name Color
  12. +AllowVipNameColor = True
  13. +VipNameColor = 88AA88
  14. +
  15. +# Enable / Disable Title Color
  16. +AllowVipTitleColor = True
  17. +VipTitleColor = 88AA88
  18. +
  19. +# VIP Xp/Sp Rate
  20. +VIPXpSpRate = 1.5
  21. +# VIP Adena rate
  22. +VIPAdenaRate = 1.5
  23. +# VIP drop rate
  24. +VIPDropRate = 1.5
  25. +# VIP spoil rate
  26. +VIPSpoilRate = 1.5
  27. +
  28. +#Mensagem vip ao entrar em game
  29. +ScreenVIPMessageText = voce e vip por:
  30. +#Tempo de mensagem na tela
  31. +ScreenVIPMessageTime = 4
  32. +
  33. +#Mensagem quando acabar o periodo vip
  34. +ScreenVIPMessageExitText = seu periodo VIP terminou!
  35. +#Tempo de mensagem na tela Exit
  36. +ScreenVIPMessageTimeExit = 4
  37. +
  38. +#=============================================================
  39. +# VIP Item 1
  40. +#=============================================================
  41. +#registrar esse nome no item no xml abaixo
  42. +#<set name="handler" val="VipCoin" />
  43. +#Item Coin 1
  44. +VipCoin = 0
  45. +VipCoinDays = 1
  46. +
  47. +#=============================================================
  48. +# VIP Item 2
  49. +#=============================================================
  50. +#registrar esse nome no item no xml abaixo
  51. +#<set name="handler" val="VipCoin" />
  52. +#Item Coin 2
  53. +VipCoin2 = 0
  54. +VipCoinDays2 = 30
  55. +
  56. +#=============================================================
  57. +# VIP Item 3
  58. +#=============================================================
  59. +#registrar esse nome no item no xml abaixo
  60. +#<set name="handler" val="VipCoin" />
  61. +#Item Coin 3
  62. +VipCoin3 = 0
  63. +VipCoinDays3 = 45
  64. +
  65. diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
  66. index 53f4314..574f9e0 100644
  67. --- a/java/net/sf/l2j/Config.java
  68. +++ b/java/net/sf/l2j/Config.java
  69. @@ -43,6 +43,7 @@
  70. public static final String FLAGZONEMOD = "./config/CustomMods/FlagZone.ini";
  71. public static final String OFFLINEMOD = "./config/CustomMods/OfflineShop.ini";
  72. public static final String PROTECTION_MODS = "./config/CustomMods/ProtectionMods.ini";
  73. + public static final String DONATEMODS = "./config/CustomMods/Donate.ini";
  74. // --------------------------------------------------
  75. // Clans settings
  76. // --------------------------------------------------
  77. @@ -534,7 +535,25 @@
  78. public static boolean SERVER_LIST_TESTSERVER;
  79. public static boolean SERVER_LIST_PVPSERVER;
  80. public static boolean SERVER_GMONLY;
  81. -
  82. + public static boolean ENABLE_VIP_SYSTEM;
  83. + public static boolean ALLOW_VIP_NCOLOR;
  84. + public static int VIP_NCOLOR;
  85. + public static boolean ALLOW_VIP_TCOLOR;
  86. + public static int VIP_TCOLOR;
  87. + public static float VIP_XP_SP_RATE;
  88. + public static float VIP_ADENA_RATE;
  89. + public static float VIP_DROP_RATE;
  90. + public static float VIP_SPOIL_RATE;
  91. + public static String MESSAGE_VIP_ENTER;
  92. + public static int MESSAGE_TIME_VIP;
  93. + public static String MESSAGE_VIP_EXIT;
  94. + public static int MESSAGE_EXIT_VIP_TIME;
  95. + public static int VIP_COIN_ID1;
  96. + public static int VIP_DAYS_ID1;
  97. + public static int VIP_COIN_ID2;
  98. + public static int VIP_DAYS_ID2;
  99. + public static int VIP_COIN_ID3;
  100. + public static int VIP_DAYS_ID3;
  101. /** clients related */
  102. public static int DELETE_DAYS;
  103. public static int MAXIMUM_ONLINE_USERS;
  104. @@ -1188,6 +1207,30 @@
  105.  
  106. }
  107.  
  108. + private static final void loadDonate()
  109. + {
  110. + final ExProperties Donate = initProperties(DONATEMODS);
  111. + ENABLE_VIP_SYSTEM = Boolean.parseBoolean(Donate.getProperty("EnableVipSystem", "True"));
  112. + ALLOW_VIP_NCOLOR = Boolean.parseBoolean(Donate.getProperty("AllowVipNameColor", "True"));
  113. + VIP_NCOLOR = Integer.decode("0x" + Donate.getProperty("VipNameColor", "88AA88"));
  114. + ALLOW_VIP_TCOLOR = Boolean.parseBoolean(Donate.getProperty("AllowVipTitleColor", "True"));
  115. + VIP_TCOLOR = Integer.decode("0x" + Donate.getProperty("VipTitleColor", "88AA88"));
  116. + VIP_XP_SP_RATE = Float.parseFloat(Donate.getProperty("VIPXpSpRate", "1.5"));
  117. + VIP_ADENA_RATE = Float.parseFloat(Donate.getProperty("VIPAdenaRate", "1.5"));
  118. + VIP_DROP_RATE = Float.parseFloat(Donate.getProperty("VIPDropRate", "1.5"));
  119. + VIP_SPOIL_RATE = Float.parseFloat(Donate.getProperty("VIPSpoilRate", "1.5"));
  120. + MESSAGE_VIP_ENTER = Donate.getProperty("ScreenVIPMessageText", "Forbidden to Use Enchant near the bank!");
  121. + MESSAGE_TIME_VIP = Integer.parseInt(Donate.getProperty("ScreenVIPMessageTime", "6")) * 1000;
  122. + MESSAGE_VIP_EXIT = Donate.getProperty("ScreenVIPMessageExitText", "Forbidden to Use Enchant near the bank!");
  123. + MESSAGE_EXIT_VIP_TIME = Integer.parseInt(Donate.getProperty("ScreenVIPMessageTimeExit", "6")) * 1000;
  124. + VIP_COIN_ID1 = Integer.parseInt(Donate.getProperty("VipCoin", "6392"));
  125. + VIP_DAYS_ID1 = Integer.parseInt(Donate.getProperty("VipCoinDays", "1"));
  126. + VIP_COIN_ID2 = Integer.parseInt(Donate.getProperty("VipCoin2", "6393"));
  127. + VIP_DAYS_ID2 = Integer.parseInt(Donate.getProperty("VipCoinDays2", "2"));
  128. + VIP_COIN_ID3 = Integer.parseInt(Donate.getProperty("VipCoin3", "5557"));
  129. + VIP_DAYS_ID3 = Integer.parseInt(Donate.getProperty("VipCoinDays3", "3"));
  130. + }
  131. +
  132. private static final void loadFlag()
  133. {
  134. final ExProperties flagzone = initProperties(FLAGZONEMOD);
  135. @@ -1652,6 +1695,7 @@
  136. loadCommands();
  137. loadScheme();
  138. loadFlag();
  139. + loadDonate();
  140. loadBoss();
  141. loadNewChar();
  142. // players settings
  143. diff --git a/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java b/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  144. index 56beb09..99efa93 100644
  145. --- a/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  146. +++ b/java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  147. @@ -34,6 +34,7 @@
  148. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTarget;
  149. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
  150. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTest;
  151. +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminVip;
  152. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
  153.  
  154. public class AdminCommandHandler
  155. @@ -42,6 +43,7 @@
  156.  
  157. protected AdminCommandHandler()
  158. {
  159. + registerHandler(new AdminVip());
  160. registerHandler(new AdminAdmin());
  161. registerHandler(new AdminAnnouncements());
  162. registerHandler(new AdminBookmark());
  163. diff --git a/java/net/sf/l2j/gameserver/handler/ItemHandler.java b/java/net/sf/l2j/gameserver/handler/ItemHandler.java
  164. index cf6ae07..dbc54c4 100644
  165. --- a/java/net/sf/l2j/gameserver/handler/ItemHandler.java
  166. +++ b/java/net/sf/l2j/gameserver/handler/ItemHandler.java
  167. @@ -29,6 +29,7 @@
  168. import net.sf.l2j.gameserver.handler.itemhandlers.SpecialXMas;
  169. import net.sf.l2j.gameserver.handler.itemhandlers.SpiritShots;
  170. import net.sf.l2j.gameserver.handler.itemhandlers.SummonItems;
  171. +import net.sf.l2j.gameserver.handler.itemhandlers.VipCoin;
  172. import net.sf.l2j.gameserver.model.item.kind.EtcItem;
  173.  
  174. public class ItemHandler
  175. @@ -37,6 +38,7 @@
  176.  
  177. protected ItemHandler()
  178. {
  179. + registerHandler(new VipCoin());
  180. registerHandler(new BeastSoulShots());
  181. registerHandler(new BeastSpices());
  182. registerHandler(new BeastSpiritShots());
  183. diff --git a/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java
  184. new file mode 100644
  185. index 0000000..6b957e3
  186. --- /dev/null
  187. +++ b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java
  188. @@ -0,0 +1,213 @@
  189. +/*
  190. + * This program is free software; you can redistribute it and/or modify
  191. + * it under the terms of the GNU General Public License as published by
  192. + * the Free Software Foundation; either version 2, or (at your option)
  193. + * any later version.
  194. + *
  195. + * This program is distributed in the hope that it will be useful,
  196. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  197. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  198. + * GNU General Public License for more details.
  199. + *
  200. + * You should have received a copy of the GNU General Public License
  201. + * along with this program; if not, write to the Free Software
  202. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  203. + * 02111-1307, USA.
  204. + *
  205. + * http://www.gnu.org/copyleft/gpl.html
  206. + */
  207. +package net.sf.l2j.gameserver.handler.admincommandhandlers;
  208. +
  209. +import java.sql.Connection;
  210. +import java.sql.PreparedStatement;
  211. +import java.util.StringTokenizer;
  212. +import java.util.logging.Level;
  213. +import java.util.logging.Logger;
  214. +
  215. +import net.sf.l2j.commons.pool.ConnectionPool;
  216. +
  217. +import net.sf.l2j.Config;
  218. +import net.sf.l2j.gameserver.data.xml.AdminData;
  219. +import net.sf.l2j.gameserver.enums.SayType;
  220. +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  221. +import net.sf.l2j.gameserver.model.World;
  222. +import net.sf.l2j.gameserver.model.WorldObject;
  223. +import net.sf.l2j.gameserver.model.actor.Player;
  224. +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
  225. +/**
  226. + *
  227. + * @author Sarada
  228. + *
  229. + */
  230. +public class AdminVip implements IAdminCommandHandler
  231. +{
  232. + private static String[] _adminCommands = { "admin_setvip", "admin_removevip" };
  233. + private final static Logger _log = Logger.getLogger(AdminVip.class.getName());
  234. +
  235. + @Override
  236. + public void useAdminCommand(String command, Player activeChar)
  237. + {
  238. + if (command.startsWith("admin_setvip"))
  239. + {
  240. + StringTokenizer str = new StringTokenizer(command);
  241. +
  242. + WorldObject target = activeChar.getTarget();
  243. + Player player = null;
  244. +
  245. + if (target != null && target instanceof Player)
  246. + player = (Player)target;
  247. + else
  248. + player = activeChar;
  249. +
  250. + try
  251. + {
  252. + str.nextToken();
  253. + String time = str.nextToken();
  254. + if (str.hasMoreTokens())
  255. + {
  256. + String playername = time;
  257. + time = str.nextToken();
  258. + player = World.getInstance().getPlayer(playername);
  259. + doVip(activeChar, player, playername, time);
  260. + }
  261. + else
  262. + {
  263. + String playername = player.getName();
  264. + doVip(activeChar, player, playername, time);
  265. + }
  266. + }
  267. + catch(Exception e)
  268. + {
  269. + activeChar.sendMessage("Usage: //setvip <char_name> [time](in days)");
  270. + }
  271. +
  272. + player.broadcastUserInfo();
  273. +
  274. + if(player.isVip())
  275. + return;
  276. + }
  277. + else if(command.startsWith("admin_removevip"))
  278. + {
  279. + StringTokenizer str = new StringTokenizer(command);
  280. +
  281. + WorldObject target = activeChar.getTarget();
  282. + Player player = null;
  283. +
  284. + if (target instanceof Player)
  285. + player = (Player)target;
  286. + else
  287. + player = activeChar;
  288. +
  289. + try
  290. + {
  291. + str.nextToken();
  292. +
  293. + if (str.hasMoreTokens())
  294. + {
  295. + String playername = str.nextToken();
  296. + player = World.getInstance().getPlayer(playername);
  297. + removeVip(activeChar, player, playername);
  298. + }
  299. + else
  300. + {
  301. + String playername = player.getName();
  302. + removeVip(activeChar, player, playername);
  303. + }
  304. + }
  305. + catch(Exception e)
  306. + {
  307. + activeChar.sendMessage("Usage: //removevip <char_name>");
  308. + }
  309. +
  310. + player.broadcastUserInfo();
  311. +
  312. + if(player.isVip())
  313. + return;
  314. + }
  315. + return;
  316. + }
  317. +
  318. + public void doVip(Player activeChar, Player _player, String _playername, String _time)
  319. + {
  320. + int days = Integer.parseInt(_time);
  321. +
  322. + if (_player == null)
  323. + {
  324. + activeChar.sendMessage("Character not found.");
  325. + return;
  326. + }
  327. + if (_player.isVip())
  328. + {
  329. + activeChar.sendMessage("Player " + _playername + " is already an VIP.");
  330. + return;
  331. + }
  332. +
  333. + if(days > 0)
  334. + {
  335. + _player.setVip(true);
  336. + _player.setEndTime("vip", days);
  337. + _player.sendPacket(new CreatureSay(0,SayType.PARTYROOM_COMMANDER,"System","Dear player, you are now an VIP, congratulations."));
  338. +
  339. + try (Connection con = ConnectionPool.getConnection())
  340. + {
  341. + PreparedStatement statement = con.prepareStatement("UPDATE characters SET vip=1, vip_end=? WHERE obj_id=?");
  342. + statement.setLong(1, _player.getVipEndTime());
  343. + statement.setInt(2, _player.getObjectId());
  344. + statement.execute();
  345. + statement.close();
  346. +
  347. + if(Config.ALLOW_VIP_NCOLOR)
  348. + _player.getAppearance().setNameColor(Config.VIP_NCOLOR);
  349. +
  350. + if(Config.ALLOW_VIP_TCOLOR)
  351. + _player.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  352. +
  353. + _player.broadcastUserInfo();
  354. + _player.sendSkillList();
  355. +
  356. + AdminData.getInstance().broadcastMessageToGMs("GM "+ activeChar.getName()+ " set an VIP status for player "+ _playername + " for " + _time + " day(s)");
  357. + }
  358. + catch (Exception e)
  359. + {
  360. + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
  361. + }
  362. + }
  363. + }
  364. +
  365. + public void removeVip(Player activeChar, Player _player, String _playername)
  366. + {
  367. + if (!_player.isVip())
  368. + {
  369. + activeChar.sendMessage("Player " + _playername + " is not an VIP.");
  370. + return;
  371. + }
  372. +
  373. + _player.setVip(false);
  374. + _player.setVipEndTime(0);
  375. +
  376. + try (Connection con = ConnectionPool.getConnection())
  377. + {
  378. + PreparedStatement statement = con.prepareStatement("UPDATE characters SET Vip=0, Vip_end=0 WHERE obj_id=?");
  379. + statement.setInt(1, _player.getObjectId());
  380. + statement.execute();
  381. + statement.close();
  382. +
  383. + _player.getAppearance().setNameColor(0xFFFF77);
  384. + _player.getAppearance().setTitleColor(0xFFFF77);
  385. + _player.broadcastUserInfo();
  386. + _player.sendSkillList();
  387. +
  388. + AdminData.getInstance().broadcastMessageToGMs("GM "+activeChar.getName()+" removed Vip status of player "+ _playername);
  389. + }
  390. + catch (Exception e)
  391. + {
  392. + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
  393. + }
  394. + }
  395. +
  396. + @Override
  397. + public String[] getAdminCommandList()
  398. + {
  399. + return _adminCommands;
  400. + }
  401. +}
  402. \ No newline at end of file
  403. diff --git a/java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java b/java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java
  404. new file mode 100644
  405. index 0000000..c80e15a
  406. --- /dev/null
  407. +++ b/java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java
  408. @@ -0,0 +1,149 @@
  409. +package net.sf.l2j.gameserver.handler.itemhandlers;
  410. +
  411. +import java.util.Calendar;
  412. +
  413. +import net.sf.l2j.Config;
  414. +import net.sf.l2j.gameserver.handler.IItemHandler;
  415. +import net.sf.l2j.gameserver.model.actor.Playable;
  416. +import net.sf.l2j.gameserver.model.actor.Player;
  417. +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
  418. +import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
  419. +
  420. +/**
  421. + *
  422. + * @author Sarada
  423. + *
  424. + */
  425. +public class VipCoin implements IItemHandler
  426. +{
  427. + private static final int ITEM_IDS[] = { Config.VIP_COIN_ID1, Config.VIP_COIN_ID2, Config.VIP_COIN_ID3};
  428. +
  429. + @Override
  430. + public void useItem(Playable playable, ItemInstance item, boolean forceUse)
  431. + {
  432. + if (!(playable instanceof Player))
  433. + return;
  434. +
  435. + Player activeChar = (Player)playable;
  436. +
  437. + int itemId = item.getItemId();
  438. +
  439. + if (itemId == Config.VIP_COIN_ID1)
  440. + {
  441. + if (activeChar.isInOlympiadMode())
  442. + {
  443. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  444. + return;
  445. + }
  446. + else if (activeChar.isVip())
  447. + {
  448. + activeChar.sendMessage("You Are Vip!.");
  449. + return;
  450. + }
  451. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  452. + {
  453. + if (activeChar.isVip())
  454. + {
  455. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  456. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID1));
  457. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID1 + " day of VIP.");
  458. + }
  459. + else
  460. + {
  461. + activeChar.setVip(true);
  462. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID1);
  463. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID1 + " day.");
  464. + }
  465. +
  466. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  467. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  468. +
  469. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  470. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  471. +
  472. + activeChar.broadcastUserInfo();
  473. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  474. + }
  475. + }
  476. +
  477. + if (itemId == Config.VIP_COIN_ID2)
  478. + {
  479. + if (activeChar.isInOlympiadMode())
  480. + {
  481. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  482. + return;
  483. + }
  484. + else if (activeChar.isVip())
  485. + {
  486. + activeChar.sendMessage("You Are Vip!.");
  487. + return;
  488. + }
  489. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  490. + {
  491. + if (activeChar.isVip())
  492. + {
  493. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  494. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID2));
  495. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID2 + " day of VIP.");
  496. + }
  497. + else
  498. + {
  499. + activeChar.setVip(true);
  500. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID2);
  501. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID2 + " day.");
  502. + }
  503. +
  504. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  505. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  506. +
  507. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  508. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  509. +
  510. + activeChar.broadcastUserInfo();
  511. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  512. + }
  513. + }
  514. +
  515. + if (itemId == Config.VIP_COIN_ID3)
  516. + {
  517. + if (activeChar.isInOlympiadMode())
  518. + {
  519. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  520. + return;
  521. + }
  522. + else if (activeChar.isVip())
  523. + {
  524. + activeChar.sendMessage("You Are Vip!.");
  525. + return;
  526. + }
  527. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  528. + {
  529. + if (activeChar.isVip())
  530. + {
  531. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  532. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID3));
  533. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID3 + " day of VIP.");
  534. + }
  535. + else
  536. + {
  537. + activeChar.setVip(true);
  538. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID3);
  539. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID3 + " day.");
  540. + }
  541. +
  542. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  543. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  544. +
  545. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  546. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  547. +
  548. + activeChar.broadcastUserInfo();
  549. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  550. + }
  551. + }
  552. + }
  553. + public int[] getItemIds()
  554. + {
  555. + return ITEM_IDS;
  556. + }
  557. +}
  558. diff --git a/java/net/sf/l2j/gameserver/model/actor/Player.java b/java/net/sf/l2j/gameserver/model/actor/Player.java
  559. index de2c3e1..6c99cca 100644
  560. --- a/java/net/sf/l2j/gameserver/model/actor/Player.java
  561. +++ b/java/net/sf/l2j/gameserver/model/actor/Player.java
  562. @@ -5,6 +5,7 @@
  563. import java.sql.ResultSet;
  564. import java.util.ArrayList;
  565. import java.util.Arrays;
  566. +import java.util.Calendar;
  567. import java.util.Collection;
  568. import java.util.Comparator;
  569. import java.util.HashMap;
  570. @@ -237,7 +238,7 @@
  571. private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  572.  
  573. private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,nobless,power_grade) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  574. - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
  575. + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,vip=?,vip_end=? WHERE obj_id=?";
  576. private static final String RESTORE_CHARACTER = "SELECT * FROM characters WHERE obj_id=?";
  577.  
  578. private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
  579. @@ -320,7 +321,9 @@
  580. private int _mountNpcId;
  581. private int _mountLevel;
  582. private int _mountObjectId;
  583. -
  584. + /** VIP System */
  585. + private boolean _isVip = false;
  586. + private long _vip_endTime = 0;
  587. protected int _throneId;
  588.  
  589. private TeleportMode _teleportMode = TeleportMode.NONE;
  590. @@ -4344,6 +4347,8 @@
  591. player.setAllianceWithVarkaKetra(rs.getInt("varka_ketra_ally"));
  592.  
  593. player.setDeathPenaltyBuffLevel(rs.getInt("death_penalty_level"));
  594. + player.setVip(rs.getInt("vip") == 1 ? true : false);
  595. + player.setVipEndTime(rs.getLong("vip_end"));
  596.  
  597. // Set the position of the Player.
  598. player.getPosition().set(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"), rs.getInt("heading"));
  599. @@ -4574,7 +4579,9 @@
  600. ps.setLong(44, getClanCreateExpiryTime());
  601. ps.setString(45, getName());
  602. ps.setLong(46, getDeathPenaltyBuffLevel());
  603. - ps.setInt(47, getObjectId());
  604. + ps.setInt(47, isVip() ? 1 : 0);
  605. + ps.setLong(48, getVipEndTime());
  606. + ps.setInt(49, getObjectId());
  607.  
  608. ps.execute();
  609. }
  610. @@ -4705,7 +4712,25 @@
  611. LOGGER.error("Couldn't store player effects.", e);
  612. }
  613. }
  614. + public boolean isVip()
  615. + {
  616. + return _isVip;
  617. + }
  618.  
  619. + public void setVip(boolean val)
  620. + {
  621. + _isVip = val;
  622. + }
  623. +
  624. + public long getVipEndTime()
  625. + {
  626. + return _vip_endTime;
  627. + }
  628. +
  629. + public void setVipEndTime(long val)
  630. + {
  631. + _vip_endTime = val;
  632. + }
  633. /**
  634. * @return True if the Player is online.
  635. */
  636. @@ -4713,7 +4738,22 @@
  637. {
  638. return _isOnline;
  639. }
  640. -
  641. + /**
  642. + * Sets the end time.
  643. + * @param process the process
  644. + * @param val the val
  645. + */
  646. + public void setEndTime(String process, int val)
  647. + {
  648. + Calendar calendar = Calendar.getInstance();
  649. + calendar.add(Calendar.DAY_OF_MONTH, val);
  650. + long end_day = calendar.getTimeInMillis();
  651. +
  652. + if(process.equals("vip"))
  653. + _vip_endTime = end_day;
  654. + /*if(process.equals("aio"))
  655. + _aio_endTime = end_day;*/
  656. + }
  657. /**
  658. * @return an int interpretation of online status.
  659. */
  660. diff --git a/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java b/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
  661. index 51afb41..8663495 100644
  662. --- a/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
  663. +++ b/java/net/sf/l2j/gameserver/model/actor/instance/Monster.java
  664. @@ -70,6 +70,7 @@
  665. super(objectId, template);
  666. }
  667.  
  668. + @SuppressWarnings("cast")
  669. @Override
  670. protected void calculateRewards(Creature creature)
  671. {
  672. @@ -163,7 +164,16 @@
  673.  
  674. long exp = expSp[0];
  675. int sp = expSp[1];
  676. -
  677. + if (attacker instanceof Player)
  678. + {
  679. + Player a = (Player)attacker;
  680. +
  681. + if (a.isVip())
  682. + {
  683. + exp *= Config.VIP_XP_SP_RATE;
  684. + sp *= Config.VIP_XP_SP_RATE;
  685. + }
  686. + }
  687. exp *= 1 - penalty;
  688.  
  689. // Test over-hit.
  690. @@ -234,7 +244,16 @@
  691. final int[] expSp = calculateExpAndSp(levelDiff, partyDmg, totalDamage);
  692. long exp = expSp[0];
  693. int sp = expSp[1];
  694. -
  695. + if (attacker instanceof Player)
  696. + {
  697. + Player a = (Player)attacker;
  698. +
  699. + if (a.isVip())
  700. + {
  701. + exp *= Config.VIP_XP_SP_RATE;
  702. + sp *= Config.VIP_XP_SP_RATE;
  703. + }
  704. + }
  705. exp *= partyMul;
  706. sp *= partyMul;
  707.  
  708. @@ -514,12 +533,13 @@
  709.  
  710. /**
  711. * Calculate the quantity for a specific drop.
  712. + * @param lastAttacker
  713. * @param drop : The {@link DropData} informations to use.
  714. * @param levelModifier : The level modifier (will be subtracted from drop chance).
  715. * @param isSweep : If True, use the spoil drop chance.
  716. * @return An {@link IntIntHolder} corresponding to the item id and count.
  717. */
  718. - private IntIntHolder calculateRewardItem(DropData drop, int levelModifier, boolean isSweep)
  719. + private IntIntHolder calculateRewardItem(Player lastAttacker,DropData drop, int levelModifier, boolean isSweep)
  720. {
  721. // Get default drop chance
  722. double dropChance = drop.getChance();
  723. @@ -547,11 +567,23 @@
  724. // Applies Drop rates
  725. if (drop.getItemId() == 57)
  726. dropChance *= Config.RATE_DROP_ADENA;
  727. + if (lastAttacker.isVip())
  728. + {
  729. + dropChance *= Config.VIP_ADENA_RATE;
  730. + }
  731. +
  732. else if (isSweep)
  733. dropChance *= Config.RATE_DROP_SPOIL;
  734. + if (lastAttacker.isVip())
  735. + {
  736. + dropChance *= Config.VIP_SPOIL_RATE;
  737. + }
  738. else
  739. dropChance *= (isRaidBoss()) ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
  740. -
  741. + if (lastAttacker.isVip())
  742. + {
  743. + dropChance *= Config.VIP_DROP_RATE;
  744. + }
  745. // Set our limits for chance of drop
  746. if (dropChance < 1)
  747. dropChance = 1;
  748. @@ -589,11 +621,12 @@
  749. * Calculate the quantity for a specific drop, according its {@link DropCategory}.<br>
  750. * <br>
  751. * Only a maximum of ONE item from a {@link DropCategory} is allowed to be dropped.
  752. + * @param lastAttacker
  753. * @param cat : The {@link DropCategory} informations to use.
  754. * @param levelModifier : The level modifier (will be subtracted from drop chance).
  755. * @return An {@link IntIntHolder} corresponding to the item id and count.
  756. */
  757. - private IntIntHolder calculateCategorizedRewardItem(DropCategory cat, int levelModifier)
  758. + private IntIntHolder calculateCategorizedRewardItem(Player lastAttacker,DropCategory cat, int levelModifier)
  759. {
  760. if (cat == null)
  761. return null;
  762. @@ -641,9 +674,16 @@
  763. double dropChance = drop.getChance();
  764. if (drop.getItemId() == 57)
  765. dropChance *= Config.RATE_DROP_ADENA;
  766. + if (lastAttacker.isVip())
  767. + {
  768. + dropChance *= Config.VIP_ADENA_RATE;
  769. + }
  770. else
  771. dropChance *= (isRaidBoss()) ? Config.RATE_DROP_ITEMS_BY_RAID : Config.RATE_DROP_ITEMS;
  772. -
  773. + if (lastAttacker.isVip())
  774. + {
  775. + dropChance *= Config.VIP_DROP_RATE;
  776. + }
  777. if (dropChance < DropData.MAX_CHANCE)
  778. dropChance = DropData.MAX_CHANCE;
  779.  
  780. @@ -838,7 +878,7 @@
  781. {
  782. for (DropData drop : cat.getAllDrops())
  783. {
  784. - holder = calculateRewardItem(drop, levelModifier, true);
  785. + holder = calculateRewardItem(player,drop, levelModifier, true);
  786. if (holder == null)
  787. continue;
  788.  
  789. @@ -854,10 +894,10 @@
  790. if (drop == null)
  791. continue;
  792.  
  793. - holder = calculateRewardItem(drop, levelModifier, false);
  794. + holder = calculateRewardItem(player,drop, levelModifier, false);
  795. }
  796. else
  797. - holder = calculateCategorizedRewardItem(cat, levelModifier);
  798. + holder = calculateCategorizedRewardItem(player,cat, levelModifier);
  799.  
  800. if (holder == null)
  801. continue;
  802. diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  803. index 3e30838..9f6addd 100644
  804. --- a/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  805. +++ b/java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  806. @@ -1,5 +1,7 @@
  807. package net.sf.l2j.gameserver.network.clientpackets;
  808.  
  809. +import java.util.Calendar;
  810. +import java.util.Date;
  811. import java.util.Map.Entry;
  812.  
  813. import net.sf.l2j.Config;
  814. @@ -37,6 +39,7 @@
  815. import net.sf.l2j.gameserver.network.serverpackets.Die;
  816. import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
  817. import net.sf.l2j.gameserver.network.serverpackets.ExMailArrived;
  818. +import net.sf.l2j.gameserver.network.serverpackets.ExShowScreenMessage;
  819. import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
  820. import net.sf.l2j.gameserver.network.serverpackets.FriendList;
  821. import net.sf.l2j.gameserver.network.serverpackets.HennaInfo;
  822. @@ -241,6 +244,16 @@
  823. player.sendMessage("I'm sorry, but multibox is not allowed here.");
  824. player.logout(true);
  825. }
  826. +
  827. + if(player.isVip())
  828. + onEnterVip(player);
  829. +
  830. + if(Config.ALLOW_VIP_NCOLOR && player.isVip())
  831. + player.getAppearance().setNameColor(Config.VIP_NCOLOR);
  832. +
  833. + if(Config.ALLOW_VIP_TCOLOR && player.isVip())
  834. + player.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  835. +
  836. // If the Player is a Dark Elf, check for Shadow Sense at night.
  837. if (player.getRace() == ClassRace.DARK_ELF && player.hasSkill(L2Skill.SKILL_SHADOW_SENSE))
  838. player.sendPacket(SystemMessage.getSystemMessage((GameTimeTaskManager.getInstance().isNight()) ? SystemMessageId.NIGHT_S1_EFFECT_APPLIES : SystemMessageId.DAY_S1_EFFECT_DISAPPEARS).addSkillName(L2Skill.SKILL_SHADOW_SENSE));
  839. @@ -320,7 +333,25 @@
  840. {
  841. activeChar.sendMessage("Next Restart: " + Restart.getInstance().getRestartNextTime());
  842. }
  843. -
  844. + private static void onEnterVip(Player activeChar)
  845. + {
  846. + long now = Calendar.getInstance().getTimeInMillis();
  847. + long endDay = activeChar.getVipEndTime();
  848. + if(now > endDay)
  849. + {
  850. + activeChar.setVip(false);
  851. + activeChar.setVipEndTime(0);
  852. + //activeChar.sendPacket(new CreatureSay(0,Say2.PARTY,"System","Your VIP period ends."));
  853. + activeChar.sendPacket(new ExShowScreenMessage(Config.MESSAGE_VIP_EXIT, Config.MESSAGE_EXIT_VIP_TIME));
  854. + }
  855. + else
  856. + {
  857. + Date dt = new Date(endDay);
  858. + if(activeChar.isVip())
  859. + //activeChar.sendMessage("Your VIP period ends at: " + dt);
  860. + activeChar.sendPacket(new ExShowScreenMessage(Config.MESSAGE_VIP_ENTER + dt, Config.MESSAGE_TIME_VIP));
  861. + }
  862. + }
  863. @Override
  864. protected boolean triggersOnActionRequest()
  865. {
  866.  
  867. Colocar num bloco de notas e salvar como SQL e executar em seu navicat
  868. +ALTER TABLE `characters` ADD COLUMN `vip` decimal(1,0) NOT NULL DEFAULT 0 AFTER `death_penalty_level`;
  869. +ALTER TABLE `characters` ADD COLUMN `vip_end` decimal(20,0) NOT NULL DEFAULT 0 AFTER `vip`;
  870.  
  871. Registrar admincomands no xml
  872. +<aCar name="admin_setvip" accessLevel="7" />
  873. +<aCar name="admin_removevip" accessLevel="7" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement