Removed unnecessary object id from fake player flag tasks.

This commit is contained in:
MobiusDevelopment
2020-03-22 08:33:48 +00:00
parent c9f8da5371
commit 747e6c5d19
57 changed files with 322 additions and 203 deletions

View File

@@ -36,33 +36,40 @@ public class PvpFlaggingStopTask extends AbstractNpcAI
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
if ((npc == null) || npc.isDead())
if (npc == null)
{
return null;
}
if (npc.isDead())
{
cancelQuestTimer("FLAG_CHECK", npc, null);
cancelQuestTimer("FINISH_FLAG", npc, null);
cancelQuestTimer("REMOVE_FLAG", npc, null);
return null;
}
if (event.startsWith("FLAG_CHECK"))
if (event.equals("FLAG_CHECK"))
{
final WorldObject target = npc.getTarget();
if ((target != null) && (target.isPlayable() || target.isFakePlayer()))
{
npc.setScriptValue(1); // in combat
cancelQuestTimer("FINISH_FLAG" + npc.getObjectId(), npc, null);
cancelQuestTimer("REMOVE_FLAG" + npc.getObjectId(), npc, null);
startQuestTimer("FINISH_FLAG" + npc.getObjectId(), Config.PVP_NORMAL_TIME - 20000, npc, null);
startQuestTimer("FLAG_CHECK" + npc.getObjectId(), 5000, npc, null);
cancelQuestTimer("FINISH_FLAG", npc, null);
cancelQuestTimer("REMOVE_FLAG", npc, null);
startQuestTimer("FINISH_FLAG", Config.PVP_NORMAL_TIME - 20000, npc, null);
startQuestTimer("FLAG_CHECK", 5000, npc, null);
}
}
else if (event.startsWith("FINISH_FLAG"))
else if (event.equals("FINISH_FLAG"))
{
if (npc.isScriptValue(1))
{
npc.setScriptValue(2); // blink status
npc.broadcastInfo(); // update flag status
startQuestTimer("REMOVE_FLAG" + npc.getObjectId(), 20000, npc, null);
startQuestTimer("REMOVE_FLAG", 20000, npc, null);
}
}
else if (event.startsWith("REMOVE_FLAG"))
else if (event.equals("REMOVE_FLAG"))
{
if (npc.isScriptValue(2))
{

View File

@@ -96,7 +96,7 @@ public class RecieveAdventurerBuffs extends AbstractNpcAI
}
}
}
startQuestTimer("AUTOBUFF" + npc.getObjectId(), 30000, npc, null);
startQuestTimer("AUTOBUFF", 30000, npc, null);
}
return super.onAdvEvent(event, npc, player);
}
@@ -104,7 +104,7 @@ public class RecieveAdventurerBuffs extends AbstractNpcAI
@Override
public String onSpawn(Npc npc)
{
startQuestTimer("AUTOBUFF" + npc.getObjectId(), 1000, npc, null);
startQuestTimer("AUTOBUFF", 1000, npc, null);
return super.onSpawn(npc);
}

View File

@@ -1172,7 +1172,7 @@ public abstract class Creature extends WorldObject implements ISkillsHolder, IDe
{
npc.setScriptValue(1); // in combat
broadcastInfo(); // update flag status
QuestManager.getInstance().getQuest("PvpFlaggingStopTask").notifyEvent("FLAG_CHECK" + npc.getObjectId(), npc, null);
QuestManager.getInstance().getQuest("PvpFlaggingStopTask").notifyEvent("FLAG_CHECK", npc, null);
}
}
}

View File

@@ -683,7 +683,7 @@ public class SkillCaster implements Runnable
{
npc.setScriptValue(1); // in combat
npc.broadcastInfo(); // update flag status
QuestManager.getInstance().getQuest("PvpFlaggingStopTask").notifyEvent("FLAG_CHECK" + npc.getObjectId(), npc, null);
QuestManager.getInstance().getQuest("PvpFlaggingStopTask").notifyEvent("FLAG_CHECK", npc, null);
}
}
}