Minor timer improvements.

This commit is contained in:
MobiusDev 2018-04-26 11:34:03 +00:00
parent d16cc9290f
commit 014e6ddfdb
15 changed files with 42 additions and 38 deletions

View File

@ -29,7 +29,7 @@ import ai.AbstractNpcAI;
*/
public final class HillsOfGold extends AbstractNpcAI
{
// Npcs
// NPCs
private static final int GOLEM_OF_REPAIRS = 19309;
private static final int EXCAVATOR_GOLEM = 19312;
private static final int DRILL_GOLEM = 19310;
@ -59,7 +59,7 @@ public final class HillsOfGold extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("SPICULA_AGGRO") && (npc != null) && !npc.isDead())
if ((npc != null) && !npc.isDead())
{
L2World.getInstance().forEachVisibleObject(npc, L2MonsterInstance.class, npc.getAggroRange(), nearby ->
{
@ -73,7 +73,7 @@ public final class HillsOfGold extends AbstractNpcAI
return;
}
});
startQuestTimer("SPICULA_AGGRO", 10000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -98,7 +98,7 @@ public final class HillsOfGold extends AbstractNpcAI
{
if ((npc.getId() == SPICULA_1) || (npc.getId() == SPICULA_2))
{
startQuestTimer("SPICULA_AGGRO", 5000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 5000, npc, null);
}
else
{

View File

@ -46,7 +46,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("GUARD_AGGRO") && (npc != null) && !npc.isDead() && !npc.isInCombat())
if ((npc != null) && !npc.isDead() && !npc.isInCombat())
{
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 1000);
if (!nearbyMonsters.isEmpty())
@ -57,6 +57,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
}
}
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -65,7 +66,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
public String onSpawn(L2Npc npc)
{
npc.setIsInvul(true);
startQuestTimer("GUARD_AGGRO", 5000, npc, null, true);
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 5000, npc, null);
return super.onSpawn(npc);
}

View File

@ -122,7 +122,7 @@ public class SiegeGuards extends AbstractNpcAI
}
}
}
startQuestTimer("AGGRO_CHECK" + npc.getId(), 3000, npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), 3000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -149,7 +149,7 @@ public class SiegeGuards extends AbstractNpcAI
final Castle castle = npc.getCastle();
final Fort fortress = npc.getFort();
npc.setScriptValue(fortress != null ? fortress.getResidenceId() : (castle != null ? castle.getResidenceId() : 0));
startQuestTimer("AGGRO_CHECK" + npc.getId(), getRandom(1000, 10000), npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), getRandom(1000, 10000), npc, null);
return super.onSpawn(npc);
}

View File

@ -29,7 +29,7 @@ import ai.AbstractNpcAI;
*/
public final class HillsOfGold extends AbstractNpcAI
{
// Npcs
// NPCs
private static final int GOLEM_OF_REPAIRS = 19309;
private static final int EXCAVATOR_GOLEM = 19312;
private static final int DRILL_GOLEM = 19310;
@ -59,7 +59,7 @@ public final class HillsOfGold extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("SPICULA_AGGRO") && (npc != null) && !npc.isDead())
if ((npc != null) && !npc.isDead())
{
L2World.getInstance().forEachVisibleObject(npc, L2MonsterInstance.class, npc.getAggroRange(), nearby ->
{
@ -73,7 +73,7 @@ public final class HillsOfGold extends AbstractNpcAI
return;
}
});
startQuestTimer("SPICULA_AGGRO", 10000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -98,7 +98,7 @@ public final class HillsOfGold extends AbstractNpcAI
{
if ((npc.getId() == SPICULA_1) || (npc.getId() == SPICULA_2))
{
startQuestTimer("SPICULA_AGGRO", 5000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 5000, npc, null);
}
else
{

View File

@ -46,7 +46,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("GUARD_AGGRO") && (npc != null) && !npc.isDead() && !npc.isInCombat())
if ((npc != null) && !npc.isDead() && !npc.isInCombat())
{
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 1000);
if (!nearbyMonsters.isEmpty())
@ -57,6 +57,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
}
}
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -65,7 +66,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
public String onSpawn(L2Npc npc)
{
npc.setIsInvul(true);
startQuestTimer("GUARD_AGGRO", 5000, npc, null, true);
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 5000, npc, null);
return super.onSpawn(npc);
}

