Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: com/l2jfrozen/gameserver/handler/itemhandlers/VipCoin.java;
- +package com.l2jfrozen.gameserver.handler.itemhandlers;
- +
- +import java.util.Calendar;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.handler.IItemHandler;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
- +import com.l2jfrozen.gameserver.network.serverpackets.EtcStatusUpdate;
- +
- +/**
- + *
- + * @author Computer Sarada
- + *
- + */
- +public class VipCoin implements IItemHandler
- +{
- + private static final int ITEM_IDS[] = { Config.VIP_COIN_ID1, Config.VIP_COIN_ID2, Config.VIP_COIN_ID3};
- +
- + @Override
- + public void useItem(final L2PlayableInstance playable, final L2ItemInstance item)
- + {
- + if (!(playable instanceof L2PcInstance))
- + return;
- +
- + L2PcInstance activeChar = (L2PcInstance)playable;
- +
- + int itemId = item.getItemId();
- +
- + if (itemId == Config.VIP_COIN_ID1)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isVip())
- + {
- + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID1));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID1 + " day of VIP.");
- + }
- + else
- + {
- + activeChar.setVip(true);
- + activeChar.setEndTime("vip", Config.VIP_DAYS_ID1);
- + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID1 + " day.");
- + }
- +
- + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
- + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
- +
- + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
- + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
- +
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- +
- + else if (itemId == Config.VIP_COIN_ID2)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isVip())
- + {
- + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID2));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID2 + " day of VIP.");
- + }
- + else
- + {
- + activeChar.setVip(true);
- + activeChar.setEndTime("vip", Config.VIP_DAYS_ID2);
- + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID2 + " day.");
- + }
- +
- + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
- + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
- +
- + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
- + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
- +
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- +
- + else if (itemId == Config.VIP_COIN_ID3)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isVip())
- + {
- + long daysleft = (activeChar.getVipEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("vip", (int)(daysleft + Config.VIP_DAYS_ID3));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.VIP_DAYS_ID3 + " day of VIP.");
- + }
- + else
- + {
- + activeChar.setVip(true);
- + activeChar.setEndTime("vip", Config.VIP_DAYS_ID3);
- + activeChar.sendMessage("Congrats, you just became VIP per " + Config.VIP_DAYS_ID3 + " day.");
- + }
- +
- + if (Config.ALLOW_VIP_NCOLOR && activeChar.isVip())
- + activeChar.getAppearance().setNameColor(Config.VIP_NCOLOR);
- +
- + if (Config.ALLOW_VIP_TCOLOR && activeChar.isVip())
- + activeChar.getAppearance().setTitleColor(Config.VIP_TCOLOR);
- +
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- + }
- + @Override
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- + }
- Index: com/l2jfrozen/gameserver/handler/ItemHandler.java;
- import com.l2jfrozen.gameserver.handler.itemhandlers.SummonItems;
- +import com.l2jfrozen.gameserver.handler.itemhandlers.VipCoin;
- _datatable = new TreeMap<>();
- +registerItemHandler(new VipCoin());
- registerItemHandler(new ScrollOfEscape());
- Index: com/l2jfrozen/Config.java;
- public static boolean WEDDING_GIVE_CUPID_BOW;
- public static boolean ANNOUNCE_WEDDING;
- + public static int VIP_COIN_ID1;
- + public static int VIP_DAYS_ID1;
- + public static int VIP_COIN_ID2;
- + public static int VIP_DAYS_ID2;
- + public static int VIP_COIN_ID3;
- + public static int VIP_DAYS_ID3;
- ENABLE_AIO_SYSTEM = Boolean.parseBoolean(otherSettings.getProperty("EnableAioSystem", "True"));
- +VIP_COIN_ID1 = Integer.parseInt(otherSettings.getProperty("VipCoin", "0"));
- +VIP_DAYS_ID1 = Integer.parseInt(otherSettings.getProperty("VipCoinDays", "1"));
- +VIP_COIN_ID2 = Integer.parseInt(otherSettings.getProperty("VipCoin2", "0"));
- +VIP_DAYS_ID2 = Integer.parseInt(otherSettings.getProperty("VipCoinDays2", "2"));
- +VIP_COIN_ID3 = Integer.parseInt(otherSettings.getProperty("VipCoin3", "0"));
- +VIP_DAYS_ID3 = Integer.parseInt(otherSettings.getProperty("VipCoinDays3", "3"));
- Index: gameserver/config/head/other.properties;
- # Crit announce
- GMShowCritAnnouncerName = False
- +#=============================================================
- +# VIP Item 1
- +#=============================================================
- +#Item Coin 1
- +VipCoin = 6392
- +VipCoinDays = 15
- +
- +#=============================================================
- +# VIP Item 2
- +#=============================================================
- +#Item Coin 2
- +VipCoin2 = 6393
- +VipCoinDays2 = 30
- +
- +#=============================================================
- +# VIP Item 3
- +#=============================================================
- +#Item Coin 3
- +VipCoin3 = 5557
- +VipCoinDays3 = 45
Add Comment
Please, Sign In to add comment