Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: com/l2jfrozen/gameserver/handler/itemhandlers/AioItem.java;
- +package com.l2jfrozen.gameserver.handler.itemhandlers;
- +import java.util.Calendar;
- +import java.util.StringTokenizer;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.handler.IItemHandler;
- +import com.l2jfrozen.gameserver.model.L2Character;
- +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 AioItem implements IItemHandler
- +{
- + private static final int ITEM_IDS[] = { Config.AIO_ITEM, Config.AIO_ITEM2, Config.AIO_ITEM3};
- +
- + @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.AIO_ITEM)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
- + activeChar.sendMessage("You can only use this item in peace zone..");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isAio())
- + {
- + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS + " day of AIO.");
- + }
- + else
- + {
- + activeChar.setAio(true);
- + activeChar.setEndTime("aio", Config.AIO_DIAS);
- + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS + " day.");
- + }
- +
- + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
- + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
- +
- + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
- + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
- + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(81));
- + activeChar.rewardAioSkills();
- + if (Config.ALLOW_AIO_ITEM)
- + {
- + StringTokenizer st = new StringTokenizer((Config.AIO_ITEMID), ",");
- + while (st.hasMoreElements())
- + {
- + int item_id = Integer.parseInt(st.nextToken());
- + activeChar.getInventory().addItem("", item_id, 1, activeChar, null);
- + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(item_id));
- + }
- + }
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- +
- + else if (itemId == Config.AIO_ITEM2)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
- + activeChar.sendMessage("You can only use this item in peace zone..");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isAio())
- + {
- + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS2));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS2 + " day of AIO.");
- + }
- + else
- + {
- + activeChar.setAio(true);
- + activeChar.setEndTime("aio", Config.AIO_DIAS2);
- + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS2 + " day.");
- + }
- +
- + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
- + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
- +
- + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
- + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
- + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(81));
- + activeChar.rewardAioSkills();
- + if (Config.ALLOW_AIO_ITEM)
- + {
- + StringTokenizer st = new StringTokenizer((Config.AIO_ITEMID), ",");
- + while (st.hasMoreElements())
- + {
- + int item_id = Integer.parseInt(st.nextToken());
- + activeChar.getInventory().addItem("", item_id, 1, activeChar, null);
- + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(item_id));
- + }
- + }
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- +
- + else if (itemId == Config.AIO_ITEM3)
- + {
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on Olympiad Games.");
- + return;
- + }
- + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
- + activeChar.sendMessage("You can only use this item in peace zone..");
- + return;
- + }
- + if (activeChar.destroyItem("Consume", item.getObjectId(), 1, null, false))
- + {
- + if (activeChar.isAio())
- + {
- + long daysleft = (activeChar.getAioEndTime() - Calendar.getInstance().getTimeInMillis()) / 86400000L;
- + activeChar.setEndTime("aio", (int)(daysleft + Config.AIO_DIAS3));
- + activeChar.sendMessage("Congratulations, You just received another " + Config.AIO_DIAS3 + " day of AIO.");
- + }
- + else
- + {
- + activeChar.setAio(true);
- + activeChar.setEndTime("aio", Config.AIO_DIAS3);
- + activeChar.sendMessage("Congrats, you just became AIO per " + Config.AIO_DIAS3 + " day.");
- + }
- +
- + if (Config.ALLOW_AIO_NCOLOR && activeChar.isAio())
- + activeChar.getAppearance().setNameColor(Config.AIO_NCOLOR);
- +
- + if (Config.ALLOW_AIO_TCOLOR && activeChar.isAio())
- + activeChar.getAppearance().setTitleColor(Config.AIO_TCOLOR);
- + activeChar.getStat().addExp(activeChar.getStat().getExpForLevel(81));
- + activeChar.rewardAioSkills();
- + if (Config.ALLOW_AIO_ITEM)
- + {
- + StringTokenizer st = new StringTokenizer((Config.AIO_ITEMID), ",");
- + while (st.hasMoreElements())
- + {
- + int item_id = Integer.parseInt(st.nextToken());
- + activeChar.getInventory().addItem("", item_id, 1, activeChar, null);
- + activeChar.getInventory().equipItem(activeChar.getInventory().getItemByItemId(item_id));
- + }
- + }
- + activeChar.broadcastUserInfo();
- + activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- + }
- + }
- + }
- + @Override
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- + }
- Index: com/l2jfrozen/gameserver/handler/itemhandlers.java;
- +import com.l2jfrozen.gameserver.handler.itemhandlers.AioItem;
- import com.l2jfrozen.gameserver.handler.itemhandlers.BeastSoulShot;
- _datatable = new TreeMap<>();
- +registerItemHandler(new AioItem());
- Index: com/l2jfrozen/Config.java;
- public static boolean ANNOUNCE_WEDDING;
- + public static int AIO_ITEM;
- + public static int AIO_DIAS;
- + public static int AIO_ITEM2;
- + public static int AIO_DIAS2;
- + public static int AIO_ITEM3;
- + public static int AIO_DIAS3;
- VIP_DAYS_ID3 = Integer.parseInt(otherSettings.getProperty("VipCoinDays3", "3"));
- + ALLOW_AIO_ITEM = Boolean.parseBoolean(otherSettings.getProperty("EnableDualAIO", "True"));
- + AIO_ITEMID = otherSettings.getProperty("ItemIdAio", "9209,9210");
- + AIO_ITEM = Integer.parseInt(otherSettings.getProperty("AioCoin", "10"));
- + AIO_DIAS = Integer.parseInt(otherSettings.getProperty("AioDays", "10"));
- + AIO_ITEM2 = Integer.parseInt(otherSettings.getProperty("AioCoin2", "10"));
- + AIO_DIAS2 = Integer.parseInt(otherSettings.getProperty("AioDays2", "10"));
- + AIO_ITEM3 = Integer.parseInt(otherSettings.getProperty("AioCoin3", "10"));
- + AIO_DIAS3 = Integer.parseInt(otherSettings.getProperty("AioDays3", "10"));
- Index: gameserver/config/head/other.properties;
- GMShowCritAnnouncerName = False
- +#=============================================================
- +# AIO Item 1
- +#=============================================================
- +EnableDualAIO = True
- +ItemIdAio = 6580
- +
- +AioCoin = 6392
- +AioDays = 1
- +#=============================================================
- +# AIO Item 2
- +#=============================================================
- +AioCoin2 = 6393
- +AioDays2 = 5
- +#=============================================================
- +# AIO Item 3
- +#=============================================================
- +AioCoin3 = 5556
- +AioDays3 = 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement