U3Games

Games | Desarrollo & Soporte => L2 | Implementaciones => L2 | Sección de Servidores => Lineage => L2 | Eventos => Mensaje iniciado por: Swarlog en Jul 15, 2025, 12:02 AM

Título: Evento Chaos
Publicado por: Swarlog en Jul 15, 2025, 12:02 AM
u3g_l2_event_chaos.jpg

### Eclipse Workspace Patch 1.0
#P Datapack
Index: dist/game/data/scripts/handlers/admincommandhandlers/AdminChaos.java
===================================================================
--- dist/game/data/scripts/handlers/admincommandhandlers/AdminChaos.java (revision 0)
+++ dist/game/data/scripts/handlers/admincommandhandlers/AdminChaos.java (working copy)
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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.
+ *
+ * L2J DataPack 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 handlers.admincommandhandlers;
+
+import l2jcrimmerproject.Config;
+import l2jcrimmerproject.gameserver.handler.IAdminCommandHandler;
+import l2jcrimmerproject.gameserver.model.actor.instance.L2PcInstance;
+import l2jcrimmerproject.gameserver.model.entity.ChaosEvent;
+import l2jcrimmerproject.gameserver.network.clientpackets.EnterWorld;
+
+/**
+ * @author Anarchy
+ */
+public class AdminChaos implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_startchaos",
+ "admin_endchaos",
+ "admin_warnchaos"
+ };
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ ChaosEvent chaos = new ChaosEvent();
+
+ if (command.equals("admin_warnchaos"))
+ {
+ if (Config.CHAOS_EVENT_ENABLE)
+ {
+ if (ChaosEvent._isChaosActive)
+ {
+ activeChar.sendMessage("Você so pode avisar os jogadores do Evento Chaos nao esta ativo.");
+ return false;
+ }
+ }
+ EnterWorld world = new EnterWorld();
+
+ world.warnAllPlayers();
+
+ return true;
+ }
+ if (command.equals("admin_startchaos"))
+ {
+ if (Config.CHAOS_EVENT_ENABLE)
+ {
+ if (!ChaosEvent._isChaosActive)
+ {
+ chaos.startChaos();
+ activeChar.sendMessage("Voce ja iniciou o evento Chaos. Utilize o // endchaos Para Parar");
+ return true;
+ }
+
+ activeChar.sendMessage("Chaos Event Ja esta Ativado.");
+ return false;
+ }
+ }
+ if (command.equals("admin_endchaos"))
+ {
+ if (Config.CHAOS_EVENT_ENABLE)
+ {
+ if (ChaosEvent._isChaosActive)
+ {
+ chaos.stopChaos();
+ activeChar.sendMessage("Voce parou com sucesso Evento Chaos.");
+ return true;
+ }
+ activeChar.sendMessage("Evento Chaos nao esta ativo.");
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}
\ No newline at end of file
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 6)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -34,7 +34,6 @@
import l2jcrimmerproject.gameserver.handler.TelnetHandler;
import l2jcrimmerproject.gameserver.handler.UserCommandHandler;
import l2jcrimmerproject.gameserver.handler.VoicedCommandHandler;
-
import handlers.actionhandlers.L2ArtefactInstanceAction;
import handlers.actionhandlers.L2DecoyAction;
import handlers.actionhandlers.L2DoorInstanceAction;
@@ -61,6 +60,7 @@
import handlers.admincommandhandlers.AdminCache;
import handlers.admincommandhandlers.AdminCamera;
import handlers.admincommandhandlers.AdminChangeAccessLevel;
+import handlers.admincommandhandlers.AdminChaos;
import handlers.admincommandhandlers.AdminClan;
import handlers.admincommandhandlers.AdminCreateItem;
import handlers.admincommandhandlers.AdminCursedWeapons;
@@ -294,6 +294,7 @@
import handlers.usercommandhandlers.Unstuck;
import handlers.voicedcommandhandlers.Banking;
import handlers.voicedcommandhandlers.ChangePassword;
+import handlers.voicedcommandhandlers.ChaosCmd;
import handlers.voicedcommandhandlers.ChatAdmin;
import handlers.voicedcommandhandlers.Debug;
import handlers.voicedcommandhandlers.ExpGain;
@@ -363,6 +364,7 @@
AdminCache.class,
AdminCamera.class,
AdminChangeAccessLevel.class,
+ AdminChaos.class,
AdminCHSiege.class,
AdminClan.class,
AdminPcCondOverride.class,
@@ -579,6 +581,7 @@
// TODO: Add configuration options for this voiced commands:
// CastleVCmd.class,
// SetVCmd.class,
+ ChaosCmd.class,
(Config.L2JMOD_ALLOW_WEDDING ? Wedding.class : null),
(Config.ALLOW_EXP_GAIN_COMMAND ? ExpGain.class : null),
(Config.ALLOW_TRADE_COMMAND ? TradeCommands.class : null),
Index: dist/game/data/html/Chaos/warning.htm
===================================================================
--- dist/game/data/html/Chaos/warning.htm (revision 0)
+++ dist/game/data/html/Chaos/warning.htm (working copy)
@@ -0,0 +1,4 @@
+<html><body>Chaos Event:<br>
+O Evento Chaos já vai começar Se Prepare, Junte uma PT e gogo Treta, Boa Sorte.<br>
+Aviso: Lembre-se que está estara com o Super Haste uma skill de GM.<br>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/ChaosCmd.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/ChaosCmd.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/ChaosCmd.java (working copy)
@@ -0,0 +1,84 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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.
+ *
+ * L2J DataPack 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 handlers.voicedcommandhandlers;
+
+import l2jcrimmerproject.Config;
+import l2jcrimmerproject.gameserver.handler.IVoicedCommandHandler;
+import l2jcrimmerproject.gameserver.model.actor.instance.L2PcInstance;
+import l2jcrimmerproject.gameserver.model.entity.ChaosEvent;
+
+/**
+ * @author Anarchy
+ */
+public class ChaosCmd implements IVoicedCommandHandler
+{
+ private static final String[] VOICED_COMMANDS =
+ {
+ "joinchaos",
+ "leavechaos"
+ };
+
+ @Override
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ ChaosEvent chaos = new ChaosEvent();
+ if (command.startsWith("joinchaos"))
+ {
+ if (Config.CHAOS_EVENT_VOICED_COMMAND)
+ {
+ if (ChaosEvent._isChaosActive)
+ {
+ if (Config.CHAOS_EVENT_PLAYER_BUFFS)
+ {
+ activeChar.stopAllEffects();
+ }
+ activeChar.getAppearance().setNameColor(Config.CHAOS_EVENT_NAME_COLOR);
+ activeChar.getAppearance().setTitleColor(Config.CHAOS_EVENT_TITLE_COLOR);
+
+ chaos.registerToChaos(activeChar);
+ return true;
+ }
+ activeChar.sendMessage("Evento Chaos nao esta ativo no momento.");
+ }
+ return false;
+ }
+ if (command.startsWith("leavechaos"))
+ {
+ if (Config.CHAOS_EVENT_VOICED_COMMAND)
+ {
+ if (ChaosEvent._isChaosActive)
+ {
+ activeChar.getAppearance().setNameColor(0xFFFFFF);
+ activeChar.getAppearance().setTitleColor(0xFFFFFF);
+ chaos.removeFromChaos(activeChar);
+ return true;
+ }
+ }
+ activeChar.sendMessage("Chaos Event Nao Esta Ativo.");
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return VOICED_COMMANDS;
+ }
+}
\ No newline at end of file
#P Core
Index: java/l2jcrimmerproject/gameserver/model/entity/ChaosEvent.java
===================================================================
--- java/l2jcrimmerproject/gameserver/model/entity/ChaosEvent.java (revision 0)
+++ java/l2jcrimmerproject/gameserver/model/entity/ChaosEvent.java (working copy)
@@ -0,0 +1,283 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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.
+ *
+ * L2J DataPack 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 l2jcrimmerproject.gameserver.model.entity;
+
+import java.util.Vector;
+
+import l2jcrimmerproject.Config;
+import l2jcrimmerproject.gameserver.Announcements;
+import l2jcrimmerproject.gameserver.datatables.SkillTable;
+import l2jcrimmerproject.gameserver.model.actor.instance.L2PcInstance;
+import l2jcrimmerproject.gameserver.model.effects.L2Effect;
+import l2jcrimmerproject.gameserver.model.skills.L2Skill;
+
+/**
+ * @author Anarchy/ reworked by BossForever
+ */
+public class ChaosEvent
+{
+ public static Vector<L2PcInstance> _players = new Vector<>();
+ public static L2PcInstance _topplayer, _topplayer2, _topplayer3, _topplayer4, _topplayer5;
+ public static int _topkills = 0, _topkills2 = 0, _topkills3 = 0, _topkills4 = 0, _topkills5 = 0;
+ public static boolean _isChaosActive;
+
+ public void startChaos()
+ {
+ if (Config.CHAOS_EVENT_ENABLE)
+ {
+ _isChaosActive = true;
+ _players.clear();
+ Announcements.getInstance().announceToAll("Chaos Evento Iniciou");
+ Announcements.getInstance().announceToAll("Pariticipar .joinchaos , Sair .leavechaos!");
+ }
+ }
+
+ public void stopChaos()
+ {
+ _isChaosActive = false;
+ Announcements.getInstance().announceToAll("Chaos Evento acabou");
+ getTopKiller();
+ calculateRewards();
+ for (L2PcInstance player : _players)
+ {
+ _players.remove(player);
+ player.getAppearance().setNameColor(0xFFFFFF);
+ player.getAppearance().setTitleColor(0xFFFFFF);
+ player.setTitle("");
+ removeSuperHaste(player);
+ }
+ cleanColors();
+ cleanPlayers();
+ _players.clear();
+ }
+
+ public void cleanColors()
+ {
+ for (L2PcInstance player : _players)
+ {
+ player.getAppearance().setNameColor(Config.CHAOS_EVENT_NAME_COLOR);
+ player.getAppearance().setTitleColor(Config.CHAOS_EVENT_TITLE_COLOR);
+ player.setTitle(Config.CHAOS_EVENT_TITLE);
+ player.broadcastUserInfo();
+ }
+ }
+
+ public void cleanPlayers()
+ {
+ for (L2PcInstance player : _players)
+ {
+ player._inChaosEvent = false;
+ player._chaosKills = 0;
+ _topkills = 0;
+ _topplayer = null;
+ }
+ }
+
+ public void registerToChaos(L2PcInstance player)
+ {
+ if (!registerToChaosOk(player))
+ {
+ return;
+ }
+ _players.add(player);
+ player._inChaosEvent = true;
+ player._chaosKills = 0;
+ player.stopAllEffects();
+ player.getAppearance().setNameColor(Config.CHAOS_EVENT_NAME_COLOR);
+ player.getAppearance().setTitleColor(Config.CHAOS_EVENT_TITLE_COLOR);
+ player.setTitle(Config.CHAOS_EVENT_TITLE);
+ player.broadcastUserInfo();
+ player.sendMessage("Voce esta participando do Evento Chaos");
+ onChaosBuffs(player);
+ addSuperHaste(player);
+ }
+
+ public void addSuperHaste(L2PcInstance player)
+ {
+ L2Skill skill = SkillTable.getInstance().getInfo(7029, 4);
+ if (skill != null)
+ {
+ skill.getEffects(player, player);
+ }
+ }
+
+ public boolean registerToChaosOk(L2PcInstance chaosplayer)
+ {
+ if (chaosplayer._inChaosEvent)
+ {
+ chaosplayer.sendMessage("Voce ja esta participando do Evento");
+ return false;
+ }
+ return true;
+ }
+
+ public void removeFromChaos(L2PcInstance player)
+ {
+ if (!removeFromChaosOk(player))
+ {
+ return;
+ }
+ _players.remove(player);
+ player._chaosKills = 0;
+ player._inChaosEvent = false;
+ player.sendMessage("Voce deixou Evento Chaos.");
+ player.getAppearance().setNameColor(0xFFFFFF);
+ player.getAppearance().setTitleColor(0xFFFFFF);
+ player.setTitle("");
+ player.broadcastUserInfo();
+ removeSuperHaste(player);
+ }
+
+ public boolean removeFromChaosOk(L2PcInstance chaosplayer)
+ {
+ if (!chaosplayer._inChaosEvent)
+ {
+ chaosplayer.sendMessage("Voce nao esta no Evento Chaos");
+ return false;
+ }
+ return true;
+ }
+
+ public static void getTopKiller()
+ {
+ for (L2PcInstance player : _players)
+ {
+ if (player._chaosKills > _topkills)
+ {
+ _topplayer = player;
+ _topkills = player._chaosKills;
+ }
+ if ((player._chaosKills > _topkills2) && (player._chaosKills < _topkills))
+ {
+ _topplayer2 = player;
+ _topkills2 = player._chaosKills;
+ }
+ if ((player._chaosKills > _topkills3) && (player._chaosKills < _topkills2))
+ {
+ _topplayer3 = player;
+ _topkills3 = player._chaosKills;
+ }
+ if ((player._chaosKills > _topkills4) && (player._chaosKills < _topkills3))
+ {
+ _topplayer4 = player;
+ _topkills4 = player._chaosKills;
+ }
+ if ((player._chaosKills > _topkills5) && (player._chaosKills < _topkills4))
+ {
+ _topplayer5 = player;
+ _topkills5 = player._chaosKills;
+ }
+ }
+ }
+
+ public void calculateRewards()
+ {
+ if (_topplayer != null)
+ {
+ _topplayer.addItem("Chaos Event Reward", (Config.CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_1), (Config.CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_1), _topplayer, true);
+ }
+ if (_topplayer2 != null)
+ {
+ _topplayer2.addItem("Chaos Event Reward 2", (Config.CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_2), (Config.CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_2), _topplayer2, true);
+ }
+ if (_topplayer3 != null)
+ {
+ _topplayer3.addItem("Chaos Event Reward 3", (Config.CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_3), (Config.CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_3), _topplayer3, true);
+ }
+ if (_topplayer4 != null)
+ {
+ _topplayer4.addItem("Chaos Event Reward 4", (Config.CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_4), (Config.CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_4), _topplayer4, true);
+ }
+ if (_topplayer5 != null)
+ {
+ _topplayer5.addItem("Chaos Event Reward 5", (Config.CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_5), (Config.CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_5), _topplayer5, true);
+ }
+
+ Announcements.getInstance().announceToAll("Vencedores Do Event Chaos");
+ if (_topplayer != null)
+ {
+ Announcements.getInstance().announceToAll("1) " + _topplayer.getName());
+ }
+ if (_topplayer2 != null)
+ {
+ Announcements.getInstance().announceToAll("2) " + _topplayer2.getName());
+ }
+ if (_topplayer3 != null)
+ {
+ Announcements.getInstance().announceToAll("3) " + _topplayer3.getName());
+ }
+ if (_topplayer4 != null)
+ {
+ Announcements.getInstance().announceToAll("4) " + _topplayer4.getName());
+ }
+ if (_topplayer5 != null)
+ {
+ Announcements.getInstance().announceToAll("5) " + _topplayer5.getName());
+ }
+ }
+
+ private void onChaosBuffs(L2PcInstance activeChar)
+ {
+
+ if (Config.CHAOS_EVENT_PLAYER_BUFFS)
+ {
+ if (activeChar.isMageClass())
+ {
+ for (Integer skillid : Config.CHAOS_EVENT_MAGE_BUFF_LIST.keySet())
+ {
+ int skilllvl = Config.CHAOS_EVENT_MAGE_BUFF_LIST.get(skillid);
+ L2Skill skill = SkillTable.getInstance().getInfo(skillid, skilllvl);
+ if (skill != null)
+ {
+ skill.getEffects(activeChar, activeChar);
+ }
+ }
+ }
+ else
+ {
+ for (Integer skillid : Config.CHAOS_EVENT_FIGHTER_BUFF_LIST.keySet())
+ {
+ int skilllvl = Config.CHAOS_EVENT_FIGHTER_BUFF_LIST.get(skillid);
+ L2Skill skill = SkillTable.getInstance().getInfo(skillid, skilllvl);
+ if (skill != null)
+ {
+ skill.getEffects(activeChar, activeChar);
+ }
+ }
+ }
+ }
+
+ }
+
+ public void removeSuperHaste(L2PcInstance activeChar)
+ {
+ if (activeChar != null)
+ {
+ L2Effect[] effects = activeChar.getAllEffects();
+
+ for (L2Effect e : effects)
+ {
+ if ((e != null) && (e.getSkill().getId() == 7029))
+ {
+ e.exit();
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
Index: java/l2jcrimmerproject/Config.java
===================================================================
--- java/l2jcrimmerproject/Config.java (revision 6)
+++ java/l2jcrimmerproject/Config.java (working copy)
@@ -812,6 +812,25 @@
public static Map<Integer, Integer> MAGE_BUFF_LIST;
public static boolean ALLOW_REFUSE_BUFF;
public static boolean ALLOW_INFO_AND_RATES_COMMAND;
+ public static boolean CHAOS_EVENT_ENABLE;
+ public static int CHAOS_EVENT_NAME_COLOR;
+ public static int CHAOS_EVENT_TITLE_COLOR;
+ public static String CHAOS_EVENT_TITLE;
+ public static int CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_1;
+ public static int CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_1;
+ public static int CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_2;
+ public static int CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_2;
+ public static int CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_3;
+ public static int CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_3;
+ public static int CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_4;
+ public static int CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_4;
+ public static int CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_5;
+ public static int CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_5;
+ public static boolean CHAOS_EVENT_VOICED_COMMAND;
+ public static boolean CHAOS_EVENT_PLAYER_BUFFS;
+ public static Map<Integer, Integer> CHAOS_EVENT_FIGHTER_BUFF_LIST;
+ public static Map<Integer, Integer> CHAOS_EVENT_MAGE_BUFF_LIST;
+
// --------------------------------------------------
// NPC Settings
// --------------------------------------------------
@@ -2913,6 +2932,76 @@
}
ALLOW_REFUSE_BUFF = Boolean.parseBoolean(CrimmerCustom.getProperty("AllowRefuseBuff", "False"));
ALLOW_INFO_AND_RATES_COMMAND = Boolean.parseBoolean(CrimmerCustom.getProperty("AllowInfoAndRatesCommand", "False"));
+ // Chaos Event
+ CHAOS_EVENT_ENABLE = Boolean.parseBoolean(CrimmerCustom.getProperty("ChaosEventEnable", "False"));
+ CHAOS_EVENT_NAME_COLOR = Integer.decode("0x" + CrimmerCustom.getProperty("ChaosEventNickColor", "FF0000"));
+ CHAOS_EVENT_TITLE_COLOR = Integer.decode("0x" + CrimmerCustom.getProperty("ChaosEventTitleColor", "FF0000"));
+ CHAOS_EVENT_TITLE = CrimmerCustom.getProperty("ChaosEventTitle", "Chaos Event");
+ CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_1 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventItemRewardIDTopPlayer1"));
+ CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_1 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventRewardAmountTopPlayer1"));
+ CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_2 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventItemRewardIDTopPlayer2"));
+ CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_2 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventRewardAmountTopPlayer2"));
+ CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_3 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventItemRewardIDTopPlayer3"));
+ CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_3 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventRewardAmountTopPlayer3"));
+ CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_4 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventItemRewardIDTopPlayer4"));
+ CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_4 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventRewardAmountTopPlayer4"));
+ CHAOS_EVENT_ITEM_REWARD_ID_TOPLAYER_5 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventItemRewardIDTopPlayer5"));
+ CHAOS_EVENT_REWARD_AMOUNT_TOPPLAYER_5 = Integer.parseInt(CrimmerCustom.getProperty("ChaosEventRewardAmountTopPlayer5"));
+ CHAOS_EVENT_VOICED_COMMAND = Boolean.parseBoolean(CrimmerCustom.getProperty("ChaosEventVoicedCommand"));
+ CHAOS_EVENT_PLAYER_BUFFS = Boolean.parseBoolean(CrimmerCustom.getProperty("OnChaosBuffs", "False"));
+ if (CHAOS_EVENT_PLAYER_BUFFS)
+ {
+ String[] fighterBuffSplit = CrimmerCustom.getProperty("FighterBuffList", "").split(";");
+ CHAOS_EVENT_FIGHTER_BUFF_LIST = new FastMap<>(fighterBuffSplit.length);
+ for (String skill : fighterBuffSplit)
+ {
+ String[] skillSplit = skill.split(",");
+ if (skillSplit.length != 2)
+ {
+ System.out.println("invalid config property in " + CRIMMER_CUSTOM_FILE + " -> FighterBuffList \"" + skill + "\"");
+ }
+ else
+ {
+ try
+ {
+ CHAOS_EVENT_FIGHTER_BUFF_LIST.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!skill.equals(""))
+ {
+ System.out.println("invalid config property in " + CRIMMER_CUSTOM_FILE + " -> FighterBuffList \"" + skillSplit[0] + "\"" + skillSplit[1]);
+ }
+ }
+ }
+ }
+
+ String[] mageBuffSplit = CrimmerCustom.getProperty("MageBuffList", "").split(";");
+ CHAOS_EVENT_MAGE_BUFF_LIST = new FastMap<>(mageBuffSplit.length);
+ for (String skill : mageBuffSplit)
+ {
+ String[] skillSplit = skill.split(",");
+ if (skillSplit.length != 2)
+ {
+ System.out.println("invalid config property in " + CRIMMER_CUSTOM_FILE + " -> MageBuffList \"" + skill + "\"");
+ }
+ else
+ {
+ try
+ {
+ CHAOS_EVENT_MAGE_BUFF_LIST.put(Integer.parseInt(skillSplit[0]), Integer.parseInt(skillSplit[1]));
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!skill.equals(""))
+ {
+ System.out.println("invalid config property in" + CRIMMER_CUSTOM_FILE + " -> MageBuffList \"" + skillSplit[0] + "\"" + skillSplit[1]);
+ }
+ }
+ }
+ }
+ }
+
// Load PvP L2Properties file (if exists)
final File pvp = new File(PVP_CONFIG_FILE);
L2Properties PVPSettings = new L2Properties();
Index: java/l2jcrimmerproject/gameserver/network/clientpackets/Logout.java
===================================================================
--- java/l2jcrimmerproject/gameserver/network/clientpackets/Logout.java (revision 6)
+++ java/l2jcrimmerproject/gameserver/network/clientpackets/Logout.java (working copy)
@@ -53,6 +53,11 @@
// Don't allow leaving if player is fighting
final L2PcInstance player = getClient().getActiveChar();

+ if (EnterWorld._onlineplayers.contains(player) && (player != null))
+ {
+ EnterWorld._onlineplayers.remove(player);
+ }
+
if (player == null)
{
return;
Index: java/l2jcrimmerproject/gameserver/cache/HtmCache.java
===================================================================
--- java/l2jcrimmerproject/gameserver/cache/HtmCache.java (revision 6)
+++ java/l2jcrimmerproject/gameserver/cache/HtmCache.java (working copy)
@@ -174,7 +174,7 @@
return content;
}

- private String getHtm(String path)
+ public String getHtm(String path)
{
if ((path == null) || path.isEmpty())
{
Index: java/l2jcrimmerproject/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/l2jcrimmerproject/gameserver/network/clientpackets/EnterWorld.java (revision 6)
+++ java/l2jcrimmerproject/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -18,8 +18,9 @@
*/
package l2jcrimmerproject.gameserver.network.clientpackets;

+import java.util.Vector;
+
import javolution.util.FastList;
-
import l2jcrimmerproject.Config;
import l2jcrimmerproject.custom.PvPColorSystem;
import l2jcrimmerproject.gameserver.Announcements;
@@ -107,7 +108,7 @@
private static final String _C__11_ENTERWORLD = "[C] 11 EnterWorld";

private static FastList<PlayerSpawnListener> listeners = new FastList<PlayerSpawnListener>().shared();
-
+ public static Vector<L2PcInstance> _onlineplayers = new Vector<>();
private final int[][] tracert = new int[5][4];

public TaskPriority getPriority()
@@ -139,6 +140,8 @@
{
L2PcInstance activeChar = getClient().getActiveChar();

+ _onlineplayers.add(activeChar);
+
PvPColorSystem pvpcolor = new PvPColorSystem();
pvpcolor.updateNameColor(activeChar);
pvpcolor.updateTitleColor(activeChar);
@@ -730,6 +733,19 @@
}
}

+ public void warnAllPlayers()
+ {
+ for (L2PcInstance player : _onlineplayers)
+ {
+ String file = "data/html/Chaos/warning.htm";
+ String html = HtmCache.getInstance().getHtm(file);
+ NpcHtmlMessage warning = new NpcHtmlMessage(1);
+ warning.setHtml(html);
+
+ player.sendPacket(warning);
+ }
+ }
+
@Override
public String getType()
{
Index: java/l2jcrimmerproject/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/l2jcrimmerproject/gameserver/model/actor/instance/L2PcInstance.java (revision 6)
+++ java/l2jcrimmerproject/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -43,7 +43,6 @@
import javolution.util.FastList;
import javolution.util.FastMap;
import javolution.util.FastSet;
-
import l2jcrimmerproject.Config;
import l2jcrimmerproject.L2DatabaseFactory;
import l2jcrimmerproject.custom.PvPColorSystem;
@@ -166,6 +165,7 @@
import l2jcrimmerproject.gameserver.model.effects.L2Effect;
import l2jcrimmerproject.gameserver.model.effects.L2EffectType;
import l2jcrimmerproject.gameserver.model.entity.Castle;
+import l2jcrimmerproject.gameserver.model.entity.ChaosEvent;
import l2jcrimmerproject.gameserver.model.entity.Duel;
import l2jcrimmerproject.gameserver.model.entity.Fort;
import l2jcrimmerproject.gameserver.model.entity.Hero;
@@ -303,7 +303,6 @@
import l2jcrimmerproject.gameserver.util.Util;
import l2jcrimmerproject.util.L2FastList;
import l2jcrimmerproject.util.Rnd;
-
import gnu.trove.list.array.TIntArrayList;

/**
@@ -312,6 +311,10 @@
*/
public final class L2PcInstance extends L2Playable
{
+ // Chaos Event.
+ public int _chaosKills;
+ public boolean _inChaosEvent = false;
+
// Character Skill SQL String Definitions:
private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?";
private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
@@ -6100,6 +6103,10 @@
))
{
increasePvpKills(target);
+ if (_inChaosEvent && targetPlayer._inChaosEvent)
+ {
+ _chaosKills++;
+ }
}
else
// Target player doesn't have pvp flag set
@@ -6109,6 +6116,10 @@
{
// 'Both way war' -> 'PvP Kill'
increasePvpKills(target);
+ if (_inChaosEvent && targetPlayer._inChaosEvent)
+ {
+ _chaosKills++;
+ }
return;
}

@@ -6118,21 +6129,36 @@
if (Config.KARMA_AWARD_PK_KILL)
{
increasePvpKills(target);
+ if (_inChaosEvent && targetPlayer._inChaosEvent)
+ {
+ _chaosKills++;
+ }
}
}
- else if (targetPlayer.getPvpFlag() == 0) // Target player doesn't have karma
+ else if ((targetPlayer.getPvpFlag() == 0) && !(_inChaosEvent && _inChaosEvent(targetPlayer))) // Target player doesn't have karma
{
increasePkKillsAndKarma(target);
- // Unequip adventurer items
- checkItemRestriction();
}
+ if ((targetPlayer.getPvpFlag() == 0) && (_inChaosEvent && targetPlayer._inChaosEvent))
+ {
+ _chaosKills++;
+ }
+ // Unequip adventurer items
+ checkItemRestriction();
}
}

