Преглед на файлове

Unhardcoding some bypasses, thanks nBd for idea and handler.
Also new InstanceType enum added into L2Object and all child instances for faster checks.
REQUIRE DP UPDATE !

_DS_ преди 15 години
родител
ревизия
4132753afc
променени са 100 файла, в които са добавени 389 реда и са изтрити 1243 реда
  1. 84 0
      L2_GameServer/java/com/l2jserver/gameserver/handler/BypassHandler.java
  2. 44 0
      L2_GameServer/java/com/l2jserver/gameserver/handler/IBypassHandler.java
  3. 149 1
      L2_GameServer/java/com/l2jserver/gameserver/model/L2Object.java
  4. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Attackable.java
  5. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Character.java
  6. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Decoy.java
  7. 8 875
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Npc.java
  8. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Playable.java
  9. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Summon.java
  10. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Trap.java
  11. 1 10
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AdventurerInstance.java
  12. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipControllerInstance.java
  13. 2 1
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipInstance.java
  14. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ArtefactInstance.java
  15. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AuctioneerInstance.java
  16. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2BabyPetInstance.java
  17. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2BoatInstance.java
  18. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CabaleBufferInstance.java
  19. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleBlacksmithInstance.java
  20. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleChamberlainInstance.java
  21. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleDoormenInstance.java
  22. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleMagicianInstance.java
  23. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleTeleporterInstance.java
  24. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleWarehouseInstance.java
  25. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleWyvernManagerInstance.java
  26. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ChestInstance.java
  27. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClanHallDoormenInstance.java
  28. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClanHallManagerInstance.java
  29. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClanTraderInstance.java
  30. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClassMasterInstance.java
  31. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ControlTowerInstance.java
  32. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ControllableMobInstance.java
  33. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DawnPriestInstance.java
  34. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DecoyInstance.java
  35. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DefenderInstance.java
  36. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DoorInstance.java
  37. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DoormenInstance.java
  38. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DungeonGatekeeperInstance.java
  39. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DuskPriestInstance.java
  40. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2EffectPointInstance.java
  41. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FameManagerInstance.java
  42. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FeedableBeastInstance.java
  43. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FestivalGuideInstance.java
  44. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FestivalMonsterInstance.java
  45. 3 58
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java
  46. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlameTowerInstance.java
  47. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyMinionInstance.java
  48. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyMonsterInstance.java
  49. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyNpcInstance.java
  50. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyRaidBossInstance.java
  51. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortBallistaInstance.java
  52. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortCommanderInstance.java
  53. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortDoormenInstance.java
  54. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortEnvoyInstance.java
  55. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortLogisticsInstance.java
  56. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortManagerInstance.java
  57. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortSiegeNpcInstance.java
  58. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortSupportCaptainInstance.java
  59. 2 2
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortWyvernManagerInstance.java
  60. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FriendlyMobInstance.java
  61. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2GrandBossInstance.java
  62. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2GuardInstance.java
  63. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ManorManagerInstance.java
  64. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MercManagerInstance.java
  65. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MercenaryManagerInstance.java
  66. 2 152
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantInstance.java
  67. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantSummonInstance.java
  68. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MinionInstance.java
  69. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MonsterInstance.java
  70. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java
  71. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2NpcInstance.java
  72. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2NpcWalkerInstance.java
  73. 1 64
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ObservationInstance.java
  74. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2OlympiadManagerInstance.java
  75. 2 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  76. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PenaltyMonsterInstance.java
  77. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java
  78. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PetManagerInstance.java
  79. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2RaceManagerInstance.java
  80. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2RaidBossInstance.java
  81. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2RiftInvaderInstance.java
  82. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SepulcherMonsterInstance.java
  83. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SepulcherNpcInstance.java
  84. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeFlagInstance.java
  85. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeNpcInstance.java
  86. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeSummonInstance.java
  87. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SignsPriestInstance.java
  88. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2StaticObjectInstance.java
  89. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SummonInstance.java
  90. 1 30
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SymbolMakerInstance.java
  91. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TamedBeastInstance.java
  92. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TeleporterInstance.java
  93. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TownPetInstance.java
  94. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TrainerInstance.java
  95. 2 48
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TransformManagerInstance.java
  96. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TrapInstance.java
  97. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TvTEventNpcInstance.java
  98. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2VillageMasterInstance.java
  99. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2WarehouseInstance.java
  100. 1 0
      L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2WeddingManagerInstance.java

+ 84 - 0
L2_GameServer/java/com/l2jserver/gameserver/handler/BypassHandler.java

@@ -0,0 +1,84 @@
+/*
+ * 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 com.l2jserver.gameserver.handler;
+
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.l2jserver.Config;
+
+import javolution.util.FastMap;
+
+/**
+ * 
+ * @author nBd
+ *
+ */
+public class BypassHandler
+{
+	private static Logger _log = Logger.getLogger(BypassHandler.class.getName());
+
+	private Map<String, IBypassHandler> _datatable;
+
+	public static BypassHandler getInstance()
+	{
+		return SingletonHolder._instance;
+	}
+
+	private BypassHandler()
+	{
+		_datatable = new FastMap<String, IBypassHandler>();
+	}
+
+	public void registerBypassHandler(IBypassHandler handler)
+	{
+		String[] ids = handler.getBypassList();
+
+		for (String element : ids)
+		{
+			if (Config.DEBUG)
+				_log.log(Level.FINE, "Adding handler for command " + element);
+
+			_datatable.put(element.toLowerCase(), handler);
+		}
+	}
+
+	public IBypassHandler getBypassHandler(String BypassCommand)
+	{
+		String command = BypassCommand;
+
+		if (BypassCommand.indexOf(" ") != -1)
+		{
+			command = BypassCommand.substring(0, BypassCommand.indexOf(" "));
+		}
+
+		if (Config.DEBUG)
+			_log.log(Level.FINE, "getting handler for command: " + command + " -> " + (_datatable.get(command) != null));
+
+		return _datatable.get(command.toLowerCase());
+	}
+
+	public int size()
+	{
+		return _datatable.size();
+	}
+
+	@SuppressWarnings("synthetic-access")
+	private static class SingletonHolder
+	{
+		protected static final BypassHandler _instance = new BypassHandler();
+	}
+}

+ 44 - 0
L2_GameServer/java/com/l2jserver/gameserver/handler/IBypassHandler.java

@@ -0,0 +1,44 @@
+/*
+ * 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 com.l2jserver.gameserver.handler;
+
+import java.util.logging.Logger;
+
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+/**
+ * 
+ * @author nBd
+ *
+ */
+public interface IBypassHandler
+{
+	public static Logger _log = Logger.getLogger(IBypassHandler.class.getName());
+
+	/**
+	 * this is the worker method that is called when someone uses an bypass command
+	 * @param command
+	 * @param activeChar
+	 * @param target
+	 * @return success
+	 */
+	public boolean useBypass(String command, L2PcInstance activeChar, L2Character target);
+
+	/**
+	 * this method is called at initialization to register all bypasses automatically
+	 * @return all known bypasses
+	 */
+	public String[] getBypassList();
+}

+ 149 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/L2Object.java

@@ -53,15 +53,163 @@ public abstract class L2Object
     private ObjectPosition _position;
 	private int _instanceId = 0;
 
+    private InstanceType _instanceType = null; 
+
     // =========================================================
     // Constructor
     public L2Object(int objectId)
     {
-        _objectId = objectId;
+    	setInstanceType(InstanceType.L2Object);
+    	_objectId = objectId;
         initKnownList();
         initPosition();
     }
 
+    public static enum InstanceType
+    {
+    	L2Object(),
+    	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),
+    	// 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),
+    	// 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),
+    	// 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),
+    	// Sepulchers
+    	L2SepulcherNpcInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
+    	L2SepulcherMonsterInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
+    	// Festival
+    	L2FestivalGiudeInstance(L2Object, L2Character, L2Npc),
+    	L2FestivalMonsterInstance(L2Object, L2Character, L2Npc, L2Attackable, L2MonsterInstance),
+    	// Ships and controllers
+    	L2BoatInstance(L2Object, L2Character),
+    	L2AirShipInstance(L2Object, L2Character),
+    	L2AirShipControllerInstance(L2Object, L2Character, L2Npc, 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),
+    	// Fort Siege
+    	L2FortBallistaInstance(L2Object, L2Character, L2Npc),
+    	L2FortCommanderInstance(L2Object, L2Character, L2Npc, L2Attackable, 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),
+    	// 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),
+    	// Seven Signs
+    	L2CabaleBufferInstance(L2Object, L2Character, L2Npc),
+    	L2SignsPriestInstance(L2Object, L2Character, L2Npc),
+    	L2DawnPriestInstance(L2Object, L2Character, L2Npc, L2SignsPriestInstance),
+    	L2DuskPriestInstance(L2Object, L2Character, L2Npc, L2SignsPriestInstance),
+    	L2DungeonGatekeeperInstance(L2Object, L2Character, 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),
+    	// Doormens
+    	L2DoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance),
+    	L2CastleDoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2DoormenInstance),
+    	L2FortDoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance, L2DoormenInstance),
+    	L2ClanHallDoormenInstance(L2Object, L2Character, L2Npc, L2NpcInstance, 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)
+    	{
+    		long type = 1 << this.ordinal();
+    		if (type == 0)
+    			throw new Error("Too many instance types, failed to load " + this.name());
+
+    		for (InstanceType i : parents)
+    			type |= 1 << i.ordinal();
+
+    		_type = type;
+    	}
+
+    	public final boolean isType(InstanceType i)
+    	{
+    		return (_type & i._type) > 0;
+    	}
+    }
+
+    protected final void setInstanceType(InstanceType i)
+    {
+		_instanceType = i;
+    }
+
+    public final boolean isInstanceType(InstanceType i)
+    {
+    	return _instanceType.isType(i);
+    }
+
     // =========================================================
     // Event - Public
     public final void onAction(L2PcInstance player)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Attackable.java

@@ -329,6 +329,7 @@ public class L2Attackable extends L2Npc
 	public L2Attackable(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2Attackable);
 		setIsInvul(false);
 		_mustGiveExpSp = true;
 	}

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Character.java

@@ -335,6 +335,7 @@ public abstract class L2Character extends L2Object
 	public L2Character(int objectId, L2CharTemplate template)
 	{
 		super(objectId);
+		setInstanceType(InstanceType.L2Character);
 		initCharStat();
 		initCharStatus();
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Decoy.java

@@ -37,6 +37,7 @@ public abstract class L2Decoy extends L2Character
     public L2Decoy(int objectId, L2CharTemplate template, L2PcInstance owner)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2Decoy);
         _owner = owner;
         setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());
         setIsInvul(false);

+ 8 - 875
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Npc.java

