From 826ad542f1d8d8a1b0695f675e4853247f555b09 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 19 Sep 2017 05:33:25 +0000 Subject: [PATCH] Attempt to fix YeSagiraGuards onEvtThink issue. --- .../areas/TalkingIsland/YeSagiraGuards.java | 2 +- .../gameserver/ai/L2AttackableAI.java | 19 +++++++++++-------- .../areas/TalkingIsland/YeSagiraGuards.java | 2 +- .../gameserver/ai/L2AttackableAI.java | 19 +++++++++++-------- .../areas/TalkingIsland/YeSagiraGuards.java | 2 +- .../gameserver/ai/L2AttackableAI.java | 19 +++++++++++-------- .../gameserver/ai/L2AttackableAI.java | 19 +++++++++++-------- 7 files changed, 47 insertions(+), 35 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java index e9a52aa766..14ae45faa1 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java @@ -48,7 +48,7 @@ public final class YeSagiraGuards extends AbstractNpcAI { L2World.getInstance().forEachVisibleObjectInRange(npc, L2MonsterInstance.class, 1000, monster -> { - if (monster.isScriptValue(0)) // not retail - but looks better + if ((monster != null) && monster.isScriptValue(0)) // not retail - but looks better { monster.setScriptValue(1); npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 78995bb2b1..d438067546 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable @Override protected void onEvtThink() { - // Check if the actor can't use skills and if a thinking action isn't already in progress - if (_thinking || getActiveChar().isAllSkillsDisabled()) + // Check if the actor can't use skills + if (getActiveChar().isAllSkillsDisabled()) + { + return; + } + // Check if a thinking action isn't already in progress + if (_thinking) { return; } @@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable } catch (Exception e) { - LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); - } - finally - { - // Stop thinking action - _thinking = false; + LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e); } + + // Finish thinking action + _thinking = false; } /** diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java index e9a52aa766..14ae45faa1 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java @@ -48,7 +48,7 @@ public final class YeSagiraGuards extends AbstractNpcAI { L2World.getInstance().forEachVisibleObjectInRange(npc, L2MonsterInstance.class, 1000, monster -> { - if (monster.isScriptValue(0)) // not retail - but looks better + if ((monster != null) && monster.isScriptValue(0)) // not retail - but looks better { monster.setScriptValue(1); npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 78995bb2b1..d438067546 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable @Override protected void onEvtThink() { - // Check if the actor can't use skills and if a thinking action isn't already in progress - if (_thinking || getActiveChar().isAllSkillsDisabled()) + // Check if the actor can't use skills + if (getActiveChar().isAllSkillsDisabled()) + { + return; + } + // Check if a thinking action isn't already in progress + if (_thinking) { return; } @@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable } catch (Exception e) { - LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); - } - finally - { - // Stop thinking action - _thinking = false; + LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e); } + + // Finish thinking action + _thinking = false; } /** diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java index e9a52aa766..14ae45faa1 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/areas/TalkingIsland/YeSagiraGuards.java @@ -48,7 +48,7 @@ public final class YeSagiraGuards extends AbstractNpcAI { L2World.getInstance().forEachVisibleObjectInRange(npc, L2MonsterInstance.class, 1000, monster -> { - if (monster.isScriptValue(0)) // not retail - but looks better + if ((monster != null) && monster.isScriptValue(0)) // not retail - but looks better { monster.setScriptValue(1); npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 78995bb2b1..d438067546 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable @Override protected void onEvtThink() { - // Check if the actor can't use skills and if a thinking action isn't already in progress - if (_thinking || getActiveChar().isAllSkillsDisabled()) + // Check if the actor can't use skills + if (getActiveChar().isAllSkillsDisabled()) + { + return; + } + // Check if a thinking action isn't already in progress + if (_thinking) { return; } @@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable } catch (Exception e) { - LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); - } - finally - { - // Stop thinking action - _thinking = false; + LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e); } + + // Finish thinking action + _thinking = false; } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java index 78995bb2b1..d438067546 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/ai/L2AttackableAI.java @@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable @Override protected void onEvtThink() { - // Check if the actor can't use skills and if a thinking action isn't already in progress - if (_thinking || getActiveChar().isAllSkillsDisabled()) + // Check if the actor can't use skills + if (getActiveChar().isAllSkillsDisabled()) + { + return; + } + // Check if a thinking action isn't already in progress + if (_thinking) { return; } @@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable } catch (Exception e) { - LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); - } - finally - { - // Stop thinking action - _thinking = false; + LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e); } + + // Finish thinking action + _thinking = false; } /**