Attempt to fix YeSagiraGuards onEvtThink issue.

This commit is contained in:
MobiusDev
2017-09-19 05:33:25 +00:00
parent 850a989b49
commit 826ad542f1
7 changed files with 47 additions and 35 deletions

View File

@@ -48,7 +48,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
{ {
L2World.getInstance().forEachVisibleObjectInRange(npc, L2MonsterInstance.class, 1000, monster -> 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); monster.setScriptValue(1);
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack

View File

@@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
@Override @Override
protected void onEvtThink() protected void onEvtThink()
{ {
// Check if the actor can't use skills and if a thinking action isn't already in progress // Check if the actor can't use skills
if (_thinking || getActiveChar().isAllSkillsDisabled()) if (getActiveChar().isAllSkillsDisabled())
{
return;
}
// Check if a thinking action isn't already in progress
if (_thinking)
{ {
return; return;
} }
@@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e);
}
finally
{
// Stop thinking action
_thinking = false;
} }
// Finish thinking action
_thinking = false;
} }
/** /**

View File

@@ -48,7 +48,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
{ {
L2World.getInstance().forEachVisibleObjectInRange(npc, L2MonsterInstance.class, 1000, monster -> 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); monster.setScriptValue(1);
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack

View File

@@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
@Override @Override
protected void onEvtThink() protected void onEvtThink()
{ {
// Check if the actor can't use skills and if a thinking action isn't already in progress // Check if the actor can't use skills
if (_thinking || getActiveChar().isAllSkillsDisabled()) if (getActiveChar().isAllSkillsDisabled())
{
return;
}
// Check if a thinking action isn't already in progress
if (_thinking)
{ {
return; return;
} }
@@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e);
}
finally
{
// Stop thinking action
_thinking = false;
} }
// Finish thinking action
_thinking = false;
} }
/** /**

View File

@@ -48,7 +48,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
{ {
L2World.getInstance().forEachVisibleObjectInRange(npc, L2MonsterInstance.class, 1000, monster -> 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); monster.setScriptValue(1);
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack

View File

@@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
@Override @Override
protected void onEvtThink() protected void onEvtThink()
{ {
// Check if the actor can't use skills and if a thinking action isn't already in progress // Check if the actor can't use skills
if (_thinking || getActiveChar().isAllSkillsDisabled()) if (getActiveChar().isAllSkillsDisabled())
{
return;
}
// Check if a thinking action isn't already in progress
if (_thinking)
{ {
return; return;
} }
@@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e);
}
finally
{
// Stop thinking action
_thinking = false;
} }
// Finish thinking action
_thinking = false;
} }
/** /**

View File

@@ -1079,8 +1079,13 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
@Override @Override
protected void onEvtThink() protected void onEvtThink()
{ {
// Check if the actor can't use skills and if a thinking action isn't already in progress // Check if the actor can't use skills
if (_thinking || getActiveChar().isAllSkillsDisabled()) if (getActiveChar().isAllSkillsDisabled())
{
return;
}
// Check if a thinking action isn't already in progress
if (_thinking)
{ {
return; return;
} }
@@ -1112,13 +1117,11 @@ public class L2AttackableAI extends L2CharacterAI implements Runnable
} }
catch (Exception e) catch (Exception e)
{ {
LOGGER.log(Level.WARNING, this + " - onEvtThink() failed", e); LOGGER.log(Level.WARNING, this + " - " + getIntention().toString() + " - onEvtThink() failed", e);
}
finally
{
// Stop thinking action
_thinking = false;
} }
// Finish thinking action
_thinking = false;
} }
/** /**