Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/net/sf/l2j/gameserver/model/entity/DM.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/entity/DM.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/entity/DM.java (revision 0)
- -0,0 +1,734 @@
- +/*
- + * 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.model.entity;
- +/**
- + *
- + * @author SqueezeD Edited By TheEnd
- + *
- + */
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.SQLException;
- +import java.util.Vector;
- +
- +import javolution.text.TextBuilder;
- +
- +import java.util.logging.Logger;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.L2DatabaseFactory;
- +import net.sf.l2j.gameserver.Announcements;
- +import net.sf.l2j.gameserver.ThreadPoolManager;
- +import net.sf.l2j.gameserver.datatables.NpcTable;
- +import net.sf.l2j.gameserver.datatables.SpawnTable;
- +import net.sf.l2j.gameserver.model.L2Effect;
- +import net.sf.l2j.gameserver.model.L2Party;
- +import net.sf.l2j.gameserver.model.L2Spawn;
- +import net.sf.l2j.gameserver.model.actor.L2Summon;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.network.serverpackets.MagicSkillUse;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +import net.sf.l2j.gameserver.network.serverpackets.StatusUpdate;
- +import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
- +
- +public class DM
- +{
- + private final static Logger _log = Logger.getLogger(DM.class.getName());
- + public static String _eventName = new String(),
- + _eventDesc = new String(),
- + _joiningLocationName = new String();
- + public static Vector<String> _savePlayers = new Vector<String>();
- + public static Vector<L2PcInstance> _players = new Vector<L2PcInstance>();
- + public static boolean _joining = false,
- + _teleport = false,
- + _started = false,
- + _sitForced = false;
- + public static L2Spawn _npcSpawn;
- + public static L2PcInstance _topPlayer;
- + public static int _npcId = 0,
- + _npcX = 0,
- + _npcY = 0,
- + _npcZ = 0,
- + _rewardId = 0,
- + _rewardAmount = 0,
- + _topKills = 0,
- + _minlvl = 0,
- + _maxlvl = 0,
- + _playerColors = 0,
- + _playerX = 0,
- + _playerY = 0,
- + _playerZ = 0;
- +
- + public static void setNpcPos(L2PcInstance activeChar)
- + {
- + _npcX = activeChar.getX();
- + _npcY = activeChar.getY();
- + _npcZ = activeChar.getZ();
- + }
- +
- + public static boolean checkMaxLevel(int maxlvl)
- + {
- + if (_minlvl >= maxlvl)
- + return false;
- +
- + return true;
- + }
- +
- + public static boolean checkMinLevel(int minlvl)
- + {
- + if (_maxlvl <= minlvl)
- + return false;
- +
- + return true;
- + }
- +
- + public static void setPlayersPos(L2PcInstance activeChar)
- + {
- + _playerX = activeChar.getX();
- + _playerY = activeChar.getY();
- + _playerZ = activeChar.getZ();
- + }
- +
- + public static boolean checkPlayerOk()
- + {
- + if (_started || _teleport || _joining)
- + return false;
- +
- + return true;
- + }
- +
- + public static void startJoin(L2PcInstance activeChar)
- + {
- + if (!startJoinOk())
- + {
- + if (!Config.DEBUG)
- + _log.fine("DM Engine[startJoin(" + activeChar.getName() + ")]: startJoinOk() = false");
- + return;
- + }
- +
- + _joining = true;
- + spawnEventNpc(activeChar);
- + Announcements.getInstance().announceToAll(_eventName + "(DM): Joinable in " + _joiningLocationName + "!");
- + }
- +
- + private static boolean startJoinOk()
- + {
- + if (_started || _teleport || _joining || _eventName.equals("") ||
- + _joiningLocationName.equals("") || _eventDesc.equals("") || _npcId == 0 ||
- + _npcX == 0 || _npcY == 0 || _npcZ == 0 || _rewardId == 0 || _rewardAmount == 0 ||
- + _playerX == 0 || _playerY == 0 || _playerZ == 0)
- + return false;
- +
- + return true;
- + }
- +
- + private static void spawnEventNpc(L2PcInstance activeChar)
- + {
- + L2NpcTemplate tmpl = NpcTable.getInstance().getTemplate(_npcId);
- +
- + try
- + {
- + _npcSpawn = new L2Spawn(tmpl);
- +
- + _npcSpawn.setLocx(_npcX);
- + _npcSpawn.setLocy(_npcY);
- + _npcSpawn.setLocz(_npcZ);
- + _npcSpawn.setAmount(1);
- + _npcSpawn.setHeading(activeChar.getHeading());
- + _npcSpawn.setRespawnDelay(1);
- +
- + SpawnTable.getInstance().addNewSpawn(_npcSpawn, false);
- +
- + _npcSpawn.init();
- + _npcSpawn.getLastSpawn().getStatus().setCurrentHp(999999999);
- + _npcSpawn.getLastSpawn().setTitle(_eventName);
- + _npcSpawn.getLastSpawn()._isEventMobDM = true;
- + _npcSpawn.getLastSpawn().isAggressive();
- + _npcSpawn.getLastSpawn().decayMe();
- + _npcSpawn.getLastSpawn().spawnMe(_npcSpawn.getLastSpawn().getX(), _npcSpawn.getLastSpawn().getY(), _npcSpawn.getLastSpawn().getZ());
- +
- + _npcSpawn.getLastSpawn().broadcastPacket(new MagicSkillUse(_npcSpawn.getLastSpawn(), _npcSpawn.getLastSpawn(), 1034, 1, 1, 1));
- + }
- + catch (Exception e)
- + {
- + _log.warning("DM Engine[spawnEventNpc(" + activeChar.getName() + ")]: exception: " + e.getMessage());
- + }
- + }
- +
- + public static void teleportStart()
- + {
- + if (!_joining || _started || _teleport)
- + return;
- +
- + _joining = false;
- + Announcements.getInstance().announceToAll(_eventName + "(DM): Teleport to team spot in 20 seconds!");
- +
- + setUserData();
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + DM.sit();
- +
- + for (L2PcInstance player : DM._players)
- + {
- + if (player != null)
- + {
- + if (Config.DM_ON_START_UNSUMMON_PET)
- + {
- + //Remove Summon's buffs
- + if (player.getPet() != null)
- + {
- + L2Summon summon = player.getPet();
- + for (L2Effect e : summon.getAllEffects())
- + e.exit();
- +
- + if (summon instanceof L2PetInstance)
- + summon.unSummon(player);
- + }
- + }
- +
- + if (Config.DM_ON_START_REMOVE_ALL_EFFECTS)
- + {
- + for (L2Effect e : player.getAllEffects())
- + {
- + if (e != null) e.exit();
- + }
- + }
- +
- + // Remove player from his party
- + if (player.getParty() != null)
- + {
- + L2Party party = player.getParty();
- + party.removePartyMember(player);
- + }
- + player.teleToLocation(_playerX, _playerY, _playerZ, false);
- + }
- + }
- + }
- + }, 20000);
- + _teleport = true;
- + }
- +
- + public static void startEvent(L2PcInstance activeChar)
- + {
- + if (!startEventOk())
- + {
- + if (Config.DEBUG)
- + _log.fine("DM Engine[startEvent(" + activeChar.getName() + ")]: startEventOk() = false");
- + return;
- + }
- +
- + _teleport = false;
- + sit();
- + Announcements.getInstance().announceToAll(_eventName + "(DM): Started. Go to kill your enemies!");
- + _started = true;
- + }
- +
- + private static boolean startEventOk()
- + {
- + if (_joining || !_teleport || _started)
- + return false;
- +
- + return true;
- + }
- +
- + public static void setUserData()
- + {
- + for (L2PcInstance player : _players)
- + {
- + player._originalNameColorDM = player.getAppearance().getNameColor();
- + player._originalKarmaDM = player.getKarma();
- + player._inEventDM = true;
- + player._countDMkills = 0;
- + player.getAppearance().setNameColor(_playerColors);
- + player.setKarma(0);
- + player.broadcastUserInfo();
- + }
- + }
- +
- + public static void removeUserData()
- + {
- + for (L2PcInstance player : _players)
- + {
- + player.getAppearance().setNameColor(player._originalNameColorDM);
- + player.setKarma(player._originalKarmaDM);
- + player._inEventDM = false;
- + player._countDMkills = 0;
- + player.broadcastUserInfo();
- + }
- + }
- +
- + public static void finishEvent(L2PcInstance activeChar)
- + {
- + if (!finishEventOk())
- + {
- + if (Config.DEBUG)
- + _log.fine("DM Engine[finishEvent(" + activeChar.getName() + ")]: finishEventOk() = false");
- + return;
- + }
- +
- + _started = false;
- + unspawnEventNpc();
- + processTopPlayer();
- +
- + if (_topKills == 0)
- + Announcements.getInstance().announceToAll(_eventName + "(DM): No players win the match(nobody killed).");
- + else
- + {
- + Announcements.getInstance().announceToAll(_eventName + "(DM): " + _topPlayer.getName() + " wins the match! " + _topKills + " kills.");
- + rewardPlayer(activeChar);
- + }
- +
- + teleportFinish();
- + }
- +
- + private static boolean finishEventOk()
- + {
- + if (!_started)
- + return false;
- +
- + return true;
- + }
- +
- + public static void processTopPlayer()
- + {
- + for (L2PcInstance player : _players)
- + {
- + if (player._countDMkills > _topKills)
- + {
- + _topPlayer = player;
- + _topKills = player._countDMkills;
- + }
- + }
- + }
- +
- + /**
- + * @param activeChar
- + */
- + public static void rewardPlayer(L2PcInstance activeChar)
- + {
- + if (_topPlayer != null)
- + {
- + _topPlayer.addItem("DM Event: " + _eventName, _rewardId, _rewardAmount, _topPlayer, true);
- +
- + StatusUpdate su = new StatusUpdate(_topPlayer.getObjectId());
- + su.addAttribute(StatusUpdate.CUR_LOAD, _topPlayer.getCurrentLoad());
- + _topPlayer.sendPacket(su);
- +
- + NpcHtmlMessage nhm = new NpcHtmlMessage(5);
- + TextBuilder replyMSG = new TextBuilder("");
- +
- + replyMSG.append("<html><body>You won the event. Look in your inventory for the reward.</body></html>");
- +
- + nhm.setHtml(replyMSG.toString());
- + _topPlayer.sendPacket(nhm);
- +
- + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
- + _topPlayer.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + }
- +
- + public static void abortEvent()
- + {
- + if (!_joining && !_teleport && !_started)
- + return;
- +
- + _joining = false;
- + _teleport = false;
- + _started = false;
- + unspawnEventNpc();
- + Announcements.getInstance().announceToAll(_eventName + "(DM): Match aborted!");
- + teleportFinish();
- + }
- +
- + public static void sit()
- + {
- + if (_sitForced)
- + _sitForced = false;
- + else
- + _sitForced = true;
- +
- + for (L2PcInstance player : _players)
- + {
- + if (player != null)
- + {
- + if (_sitForced)
- + {
- + player.stopMove(null, false);
- + player.abortAttack();
- + player.abortCast();
- +
- + if (!player.isSitting())
- + player.sitDown();
- + }
- + else
- + {
- + if (player.isSitting())
- + player.standUp();
- + }
- + }
- + }
- + }
- +
- + public static void dumpData()
- + {
- + _log.info("");
- + _log.info("");
- +
- + if (!_joining && !_teleport && !_started)
- + {
- + _log.info("<<---------------------------------->>");
- + _log.info(">> DM Engine infos dump (INACTIVE) <<");
- + _log.info("<<--^----^^-----^----^^------^^----->>");
- + }
- + else if (_joining && !_teleport && !_started)
- + {
- + _log.info("<<--------------------------------->>");
- + _log.info(">> DM Engine infos dump (JOINING) <<");
- + _log.info("<<--^----^^-----^----^^------^----->>");
- + }
- + else if (!_joining && _teleport && !_started)
- + {
- + _log.info("<<---------------------------------->>");
- + _log.info(">> DM Engine infos dump (TELEPORT) <<");
- + _log.info("<<--^----^^-----^----^^------^^----->>");
- + }
- + else if (!_joining && !_teleport && _started)
- + {
- + _log.info("<<--------------------------------->>");
- + _log.info(">> DM Engine infos dump (STARTED) <<");
- + _log.info("<<--^----^^-----^----^^------^----->>");
- + }
- +
- + _log.info("Name: " + _eventName);
- + _log.info("Desc: " + _eventDesc);
- + _log.info("Join location: " + _joiningLocationName);
- + _log.info("Min lvl: " + _minlvl);
- + _log.info("Max lvl: " + _maxlvl);
- +
- + _log.info("");
- + _log.info("##################################");
- + _log.info("# _players(Vector<L2PcInstance>) #");
- + _log.info("##################################");
- +
- + _log.info("Total Players : " + _players.size());
- +
- + for (L2PcInstance player : _players)
- + {
- + if (player != null)
- + _log.info("Name: " + player.getName()+ " kills :" + player._countDMkills);
- + }
- +
- + _log.info("");
- + _log.info("################################");
- + _log.info("# _savePlayers(Vector<String>) #");
- + _log.info("################################");
- +
- + for (String player : _savePlayers)
- + _log.info("Name: " + player );
- +
- + _log.info("");
- + _log.info("");
- + }
- +
- + public static void loadData()
- + {
- + _eventName = new String();
- + _eventDesc = new String();
- + _joiningLocationName = new String();
- + _savePlayers = new Vector<String>();
- + _players = new Vector<L2PcInstance>();
- + _topPlayer = null;
- + _npcSpawn = null;
- + _joining = false;
- + _teleport = false;
- + _started = false;
- + _sitForced = false;
- + _npcId = 0;
- + _npcX = 0;
- + _npcY = 0;
- + _npcZ = 0;
- + _rewardId = 0;
- + _rewardAmount = 0;
- + _topKills = 0;
- + _minlvl = 0;
- + _maxlvl = 0;
- + _playerColors = 0;
- + _playerX = 0;
- + _playerY = 0;
- + _playerZ = 0;
- +
- + Connection con = null;
- + try
- + {
- + PreparedStatement statement;
- + ResultSet rs;
- +
- +
- + con = L2DatabaseFactory.getInstance().getConnection();
- +
- + statement = con.prepareStatement("Select * from dm");
- + rs = statement.executeQuery();
- +
- + while (rs.next())
- + {
- + _eventName = rs.getString("eventName");
- + _eventDesc = rs.getString("eventDesc");
- + _joiningLocationName = rs.getString("joiningLocation");
- + _minlvl = rs.getInt("minlvl");
- + _maxlvl = rs.getInt("maxlvl");
- + _npcId = rs.getInt("npcId");
- + _npcX = rs.getInt("npcX");
- + _npcY = rs.getInt("npcY");
- + _npcZ = rs.getInt("npcZ");
- + _rewardId = rs.getInt("rewardId");
- + _rewardAmount = rs.getInt("rewardAmount");
- + _playerColors = rs.getInt("color");
- + _playerX = rs.getInt("playerX");
- + _playerY = rs.getInt("playerY");
- + _playerZ = rs.getInt("playerZ");
- +
- + }
- + statement.close();
- + }
- + catch (Exception e)
- + {
- + _log.warning("Exception: DM.loadData(): " + e.getMessage());
- + }
- + finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } }
- + }
- +
- + public static void saveData()
- + {
- + Connection con = null;
- + try
- + {
- + con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement;
- +
- + statement = con.prepareStatement("Delete from dm");
- + statement.execute();
- + statement.close();
- +
- + statement = con.prepareStatement("INSERT INTO dm (eventName, eventDesc, joiningLocation, minlvl, maxlvl, npcId, npcX, npcY, npcZ, rewardId, rewardAmount, color, playerX, playerY, playerZ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
- + statement.setString(1, _eventName);
- + statement.setString(2, _eventDesc);
- + statement.setString(3, _joiningLocationName);
- + statement.setInt(4, _minlvl);
- + statement.setInt(5, _maxlvl);
- + statement.setInt(6, _npcId);
- + statement.setInt(7, _npcX);
- + statement.setInt(8, _npcY);
- + statement.setInt(9, _npcZ);
- + statement.setInt(10, _rewardId);
- + statement.setInt(11, _rewardAmount);
- + statement.setInt(12, _playerColors);
- + statement.setInt(13, _playerX);
- + statement.setInt(14, _playerY);
- + statement.setInt(15, _playerZ);
- + statement.execute();
- + statement.close();
- + }
- + catch (Exception e)
- + {
- + _log.warning("Exception: DM.saveData(): " + e.getMessage());
- + }
- + finally { try { if (con != null) con.close(); } catch (SQLException e) { e.printStackTrace(); } }
- + }
- +
- + public static void showEventHtml(L2PcInstance eventPlayer, String objectId)
- + {
- + try
- + {
- + NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
- +
- + TextBuilder replyMSG = new TextBuilder("<html><body>");
- + replyMSG.append("DM Match<br><br><br>");
- + replyMSG.append("Current event...<br1>");
- + replyMSG.append(" ... name: <font color=\"00FF00\">" + _eventName + "</font><br1>");
- + replyMSG.append(" ... description: <font color=\"00FF00\">" + _eventDesc + "</font><br><br>");
- +
- + if (!_started && !_joining)
- + replyMSG.append("<center>Wait till the admin/gm start the participation.</center>");
- + else if (!_started && _joining && eventPlayer.getLevel()>=_minlvl && eventPlayer.getLevel()<_maxlvl)
- + {
- + if (_players.contains(eventPlayer))
- + {
- + replyMSG.append("You are already participating!<br><br>");
- +
- + replyMSG.append("<table border=\"0\"><tr>");
- + replyMSG.append("<td width=\"200\">Wait till event start or</td>");
- + replyMSG.append("<td width=\"60\"><center><button value=\"remove\" action=\"bypass -h npc_" + objectId + "_dmevent_player_leave\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></td>");
- + replyMSG.append("<td width=\"100\">your participation!</td>");
- + replyMSG.append("</tr></table>");
- + }
- + else
- + {
- + replyMSG.append("You want to participate in the event?<br><br>");
- + replyMSG.append("<td width=\"200\">Admin set min lvl : <font color=\"00FF00\">" + _minlvl + "</font></td><br>");
- + replyMSG.append("<td width=\"200\">Admin set max lvl : <font color=\"00FF00\">" + _maxlvl + "</font></td><br><br>");
- +
- + replyMSG.append("<button value=\"Join\" action=\"bypass -h npc_" + objectId + "_dmevent_player_join\" width=50 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
- +
- + }
- + }
- + else if (_started && !_joining)
- + replyMSG.append("<center>DM match is in progress.</center>");
- + else if (eventPlayer.getLevel()<_minlvl || eventPlayer.getLevel()>_maxlvl )
- + {
- + replyMSG.append("Your lvl : <font color=\"00FF00\">" + eventPlayer.getLevel() +"</font><br>");
- + replyMSG.append("Admin set min lvl : <font color=\"00FF00\">" + _minlvl + "</font><br>");
- + replyMSG.append("Admin set max lvl : <font color=\"00FF00\">" + _maxlvl + "</font><br><br>");
- + replyMSG.append("<font color=\"FFFF00\">You can't participate to this event.</font><br>");
- + }
- +
- + replyMSG.append("</body></html>");
- + adminReply.setHtml(replyMSG.toString());
- + eventPlayer.sendPacket(adminReply);
- +
- + // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
- + eventPlayer.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + catch (Exception e)
- + {
- + _log.warning("DM Engine[showEventHtlm(" + eventPlayer.getName() + ", " + objectId + ")]: exception" + e.getMessage());
- + }
- + }
- +
- + public static void addPlayer(L2PcInstance player)
- + {
- + if (!addPlayerOk(player))
- + return;
- + _players.add(player);
- + player._originalNameColorDM = player.getAppearance().getNameColor();
- + player._originalKarmaDM = player.getKarma();
- + player._inEventDM = true;
- + player._countDMkills = 0;
- + _savePlayers.add(player.getName());
- +
- + }
- +
- + public static boolean addPlayerOk(L2PcInstance eventPlayer)
- + {
- +
- + if (eventPlayer._inEventDM)
- + {
- + eventPlayer.sendMessage("You are already participating in the event!");
- + return false;
- + }
- +
- +
- + return true;
- + }
- +
- + public static synchronized void addDisconnectedPlayer(L2PcInstance player)
- + {
- + if ((_teleport || _started) || _savePlayers.contains(player.getName()))
- + {
- + if (Config.DM_ON_START_REMOVE_ALL_EFFECTS)
- + {
- + for (L2Effect e : player.getAllEffects())
- + {
- + if (e != null)
- + e.exit();
- + }
- + }
- + for (L2PcInstance p : _players)
- + {
- + if (p==null)
- + {
- + continue;
- + }
- + //check by name incase player got new objectId
- + else if (p.getName().equals(player.getName()))
- + {
- + player._originalNameColorDM = player.getAppearance().getNameColor();
- + player._originalKarmaDM = player.getKarma();
- + player._inEventDM = true;
- + player._countDMkills =p._countDMkills;
- + _players.remove(p); //removing old object id from vector
- + _players.add(player); //adding new objectId to vector
- + break;
- + }
- + }
- +
- + player.getAppearance().setNameColor(_playerColors);
- + player.setKarma(0);
- + player.broadcastUserInfo();
- + player.teleToLocation(_playerX, _playerY , _playerZ, false);
- + }
- + }
- +
- + public static void removePlayer(L2PcInstance player)
- + {
- + if (player != null)
- + {
- + _players.remove(player);
- + }
- + }
- +
- + public static void cleanDM()
- + {
- + for (L2PcInstance player : _players)
- + {
- + removePlayer(player);
- + }
- +
- + _savePlayers = new Vector<String>();
- + _topPlayer = null;
- + _npcSpawn = null;
- + _joining = false;
- + _teleport = false;
- + _started = false;
- + _sitForced = false;
- + _topKills = 0;
- + _players = new Vector<L2PcInstance>();
- +
- + }
- +
- + public static void unspawnEventNpc()
- + {
- + if (_npcSpawn == null)
- + return;
- +
- + _npcSpawn.getLastSpawn().deleteMe();
- + _npcSpawn.stopRespawn();
- + SpawnTable.getInstance().deleteSpawn(_npcSpawn, true);
- + }
- +
- + public static void teleportFinish()
- + {
- + Announcements.getInstance().announceToAll(_eventName + "(DM): Teleport back to participation NPC in 20 seconds!");
- +
- + removeUserData();
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + for (L2PcInstance player : _players)
- + {
- + if (player != null && player.isOnline()!=0)
- + player.teleToLocation(_npcX, _npcY, _npcZ, false);
- + }
- + cleanDM();
- + }
- + }, 20000);
- + }
- +}
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/L2Summon.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/L2Summon.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/actor/L2Summon.java (working copy)
- -685,9 +685,12 @@
- && getOwner() != null
- && (!getOwner().getAccessLevel().allowPeaceAttack()))
- {
- - // If summon or target is in a peace zone, send a system message TARGET_IN_PEACEZONE
- - sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- - return;
- + if(!this.isInFunEvent() || !target.isInFunEvent())
- + {
- + // If summon or target is in a peace zone, send a system message TARGET_IN_PEACEZONE
- + sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- + return;
- + }
- }
- if (getOwner() != null && getOwner().isInOlympiadMode() && !getOwner().isOlympiadStart()){
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
- -27,10 +27,12 @@
- import net.sf.l2j.gameserver.model.L2CharPosition;
- import net.sf.l2j.gameserver.model.L2Object;
- import net.sf.l2j.gameserver.model.L2World;
- +import net.sf.l2j.gameserver.model.actor.instance.L2ClassMasterInstance;
- import net.sf.l2j.gameserver.model.actor.L2Npc;
- import net.sf.l2j.gameserver.model.actor.instance.L2MerchantSummonInstance;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.entity.L2Event;
- +import net.sf.l2j.gameserver.model.entity.DM;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- -124,7 +126,22 @@
- {
- ((L2Npc)object).onBypassFeedback(activeChar, _command.substring(endOfId+1));
- }
- + if (_command.substring(endOfId+1).startsWith("dmevent_player_join"))
- + {
- + if (DM._joining)
- + DM.addPlayer(activeChar);
- + else
- + activeChar.sendMessage("The event is already started. You can not join now!");
- + }
- +
- + else if (_command.substring(endOfId+1).startsWith("dmevent_player_leave"))
- + {
- + if (DM._joining)
- + DM.removePlayer(activeChar);
- + else
- + activeChar.sendMessage("The event is already started. You can not leave now!");
- activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- }
- catch (NumberFormatException nfe) {}
- }
- Index: java/net/sf/l2j/gameserver/model/L2Object.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/L2Object.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/L2Object.java (working copy)
- -435,4 +435,10 @@
- {
- return "" + getObjectId();
- }
- + public boolean isInFunEvent()
- + {
- + L2PcInstance player = getActingPlayer();
- +
- + return (player == null ? false : player.isInFunEvent());
- + }
- }
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/actor/stat/PcStat.java (working copy)
- -21,6 +21,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
- import net.sf.l2j.gameserver.model.base.Experience;
- import net.sf.l2j.gameserver.model.quest.QuestState;
- +import net.sf.l2j.gameserver.model.entity.DM;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.ExBrExtraUserInfo;
- import net.sf.l2j.gameserver.network.serverpackets.ExVitalityPointInfo;
- -200,6 +201,12 @@
- getActiveChar().setCurrentCp(getMaxCp());
- getActiveChar().broadcastPacket(new SocialAction(getActiveChar().getObjectId(), SocialAction.LEVEL_UP));
- getActiveChar().sendPacket(new SystemMessage(SystemMessageId.YOU_INCREASED_YOUR_LEVEL));
- + if (getActiveChar().isInFunEvent())
- + {
- + if (getActiveChar()._inEventDM && DM._maxlvl == getLevel() && !DM._started)
- + DM.removePlayer(getActiveChar());
- + getActiveChar().sendMessage("Your event sign up was canceled.");
- + }
- }
- getActiveChar().rewardSkills(); // Give Expertise skill of this level
- Index: java/net/sf/l2j/gameserver/model/actor/L2Character.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/L2Character.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/actor/L2Character.java (working copy)
- -5487,8 +5487,11 @@
- if (isInsidePeaceZone(player))
- {
- // If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
- - player.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- - player.sendPacket(ActionFailed.STATIC_PACKET);
- + if(!player.isInFunEvent() || !player.getTarget().isInFunEvent())
- + {
- + player.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- }
- else if (player.isInOlympiadMode() && player.getTarget() != null && player.getTarget() instanceof L2Playable)
- {
- -5540,7 +5543,11 @@
- */
- public boolean isInsidePeaceZone(L2PcInstance attacker)
- {
- - return isInsidePeaceZone(attacker, this);
- + if(!this.isInFunEvent() || !attacker.isInFunEvent())
- + {
- + return isInsidePeaceZone(attacker, this);
- + }
- + return false;
- }
- public boolean isInsidePeaceZone(L2PcInstance attacker, L2Object target)
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- -134,6 +134,7 @@
- import net.sf.l2j.gameserver.model.entity.Fort;
- import net.sf.l2j.gameserver.model.entity.L2Event;
- import net.sf.l2j.gameserver.model.entity.Siege;
- +import net.sf.l2j.gameserver.model.entity.DM;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
- import net.sf.l2j.gameserver.model.itemcontainer.ItemContainer;
- -682,7 +683,12 @@
- public LinkedList<String> kills = new LinkedList<String>();
- public boolean eventSitForced = false;
- public boolean atEvent = false;
- +
- + /** DM Engine parameters */
- + public int _originalNameColorDM, _countDMkills, _originalKarmaDM;
- + public boolean _inEventDM = false;
- +
- /** new loto ticket **/
- private int _loto[] = new int[5];
- //public static int _loto_nums[] = {0,1,2,3,4,5,6,7,8,9,};
- -2974,6 +2980,8 @@
- {
- sendMessage("A dark force beyond your mortal understanding makes your knees to shake when you try to stand up ...");
- }
- + else if (DM._sitForced && _inEventDM)
- + sendMessage("The Admin/GM handle if you sit or stand in this match!");
- else if (_waitTypeSitting && !isInStoreMode() && !isAlikeDead())
- {
- if (_relax)
- -4052,6 +4060,14 @@
- player.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- + if (DM._started && !Config.DM_ALLOW_INTERFERENCE)
- + {
- + if ((_inEventDM && !player._inEventDM) || (!_inEventDM && player._inEventDM))
- + {
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + }
- // Check if the L2PcInstance is confused
- if (player.isOutOfControl())
- -4091,7 +4107,7 @@
- else
- {
- // Check if this L2PcInstance is autoAttackable
- - if (isAutoAttackable(player))
- + if (isAutoAttackable(player) || (player._inEventDM && DM._started))
- {
- // Player with lvl < 21 can't attack a cursed weapon holder
- // And a cursed weapon holder can't attack players with lvl < 21
- -4160,6 +4176,10 @@
- }
- player.sendPacket(ActionFailed.STATIC_PACKET);
- }
- + public boolean isInFunEvent()
- + {
- + return (atEvent || (DM._started && _inEventDM));
- + }
- /**
- * Returns true if cp update should be done, false if not
- -5256,6 +5276,39 @@
- TvTEvent.onKill(killer, this);
- + if ((killer instanceof L2PcInstance && ((L2PcInstance) killer)._inEventDM) && _inEventDM)
- + {
- + if (DM._teleport || DM._started)
- + {
- + ((L2PcInstance) killer)._countDMkills++;
- +
- + sendMessage("You will be revived and teleported to spot in " + Config.DM_REVIVE_DELAY / 1000 + " seconds!");
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + teleToLocation(DM._playerX, DM._playerY, DM._playerZ, false);
- + doRevive();
- + }
- + }, Config.DM_REVIVE_DELAY);
- + }
- + }
- + else if (_inEventDM)
- + {
- + if (DM._teleport || DM._started)
- + {
- + sendMessage("You will be revived and teleported to spot in " + Config.DM_REVIVE_DELAY / 1000 + " seconds!");
- + ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
- + {
- + public void run()
- + {
- + teleToLocation(DM._playerX, DM._playerY, DM._playerZ, false);
- + doRevive();
- + }
- + }, Config.DM_REVIVE_DELAY);
- + }
- + }
- +
- if (atEvent && pk != null)
- {
- pk.kills.add(getName());
- -5367,7 +5420,7 @@
- private void onDieDropItem(L2Character killer)
- {
- - if (atEvent || killer == null)
- + if (atEvent || (DM._started && _inEventDM) || killer == null)
- return;
- L2PcInstance pk = killer.getActingPlayer();
- -5479,6 +5532,9 @@
- {
- if (target == null) return;
- if (!(target instanceof L2Playable)) return;
- +
- + if (_inEventDM)
- + return;
- L2PcInstance targetPlayer = target.getActingPlayer();
- -5571,6 +5627,9 @@
- */
- public void increasePvpKills()
- {
- +
- + if (DM._started && _inEventDM)
- + return;
- // Add karma to attacker and increase its PK counter
- setPvpKills(getPvpKills() + 1);
- -5586,6 +5645,9 @@
- */
- public void increasePkKillsAndKarma(int targLVL)
- {
- + if (DM._started && _inEventDM)
- + return;
- +
- int baseKarma = Config.KARMA_MIN_KARMA;
- int newKarma = baseKarma;
- int karmaLimit = Config.KARMA_MAX_KARMA;
- -5666,10 +5728,16 @@
- public void updatePvPStatus(L2Character target)
- {
- + if (DM._started && _inEventDM)
- + return;
- +
- L2PcInstance player_target = target.getActingPlayer();
- if (player_target == null)
- return;
- +
- + if (DM._started && _inEventDM && player_target._inEventDM)
- + return;
- if ((isInDuel() && player_target.getDuelId() == getDuelId())) return;
- if ((!isInsideZone(ZONE_PVP) || !player_target.isInsideZone(ZONE_PVP)) && player_target.getKarma() == 0)
- -5787,7 +5855,7 @@
- // Calculate the Experience loss
- long lostExp = 0;
- - if (!atEvent)
- + if (!atEvent && !_inEventDM)
- if (lvl < Experience.MAX_LEVEL)
- lostExp = Math.round((getStat().getExpForLevel(lvl+1) - getStat().getExpForLevel(lvl)) * percentLost /100);
- else
- -8684,12 +8752,13 @@
- if (skill.isOffensive())
- {
- if ((isInsidePeaceZone(this, target)) && !getAccessLevel().allowPeaceAttack())
- - {
- - // If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
- - sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- - sendPacket(ActionFailed.STATIC_PACKET);
- - return false;
- - }
- + if(!this.isInFunEvent() || !target.isInFunEvent())
- + {
- + // If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
- + sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- if (isInOlympiadMode() && !isOlympiadStart()){
- // if L2PcInstance is in Olympia and the match isn't already start, send a Server->Client packet ActionFailed
- -8700,9 +8769,12 @@
- // Check if the target is attackable
- if (!target.isAttackable() && !getAccessLevel().allowPeaceAttack())
- {
- - // If target is not attackable, send a Server->Client packet ActionFailed
- - sendPacket(ActionFailed.STATIC_PACKET);
- - return false;
- + if(!this.isInFunEvent() || !target.isInFunEvent())
- + {
- + // If target is not attackable, send a Server->Client packet ActionFailed
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- }
- // Check if a Forced ATTACK is in progress on non-attackable target
- -8772,13 +8844,14 @@
- // And this skill cannot be used in peace zone, not even on NPCs!
- if(this.isInsideZone(L2Character.ZONE_PEACE))
- {
- - //Sends a sys msg to client
- - sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- -
- - // Send a Server->Client packet ActionFailed to the L2PcInstance
- - sendPacket(ActionFailed.STATIC_PACKET);
- -
- - return false;
- + if(!this.isInFunEvent() || !target.isInFunEvent())
- + {
- + //Sends a sys msg to client
- + sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- + // Send a Server->Client packet ActionFailed to the L2PcInstance
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- }
- }
- -8892,12 +8965,14 @@
- default:
- if (!checkPvpSkill(target, skill) && !getAccessLevel().allowPeaceAttack())
- {
- - // Send a System Message to the L2PcInstance
- - sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
- -
- - // Send a Server->Client packet ActionFailed to the L2PcInstance
- - sendPacket(ActionFailed.STATIC_PACKET);
- - return false;
- + if(!this.isInFunEvent() || !target.isInFunEvent())
- + {
- + // Send a System Message to the L2PcInstance
- + sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
- +
- + // Send a Server->Client packet ActionFailed to the L2PcInstance
- + sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- }
- }
- -8933,6 +9008,8 @@
- // finally, after passing all conditions
- return true;
- }
- + return dontMove;
- + }
- public boolean checkIfOkToUseStriderSiegeAssault(boolean isCheckOnly)
- {
- -9079,6 +9156,10 @@
- */
- public boolean checkPvpSkill(L2Object target, L2Skill skill)
- {
- +
- + if (_inEventDM && DM._started)
- + return true;
- +
- return checkPvpSkill(target, skill, false);
- }
- -10703,6 +10784,7 @@
- if (!DimensionalRiftManager.getInstance().checkIfInPeaceZone(getX(), getY(), getZ()))
- getParty().getDimensionalRift().memberRessurected(this);
- }
- +
- }
- @Override
- Index: java/net/sf/l2j/gameserver/model/actor/L2Npc.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/L2Npc.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/actor/L2Npc.java (working copy)
- -69,6 +69,7 @@
- import net.sf.l2j.gameserver.model.entity.Castle;
- import net.sf.l2j.gameserver.model.entity.Fort;
- import net.sf.l2j.gameserver.model.entity.L2Event;
- +import net.sf.l2j.gameserver.model.entity.DM;
- import net.sf.l2j.gameserver.model.itemcontainer.NpcInventory;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.model.quest.Quest;
- -144,7 +145,8 @@
- /** The fortress index in the array of L2Fort this L2NpcInstance belongs to */
- private int _fortIndex = -2;
- - public boolean isEventMob = false;
- +
- + public boolean isEventMob = false, _isEventMobDM = false ;
- private boolean _isInTown = false;
- private int _isSpoiledBy = 0;
- -685,6 +687,8 @@
- {
- L2Event.showEventHtml(player, String.valueOf(getObjectId()));
- }
- + else if (_isEventMobDM)
- + DM.showEventHtml(player, String.valueOf(getObjectId()));
- else
- {
- Quest[] qlsa = getTemplate().getEventQuests(Quest.QuestEventType.QUEST_START);
- Index: java/net/sf/l2j/gameserver/model/L2Skill.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/L2Skill.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/L2Skill.java (working copy)
- -36,6 +36,7 @@
- import net.sf.l2j.gameserver.model.actor.instance.L2PetInstance;
- import net.sf.l2j.gameserver.model.actor.instance.L2SiegeFlagInstance;
- import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance;
- +import net.sf.l2j.gameserver.model.entity.DM;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- -1637,6 +1638,12 @@
- {
- if (partyMember == null || partyMember == player)
- continue;
- + //check if allow interference is allowed if player is not on event but target is on event
- + if ((DM._started && !Config.DM_ALLOW_INTERFERENCE) && !player.isGM())
- + {
- + if ((partyMember._inEventDM && !player._inEventDM) || (!partyMember._inEventDM && player._inEventDM))
- + continue;
- + }
- if (addCharacter(activeChar, partyMember, radius, false))
- targetList.add(partyMember);
- -1937,7 +1944,12 @@
- {
- if (obj == null)
- continue;
- -
- + //check if allow interference is allowed if player is not on event but target is on event
- + if ((DM._started && !Config.DM_ALLOW_INTERFERENCE) && !player.isGM())
- + {
- + if ((player._inEventDM && !player._inEventDM) || (!player._inEventDM && player._inEventDM))
- + continue;
- + }
- if (player.isInDuel())
- {
- if (player.getDuelId() != obj.getDuelId())
- Index: java/config/l2jmods.properties
- ===================================================================
- --- java/config/l2jmods.properties (revision 3427)
- +++ java/config/l2jmods.properties (working copy)
- -248,4 +248,17 @@
- # This option will enable core support for:
- # Mana Drug (item ID 726), using skill ID 9007.
- # Mana Potion (item ID 728), using skill ID 9008.
- -EnableManaPotionSupport = False
- \ No newline at end of file
- +EnableManaPotionSupport = False
- +
- +#Players that are not participating in DM can target DM participants?
- +DMAllowInterference = False
- +# DM participants can use potions?
- +DMAllowPotions = False
- +# DM participants can summon by item?
- +DMAllowSummon = False
- +# Remove all effects of DM participants on event start?
- +DMOnStartRemoveAllEffects = True
- +# Unsummon pet of DM participants on event start?
- +DMOnStartUnsummonPet = True
- +# Delay on revive when dead, NOTE: 20000 equals to 20 seconds, minimum 1000 (1 second)
- +DMReviveDelay = 20000
- \ No newline at end of file
- Index: java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (working copy)
- -47,6 +47,7 @@
- import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- import net.sf.l2j.gameserver.network.serverpackets.UserInfo;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
- import net.sf.l2j.gameserver.util.StringUtil;
- import net.sf.l2j.gameserver.util.Util;
- -318,6 +319,11 @@
- player.sendMessage("You may not add a new sub class before you are level 75 on your previous class.");
- allowAddition = false;
- }
- + if (player._inEventDM)
- + {
- + player.sendMessage("You have already been registered in a waiting list of an event.");
- + return;
- + }
- if (allowAddition)
- {
- -404,7 +410,11 @@
- *
- * Note: paramOne = classIndex
- */
- -
- + if (player._inEventDM)
- + {
- + player.sendMessage("You have already been registered in a waiting list of an event.");
- + return;
- + }
- /*
- * DrHouse: Despite this is not 100% retail like, it is here to avoid some exploits during subclass changes, specially
- * on small servers. TODO: On retail, each village master doesn't offer any subclass that is not given by itself so player
- Index: java/net/sf/l2j/gameserver/model/L2Radar.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/L2Radar.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/model/L2Radar.java (working copy)
- -16,6 +16,7 @@
- import javolution.util.FastList;
- +import net.sf.l2j.gameserver.ThreadPoolManager;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.network.serverpackets.RadarControl;
- -127,4 +128,32 @@
- return true;
- }
- }
- + public class RadarOnPlayer implements Runnable
- + {
- + private final L2PcInstance _myTarget, _me;
- +
- + public RadarOnPlayer(L2PcInstance target, L2PcInstance me)
- + {
- + _me = me;
- + _myTarget = target;
- + }
- +
- + public void run()
- + {
- + try
- + {
- + if (_me == null || _me.isOnline()==0)
- + return;
- +
- + _me.sendPacket(new RadarControl(1, 1, _me.getX(), _me.getY(), _me.getZ()));
- + if (_myTarget == null || _myTarget.isOnline()==0 )
- + return;
- +
- + _me.sendPacket(new RadarControl(0, 1, _myTarget.getX(), _myTarget.getY(), _myTarget.getZ()));
- + ThreadPoolManager.getInstance().scheduleGeneral(new RadarOnPlayer(_myTarget,_me), 15000);
- + }
- + catch(Throwable t)
- + {}
- + }
- + }
- }
- Index: java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/EnterWorld.java (working copy)
- -57,6 +57,7 @@
- import net.sf.l2j.gameserver.model.entity.L2Event;
- import net.sf.l2j.gameserver.model.entity.Siege;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- +import net.sf.l2j.gameserver.model.entity.DM;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.model.quest.Quest;
- import net.sf.l2j.gameserver.model.quest.QuestState;
- -438,6 +439,8 @@
- RegionBBSManager.getInstance().changeCommunityBoard();
- TvTEvent.onLogin(activeChar);
- + if (DM._savePlayers.contains(activeChar.getName()))
- + DM.addDisconnectedPlayer(activeChar);
- }
- /**
- Index: java/net/sf/l2j/gameserver/network/clientpackets/RequestActionUse.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/clientpackets/RequestActionUse.java (revision 3427)
- +++ java/net/sf/l2j/gameserver/network/clientpackets/RequestActionUse.java (working copy)
- -171,8 +171,11 @@
- if (!activeChar.getAccessLevel().allowPeaceAttack() && activeChar.isInsidePeaceZone(pet, target))
- {
- - activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- - return;
- + if(!activeChar.isInFunEvent() || !target.isInFunEvent())
- + {
- + activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
- + return;
- + }
- }
- if (pet.getNpcId() == 12564 || pet.getNpcId() == 12621)
- {
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 3427)
- +++ java/net/sf/l2j/Config.java (working copy)
- -594,8 +594,13 @@
- public static boolean OFFLINE_SET_NAME_COLOR;
- public static int OFFLINE_NAME_COLOR;
- public static boolean L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
- + public static boolean DM_ALLOW_INTERFERENCE;
- + public static boolean DM_ALLOW_POTIONS;
- + public static boolean DM_ALLOW_SUMMON;
- + public static boolean DM_ON_START_REMOVE_ALL_EFFECTS;
- + public static boolean DM_ON_START_UNSUMMON_PET;
- + public static long DM_REVIVE_DELAY;
- -
- //--------------------------------------------------
- // NPC Settings
- //--------------------------------------------------
- -1779,6 +1784,15 @@
- L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
- L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingFreight", "False"));
- + DM_ALLOW_INTERFERENCE = Boolean.parseBoolean(L2JModSettings.getProperty("DMAllowInterference", "false"));
- + DM_ALLOW_POTIONS = Boolean.parseBoolean(L2JModSettings.getProperty("DMAllowPotions", "false"));
- + DM_ALLOW_SUMMON = Boolean.parseBoolean(L2JModSettings.getProperty("DMAllowSummon", "false"));
- + DM_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(L2JModSettings.getProperty("DMOnStartRemoveAllEffects", "true"));
- + DM_ON_START_UNSUMMON_PET = Boolean.parseBoolean(L2JModSettings.getProperty("DMOnStartUnsummonPet", "true"));
- + DM_REVIVE_DELAY = Long.parseLong(L2JModSettings.getProperty("DMReviveDelay", "20000"));
- + if (DM_REVIVE_DELAY < 1000)
- + DM_REVIVE_DELAY = 1000; //can't be set less then 1 second
- +
- if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
- {
- TVT_EVENT_ENABLED = false;
- -2390,7 +2404,19 @@
- else if (pName.equalsIgnoreCase("EnableWarehouseSortingFreight")) L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT = Boolean.parseBoolean(pValue);
- else if (pName.equalsIgnoreCase("EnableManaPotionSupport")) L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(pValue);
- -
- + else if (pName.equalsIgnoreCase("DMAllowInterference"))
- + DM_ALLOW_INTERFERENCE = Boolean.parseBoolean(pValue);
- + else if (pName.equalsIgnoreCase("DMAllowPotions"))
- + DM_ALLOW_POTIONS = Boolean.parseBoolean(pValue);
- + else if (pName.equalsIgnoreCase("DMAllowSummon"))
- + DM_ALLOW_SUMMON = Boolean.parseBoolean(pValue);
- + else if (pName.equalsIgnoreCase("DMOnStartRemoveAllEffects"))
- + DM_ON_START_REMOVE_ALL_EFFECTS = Boolean.parseBoolean(pValue);
- + else if (pName.equalsIgnoreCase("DMOnStartUnsummonPet"))
- + DM_ON_START_UNSUMMON_PET = Boolean.parseBoolean(pValue);
- + else if (pName.equalsIgnoreCase("DMReviveDelay"))
- + DM_REVIVE_DELAY = Long.parseLong(pValue);
- +
- else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);
- else if (pName.equalsIgnoreCase("MaxKarma")) KARMA_MAX_KARMA = Integer.parseInt(pValue);
- else if (pName.equalsIgnoreCase("XPDivider")) KARMA_XP_DIVIDER = Integer.parseInt(pValue);
- Index: java/net/sf/l2j/util/Util.java
- ===================================================================
- --- java/net/sf/l2j/util/Util.java (revision 3427)
- +++ java/net/sf/l2j/util/Util.java (working copy)
- @@ -142,5 +142,21 @@
- buf.position(buf.position() - data.length);
- return hex;
- }
- -
- +
- + /**
- + * @param substring
- + * @return
- + */
- +public static String reverseColor(String color)
- +{
- + char[] ch1 = color.toCharArray();
- + char[] ch2 = new char[6];
- + ch2[0] = ch1[4];
- + ch2[1] = ch1[5];
- + ch2[2] = ch1[2];
- + ch2[3] = ch1[3];
- + ch2[4] = ch1[0];
- + ch2[5] = ch1[1];
- + return new String(ch2);
- }
Advertisement
Add Comment
Please, Sign In to add comment