@@ -16,9 +16,7 @@ package com.l2jserver.gameserver.model.actor;
 
 import static com.l2jserver.gameserver.ai.CtrlIntention.AI_INTENTION_ACTIVE;
 
-import java.text.DateFormat;
 import java.util.Collection;
-import java.util.List;
 import java.util.logging.Level;
 
 import javolution.util.FastList;
@@ -29,23 +27,15 @@ import com.l2jserver.gameserver.SevenSignsFestival;
 import com.l2jserver.gameserver.ThreadPoolManager;
 import com.l2jserver.gameserver.ai.CtrlIntention;
 import com.l2jserver.gameserver.cache.HtmCache;
-import com.l2jserver.gameserver.datatables.ClanTable;
-import com.l2jserver.gameserver.datatables.HelperBuffTable;
 import com.l2jserver.gameserver.datatables.ItemTable;
-import com.l2jserver.gameserver.datatables.SkillTable;
-import com.l2jserver.gameserver.datatables.SpawnTable;
-import com.l2jserver.gameserver.idfactory.IdFactory;
+import com.l2jserver.gameserver.handler.BypassHandler;
+import com.l2jserver.gameserver.handler.IBypassHandler;
 import com.l2jserver.gameserver.instancemanager.CastleManager;
-import com.l2jserver.gameserver.instancemanager.DimensionalRiftManager;
 import com.l2jserver.gameserver.instancemanager.FortManager;
-import com.l2jserver.gameserver.instancemanager.QuestManager;
 import com.l2jserver.gameserver.instancemanager.TownManager;
-import com.l2jserver.gameserver.instancemanager.games.Lottery;
-import com.l2jserver.gameserver.model.L2Clan;
 import com.l2jserver.gameserver.model.L2DropCategory;
 import com.l2jserver.gameserver.model.L2DropData;
 import com.l2jserver.gameserver.model.L2ItemInstance;
-import com.l2jserver.gameserver.model.L2Multisell;
 import com.l2jserver.gameserver.model.L2NpcAIData;
 import com.l2jserver.gameserver.model.L2Object;
 import com.l2jserver.gameserver.model.L2Skill;
@@ -61,7 +51,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2FishermanInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2MerchantInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
-import com.l2jserver.gameserver.model.actor.instance.L2SummonInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2TeleporterInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2TrainerInstance;
 import com.l2jserver.gameserver.model.actor.instance.L2WarehouseInstance;
@@ -73,21 +62,13 @@ import com.l2jserver.gameserver.model.entity.Fort;
 import com.l2jserver.gameserver.model.entity.L2Event;
 import com.l2jserver.gameserver.model.olympiad.Olympiad;
 import com.l2jserver.gameserver.model.quest.Quest;
-import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.model.quest.State;
 import com.l2jserver.gameserver.model.zone.type.L2TownZone;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.AbstractNpcInfo;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
-import com.l2jserver.gameserver.network.serverpackets.EtcStatusUpdate;
-import com.l2jserver.gameserver.network.serverpackets.ExShowBaseAttributeCancelWindow;
-import com.l2jserver.gameserver.network.serverpackets.ExShowVariationCancelWindow;
-import com.l2jserver.gameserver.network.serverpackets.ExShowVariationMakeWindow;
-import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
 import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
 import com.l2jserver.gameserver.network.serverpackets.MyTargetSelected;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
-import com.l2jserver.gameserver.network.serverpackets.RadarControl;
 import com.l2jserver.gameserver.network.serverpackets.ServerObjectInfo;
 import com.l2jserver.gameserver.network.serverpackets.SocialAction;
 import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
@@ -95,12 +76,10 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.network.serverpackets.ValidateLocation;
 import com.l2jserver.gameserver.skills.Stats;
 import com.l2jserver.gameserver.taskmanager.DecayTaskManager;
-import com.l2jserver.gameserver.templates.L2HelperBuff;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate.AIType;
 import com.l2jserver.gameserver.templates.item.L2Item;
 import com.l2jserver.gameserver.templates.item.L2Weapon;
-import com.l2jserver.gameserver.templates.skills.L2SkillType;
 import com.l2jserver.gameserver.util.Broadcast;
 import com.l2jserver.gameserver.util.StringUtil;
 import com.l2jserver.util.Rnd;
@@ -153,11 +132,6 @@ public class L2Npc extends L2Character
 	/** Minimum interval between social packets*/
 	private int _minimalSocialInterval = 6000;
 	
-	static final int[] pen_clear_price =
-	{
-		3600, 8640, 25200, 50400, 86400, 144000, 144000, 144000
-	};
-
 	protected RandomAnimationTask _rAniTask = null;
 	private int _currentLHandId; // normally this shouldn't change from the template, but there exist exceptions
 	private int _currentRHandId; // normally this shouldn't change from the template, but there exist exceptions
@@ -567,6 +541,7 @@ public class L2Npc extends L2Character
 		// Call the L2Character constructor to set the _template of the L2Character, copy skills from template to object
 		// and link _calculators to NPC_STD_CALCULATOR
 		super(objectId, template);
+		setInstanceType(InstanceType.L2Npc);
 		initCharStatusUpdateValues();
 
 		// initialize the "current" equipment
@@ -1415,267 +1390,13 @@ public class L2Npc extends L2Character
 				html.replace("%playername%", player.getName());
 				player.sendPacket(html);
 			}
-			else if (command.equalsIgnoreCase("TerritoryStatus"))
-			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-				{
-					if (getCastle().getOwnerId() > 0)
-					{
-						html.setFile(player.getHtmlPrefix(), "data/html/territorystatus.htm");
-						L2Clan clan = ClanTable.getInstance().getClan(getCastle().getOwnerId());
-						html.replace("%clanname%", clan.getName());
-						html.replace("%clanleadername%", clan.getLeaderName());
-					}
-					else
-					{
-						html.setFile(player.getHtmlPrefix(), "data/html/territorynoclan.htm");
-					}
-				}
-				html.replace("%castlename%", getCastle().getName());
-				html.replace("%taxpercent%", "" + getCastle().getTaxPercent());
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				{
-					if (getCastle().getCastleId() > 6)
-					{
-						html.replace("%territory%", "The Kingdom of Elmore");
-					}
-					else
-					{
-						html.replace("%territory%", "The Kingdom of Aden");
-					}
-				}
-				player.sendPacket(html);
-			}
-			else if (command.startsWith("Quest"))
-			{
-				String quest = "";
-				try
-				{
-					quest = command.substring(5).trim();
-				}
-				catch (IndexOutOfBoundsException ioobe)
-				{
-				}
-				if (quest.length() == 0)
-					showQuestWindow(player);
-				else
-					showQuestWindow(player, quest);
-			}
-			else if (command.startsWith("Chat"))
-			{
-				int val = 0;
-				try
-				{
-					val = Integer.parseInt(command.substring(5));
-				}
-				catch (IndexOutOfBoundsException ioobe)
-				{
-				}
-				catch (NumberFormatException nfe)
-				{
-				}
-				showChatWindow(player, val);
-			}
-			else if (command.startsWith("Link"))
-			{
-				String path = command.substring(5).trim();
-				if (path.indexOf("..") != -1)
-					return;
-				String filename = "data/html/" + path;
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-				html.setFile(player.getHtmlPrefix(), filename);
-				html.replace("%objectId%", String.valueOf(getObjectId()));
-				player.sendPacket(html);
-			}
-			else if (command.startsWith("NobleTeleport"))
-			{
-				if (!player.isNoble())
-				{
-					String filename = "data/html/teleporter/nobleteleporter-no.htm";
-					NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-					html.setFile(player.getHtmlPrefix(), filename);
-					html.replace("%objectId%", String.valueOf(getObjectId()));
-					html.replace("%npcname%", getName());
-					player.sendPacket(html);
-					return;
-				}
-				int val = 0;
-				try
-				{
-					val = Integer.parseInt(command.substring(5));
-				}
-				catch (IndexOutOfBoundsException ioobe)
-				{
-				}
-				catch (NumberFormatException nfe)
-				{
-				}
-				showChatWindow(player, val);
-			}
-			else if (command.startsWith("Loto"))
-			{
-				int val = 0;
-				try
-				{
-					val = Integer.parseInt(command.substring(5));
-				}
-				catch (IndexOutOfBoundsException ioobe)
-				{
-				}
-				catch (NumberFormatException nfe)
-				{
-				}
-				if (val == 0)
-				{
-					// new loto ticket
-					for (int i = 0; i < 5; i++)
-						player.setLoto(i, 0);
-				}
-				showLotoWindow(player, val);
-			}
-			else if (command.startsWith("CPRecovery"))
-			{
-				makeCPRecovery(player);
-			}
-			else if (command.startsWith("SupportMagicServitor"))
-			{
-				makeSupportMagic(player,true);
-			}
-			else if (command.startsWith("SupportMagic"))
-			{
-				makeSupportMagic(player,false);
-			}
-			else if (command.startsWith("GiveBlessing"))
-			{
-				giveBlessingSupport(player);
-			}
-			else if (command.startsWith("multisell"))
-			{
-				int listId = Integer.parseInt(command.substring(9).trim());
-				L2Multisell.getInstance().separateAndSend(listId, player, getNpcId(), false, getCastle().getTaxRate());
-			}
-			else if (command.startsWith("exc_multisell"))
-			{
-				int listId = Integer.parseInt(command.substring(13).trim());
-				L2Multisell.getInstance().separateAndSend(listId, player, getNpcId(), true, getCastle().getTaxRate());
-			}
-			else if (command.startsWith("Augment"))
-			{
-				int cmdChoice = Integer.parseInt(command.substring(8, 9).trim());
-				switch (cmdChoice)
-				{
-					case 1:
-						player.sendPacket(new ExShowVariationMakeWindow());
-						break;
-					case 2:
-						player.sendPacket(new ExShowVariationCancelWindow());
-						break;
-				}
-			}
-			else if (command.startsWith("npcfind_byid"))
-			{
-				try
-				{
-					L2Spawn spawn = SpawnTable.getInstance().getTemplate(Integer.parseInt(command.substring(12).trim()));
-					
-					if (spawn != null)
-					{
-						player.sendPacket(new RadarControl(2, 2, spawn.getLocx(), spawn.getLocy(), spawn.getLocz()));
-						player.sendPacket(new RadarControl(0, 1, spawn.getLocx(), spawn.getLocy(), spawn.getLocz()));
-					}
-				}
-				catch (NumberFormatException nfe)
-				{
-					player.sendMessage("Wrong command parameters");
-				}
-			}
-			else if (command.startsWith("EnterRift"))
-			{
-				try
-				{
-					Byte b1 = Byte.parseByte(command.substring(10)); // Selected Area: Recruit, Soldier etc
-					DimensionalRiftManager.getInstance().start(player, b1, this);
-				}
-				catch (Exception e)
-				{
-				}
-			}
-			else if (command.startsWith("ChangeRiftRoom"))
-			{
-				if (player.isInParty() && player.getParty().isInDimensionalRift())
-				{
-					player.getParty().getDimensionalRift().manualTeleport(player, this);
-				}
-				else
-				{
-					DimensionalRiftManager.getInstance().handleCheat(player, this);
-				}
-			}
-			else if (command.startsWith("remove_dp"))
-			{
-				int cmdChoice = Integer.parseInt(command.substring(10, 11).trim());
-				switch (cmdChoice)
-				{
-					case 1:
-						String filename = "data/html/default/30981-1.htm";
-						NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-						html.setFile(player.getHtmlPrefix(), filename);
-						html.replace("%objectId%", String.valueOf(getObjectId()));
-						html.replace("%dp_price%", String.valueOf(pen_clear_price[player.getExpertiseIndex()]));
-						player.sendPacket(html);
-						break;
-					case 2:
-						NpcHtmlMessage Reply = new NpcHtmlMessage(getObjectId());
-                                                final StringBuilder replyMSG = StringUtil.startAppend(400,
-                                                        "<html><body>Black Judge:<br>"
-                                                        );
-
-						if (player.getDeathPenaltyBuffLevel() > 0)
-						{
-							if (player.getAdena() >= pen_clear_price[player.getExpertiseIndex()])
-							{
-								if (!player.reduceAdena("DeathPenality", pen_clear_price[player.getExpertiseIndex()], this, true))
-									return;
-								player.setDeathPenaltyBuffLevel(player.getDeathPenaltyBuffLevel() - 1);
-								player.sendPacket(new SystemMessage(SystemMessageId.DEATH_PENALTY_LIFTED));
-								player.sendPacket(new EtcStatusUpdate(player));
-								return;
-							}
-							else
-							{
-								replyMSG.append("The wound you have received from death's touch is too deep to be healed for the money you have to give me. Find more money if you wish death's mark to be fully removed from you.");
-							}
-						}
-						else 
-						{
-							replyMSG.append("You have no more death wounds that require healing.<br>" +
-                                                                "Go forth and fight, both for this world and your own glory.");
-						}
-						
-						replyMSG.append("</body></html>");
-						Reply.setHtml(replyMSG.toString());
-						player.sendPacket(Reply);
-						break;
-				}
-			}
-			else if (command.startsWith("ExitRift"))
-			{
-				if (player.isInParty() && player.getParty().isInDimensionalRift())
-				{
-					player.getParty().getDimensionalRift().manualExitRift(player, this);
-				}
-				else
-				{
-					DimensionalRiftManager.getInstance().handleCheat(player, this);
-				}
-			}
-			else if (command.startsWith("ReleaseAttribute"))
-			{
-				player.sendPacket(new ExShowBaseAttributeCancelWindow(player));
-			}
 			else 
 			{
-				_log.info(getClass().getSimpleName()+": Unknown NPC bypass: \""+command+"\" NpcId: "+getNpcId());
+				IBypassHandler handler = BypassHandler.getInstance().getBypassHandler(command);
+				if (handler != null)
+					handler.useBypass(command, player, this);
+				else
+					_log.info(getClass().getSimpleName()+": Unknown NPC bypass: \""+command+"\" NpcId: "+getNpcId());
 			}
 		}
 	}
