From 241ef1a1c48ffd2b32a4826f9e210ab7f43d820f Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Fri, 1 Jun 2018 08:55:09 +0000 Subject: [PATCH] Disable completely Nevit system by config. Contributed by Sahar. --- .../admincommandhandlers/AdminEditChar.java | 5 ++++- .../handlers/effecthandlers/GiveRecommendation.java | 6 +++++- .../gameserver/model/actor/stat/PcStat.java | 13 ++++++++----- .../gameserver/model/entity/NevitSystem.java | 7 +++++-- .../gameserver/model/zone/type/L2PeaceZone.java | 13 ++++++++----- .../network/clientpackets/EnterWorld.java | 10 ++++++++-- .../network/clientpackets/RequestVoteNew.java | 8 ++++++-- .../gameserver/taskmanager/tasks/TaskNevit.java | 6 ++++++ .../gameserver/taskmanager/tasks/TaskRecom.java | 12 ++++++++---- 9 files changed, 58 insertions(+), 22 deletions(-) diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java index 7e3d1d2a85..a24286ea36 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java @@ -330,7 +330,10 @@ public class AdminEditChar implements IAdminCommandHandler player.broadcastUserInfo(); player.sendPacket(new UserInfo(player)); player.sendPacket(new ExBrExtraUserInfo(player)); - player.sendPacket(new ExVoteSystemInfo(player)); + if (Config.NEVIT_ENABLED) + { + player.sendPacket(new ExVoteSystemInfo(player)); + } player.sendMessage("A GM changed your Recommend points to " + recVal); activeChar.sendMessage(player.getName() + "'s Recommend changed to " + recVal); } diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GiveRecommendation.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GiveRecommendation.java index 091eaa31f6..231859dfda 100644 --- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GiveRecommendation.java +++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/effecthandlers/GiveRecommendation.java @@ -16,6 +16,7 @@ */ package handlers.effecthandlers; +import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.StatsSet; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.conditions.Condition; @@ -72,7 +73,10 @@ public final class GiveRecommendation extends AbstractEffect sm.addInt(recommendationsGiven); target.sendPacket(sm); target.sendPacket(new UserInfo(target)); - target.sendPacket(new ExVoteSystemInfo(target)); + if (Config.NEVIT_ENABLED) + { + target.sendPacket(new ExVoteSystemInfo(target)); + } } else { diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/stat/PcStat.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/stat/PcStat.java index 2ed1a93772..39f293a0e8 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/stat/PcStat.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/stat/PcStat.java @@ -137,7 +137,7 @@ public class PcStat extends PlayableStat double bonusSp = 1.; // Start Nevit's Hourglass - if ((addToExp > 0) && !activeChar.isInsideZone(ZoneId.PEACE)) + if (Config.NEVIT_ENABLED && (addToExp > 0) && !activeChar.isInsideZone(ZoneId.PEACE)) { activeChar.startNevitHourglassTask(); @@ -153,7 +153,7 @@ public class PcStat extends PlayableStat bonusSp = getSpBonusMultiplier(); } - if ((addToExp > 0) && !activeChar.isInsideZone(ZoneId.PEACE)) + if (Config.NEVIT_ENABLED && (addToExp > 0) && !activeChar.isInsideZone(ZoneId.PEACE)) { activeChar.getNevitSystem().startAdventTask(); } @@ -331,9 +331,12 @@ public class PcStat extends PlayableStat // Send a Server->Client packet UserInfo to the L2PcInstance getActiveChar().sendPacket(new UserInfo(getActiveChar())); getActiveChar().sendPacket(new ExBrExtraUserInfo(getActiveChar())); - getActiveChar().sendPacket(new ExVoteSystemInfo(getActiveChar())); - // Nevit Points For Level - getActiveChar().getNevitSystem().addPoints(2000); + // Nevit System + if (Config.NEVIT_ENABLED) + { + getActiveChar().sendPacket(new ExVoteSystemInfo(getActiveChar())); + getActiveChar().getNevitSystem().addPoints(2000); + } return levelIncreased; } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/NevitSystem.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/NevitSystem.java index e19bd399ba..2aa258f0bb 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/NevitSystem.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/NevitSystem.java @@ -50,8 +50,11 @@ public class NevitSystem implements IUniqueId { _player = player; - player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this)); - player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_LOGOUT, (OnPlayerLogout event) -> OnPlayerLogout(event), this)); + if (Config.NEVIT_ENABLED) + { + player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_LOGIN, (OnPlayerLogin event) -> onPlayerLogin(event), this)); + player.addListener(new ConsumerEventListener(player, EventType.ON_PLAYER_LOGOUT, (OnPlayerLogout event) -> OnPlayerLogout(event), this)); + } } @RegisterEvent(EventType.ON_PLAYER_LOGIN) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2PeaceZone.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2PeaceZone.java index f08244c0a7..d31b13c7af 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2PeaceZone.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/zone/type/L2PeaceZone.java @@ -53,11 +53,14 @@ public class L2PeaceZone extends L2ZoneType } /* Nevit Turn Off on Peace Zone */ - player.getNevitSystem().stopAdventTask(true); - - // Stop Nevit's Hourglass - player.storeRecommendations(true); - player.getStat().setPausedNevitHourglassStatus(true); + if (Config.NEVIT_ENABLED) + { + player.getNevitSystem().stopAdventTask(true); + + // Stop Nevit's Hourglass + player.storeRecommendations(true); + player.getStat().setPausedNevitHourglassStatus(true); + } } if (Config.PEACE_ZONE_MODE != 2) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java index 17e2b41b57..f02d95fc36 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/EnterWorld.java @@ -393,7 +393,10 @@ public class EnterWorld implements IClientIncomingPacket } } - activeChar.checkRecoBonusTask(); + if (Config.NEVIT_ENABLED) + { + activeChar.checkRecoBonusTask(); + } activeChar.broadcastUserInfo(); @@ -540,7 +543,10 @@ public class EnterWorld implements IClientIncomingPacket activeChar.onPlayerEnter(); client.sendPacket(new SkillCoolTime(activeChar)); - client.sendPacket(new ExVoteSystemInfo(activeChar)); + if (Config.NEVIT_ENABLED) + { + client.sendPacket(new ExVoteSystemInfo(activeChar)); + } client.sendPacket(new ExShowContactList(activeChar)); for (L2ItemInstance i : activeChar.getInventory().getItems()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestVoteNew.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestVoteNew.java index 747b331991..749847036a 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestVoteNew.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestVoteNew.java @@ -16,6 +16,7 @@ */ package com.l2jmobius.gameserver.network.clientpackets; +import com.l2jmobius.Config; import com.l2jmobius.commons.network.PacketReader; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -101,7 +102,10 @@ public final class RequestVoteNew implements IClientIncomingPacket client.sendPacket(new ExBrExtraUserInfo(activeChar)); target.broadcastUserInfo(); - activeChar.sendPacket(new ExVoteSystemInfo(activeChar)); - target.sendPacket(new ExVoteSystemInfo(target)); + if (Config.NEVIT_ENABLED) + { + activeChar.sendPacket(new ExVoteSystemInfo(activeChar)); + target.sendPacket(new ExVoteSystemInfo(target)); + } } } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java index c11f4beea2..066d0d8784 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskNevit.java @@ -16,6 +16,7 @@ */ package com.l2jmobius.gameserver.taskmanager.tasks; +import com.l2jmobius.Config; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.network.serverpackets.ExNevitAdventTimeChange; @@ -40,6 +41,11 @@ public class TaskNevit extends Task @Override public void onTimeElapsed(ExecutedTask task) { + if (!Config.NEVIT_ENABLED) + { + return; + } + for (L2PcInstance player : L2World.getInstance().getPlayers()) { if ((player == null) || !player.isOnline()) diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java index 8cde822fa6..f74938e7af 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java @@ -19,6 +19,7 @@ package com.l2jmobius.gameserver.taskmanager.tasks; import java.sql.Connection; import java.sql.PreparedStatement; +import com.l2jmobius.Config; import com.l2jmobius.commons.database.DatabaseFactory; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; @@ -65,12 +66,15 @@ public class TaskRecom extends Task } // Refresh reco bonus for online players - for (L2PcInstance player : L2World.getInstance().getPlayers()) + if (Config.NEVIT_ENABLED) { - if (player != null) + for (L2PcInstance player : L2World.getInstance().getPlayers()) { - player.stopNevitHourglassTask(); - player.startNevitHourglassTask(); + if (player != null) + { + player.stopNevitHourglassTask(); + player.startNevitHourglassTask(); + } } } LOGGER.info("Recommendations System reseted");