Sarada-L2

Vip System + Vip Coin Click C4 Yo: Sarada

Apr 21st, 2021 (edited)
337
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 28.49 KB | None | 0 0
  1. Index: java/net/sf/l2j/gameserver/model/L2Attackable.java
  2. ===================================================================
  3. --- java/net/sf/l2j/gameserver/model/L2Attackable.java (revision 730)
  4. +++ java/net/sf/l2j/gameserver/model/L2Attackable.java (working copy)
  5. @@ -663,7 +663,16 @@
  6. exp = tmp[0];
  7. exp *= 1 - penalty;
  8. sp = tmp[1];
  9. + if (attacker instanceof L2PcInstance)
  10. + {
  11. + L2PcInstance a = (L2PcInstance)attacker;
  12. +
  13. + if (a.isVip())
  14. + {
  15. + exp *= Config.VIP_XP_SP_RATE;
  16. + sp *= Config.VIP_XP_SP_RATE;
  17. + }
  18. + }
  19. if (Config.CHAMPION_ENABLE && isChampion())
  20. {
  21. exp *= Config.CHAMPION_REWARDS;
  22. @@ -785,7 +794,16 @@
  23. tmp = calculateExpAndSp(levelDiff, partyDmg);
  24. exp = tmp[0];
  25. sp = tmp[1];
  26. + if (attacker instanceof L2PcInstance)
  27. + {
  28. + L2PcInstance a = (L2PcInstance)attacker;
  29. +
  30. + if (a.isVip())
  31. + {
  32. + exp *= Config.VIP_XP_SP_RATE;
  33. + sp *= Config.VIP_XP_SP_RATE;
  34. + }
  35. + }
  36. if (Config.CHAMPION_ENABLE && isChampion())
  37. {
  38. exp *= Config.CHAMPION_REWARDS;
  39. @@ -1106,14 +1124,26 @@
  40. if (drop.getItemId() == Inventory.ADENA_ID)
  41. {
  42. dropChance *= Config.RATE_DROP_ADENA;
  43. + if (lastAttacker.isVip())
  44. + {
  45. + dropChance *= Config.VIP_ADENA_RATE;
  46. + }
  47. }
  48. else if (isSweep)
  49. {
  50. dropChance *= Config.RATE_DROP_SPOIL;
  51. + if (lastAttacker.isVip())
  52. + {
  53. + dropChance *= Config.VIP_SPOIL_RATE;
  54. + }
  55. }
  56. else
  57. {
  58. dropChance *= isRaid() ? Config.RATE_BOSS_DROP_ITEMS : Config.RATE_DROP_ITEMS;
  59. + if (lastAttacker.isVip())
  60. + {
  61. + dropChance *= Config.VIP_DROP_RATE;
  62. + }
  63. }
  64.  
  65. if (Config.CHAMPION_ENABLE && isChampion())
  66. @@ -1281,10 +1311,18 @@
  67. if (drop.getItemId() == Inventory.ADENA_ID)
  68. {
  69. dropChance *= Config.RATE_DROP_ADENA;
  70. + if (lastAttacker.isVip())
  71. + {
  72. + dropChance *= Config.VIP_ADENA_RATE;
  73. + }
  74. }
  75. else
  76. {
  77. dropChance *= isRaid() ? Config.RATE_BOSS_DROP_ITEMS : Config.RATE_DROP_ITEMS;
  78. + if (lastAttacker.isVip())
  79. + {
  80. + dropChance *= Config.VIP_DROP_RATE;
  81. + }
  82. }
  83.  
  84. if (Config.CHAMPION_ENABLE && isChampion())
  85. Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
  86. ===================================================================
  87. --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 730)
  88. +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  89. @@ -227,8 +227,8 @@
  90. private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
  91.  
  92. 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,clan_privs,wantspeace,base_class,nobless,last_recom_date) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  93. - 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=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,clan_privs=?,wantspeace=?,clan_join_expiry_time=?,clan_create_expiry_time=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,nobless=?,last_recom_date=?,varka_ketra_ally=?,aio_buffer=?,newbie_at=?,char_name=? WHERE obj_Id=?";
  94. - private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, name_color, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, clan_join_expiry_time, clan_create_expiry_time, base_class, onlinetime, in_jail, jail_timer, nobless, last_recom_date, varka_ketra_ally, aio_buffer, newbie_at FROM characters WHERE obj_Id=?";
  95. + 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=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,clan_privs=?,wantspeace=?,clan_join_expiry_time=?,clan_create_expiry_time=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,nobless=?,last_recom_date=?,varka_ketra_ally=?,aio_buffer=?,newbie_at=?,char_name=?, vip=?,vip_end=? WHERE obj_Id=?";
  96. + private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, name_color, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, sp, karma, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, clan_join_expiry_time, clan_create_expiry_time, base_class, onlinetime, in_jail, jail_timer, nobless, last_recom_date, varka_ketra_ally, aio_buffer, newbie_at, vip,vip_end FROM characters WHERE obj_Id=?";
  97. 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";
  98. private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
  99. private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?";
  100. @@ -437,7 +437,9 @@
  101.  
  102. private final Set<L2PcInstance> _snoopListener = ConcurrentHashMap.newKeySet(1);
  103. private final Set<L2PcInstance> _snoopedPlayer = ConcurrentHashMap.newKeySet(1);
  104. + /** VIP System */
  105. + private boolean _isVip = false;
  106. + private long _vip_endTime = 0;
  107. private ClassId _skillLearningClassId;
  108.  
  109. // Hennas
  110. @@ -6550,7 +6552,9 @@
  111.  
  112. // Set character newbie time
  113. player.setNewbieAt(rset.getLong("newbie_at"));
  114. + player.setVip(rset.getInt("vip") == 1 ? true : false);
  115. + player.setVipEndTime(rset.getLong("vip_end"));
  116. +
  117. // Set the x,y,z position of the L2PcInstance and make it invisible
  118. player.setXYZInvisible(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
  119.  
  120. @@ -6897,6 +6901,8 @@
  121. statement.setInt(++i, isAIOBuffer() ? 1 : 0);
  122. statement.setLong(++i, getNewbieAt());
  123. statement.setString(++i, getName());
  124. + statement.setInt(++i, isVip() ? 1 : 0);
  125. + statement.setLong(++i, getVipEndTime());
  126. statement.setInt(++i, getObjectId());
  127. statement.execute();
  128. }
  129. @@ -7085,7 +7091,34 @@
  130. {
  131. return _isOnline;
  132. }
  133. + public boolean isVip()
  134. + {
  135. + return _isVip;
  136. + }
  137.  
  138. + public void setVip(boolean val)
  139. + {
  140. + _isVip = val;
  141. + }
  142. +
  143. + public long getVipEndTime()
  144. + {
  145. + return _vip_endTime;
  146. + }
  147. +
  148. + public void setVipEndTime(long val)
  149. + {
  150. + _vip_endTime = val;
  151. + }
  152. + public void setEndTime(String process, int val)
  153. + {
  154. + Calendar calendar = Calendar.getInstance();
  155. + calendar.add(Calendar.DAY_OF_MONTH, val);
  156. + long end_day = calendar.getTimeInMillis();
  157. +
  158. + if(process.equals("vip"))
  159. + _vip_endTime = end_day;
  160. + }
  161. /**
  162. * Add a skill to the L2PcInstance _skills and its Func objects to the calculator set of the L2PcInstance and save update in the character_skills table of the database.<BR>
  163. * <BR>
  164. Index: java/net/sf/l2j/Config.java
  165. ===================================================================
  166. --- java/net/sf/l2j/Config.java (revision 730)
  167. +++ java/net/sf/l2j/Config.java (working copy)
  168. @@ -45,6 +45,9 @@
  169. {
  170. private final static Logger _log = Logger.getLogger(Config.class.getName());
  171.  
  172. + /**Custom Properties */
  173. + public static final String VIP_DONATE= "./config/CustomMods/Donate.ini";
  174. +
  175. /** Properties file for access level configurations */
  176. public static final String ACCESS_LEVELS_FILE = "./config/AccessLevels.properties";
  177. /** Properties file for alternative configurations */
  178. @@ -578,7 +581,22 @@
  179. public static int SAVE_DROPPED_ITEM_INTERVAL;
  180. /** Clear all items stored in ItemsOnGround table */
  181. public static boolean CLEAR_DROPPED_ITEM_TABLE;
  182. -
  183. + /** VIP System */
  184. + public static boolean ENABLE_VIP_SYSTEM;
  185. + public static boolean ALLOW_VIP_NCOLOR;
  186. + public static int VIP_NCOLOR;
  187. + public static boolean ALLOW_VIP_TCOLOR;
  188. + public static int VIP_TCOLOR;
  189. + public static float VIP_XP_SP_RATE;
  190. + public static float VIP_ADENA_RATE;
  191. + public static float VIP_DROP_RATE;
  192. + public static float VIP_SPOIL_RATE;
  193. + public static int VIP_COIN_ID1;
  194. + public static int VIP_DAYS_ID1;
  195. + public static int VIP_COIN_ID2;
  196. + public static int VIP_DAYS_ID2;
  197. + public static int VIP_COIN_ID3;
  198. + public static int VIP_DAYS_ID3;
  199. /** Accept precise drop calculation ? */
  200. public static boolean PRECISE_DROP_CALCULATION;
  201. /** Accept multi-items drop ? */
  202. @@ -2249,6 +2267,34 @@
  203. PVP_NORMAL_TIME = Integer.parseInt(pvpSettings.getProperty("PvPVsNormalTime", "15000"));
  204. PVP_PVP_TIME = Integer.parseInt(pvpSettings.getProperty("PvPVsPvPTime", "30000"));
  205.  
  206. +
  207. + // Donate Properties
  208. + Properties donate = new Properties();
  209. + try (InputStream is = new FileInputStream(new File(VIP_DONATE)))
  210. + {
  211. + donate.load(is);
  212. + }
  213. + catch (Exception e)
  214. + {
  215. + e.printStackTrace();
  216. + throw new Error("Failed to Load " + VIP_DONATE + " File.");
  217. + }
  218. + ENABLE_VIP_SYSTEM = Boolean.parseBoolean(donate.getProperty("EnableVipSystem", "True"));
  219. + ALLOW_VIP_NCOLOR = Boolean.parseBoolean(donate.getProperty("AllowVipNameColor", "True"));
  220. + VIP_NCOLOR = Integer.decode("0x" + donate.getProperty("VipNameColor", "88AA88"));
  221. + ALLOW_VIP_TCOLOR = Boolean.parseBoolean(donate.getProperty("AllowVipTitleColor", "True"));
  222. + VIP_TCOLOR = Integer.decode("0x" + donate.getProperty("VipTitleColor", "88AA88"));
  223. + VIP_XP_SP_RATE = Float.parseFloat(donate.getProperty("VIPXpSpRate", "1.5"));
  224. + VIP_ADENA_RATE = Float.parseFloat(donate.getProperty("VIPAdenaRate", "1.5"));
  225. + VIP_DROP_RATE = Float.parseFloat(donate.getProperty("VIPDropRate", "1.5"));
  226. + VIP_SPOIL_RATE = Float.parseFloat(donate.getProperty("VIPSpoilRate", "1.5"));
  227. + VIP_COIN_ID1 = Integer.parseInt(donate.getProperty("VipCoin", "6392"));
  228. + VIP_DAYS_ID1 = Integer.parseInt(donate.getProperty("VipCoinDays", "1"));
  229. + VIP_COIN_ID2 = Integer.parseInt(donate.getProperty("VipCoin2", "6393"));
  230. + VIP_DAYS_ID2 = Integer.parseInt(donate.getProperty("VipCoinDays2", "2"));
  231. + VIP_COIN_ID3 = Integer.parseInt(donate.getProperty("VipCoin3", "5557"));
  232. + VIP_DAYS_ID3 = Integer.parseInt(donate.getProperty("VipCoinDays3", "3"));
  233. +
  234. // Access levels
  235. Properties accessLevelSettings = new Properties();
  236. try (InputStream is = new FileInputStream(new File(ACCESS_LEVELS_FILE)))
  237. Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
  238. ===================================================================
  239. --- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 730)
  240. +++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
  241. @@ -70,6 +70,7 @@
  242. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTeleport;
  243. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminTest;
  244. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminUnblockIp;
  245. +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminVip;
  246. import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminZone;
  247.  
  248. /**
  249. @@ -96,6 +97,7 @@
  250.  
  251. public void load()
  252. {
  253. + registerAdminCommandHandler(new AdminVip());
  254. registerAdminCommandHandler(new AdminAdmin());
  255. registerAdminCommandHandler(new AdminInvul());
  256. registerAdminCommandHandler(new AdminDelete());
  257. Index: java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java
  258. ===================================================================
  259. --- java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java (nonexistent)
  260. +++ java/net/sf/l2j/gameserver/handler/itemhandlers/VipCoin.java (working copy)
  261. @@ -0,0 +1,150 @@
  262. +package net.sf.l2j.gameserver.handler.itemhandlers;
  263. +
  264. +import java.util.Calendar;
  265. +
  266. +import net.sf.l2j.Config;
  267. +import net.sf.l2j.gameserver.handler.IItemHandler;
  268. +import net.sf.l2j.gameserver.model.L2ItemInstance;
  269. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  270. +import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
  271. +import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
  272. +
  273. +/**
  274. + *
  275. + * @author Computer Sarada
  276. + *
  277. + */
  278. +public class VipCoin implements IItemHandler
  279. +{
  280. + private static final int ITEM_IDS[] = { Config.VIP_COIN_ID1, Config.VIP_COIN_ID2, Config.VIP_COIN_ID3};
  281. +
  282. + @Override
  283. + public void useItem(final L2PlayableInstance playable, final L2ItemInstance item)
  284. + {
  285. + if (!(playable instanceof L2PcInstance))
  286. + return;
  287. +
  288. + L2PcInstance activeChar = (L2PcInstance)playable;
  289. +
  290. + int itemId = item.getItemId();
  291. +
  292. + if (itemId == Config.VIP_COIN_ID1)
  293. + {
  294. + if (activeChar.isInOlympiadMode())
  295. + {
  296. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  297. + return;
  298. + }
  299. + else if (activeChar.isVip())
  300. + {
  301. + activeChar.sendMessage("You Are Vip!.");
  302. + return;
  303. + }
  304. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  305. + {
  306. + if (activeChar.isVip())
  307. + {
  308. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  309. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID1));
  310. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID1 + " day of VIP.");
  311. + }
  312. + else
  313. + {
  314. + activeChar.setVip(true);
  315. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID1);
  316. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID1 + " day.");
  317. + }
  318. +
  319. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  320. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  321. +
  322. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  323. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  324. +
  325. + activeChar.broadcastUserInfo();
  326. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  327. + }
  328. + }
  329. +
  330. + else if (itemId == Config.VIP_COIN_ID2)
  331. + {
  332. + if (activeChar.isInOlympiadMode())
  333. + {
  334. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  335. + return;
  336. + }
  337. + else if (activeChar.isVip())
  338. + {
  339. + activeChar.sendMessage("You Are Vip!.");
  340. + return;
  341. + }
  342. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  343. + {
  344. + if (activeChar.isVip())
  345. + {
  346. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  347. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID2));
  348. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID2 + " day of VIP.");
  349. + }
  350. + else
  351. + {
  352. + activeChar.setVip(true);
  353. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID2);
  354. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID2 + " day.");
  355. + }
  356. +
  357. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  358. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  359. +
  360. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  361. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  362. +
  363. + activeChar.broadcastUserInfo();
  364. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  365. + }
  366. + }
  367. +
  368. + else if (itemId == Config.VIP_COIN_ID3)
  369. + {
  370. + if (activeChar.isInOlympiadMode())
  371. + {
  372. + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
  373. + return;
  374. + }
  375. + else if (activeChar.isVip())
  376. + {
  377. + activeChar.sendMessage("You Are Vip!.");
  378. + return;
  379. + }
  380. + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
  381. + {
  382. + if (activeChar.isVip())
  383. + {
  384. + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
  385. + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID3));
  386. + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID3 + " day of VIP.");
  387. + }
  388. + else
  389. + {
  390. + activeChar.setVip(true);
  391. + activeChar.setEndTime("vip", Config.VIP_DAYS_ID3);
  392. + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID3 + " day.");
  393. + }
  394. +
  395. + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  396. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  397. +
  398. + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  399. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  400. +
  401. + activeChar.broadcastUserInfo();
  402. + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
  403. + }
  404. + }
  405. + }
  406. + @Override
  407. + public int[] getItemIds()
  408. + {
  409. + return ITEM_IDS;
  410. + }
  411. +}
  412. Index: config/CustomMods/Donate.ini
  413. ===================================================================
  414. --- config/CustomMods/Donate.ini (nonexistent)
  415. +++ config/CustomMods/Donate.ini (working copy)
  416. @@ -0,0 +1,43 @@
  417. +#=============================================================
  418. +# VIP System
  419. +#=============================================================
  420. +EnableVipSystem = True
  421. +
  422. +# Enable / Disable Name Color
  423. +AllowVipNameColor = True
  424. +VipNameColor = 88AA88
  425. +
  426. +# Enable / Disable Title Color
  427. +AllowVipTitleColor = True
  428. +VipTitleColor = 88AA88
  429. +
  430. +# VIP Xp/Sp Rate
  431. +VIPXpSpRate = 1.5
  432. +# VIP Adena rate
  433. +VIPAdenaRate = 1.5
  434. +# VIP drop rate
  435. +VIPDropRate = 1.5
  436. +# VIP spoil rate
  437. +VIPSpoilRate = 1.5
  438. +
  439. +#=============================================================
  440. +# VIP Item 1
  441. +#=============================================================
  442. +#Item Coin 1
  443. +VipCoin = 0
  444. +VipCoinDays = 1
  445. +
  446. +#=============================================================
  447. +# VIP Item 2
  448. +#=============================================================
  449. +#Item Coin 2
  450. +VipCoin2 = 0
  451. +VipCoinDays2 = 30
  452. +
  453. +#=============================================================
  454. +# VIP Item 3
  455. +#=============================================================
  456. +#Item Coin 3
  457. +VipCoin3 = 0
  458. +VipCoinDays3 = 45
  459. +
  460. Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
  461. ===================================================================
  462. --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 730)
  463. +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
  464. @@ -14,7 +14,9 @@
  465. */
  466. package net.sf.l2j.gameserver.network.clientpackets;
  467.  
  468. +import java.sql.Date;
  469. import java.util.Base64;
  470. +import java.util.Calendar;
  471. import java.util.Collection;
  472. import java.util.logging.Logger;
  473.  
  474. @@ -43,6 +45,7 @@
  475. import net.sf.l2j.gameserver.model.quest.Quest;
  476. import net.sf.l2j.gameserver.model.quest.QuestState;
  477. import net.sf.l2j.gameserver.network.L2GameClient.GameClientState;
  478. +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
  479. import net.sf.l2j.gameserver.network.serverpackets.Die;
  480. import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
  481. import net.sf.l2j.gameserver.network.serverpackets.ExStorageMaxCount;
  482. @@ -216,17 +219,17 @@
  483. // Default enter world message
  484. sendPacket(new SystemMessage(SystemMessage.WELCOME_TO_LINEAGE_II));
  485.  
  486. SevenSigns.getInstance().sendCurrentPeriodMsg(activeChar);
  487. Announcements.getInstance().showAnnouncements(activeChar);
  488. +
  489. + if(activeChar.isVip())
  490. + onEnterVip(activeChar);
  491. +
  492. + if(Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
  493. + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
  494. +
  495. + if(Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
  496. + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  497.  
  498. String serverNews = HtmCache.getInstance().getHtm("data/html/servnews.htm");
  499. if (serverNews != null)
  500. @@ -301,6 +304,24 @@
  501. }
  502. }
  503.  
  504. + private static void onEnterVip(L2PcInstance activeChar)
  505. + {
  506. + long now = Calendar.getInstance().getTimeInMillis();
  507. + long endDay = activeChar.getVipEndTime();
  508. + if(now > endDay)
  509. + {
  510. + activeChar.setVip(false);
  511. + activeChar.setVipEndTime(0);
  512. + activeChar.sendPacket(new CreatureSay(0,Say2.PARTY,"System","Your VIP period ends."));
  513. + }
  514. + else
  515. + {
  516. + Date dt = new Date(endDay);
  517. + if(activeChar.isVip())
  518. + activeChar.sendMessage("Your VIP period ends at: " + dt);
  519. + }
  520. + }
  521. +
  522. private final boolean isDualBoxingAllowed(L2PcInstance activeChar)
  523. {
  524. if (Config.MAX_CLIENTS_PER_IP <= 0)
  525. Index: java/net/sf/l2j/gameserver/handler/ItemHandler.java
  526. ===================================================================
  527. --- java/net/sf/l2j/gameserver/handler/ItemHandler.java (revision 730)
  528. +++ java/net/sf/l2j/gameserver/handler/ItemHandler.java (working copy)
  529. @@ -48,6 +48,7 @@
  530. import net.sf.l2j.gameserver.handler.itemhandlers.SpecialXMas;
  531. import net.sf.l2j.gameserver.handler.itemhandlers.SpiritShot;
  532. import net.sf.l2j.gameserver.handler.itemhandlers.SummonItems;
  533. +import net.sf.l2j.gameserver.handler.itemhandlers.VipCoin;
  534. import net.sf.l2j.gameserver.handler.itemhandlers.WorldMap;
  535.  
  536. /**
  537. @@ -78,6 +79,7 @@
  538.  
  539. public void load()
  540. {
  541. + registerItemHandler(new VipCoin());
  542. registerItemHandler(new ScrollOfEscape());
  543. registerItemHandler(new ScrollOfResurrection());
  544. registerItemHandler(new SoulShots());
  545. Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java
  546. ===================================================================
  547. --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java (nonexistent)
  548. +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminVip.java (working copy)
  549. @@ -0,0 +1,206 @@
  550. +/*
  551. + * This program is free software; you can redistribute it and/or modify
  552. + * it under the terms of the GNU General Public License as published by
  553. + * the Free Software Foundation; either version 2, or (at your option)
  554. + * any later version.
  555. + *
  556. + * This program is distributed in the hope that it will be useful,
  557. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  558. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  559. + * GNU General Public License for more details.
  560. + *
  561. + * You should have received a copy of the GNU General Public License
  562. + * along with this program; if not, write to the Free Software
  563. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  564. + * 02111-1307, USA.
  565. + *
  566. + * http://www.gnu.org/copyleft/gpl.html
  567. + */
  568. +package net.sf.l2j.gameserver.handler.admincommandhandlers;
  569. +
  570. +import java.sql.Connection;
  571. +import java.sql.PreparedStatement;
  572. +import java.util.StringTokenizer;
  573. +import java.util.logging.Level;
  574. +import java.util.logging.Logger;
  575. +
  576. +import net.sf.l2j.Config;
  577. +import net.sf.l2j.L2DatabaseFactory;
  578. +import net.sf.l2j.gameserver.datatables.GmListTable;
  579. +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
  580. +import net.sf.l2j.gameserver.model.L2Object;
  581. +import net.sf.l2j.gameserver.model.L2World;
  582. +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  583. +import net.sf.l2j.gameserver.network.clientpackets.Say2;
  584. +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
  585. +
  586. +public class AdminVip implements IAdminCommandHandler
  587. +{
  588. + private static String[] _adminCommands = { "admin_setvip", "admin_removevip" };
  589. + private final static Logger _log = Logger.getLogger(AdminVip.class.getName());
  590. +
  591. + @Override
  592. + public boolean useAdminCommand(String command, L2PcInstance activeChar)
  593. + {
  594. + if (command.startsWith("admin_setvip"))
  595. + {
  596. + StringTokenizer str = new StringTokenizer(command);
  597. +
  598. + L2Object target = activeChar.getTarget();
  599. + L2PcInstance player = null;
  600. +
  601. + if (target != null && target instanceof L2PcInstance)
  602. + player = (L2PcInstance)target;
  603. + else
  604. + player = activeChar;
  605. +
  606. + try
  607. + {
  608. + str.nextToken();
  609. + String time = str.nextToken();
  610. + if (str.hasMoreTokens())
  611. + {
  612. + String playername = time;
  613. + time = str.nextToken();
  614. + player = L2World.getInstance().getPlayer(playername);
  615. + doVip(activeChar, player, playername, time);
  616. + }
  617. + else
  618. + {
  619. + String playername = player.getName();
  620. + doVip(activeChar, player, playername, time);
  621. + }
  622. + }
  623. + catch(Exception e)
  624. + {
  625. + activeChar.sendMessage("Usage: //setvip <char_name> [time](in days)");
  626. + }
  627. +
  628. + player.broadcastUserInfo();
  629. +
  630. + if(player.isVip())
  631. + return true;
  632. + }
  633. + else if(command.startsWith("admin_removevip"))
  634. + {
  635. + StringTokenizer str = new StringTokenizer(command);
  636. +
  637. + L2Object target = activeChar.getTarget();
  638. + L2PcInstance player = null;
  639. +
  640. + if (target instanceof L2PcInstance)
  641. + player = (L2PcInstance)target;
  642. + else
  643. + player = activeChar;
  644. +
  645. + try
  646. + {
  647. + str.nextToken();
  648. +
  649. + if (str.hasMoreTokens())
  650. + {
  651. + String playername = str.nextToken();
  652. + player = L2World.getInstance().getPlayer(playername);
  653. + removeVip(activeChar, player, playername);
  654. + }
  655. + else
  656. + {
  657. + String playername = player.getName();
  658. + removeVip(activeChar, player, playername);
  659. + }
  660. + }
  661. + catch(Exception e)
  662. + {
  663. + activeChar.sendMessage("Usage: //removevip <char_name>");
  664. + }
  665. +
  666. + player.broadcastUserInfo();
  667. +
  668. + if(player.isVip())
  669. + return false;
  670. + }
  671. + return false;
  672. + }
  673. +
  674. + public void doVip(L2PcInstance activeChar, L2PcInstance _player, String _playername, String _time)
  675. + {
  676. + int days = Integer.parseInt(_time);
  677. +
  678. + if (_player == null)
  679. + {
  680. + activeChar.sendMessage("Character not found.");
  681. + return;
  682. + }
  683. + if (_player.isVip())
  684. + {
  685. + activeChar.sendMessage("Player " + _playername + " is already an VIP.");
  686. + return;
  687. + }
  688. +
  689. + if(days > 0)
  690. + {
  691. + _player.setVip(true);
  692. + _player.setEndTime("vip", days);
  693. + _player.sendPacket(new CreatureSay(0,Say2.HERO_VOICE,"System","Dear player, you are now an VIP, congratulations."));
  694. +
  695. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  696. + {
  697. + PreparedStatement statement = con.prepareStatement("UPDATE characters SET vip=1, vip_end=? WHERE obj_id=?");
  698. + statement.setLong(1, _player.getVipEndTime());
  699. + statement.setInt(2, _player.getObjectId());
  700. + statement.execute();
  701. + statement.close();
  702. +
  703. + if(Config.ALLOW_VIP_NCOLOR)
  704. + _player.getAppearance().setNameColor(Config.VIP_NCOLOR);
  705. +
  706. + if(Config.ALLOW_VIP_TCOLOR)
  707. + _player.getAppearance().setTitleColor(Config.VIP_TCOLOR);
  708. +
  709. + _player.broadcastUserInfo();
  710. +
  711. + GmListTable.broadcastMessageToGMs("GM "+ activeChar.getName()+ " set an VIP status for player "+ _playername + " for " + _time + " day(s)");
  712. + }
  713. + catch (Exception e)
  714. + {
  715. + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
  716. + }
  717. + }
  718. + }
  719. +
  720. + public void removeVip(L2PcInstance activeChar, L2PcInstance _player, String _playername)
  721. + {
  722. + if (!_player.isVip())
  723. + {
  724. + activeChar.sendMessage("Player " + _playername + " is not an VIP.");
  725. + return;
  726. + }
  727. +
  728. + _player.setVip(false);
  729. + _player.setVipEndTime(0);
  730. +
  731. + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  732. + {
  733. + PreparedStatement statement = con.prepareStatement("UPDATE characters SET Vip=0, Vip_end=0 WHERE obj_id=?");
  734. + statement.setInt(1, _player.getObjectId());
  735. + statement.execute();
  736. + statement.close();
  737. +
  738. + _player.getAppearance().setNameColor(0xFFFF77);
  739. + _player.getAppearance().setTitleColor(0xFFFF77);
  740. + _player.broadcastUserInfo();
  741. +
  742. + GmListTable.broadcastMessageToGMs("GM "+activeChar.getName()+" removed Vip status of player "+ _playername);
  743. + }
  744. + catch (Exception e)
  745. + {
  746. + _log.log(Level.WARNING,"Something went wrong, check log folder for details", e);
  747. + }
  748. + }
  749. +
  750. + @Override
  751. + public String[] getAdminCommandList()
  752. + {
  753. + return _adminCommands;
  754. + }
  755. +}
  756. \ No newline at end of file
  757.  
  758. Datapack SQL
  759.  
  760. ALTER TABLE `characters` ADD COLUMN `vip` decimal(1,0) NOT NULL DEFAULT 0 AFTER `newbie_at`;
  761. ALTER TABLE `characters` ADD COLUMN `vip_end` decimal(20,0) NOT NULL DEFAULT 0 AFTER `vip`;
  762.  
  763. adminCommandRights.xml
  764. <command name="admin_setvip" val="100"/>
  765. <command name="admin_removevip" val="100"/>
  766.  
Add Comment
Please, Sign In to add comment