@@ -1711,30 +1432,6 @@ public class L2Npc extends L2Character
 		return (L2Weapon) item;
 	}
 
-	public void giveBlessingSupport(L2PcInstance player)
-	{
-		if (player == null)
-			return;
-
-		// Blessing of protection - author kerberos_20. Used codes from Rayan - L2Emu project.
-		// Prevent a cursed weapon weilder of being buffed - I think no need of that becouse karma check > 0
-		// if (player.isCursedWeaponEquiped()) 
-		//   return; 
-
-		int player_level = player.getLevel();
-		// Select the player 
-		setTarget(player);
-		// If the player is too high level, display a message and return 
-		if (player_level > 39 || player.getClassId().level() >= 2)
-		{
-			String content = "<html><body>Newbie Guide:<br>I'm sorry, but you are not eligible to receive the protection blessing.<br1>It can only be bestowed on <font color=\"LEVEL\">characters below level 39 who have not made a seccond transfer.</font></body></html>";
-			insertObjectIdAndShowChatWindow(player, content);
-			return;
-		}
-		L2Skill skill = SkillTable.FrequentSkill.BLESSING_OF_PROTECTION.getSkill();
-		doCast(skill);
-	}
-
 	/**
 	 * Return null (regular NPCs don't have weapons instancies).<BR><BR>
 	 */
@@ -1824,570 +1521,6 @@ public class L2Npc extends L2Character
 		return "data/html/npcdefault.htm";
 	}
 
