diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Npc.java index 998d18643b..29a3deea8e 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index f0e51705a0..2353ceddf0 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -981,6 +981,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -992,6 +996,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Npc.java index 98c4f9f99c..ae62ac9508 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index f0e51705a0..2353ceddf0 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -981,6 +981,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -992,6 +996,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Npc.java index 98c4f9f99c..ae62ac9508 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Npc.java index 98c4f9f99c..ae62ac9508 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Npc.java index 98c4f9f99c..ae62ac9508 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Npc.java index 98c4f9f99c..ae62ac9508 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Npc.java index 98c4f9f99c..ae62ac9508 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Npc.java index 98c4f9f99c..ae62ac9508 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Npc.java index 3947541ddb..b3f7db3fa1 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1071,6 +1075,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Npc.java index 3947541ddb..b3f7db3fa1 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1071,6 +1075,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index bce4f6845e..a8ada435be 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -982,6 +982,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -993,6 +997,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Npc.java index a03ca2e2a7..922513c085 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -114,6 +115,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1272,6 +1275,7 @@ public class Npc extends Creature _killingBlowWeaponId = 0; _isRandomAnimationEnabled = getTemplate().isRandomAnimationEnabled(); _isRandomWalkingEnabled = !WalkingManager.getInstance().isTargeted(this) && getTemplate().isRandomWalkEnabled(); + if (isTeleporting()) { EventDispatcher.getInstance().notifyEventAsync(new OnNpcTeleport(this), this); @@ -1285,6 +1289,16 @@ public class Npc extends Creature { WalkingManager.getInstance().onSpawn(this); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 5176affd4c..9b2f2cefcc 100644 --- a/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_CT_2.4_Epilogue/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -843,6 +843,10 @@ public abstract class AbstractScript extends ManagedScript */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -854,6 +858,10 @@ public abstract class AbstractScript extends ManagedScript */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Npc.java index a03ca2e2a7..922513c085 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -21,6 +21,7 @@ import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; @@ -114,6 +115,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1272,6 +1275,7 @@ public class Npc extends Creature _killingBlowWeaponId = 0; _isRandomAnimationEnabled = getTemplate().isRandomAnimationEnabled(); _isRandomWalkingEnabled = !WalkingManager.getInstance().isTargeted(this) && getTemplate().isRandomWalkEnabled(); + if (isTeleporting()) { EventDispatcher.getInstance().notifyEventAsync(new OnNpcTeleport(this), this); @@ -1285,6 +1289,16 @@ public class Npc extends Creature { WalkingManager.getInstance().onSpawn(this); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 5176affd4c..9b2f2cefcc 100644 --- a/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_CT_2.6_HighFive/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -843,6 +843,10 @@ public abstract class AbstractScript extends ManagedScript */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -854,6 +858,10 @@ public abstract class AbstractScript extends ManagedScript */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Npc.java index a3c8d420b2..5ed095baa4 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 8a2109f5b2..bd7368f305 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -956,6 +956,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -967,6 +971,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Npc.java index a3c8d420b2..5ed095baa4 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 8a2109f5b2..bd7368f305 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -956,6 +956,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -967,6 +971,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Npc.java index a3c8d420b2..5ed095baa4 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -116,6 +118,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1070,6 +1074,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 8a2109f5b2..bd7368f305 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -956,6 +956,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -967,6 +971,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Npc.java index b6ae6c8945..050f15b78d 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -117,6 +119,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1082,6 +1086,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 8a2109f5b2..bd7368f305 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -956,6 +956,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -967,6 +971,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Npc.java index b6ae6c8945..050f15b78d 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -117,6 +119,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1082,6 +1086,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 8a2109f5b2..bd7368f305 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -956,6 +956,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -967,6 +971,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Npc.java index b6ae6c8945..050f15b78d 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -117,6 +119,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1082,6 +1086,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 8a2109f5b2..bd7368f305 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -956,6 +956,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -967,6 +971,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java index cf1126298f..044002951d 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -114,6 +116,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1054,6 +1058,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 8a2109f5b2..bd7368f305 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -956,6 +956,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -967,6 +971,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Npc.java index 194aad174c..6fbde3d9db 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -117,6 +119,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1083,6 +1087,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 197980b2ac..58a82f6f76 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -957,6 +957,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -968,6 +972,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/Npc.java index 194aad174c..6fbde3d9db 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -117,6 +119,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1083,6 +1087,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 197980b2ac..58a82f6f76 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -957,6 +957,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -968,6 +972,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } diff --git a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/Npc.java b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/Npc.java index 194aad174c..6fbde3d9db 100644 --- a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/Npc.java +++ b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/actor/Npc.java @@ -18,6 +18,8 @@ package org.l2jmobius.gameserver.model.actor; import java.util.ArrayList; import java.util.List; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; import java.util.logging.Level; import org.l2jmobius.Config; @@ -117,6 +119,8 @@ public class Npc extends Creature public static final int INTERACTION_DISTANCE = 250; /** Maximum distance where the drop may appear given this NPC position. */ public static final int RANDOM_ITEM_DROP_LIMIT = 70; + /** Ids of NPCs that see creatures through the OnCreatureSee event. */ + private static final Set CREATURE_SEE_IDS = ConcurrentHashMap.newKeySet(); /** The Spawn object that manage this NpcInstance */ private Spawn _spawn; /** The flag to specify if this NpcInstance is busy */ @@ -1083,6 +1087,16 @@ public class Npc extends Creature { setClanId(getCastle().getOwnerId()); } + + if (CREATURE_SEE_IDS.contains(getId())) + { + initSeenCreatures(); + } + } + + public static void addCreatureSeeId(int id) + { + CREATURE_SEE_IDS.add(id); } /** diff --git a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/events/AbstractScript.java b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/events/AbstractScript.java index 197980b2ac..58a82f6f76 100644 --- a/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/events/AbstractScript.java +++ b/L2J_Mobius_Essence_5.5_FrostLord/java/org/l2jmobius/gameserver/model/events/AbstractScript.java @@ -957,6 +957,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, int... npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); } @@ -968,6 +972,10 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime */ protected final List setCreatureSeeId(Consumer callback, Collection npcIds) { + for (int id : npcIds) + { + Npc.addCreatureSeeId(id); + } return registerConsumer(callback, EventType.ON_CREATURE_SEE, ListenerRegisterType.NPC, npcIds); }