Index: C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/L2Character.java =================================================================== --- C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/L2Character.java (revision 1059) +++ C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/L2Character.java (working copy) @@ -534,8 +534,6 @@ if (Config.DEBUG) _log.fine(this.getName()+" doAttack: target="+target); - TvTEvent.onActivity(this); - if (isAlikeDead() || target == null || (this instanceof L2NpcInstance && target.isAlikeDead()) || (this instanceof L2PcInstance && target.isDead() && !target.isFakeDeath()) || !getKnownList().knowsObject(target) @@ -1110,8 +1108,6 @@ return; } - TvTEvent.onActivity(this); - if (isSkillDisabled(skill.getId())) { if (this instanceof L2PcInstance) Index: C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java =================================================================== --- C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java (revision 1059) +++ C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/actor/instance/L2TvTEventNpcInstance.java (working copy) @@ -1,20 +1,3 @@ -/* This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * http://www.gnu.org/copyleft/gpl.html - */ package net.sf.l2j.gameserver.model.actor.instance; import net.sf.l2j.Config; Index: C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTEvent.java =================================================================== --- C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTEvent.java (revision 1059) +++ C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTEvent.java (working copy) @@ -1,23 +1,7 @@ -/* This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * http://www.gnu.org/copyleft/gpl.html - */ package net.sf.l2j.gameserver.model.entity; import net.sf.l2j.Config; +import net.sf.l2j.util.Rnd; import net.sf.l2j.gameserver.Announcements; import net.sf.l2j.gameserver.datatables.ItemTable; import net.sf.l2j.gameserver.datatables.NpcTable; @@ -35,13 +19,7 @@ import net.sf.l2j.gameserver.serverpackets.StatusUpdate; import net.sf.l2j.gameserver.serverpackets.SystemMessage; import net.sf.l2j.gameserver.templates.L2NpcTemplate; -import net.sf.l2j.util.Rnd; -/** - * TvTEvent class - * - * @author FBIagent - */ public class TvTEvent { enum EventState @@ -128,36 +106,6 @@ _npcSpawn.stopRespawn(); _npcSpawn = null; _lastNpcSpawn = null; - - for (byte i=0;i<2;i++) - { - for (String playerName : _teams[i].getParticipatedPlayerNames()) - { - L2PcInstance playerInstance = _teams[i].getPlayerInstance(playerName); - - if (playerInstance == null || playerInstance.isOnline() == 0) - _teams[i].removePlayer(playerName); - } - } - - int teamOnePlayerCount = _teams[0].getParticipatedPlayerCount(); - int teamTwoPlayerCount = _teams[1].getParticipatedPlayerCount(); - int playerCountDifference = Math.abs(teamOnePlayerCount - teamTwoPlayerCount); - byte rest = (byte)(getParticipatedPlayersCount() % 2); - - if ((rest == 0 && playerCountDifference > 0) || (rest != 0 && playerCountDifference > 1)) - { - byte teamIdWithMorePlayers = (byte)(teamOnePlayerCount > teamTwoPlayerCount ? 0 : 1); - byte teamIdWithLesserPlayers = (byte)(teamIdWithMorePlayers == 0 ? 1 : 0); - - for (int i=0;i _participatedPlayersInstances = new FastMap(); - private Map _participatedPlayersLastActivities = new FastMap(); + private Map _participatedPlayers = new FastMap(); private Vector _participatedPlayerNames = new Vector(); public TvTEventTeam(String name, int[] coordinates) @@ -46,12 +27,11 @@ if (playerInstance == null) return false; - synchronized (_participatedPlayersInstances) + synchronized (_participatedPlayers) { String playerName = playerInstance.getName(); - _participatedPlayersInstances.put(playerName, playerInstance); - _participatedPlayersLastActivities.put(playerName, (long)0); + _participatedPlayers.put(playerName, playerInstance); if (!_participatedPlayerNames.contains(playerName)) _participatedPlayerNames.add(playerName); @@ -62,10 +42,9 @@ public void removePlayer(String playerName) { - synchronized (_participatedPlayersInstances) + synchronized (_participatedPlayers) { - _participatedPlayersInstances.remove(playerName); - _participatedPlayersLastActivities.remove(playerName); + _participatedPlayers.remove(playerName); _participatedPlayerNames.remove(playerName); } } @@ -77,11 +56,9 @@ public void cleanMe() { - _participatedPlayersInstances.clear(); - _participatedPlayersLastActivities.clear(); + _participatedPlayers.clear(); _participatedPlayerNames.clear(); - _participatedPlayersInstances = new FastMap(); - _participatedPlayersLastActivities = new FastMap(); + _participatedPlayers = new FastMap(); _participatedPlayerNames = new Vector(); _points = 0; } @@ -90,7 +67,7 @@ { boolean containsPlayer; - synchronized (_participatedPlayersInstances) + synchronized (_participatedPlayers) { containsPlayer = _participatedPlayerNames.contains(playerName); } @@ -97,14 +74,6 @@ return containsPlayer; } - - public void updatePlayerLastActivity(String playerName) - { - synchronized (_participatedPlayersLastActivities) - { - _participatedPlayersLastActivities.put(playerName, System.currentTimeMillis()); - } - } public String getName() { @@ -121,13 +90,13 @@ return _points; } - public Map getParticipatedPlayerInstances() + public Map getParticipatedPlayers() { Map participatedPlayers = null; - synchronized (_participatedPlayersInstances) + synchronized (_participatedPlayers) { - participatedPlayers = _participatedPlayersInstances; + participatedPlayers = _participatedPlayers; } return participatedPlayers; @@ -133,18 +102,6 @@ return participatedPlayers; } - public Map getParticipatedPlayersLastActivities() - { - Map participatedPlayersLastActivities = null; - - synchronized (_participatedPlayersInstances) - { - participatedPlayersLastActivities = _participatedPlayersLastActivities; - } - - return participatedPlayersLastActivities; - } - public Vector getParticipatedPlayerNames() { Vector participatedPlayerNames = null; @@ -149,7 +106,7 @@ { Vector participatedPlayerNames = null; - synchronized (_participatedPlayersInstances) + synchronized (_participatedPlayers) { participatedPlayerNames = _participatedPlayerNames; } @@ -161,9 +118,9 @@ { int participatedPlayerCount; - synchronized (_participatedPlayersInstances) + synchronized (_participatedPlayers) { - participatedPlayerCount = _participatedPlayersInstances.size(); + participatedPlayerCount = _participatedPlayers.size(); } return participatedPlayerCount; @@ -168,40 +125,4 @@ return participatedPlayerCount; } - - public L2PcInstance getPlayerInstance(String playerName) - { - L2PcInstance playerInstance = null; - - synchronized (_participatedPlayersInstances) - { - playerInstance = _participatedPlayersInstances.get(playerName); - } - - return playerInstance; - } - - public long getPlayerLastActivity(String playerName) - { - long lastActivity = 0; - - synchronized (_participatedPlayersInstances) - { - lastActivity = _participatedPlayersLastActivities.get(playerName); - } - - return lastActivity; - } - - public L2PcInstance getRandomPlayerInstance() - { - String playerName = null; - - synchronized (_participatedPlayersInstances) - { - playerName = _participatedPlayerNames.get(Rnd.get(_participatedPlayerNames.size())); - } - - return getPlayerInstance(playerName); - } } Index: C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTEventTeleporter.java =================================================================== --- C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTEventTeleporter.java (revision 1059) +++ C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTEventTeleporter.java (working copy) @@ -1,20 +1,3 @@ -/* This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * http://www.gnu.org/copyleft/gpl.html - */ package net.sf.l2j.gameserver.model.entity; import net.sf.l2j.Config; @@ -19,24 +2,20 @@ import net.sf.l2j.Config; import net.sf.l2j.gameserver.ThreadPoolManager; -import net.sf.l2j.gameserver.datatables.SkillTable; import net.sf.l2j.gameserver.model.L2Effect; import net.sf.l2j.gameserver.model.L2Summon; -//import net.sf.l2j.gameserver.model.entity.TvTEvent; +import net.sf.l2j.gameserver.model.entity.TvTEvent; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; -import net.sf.l2j.gameserver.serverpackets.Ride; public class TvTEventTeleporter implements Runnable { - private L2PcInstance _playerInstance = null; + private L2PcInstance _playerInstance; private int[] _coordinates = new int[3]; - boolean _removeCauseInactivity = false; - public TvTEventTeleporter(L2PcInstance playerInstance, int[] coordinates, boolean noDelay, boolean removeCauseInactivity) + public TvTEventTeleporter(L2PcInstance playerInstance, int[] coordinates, boolean reAdd) { _playerInstance = playerInstance; _coordinates = coordinates; - _removeCauseInactivity = removeCauseInactivity; // in config as seconds long delay = (TvTEvent.isStarted() ? Config.TVT_EVENT_RESPAWN_TELEPORT_DELAY : Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000; @@ -41,7 +20,7 @@ // in config as seconds long delay = (TvTEvent.isStarted() ? Config.TVT_EVENT_RESPAWN_TELEPORT_DELAY : Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000; - if (noDelay) + if (reAdd) delay = 0; ThreadPoolManager.getInstance().scheduleGeneral(this, delay); @@ -51,17 +30,6 @@ { if (_playerInstance == null) return; - - if (_playerInstance.isMounted()) - { - if (_playerInstance.isFlying()) - _playerInstance.removeSkill(SkillTable.getInstance().getInfo(4289, 1)); - - Ride dismount = new Ride(_playerInstance.getObjectId(), Ride.ACTION_DISMOUNT, 0); - _playerInstance.broadcastPacket(dismount); - _playerInstance.setMountType(0); - _playerInstance.setMountObjectID(0); - } L2Summon summon = _playerInstance.getPet(); @@ -73,11 +41,6 @@ if (effect != null) effect.exit(); } - - if (TvTEvent.isStarted() && !_removeCauseInactivity) - _playerInstance.setTeam(TvTEvent.getParticipantTeamId(_playerInstance.getName())+1); - else - _playerInstance.setTeam(0); _playerInstance.doRevive(); _playerInstance.setCurrentCp(_playerInstance.getMaxCp()); @@ -84,11 +47,13 @@ _playerInstance.setCurrentHp(_playerInstance.getMaxHp()); _playerInstance.setCurrentMp(_playerInstance.getMaxMp()); _playerInstance.teleToLocation(_coordinates[0], _coordinates[1], _coordinates[2], false); + + if (TvTEvent.isStarted()) + _playerInstance.setTeam(TvTEvent.getParticipantTeamId(_playerInstance.getName())+1); + else + _playerInstance.setTeam(0); + _playerInstance.broadcastStatusUpdate(); _playerInstance.broadcastUserInfo(); - - String playerName = _playerInstance.getName(); - - TvTEvent.getTeams()[TvTEvent.getParticipantTeamId(playerName)].updatePlayerLastActivity(playerName); } } Index: C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTManager.java =================================================================== --- C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTManager.java (revision 1059) +++ C:/Documents and Settings/Administrator/My Documents/eclipse/workspace/L2_GameServer_It_tvt_rewert/java/net/sf/l2j/gameserver/model/entity/TvTManager.java (working copy) @@ -1,20 +1,3 @@ -/* This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - * 02111-1307, USA. - * - * http://www.gnu.org/copyleft/gpl.html - */ package net.sf.l2j.gameserver.model.entity; import net.sf.l2j.Config; @@ -51,7 +34,7 @@ for (;;) { - waiter(Config.TVT_EVENT_INTERVAL * 60000L); // in config given as minutes 60*1000 = 60000 + waiter(Config.TVT_EVENT_INTERVAL * 60 * 1000); // in config given as minutes if (!TvTEvent.startParticipation()) { @@ -62,7 +45,7 @@ else Announcements.getInstance().announceToAll("TvT Event: Registration opened for " + Config.TVT_EVENT_PARTICIPATION_TIME + " minute(s)."); - waiter(Config.TVT_EVENT_PARTICIPATION_TIME * 60000L); // in config given as minutes + waiter(Config.TVT_EVENT_PARTICIPATION_TIME * 60 * 1000); // in config given as minutes if (!TvTEvent.startFight()) { @@ -73,7 +56,7 @@ else Announcements.getInstance().announceToAll("TvT Event: Teleport participants to team spot in " + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s)."); - waiter(Config.TVT_EVENT_RUNNING_TIME * 60000L); // in config given as minutes + waiter(Config.TVT_EVENT_RUNNING_TIME * 60 * 1000); // in config given as minutes Announcements.getInstance().announceToAll("TvT Event: Event finish. Team \"" + TvTEvent.calculateRewards() + "\" wins."); Announcements.getInstance().announceToAll("TvT Event: Teleport back to registration npc in " + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY + " second(s)."); TvTEvent.stopFight();