-	/**
-	 * Open a choose quest window on client with all quests available of the L2NpcInstance.<BR><BR>
-	 * 
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance </li><BR><BR>
-	 * 
-	 * @param player The L2PcInstance that talk with the L2NpcInstance
-	 * @param quests The table containing quests of the L2NpcInstance
-	 * 
-	 */
-	public void showQuestChooseWindow(L2PcInstance player, Quest[] quests)
-	{
-		final StringBuilder sb = StringUtil.startAppend(150,
-				"<html><body>"
-		);
-		for (Quest q : quests)
-		{
-			StringUtil.append(sb,
-					"<a action=\"bypass -h npc_",
-					String.valueOf(getObjectId()),
-					"_Quest ",
-					q.getName(),
-					"\">[",
-					q.getDescr()
-			);
-
-			QuestState qs = player.getQuestState(q.getScriptName());
-			if (qs != null)
-			{
-				if (qs.getState() == State.STARTED && qs.getInt("cond") > 0)
-					sb.append(" (In Progress)");
-				else if (qs.getState() == State.COMPLETED)
-					sb.append(" (Done)");
-			}
-			sb.append("]</a><br>");
-		}
-
-		sb.append("</body></html>");
-
-		// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
-		insertObjectIdAndShowChatWindow(player, sb.toString());
-	}
-
-	/**
-	 * Open a quest window on client with the text of the L2NpcInstance.<BR><BR>
-	 * 
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Get the text of the quest state in the folder data/scripts/quests/questId/stateId.htm </li>
-	 * <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance </li>
-	 * <li>Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet </li><BR><BR>
-	 * 
-	 * @param player The L2PcInstance that talk with the L2NpcInstance
-	 * @param questId The Identifier of the quest to display the message
-	 * 
-	 */
-	public void showQuestWindow(L2PcInstance player, String questId)
-	{
-		String content = null;
-
-		Quest q = QuestManager.getInstance().getQuest(questId);
-
-		// Get the state of the selected quest
-		QuestState qs = player.getQuestState(questId);
-
-		if (q == null)
-		{
-			// no quests found
-			content = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>";
-		}
-		else
-		{
-			if ((q.getQuestIntId() >= 1 && q.getQuestIntId() < 20000) && (player.getWeightPenalty() >= 3 || player.getInventoryLimit() * 0.8 <= player.getInventory().getSize()))
-			{
-				player.sendPacket(new SystemMessage(SystemMessageId.INVENTORY_LESS_THAN_80_PERCENT));
-				return;
-			}
-
-			if (qs == null)
-			{
-				if (q.getQuestIntId() >= 1 && q.getQuestIntId() < 20000)
-				{
-					Quest[] questList = player.getAllActiveQuests();
-					if (questList.length >= 25) // if too many ongoing quests, don't show window and send message
-					{
-						player.sendPacket(new SystemMessage(SystemMessageId.TOO_MANY_QUESTS));
-						return;
-					}
-				}
-				// check for start point
-				Quest[] qlst = getTemplate().getEventQuests(Quest.QuestEventType.QUEST_START);
-
-				if (qlst != null && qlst.length > 0)
-				{
-					for (Quest temp : qlst)
-					{
-						if (temp == q)
-						{
-							qs = q.newQuestState(player);
-							break;
-						}
-					}
-				}
-			}
-		}
-
-		if (qs != null)
-		{
-			// If the quest is alreday started, no need to show a window
-			if (!qs.getQuest().notifyTalk(this, qs))
-				return;
-
-			questId = qs.getQuest().getName();
-			String stateId = State.getStateName(qs.getState());
-			String path = "data/scripts/quests/" + questId + "/" + stateId + ".htm";
-			content = HtmCache.getInstance().getHtm(player.getHtmlPrefix(), path); //TODO path for quests html
-
-			if (Config.DEBUG)
-			{
-				if (content != null)
-				{
-					_log.fine("Showing quest window for quest " + questId + " html path: " + path);
-				}
-				else
-				{
-					_log.fine("File not exists for quest " + questId + " html path: " + path);
-				}
-			}
-		}
-
-		// Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
-		if (content != null)
-			insertObjectIdAndShowChatWindow(player, content);
-
-		// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
-		player.sendPacket(ActionFailed.STATIC_PACKET);
-	}
-
-	/**
-	 * Collect awaiting quests/start points and display a QuestChooseWindow (if several available) or QuestWindow.<BR><BR>
-	 * 
-	 * @param player The L2PcInstance that talk with the L2NpcInstance
-	 * 
-	 */
-	public void showQuestWindow(L2PcInstance player)
-	{
-		// collect awaiting quests and start points
-		List<Quest> options = new FastList<Quest>();
-
-		QuestState[] awaits = player.getQuestsForTalk(getTemplate().npcId);
-		Quest[] starts = getTemplate().getEventQuests(Quest.QuestEventType.QUEST_START);
-
-		// Quests are limited between 1 and 999 because those are the quests that are supported by the client.  
-		// By limiting them there, we are allowed to create custom quests at higher IDs without interfering  
-		if (awaits != null)
-		{
-			for (QuestState x : awaits)
-			{
-				if (!options.contains(x.getQuest()))
-					if ((x.getQuest().getQuestIntId() > 0) && (x.getQuest().getQuestIntId() < 20000))
-						options.add(x.getQuest());
-			}
-		}
-
-		if (starts != null)
-		{
-			for (Quest x : starts)
-			{
-				if (!options.contains(x))
-					if ((x.getQuestIntId() > 0) && (x.getQuestIntId() < 20000))
-						options.add(x);
-			}
-		}
-
-		// Display a QuestChooseWindow (if several quests are available) or QuestWindow
-		if (options.size() > 1)
-		{
-			showQuestChooseWindow(player, options.toArray(new Quest[options.size()]));
-		}
-		else if (options.size() == 1)
-		{
-			showQuestWindow(player, options.get(0).getName());
-		}
-		else
-		{
-			showQuestWindow(player, "");
-		}
-	}
-
-	/**
-	 * Open a Loto window on client with the text of the L2NpcInstance.<BR><BR>
-	 * 
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Get the text of the selected HTML file in function of the npcId and of the page number </li>
-	 * <li>Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance </li>
-	 * <li>Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet </li><BR>
-	 * 
-	 * @param player The L2PcInstance that talk with the L2NpcInstance
-	 * @param val The number of the page of the L2NpcInstance to display
-	 * 
-	 */
-	// 0 - first buy lottery ticket window
-	// 1-20 - buttons
-	// 21 - second buy lottery ticket window
-	// 22 - selected ticket with 5 numbers
-	// 23 - current lottery jackpot
-	// 24 - Previous winning numbers/Prize claim
-	// >24 - check lottery ticket by item object id
-	public void showLotoWindow(L2PcInstance player, int val)
-	{
-		int npcId = getTemplate().npcId;
-		String filename;
-		SystemMessage sm;
-		NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-
-		if (val == 0) // 0 - first buy lottery ticket window
-		{
-			filename = (getHtmlPath(npcId, 1));
-			html.setFile(player.getHtmlPrefix(), filename);
-		}
-		else if (val >= 1 && val <= 21) // 1-20 - buttons, 21 - second buy lottery ticket window
-		{
-			if (!Lottery.getInstance().isStarted())
-			{
-				//tickets can't be sold
-				player.sendPacket(new SystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_CURRENT_SOLD));
-				return;
-			}
-			if (!Lottery.getInstance().isSellableTickets())
-			{
-				//tickets can't be sold
-				player.sendPacket(new SystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_AVAILABLE));
-				return;
-			}
-
-			filename = (getHtmlPath(npcId, 5));
-			html.setFile(player.getHtmlPrefix(), filename);
-
-			int count = 0;
-			int found = 0;
-			// counting buttons and unsetting button if found
-			for (int i = 0; i < 5; i++)
-			{
-				if (player.getLoto(i) == val)
-				{
-					//unsetting button
-					player.setLoto(i, 0);
-					found = 1;
-				}
-				else if (player.getLoto(i) > 0)
-				{
-					count++;
-				}
-			}
-
-			//if not rearched limit 5 and not unseted value
-			if (count < 5 && found == 0 && val <= 20)
-				for (int i = 0; i < 5; i++)
-					if (player.getLoto(i) == 0)
-					{
-						player.setLoto(i, val);
-						break;
-					}
-
-			//setting pusshed buttons
-			count = 0;
-			for (int i = 0; i < 5; i++)
-				if (player.getLoto(i) > 0)
-				{
-					count++;
-					String button = String.valueOf(player.getLoto(i));
-					if (player.getLoto(i) < 10)
-						button = "0" + button;
-					String search = "fore=\"L2UI.lottoNum" + button + "\" back=\"L2UI.lottoNum" + button + "a_check\"";
-					String replace = "fore=\"L2UI.lottoNum" + button + "a_check\" back=\"L2UI.lottoNum" + button + "\"";
-					html.replace(search, replace);
-				}
-
-			if (count == 5)
-			{
-				String search = "0\">Return";
-				String replace = "22\">The winner selected the numbers above.";
-				html.replace(search, replace);
-			}
-		}
-		else if (val == 22) //22 - selected ticket with 5 numbers
-		{
-			if (!Lottery.getInstance().isStarted())
-			{
-				//tickets can't be sold
-				player.sendPacket(new SystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_CURRENT_SOLD));
-				return;
-			}
-			if (!Lottery.getInstance().isSellableTickets())
-			{
-				//tickets can't be sold
-				player.sendPacket(new SystemMessage(SystemMessageId.NO_LOTTERY_TICKETS_AVAILABLE));
-				return;
-			}
-
-			long price = Config.ALT_LOTTERY_TICKET_PRICE;
-			int lotonumber = Lottery.getInstance().getId();
-			int enchant = 0;
-			int type2 = 0;
-
-			for (int i = 0; i < 5; i++)
-			{
-				if (player.getLoto(i) == 0)
-					return;
-				
-				if (player.getLoto(i) < 17)
-					enchant += Math.pow(2, player.getLoto(i) - 1);
-				else
-					type2 += Math.pow(2, player.getLoto(i) - 17);
-			}
-			if (player.getAdena() < price)
-			{
-				sm = new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
-				player.sendPacket(sm);
-				return;
-			}
-			if (!player.reduceAdena("Loto", price, this, true))
-				return;
-			Lottery.getInstance().increasePrize(price);
-
-			sm = new SystemMessage(SystemMessageId.ACQUIRED_S1_S2);
-			sm.addNumber(lotonumber);
-			sm.addItemName(4442);
-			player.sendPacket(sm);
-
-			L2ItemInstance item = new L2ItemInstance(IdFactory.getInstance().getNextId(), 4442);
-			item.setCount(1);
-			item.setCustomType1(lotonumber);
-			item.setEnchantLevel(enchant);
-			item.setCustomType2(type2);
-			player.getInventory().addItem("Loto", item, player, this);
-
-			InventoryUpdate iu = new InventoryUpdate();
-			iu.addItem(item);
-			L2ItemInstance adenaupdate = player.getInventory().getItemByItemId(57);
-			iu.addModifiedItem(adenaupdate);
-			player.sendPacket(iu);
-
-			filename = (getHtmlPath(npcId, 3));
-			html.setFile(player.getHtmlPrefix(), filename);
-		}
-		else if (val == 23) //23 - current lottery jackpot
-		{
-			filename = (getHtmlPath(npcId, 3));
-			html.setFile(player.getHtmlPrefix(), filename);
-		}
-		else if (val == 24) // 24 - Previous winning numbers/Prize claim
-		{
-			filename = (getHtmlPath(npcId, 4));
-			html.setFile(player.getHtmlPrefix(), filename);
-
-			int lotonumber = Lottery.getInstance().getId();
-			String message = "";
-			for (L2ItemInstance item : player.getInventory().getItems())
-			{
-				if (item == null)
-					continue;
-				if (item.getItemId() == 4442 && item.getCustomType1() < lotonumber)
-				{
-					message = message + "<a action=\"bypass -h npc_%objectId%_Loto " + item.getObjectId() + "\">" + item.getCustomType1() + " Event Number ";
-					int[] numbers = Lottery.getInstance().decodeNumbers(item.getEnchantLevel(), item.getCustomType2());
-					for (int i = 0; i < 5; i++)
-					{
-						message += numbers[i] + " ";
-					}
-					long[] check = Lottery.getInstance().checkTicket(item);
-					if (check[0] > 0)
-					{
-						switch ((int)check[0])
-						{
-							case 1:
-								message += "- 1st Prize";
-								break;
-							case 2:
-								message += "- 2nd Prize";
-								break;
-							case 3:
-								message += "- 3th Prize";
-								break;
-							case 4:
-								message += "- 4th Prize";
-								break;
-						}
-						message += " " + check[1] + "a.";
-					}
-					message += "</a><br>";
-				}
-			}
-			if (message.isEmpty())
-			{
-				message += "There is no winning lottery ticket...<br>";
-			}
-			html.replace("%result%", message);
-		}
-		else if (val > 24) // >24 - check lottery ticket by item object id
-		{
-			int lotonumber = Lottery.getInstance().getId();
-			L2ItemInstance item = player.getInventory().getItemByObjectId(val);
-			if (item == null || item.getItemId() != 4442 || item.getCustomType1() >= lotonumber)
-				return;
-			long[] check = Lottery.getInstance().checkTicket(item);
-
-			sm = new SystemMessage(SystemMessageId.S2_S1_DISAPPEARED);
-			sm.addItemName(4442);
-			sm.addItemNumber(1);
-			player.sendPacket(sm);
-
-			long adena = check[1];
-			if (adena > 0)
-				player.addAdena("Loto", adena, this, true);
-			player.destroyItem("Loto", item, this, false);
-			return;
-		}
-		html.replace("%objectId%", String.valueOf(getObjectId()));
-		html.replace("%race%", "" + Lottery.getInstance().getId());
-		html.replace("%adena%", "" + Lottery.getInstance().getPrize());
-		html.replace("%ticket_price%", "" + Config.ALT_LOTTERY_TICKET_PRICE);
-		html.replace("%prize5%", "" + (Config.ALT_LOTTERY_5_NUMBER_RATE * 100));
-		html.replace("%prize4%", "" + (Config.ALT_LOTTERY_4_NUMBER_RATE * 100));
-		html.replace("%prize3%", "" + (Config.ALT_LOTTERY_3_NUMBER_RATE * 100));
-		html.replace("%prize2%", "" + Config.ALT_LOTTERY_2_AND_1_NUMBER_PRIZE);
-		html.replace("%enddate%", "" + DateFormat.getDateInstance().format(Lottery.getInstance().getEndDate()));
-		player.sendPacket(html);
-
-		// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
-		player.sendPacket(ActionFailed.STATIC_PACKET);
-	}
-
-	public void makeCPRecovery(L2PcInstance player)
-	{
-		if (getNpcId() != 31225 && getNpcId() != 31226)
-			return;
-		if (player.isCursedWeaponEquipped())
-		{
-			player.sendMessage("Go away, you're not welcome here.");
-			player.sendPacket(ActionFailed.STATIC_PACKET);
-			return;
-		}
-
-		int neededmoney = 100;
-		if (!player.reduceAdena("RestoreCP", neededmoney, player.getLastFolkNPC(), true))
-			return;
-		L2Skill skill = SkillTable.getInstance().getInfo(4380, 1);
-		if (skill != null)
-		{
-			setTarget(player);
-			doCast(skill);
-		}
-		player.sendPacket(ActionFailed.STATIC_PACKET);
-	}
-
-	/**
-	 * Add Newbie helper buffs to L2Player according to its level.<BR><BR>
-	 * 
-	 * <B><U> Actions</U> :</B><BR><BR>
-	 * <li>Get the range level in wich player must be to obtain buff </li>
-	 * <li>If player level is out of range, display a message and return </li>
-	 * <li>According to player level cast buff </li><BR><BR>
-	 * 
-	 * <FONT COLOR=#FF0000><B> Newbie Helper Buff list is define in sql table helper_buff_list</B></FONT><BR><BR>
-	 * 
-	 * @param player The L2PcInstance that talk with the L2NpcInstance
-	 * 
-	 */
-	public void makeSupportMagic(L2PcInstance player, boolean isSummon)
-	{
-		if (player == null)
-			return;
-
-		// Prevent a cursed weapon weilder of being buffed
-		if (player.isCursedWeaponEquipped())
-			return;
-
-		int player_level = player.getLevel();
-		int lowestLevel = 0;
-		int highestLevel = 0;
-
-		if (isSummon)
-		{
-			if (player.getPet() == null || !(player.getPet() instanceof L2SummonInstance))
-			{
-				String content = "<html><body>Only servitors can receive this Support Magic. If you do not have a servitor, you cannot access these spells.</body></html>";
-				insertObjectIdAndShowChatWindow(player, content);
-				return;
-			}
-			setTarget(player.getPet());
-		}
-		else
-			// 	Select the player
-			setTarget(player);
-
-		if (isSummon)
-		{
-			lowestLevel = HelperBuffTable.getInstance().getServitorLowestLevel();
-			highestLevel = HelperBuffTable.getInstance().getServitorHighestLevel();
-		}
-		else
-		{
-			// 	Calculate the min and max level between which the player must be to obtain buff
-			if (player.isMageClass())
-			{
-				lowestLevel = HelperBuffTable.getInstance().getMagicClassLowestLevel();
-				highestLevel = HelperBuffTable.getInstance().getMagicClassHighestLevel();
-			}
-			else
-			{
-				lowestLevel = HelperBuffTable.getInstance().getPhysicClassLowestLevel();
-				highestLevel = HelperBuffTable.getInstance().getPhysicClassHighestLevel();
-			}
-		}
-		// If the player is too high level, display a message and return
-		if (player_level > highestLevel)
-		{
-			String content = "<html><body>Newbie Guide:<br>Only a <font color=\"LEVEL\">novice character of level " + highestLevel
-					+ " or less</font> can receive my support magic.<br>Your novice character is the first one that you created and raised in this world.</body></html>";
-			insertObjectIdAndShowChatWindow(player, content);
-			return;
-		}
-
-		// If the player is too low level, display a message and return
-		if (player_level < lowestLevel)
-		{
-			String content = "<html><body>Come back here when you have reached level " + lowestLevel + ". I will give you support magic then.</body></html>";
-			insertObjectIdAndShowChatWindow(player, content);
-			return;
-		}
-
-		L2Skill skill = null;
-		if (isSummon)
-		{
-			for (L2HelperBuff helperBuffItem : HelperBuffTable.getInstance().getHelperBuffTable())
-			{
-				if (helperBuffItem.isForSummon())
-				{
-					skill = SkillTable.getInstance().getInfo(helperBuffItem.getSkillID(), helperBuffItem.getSkillLevel());
-					if (skill != null)
-						doCast(skill);
-				}
-			}
-		}
-		else
-		{
-			// 	Go through the Helper Buff list define in sql table helper_buff_list and cast skill
-			for (L2HelperBuff helperBuffItem : HelperBuffTable.getInstance().getHelperBuffTable())
-			{
-				if (helperBuffItem.isMagicClassBuff() == player.isMageClass())
-				{
-					if (player_level >= helperBuffItem.getLowerLevel() && player_level <= helperBuffItem.getUpperLevel())
-					{
-						skill = SkillTable.getInstance().getInfo(helperBuffItem.getSkillID(), helperBuffItem.getSkillLevel());
-						if (skill.getSkillType() == L2SkillType.SUMMON)
-							player.doSimultaneousCast(skill);
-						else
-							doCast(skill);
-					}
-				}
-			}
-		}
-	}
-
 	public void showChatWindow(L2PcInstance player)
 	{
 		showChatWindow(player, 0);

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Playable.java

@@ -57,6 +57,7 @@ public abstract class L2Playable extends L2Character
 	public L2Playable(int objectId, L2CharTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2Playable);
 		setIsInvul(false);
 	}
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Summon.java