View File

@ -122,7 +122,7 @@ public class SiegeGuards extends AbstractNpcAI
}
}
}
startQuestTimer("AGGRO_CHECK" + npc.getId(), 3000, npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), 3000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -149,7 +149,7 @@ public class SiegeGuards extends AbstractNpcAI
final Castle castle = npc.getCastle();
final Fort fortress = npc.getFort();
npc.setScriptValue(fortress != null ? fortress.getResidenceId() : (castle != null ? castle.getResidenceId() : 0));
startQuestTimer("AGGRO_CHECK" + npc.getId(), getRandom(1000, 10000), npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), getRandom(1000, 10000), npc, null);
return super.onSpawn(npc);
}

View File

@ -29,7 +29,7 @@ import ai.AbstractNpcAI;
*/
public final class HillsOfGold extends AbstractNpcAI
{
// Npcs
// NPCs
private static final int GOLEM_OF_REPAIRS = 19309;
private static final int EXCAVATOR_GOLEM = 19312;
private static final int DRILL_GOLEM = 19310;
@ -59,7 +59,7 @@ public final class HillsOfGold extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("SPICULA_AGGRO") && (npc != null) && !npc.isDead())
if ((npc != null) && !npc.isDead())
{
L2World.getInstance().forEachVisibleObject(npc, L2MonsterInstance.class, npc.getAggroRange(), nearby ->
{
@ -73,7 +73,7 @@ public final class HillsOfGold extends AbstractNpcAI
return;
}
});
startQuestTimer("SPICULA_AGGRO", 10000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -98,7 +98,7 @@ public final class HillsOfGold extends AbstractNpcAI
{
if ((npc.getId() == SPICULA_1) || (npc.getId() == SPICULA_2))
{
startQuestTimer("SPICULA_AGGRO", 5000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 5000, npc, null);
}
else
{

View File

@ -46,7 +46,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("GUARD_AGGRO") && (npc != null) && !npc.isDead() && !npc.isInCombat())
if ((npc != null) && !npc.isDead() && !npc.isInCombat())
{
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 1000);
if (!nearbyMonsters.isEmpty())
@ -57,6 +57,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
}
}
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -65,7 +66,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
public String onSpawn(L2Npc npc)
{
npc.setIsInvul(true);
startQuestTimer("GUARD_AGGRO", 5000, npc, null, true);
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 5000, npc, null);
return super.onSpawn(npc);
}

View File

@ -122,7 +122,7 @@ public class SiegeGuards extends AbstractNpcAI
}
}
}
startQuestTimer("AGGRO_CHECK" + npc.getId(), 3000, npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), 3000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -149,7 +149,7 @@ public class SiegeGuards extends AbstractNpcAI
final Castle castle = npc.getCastle();
final Fort fortress = npc.getFort();
npc.setScriptValue(fortress != null ? fortress.getResidenceId() : (castle != null ? castle.getResidenceId() : 0));
startQuestTimer("AGGRO_CHECK" + npc.getId(), getRandom(1000, 10000), npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), getRandom(1000, 10000), npc, null);
return super.onSpawn(npc);
}

View File

