Disable completely Nevit system by config.

Contributed by Sahar.
This commit is contained in:
MobiusDev 2018-06-01 08:55:09 +00:00
parent 6bad215c79
commit 241ef1a1c4
9 changed files with 58 additions and 22 deletions

View File

@ -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);
}

View File

@ -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
{

View File

@ -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;
}

View File

@ -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)

View File

@ -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)

View File

@ -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())

View File

@ -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));
}
}
}

View File

@ -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())

View File

@ -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");