@@ -90,6 +90,7 @@ public abstract class L2Summon extends L2Playable
 	public L2Summon(int objectId, L2NpcTemplate template, L2PcInstance owner)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2Summon);
 
         setInstanceId(owner.getInstanceId()); // set instance to same as owner
         

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/L2Trap.java

@@ -53,6 +53,7 @@ public class L2Trap extends L2Character
 	public L2Trap(int objectId, L2NpcTemplate template, int lifeTime, L2Skill skill)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2Trap);
 		setName(template.name);
 		setIsInvul(false);
 

+ 1 - 10
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AdventurerInstance.java

@@ -14,7 +14,6 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
-import com.l2jserver.gameserver.network.serverpackets.ExShowQuestInfo;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
 
 /**
@@ -28,15 +27,7 @@ public class L2AdventurerInstance extends L2NpcInstance
 	public L2AdventurerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
-	}
-
-	@Override
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		if (command.equalsIgnoreCase("questlist"))
-			player.sendPacket(new ExShowQuestInfo());
-		else
-			super.onBypassFeedback(player, command);
+		setInstanceType(InstanceType.L2AdventurerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipControllerInstance.java

@@ -36,6 +36,7 @@ public class L2AirShipControllerInstance extends L2NpcInstance
 	public L2AirShipControllerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2AirShipControllerInstance);
 		AirShipManager.getInstance().registerATC(this);
 	}
 

+ 2 - 1
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AirShipInstance.java

@@ -63,7 +63,7 @@ public class L2AirShipInstance extends L2Character
 		protected class L2AirShipPoint
 		{
 			public int speed1 = 350;
-			public int speed2 = 4000;
+			//public int speed2 = 4000;
 			public int x;
 			public int y;
 			public int z;
@@ -189,6 +189,7 @@ public class L2AirShipInstance extends L2Character
 	public L2AirShipInstance(int objectId, L2CharTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2AirShipInstance);
 		setAI(new L2CharacterAI(new AIAccessor()));
 	}	
 	

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ArtefactInstance.java

@@ -53,6 +53,7 @@ public final class L2ArtefactInstance extends L2Npc
 	public L2ArtefactInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ArtefactInstance);
 	}
 
 	/**

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2AuctioneerInstance.java

@@ -48,6 +48,7 @@ public final class L2AuctioneerInstance extends L2Npc
 	public L2AuctioneerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2AuctioneerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2BabyPetInstance.java

@@ -55,6 +55,7 @@ public final class L2BabyPetInstance extends L2PetInstance
 	public L2BabyPetInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
 	{
 		super(objectId, template, owner, control);
+		setInstanceType(InstanceType.L2BabyPetInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2BoatInstance.java

@@ -257,6 +257,7 @@ public class L2BoatInstance extends L2Character
 	public L2BoatInstance(int objectId, L2CharTemplate template, String name)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2BoatInstance);
 		setAI(new L2CharacterAI(new AIAccessor()));
 		/*
 		 * super.setStat(new DoorStat(new L2DoorInstance[] {this}));

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CabaleBufferInstance.java

@@ -193,6 +193,7 @@ public class L2CabaleBufferInstance extends L2Npc
     public L2CabaleBufferInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2CabaleBufferInstance);
 
         if (_aiTask != null)
         	_aiTask.cancel(true);

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleBlacksmithInstance.java

@@ -31,6 +31,7 @@ public class L2CastleBlacksmithInstance extends L2NpcInstance
 	public L2CastleBlacksmithInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2CastleBlacksmithInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleChamberlainInstance.java

@@ -63,6 +63,7 @@ public class L2CastleChamberlainInstance extends L2MerchantInstance
 	public L2CastleChamberlainInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2CastleChamberlainInstance);
 	}
 
 	private void sendHtmlMessage(L2PcInstance player, NpcHtmlMessage html)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleDoormenInstance.java

@@ -25,6 +25,7 @@ public class L2CastleDoormenInstance extends L2DoormenInstance
 	public L2CastleDoormenInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2CastleDoormenInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleMagicianInstance.java

@@ -52,6 +52,7 @@ public class L2CastleMagicianInstance extends L2NpcInstance
 	public L2CastleMagicianInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2CastleMagicianInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleTeleporterInstance.java

@@ -39,6 +39,7 @@ public final class L2CastleTeleporterInstance extends L2Npc
 	public L2CastleTeleporterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2CastleTeleporterInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleWarehouseInstance.java

@@ -42,6 +42,7 @@ public class L2CastleWarehouseInstance extends L2NpcInstance
 	public L2CastleWarehouseInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2CastleWarehouseInstance);
 	}
 
 	@Override

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2CastleWyvernManagerInstance.java

@@ -24,7 +24,7 @@ public class L2CastleWyvernManagerInstance extends L2WyvernManagerInstance
 	}
 
 	@Override
-	protected final boolean isOwnerClan(L2PcInstance player)
+	public final boolean isOwnerClan(L2PcInstance player)
 	{
 		if (player.getClan() != null && getCastle() != null)
 		{
@@ -38,7 +38,7 @@ public class L2CastleWyvernManagerInstance extends L2WyvernManagerInstance
 	 * @see com.l2jserver.gameserver.model.actor.instance.L2WyvernManagerInstance#isInSiege(com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
 	 */
 	@Override
-	protected boolean isInSiege()
+	public boolean isInSiege()
 	{
 		return getCastle().getSiege().getIsInProgress();
 	}

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ChestInstance.java

@@ -35,6 +35,7 @@ public final class L2ChestInstance extends L2MonsterInstance
 	public L2ChestInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ChestInstance);
 		setIsNoRndWalk(true);
 		_isInteracted = false;
 		_specialDrop = false;

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClanHallDoormenInstance.java

@@ -38,6 +38,7 @@ public class L2ClanHallDoormenInstance extends L2DoormenInstance
 	public L2ClanHallDoormenInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2ClanHallDoormenInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClanHallManagerInstance.java

@@ -51,6 +51,7 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
 	public L2ClanHallManagerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ClanHallManagerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClanTraderInstance.java

@@ -27,6 +27,7 @@ public final class L2ClanTraderInstance extends L2Npc
 	public L2ClanTraderInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ClanTraderInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ClassMasterInstance.java

@@ -43,6 +43,7 @@ public final class L2ClassMasterInstance extends L2NpcInstance
 	public L2ClassMasterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ClassMasterInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ControlTowerInstance.java

@@ -36,6 +36,7 @@ public class L2ControlTowerInstance extends L2Npc
 	public L2ControlTowerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ControlTowerInstance);
 		setIsInvul(false);
 	}
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ControllableMobInstance.java

@@ -57,6 +57,7 @@ public class L2ControllableMobInstance extends L2MonsterInstance
 	public L2ControllableMobInstance(int objectId, L2NpcTemplate template)
     {
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ControllableMobInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DawnPriestInstance.java

@@ -24,6 +24,7 @@ public class L2DawnPriestInstance extends L2SignsPriestInstance
 	public L2DawnPriestInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2DawnPriestInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DecoyInstance.java

@@ -37,6 +37,7 @@ public class L2DecoyInstance extends L2Decoy
     public L2DecoyInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2Skill skill)
     {
         super(objectId, template, owner);
+        setInstanceType(InstanceType.L2DecoyInstance);
         if (skill != null)
         {
             _totalLifeTime = ((L2SkillDecoy)skill).getTotalLifeTime();

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DefenderInstance.java

@@ -42,6 +42,7 @@ public class L2DefenderInstance extends L2Attackable
 	public L2DefenderInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2DefenderInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DoorInstance.java

@@ -202,6 +202,7 @@ public class L2DoorInstance extends L2Character
 	public L2DoorInstance(int objectId, L2CharTemplate template, int doorId, String name, boolean unlockable)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2DoorInstance);
 		setIsInvul(false);
 		_doorId = doorId;
 		_name = name;

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DoormenInstance.java

@@ -36,6 +36,7 @@ public class L2DoormenInstance extends L2NpcInstance
 	public L2DoormenInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2DoormenInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DungeonGatekeeperInstance.java

@@ -32,6 +32,7 @@ public class L2DungeonGatekeeperInstance extends L2Npc
 	public L2DungeonGatekeeperInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2DungeonGatekeeperInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2DuskPriestInstance.java

@@ -24,6 +24,7 @@ public class L2DuskPriestInstance extends L2SignsPriestInstance
 	public L2DuskPriestInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2DuskPriestInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2EffectPointInstance.java

@@ -26,6 +26,7 @@ public class L2EffectPointInstance extends L2Npc
 	public L2EffectPointInstance(int objectId, L2NpcTemplate template, L2Character owner)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2EffectPointInstance);
 		setIsInvul(false);
 		_owner = owner;
 	}

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FameManagerInstance.java