/**
* Increase the pvp kills count and send the info to the player
* @param target
+ * @return
*/
+ public boolean _inChaosEvent(L2Character target)
+ {
+ L2PcInstance targetPlayer = target.getActingPlayer();
+ return targetPlayer._inChaosEvent;
+ }
+
public void increasePvpKills(L2Character target)
{
if ((target instanceof L2PcInstance) && AntiFeedManager.getInstance().check(this, target))
@@ -11594,6 +11620,12 @@
{
getParty().getDimensionalRift().memberRessurected(this);
}
+
+ ChaosEvent chaos = new ChaosEvent();
+ if (_inChaosEvent)
+ {
+ chaos.addSuperHaste(this);
+ }
}
if (getInstanceId() > 0)
{
Index: dist/game/config/Mods/Custom.properties
===================================================================
--- dist/game/config/Mods/Custom.properties (revision 6)
+++ dist/game/config/Mods/Custom.properties (working copy)
@@ -70,4 +70,46 @@
# .info Html File: data/html/ServerInfo.htm
# .rates Html File: data/html/ServerRates.htm
# Default = False
-AllowInfoAndRatesCommand = False
\ No newline at end of file
+AllowInfoAndRatesCommand = False
+
+#-------------------------------------------------------
+# Event Chaos
+#-------------------------------------------------------
+# Event Chaos
+# Chaos Event Enable.
+ChaosEventEnable = False+
+# Chaos Evento Name's Color.
+ChaosEventNickColor = FF0000
+# Chaos Evento Title's Colon.
+ChaosEventTitleColor = FF0000
+# Chaos Evento Title Player.
+ChaosEventTitle = Evento Chaos
+# Configurar Item ID e Quantidade Para o Jogador 1.
+ChaosEventItemRewardIDTopPlayer1 = 57
+ChaosEventRewardAmountTopPlayer1 = 5000
+# Configurar Item ID e Quantidade Para o Jogador 2.
+ChaosEventItemRewardIDTopPlayer2 = 57
+ChaosEventRewardAmountTopPlayer2 = 4000
+# Configurar Item ID e Quantidade Para o Jogador 3.
+ChaosEventItemRewardIDTopPlayer3 = 57
+ChaosEventRewardAmountTopPlayer3 = 3000
+# Configurar Item ID e Quantidade Para o Jogador 4.
+ChaosEventItemRewardIDTopPlayer4 = 57
+ChaosEventRewardAmountTopPlayer4 = 2000
+# Configurar Item ID e Quantidade Para o Jogador 5.
+ChaosEventItemRewardIDTopPlayer5 = 57
+ChaosEventRewardAmountTopPlayer5 = 1000
+# Ativar o Comando .joinchaos e .leavechaos.
+ChaosEventVoicedCommand = False
+# Chaos Buffs Players
+OnChaosBuffs = False
+
+# The List of Fighter Buffs
+# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
+FighterBuffList = 1204,2;1068,3;1040,3;1035,4;1036,2;1045,6;1086,2;1077,3;1240,3;1242,3;\
+264,1;267,1;268,1;269,1;304,1;349,1;364,1;271,1;274,1;275,1;1363,1;1391,3;4699,1;4703,1
+
+# The List of Mage Buffs
+# Format : skillid,skilllvl;skillid2,skilllvl2;....skillidn,skilllvln
+MageBuffList = 1204,2;1040,3;1035,4;1045,6;1048,6;1036,2;1303,2;1085,3;1059,3;1078,6;\
+1062,2;1397,3;264,1;267,1;268,1;304,1;349,1;364,1;273,1;276,1;365,1;1413,1;1391,3;4703,1