|
@@ -25,7 +25,6 @@ import com.l2jserver.gameserver.model.actor.knownlist.ObjectKnownList;
|
|
|
import com.l2jserver.gameserver.model.actor.poly.ObjectPoly;
|
|
|
import com.l2jserver.gameserver.model.actor.position.ObjectPosition;
|
|
|
import com.l2jserver.gameserver.model.entity.Instance;
|
|
|
-import com.l2jserver.gameserver.network.L2GameClient;
|
|
|
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
|
|
|
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
|
|
|
|
|
@@ -67,136 +66,171 @@ public abstract class L2Object
|
|
|
|
|
|
public static enum InstanceType
|
|
|
{
|
|
|
- L2Object(),
|
|
|
+ L2Object(null),
|
|
|
L2Character(L2Object),
|
|
|
- L2Npc(L2Object, L2Character),
|
|
|
- L2Playable(L2Object, L2Character, L2Npc),
|
|
|
- L2Summon(L2Object, L2Character, L2Playable),
|
|
|
- L2Decoy(L2Object, L2Character),
|
|
|
- L2Trap(L2Object, L2Character),
|
|
|
- L2PcInstance(L2Object, L2Character, L2Playable),
|
|
|
- L2NpcInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2MerchantInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2StaticObjectInstance(L2Object, L2Character),
|
|
|
- L2DoorInstance(L2Object, L2Character),
|
|
|
- L2EffectPointInstance(L2Object, L2Character, L2Npc),
|
|
|
+ L2Npc(L2Character),
|
|
|
+ L2Playable(L2Npc),
|
|
|
+ L2Summon(L2Playable),
|
|
|
+ L2Decoy(L2Character),
|
|
|
+ L2Trap(L2Character),
|
|
|
+ L2PcInstance(L2Playable),
|
|
|
+ L2NpcInstance(L2Npc),
|
|
|
+ L2MerchantInstance(L2NpcInstance),
|
|
|
+ L2StaticObjectInstance(L2Character),
|
|
|
+ L2DoorInstance(L2Character),
|
|
|
+ L2EffectPointInstance(L2Npc),
|
|
|
// Summons, Pets, Decoys and Traps
|
|
|
- L2SummonInstance(L2Object, L2Character, L2Playable, L2Summon),
|
|
|
- L2SiegeSummonInstance(L2Object, L2Character, L2Playable, L2Summon, L2SummonInstance),
|
|
|
- L2MerchantSummonInstance(L2Object, L2Character, L2Playable, L2Summon, L2SummonInstance),
|
|
|
- L2PetInstance(L2Object, L2Character, L2Playable, L2Summon),
|
|
|
- L2BabyPetInstance(L2Object, L2Character, L2Playable, L2Summon, L2PetInstance),
|
|
|
- L2DecoyInstance(L2Object, L2Character, L2Decoy),
|
|
|
- L2TrapInstance(L2Object, L2Character, L2Trap),
|
|
|
+ L2SummonInstance(L2Summon),
|
|
|
+ L2SiegeSummonInstance(L2SummonInstance),
|
|
|
+ L2MerchantSummonInstance(L2SummonInstance),
|
|
|
+ L2PetInstance(L2Summon),
|
|
|
+ L2BabyPetInstance(L2PetInstance),
|
|
|
+ L2DecoyInstance(L2Decoy),
|
|
|
+ L2TrapInstance(L2Trap),
|
|
|
// Attackable
|
|
|
- L2Attackable(L2Object, L2Character, L2Npc),
|
|
|
- L2GuardInstance(L2Object, L2Character, L2Npc, L2Attackable),
|
|
|
- L2MonsterInstance(L2Object, L2Character, L2Npc, L2Attackable),
|
|
|
- L2ChestInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2ControllableMobInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2FeedableBeastInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2TamedBeastInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance, L2FeedableBeastInstance),
|
|
|
- L2FriendlyMobInstance(L2Object, L2Character, L2Npc, L2Attackable),
|
|
|
- L2PenaltyMonsterInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2RiftInvaderInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2MinionInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2RaidBossInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2GrandBossInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance, L2RaidBossInstance),
|
|
|
+ L2Attackable(L2Npc),
|
|
|
+ L2GuardInstance(L2Attackable),
|
|
|
+ L2MonsterInstance(L2Attackable),
|
|
|
+ L2ChestInstance(L2MonsterInstance),
|
|
|
+ L2ControllableMobInstance(L2MonsterInstance),
|
|
|
+ L2FeedableBeastInstance(L2MonsterInstance),
|
|
|
+ L2TamedBeastInstance(L2FeedableBeastInstance),
|
|
|
+ L2FriendlyMobInstance(L2Attackable),
|
|
|
+ L2PenaltyMonsterInstance(L2MonsterInstance),
|
|
|
+ L2RiftInvaderInstance(L2MonsterInstance),
|
|
|
+ L2MinionInstance(L2MonsterInstance),
|
|
|
+ L2RaidBossInstance(L2MonsterInstance),
|
|
|
+ L2GrandBossInstance(L2RaidBossInstance),
|
|
|
// FlyMobs
|
|
|
- L2FlyNpcInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2FlyMonsterInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
- L2FlyMinionInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance, L2MinionInstance),
|
|
|
- L2FlyRaidBossInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance, L2RaidBossInstance),
|
|
|
+ L2FlyNpcInstance(L2NpcInstance),
|
|
|
+ L2FlyMonsterInstance(L2MonsterInstance),
|
|
|
+ L2FlyMinionInstance(L2MinionInstance),
|
|
|
+ L2FlyRaidBossInstance(L2RaidBossInstance),
|
|
|
// Sepulchers
|
|
|
- L2SepulcherNpcInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2SepulcherMonsterInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
+ L2SepulcherNpcInstance(L2NpcInstance),
|
|
|
+ L2SepulcherMonsterInstance(L2MonsterInstance),
|
|
|
// Festival
|
|
|
- L2FestivalGiudeInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2FestivalMonsterInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
|
|
|
+ L2FestivalGiudeInstance(L2Npc),
|
|
|
+ L2FestivalMonsterInstance(L2MonsterInstance),
|
|
|
// Ships and controllers
|
|
|
- L2BoatInstance(L2Object, L2Character),
|
|
|
- L2AirShipInstance(L2Object, L2Character),
|
|
|
- L2AirShipControllerInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
+ L2BoatInstance(L2Character),
|
|
|
+ L2AirShipInstance(L2Character),
|
|
|
+ L2AirShipControllerInstance(L2NpcInstance),
|
|
|
// Siege
|
|
|
- L2DefenderInstance(L2Object, L2Character, L2Npc, L2Attackable),
|
|
|
- L2ArtefactInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2ControlTowerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2FlameTowerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2SiegeFlagInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2SiegeNpcInstance(L2Object, L2Character, L2Npc),
|
|
|
+ L2DefenderInstance(L2Attackable),
|
|
|
+ L2ArtefactInstance(L2NpcInstance),
|
|
|
+ L2ControlTowerInstance(L2Npc),
|
|
|
+ L2FlameTowerInstance(L2Npc),
|
|
|
+ L2SiegeFlagInstance(L2Npc),
|
|
|
+ L2SiegeNpcInstance(L2Npc),
|
|
|
// Fort Siege
|
|
|
- L2FortBallistaInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2FortCommanderInstance(L2Object, L2Character, L2Npc, L2Attackable, L2DefenderInstance),
|
|
|
+ L2FortBallistaInstance(L2Npc),
|
|
|
+ L2FortCommanderInstance(L2DefenderInstance),
|
|
|
// Castle NPCs
|
|
|
- L2CastleBlacksmithInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2CastleChamberlainInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2CastleMagicianInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2CastleTeleporterInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2CastleWarehouseInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2MercManagerInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
+ L2CastleBlacksmithInstance(L2NpcInstance),
|
|
|
+ L2CastleChamberlainInstance(L2NpcInstance),
|
|
|
+ L2CastleMagicianInstance(L2NpcInstance),
|
|
|
+ L2CastleTeleporterInstance(L2NpcInstance),
|
|
|
+ L2CastleWarehouseInstance(L2NpcInstance),
|
|
|
+ L2MercManagerInstance(L2MerchantInstance),
|
|
|
// Fort NPCs
|
|
|
- L2FortEnvoyInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2FortLogisticsInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
- L2FortManagerInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
- L2FortSiegeNpcInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2FortSupportCaptainInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
+ L2FortEnvoyInstance(L2Npc),
|
|
|
+ L2FortLogisticsInstance(L2MerchantInstance),
|
|
|
+ L2FortManagerInstance(L2MerchantInstance),
|
|
|
+ L2FortSiegeNpcInstance(L2Npc),
|
|
|
+ L2FortSupportCaptainInstance(L2MerchantInstance),
|
|
|
// Seven Signs
|
|
|
- L2CabaleBufferInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2SignsPriestInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2DawnPriestInstance(L2Object, L2Character, L2Npc, L2SignsPriestInstance),
|
|
|
- L2DuskPriestInstance(L2Object, L2Character, L2Npc, L2SignsPriestInstance),
|
|
|
- L2DungeonGatekeeperInstance(L2Object, L2Character, L2Npc),
|
|
|
+ L2CabaleBufferInstance(L2Npc),
|
|
|
+ L2SignsPriestInstance(L2Npc),
|
|
|
+ L2DawnPriestInstance(L2SignsPriestInstance),
|
|
|
+ L2DuskPriestInstance(L2SignsPriestInstance),
|
|
|
+ L2DungeonGatekeeperInstance(L2Npc),
|
|
|
// City NPCs
|
|
|
- L2AdventurerInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2AuctioneerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2ClanHallManagerInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
- L2ClanTraderInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2FameManagerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2FishermanInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
- L2ManorManagerInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
- L2MercenaryManagerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2NpcWalkerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2ObservationInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2OlympiadManagerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2PetManagerInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
- L2RaceManagerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2SymbolMakerInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2TeleporterInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2TownPetInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2TrainerInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2TransformManagerInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2MerchantInstance),
|
|
|
- L2VillageMasterInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2WarehouseInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2WyvernManagerInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2XmassTreeInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
+ L2AdventurerInstance(L2NpcInstance),
|
|
|
+ L2AuctioneerInstance(L2Npc),
|
|
|
+ L2ClanHallManagerInstance(L2MerchantInstance),
|
|
|
+ L2ClanTraderInstance(L2Npc),
|
|
|
+ L2FameManagerInstance(L2Npc),
|
|
|
+ L2FishermanInstance(L2MerchantInstance),
|
|
|
+ L2ManorManagerInstance(L2MerchantInstance),
|
|
|
+ L2MercenaryManagerInstance(L2Npc),
|
|
|
+ L2NpcWalkerInstance(L2Npc),
|
|
|
+ L2ObservationInstance(L2Npc),
|
|
|
+ L2OlympiadManagerInstance(L2Npc),
|
|
|
+ L2PetManagerInstance(L2MerchantInstance),
|
|
|
+ L2RaceManagerInstance(L2Npc),
|
|
|
+ L2SymbolMakerInstance(L2Npc),
|
|
|
+ L2TeleporterInstance(L2Npc),
|
|
|
+ L2TownPetInstance(L2Npc),
|
|
|
+ L2TrainerInstance(L2NpcInstance),
|
|
|
+ L2TransformManagerInstance(L2MerchantInstance),
|
|
|
+ L2VillageMasterInstance(L2NpcInstance),
|
|
|
+ L2WarehouseInstance(L2NpcInstance),
|
|
|
+ L2WyvernManagerInstance(L2NpcInstance),
|
|
|
+ L2XmassTreeInstance(L2NpcInstance),
|
|
|
// Doormens
|
|
|
- L2DoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2CastleDoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2DoormenInstance),
|
|
|
- L2FortDoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2DoormenInstance),
|
|
|
- L2ClanHallDoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2DoormenInstance),
|
|
|
+ L2DoormenInstance(L2NpcInstance),
|
|
|
+ L2CastleDoormenInstance(L2DoormenInstance),
|
|
|
+ L2FortDoormenInstance(L2DoormenInstance),
|
|
|
+ L2ClanHallDoormenInstance(L2DoormenInstance),
|
|
|
// Custom
|
|
|
- L2ClassMasterInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
|
|
|
- L2NpcBufferInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2TvTEventNpcInstance(L2Object, L2Character, L2Npc),
|
|
|
- L2WeddingManagerInstance(L2Object, L2Character, L2Npc);
|
|
|
-
|
|
|
- private final long _type;
|
|
|
-
|
|
|
- private InstanceType(InstanceType... parents)
|
|
|
+ L2ClassMasterInstance(L2NpcInstance),
|
|
|
+ L2NpcBufferInstance(L2Npc),
|
|
|
+ L2TvTEventNpcInstance(L2Npc),
|
|
|
+ L2WeddingManagerInstance(L2Npc);
|
|
|
+
|
|
|
+ private final InstanceType _parent;
|
|
|
+ private final long _typeL;
|
|
|
+ private final long _typeH;
|
|
|
+ private final long _maskL;
|
|
|
+ private final long _maskH;
|
|
|
+
|
|
|
+ private InstanceType(InstanceType parent)
|
|
|
{
|
|
|
- long type = 1 << this.ordinal();
|
|
|
- if (type == 0)
|
|
|
+ _parent = parent;
|
|
|
+
|
|
|
+ final int high = this.ordinal() - (Long.SIZE - 1);
|
|
|
+ if (high < 0)
|
|
|
+ {
|
|
|
+ _typeL = 1L << this.ordinal();
|
|
|
+ _typeH = 0;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _typeL = 0;
|
|
|
+ _typeH = 1L << high;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_typeL < 0 || _typeH < 0)
|
|
|
throw new Error("Too many instance types, failed to load " + this.name());
|
|
|
|
|
|
- for (InstanceType i : parents)
|
|
|
- type |= 1 << i.ordinal();
|
|
|
+ if (parent != null)
|
|
|
+ {
|
|
|
+ _maskL = _typeL | parent._maskL;
|
|
|
+ _maskH = _typeH | parent._maskH;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ _maskL = _typeL;
|
|
|
+ _maskH = _typeH;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- _type = type;
|
|
|
+ public final InstanceType getParent()
|
|
|
+ {
|
|
|
+ return _parent;
|
|
|
}
|
|
|
|
|
|
- public final boolean isType(InstanceType i)
|
|
|
+ public final boolean isType(InstanceType... it)
|
|
|
{
|
|
|
- return (_type & i._type) > 0;
|
|
|
+ for (InstanceType i : it)
|
|
|
+ {
|
|
|
+ if ((_maskL & i._typeL) > 0)
|
|
|
+ return true;
|
|
|
+ if ((_maskH & i._typeH) > 0)
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -205,7 +239,12 @@ public abstract class L2Object
|
|
|
_instanceType = i;
|
|
|
}
|
|
|
|
|
|
- public final boolean isInstanceType(InstanceType i)
|
|
|
+ public final InstanceType getInstanceType()
|
|
|
+ {
|
|
|
+ return _instanceType;
|
|
|
+ }
|
|
|
+
|
|
|
+ public final boolean isInstanceType(InstanceType... i)
|
|
|
{
|
|
|
return _instanceType.isType(i);
|
|
|
}
|
|
@@ -222,12 +261,6 @@ public abstract class L2Object
|
|
|
player.sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
}
|
|
|
|
|
|
- @Deprecated
|
|
|
- public void onActionShift(L2GameClient client)
|
|
|
- {
|
|
|
- client.getActiveChar().sendPacket(ActionFailed.STATIC_PACKET);
|
|
|
- }
|
|
|
-
|
|
|
public void onActionShift(L2PcInstance player)
|
|
|
{
|
|
|
player.sendPacket(ActionFailed.STATIC_PACKET);
|