@@ -34,6 +34,7 @@ public class L2FameManagerInstance extends L2Npc
 	public L2FameManagerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FameManagerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FeedableBeastInstance.java

@@ -27,5 +27,6 @@ public class L2FeedableBeastInstance extends L2MonsterInstance
     public L2FeedableBeastInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2FeedableBeastInstance);
     }
 }

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FestivalGuideInstance.java

@@ -51,6 +51,7 @@ public final class L2FestivalGuideInstance extends L2Npc
     public L2FestivalGuideInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2FestivalGiudeInstance);
 
         switch (getNpcId()) {
             case 31127:

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FestivalMonsterInstance.java

@@ -45,6 +45,7 @@ public class L2FestivalMonsterInstance extends L2MonsterInstance
     public L2FestivalMonsterInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2FestivalMonsterInstance);
     }
 
     public void setOfferingBonus(int bonusMultiplier)

+ 3 - 58
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FishermanInstance.java

@@ -21,7 +21,6 @@ import com.l2jserver.gameserver.model.L2SkillLearn;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.AcquireSkillList;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
-import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
 
@@ -34,6 +33,7 @@ public class L2FishermanInstance extends L2MerchantInstance
 	public L2FishermanInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FishermanInstance);
 	}
 
 	@Override
@@ -49,55 +49,7 @@ public class L2FishermanInstance extends L2MerchantInstance
 		return "data/html/fisherman/" + pom + ".htm";
 	}
 
-	/*private void showBuyWindow(L2PcInstance player, int val)
-    {
-        double taxRate = 0;
-        if (getIsInTown()) taxRate = getCastle().getTaxRate();
-        player.tempInvetoryDisable();
-        if (Config.DEBUG) _log.fine("Showing buylist");
-        L2TradeList list = TradeController.getInstance().getBuyList(val);
-
-        if (list != null && list.getNpcId().equals(String.valueOf(getNpcId())))
-        {
-            BuyList bl = new BuyList(list, player.getAdena(), taxRate);
-            player.sendPacket(bl);
-        }
-        else
-        {
-            _log.warning("possible client hacker: " + player.getName()
-                + " attempting to buy from GM shop! < Ban him!");
-            _log.warning("buylist id:" + val);
-        }
-
-        player.sendPacket(ActionFailed.STATIC_PACKET);
-    }*/
-
-	/*private void showSellWindow(L2PcInstance player)
-    {
-        if (Config.DEBUG) _log.fine("Showing selllist");
-
-        player.sendPacket(new SellList(player));
-
-        if (Config.DEBUG) _log.fine("Showing sell window");
-
-        player.sendPacket(ActionFailed.STATIC_PACKET);
-    }*/
-
-	@Override
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		if (command.startsWith("FishSkillList"))
-		{
-			player.setSkillLearningClassId(player.getClassId());
-			showSkillList(player);
-		}
-		else
-		{
-			super.onBypassFeedback(player, command);
-		}
-	}
-
-	public void showSkillList(L2PcInstance player)
+	public static void showFishSkillList(L2PcInstance player)
 	{
 		L2SkillLearn[] skills = SkillTreeTable.getInstance().getAvailableSkills(player);
 		AcquireSkillList asl = new AcquireSkillList(AcquireSkillList.SkillType.Fishing);
@@ -117,7 +69,6 @@ public class L2FishermanInstance extends L2MerchantInstance
 
 		if (counts == 0)
 		{
-		    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
 		    int minlevel = SkillTreeTable.getInstance().getMinLevelForNewSkill(player);
 
 		    if (minlevel > 0)
@@ -128,13 +79,7 @@ public class L2FishermanInstance extends L2MerchantInstance
 		        player.sendPacket(sm);
 		    }
             else
-            {
-                html.setHtml(
-                        "<html><head><body>" +
-                        "You've learned all skills.<br>" +
-                        "</body></html>");
-                player.sendPacket(html);
-		    }
+				player.sendPacket(new SystemMessage(SystemMessageId.NO_MORE_SKILLS_TO_LEARN));
 		}
 		else
 		{

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlameTowerInstance.java

@@ -34,6 +34,7 @@ public class L2FlameTowerInstance extends L2Npc
 	public L2FlameTowerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FlameTowerInstance);
 		setIsInvul(false);
 	}
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyMinionInstance.java

@@ -22,6 +22,7 @@ public final class L2FlyMinionInstance extends L2MinionInstance
 	public L2FlyMinionInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FlyMinionInstance);
 	}
 
     @Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyMonsterInstance.java

@@ -22,6 +22,7 @@ public final class L2FlyMonsterInstance extends L2MonsterInstance
 	public L2FlyMonsterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FlyMonsterInstance);
 	}
 
     @Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyNpcInstance.java

@@ -22,6 +22,7 @@ public final class L2FlyNpcInstance extends L2NpcInstance
 	public L2FlyNpcInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FlyNpcInstance);
 	}
 
     @Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FlyRaidBossInstance.java

@@ -22,6 +22,7 @@ public final class L2FlyRaidBossInstance extends L2RaidBossInstance
 	public L2FlyRaidBossInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FlyRaidBossInstance);
 	}
 
     @Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortBallistaInstance.java

@@ -32,6 +32,7 @@ public class L2FortBallistaInstance extends L2Npc
 	public L2FortBallistaInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2FortBallistaInstance);
     }
 	
     @Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortCommanderInstance.java

@@ -37,6 +37,7 @@ public class L2FortCommanderInstance extends L2DefenderInstance
 	public L2FortCommanderInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2FortCommanderInstance);
         _canTalk = true;
     }
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortDoormenInstance.java

@@ -26,6 +26,7 @@ public class L2FortDoormenInstance extends L2DoormenInstance
 	public L2FortDoormenInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2FortDoormenInstance);
 	}
 
 	public void showChatWindow(L2PcInstance player)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortEnvoyInstance.java

@@ -27,6 +27,7 @@ public class L2FortEnvoyInstance extends L2Npc
 	public L2FortEnvoyInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2FortEnvoyInstance);
 	}
 
 	public void showChatWindow(L2PcInstance player)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortLogisticsInstance.java

@@ -30,6 +30,7 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
 	public L2FortLogisticsInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2FortLogisticsInstance);
 	}
 
 	public void onBypassFeedback(L2PcInstance player, String command)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortManagerInstance.java

@@ -47,6 +47,7 @@ public class L2FortManagerInstance extends L2MerchantInstance
 	public L2FortManagerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FortManagerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortSiegeNpcInstance.java

@@ -32,6 +32,7 @@ public class L2FortSiegeNpcInstance extends L2Npc
 	public L2FortSiegeNpcInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2FortSiegeNpcInstance);
 	}
 
 	public void onBypassFeedback(L2PcInstance player, String command)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortSupportCaptainInstance.java

@@ -31,6 +31,7 @@ public class L2FortSupportCaptainInstance extends L2MerchantInstance
 	public L2FortSupportCaptainInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2FortSupportCaptainInstance);
 	}
 
 	private final static int[] TalismanIds =

+ 2 - 2
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FortWyvernManagerInstance.java

@@ -24,7 +24,7 @@ public class L2FortWyvernManagerInstance extends L2WyvernManagerInstance
 	}
 
 	@Override
-	protected final boolean isOwnerClan(L2PcInstance player)
+	public final boolean isOwnerClan(L2PcInstance player)
 	{
 		if (player.getClan() != null && getFort() != null && getFort().getOwnerClan() != null)
 		{
@@ -38,7 +38,7 @@ public class L2FortWyvernManagerInstance extends L2WyvernManagerInstance
 	 * @see com.l2jserver.gameserver.model.actor.instance.L2WyvernManagerInstance#isInSiege(com.l2jserver.gameserver.model.actor.instance.L2PcInstance)
 	 */
 	@Override
-	protected boolean isInSiege()
+	public boolean isInSiege()
 	{
 		return getFort().getSiege().getIsInProgress();
 	}

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2FriendlyMobInstance.java

@@ -31,6 +31,7 @@ public class L2FriendlyMobInstance extends L2Attackable
 	public L2FriendlyMobInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2FriendlyMobInstance);
 	}
 
     @Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2GrandBossInstance.java

@@ -41,6 +41,7 @@ public final class L2GrandBossInstance extends L2MonsterInstance
 	public L2GrandBossInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2GrandBossInstance);
 		setIsRaid(true);
 	}
 	

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2GuardInstance.java

@@ -70,6 +70,7 @@ public final class L2GuardInstance extends L2Attackable
 	public L2GuardInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2GuardInstance);
 
         ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new ReturnTask(),RETURN_INTERVAL,RETURN_INTERVAL+Rnd.nextInt(60000));
 	}

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ManorManagerInstance.java

@@ -35,6 +35,7 @@ public class L2ManorManagerInstance extends L2MerchantInstance
 	public L2ManorManagerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2ManorManagerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MercManagerInstance.java

@@ -29,6 +29,7 @@ public final class L2MercManagerInstance extends L2MerchantInstance
 	public L2MercManagerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2MercManagerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MercenaryManagerInstance.java

@@ -33,6 +33,7 @@ public class L2MercenaryManagerInstance extends L2Npc
     public L2MercenaryManagerInstance(int objectId, L2NpcTemplate template)
     {
            super(objectId, template);
+           setInstanceType(InstanceType.L2MercenaryManagerInstance);
     }
 
 	@Override

+ 2 - 152
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantInstance.java

@@ -14,20 +14,15 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
-import java.util.StringTokenizer;
-
 import com.l2jserver.Config;
 import com.l2jserver.gameserver.TradeController;
 import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable;
 import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable.MerchantPriceConfig;
-import com.l2jserver.gameserver.model.L2Multisell;
 import com.l2jserver.gameserver.model.L2TradeList;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
 import com.l2jserver.gameserver.network.serverpackets.ExBuySellListPacket;
 import com.l2jserver.gameserver.network.serverpackets.MyTargetSelected;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
