Dropped OnNpcCreatureSee in favor of OnCreatureSee event.
This commit is contained in:
@@ -21,6 +21,7 @@ import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
@@ -79,7 +80,7 @@ public class Rooney extends AbstractNpcAI
|
||||
|
||||
private Rooney()
|
||||
{
|
||||
addSeeCreatureId(ROONEY);
|
||||
setCreatureSeeId(this::onCreatureSee, ROONEY);
|
||||
addSpawn(ROONEY, getRandomEntry(LOCATIONS), false, 0);
|
||||
}
|
||||
|
||||
@@ -124,16 +125,19 @@ public class Rooney extends AbstractNpcAI
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
if (creature.isPlayer() && npc.isScriptValue(0))
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELCOME);
|
||||
startQuestTimer("teleport", 60000, npc, null);
|
||||
npc.setScriptValue(1);
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
if (npc.isScriptValue(0))
|
||||
{
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.WELCOME);
|
||||
startQuestTimer("teleport", 60000, npc, null);
|
||||
npc.setScriptValue(1);
|
||||
}
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
|
@@ -29,6 +29,7 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
@@ -115,8 +116,8 @@ public class PrimevalIsle extends AbstractNpcAI
|
||||
addAttackId(TREX);
|
||||
addAttackId(MONSTERS);
|
||||
addKillId(EGG, SAILREN, DEINO, ORNIT);
|
||||
addSeeCreatureId(TREX);
|
||||
addSeeCreatureId(MONSTERS);
|
||||
setCreatureSeeId(this::onCreatureSee, TREX);
|
||||
setCreatureSeeId(this::onCreatureSee, MONSTERS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -242,9 +243,10 @@ public class PrimevalIsle extends AbstractNpcAI
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
final Creature creature = event.getSeen();
|
||||
if (CommonUtil.contains(MONSTERS, npc.getId()))
|
||||
{
|
||||
if (creature.isPlayer())
|
||||
@@ -298,7 +300,6 @@ public class PrimevalIsle extends AbstractNpcAI
|
||||
npc.setRunning();
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, creature);
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
|
||||
@@ -64,9 +65,9 @@ public class SilentValley extends AbstractNpcAI
|
||||
addAttackId(CHEST, GUARD1, GUARD2);
|
||||
addEventReceivedId(GUARD1, GUARD2);
|
||||
addKillId(MOBS);
|
||||
addSeeCreatureId(MOBS);
|
||||
addSeeCreatureId(GUARD1, GUARD2);
|
||||
addSpawnId(CHEST, GUARD2);
|
||||
setCreatureSeeId(this::onCreatureSee, GUARD1, GUARD2);
|
||||
setCreatureSeeId(this::onCreatureSee, MOBS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -153,12 +154,13 @@ public class SilentValley extends AbstractNpcAI
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayable())
|
||||
{
|
||||
final PlayerInstance player = (isSummon) ? ((Summon) creature).getOwner() : creature.getActingPlayer();
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
final PlayerInstance player = (creature.isSummon()) ? ((Summon) creature).getOwner() : creature.getActingPlayer();
|
||||
if ((npc.getId() == GUARD1) || (npc.getId() == GUARD2))
|
||||
{
|
||||
npc.setTarget(player);
|
||||
@@ -170,7 +172,6 @@ public class SilentValley extends AbstractNpcAI
|
||||
addAttackDesire(npc, player);
|
||||
}
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -33,6 +33,7 @@ import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Playable;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.GrandBossInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.model.variables.NpcVariables;
|
||||
@@ -108,8 +109,8 @@ public class Baium extends AbstractNpcAI
|
||||
addStartNpc(ANG_VORTEX, TELE_CUBE, BAIUM_STONE);
|
||||
addAttackId(BAIUM, ARCHANGEL);
|
||||
addKillId(BAIUM);
|
||||
addSeeCreatureId(BAIUM);
|
||||
addSpellFinishedId(BAIUM);
|
||||
setCreatureSeeId(this::onCreatureSee, BAIUM);
|
||||
|
||||
final StatSet info = GrandBossManager.getInstance().getStatSet(BAIUM);
|
||||
final double curr_hp = info.getDouble("currentHP");
|
||||
@@ -559,12 +560,13 @@ public class Baium extends AbstractNpcAI
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
final Creature creature = event.getSeen();
|
||||
if (!zone.isInsideZone(creature) || (creature.isNpc() && (creature.getId() == BAIUM_STONE)))
|
||||
{
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
return;
|
||||
}
|
||||
|
||||
if (creature.isInCategory(CategoryType.CLERIC_GROUP))
|
||||
@@ -591,7 +593,6 @@ public class Baium extends AbstractNpcAI
|
||||
refreshAiParams(creature, npc, 10000, 1000);
|
||||
}
|
||||
manageSkills(npc);
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -21,6 +21,7 @@ import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.skills.Skill;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
@@ -51,8 +52,8 @@ public class BlackdaggerWing extends AbstractNpcAI
|
||||
public BlackdaggerWing()
|
||||
{
|
||||
addAttackId(BLACKDAGGER_WING);
|
||||
addSeeCreatureId(BLACKDAGGER_WING);
|
||||
addSpellFinishedId(BLACKDAGGER_WING);
|
||||
setCreatureSeeId(this::onCreatureSee, BLACKDAGGER_WING);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -71,18 +72,18 @@ public class BlackdaggerWing extends AbstractNpcAI
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
if (npc.getVariables().getBoolean(MID_HP_FLAG, false))
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
final Creature mostHated = ((Attackable) npc).getMostHated();
|
||||
if ((mostHated != null) && mostHated.isPlayer() && (mostHated != creature) && (getRandom(5) < 1))
|
||||
{
|
||||
addSkillCastDesire(npc, creature, RANGE_MAGIC_ATTACK, 99999);
|
||||
}
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.enums.ChatType;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
|
||||
@@ -40,12 +41,12 @@ public class Dorian extends AbstractNpcAI
|
||||
|
||||
private Dorian()
|
||||
{
|
||||
addSeeCreatureId(DORIAN);
|
||||
setCreatureSeeId(this::onCreatureSee, DORIAN);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
final PlayerInstance pl = creature.getActingPlayer();
|
||||
@@ -55,10 +56,10 @@ public class Dorian extends AbstractNpcAI
|
||||
takeItems(pl, SILVER_CROSS, -1);
|
||||
giveItems(pl, BROKEN_SILVER_CROSS, 1);
|
||||
qs.setCond(4, true);
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.THAT_SIGN);
|
||||
}
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
public static void main(String[] args)
|
||||
|
@@ -20,6 +20,7 @@ import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
|
||||
import ai.AbstractNpcAI;
|
||||
|
||||
@@ -34,17 +35,17 @@ public class Gordon extends AbstractNpcAI
|
||||
private Gordon()
|
||||
{
|
||||
addSpawnId(GORDON);
|
||||
addSeeCreatureId(GORDON);
|
||||
setCreatureSeeId(this::onCreatureSee, GORDON);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer() && ((PlayerInstance) creature).isCursedWeaponEquipped())
|
||||
{
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
addAttackDesire(npc, creature);
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -21,6 +21,7 @@ import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.util.Util;
|
||||
|
||||
@@ -54,7 +55,7 @@ public class ShadowSummoner extends AbstractNpcAI
|
||||
public ShadowSummoner()
|
||||
{
|
||||
addAttackId(SHADOW_SUMMONER);
|
||||
addSeeCreatureId(SHADOW_SUMMONER);
|
||||
setCreatureSeeId(this::onCreatureSee, SHADOW_SUMMONER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,15 +76,15 @@ public class ShadowSummoner extends AbstractNpcAI
|
||||
return super.onAttack(npc, attacker, damage, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
if (!creature.isPlayer() && (creature.getId() == DEMONS_BANQUET_2))
|
||||
{
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
((Attackable) npc).clearAggroList();
|
||||
addAttackDesire(npc, creature, 99999);
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -26,6 +26,7 @@ import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.holders.SkillHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.InstanceWorld;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -64,9 +65,9 @@ public class IceQueensCastle extends AbstractInstance
|
||||
{
|
||||
addStartNpc(JINIA);
|
||||
addTalkId(JINIA);
|
||||
addSeeCreatureId(BATTALION_LEADER, LEGIONNAIRE, MERCENARY_ARCHER);
|
||||
addSpawnId(FREYA);
|
||||
addSpellFinishedId(FREYA);
|
||||
setCreatureSeeId(this::onCreatureSee, BATTALION_LEADER, LEGIONNAIRE, MERCENARY_ARCHER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -132,9 +133,10 @@ public class IceQueensCastle extends AbstractInstance
|
||||
return super.onAdvEvent(event, npc, player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer() && npc.isScriptValue(0))
|
||||
{
|
||||
World.getInstance().forEachVisibleObject(npc, Creature.class, character ->
|
||||
@@ -150,7 +152,6 @@ public class IceQueensCastle extends AbstractInstance
|
||||
});
|
||||
npc.broadcastSay(ChatType.NPC_GENERAL, NpcStringId.S1_MAY_THE_PROTECTION_OF_THE_GODS_BE_UPON_YOU, creature.getName());
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.model.Location;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.instancezone.InstanceWorld;
|
||||
import org.l2jmobius.gameserver.model.zone.ZoneType;
|
||||
import org.l2jmobius.gameserver.network.NpcStringId;
|
||||
@@ -57,9 +58,9 @@ public class PailakaSongOfIceAndFire extends AbstractInstance
|
||||
addTalkId(ADLER1);
|
||||
addAttackId(BOTTLE, BRAZIER);
|
||||
addExitZoneId(ZONE);
|
||||
addSeeCreatureId(GARGOS);
|
||||
addSpawnId(BLOOM);
|
||||
addKillId(BLOOM);
|
||||
setCreatureSeeId(this::onCreatureSee, GARGOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -178,15 +179,18 @@ public class PailakaSongOfIceAndFire extends AbstractInstance
|
||||
return super.onExitZone(creature, zone);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
if (npc.isScriptValue(0) && creature.isPlayer())
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
startQuestTimer("GARGOS_LAUGH", 1000, npc, creature.getActingPlayer());
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
if (npc.isScriptValue(0))
|
||||
{
|
||||
npc.setScriptValue(1);
|
||||
startQuestTimer("GARGOS_LAUGH", 1000, npc, creature.getActingPlayer());
|
||||
}
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -24,6 +24,7 @@ import org.l2jmobius.gameserver.model.World;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.model.quest.State;
|
||||
@@ -67,8 +68,8 @@ public class Q00021_HiddenTruth extends Quest
|
||||
super(21);
|
||||
addStartNpc(MYSTERIOUS_WIZARD);
|
||||
addTalkId(MYSTERIOUS_WIZARD, TOMBSTONE, GHOST_OF_VON_HELLMAN, GHOST_OF_VON_HELLMANS_PAGE, BROKEN_BOOKSHELF, AGRIPEL, BENEDICT, DOMINIC, INNOCENTIN);
|
||||
addSeeCreatureId(GHOST_OF_VON_HELLMANS_PAGE);
|
||||
addRouteFinishedId(GHOST_OF_VON_HELLMANS_PAGE);
|
||||
setCreatureSeeId(this::onCreatureSee, GHOST_OF_VON_HELLMANS_PAGE);
|
||||
registerQuestItems(CROSS_OF_EINHASAD);
|
||||
}
|
||||
|
||||
@@ -429,14 +430,13 @@ public class Q00021_HiddenTruth extends Quest
|
||||
return htmltext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
playSound((PlayerInstance) creature, QuestSound.HORROR_01);
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -22,6 +22,7 @@ import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.itemcontainer.Inventory;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -61,7 +62,7 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest
|
||||
addStartNpc(YUMI);
|
||||
addTalkId(YUMI, WENDY, BOX, STONES, NEWYEAR);
|
||||
addKillId(GUARDIAN);
|
||||
addSeeCreatureId(STONES);
|
||||
setCreatureSeeId(this::onCreatureSee, STONES);
|
||||
registerQuestItems(STARSTONE, STARSTONE2, DETCTOR, DETCTOR2, LETTER);
|
||||
}
|
||||
|
||||
@@ -408,9 +409,9 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest
|
||||
return super.onKill(npc, player, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
final QuestState qs = getQuestState(creature.getActingPlayer(), false);
|
||||
@@ -422,7 +423,6 @@ public class Q00114_ResurrectionOfAnOldManager extends Quest
|
||||
showOnScreenMsg(creature.getActingPlayer(), NpcStringId.THE_RADIO_SIGNAL_DETECTOR_IS_RESPONDING_A_SUSPICIOUS_PILE_OF_STONES_CATCHES_YOUR_EYE, 2, 4500);
|
||||
}
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -36,6 +36,7 @@ import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.holders.ItemChanceHolder;
|
||||
import org.l2jmobius.gameserver.model.instancezone.Instance;
|
||||
import org.l2jmobius.gameserver.model.instancezone.InstanceWorld;
|
||||
@@ -206,8 +207,8 @@ public class Q00144_PailakaInjuredDragon extends Quest
|
||||
addKillId(WALL_MONSTERS);
|
||||
addKillId(OTHER_MONSTERS);
|
||||
addKillId(LATANA);
|
||||
addSeeCreatureId(LATANA);
|
||||
addEnterZoneId(NOEXIT_ZONES.keySet());
|
||||
setCreatureSeeId(this::onCreatureSee, LATANA);
|
||||
registerQuestItems(ITEMS);
|
||||
}
|
||||
|
||||
@@ -833,19 +834,22 @@ public class Q00144_PailakaInjuredDragon extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
if (creature.isPlayer() && npc.isScriptValue(0))
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
final QuestState qs = getQuestState(creature.getActingPlayer(), false);
|
||||
if ((qs == null) || (qs.getState() != State.STARTED) || isSummon)
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
if (npc.isScriptValue(0))
|
||||
{
|
||||
return null;
|
||||
final QuestState qs = getQuestState(creature.getActingPlayer(), false);
|
||||
if ((qs == null) || (qs.getState() != State.STARTED) || creature.isSummon())
|
||||
{
|
||||
return;
|
||||
}
|
||||
startQuestTimer("LATANA_INTRO_CAMERA_START", 600, npc, creature.getActingPlayer());
|
||||
}
|
||||
startQuestTimer("LATANA_INTRO_CAMERA_START", 600, npc, creature.getActingPlayer());
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -23,6 +23,7 @@ import org.l2jmobius.gameserver.model.actor.Attackable;
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
import org.l2jmobius.gameserver.model.quest.State;
|
||||
@@ -53,7 +54,7 @@ public class Q00275_DarkWingedSpies extends Quest
|
||||
addStartNpc(NERUGA_CHIEF_TANTUS);
|
||||
addTalkId(NERUGA_CHIEF_TANTUS);
|
||||
addKillId(DARKWING_BAT, VARANGKAS_TRACKER);
|
||||
addSeeCreatureId(VARANGKAS_TRACKER);
|
||||
setCreatureSeeId(this::onCreatureSee, VARANGKAS_TRACKER);
|
||||
registerQuestItems(DARKWING_BAT_FANG, VARANGKAS_PARASITE);
|
||||
}
|
||||
|
||||
@@ -109,16 +110,16 @@ public class Q00275_DarkWingedSpies extends Quest
|
||||
return super.onKill(npc, killer, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
npc.setRunning();
|
||||
((Attackable) npc).addDamageHate(creature, 0, 1);
|
||||
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, creature);
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -31,6 +31,7 @@ import org.l2jmobius.gameserver.model.events.annotations.Id;
|
||||
import org.l2jmobius.gameserver.model.events.annotations.RegisterEvent;
|
||||
import org.l2jmobius.gameserver.model.events.annotations.RegisterType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureAttacked;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.events.returns.TerminateReturn;
|
||||
import org.l2jmobius.gameserver.model.quest.Quest;
|
||||
import org.l2jmobius.gameserver.model.quest.QuestState;
|
||||
@@ -59,8 +60,8 @@ public class Q00454_CompletelyLost extends Quest
|
||||
addStartNpc(INJURED_SOLDIER);
|
||||
addTalkId(INJURED_SOLDIER, ERMIAN);
|
||||
addMoveFinishedId(INJURED_SOLDIER);
|
||||
addSeeCreatureId(INJURED_SOLDIER);
|
||||
addEventReceivedId(INJURED_SOLDIER);
|
||||
setCreatureSeeId(this::onCreatureSee, INJURED_SOLDIER);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -398,14 +399,17 @@ public class Q00454_CompletelyLost extends Quest
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
public void onCreatureSee(OnCreatureSee event)
|
||||
{
|
||||
if (creature.isPlayer() && npc.isScriptValue(0))
|
||||
final Creature creature = event.getSeen();
|
||||
if (creature.isPlayer())
|
||||
{
|
||||
addAttackDesire(npc, creature.getActingPlayer(), 10);
|
||||
final Npc npc = (Npc) event.getSeer();
|
||||
if (npc.isScriptValue(0))
|
||||
{
|
||||
addAttackDesire(npc, creature.getActingPlayer(), 10);
|
||||
}
|
||||
}
|
||||
return super.onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -36,8 +36,6 @@ import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.actor.Summon;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PetInstance;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
import org.l2jmobius.gameserver.model.events.EventDispatcher;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcCreatureSee;
|
||||
import org.l2jmobius.gameserver.network.Disconnection;
|
||||
import org.l2jmobius.gameserver.network.serverpackets.DeleteObject;
|
||||
|
||||
@@ -353,16 +351,6 @@ public class World
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wo.isNpc() && object.isCreature())
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcCreatureSee((Npc) wo, (Creature) object, object.isSummon()), (Npc) wo);
|
||||
}
|
||||
|
||||
if (object.isNpc() && wo.isCreature())
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcCreatureSee((Npc) object, (Creature) wo, wo.isSummon()), (Npc) object);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -576,16 +564,6 @@ public class World
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (wo.isNpc() && object.isCreature())
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcCreatureSee((Npc) wo, (Creature) object, object.isSummon()), (Npc) wo);
|
||||
}
|
||||
|
||||
if (object.isNpc() && wo.isCreature())
|
||||
{
|
||||
EventDispatcher.getInstance().notifyEventAsync(new OnNpcCreatureSee((Npc) object, (Creature) wo, wo.isSummon()), (Npc) object);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -68,7 +68,6 @@ import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureZoneEnter;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureZoneExit;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcCanBeSeen;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcEventReceived;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcFirstTalk;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcMoveFinished;
|
||||
@@ -813,28 +812,6 @@ public abstract class AbstractScript extends ManagedScript
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Provides instant callback operation when {@link Npc} sees another creature.
|
||||
* @param callback
|
||||
* @param npcIds
|
||||
* @return
|
||||
*/
|
||||
protected final List<AbstractEventListener> setNpcCreatureSeeId(Consumer<OnNpcCreatureSee> callback, int... npcIds)
|
||||
{
|
||||
return registerConsumer(callback, EventType.ON_NPC_CREATURE_SEE, ListenerRegisterType.NPC, npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides instant callback operation when {@link Npc} sees another creature.
|
||||
* @param callback
|
||||
* @param npcIds
|
||||
* @return
|
||||
*/
|
||||
protected final List<AbstractEventListener> setNpcCreatureSeeId(Consumer<OnNpcCreatureSee> callback, Collection<Integer> npcIds)
|
||||
{
|
||||
return registerConsumer(callback, EventType.ON_NPC_CREATURE_SEE, ListenerRegisterType.NPC, npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Provides instant callback operation when {@link Creature} sees another creature.
|
||||
* @param callback
|
||||
|
@@ -32,7 +32,6 @@ import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureTeleported;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureZoneEnter;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.OnCreatureZoneExit;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcCanBeSeen;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcCreatureSee;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcEventReceived;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcFirstTalk;
|
||||
import org.l2jmobius.gameserver.model.events.impl.creature.npc.OnNpcManorBypass;
|
||||
@@ -151,7 +150,6 @@ public enum EventType
|
||||
|
||||
// NPC events
|
||||
ON_NPC_CAN_BE_SEEN(OnNpcCanBeSeen.class, void.class, TerminateReturn.class),
|
||||
ON_NPC_CREATURE_SEE(OnNpcCreatureSee.class, void.class),
|
||||
ON_NPC_EVENT_RECEIVED(OnNpcEventReceived.class, void.class),
|
||||
ON_NPC_FIRST_TALK(OnNpcFirstTalk.class, void.class),
|
||||
ON_NPC_HATE(OnAttackableHate.class, void.class, TerminateReturn.class),
|
||||
|
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* This file is part of the L2J Mobius project.
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.events.impl.creature.npc;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Creature;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
import org.l2jmobius.gameserver.model.events.EventType;
|
||||
import org.l2jmobius.gameserver.model.events.impl.IBaseEvent;
|
||||
|
||||
/**
|
||||
* An instantly executed event when Creature is killed by Creature.
|
||||
* @author UnAfraid
|
||||
*/
|
||||
public class OnNpcCreatureSee implements IBaseEvent
|
||||
{
|
||||
private final Npc _npc;
|
||||
private final Creature _creature;
|
||||
private final boolean _isSummon;
|
||||
|
||||
public OnNpcCreatureSee(Npc npc, Creature creature, boolean isSummon)
|
||||
{
|
||||
_npc = npc;
|
||||
_creature = creature;
|
||||
_isSummon = isSummon;
|
||||
}
|
||||
|
||||
public Npc getNpc()
|
||||
{
|
||||
return _npc;
|
||||
}
|
||||
|
||||
public Creature getCreature()
|
||||
{
|
||||
return _creature;
|
||||
}
|
||||
|
||||
public boolean isSummon()
|
||||
{
|
||||
return _isSummon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventType getType()
|
||||
{
|
||||
return EventType.ON_NPC_CREATURE_SEE;
|
||||
}
|
||||
}
|
@@ -766,37 +766,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
showResult(player, res);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npc the NPC that sees the creature
|
||||
* @param creature the creature seen by the NPC
|
||||
* @param isSummon
|
||||
*/
|
||||
public void notifySeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
{
|
||||
PlayerInstance player = null;
|
||||
if (isSummon || creature.isPlayer())
|
||||
{
|
||||
player = creature.getActingPlayer();
|
||||
}
|
||||
String res = null;
|
||||
try
|
||||
{
|
||||
res = onSeeCreature(npc, creature, isSummon);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
if (player != null)
|
||||
{
|
||||
showError(player, e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (player != null)
|
||||
{
|
||||
showResult(player, res);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param eventName - name of event
|
||||
* @param sender - NPC, who sent event
|
||||
@@ -1239,18 +1208,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called whenever a NPC "sees" a creature.
|
||||
* @param npc the NPC who sees the creature
|
||||
* @param creature the creature seen by the NPC
|
||||
* @param isSummon this parameter if it's {@code false} it denotes that the character seen by the NPC was indeed the player, else it specifies that the character was the player's summon
|
||||
* @return
|
||||
*/
|
||||
public String onSeeCreature(Npc npc, Creature creature, boolean isSummon)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function is called whenever a player enters the game.
|
||||
* @param player this parameter contains a reference to the exact instance of the player who is entering to the world.
|
||||
@@ -1921,22 +1878,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
setAttackableAggroRangeEnterId(event -> notifyAggroRangeEnter(event.getNpc(), event.getActiveChar(), event.isSummon()), npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npcIds the IDs of the NPCs to register
|
||||
*/
|
||||
public void addSeeCreatureId(int... npcIds)
|
||||
{
|
||||
setNpcCreatureSeeId(event -> notifySeeCreature(event.getNpc(), event.getCreature(), event.isSummon()), npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param npcIds the IDs of the NPCs to register
|
||||
*/
|
||||
public void addSeeCreatureId(Collection<Integer> npcIds)
|
||||
{
|
||||
setNpcCreatureSeeId(event -> notifySeeCreature(event.getNpc(), event.getCreature(), event.isSummon()), npcIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register onEnterZone trigger for zone
|
||||
* @param zoneId the ID of the zone to register
|
||||
|
Reference in New Issue
Block a user