@ -29,7 +29,7 @@ import ai.AbstractNpcAI;
*/
public final class HillsOfGold extends AbstractNpcAI
{
// Npcs
// NPCs
private static final int GOLEM_OF_REPAIRS = 19309;
private static final int EXCAVATOR_GOLEM = 19312;
private static final int DRILL_GOLEM = 19310;
@ -59,7 +59,7 @@ public final class HillsOfGold extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("SPICULA_AGGRO") && (npc != null) && !npc.isDead())
if ((npc != null) && !npc.isDead())
{
L2World.getInstance().forEachVisibleObject(npc, L2MonsterInstance.class, npc.getAggroRange(), nearby ->
{
@ -73,7 +73,7 @@ public final class HillsOfGold extends AbstractNpcAI
return;
}
});
startQuestTimer("SPICULA_AGGRO", 10000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -98,7 +98,7 @@ public final class HillsOfGold extends AbstractNpcAI
{
if ((npc.getId() == SPICULA_1) || (npc.getId() == SPICULA_2))
{
startQuestTimer("SPICULA_AGGRO", 5000, npc, null);
startQuestTimer("SPICULA_AGGRO" + npc.getObjectId(), 5000, npc, null);
}
else
{

View File

@ -46,7 +46,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if (event.equals("GUARD_AGGRO") && (npc != null) && !npc.isDead() && !npc.isInCombat())
if ((npc != null) && !npc.isDead() && !npc.isInCombat())
{
final List<L2MonsterInstance> nearbyMonsters = L2World.getInstance().getVisibleObjects(npc, L2MonsterInstance.class, 1000);
if (!nearbyMonsters.isEmpty())
@ -57,6 +57,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
npc.reduceCurrentHp(1, monster, null); // TODO: Find better way for attack
}
}
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 10000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -65,7 +66,7 @@ public final class YeSagiraGuards extends AbstractNpcAI
public String onSpawn(L2Npc npc)
{
npc.setIsInvul(true);
startQuestTimer("GUARD_AGGRO", 5000, npc, null, true);
startQuestTimer("GUARD_AGGRO" + npc.getObjectId(), 5000, npc, null);
return super.onSpawn(npc);
}

View File

@ -122,7 +122,7 @@ public class SiegeGuards extends AbstractNpcAI
}
}
}
startQuestTimer("AGGRO_CHECK" + npc.getId(), 3000, npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), 3000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -149,7 +149,7 @@ public class SiegeGuards extends AbstractNpcAI
final Castle castle = npc.getCastle();
final Fort fortress = npc.getFort();
npc.setScriptValue(fortress != null ? fortress.getResidenceId() : (castle != null ? castle.getResidenceId() : 0));
startQuestTimer("AGGRO_CHECK" + npc.getId(), getRandom(1000, 10000), npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), getRandom(1000, 10000), npc, null);
return super.onSpawn(npc);
}

View File

@ -122,7 +122,7 @@ public class SiegeGuards extends AbstractNpcAI
}
}
}
startQuestTimer("AGGRO_CHECK" + npc.getId(), 3000, npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), 3000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -149,7 +149,7 @@ public class SiegeGuards extends AbstractNpcAI
final Castle castle = npc.getCastle();
final Fort fortress = npc.getFort();
npc.setScriptValue(fortress != null ? fortress.getResidenceId() : (castle != null ? castle.getResidenceId() : 0));
startQuestTimer("AGGRO_CHECK" + npc.getId(), getRandom(1000, 10000), npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), getRandom(1000, 10000), npc, null);
return super.onSpawn(npc);
}

View File

@ -96,7 +96,7 @@ public class SiegeGuards extends AbstractNpcAI
}
}
}
startQuestTimer("AGGRO_CHECK" + npc.getId(), 3000, npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), 3000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -123,7 +123,7 @@ public class SiegeGuards extends AbstractNpcAI
final Castle castle = npc.getCastle();
final Fort fortress = npc.getFort();
npc.setScriptValue(fortress != null ? fortress.getResidenceId() : (castle != null ? castle.getResidenceId() : 0));
startQuestTimer("AGGRO_CHECK" + npc.getId(), getRandom(1000, 10000), npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), getRandom(1000, 10000), npc, null);
return super.onSpawn(npc);
}

View File

@ -96,7 +96,7 @@ public class SiegeGuards extends AbstractNpcAI
}
}
}
startQuestTimer("AGGRO_CHECK" + npc.getId(), 3000, npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), 3000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@ -123,7 +123,7 @@ public class SiegeGuards extends AbstractNpcAI
final Castle castle = npc.getCastle();
final Fort fortress = npc.getFort();
npc.setScriptValue(fortress != null ? fortress.getResidenceId() : (castle != null ? castle.getResidenceId() : 0));
startQuestTimer("AGGRO_CHECK" + npc.getId(), getRandom(1000, 10000), npc, null);
startQuestTimer("AGGRO_CHECK" + npc.getObjectId(), getRandom(1000, 10000), npc, null);
return super.onSpawn(npc);
}