-import com.l2jserver.gameserver.network.serverpackets.SetupGauge;
-import com.l2jserver.gameserver.network.serverpackets.ShopPreviewList;
 import com.l2jserver.gameserver.network.serverpackets.StatusUpdate;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
 import com.l2jserver.gameserver.util.StringUtil;
@@ -47,6 +42,7 @@ public class L2MerchantInstance extends L2NpcInstance
 	public L2MerchantInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2MerchantInstance);
 	}
 
 	@Override
@@ -75,28 +71,7 @@ public class L2MerchantInstance extends L2NpcInstance
 		return _mpc;
 	}
 
-	private final void showWearWindow(L2PcInstance player, int val)
-	{
-		player.tempInventoryDisable();
-
-		if (Config.DEBUG)
-			_log.fine("Showing wearlist");
-
-		L2TradeList list = TradeController.getInstance().getBuyList(val);
-
-		if (list != null)
-		{
-			ShopPreviewList bl = new ShopPreviewList(list, player.getAdena(), player.getExpertiseIndex());
-			player.sendPacket(bl);
-		}
-		else
-		{
-			_log.warning("no buylist with id:" + val);
-			player.sendPacket(ActionFailed.STATIC_PACKET);
-		}
-	}
-
-	protected final void showBuyWindow(L2PcInstance player, int val)
+	public final void showBuyWindow(L2PcInstance player, int val)
 	{
 		double taxRate = 0;
 
@@ -120,131 +95,6 @@ public class L2MerchantInstance extends L2NpcInstance
 		player.sendPacket(ActionFailed.STATIC_PACKET);
 	}
 
-	@Override
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		StringTokenizer st = new StringTokenizer(command, " ");
-		String actualCommand = st.nextToken(); // Get actual command
-
-		if (actualCommand.equalsIgnoreCase("Buy"))
-		{
-			if (st.countTokens() < 1)
-				return;
-
-			int val = Integer.parseInt(st.nextToken());
-			showBuyWindow(player, val);
-		}
-		else if (actualCommand.equalsIgnoreCase("BuyShadowItem"))
-		{
-			NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-			if (player.getLevel() >= 40)
-				html.setFile(player.getHtmlPrefix(), "data/html/merchant/shadow_item.htm");
-			else
-				html.setFile(player.getHtmlPrefix(), "data/html/merchant/shadow_item-lowlevel.htm");
-			html.replace("%objectId%", String.valueOf(getObjectId()));
-			player.sendPacket(html);
-		}
-		else if (actualCommand.equalsIgnoreCase("RentPet"))
-		{
-			if (Config.ALLOW_RENTPET)
-			{
-				if (st.countTokens() < 1)
-				{
-					showRentPetWindow(player);
-				}
-				else
-				{
-					int val = Integer.parseInt(st.nextToken());
-					tryRentPet(player, val);
-				}
-			}
-		}
-		else if (actualCommand.equalsIgnoreCase("Wear"))
-		{
-			if (!Config.ALLOW_WEAR)
-				return;
-			
-			if (st.countTokens() < 1)
-				return;
-
-			int val = Integer.parseInt(st.nextToken());
-			showWearWindow(player, val);
-		}
-		else if (actualCommand.equalsIgnoreCase("Multisell"))
-		{
-			if (st.countTokens() < 1)
-				return;
-
-			int val = Integer.parseInt(st.nextToken());
-			L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), false, getCastle().getTaxRate());
-		}
-		else if (actualCommand.equalsIgnoreCase("Exc_Multisell"))
-		{
-			if (st.countTokens() < 1)
-				return;
-
-			int val = Integer.parseInt(st.nextToken());
-			L2Multisell.getInstance().separateAndSend(val, player, getNpcId(), true, getCastle().getTaxRate());
-		}
-		else
-			super.onBypassFeedback(player, command);
-	}
-
-	public final void showRentPetWindow(L2PcInstance player)
-	{
-		if (!Config.LIST_PET_RENT_NPC.contains(getTemplate().npcId))
-			return;
-
-		insertObjectIdAndShowChatWindow(player,
-				"<html><body>Pet Manager:<br>" +
-				"You can rent a wyvern or strider for adena.<br>My prices:<br1>" +
-				"<table border=0><tr><td>Ride</td></tr>" +
-				"<tr><td>Wyvern</td><td>Strider</td></tr>" +
-				"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 1\">30 sec/1800 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 11\">30 sec/900 adena</a></td></tr>" +
-				"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 2\">1 min/7200 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 12\">1 min/3600 adena</a></td></tr>" +
-				"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 3\">10 min/720000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 13\">10 min/360000 adena</a></td></tr>" +
-				"<tr><td><a action=\"bypass -h npc_%objectId%_RentPet 4\">30 min/6480000 adena</a></td><td><a action=\"bypass -h npc_%objectId%_RentPet 14\">30 min/3240000 adena</a></td></tr>" +
-				"</table>" +
-				"</body></html>"
-		);
-	}
-
-	public final void tryRentPet(L2PcInstance player, int val)
-	{
-		if (player == null || player.getPet() != null || player.isMounted() || player.isRentedPet() || player.isTransformed() || player.isCursedWeaponEquipped())
-			return;
-		if (!player.disarmWeapons())
-			return;
-
-		int petId;
-		double price = 1;
-		int cost[] = {1800, 7200, 720000, 6480000};
-		int ridetime[] = {30, 60, 600, 1800};
-
-		if (val > 10)
-		{
-			petId = 12526;
-			val -= 10;
-			price /= 2;
-		}
-		else
-			petId = 12621;
-
-		if (val < 1 || val > 4)
-			return;
-
-		price *= cost[val - 1];
-		int time = ridetime[val - 1];
-
-		if (!player.reduceAdena("Rent", (long) price, player.getLastFolkNPC(), true))
-			return;
-
-		player.mount(petId, 0, false);
-		SetupGauge sg = new SetupGauge(3, time*1000);
-		player.sendPacket(sg);
-		player.startRentPet(time);
-	}
-
 	@Override
 	public final void onActionShift(L2PcInstance player)
 	{

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MerchantSummonInstance.java

@@ -42,6 +42,7 @@ public class L2MerchantSummonInstance extends L2SummonInstance
 	public L2MerchantSummonInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2Skill skill)
 	{
 		super(objectId, template, owner, skill);
+		setInstanceType(InstanceType.L2MerchantSummonInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MinionInstance.java

@@ -47,6 +47,7 @@ public class L2MinionInstance extends L2MonsterInstance
 	public L2MinionInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2MonsterInstance);
 	}
 
 	/**

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2MonsterInstance.java

@@ -62,6 +62,7 @@ public class L2MonsterInstance extends L2Attackable
 	public L2MonsterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2MonsterInstance);
 		setAutoAttackable(true);
 		if (getTemplate().getMinionData() != null)
 			_minionList  = new MinionList(this);

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2NpcBufferInstance.java

@@ -41,6 +41,7 @@ public class L2NpcBufferInstance extends L2Npc
 	public L2NpcBufferInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2NpcBufferInstance);
 	}
 	
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2NpcInstance.java

@@ -40,6 +40,7 @@ public class L2NpcInstance extends L2Npc
 	public L2NpcInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2NpcInstance);
 		setIsInvul(false);
 		_classesToTeach = template.getTeachInfo();
 	}

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2NpcWalkerInstance.java

@@ -45,6 +45,7 @@ public class L2NpcWalkerInstance extends L2Npc
 	public L2NpcWalkerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2NpcWalkerInstance);
 		setAI(new L2NpcWalkerAI(new L2NpcWalkerAIAccessor()));
 	}
 

+ 1 - 64
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2ObservationInstance.java

@@ -14,15 +14,8 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
-import java.util.StringTokenizer;
-
-import com.l2jserver.gameserver.instancemanager.SiegeManager;
 import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.network.SystemMessageId;
-import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
-import com.l2jserver.gameserver.network.serverpackets.ItemList;
 import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
-import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
 
 /**
@@ -34,63 +27,7 @@ public final class L2ObservationInstance extends L2Npc
 	public L2ObservationInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
-	}
-
-	@Override
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		if (command.startsWith("Chat"))
-		{
-			int val = 0;
-			try
-			{
-				val = Integer.parseInt(command.substring(5));
-			}
-			catch (IndexOutOfBoundsException ioobe){}
-			catch (NumberFormatException nfe){}
-
-			showChatWindow(player, val);
-		}
-		else if (command.startsWith("observeSiege"))
-		{
-			String val = command.substring(13);
-			StringTokenizer st = new StringTokenizer(val);
-			st.nextToken(); // Bypass cost
-
-			if (SiegeManager.getInstance().getSiege(Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken()), Integer.parseInt(st.nextToken())) != null)
-				doObserve(player, val);
-			else
-				player.sendPacket(new SystemMessage(SystemMessageId.ONLY_VIEW_SIEGE));
-		}
-		else if (command.startsWith("observeOracle"))
-		{
-			String val = command.substring(13);
-			StringTokenizer st = new StringTokenizer(val);
-			st.nextToken(); // Bypass cost
-
-			doObserve(player, val);
-		}
-		else if (command.startsWith("observe"))
-			doObserve(player, command.substring(8));
-		else
-			super.onBypassFeedback(player, command);
-	}
-
-	private void doObserve(L2PcInstance player, String val)
-	{
-		StringTokenizer st = new StringTokenizer(val);
-		long cost = Long.parseLong(st.nextToken());
-		int x = Integer.parseInt(st.nextToken());
-		int y = Integer.parseInt(st.nextToken());
-		int z = Integer.parseInt(st.nextToken());
-
-		if (player.reduceAdena("Broadcast", cost, this, true))
-		{
-			// enter mode
-			player.enterObserverMode(x, y, z);
-			player.sendPacket(new ItemList(player, false));
-		}
-		player.sendPacket(ActionFailed.STATIC_PACKET);
+		setInstanceType(InstanceType.L2ObservationInstance);
 	}
 
 	public void showChatWindow(L2PcInstance player, int val)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2OlympiadManagerInstance.java

@@ -51,6 +51,7 @@ public class L2OlympiadManagerInstance extends L2Npc
 	public L2OlympiadManagerInstance (int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2OlympiadManagerInstance);
 	}
 
 	@Override

+ 2 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -1137,6 +1137,7 @@ public final class L2PcInstance extends L2Playable
 	private L2PcInstance(int objectId, L2PcTemplate template, String accountName, PcAppearance app)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2PcInstance);
         super.initCharStatusUpdateValues();
         initPcStatusUpdateValues();
 
@@ -1161,6 +1162,7 @@ public final class L2PcInstance extends L2Playable
 	private L2PcInstance(int objectId)
 	{
 		super(objectId, null);
+		setInstanceType(InstanceType.L2PcInstance);
         super.initCharStatusUpdateValues();
         initPcStatusUpdateValues();
 	}

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PenaltyMonsterInstance.java

@@ -28,6 +28,7 @@ public class L2PenaltyMonsterInstance extends L2MonsterInstance
 	public L2PenaltyMonsterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2PenaltyMonsterInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PetInstance.java

@@ -236,6 +236,7 @@ public class L2PetInstance extends L2Summon
 	public L2PetInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
 	{
 		super(objectId, template, owner);
+		setInstanceType(InstanceType.L2PetInstance);
 
         _controlItemId = control.getObjectId();
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2PetManagerInstance.java

@@ -30,6 +30,7 @@ public class L2PetManagerInstance extends L2MerchantInstance
 	public L2PetManagerInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2PetManagerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2RaceManagerInstance.java

@@ -67,6 +67,7 @@ public class L2RaceManagerInstance extends L2Npc
     public L2RaceManagerInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2RaceManagerInstance);
         if (_notInitialized)
         {
             _notInitialized = false;

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2RaidBossInstance.java

@@ -53,6 +53,7 @@ public class L2RaidBossInstance extends L2MonsterInstance
 	public L2RaidBossInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2RaidBossInstance);
 		setIsRaid(true);
 	}
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2RiftInvaderInstance.java

@@ -22,5 +22,6 @@ public class L2RiftInvaderInstance extends L2MonsterInstance
 	public L2RiftInvaderInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2RiftInvaderInstance);
 	}
 }

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SepulcherMonsterInstance.java

@@ -42,6 +42,7 @@ public class L2SepulcherMonsterInstance extends L2MonsterInstance
 	public L2SepulcherMonsterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2SepulcherMonsterInstance);
 		setShowSummonAnimation(true);
 		switch (template.npcId)
 		{

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SepulcherNpcInstance.java

@@ -54,6 +54,7 @@ public class L2SepulcherNpcInstance extends L2Npc
 	public L2SepulcherNpcInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2SepulcherNpcInstance);
 		setShowSummonAnimation(true);
 
 		if (_closeTask != null)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeFlagInstance.java

@@ -44,6 +44,7 @@ public class L2SiegeFlagInstance extends L2Npc
     public L2SiegeFlagInstance(L2PcInstance player, int objectId, L2NpcTemplate template, boolean advanced)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2SiegeFlagInstance);
 		
 		_clan = player.getClan();
 		_player = player;

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeNpcInstance.java

@@ -28,6 +28,7 @@ public class L2SiegeNpcInstance extends L2NpcInstance
 	public L2SiegeNpcInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
+		setInstanceType(InstanceType.L2SiegeNpcInstance);
 	}
 
 	public void showChatWindow(L2PcInstance player)

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SiegeSummonInstance.java

@@ -27,6 +27,7 @@ public class L2SiegeSummonInstance extends L2SummonInstance
 	public L2SiegeSummonInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2Skill skill)
     {
         super(objectId, template, owner, skill);
+        setInstanceType(InstanceType.L2SiegeSummonInstance);
     }
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SignsPriestInstance.java

@@ -38,6 +38,7 @@ public class L2SignsPriestInstance extends L2Npc
 	public L2SignsPriestInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2SignsPriestInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2StaticObjectInstance.java

@@ -91,6 +91,7 @@ public class L2StaticObjectInstance extends L2Character
     public L2StaticObjectInstance(int objectId,L2CharTemplate template, int staticId)
     {
     	super(objectId, template);
+    	setInstanceType(InstanceType.L2StaticObjectInstance);
     	_staticObjectId = staticId;
     }
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SummonInstance.java

@@ -50,6 +50,7 @@ public class L2SummonInstance extends L2Summon
 	public L2SummonInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2Skill skill)
 	{
 		super(objectId, template, owner);
+		setInstanceType(InstanceType.L2SummonInstance);
 		setShowSummonAnimation(true);
 		
 		if (skill != null)

+ 1 - 30
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2SymbolMakerInstance.java

@@ -14,12 +14,8 @@
  */
 package com.l2jserver.gameserver.model.actor.instance;
 
-import com.l2jserver.gameserver.datatables.HennaTreeTable;
-import com.l2jserver.gameserver.model.L2HennaInstance;
 import com.l2jserver.gameserver.model.actor.L2Character;
 import com.l2jserver.gameserver.model.actor.L2Npc;
-import com.l2jserver.gameserver.network.serverpackets.HennaEquipList;
-import com.l2jserver.gameserver.network.serverpackets.HennaRemoveList;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
 
 public class L2SymbolMakerInstance extends L2Npc
@@ -27,32 +23,7 @@ public class L2SymbolMakerInstance extends L2Npc
 	public L2SymbolMakerInstance(int objectID, L2NpcTemplate template)
 	{
 		super(objectID, template);
-	}
-
-	@Override
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		if (command.equals("Draw"))
-		{
-			L2HennaInstance[] henna = HennaTreeTable.getInstance().getAvailableHenna(player.getClassId());
-			player.sendPacket(new HennaEquipList(player, henna));
-		}
-		else if (command.equals("RemoveList"))
-		{
-			boolean hasHennas = false;
-
-			for (int i = 1; i <= 3; i++)
-			{
-				L2HennaInstance henna = player.getHenna(i);
-
-				if (henna != null)
-					hasHennas = true;
-			}
-			if (hasHennas)
-				player.sendPacket(new HennaRemoveList(player));
-		}
-		else
-			super.onBypassFeedback(player, command);
+		setInstanceType(InstanceType.L2SymbolMakerInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TamedBeastInstance.java

@@ -57,6 +57,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
 	public L2TamedBeastInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2TamedBeastInstance);
 		setHome(this);
 	}
 

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TeleporterInstance.java

@@ -51,6 +51,7 @@ public final class L2TeleporterInstance extends L2Npc
 	public L2TeleporterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2TeleporterInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TownPetInstance.java

@@ -36,6 +36,7 @@ public class L2TownPetInstance extends L2Npc
     public L2TownPetInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2TownPetInstance);
 
         if (Config.ALLOW_PET_WALKERS)
         	ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new RandomWalkTask(), 2000, 4000);

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TrainerInstance.java

@@ -29,6 +29,7 @@ public final class L2TrainerInstance extends L2NpcInstance
     public L2TrainerInstance(int objectId, L2NpcTemplate template)
     {
         super(objectId, template);
+        setInstanceType(InstanceType.L2TrainerInstance);
     }
 
     @Override

+ 2 - 48
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TransformManagerInstance.java

@@ -16,15 +16,11 @@ package com.l2jserver.gameserver.model.actor.instance;
 
 import com.l2jserver.gameserver.datatables.SkillTable;
 import com.l2jserver.gameserver.datatables.SkillTreeTable;
-import com.l2jserver.gameserver.model.L2Multisell;
 import com.l2jserver.gameserver.model.L2Skill;
 import com.l2jserver.gameserver.model.L2TransformSkillLearn;
-import com.l2jserver.gameserver.model.quest.QuestState;
-import com.l2jserver.gameserver.model.quest.State;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.serverpackets.AcquireSkillList;
 import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
-import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 import com.l2jserver.gameserver.templates.chars.L2NpcTemplate;
 
@@ -37,6 +33,7 @@ public class L2TransformManagerInstance extends L2MerchantInstance
 	public L2TransformManagerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2TransformManagerInstance);
 	}
 
 	@Override
@@ -52,54 +49,11 @@ public class L2TransformManagerInstance extends L2MerchantInstance
 		return "data/html/default/" + pom + ".htm";
 	}
 
-	@Override
-	public void onBypassFeedback(L2PcInstance player, String command)
-	{
-		if (command.startsWith("TransformSkillList"))
-		{
-			if (canTransform(player))
-			{
-				player.setSkillLearningClassId(player.getClassId());
-				showTransformSkillList(player);
-			}
-			else
-			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-				html.setFile(player.getHtmlPrefix(), "data/html/default/" + getNpcId() + "-cantlearn.htm");
-				player.sendPacket(html);
-			}
-		}
-		else if (command.startsWith("BuyTransform"))
-		{
-			if (canTransform(player))
-			{				
-				L2Multisell.getInstance().separateAndSend(32323001, player, getNpcId(), false, getCastle().getTaxRate());
-			}
-			else
-			{
-				NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
-				html.setFile(player.getHtmlPrefix(), "data/html/default/" + getNpcId() + "-cantbuy.htm");
-				player.sendPacket(html);
-			}
-		}
-		else
-			super.onBypassFeedback(player, command);
-	}
-
-	public static boolean canTransform(L2PcInstance player)
-	{
-		QuestState st = player.getQuestState("136_MoreThanMeetsTheEye");
-		if (st != null && st.getState() == State.COMPLETED)
-			return true;
-
-		return false;
-	}
-
 	/**
 	 * this displays TransformationSkillList to the player.
 	 * @param player
 	 */
-	public void showTransformSkillList(L2PcInstance player)
+	public static void showTransformSkillList(L2PcInstance player)
 	{        
 		L2TransformSkillLearn[] skills = SkillTreeTable.getInstance().getAvailableTransformSkills(player);
 		AcquireSkillList asl = new AcquireSkillList(AcquireSkillList.SkillType.Usual);

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TrapInstance.java

@@ -37,6 +37,7 @@ public class L2TrapInstance extends L2Trap
 			L2PcInstance owner, int lifeTime, L2Skill skill)
 	{
 		super(objectId, template, lifeTime, skill);
+		setInstanceType(InstanceType.L2TrapInstance);
 		
 		setInstanceId(owner.getInstanceId());
 		

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2TvTEventNpcInstance.java

@@ -29,6 +29,7 @@ public class L2TvTEventNpcInstance extends L2Npc
 	public L2TvTEventNpcInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2TvTEventNpcInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2VillageMasterInstance.java

@@ -66,6 +66,7 @@ public class L2VillageMasterInstance extends L2NpcInstance
 	public L2VillageMasterInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2VillageMasterInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2WarehouseInstance.java

@@ -36,6 +36,7 @@ public final class L2WarehouseInstance extends L2NpcInstance
 	public L2WarehouseInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2WarehouseInstance);
 	}
 
 	@Override

+ 1 - 0
L2_GameServer/java/com/l2jserver/gameserver/model/actor/instance/L2WeddingManagerInstance.java

@@ -36,6 +36,7 @@ public class L2WeddingManagerInstance extends L2Npc
 	public L2WeddingManagerInstance(int objectId, L2NpcTemplate template)
 	{
 		super(objectId, template);
+		setInstanceType(InstanceType.L2WeddingManagerInstance);
 	}
 
 	public void showChatWindow(L2PcInstance player)

Някои файлове не бяха показани, защото твърде много файлове са промени