Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/Config.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/Config.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/Config.java (working copy) @@ -511,6 +511,8 @@ public static boolean GM_NAME_COLOUR_ENABLED; public static int GM_NAME_COLOUR; + public static boolean GM_STARTUP_INVISIBLE; + public static boolean GM_STARTUP_SILENCE; /** Alternative AI setting*/ public static boolean AI_ENABLED; @@ -822,7 +824,8 @@ GM_NAME_COLOUR_ENABLED = Boolean.parseBoolean(otherSettings.getProperty("GMNameColourEnabled", "False")); GM_NAME_COLOUR = Integer.decode("0x" + otherSettings.getProperty("GMNameColour", "00FF00")); - + GM_STARTUP_INVISIBLE = Boolean.parseBoolean(otherSettings.getProperty("GMStartupInvisible", "True")); + GM_STARTUP_SILENCE = Boolean.parseBoolean(otherSettings.getProperty("GMStartupSilence", "True")); } catch (Exception e) { Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/loginserver/ClientThread.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/loginserver/ClientThread.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/loginserver/ClientThread.java (working copy) @@ -267,7 +267,8 @@ case 07: // new GG Auth packet (GG = GameGuard) { - _log.warning("Client requested GG Auth"); + if (Config.DEBUG) + _log.info("Client requested GG Auth"); GGAuth sp = new GGAuth(GGAuth.SKIP_GG_AUTH_REQUEST); sendPacket(sp); break; Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/SelectorThread.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/SelectorThread.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/SelectorThread.java (working copy) @@ -256,35 +256,37 @@ continue; // iterate over selected keys Iterator it = _selector.selectedKeys().iterator(); - while (it.hasNext()) { +while (it.hasNext()) +{ SelectionKey sk = it.next(); it.remove(); if (!sk.isValid()) continue; // Obtain the interest of the key - int readyOps = sk.readyOps(); - switch (readyOps) { - case SelectionKey.OP_WRITE: - writeData(sk); - break; - case SelectionKey.OP_READ: - readData(sk); - break; - case SelectionKey.OP_WRITE | SelectionKey.OP_READ: - writeData(sk); - readData(sk); - break; - case SelectionKey.OP_ACCEPT: - acceptConnection(sk); - break; - default: - System.err.println("Impossible readyOps="+readyOps); - _log.severe("Impossible readyOps="+readyOps); - sk.cancel(); - break; - } - } - } + int readyOps = sk.readyOps(); //the key CAN be invalid at this point (rare but happens: the key becomes invalid just after the isValid() check) + switch (readyOps) + { + case SelectionKey.OP_WRITE: + writeData(sk); + break; + case SelectionKey.OP_READ: + readData(sk); + break; + case SelectionKey.OP_WRITE | SelectionKey.OP_READ: + writeData(sk); + readData(sk); + break; +case SelectionKey.OP_ACCEPT: +acceptConnection(sk); +break; + default: + System.err.println("Impossible readyOps="+readyOps); + _log.severe("Impossible readyOps="+readyOps); + sk.cancel(); + break; + } +} +} } catch (Throwable t) { _log.log(Level.SEVERE, "", t); System.exit(1); @@ -336,7 +338,7 @@ sk.interestOps(sk.interestOps() & ~SelectionKey.OP_WRITE); } catch (IOException e) { try - { + { _log.info("Error on network write, player "+con.getClient().getActiveChar().getName()+" disconnected?"); } catch(NullPointerException npe) @@ -344,7 +346,7 @@ _log.info("Error on network write, player disconnected? (nullpointer, couldn't get player name)"); } - if (con != null) closeClient(con); + if (con != null) closeClient(con); } catch (Throwable t) { _log.log(Level.INFO, "", t); @@ -440,7 +442,7 @@ try { _log.info("Error on network read, player "+con.getClient().getActiveChar().getName()+" disconnected?"); - con.getClient().getActiveChar().getInventory().updateDatabase(); + con.getClient().getActiveChar().getInventory().updateDatabase(); } catch(NullPointerException npe) { @@ -542,8 +544,8 @@ { updateCounter(msg); } - if (msg.getLifeTime() > 0) - msg.setTime(System.currentTimeMillis()); + if (msg.getLifeTime() > 0) + msg.setTime(System.currentTimeMillis()); sendMsgQueue.put(msg); msgCounter++; if (msgCounter > 20 || msg instanceof LeaveWorld) { @@ -580,14 +582,14 @@ while (iter.hasNext()) { ServerBasePacket msg = (ServerBasePacket)iter.next(); - if (msg.getLifeTime() > 0) - if (System.currentTimeMillis()-msg.getTime()>msg.getLifeTime()) - { - iter.remove(); - continue; - } - - + if (msg.getLifeTime() > 0) + if (System.currentTimeMillis()-msg.getTime()>msg.getLifeTime()) + { + iter.remove(); + continue; + } + + Connection con = msg.getConnection(); SelectionKey sk = con.getChannel().keyFor(_selector); if (sk == null || !sk.isValid()) Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (working copy) @@ -32,6 +32,7 @@ import net.sf.l2j.gameserver.ClientThread; import net.sf.l2j.gameserver.LoginServerThread; import net.sf.l2j.gameserver.SevenSigns; +import net.sf.l2j.gameserver.handler.AdminCommandHandler; import net.sf.l2j.gameserver.model.L2Clan; import net.sf.l2j.gameserver.model.L2Effect; import net.sf.l2j.gameserver.model.L2World; @@ -92,9 +93,20 @@ //activeChar.closeNetConnection(); } - if(activeChar.isGM() && activeChar.getAccessLevel()>9) + if(activeChar.isGM()) { - activeChar.setInvisible(); + if(Config.GM_STARTUP_INVISIBLE + && (!Config.ALT_PRIVILEGES_ADMIN && activeChar.getAccessLevel() >= Config.GM_GODMODE + || Config.ALT_PRIVILEGES_ADMIN && AdminCommandHandler.getInstance().checkPrivileges(activeChar, "admin_invisible"))) + activeChar.setInvisible(); + + if(Config.GM_STARTUP_SILENCE + && (!Config.ALT_PRIVILEGES_ADMIN && activeChar.getAccessLevel() >= Config.GM_MENU + || Config.ALT_PRIVILEGES_ADMIN && AdminCommandHandler.getInstance().checkPrivileges(activeChar, "admin_silence"))) + activeChar.setMessageRefusal(true); + + if(Config.GM_NAME_COLOUR_ENABLED) + activeChar.setNameColor(Config.GM_NAME_COLOUR); } if (Config.PLAYER_SPAWN_PROTECTION > 0) @@ -208,17 +220,6 @@ notifyClanMembers(activeChar); activeChar.onPlayerEnter(); - - if(activeChar.isGM() && activeChar.getAccessLevel()>9) - { - activeChar.sendPacket(new CreatureSay(0,5,"SYS","Hide is default for builder")); - activeChar.setMessageRefusal(true); - activeChar.sendPacket(new CreatureSay(0,5,"SYS","Message refusal mode")); - if(Config.GM_NAME_COLOUR_ENABLED) - { - activeChar.setNameColor(Config.GM_NAME_COLOUR); - } - } } /** Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2GroupSpawn.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2GroupSpawn.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2GroupSpawn.java (working copy) @@ -20,7 +20,7 @@ public L2GroupSpawn(L2NpcTemplate mobTemplate) throws SecurityException, ClassNotFoundException { super(mobTemplate); - _constructor = Class.forName("net.sf.l2j.gameserver.model.L2ControllableMobInstance").getConstructors()[0]; +_constructor = Class.forName("net.sf.l2j.gameserver.model.actor.instance.L2ControllableMobInstance").getConstructors()[0]; _template = mobTemplate; setAmount(1); } Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeGuardInstance.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeGuardInstance.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2SiegeGuardInstance.java (working copy) @@ -77,13 +77,13 @@ */ public boolean isAutoAttackable(L2Character attacker) { - // Attackable during siege by attacker only + // Attackable during siege by all except defenders return (attacker != null && attacker instanceof L2PcInstance && getCastle() != null && getCastle().getCastleId() > 0 && getCastle().getSiege().getIsInProgress() - && getCastle().getSiege().checkIsAttacker(((L2PcInstance)attacker).getClan())); + && (!getCastle().getSiege().checkIsDefender(((L2PcInstance)attacker).getClan())) || getCastle().getSiege().checkIsAttacker(((L2PcInstance)attacker).getClan())); } /** Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2ClassMasterInstance.java (working copy) @@ -38,6 +38,8 @@ public final class L2ClassMasterInstance extends L2FolkInstance { private static Logger _log = Logger.getLogger(L2ClassMasterInstance.class.getName()); +private static int[] _secondClassIds = {2,3,5,6,9,8,12,13,14,16,17,20,21,23,24,27, + 28,30,33,34,36,37,40,41,43,46,48,51,52,55,57}; /** * @param template @@ -120,6 +122,19 @@ { showChatWindow(player, classId.getId()); } +else if (level >= 76 && Config.ALLOW_CLASS_MASTERS && classId.getId() < 88) +{ +for (int i = 0; i < _secondClassIds.length; i++) +{ +if (classId.getId() == _secondClassIds[i]) +{ +changeClass(player, 88+i); +player.setBaseClass(player.getActiveClass()); +player.sendMessage("Congratulations you have changed class"); +break; +} +} +} else { NpcHtmlMessage html = new NpcHtmlMessage(1); Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -2584,6 +2584,8 @@ L2PcInstance pk = (L2PcInstance) killer; pk.kills.add(getName()); } +onDieDropItem(killer); // Check if any item should be dropped + if (!ArenaManager.getInstance().checkIfInZone(this)) { if (Config.ALT_GAME_DELEVEL) @@ -2596,8 +2598,6 @@ else onDieUpdateKarma(); // Update karma if delevel is not allowed } - - onDieDropItem(killer); // Check if any item should be dropped } setPvpFlag(0); // Clear the pvp flag @@ -6293,6 +6293,9 @@ public void onPlayerEnter() { startWarnUserTakeBreak(); + + if(getInvisible() == 1) sendMessage("Entering world in Invisible mode"); + if(getMessageRefusal()) sendMessage("Entering world in Message refusal mode"); } public boolean isProcessingTransaction() Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2Skill.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2Skill.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2Skill.java (working copy) @@ -92,6 +92,7 @@ TARGET_AURA, TARGET_CORPSE, TARGET_UNDEAD, + TARGET_AREA_UNDEAD, TARGET_MULTIFACE, TARGET_CORPSE_ALLY, TARGET_CORPSE_CLAN, @@ -1301,6 +1302,41 @@ targetList.add(target); return targetList.toArray(new L2Object[targetList.size()]); } + + case TARGET_AREA_CORPSE_MOB: // around dead monster + { + if (target == null || ((!(target instanceof L2Attackable)) && !target.isDead())) + { + activeChar.sendPacket(new SystemMessage(SystemMessage.TARGET_IS_INCORRECT)); + return null; + } + // Add the selected target to target list + targetList.add((L2Character)target); + + int radius = getSkillRadius(); + + for (L2Character obj : target.getKnownList().getKnownCharactersInRadius(radius)) + { + if (!Util.checkIfInRange(radius, target, obj, true)) // Go to next obj if obj isn't in range + continue; + + // prevent attacker to selfhit + if (obj == activeChar) + continue; + + if (!(obj instanceof L2Attackable)) + continue; + + // add all valid targets to the list + targetList.add((L2Character)obj); + + if (targetList.size() == 0) + return null; + } + targetList.add(target); + return targetList.toArray(new L2Character[targetList.size()]); + } + case TARGET_UNLOCKABLE: { if(!(target instanceof L2DoorInstance)) @@ -1333,6 +1369,38 @@ return targetList.toArray(new L2Object[targetList.size()]); } } + case TARGET_AREA_UNDEAD: + { + L2Character cha; + if (this.getCastRange() >= 0) + { + cha = target; + targetList.add((L2Character)cha); // Add target to target list + } + else + cha = activeChar; + + int radius = getSkillRadius(); + for (L2Object obj : cha.getKnownList().getKnownObjects()) + { + if (!(obj instanceof L2Character)) continue; + + target = (L2Character) obj; + if(!target.isAlikeDead()) // If target is not dead/fake death and not self + { + if (!((L2NpcInstance)obj).isUndead()) + continue; + if (!Util.checkIfInRange(radius, cha, obj, true)) // Go to next obj if obj isn't in range + continue; + + targetList.add((L2Character)obj); // Add obj to target lists + } + } + + if (targetList.size() == 0) + return null; + return targetList.toArray(new L2Character[targetList.size()]); + } default: { SystemMessage sm = new SystemMessage(614); Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2Character.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2Character.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/L2Character.java (working copy) @@ -3639,7 +3639,17 @@ // Check Raidboss attack if (target.isRaid() && getLevel() > target.getLevel() + 8) - SkillTable.getInstance().getInfo(4515, 99).getEffects(target, this); + { + L2Skill skill = SkillTable.getInstance().getInfo(4515, 99); + if(skill != null) + { + skill.getEffects(target, this); + } + else + { + _log.warning("Skill 4515 at level 99 is missing in DP."); + } + } } } @@ -4196,9 +4206,9 @@ if (player instanceof L2PcInstance) { // Casting non offensive skill on player with pvp flag set or with karma - if ( - ((L2PcInstance)player).getPvpFlag() > 0 || - ((L2PcInstance)player).getKarma() > 0) activeChar.updatePvPStatus(); +if (!player.equals(this) && +(((L2PcInstance)player).getPvpFlag() > 0 || +((L2PcInstance)player).getKarma() > 0)) activeChar.updatePvPStatus(); } else if (player instanceof L2Attackable) activeChar.updatePvPStatus(); Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/entity/Siege.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/entity/Siege.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/model/entity/Siege.java (working copy) @@ -227,7 +227,6 @@ private List _ControlTowers = new FastList();; private int[][] _ControlTowerSpawnList; private boolean _IsInProgress = false; - private boolean _IsNormalSide = true; // true = Atk is Atk, false = Atk is Def protected boolean _IsRegistrationOver = false; private Calendar _SiegeDate; protected Calendar _SiegeEndDate; @@ -292,15 +291,20 @@ } else if (getDefenderClans().size() > 0) // If defender does exist (Pc vs Pc) { - if (_IsNormalSide) - _IsNormalSide = false; // Atk is now def - else - _IsNormalSide = true; // Atk is now atk + int ownerId = getCastle().getOwnerId(); + + getAttackerClans().addAll(_Defender_Clans); + getDefenderClans().clear(); + getAttackerClans().remove(ownerId); + addDefender(ownerId); - teleportPlayer(Siege.TeleportWhoType.Attacker, MapRegionTable.TeleportWhereType.Town); // Teleport to the second closest town - teleportPlayer(Siege.TeleportWhoType.Spectator, MapRegionTable.TeleportWhereType.Town); // Teleport to the second closest town - - removeFlags(); // Removes all flags + //should be teleported to flag ? + //teleportPlayer(Siege.TeleportWhoType.Attacker, MapRegionTable.TeleportWhereType.SiegeFlag); // Teleport to the flag + //teleportPlayer(Siege.TeleportWhoType.Attacker, MapRegionTable.TeleportWhereType.Town); // Teleport to the second closest town + + //teleportPlayer(Siege.TeleportWhoType.Spectator, MapRegionTable.TeleportWhereType.Town); // Teleport to the second closest town + //teleportPlayer(Siege.TeleportWhoType.Defender, MapRegionTable.TeleportWhereType.Castle); // Teleport to the Castle + getCastle().removeUpgrade(); // Remove all castle upgrade getCastle().spawnDoor(true); // Respawn door to castle but make them weaker (50% hp) } @@ -323,7 +327,6 @@ return; } - _IsNormalSide = true; // Atk is now atk _IsInProgress = true; // Flag so that same siege instance cannot be started again loadCastleSiege(); // Load castle specific data loadSiegeClan(); // Load siege clan from db @@ -1103,8 +1106,7 @@ public final List getAttackerClans() { - if (_IsNormalSide) return _Attacker_Clans; - return _Defender_Clans; + return _Attacker_Clans; } public final int getAttackerRespawnDelay() { return (SiegeManager.getInstance().getAttackerRespawnDelay()); } @@ -1130,8 +1132,7 @@ public final List getDefenderClans() { - if (_IsNormalSide) return _Defender_Clans; - return _Attacker_Clans; + return _Defender_Clans; } public final L2SiegeClan getDefenderWaitingClan(L2Clan clan) Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/lib/Rnd.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/lib/Rnd.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/lib/Rnd.java (working copy) @@ -55,4 +55,8 @@ { return _rnd.nextGaussian(); } +public static final boolean nextBoolean() +{ +return _rnd.nextBoolean(); } +} Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/skillhandlers/Disablers.java (working copy) @@ -141,6 +141,7 @@ } case CONFUSION: case MUTE: + case FEAR: { if (Formulas.getInstance().calcSkillSuccess(activeChar, target, skill, false, ss, bss)) { Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/skillhandlers/Resurrect.java (working copy) @@ -63,13 +63,6 @@ { if (player.getClanId() != targetPlayer.getClanId()) continue; } - - // Check to see if the current player target is in a festival. - if (targetPlayer.isFestivalParticipant()) - { - player.sendPacket(SystemMessage.sendString("You may not resurrect participants in a festival.")); - continue; - } } targetToRes.add(target); } Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInvul.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInvul.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminInvul.java (working copy) @@ -42,7 +42,7 @@ if (!Config.ALT_PRIVILEGES_ADMIN) if (!(checkLevel(activeChar.getAccessLevel()) && activeChar.isGM())) return false; - GMAudit.auditGMAction(activeChar.getName(), command, (activeChar.getTarget().getName() != null?activeChar.getTarget().getName():"no-target"), ""); + GMAudit.auditGMAction(activeChar.getName(), command, (activeChar.getTarget() != null ? activeChar.getTarget().getName() : "no-target"), ""); if (command.equals("admin_invul")) handleInvul(activeChar); if (command.equals("admin_setinvul")){ Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/serverpackets/CharInfo.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/serverpackets/CharInfo.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/serverpackets/CharInfo.java (working copy) @@ -145,7 +145,11 @@ writeD(_z); writeD(_heading); writeD(_cha.getObjectId()); - writeS(_cha.getName()); +L2PcInstance _cha2 = getClient().getActiveChar(); +if (_cha2 != null && _cha.getClan() != null && _cha2.getClan() != null && _cha.getClan().isAtWarWith(_cha2.getClanId())) + writeS("*"+_cha.getName()); +else + writeS(_cha.getName()); writeD(_cha.getRace().ordinal()); writeD(_cha.getSex()); Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/ai/L2AttackableAI.java (working copy) @@ -134,7 +134,7 @@ L2Attackable me = (L2Attackable)_actor; // Check if the target isn't a Folk or a Door - if (target instanceof L2FolkInstance || target instanceof L2DoorInstance) +if (target == null || target instanceof L2FolkInstance || target instanceof L2DoorInstance) return false; // Check if the target isn't dead, is in the Aggro range and is at the same height @@ -161,7 +161,7 @@ // Check if the L2MonsterInstance target is aggressive if (target instanceof L2MonsterInstance) - return ((L2MonsterInstance)target).isAggressive(); +return (((L2MonsterInstance)target).isAggressive() && Config.ALLOW_GUARDS); return false; } @@ -207,7 +207,7 @@ if (intention == AI_INTENTION_IDLE || intention == AI_INTENTION_ACTIVE) { // Check if actor is not dead - if (!_actor.isAlikeDead()) +if (_actor != null || !_actor.isAlikeDead()) { L2Attackable npc = (L2Attackable)_actor; Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/ai/L2SiegeGuardAI.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/ai/L2SiegeGuardAI.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/ai/L2SiegeGuardAI.java (working copy) @@ -21,6 +21,7 @@ import static net.sf.l2j.gameserver.ai.CtrlIntention.AI_INTENTION_ACTIVE; import static net.sf.l2j.gameserver.ai.CtrlIntention.AI_INTENTION_ATTACK; import static net.sf.l2j.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE; +import static net.sf.l2j.gameserver.ai.CtrlIntention.AI_INTENTION_FOLLOW; import java.util.concurrent.Future; import java.util.logging.Logger; @@ -40,6 +41,7 @@ import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.model.actor.instance.L2SiegeGuardInstance; +import net.sf.l2j.gameserver.model.actor.instance.L2SummonInstance; /** @@ -133,6 +135,10 @@ // Check if the target isn't dead if (target.isAlikeDead()) return false; + // Get the owner if the target is a summon + if (target instanceof L2SummonInstance) + target = ((L2SummonInstance)target).getOwner(); + return ( target instanceof L2PcInstance && !((L2PcInstance)target).isInvul() && // Not invul and @@ -163,6 +169,12 @@ { L2Attackable npc = (L2Attackable)_actor; + // remove from knownlist all dead or alikedead players + for(L2PcInstance in:npc.getKnownList().getKnownPlayers()) + { + if(in.isAlikeDead()) npc.getKnownList().removeKnownObject(in); + } + // If its _knownPlayer isn't empty set the Intention to AI_INTENTION_ACTIVE if(npc.getKnownList().getKnownPlayers().size() > 0) intention = AI_INTENTION_ACTIVE; @@ -564,7 +576,16 @@ // Check if the actor can't use skills and if a thinking action isn't already in progress if (thinking || _actor.isAllSkillsDisabled()) return; - + + if((!_actor.isVisible()) || (!_actor.hasAI())) + setIntention(AI_INTENTION_IDLE); + + if((getIntention() == AI_INTENTION_FOLLOW) && (_actor.getKnownList().getKnownPlayers().isEmpty())) + setIntention(AI_INTENTION_IDLE); + + if(getIntention() == AI_INTENTION_IDLE) + return; + // Start thinking action thinking = true; @@ -597,7 +618,14 @@ */ protected void onEvtAttacked(L2Character attacker) { - // Calculate the attack timeout + if(attacker == null) + { + _log.warning("L2SiegeGuardAI.java: onEvtAttacked(L2Character attacker) -> attacker=null, RETURNING with setting attacktimeout"); + _attack_timeout = GameTimeController.getGameTicks(); + return; + } + + // Calculate the attack timeout _attack_timeout = MAX_ATTACK_TIMEOUT + GameTimeController.getGameTicks(); // Set the _globalAggro to 0 to permit attack even just after spawn Index: D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/taskmanager/tasks/TaskCleanUp.java =================================================================== --- D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/taskmanager/tasks/TaskCleanUp.java (revision 218) +++ D:/workspace/GameServer_tmp/java/net/sf/l2j/gameserver/taskmanager/tasks/TaskCleanUp.java (working copy) @@ -23,8 +23,8 @@ public void onTimeElapsed(ExecutedTask task) { - System.runFinalization(); - System.gc(); + //System.runFinalization(); + //System.gc(); } public void initializate()