Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P aCis_gameserver
- Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 650)
- +++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
- @@ -18,6 +18,7 @@
- import java.util.Map;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAdmin;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAnnouncements;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBan;
- import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminBookmark;
- @@ -76,6 +77,7 @@
- protected AdminCommandHandler()
- {
- registerAdminCommandHandler(new AdminAdmin());
- + registerAdminCommandHandler(new AdminAio());
- registerAdminCommandHandler(new AdminAnnouncements());
- registerAdminCommandHandler(new AdminBan());
- registerAdminCommandHandler(new AdminBookmark());
- Index: java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java (revision 650)
- +++ java/net/sf/l2j/gameserver/model/olympiad/OlympiadManager.java (working copy)
- @@ -153,6 +153,12 @@
- return false;
- }
- + if (player.isAio())
- + {
- + player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
- + return false;
- + }
- +
- switch (type)
- {
- case CLASSED:
- Index: java/net/sf/l2j/gameserver/taskmanager/AioTaskManager.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/taskmanager/AioTaskManager.java (nonexistent)
- +++ java/net/sf/l2j/gameserver/taskmanager/AioTaskManager.java (working copy)
- @@ -0,0 +1,73 @@
- +/*
- + * This program is free software: you can redistribute it and/or modify it under
- + * the terms of the GNU General Public License as published by the Free Software
- + * Foundation, either version 3 of the License, or (at your option) any later
- + * version.
- + *
- + * This program is distributed in the hope that it will be useful, but WITHOUT
- + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- + * details.
- + *
- + * You should have received a copy of the GNU General Public License along with
- + * this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package net.sf.l2j.gameserver.taskmanager;
- +
- +import java.util.Map;
- +import java.util.concurrent.ConcurrentHashMap;
- +
- +import net.sf.l2j.commons.concurrent.ThreadPool;
- +
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
- +import net.sf.l2j.gameserver.model.actor.L2Character;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +
- +public final class AioTaskManager implements Runnable
- +{
- + private final Map<L2PcInstance, Long> _players = new ConcurrentHashMap<>();
- +
- + protected AioTaskManager()
- + {
- + // Run task each 10 second.
- + ThreadPool.scheduleAtFixedRate(this, 10000, 10000);
- + }
- +
- + public final void add(L2PcInstance player)
- + {
- + _players.put(player, System.currentTimeMillis());
- + }
- +
- + public final void remove(L2Character player)
- + {
- + _players.remove(player);
- + }
- +
- + @Override
- + public final void run()
- + {
- + if (_players.isEmpty())
- + return;
- +
- + for (Map.Entry<L2PcInstance, Long> entry : _players.entrySet())
- + {
- + final L2PcInstance player = entry.getKey();
- +
- + if (player.getMemos().getLong("aioEndTime") < System.currentTimeMillis())
- + {
- + AdminAio.removeAio(player);
- + remove(player);
- + }
- + }
- + }
- +
- + public static final AioTaskManager getInstance()
- + {
- + return SingletonHolder._instance;
- + }
- +
- + private static class SingletonHolder
- + {
- + protected static final AioTaskManager _instance = new AioTaskManager();
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 650)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -483,6 +483,13 @@
- public static boolean STORE_SKILL_COOLTIME;
- public static int BUFFS_MAX_AMOUNT;
- + /** AIO System */
- + public static Map<Integer, Integer> AIO_SKILLS;
- + public static int AIO_NICK_COLOR;
- + public static int AIO_TITLE_COLOR;
- + public static int AIO_ITEM_ID;
- + public static int AIO_COIN_DURATION;
- +
- // --------------------------------------------------
- // Sieges
- // --------------------------------------------------
- @@ -1185,6 +1192,18 @@
- BUFFS_MAX_AMOUNT = players.getProperty("MaxBuffsAmount", 20);
- STORE_SKILL_COOLTIME = players.getProperty("StoreSkillCooltime", true);
- +
- + AIO_NICK_COLOR = Integer.decode("0x" + players.getProperty("AioNameColor", "FFFF00"));
- + AIO_TITLE_COLOR = Integer.decode("0x" + players.getProperty("AioTitleColor", "FFFF00"));
- + AIO_ITEM_ID = players.getProperty("AioItemId", 5233);
- + AIO_COIN_DURATION = players.getProperty("AioCoinDuration", 1);
- +
- + AIO_SKILLS = new HashMap<>();
- + for (String skillInfo : players.getProperty("AioSkills").split(";"))
- + {
- + final String[] info = skillInfo.split(",");
- + AIO_SKILLS.put(Integer.parseInt(info[0]), Integer.parseInt(info[1]));
- + }
- }
- /**
- Index: java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (revision 650)
- +++ java/net/sf/l2j/gameserver/network/serverpackets/CharInfo.java (working copy)
- @@ -206,7 +206,7 @@
- writeD(0);
- }
- - writeD(_activeChar.getAppearance().getNameColor());
- + writeD(_activeChar.isAio() ? Config.AIO_NICK_COLOR : _activeChar.getAppearance().getNameColor());
- writeD(0x00); // isRunning() as in UserInfo?
- @@ -213,7 +213,7 @@
- writeD(_activeChar.getPledgeClass());
- writeD(_activeChar.getPledgeType());
- - writeD(_activeChar.getAppearance().getTitleColor());
- + writeD(_activeChar.isAio() ? Config.AIO_TITLE_COLOR : _activeChar.getAppearance().getTitleColor());
- if (_activeChar.isCursedWeaponEquipped())
- writeD(CursedWeaponsManager.getInstance().getCurrentStage(_activeChar.getCursedWeaponEquippedId()) - 1);
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2AioInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2AioInstance.java (nonexistent)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2AioInstance.java (working copy)
- @@ -0,0 +1,84 @@
- +/*
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.model.actor.instance;
- +
- +import java.util.StringTokenizer;
- +
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- +import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
- +import net.sf.l2j.gameserver.network.SystemMessageId;
- +import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- +
- +public class L2AioInstance extends L2NpcInstance
- +{
- + public L2AioInstance(int objectId, NpcTemplate template)
- + {
- + super(objectId, template);
- + }
- +
- + @Override
- + public void onBypassFeedback(L2PcInstance player, String command)
- + {
- + StringTokenizer st = new StringTokenizer(command, " ");
- + String currentCommand = st.nextToken();
- +
- + if (currentCommand.startsWith("buy"))
- + {
- + if (st.countTokens() != 3)
- + return;
- +
- + if (OlympiadManager.getInstance().isRegisteredInComp(player))
- + {
- + player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
- + return;
- + }
- +
- + final int itemId = Integer.parseInt(st.nextToken());
- + final int count = Integer.parseInt(st.nextToken());
- + final int time = Integer.parseInt(st.nextToken());
- +
- + ItemInstance item = player.getInventory().getItemByItemId(itemId);
- +
- + if (item == null || item.getCount() < count)
- + {
- + player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.NOT_ENOUGH_ITEMS));
- + return;
- + }
- +
- + player.destroyItemByItemId("Consume", itemId, count, player, true);
- + AdminAio.doAio(player, time);
- + }
- +
- + super.onBypassFeedback(player, command);
- + }
- +
- + @Override
- + public String getHtmlPath(int npcId, int val)
- + {
- + String filename = "";
- + if (val == 0)
- + filename = "" + npcId;
- + else
- + filename = npcId + "-" + val;
- +
- + return "data/html/mods/aio/" + filename + ".htm";
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (revision 650)
- +++ java/net/sf/l2j/gameserver/network/serverpackets/UserInfo.java (working copy)
- @@ -264,7 +264,7 @@
- writeD(0);
- }
- - writeD(_activeChar.getAppearance().getNameColor());
- + writeD(_activeChar.isAio() ? Config.AIO_NICK_COLOR : _activeChar.getAppearance().getNameColor());
- // new c5
- writeC(_activeChar.isRunning() ? 0x01 : 0x00); // changes the Speed display on Status Window
- @@ -272,7 +272,7 @@
- writeD(_activeChar.getPledgeClass()); // changes the text above CP on Status Window
- writeD(_activeChar.getPledgeType());
- - writeD(_activeChar.getAppearance().getTitleColor());
- + writeD(_activeChar.isAio() ? Config.AIO_TITLE_COLOR : _activeChar.getAppearance().getTitleColor());
- if (_activeChar.isCursedWeaponEquipped())
- writeD(CursedWeaponsManager.getInstance().getCurrentStage(_activeChar.getCursedWeaponEquippedId()) - 1);
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 650)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (working copy)
- @@ -173,6 +173,11 @@
- player.sendPacket(SystemMessageId.SUBCLASS_NO_CHANGE_OR_CREATE_WHILE_SKILL_IN_USE);
- return;
- }
- + else if (player.isAio())
- + {
- + player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
- + return;
- + }
- // Affecting subclasses (add/del/change) if registered in Olympiads makes you ineligible to compete.
- if (OlympiadManager.getInstance().isRegisteredInComp(player))
- Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java (nonexistent)
- +++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminAio.java (working copy)
- @@ -0,0 +1,171 @@
- +/*
- + * This program is free software; you can redistribute it and/or modify
- + * it under the terms of the GNU General Public License as published by
- + * the Free Software Foundation; either version 2, or (at your option)
- + * any later version.
- + *
- + * This program is distributed in the hope that it will be useful,
- + * but WITHOUT ANY WARRANTY; without even the implied warranty of
- + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- + * GNU General Public License for more details.
- + *
- + * You should have received a copy of the GNU General Public License
- + * along with this program; if not, write to the Free Software
- + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- + * 02111-1307, USA.
- + *
- + * http://www.gnu.org/copyleft/gpl.html
- + */
- +package net.sf.l2j.gameserver.handler.admincommandhandlers;
- +
- +import java.util.StringTokenizer;
- +import java.util.concurrent.TimeUnit;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
- +import net.sf.l2j.gameserver.model.L2Skill;
- +import net.sf.l2j.gameserver.model.World;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.network.clientpackets.Say2;
- +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- +import net.sf.l2j.gameserver.network.serverpackets.SocialAction;
- +import net.sf.l2j.gameserver.taskmanager.AioTaskManager;
- +
- +/**
- + * @author SweeTs
- + */
- +public class AdminAio implements IAdminCommandHandler
- +{
- + private static String[] _adminCommands =
- + {
- + "admin_setaio",
- + "admin_removeaio"
- + };
- +
- + @Override
- + public boolean useAdminCommand(String command, L2PcInstance activeChar)
- + {
- + StringTokenizer st = new StringTokenizer(command);
- + st.nextToken();
- + String player = "";
- + int duration = 1;
- + L2PcInstance target = null;
- +
- + // One parameter, player name
- + if (st.hasMoreTokens())
- + {
- + player = st.nextToken();
- + target = World.getInstance().getPlayer(player);
- +
- + // Second parameter, duration
- + if (st.hasMoreTokens())
- + {
- + try
- + {
- + duration = Integer.parseInt(st.nextToken());
- + }
- + catch (NumberFormatException nfe)
- + {
- + activeChar.sendMessage("Invalid number format used: " + nfe);
- + return false;
- + }
- + }
- + }
- + else
- + {
- + // If there is no name, select target
- + if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance)
- + target = (L2PcInstance) activeChar.getTarget();
- + }
- +
- + if (command.startsWith("admin_setaio"))
- + {
- + if (target == null && player.equals(""))
- + {
- + activeChar.sendMessage("Usage: //setaio <char_name> [duration_days]");
- + return false;
- + }
- +
- + if (target != null)
- + {
- + doAio(target, duration);
- + activeChar.sendMessage(target.getName() + " is now an AIO for " + duration + " day(s).");
- + }
- + }
- + else if (command.startsWith("admin_removeaio"))
- + {
- + if (target == null && player.equals(""))
- + {
- + activeChar.sendMessage("Usage: //removeaio <char_name>");
- + return false;
- + }
- +
- + if (target != null)
- + {
- + if (target.isAio())
- + {
- + removeAio(target);
- + activeChar.sendMessage(target.getName() + "'s AIO status has been removed.");
- + }
- + else
- + activeChar.sendMessage(target.getName() + " is not an AIO.");
- + }
- + }
- + return true;
- + }
- +
- + public static void doAio(L2PcInstance target, int time)
- + {
- + target.getStat().addExp(target.getStat().getExpForLevel(81));
- + target.broadcastPacket(new SocialAction(target, 3));
- + target.setAio(true);
- + AioTaskManager.getInstance().add(target);
- +
- + long remainingTime = target.getMemos().getLong("aioEndTime", 0);
- + if (remainingTime > 0)
- + {
- + target.getMemos().set("aioEndTime", remainingTime + TimeUnit.DAYS.toMillis(time));
- + target.sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "System", "Dear player, your AIO status has been extended by " + time + " day(s)."));
- + }
- + else
- + {
- + target.getMemos().set("aioEndTime", System.currentTimeMillis() + TimeUnit.DAYS.toMillis(time));
- + target.sendPacket(new CreatureSay(0, Say2.HERO_VOICE, "System", "Dear player, you are now an AIO, congratulations."));
- +
- + for (L2Skill skill : target.getSkills().values())
- + target.removeSkill(skill);
- +
- + if (Config.AIO_ITEM_ID != 0)
- + {
- + target.addItem("Add", Config.AIO_ITEM_ID, 1, target, true);
- + target.getInventory().equipItemAndRecord(target.getInventory().getItemByItemId(Config.AIO_ITEM_ID));
- + }
- +
- + target.addAioSkills();
- + target.broadcastUserInfo();
- + }
- + }
- +
- + public static void removeAio(L2PcInstance target)
- + {
- + AioTaskManager.getInstance().remove(target);
- + target.getMemos().set("aioEndTime", 0);
- + target.setAio(false);
- +
- + for (L2Skill skill : target.getSkills().values())
- + target.removeSkill(skill);
- +
- + if (Config.AIO_ITEM_ID != 0)
- + target.destroyItemByItemId("Destroy", Config.AIO_ITEM_ID, 1, target, true);
- +
- + target.sendPacket(new CreatureSay(0, Say2.PARTYROOM_COMMANDER, "System", "Your AIO period is over."));
- + target.broadcastPacket(new SocialAction(target, 13));
- + target.broadcastUserInfo();
- + }
- +
- + @Override
- + public String[] getAdminCommandList()
- + {
- + return _adminCommands;
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/handler/ItemHandler.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/ItemHandler.java (revision 650)
- +++ java/net/sf/l2j/gameserver/handler/ItemHandler.java (working copy)
- @@ -17,6 +17,7 @@
- import java.util.HashMap;
- import java.util.Map;
- +import net.sf.l2j.gameserver.handler.itemhandlers.AioCoin;
- import net.sf.l2j.gameserver.handler.itemhandlers.BeastSoulShot;
- import net.sf.l2j.gameserver.handler.itemhandlers.BeastSpice;
- import net.sf.l2j.gameserver.handler.itemhandlers.BeastSpiritShot;
- @@ -56,6 +57,7 @@
- protected ItemHandler()
- {
- + registerItemHandler(new AioCoin());
- registerItemHandler(new BeastSoulShot());
- registerItemHandler(new BeastSpice());
- registerItemHandler(new BeastSpiritShot());
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 650)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -243,6 +243,7 @@
- import net.sf.l2j.gameserver.skills.funcs.FuncMaxCpMul;
- import net.sf.l2j.gameserver.skills.l2skills.L2SkillSiegeFlag;
- import net.sf.l2j.gameserver.skills.l2skills.L2SkillSummon;
- +import net.sf.l2j.gameserver.taskmanager.AioTaskManager;
- import net.sf.l2j.gameserver.taskmanager.AttackStanceTaskManager;
- import net.sf.l2j.gameserver.taskmanager.GameTimeTaskManager;
- import net.sf.l2j.gameserver.taskmanager.ItemsOnGroundTaskManager;
- @@ -466,6 +467,7 @@
- private boolean _isNoble;
- private boolean _isHero;
- + private boolean _isAio;
- private L2Npc _currentFolkNpc;
- @@ -1931,7 +1933,7 @@
- }
- // Auto-Learn skills if activated
- - if (Config.AUTO_LEARN_SKILLS)
- + if (Config.AUTO_LEARN_SKILLS && !isAio())
- giveAvailableSkills();
- sendSkillList();
- @@ -4330,6 +4332,7 @@
- PvpFlagTaskManager.getInstance().remove(this);
- GameTimeTaskManager.getInstance().remove(this);
- ShadowItemTaskManager.getInstance().remove(this);
- + AioTaskManager.getInstance().remove(this);
- }
- /**
- @@ -6576,6 +6579,12 @@
- return false;
- }
- + if (isAio() && !isGM() && !isInsideZone(ZoneId.TOWN))
- + {
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- +
- // Cancels the use of skills when player uses a cursed weapon or is flying.
- if ((isCursedWeaponEquipped() && !skill.isDemonicSkill()) // If CW, allow ONLY demonic skills.
- || (getMountType() == 1 && !skill.isStriderSkill()) // If mounted, allow ONLY Strider skills.
- @@ -8123,6 +8132,9 @@
- if (isWearingFormalWear)
- isDisabled = true;
- + if (isAio() && !isGM() && !isInsideZone(ZoneId.TOWN))
- + isDisabled = true;
- +
- sl.addSkill(s.getId(), s.getLevel(), s.isPassive(), isDisabled);
- }
- sendPacket(sl);
- @@ -8451,6 +8463,9 @@
- if (isCursedWeaponEquipped())
- CursedWeaponsManager.getInstance().getCursedWeapon(getCursedWeaponEquippedId()).cursedOnLogin();
- + if (isAio())
- + AioTaskManager.getInstance().add(this);
- +
- // Add to the GameTimeTask to keep inform about activity time.
- GameTimeTaskManager.getInstance().add(this);
- @@ -10598,4 +10613,26 @@
- }
- }
- }
- +
- + public boolean isAio()
- + {
- + return _isAio;
- + }
- +
- + public void setAio(boolean b)
- + {
- + _isAio = b;
- + }
- +
- + public void addAioSkills()
- + {
- + for (int skillid : Config.AIO_SKILLS.keySet())
- + {
- + final L2Skill skill = SkillTable.getInstance().getInfo(skillid, Config.AIO_SKILLS.get(skillid));
- +
- + if (skill != null)
- + addSkill(skill, true);
- + }
- + sendSkillList();
- + }
- }
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/handler/itemhandlers/AioCoin.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/handler/itemhandlers/AioCoin.java (nonexistent)
- +++ java/net/sf/l2j/gameserver/handler/itemhandlers/AioCoin.java (working copy)
- @@ -0,0 +1,45 @@
- +/*
- + * This program is free software: you can redistribute it and/or modify it under
- + * the terms of the GNU General Public License as published by the Free Software
- + * Foundation, either version 3 of the License, or (at your option) any later
- + * version.
- + *
- + * This program is distributed in the hope that it will be useful, but WITHOUT
- + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- + * details.
- + *
- + * You should have received a copy of the GNU General Public License along with
- + * this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package net.sf.l2j.gameserver.handler.itemhandlers;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.handler.IItemHandler;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
- +import net.sf.l2j.gameserver.model.actor.L2Playable;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.item.instance.ItemInstance;
- +import net.sf.l2j.gameserver.model.olympiad.OlympiadManager;
- +import net.sf.l2j.gameserver.network.SystemMessageId;
- +
- +public class AioCoin implements IItemHandler
- +{
- + @Override
- + public void useItem(L2Playable playable, ItemInstance item, boolean forceUse)
- + {
- + if (!(playable instanceof L2PcInstance))
- + return;
- +
- + L2PcInstance activeChar = (L2PcInstance) playable;
- +
- + if (activeChar.isInOlympiadMode() || OlympiadManager.getInstance().isRegisteredInComp(activeChar))
- + {
- + activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
- + return;
- + }
- +
- + activeChar.destroyItem("Consume", item.getObjectId(), 1, null, true);
- + AdminAio.doAio(activeChar, Config.AIO_COIN_DURATION);
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (revision 650)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2NpcInstance.java (working copy)
- @@ -81,6 +81,12 @@
- return;
- }
- + if (player.isAio())
- + {
- + player.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
- + return;
- + }
- +
- AcquireSkillList asl = new AcquireSkillList(AcquireSkillList.SkillType.Usual);
- boolean empty = true;
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 650)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -17,6 +17,7 @@
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- +import java.util.Calendar;
- import java.util.Map.Entry;
- import java.util.logging.Level;
- @@ -28,6 +29,7 @@
- import net.sf.l2j.gameserver.datatables.GmListTable;
- import net.sf.l2j.gameserver.datatables.MapRegionTable.TeleportWhereType;
- import net.sf.l2j.gameserver.datatables.SkillTable.FrequentSkill;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminAio;
- import net.sf.l2j.gameserver.instancemanager.CastleManager;
- import net.sf.l2j.gameserver.instancemanager.ClanHallManager;
- import net.sf.l2j.gameserver.instancemanager.CoupleManager;
- @@ -240,6 +242,9 @@
- activeChar.sendPacket(new EtcStatusUpdate(activeChar));
- activeChar.sendSkillList();
- + if (activeChar.getMemos().getLong("aioEndTime", 0) > 0)
- + onEnter(activeChar);
- +
- // Load quests.
- try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- {
- @@ -339,6 +344,35 @@
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- }
- + private static void onEnter(L2PcInstance activeChar)
- + {
- + final long now = Calendar.getInstance().getTimeInMillis();
- + final long endDay = activeChar.getMemos().getLong("aioEndTime");
- +
- + if (now > endDay)
- + AdminAio.removeAio(activeChar);
- + else
- + {
- + activeChar.setAio(true);
- + activeChar.broadcastUserInfo();
- + sendReEnterMessage(endDay, activeChar);
- + }
- + }
- +
- + private static void sendReEnterMessage(long time, L2PcInstance activeChar)
- + {
- + final long remainingTime = (time - System.currentTimeMillis()) / 1000;
- + final int hours = (int) (remainingTime / 3600);
- + final int minutes = (int) ((remainingTime % 3600) / 60);
- + final int seconds = (int) ((remainingTime % 3600) % 60);
- +
- + String msg = "Your AIO period ends after: %hours% hours, %mins% minutes and %secs% seconds!";
- + msg = msg.replaceAll("%hours%", Integer.toString(hours));
- + msg = msg.replaceAll("%mins%", Integer.toString(minutes));
- + msg = msg.replaceAll("%secs%", Integer.toString(seconds));
- + activeChar.sendMessage(msg);
- + }
- +
- @Override
- protected boolean triggersOnActionRequest()
- {
- Index: config/players.properties
- ===================================================================
- --- config/players.properties (revision 650)
- +++ config/players.properties (working copy)
- @@ -291,4 +291,34 @@
- MaxBuffsAmount = 20
- # Store buffs/debuffs on user logout?
- -StoreSkillCooltime = True
- \ No newline at end of file
- +StoreSkillCooltime = True
- +
- +#=============================================================
- +# AIO System
- +#=============================================================
- +
- +# Name color
- +AioNameColor = FFFF00
- +
- +# Title color
- +AioTitleColor = FFFF00
- +
- +# ID of the item that will be given to AIO
- +# Default: Keshanberk*Keshanberk
- +# 0 to disable
- +AioItemId = 5233
- +
- +# Time in days
- +AioCoinDuration = 1
- +
- +# List of Aio Skills
- +# Format : skillid,skilllvl;skillid2,skilllvl2;
- +AioSkills = 1085,3;1304,3;1087,3;1354,1;1062,2;1243,6;1045,6;1048,6;1429,1;163,1;\
- +1311,6;213,8;1007,3;1309,3;1552,3;1006,3;1308,3;1253,3;1284,3;1392,3;1393,3;214,1;\
- +1009,3;1310,4;1363,1;1362,1;1397,3;1292,6;1078,6;307,1;276,1;309,1;274,1;275,1;164,3;\
- +272,1;277,1;273,1;311,1;366,1;365,1;310,1;271,1;1242,3;1353,3;1391,3;1002,3;7029,1;\
- +1352,1;229,7;228,3;1077,3;1218,33;1059,3;1219,33;1388,3;1389,3;1240,3;1413,1;\
- +1086,2;1036,2;1035,4;1068,3;1356,1;1355,1;1357,1;1307,3;1410,1;1409,1;1353,1;\
- +1044,3;1182,3;1191,3;1189,3;1259,4;1306,6;234,23;1040,3;364,1;264,1;306,1;\
- +269,1;270,1;265,1;363,1;349,1;308,1;305,1;304,1;267,1;266,1;268,1;1390,3;1303,2;\
- +1204,2;1268,4
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement