Sync with L2jServer HighFive Feb 10th 2015.

This commit is contained in:
mobius 2015-02-10 22:49:31 +00:00
parent 4dc2666fa4
commit 431b4cacdf
98 changed files with 636 additions and 632 deletions

View File

@ -28,7 +28,6 @@ import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.data.xml.impl.DoorData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.GraciaSeedsManager;
import com.l2jserver.gameserver.instancemanager.ZoneManager;
import com.l2jserver.gameserver.model.L2Object;
@ -346,8 +345,8 @@ public class EnergySeeds extends AbstractNpcAI
private L2MonsterInstance spawnSupriseMob(L2Npc energy, int npcId)
{
L2NpcTemplate supriseMobTemplate = NpcData.getInstance().getTemplate(npcId);
L2MonsterInstance monster = new L2MonsterInstance(IdFactory.getInstance().getNextId(), supriseMobTemplate);
L2NpcTemplate surpriseMobTemplate = NpcData.getInstance().getTemplate(npcId);
L2MonsterInstance monster = new L2MonsterInstance(surpriseMobTemplate);
monster.setCurrentHpMp(monster.getMaxHp(), monster.getMaxMp());
monster.setHeading(energy.getHeading());
monster.setInstanceId(energy.getInstanceId());

View File

@ -23,7 +23,6 @@ import java.util.StringTokenizer;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -187,8 +186,8 @@ public class AdminFightCalculator implements IAdminCommandHandler
mid1 = Integer.parseInt(st.nextToken());
mid2 = Integer.parseInt(st.nextToken());
npc1 = new L2MonsterInstance(IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(mid1));
npc2 = new L2MonsterInstance(IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(mid2));
npc1 = new L2MonsterInstance(NpcData.getInstance().getTemplate(mid1));
npc2 = new L2MonsterInstance(NpcData.getInstance().getTemplate(mid2));
}
int miss1 = 0;

View File

@ -19,7 +19,6 @@
package handlers.effecthandlers;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
import com.l2jserver.gameserver.instancemanager.CastleManager;
import com.l2jserver.gameserver.instancemanager.FortManager;
@ -64,7 +63,7 @@ public final class HeadquarterCreate extends AbstractEffect
return;
}
final L2SiegeFlagInstance flag = new L2SiegeFlagInstance(player, IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(HQ_NPC_ID), _isAdvanced, false);
final L2SiegeFlagInstance flag = new L2SiegeFlagInstance(player, NpcData.getInstance().getTemplate(HQ_NPC_ID), _isAdvanced, false);
flag.setTitle(player.getClan().getName());
flag.setCurrentHpMp(flag.getMaxHp(), flag.getMaxMp());
flag.setHeading(player.getHeading());

View File

@ -21,7 +21,6 @@ package handlers.effecthandlers;
import com.l2jserver.gameserver.data.xml.impl.ExperienceData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
@ -77,7 +76,7 @@ public final class Summon extends AbstractEffect
final L2PcInstance player = info.getEffected().getActingPlayer();
final L2NpcTemplate template = NpcData.getInstance().getTemplate(_npcId);
final L2ServitorInstance summon = new L2ServitorInstance(IdFactory.getInstance().getNextId(), template, player);
final L2ServitorInstance summon = new L2ServitorInstance(template, player);
final int consumeItemInterval = (_consumeItemInterval > 0 ? _consumeItemInterval : (template.getRace() != Race.SIEGE_WEAPON ? 240 : 60)) * 1000;
summon.setName(template.getName());

View File

@ -19,7 +19,6 @@
package handlers.effecthandlers;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
@ -101,7 +100,7 @@ public final class SummonNpc extends AbstractEffect
{
case "L2Decoy":
{
final L2DecoyInstance decoy = new L2DecoyInstance(IdFactory.getInstance().getNextId(), npcTemplate, player, _despawnDelay);
final L2DecoyInstance decoy = new L2DecoyInstance(npcTemplate, player, _despawnDelay);
decoy.setCurrentHp(decoy.getMaxHp());
decoy.setCurrentMp(decoy.getMaxMp());
decoy.setHeading(player.getHeading());
@ -113,7 +112,7 @@ public final class SummonNpc extends AbstractEffect
}
case "L2EffectPoint": // TODO: Implement proper signet skills.
{
final L2EffectPointInstance effectPoint = new L2EffectPointInstance(IdFactory.getInstance().getNextId(), npcTemplate, player);
final L2EffectPointInstance effectPoint = new L2EffectPointInstance(npcTemplate, player);
effectPoint.setCurrentHp(effectPoint.getMaxHp());
effectPoint.setCurrentMp(effectPoint.getMaxMp());
int x = player.getX();

View File

@ -19,7 +19,6 @@
package handlers.effecthandlers;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.instance.L2TrapInstance;
@ -84,7 +83,7 @@ public final class SummonTrap extends AbstractEffect
return;
}
final L2TrapInstance trap = new L2TrapInstance(IdFactory.getInstance().getNextId(), npcTemplate, player, _despawnTime);
final L2TrapInstance trap = new L2TrapInstance(npcTemplate, player, _despawnTime);
trap.setCurrentHp(trap.getMaxHp());
trap.setCurrentMp(trap.getMaxMp());
trap.setIsInvul(true);

View File

@ -1855,7 +1855,7 @@
<height normal="27.5" />
</collision>
</npc>
<npc id="13148" level="55" type="L2FlyMonster" name="Lindvior">
<npc id="13148" level="55" type="L2Monster" name="Lindvior">
<!-- Confirmed CT2.5 -->
<race>DRAGON</race>
<sex>FEMALE</sex>

View File

@ -4539,7 +4539,7 @@
<height normal="10" />
</collision>
</npc>
<npc id="18684" level="1" type="L2FlyNpc" name="Red Star Stone">
<npc id="18684" level="1" type="L2Npc" name="Red Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4581,7 +4581,7 @@
<height normal="61" />
</collision>
</npc>
<npc id="18685" level="1" type="L2FlyNpc" name="Red Star Stone">
<npc id="18685" level="1" type="L2Npc" name="Red Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4623,7 +4623,7 @@
<height normal="43.5" />
</collision>
</npc>
<npc id="18686" level="1" type="L2FlyNpc" name="Red Star Stone">
<npc id="18686" level="1" type="L2Npc" name="Red Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4665,7 +4665,7 @@
<height normal="30.5" />
</collision>
</npc>
<npc id="18687" level="1" type="L2FlyNpc" name="Blue Star Stone">
<npc id="18687" level="1" type="L2Npc" name="Blue Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4707,7 +4707,7 @@
<height normal="61" />
</collision>
</npc>
<npc id="18688" level="1" type="L2FlyNpc" name="Blue Star Stone">
<npc id="18688" level="1" type="L2Npc" name="Blue Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4749,7 +4749,7 @@
<height normal="43.5" />
</collision>
</npc>
<npc id="18689" level="1" type="L2FlyNpc" name="Blue Star Stone">
<npc id="18689" level="1" type="L2Npc" name="Blue Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4791,7 +4791,7 @@
<height normal="30.5" />
</collision>
</npc>
<npc id="18690" level="1" type="L2FlyNpc" name="Green Star Stone">
<npc id="18690" level="1" type="L2Npc" name="Green Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4833,7 +4833,7 @@
<height normal="61" />
</collision>
</npc>
<npc id="18691" level="1" type="L2FlyNpc" name="Green Star Stone">
<npc id="18691" level="1" type="L2Npc" name="Green Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>
@ -4875,7 +4875,7 @@
<height normal="43.5" />
</collision>
</npc>
<npc id="18692" level="1" type="L2FlyNpc" name="Green Star Stone">
<npc id="18692" level="1" type="L2Npc" name="Green Star Stone">
<!-- Confirmed CT2.5 -->
<race>CONSTRUCT</race>
<sex>FEMALE</sex>

View File

@ -50,7 +50,7 @@
<height normal="74" />
</collision>
</npc>
<npc id="22602" level="73" type="L2FlyMonster" name="Mutant Bird">
<npc id="22602" level="73" type="L2Monster" name="Mutant Bird">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="110" />
@ -131,7 +131,7 @@
<height normal="85" />
</collision>
</npc>
<npc id="22603" level="74" type="L2FlyMonster" name="Mutant Bird">
<npc id="22603" level="74" type="L2Monster" name="Mutant Bird">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="110" />
@ -216,7 +216,7 @@
<height normal="85" />
</collision>
</npc>
<npc id="22604" level="74" type="L2FlyMonster" name="Dra Hawk">
<npc id="22604" level="74" type="L2Monster" name="Dra Hawk">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="90" />
@ -296,7 +296,7 @@
<height normal="35" />
</collision>
</npc>
<npc id="22605" level="75" type="L2FlyMonster" name="Dra Hawk">
<npc id="22605" level="75" type="L2Monster" name="Dra Hawk">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="90" />
@ -376,7 +376,7 @@
<height normal="35" />
</collision>
</npc>
<npc id="22606" level="76" type="L2FlyMonster" name="Floating Skull">
<npc id="22606" level="76" type="L2Monster" name="Floating Skull">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="100" />
@ -459,7 +459,7 @@
<height normal="39" />
</collision>
</npc>
<npc id="22607" level="77" type="L2FlyMonster" name="Floating Skull">
<npc id="22607" level="77" type="L2Monster" name="Floating Skull">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="100" />
@ -530,7 +530,7 @@
<height normal="39" />
</collision>
</npc>
<npc id="22608" level="75" type="L2FlyMonster" name="Floating Zombie">
<npc id="22608" level="75" type="L2Monster" name="Floating Zombie">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="110" />
@ -602,7 +602,7 @@
<height normal="50" />
</collision>
</npc>
<npc id="22609" level="76" type="L2FlyMonster" name="Floating Zombie">
<npc id="22609" level="76" type="L2Monster" name="Floating Zombie">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="110" />
@ -674,7 +674,7 @@
<height normal="50" />
</collision>
</npc>
<npc id="22610" level="75" type="L2FlyMonster" name="Mutated Drake Wing">
<npc id="22610" level="75" type="L2Monster" name="Mutated Drake Wing">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="120" />
@ -753,7 +753,7 @@
<height normal="63" />
</collision>
</npc>
<npc id="22611" level="76" type="L2FlyMonster" name="Mutated Drake Wing">
<npc id="22611" level="76" type="L2Monster" name="Mutated Drake Wing">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="120" />
@ -832,7 +832,7 @@
<height normal="63" />
</collision>
</npc>
<npc id="22612" level="76" type="L2FlyMonster" name="Drak">
<npc id="22612" level="76" type="L2Monster" name="Drak">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="80" />
@ -914,7 +914,7 @@
<height normal="40" />
</collision>
</npc>
<npc id="22613" level="77" type="L2FlyMonster" name="Drak">
<npc id="22613" level="77" type="L2Monster" name="Drak">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="80" />
@ -994,7 +994,7 @@
<height normal="40" />
</collision>
</npc>
<npc id="22614" level="74" type="L2FlyMonster" name="Vulture Rider">
<npc id="22614" level="74" type="L2Monster" name="Vulture Rider">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="105" />
@ -1083,7 +1083,7 @@
<height normal="90" />
</collision>
</npc>
<npc id="22615" level="75" type="L2FlyMonster" name="Vulture Rider">
<npc id="22615" level="75" type="L2Monster" name="Vulture Rider">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="MoveAroundSocial" value="105" />

View File

@ -1465,7 +1465,7 @@
<height normal="40" grown="48" />
</collision>
</npc>
<npc id="25623" level="80" type="L2FlyRaidBoss" name="Valdstone" title="Master Rider">
<npc id="25623" level="80" type="L2RaidBoss" name="Valdstone" title="Master Rider">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="Skill01_AttackSplash" value="1" />
@ -1543,7 +1543,7 @@
<height normal="90" />
</collision>
</npc>
<npc id="25624" level="80" type="L2FlyRaidBoss" name="Rok" title="King of Birds">
<npc id="25624" level="80" type="L2RaidBoss" name="Rok" title="King of Birds">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="Skill01_AttackSplash" value="1" />
@ -1608,7 +1608,7 @@
<height normal="130.5" />
</collision>
</npc>
<npc id="25625" level="80" type="L2FlyRaidBoss" name="Enira" title="Banshee Queen">
<npc id="25625" level="80" type="L2RaidBoss" name="Enira" title="Banshee Queen">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="Skill01_Target" value="3" />
@ -1691,7 +1691,7 @@
<height normal="33.5" />
</collision>
</npc>
<npc id="25626" level="80" type="L2FlyRaidBoss" name="Dius" title="Deadman of Destruction">
<npc id="25626" level="80" type="L2RaidBoss" name="Dius" title="Deadman of Destruction">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="Skill01_AttackSplash" value="1" />
@ -1860,7 +1860,7 @@
<height normal="35" />
</collision>
</npc>
<npc id="25629" level="78" type="L2FlyMonster" name="Floating Skull" title="Enira's Evil Spirit">
<npc id="25629" level="78" type="L2Monster" name="Floating Skull" title="Enira's Evil Spirit">
<!-- Confirmed CT2.5 -->
<parameters>
<skill name="Skill01_ID" id="5803" level="1" /> <!-- Green Chili -->
@ -1909,7 +1909,7 @@
<height normal="39" />
</collision>
</npc>
<npc id="25630" level="77" type="L2FlyMonster" name="Floating Zombie" title="Enira's Evil Spirit">
<npc id="25630" level="77" type="L2Monster" name="Floating Zombie" title="Enira's Evil Spirit">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="Skill02_Target" value="3" />
@ -2058,7 +2058,7 @@
<height normal="40" />
</collision>
</npc>
<npc id="25633" level="76" type="L2FlyMonster" name="Elite Rider" title="Valdstone's Elites">
<npc id="25633" level="76" type="L2Monster" name="Elite Rider" title="Valdstone's Elites">
<!-- Confirmed CT2.5 -->
<parameters>
<param name="Skill03_Target" value="4" />

View File

@ -23,7 +23,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.util.Rnd;
@ -73,8 +72,7 @@ public class MonsterRace
{
L2NpcTemplate template = NpcData.getInstance().getTemplate(id + random);
Constructor<?> constructor = Class.forName("com.l2jserver.gameserver.model.actor.instance." + template.getType() + "Instance").getConstructors()[0];
int objectId = IdFactory.getInstance().getNextId();
_monsters[i] = (L2Npc) constructor.newInstance(objectId, template);
_monsters[i] = (L2Npc) constructor.newInstance(template);
}
catch (Exception e)
{

View File

@ -31,7 +31,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.model.StatsSet;
@ -124,7 +123,7 @@ public class DoorData implements IXmlReader
{
insertCollisionData(set);
L2DoorTemplate template = new L2DoorTemplate(set);
L2DoorInstance door = new L2DoorInstance(IdFactory.getInstance().getNextId(), template);
L2DoorInstance door = new L2DoorInstance(template);
door.setCurrentHp(door.getMaxHp());
door.spawnMe(template.getX(), template.getY(), template.getZ());
putDoor(door, MapRegionManager.getInstance().getMapRegionLocId(door));

View File

@ -29,7 +29,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.VehiclePathPoint;
@ -164,7 +163,7 @@ public final class ShuttleData implements IXmlReader
{
for (L2ShuttleData data : _shuttles.values())
{
final L2ShuttleInstance shuttle = new L2ShuttleInstance(IdFactory.getInstance().getNextId(), new L2CharTemplate(new StatsSet()));
final L2ShuttleInstance shuttle = new L2ShuttleInstance(new L2CharTemplate(new StatsSet()));
shuttle.setData(data);
shuttle.setHeading(data.getLocation().getHeading());
shuttle.setLocationInvisible(data.getLocation());

View File

@ -27,7 +27,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance;
import com.l2jserver.gameserver.model.actor.templates.L2CharTemplate;
@ -90,7 +89,7 @@ public final class StaticObjectData implements IXmlReader
*/
private void addObject(StatsSet set)
{
L2StaticObjectInstance obj = new L2StaticObjectInstance(IdFactory.getInstance().getNextId(), new L2CharTemplate(new StatsSet()), set.getInt("id"));
L2StaticObjectInstance obj = new L2StaticObjectInstance(new L2CharTemplate(new StatsSet()), set.getInt("id"));
obj.setType(set.getInt("type", 0));
obj.setName(set.getString("name"));
obj.setMap(set.getString("texture", "none"), set.getInt("map_x", 0), set.getInt("map_y", 0));

View File

@ -394,7 +394,7 @@ public final class SpawnTable implements IXmlReader
}
/**
* Add a new spawn to the spawn table.
* Adds a new spawn to the spawn table.
* @param spawn the spawn to add
* @param storeInDb if {@code true} it'll be saved in the database
*/

View File

@ -29,7 +29,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.AirShipTeleportList;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.VehiclePathPoint;
@ -104,7 +103,7 @@ public class AirShipManager
public L2AirShipInstance getNewAirShip(int x, int y, int z, int heading)
{
final L2AirShipInstance airShip = new L2AirShipInstance(IdFactory.getInstance().getNextId(), _airShipTemplate);
final L2AirShipInstance airShip = new L2AirShipInstance(_airShipTemplate);
airShip.setHeading(heading);
airShip.setXYZInvisible(x, y, z);
@ -130,7 +129,7 @@ public class AirShipManager
}
else
{
airShip = new L2ControllableAirShipInstance(IdFactory.getInstance().getNextId(), _airShipTemplate, ownerId);
airShip = new L2ControllableAirShipInstance(_airShipTemplate, ownerId);
_airShips.put(ownerId, airShip);
airShip.setMaxFuel(600);

View File

@ -22,7 +22,6 @@ import java.util.HashMap;
import java.util.Map;
import com.l2jserver.Config;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.VehiclePathPoint;
@ -103,8 +102,8 @@ public class BoatManager
npcDat.set("baseMpReg", 3.e-3f);
npcDat.set("basePDef", 100);
npcDat.set("baseMDef", 100);
L2CharTemplate template = new L2CharTemplate(npcDat);
L2BoatInstance boat = new L2BoatInstance(IdFactory.getInstance().getNextId(), template);
L2BoatInstance boat = new L2BoatInstance(new L2CharTemplate(npcDat));
_boats.put(boat.getObjectId(), boat);
boat.setHeading(heading);
boat.setXYZInvisible(x, y, z);

View File

@ -352,7 +352,7 @@ public final class MercTicketManager
L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
if (template != null)
{
final L2DefenderInstance npc = new L2DefenderInstance(IdFactory.getInstance().getNextId(), template);
final L2DefenderInstance npc = new L2DefenderInstance(template);
npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
npc.setDecayed(false);
npc.spawnMe(x, y, (z + 20));

View File

@ -22,7 +22,6 @@ import java.util.logging.Level;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.sql.impl.TerritoryTable;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2ControllableMobInstance;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
@ -78,7 +77,7 @@ public class L2GroupSpawn extends L2Spawn
newlocz = getZ();
}
final L2Npc mob = new L2ControllableMobInstance(IdFactory.getInstance().getNextId(), _template);
final L2Npc mob = new L2ControllableMobInstance(_template);
mob.setCurrentHpMp(mob.getMaxHp(), mob.getMaxMp());
if (getHeading() == -1)

View File

@ -31,7 +31,6 @@ import com.l2jserver.gameserver.GeoData;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.data.sql.impl.TerritoryTable;
import com.l2jserver.gameserver.datatables.NpcPersonalAIData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.actor.L2Attackable;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
@ -145,7 +144,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
String className = "com.l2jserver.gameserver.model.actor.instance." + _template.getType() + "Instance";
// Create the generic constructor of L2Npc managed by this L2Spawn
_constructor = Class.forName(className).asSubclass(L2Npc.class).getConstructor(int.class, L2NpcTemplate.class);
_constructor = Class.forName(className).asSubclass(L2Npc.class).getConstructor(L2NpcTemplate.class);
}
/**
@ -527,7 +526,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
}
// Call the constructor of the L2Npc
L2Npc npc = _constructor.newInstance(IdFactory.getInstance().getNextId(), _template);
L2Npc npc = _constructor.newInstance(_template);
npc.setInstanceId(getInstanceId()); // Must be done before object is spawned into visible world
if (isSummonSpawn)
{

View File

@ -111,17 +111,12 @@ public class L2Attackable extends L2Npc
private boolean _mustGiveExpSp;
/**
* Constructor of L2Attackable (use L2Character and L2NpcInstance constructor).<br>
* Actions:<br>
* Call the L2Character constructor to set the _template of the L2Attackable (copy skills from template to object and link _calculators to NPC_STD_CALCULATOR)<br>
* Set the name of the L2Attackable<br>
* Create a RandomAnimation Task that will be launched after the calculated delay if the server allow it.
* @param objectId identifier of the object initialized.
* @param template the template to apply to the NPC.
* Creates an attackable NPC.
* @param template the attackable NPC template
*/
public L2Attackable(int objectId, L2NpcTemplate template)
public L2Attackable(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2Attackable);
setIsInvul(false);
_mustGiveExpSp = true;

View File

@ -57,6 +57,7 @@ import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.enums.ShotType;
import com.l2jserver.gameserver.enums.Team;
import com.l2jserver.gameserver.enums.UserInfoType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.model.CharEffectList;
@ -276,6 +277,83 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
protected Future<?> _skillCast;
protected Future<?> _skillCast2;
/**
* Creates a creature.
* @param template the creature template
*/
public L2Character(L2CharTemplate template)
{
this(IdFactory.getInstance().getNextId(), template);
}
/**
* Constructor of L2Character.<br>
* <B><U>Concept</U>:</B><br>
* Each L2Character owns generic and static properties (ex : all Keltir have the same number of HP...).<br>
* All of those properties are stored in a different template for each type of L2Character. Each template is loaded once in the server cache memory (reduce memory use).<br>
* When a new instance of L2Character is spawned, server just create a link between the instance and the template This link is stored in <B>_template</B><br>
* <B><U> Actions</U>:</B>
* <ul>
* <li>Set the _template of the L2Character</li>
* <li>Set _overloaded to false (the character can take more items)</li>
* <li>If L2Character is a L2NPCInstance, copy skills from template to object</li>
* <li>If L2Character is a L2NPCInstance, link _calculators to NPC_STD_CALCULATOR</li>
* <li>If L2Character is NOT a L2NPCInstance, create an empty _skills slot</li>
* <li>If L2Character is a L2PcInstance or L2Summon, copy basic Calculator set to object</li>
* </ul>
* @param objectId Identifier of the object to initialized
* @param template The L2CharTemplate to apply to the object
*/
public L2Character(int objectId, L2CharTemplate template)
{
super(objectId);
if (template == null)
{
throw new NullPointerException("Template is null!");
}
setInstanceType(InstanceType.L2Character);
initCharStat();
initCharStatus();
// Set its template to the new L2Character
_template = template;
if (isNpc())
{
// Copy the Standard Calculators of the L2NPCInstance in _calculators
_calculators = NPC_STD_CALCULATOR;
// Copy the skills of the L2NPCInstance from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2NpcInstance, affects others L2NPCInstance of the same type too.
for (Skill skill : template.getSkills().values())
{
addSkill(skill);
}
}
else
{
// If L2Character is a L2PcInstance or a L2Summon, create the basic calculator set
_calculators = new Calculator[Stats.NUM_STATS];
if (isSummon())
{
// Copy the skills of the L2Summon from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2Summon, affects others L2Summon of the same type too.
for (Skill skill : template.getSkills().values())
{
addSkill(skill);
}
}
Formulas.addFuncsToNewCharacter(this);
}
setIsInvul(true);
}
public final CharEffectList getEffectList()
{
return _effectList;
@ -432,74 +510,6 @@ public abstract class L2Character extends L2Object implements ISkillsHolder, IDe
return null;
}
/**
* Constructor of L2Character.<br>
* <B><U>Concept</U>:</B><br>
* Each L2Character owns generic and static properties (ex : all Keltir have the same number of HP...).<br>
* All of those properties are stored in a different template for each type of L2Character. Each template is loaded once in the server cache memory (reduce memory use).<br>
* When a new instance of L2Character is spawned, server just create a link between the instance and the template This link is stored in <B>_template</B><br>
* <B><U> Actions</U>:</B>
* <ul>
* <li>Set the _template of the L2Character</li>
* <li>Set _overloaded to false (the character can take more items)</li>
* <li>If L2Character is a L2NPCInstance, copy skills from template to object</li>
* <li>If L2Character is a L2NPCInstance, link _calculators to NPC_STD_CALCULATOR</li>
* <li>If L2Character is NOT a L2NPCInstance, create an empty _skills slot</li>
* <li>If L2Character is a L2PcInstance or L2Summon, copy basic Calculator set to object</li>
* </ul>
* @param objectId Identifier of the object to initialized
* @param template The L2CharTemplate to apply to the object
*/
public L2Character(int objectId, L2CharTemplate template)
{
super(objectId);
if (template == null)
{
throw new NullPointerException("Template is null!");
}
setInstanceType(InstanceType.L2Character);
initCharStat();
initCharStatus();
// Set its template to the new L2Character
_template = template;
if (isNpc())
{
// Copy the Standard Calculators of the L2NPCInstance in _calculators
_calculators = NPC_STD_CALCULATOR;
// Copy the skills of the L2NPCInstance from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2NpcInstance, affects others L2NPCInstance of the same type too.
for (Skill skill : template.getSkills().values())
{
addSkill(skill);
}
}
else
{
// If L2Character is a L2PcInstance or a L2Summon, create the basic calculator set
_calculators = new Calculator[Stats.NUM_STATS];
if (isSummon())
{
// Copy the skills of the L2Summon from its template to the L2Character Instance
// The skills list can be affected by spell effects so it's necessary to make a copy
// to avoid that a spell affecting a L2Summon, affects others L2Summon of the same type too.
for (Skill skill : template.getSkills().values())
{
addSkill(skill);
}
}
Formulas.addFuncsToNewCharacter(this);
}
setIsInvul(true);
}
protected void initCharStatusUpdateValues()
{
_hpUpdateIncCheck = getMaxHp();

View File

@ -35,9 +35,14 @@ public abstract class L2Decoy extends L2Character
{
private final L2PcInstance _owner;
public L2Decoy(int objectId, L2CharTemplate template, L2PcInstance owner)
/**
* Creates an abstract decoy.
* @param template the decoy template
* @param owner the owner
*/
public L2Decoy(L2CharTemplate template, L2PcInstance owner)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2Decoy);
_owner = owner;
setXYZInvisible(owner.getX(), owner.getY(), owner.getZ());

View File

@ -149,6 +149,30 @@ public class L2Npc extends L2Character
/** Map of summoned NPCs by this NPC. */
private volatile Map<Integer, L2Npc> _summonedNpcs = null;
/**
* Creates a NPC.
* @param template the NPC template
*/
public L2Npc(L2NpcTemplate template)
{
// 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(template);
setInstanceType(InstanceType.L2Npc);
initCharStatusUpdateValues();
// initialize the "current" equipment
_currentLHandId = getTemplate().getLHandId();
_currentRHandId = getTemplate().getRHandId();
_currentEnchant = Config.ENABLE_RANDOM_ENCHANT_EFFECT ? Rnd.get(4, 21) : getTemplate().getWeaponEnchant();
// initialize the "current" collisions
_currentCollisionHeight = getTemplate().getfCollisionHeight();
_currentCollisionRadius = getTemplate().getfCollisionRadius();
setIsFlying(template.isFlying());
}
public int getSoulShotChance()
{
return getTemplate().getSoulShotChance();
@ -420,35 +444,6 @@ public class L2Npc extends L2Character
return _isRandomAnimationEnabled;
}
/**
* Constructor of L2NpcInstance (use L2Character constructor).<br>
* <B><U>Actions</U>:</B>
* <ul>
* <li>Call the L2Character constructor to set the _template of the L2Character (copy skills from template to object and link _calculators to NPC_STD_CALCULATOR)</li>
* <li>Set the name of the L2Character</li>
* <li>Create a RandomAnimation Task that will be launched after the calculated delay if the server allow it</li>
* </ul>
* @param objectId Identifier of the object to initialized
* @param template The L2NpcTemplate to apply to the NPC
*/
public L2Npc(int objectId, L2NpcTemplate template)
{
// 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
_currentLHandId = getTemplate().getLHandId();
_currentRHandId = getTemplate().getRHandId();
_currentEnchant = Config.ENABLE_RANDOM_ENCHANT_EFFECT ? Rnd.get(4, 21) : getTemplate().getWeaponEnchant();
// initialize the "current" collisions
_currentCollisionHeight = getTemplate().getfCollisionHeight();
_currentCollisionRadius = getTemplate().getfCollisionRadius();
}
@Override
public NpcKnownList getKnownList()
{

View File

@ -50,13 +50,9 @@ public abstract class L2Playable extends L2Character
private L2PcInstance transferDmgTo = null;
/**
* Constructor of L2Playable.<br>
* <B><U> Actions</U> :</B>
* <ul>
* <li>Call the L2Character constructor to create an empty _skills slot and link copy basic Calculator set to this L2Playable</li>
* </ul>
* @param objectId Identifier of the object to initialized
* @param template The L2CharTemplate to apply to the L2Playable
* Creates an abstract playable creature.
* @param objectId the playable object ID
* @param template the creature template
*/
public L2Playable(int objectId, L2CharTemplate template)
{
@ -65,6 +61,13 @@ public abstract class L2Playable extends L2Character
setIsInvul(false);
}
public L2Playable(L2CharTemplate template)
{
super(template);
setInstanceType(InstanceType.L2Playable);
setIsInvul(false);
}
@Override
public PlayableKnownList getKnownList()
{

View File

@ -108,9 +108,14 @@ public abstract class L2Summon extends L2Playable
}
}
public L2Summon(int objectId, L2NpcTemplate template, L2PcInstance owner)
/**
* Creates an abstract summon.
* @param template the summon NPC template
* @param owner the owner
*/
public L2Summon(L2NpcTemplate template, L2PcInstance owner)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2Summon);
setInstanceId(owner.getInstanceId()); // set instance to same as owner
setShowSummonAnimation(true);

View File

@ -30,9 +30,13 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
*/
public abstract class L2Tower extends L2Npc
{
public L2Tower(int objectId, L2NpcTemplate template)
/**
* Creates an abstract Tower.
* @param template the tower template
*/
public L2Tower(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setIsInvul(false);
}

View File

@ -60,9 +60,13 @@ public abstract class L2Vehicle extends L2Character
protected VehiclePathPoint[] _currentPath = null;
protected int _runState = 0;
public L2Vehicle(int objectId, L2CharTemplate template)
/**
* Creates an abstract vehicle.
* @param template the vehicle template
*/
public L2Vehicle(L2CharTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2Vehicle);
setIsFlying(true);
}

View File

@ -28,9 +28,9 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
*/
public class L2AdventurerInstance extends L2NpcInstance
{
public L2AdventurerInstance(int objectId, L2NpcTemplate template)
public L2AdventurerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2AdventurerInstance);
}

View File

@ -36,9 +36,9 @@ import com.l2jserver.gameserver.network.serverpackets.ExStopMoveAirShip;
*/
public class L2AirShipInstance extends L2Vehicle
{
public L2AirShipInstance(int objectId, L2CharTemplate template)
public L2AirShipInstance(L2CharTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2AirShipInstance);
setAI(new L2AirShipAI(new AIAccessor()));
}

View File

@ -25,27 +25,15 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
/**
* This class manages all Castle Siege Artefacts.<BR>
* <BR>
* @version $Revision: 1.11.2.1.2.7 $ $Date: 2005/04/06 16:13:40 $
*/
public final class L2ArtefactInstance extends L2Npc
{
/**
* Constructor of L2ArtefactInstance (use L2Character and L2NpcInstance constructor).<BR>
* <BR>
* <B><U> Actions</U> :</B><BR>
* <BR>
* <li>Call the L2Character constructor to set the _template of the L2ArtefactInstance (copy skills from template to object and link _calculators to NPC_STD_CALCULATOR)</li> <li>Set the name of the L2ArtefactInstance</li> <li>Create a RandomAnimation Task that will be launched after the
* calculated delay if the server allow it</li><BR>
* <BR>
* @param objectId the identifier of the object to initialized
* @param template to apply to the NPC
* Creates a castle siege artifact.
* @param template the artifact NPC template
*/
public L2ArtefactInstance(int objectId, L2NpcTemplate template)
public L2ArtefactInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ArtefactInstance);
}

View File

@ -48,9 +48,9 @@ public final class L2AuctioneerInstance extends L2Npc
private final Map<Integer, Auction> _pendingAuctions = new HashMap<>();
public L2AuctioneerInstance(int objectId, L2NpcTemplate template)
public L2AuctioneerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2AuctioneerInstance);
}

View File

@ -54,15 +54,28 @@ public final class L2BabyPetInstance extends L2PetInstance
protected boolean _bufferMode = true;
public L2BabyPetInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
/**
* Creates a baby pet.
* @param template the baby pet NPC template
* @param owner the owner
* @param control the summoning item
*/
public L2BabyPetInstance(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
{
super(objectId, template, owner, control);
super(template, owner, control);
setInstanceType(InstanceType.L2BabyPetInstance);
}
public L2BabyPetInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control, byte level)
/**
* Creates a baby pet.
* @param template the baby pet NPC template
* @param owner the owner
* @param control the summoning item
* @param level the level
*/
public L2BabyPetInstance(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control, byte level)
{
super(objectId, template, owner, control, level);
super(template, owner, control, level);
setInstanceType(InstanceType.L2BabyPetInstance);
}

View File

@ -38,12 +38,12 @@ public class L2BlockInstance extends L2MonsterInstance
private int _colorEffect;
/**
* @param objectId
* @param template
* Creates a block.
* @param template the block NPC template
*/
public L2BlockInstance(int objectId, L2NpcTemplate template)
public L2BlockInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
/**

View File

@ -36,9 +36,13 @@ public class L2BoatInstance extends L2Vehicle
{
protected static final Logger _logBoat = Logger.getLogger(L2BoatInstance.class.getName());
public L2BoatInstance(int objectId, L2CharTemplate template)
/**
* Creates a boat.
* @param template the boat template
*/
public L2BoatInstance(L2CharTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2BoatInstance);
setAI(new L2BoatAI(new AIAccessor()));
}

View File

@ -27,9 +27,9 @@ import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall;
public class L2CastleDoormenInstance extends L2DoormenInstance
{
public L2CastleDoormenInstance(int objectID, L2NpcTemplate template)
public L2CastleDoormenInstance(L2NpcTemplate template)
{
super(objectID, template);
super(template);
setInstanceType(InstanceType.L2CastleDoormenInstance);
}

View File

@ -31,9 +31,13 @@ public final class L2ChestInstance extends L2MonsterInstance
{
private volatile boolean _specialDrop;
public L2ChestInstance(int objectId, L2NpcTemplate template)
/**
* Creates a chest.
* @param template the chest NPC template
*/
public L2ChestInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ChestInstance);
setIsNoRndWalk(true);
_specialDrop = false;

View File

@ -55,9 +55,13 @@ public class L2ClanHallDoormenInstance extends L2DoormenInstance
57
};
public L2ClanHallDoormenInstance(int objectID, L2NpcTemplate template)
/**
* Creates a clan hall doorman.
* @param template the doorman NPC template
*/
public L2ClanHallDoormenInstance(L2NpcTemplate template)
{
super(objectID, template);
super(template);
setInstanceType(InstanceType.L2ClanHallDoormenInstance);
}

View File

@ -51,12 +51,12 @@ public class L2ClanHallManagerInstance extends L2MerchantInstance
private int _clanHallId = -1;
/**
* @param objectId
* @param template
* Creates clan hall manager.
* @param template the clan hall manager NPC template
*/
public L2ClanHallManagerInstance(int objectId, L2NpcTemplate template)
public L2ClanHallManagerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ClanHallManagerInstance);
}

View File

@ -41,12 +41,12 @@ import com.l2jserver.util.StringUtil;
public final class L2ClassMasterInstance extends L2MerchantInstance
{
/**
* @param objectId
* @param template
* Creates a class master.
* @param template the class master NPC template
*/
public L2ClassMasterInstance(int objectId, L2NpcTemplate template)
public L2ClassMasterInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ClassMasterInstance);
}

View File

@ -35,9 +35,13 @@ public class L2ControlTowerInstance extends L2Tower
{
private volatile List<L2Spawn> _guards;
public L2ControlTowerInstance(int objectId, L2NpcTemplate template)
/**
* Creates a control tower.
* @param template the control tower NPC template
*/
public L2ControlTowerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ControlTowerInstance);
}

View File

@ -44,9 +44,14 @@ public class L2ControllableAirShipInstance extends L2AirShipInstance
private Future<?> _consumeFuelTask;
private Future<?> _checkTask;
public L2ControllableAirShipInstance(int objectId, L2CharTemplate template, int ownerId)
/**
* Creates a controllable air ship.
* @param template the controllable air ship template
* @param ownerId the owner ID
*/
public L2ControllableAirShipInstance(L2CharTemplate template, int ownerId)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ControllableAirShipInstance);
_ownerId = ownerId;
_helmId = IdFactory.getInstance().getNextId(); // not forget to release !

View File

@ -40,6 +40,16 @@ public class L2ControllableMobInstance extends L2MonsterInstance
}
}
/**
* Creates a controllable monster.
* @param template the contrllable monster NPC template
*/
public L2ControllableMobInstance(L2NpcTemplate template)
{
super(template);
setInstanceType(InstanceType.L2ControllableMobInstance);
}
@Override
public boolean isAggressive()
{
@ -53,12 +63,6 @@ public class L2ControllableMobInstance extends L2MonsterInstance
return 500;
}
public L2ControllableMobInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
setInstanceType(InstanceType.L2ControllableMobInstance);
}
@Override
protected L2CharacterAI initAI()
{

View File

@ -38,9 +38,15 @@ public class L2DecoyInstance extends L2Decoy
private Future<?> _DecoyLifeTask;
private Future<?> _HateSpam;
public L2DecoyInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, int totalLifeTime)
/**
* Creates a decoy.
* @param template the decoy NPC template
* @param owner the owner
* @param totalLifeTime the total life time
*/
public L2DecoyInstance(L2NpcTemplate template, L2PcInstance owner, int totalLifeTime)
{
super(objectId, template, owner);
super(template, owner);
setInstanceType(InstanceType.L2DecoyInstance);
_totalLifeTime = totalLifeTime;
_timeRemaining = _totalLifeTime;

View File

@ -43,9 +43,13 @@ public class L2DefenderInstance extends L2Attackable
private Fort _fort = null; // the fortress which the instance should defend
private SiegableHall _hall = null; // the siegable hall which the instance should defend
public L2DefenderInstance(int objectId, L2NpcTemplate template)
/**
* Creates a defender.
* @param template the defender NPC template
*/
public L2DefenderInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2DefenderInstance);
}

View File

@ -79,12 +79,12 @@ public class L2DoorInstance extends L2Character
private Future<?> _autoCloseTask;
/**
* @param objectId
* @param template
* Creates a door.
* @param template the door template
*/
public L2DoorInstance(int objectId, L2DoorTemplate template)
public L2DoorInstance(L2DoorTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2DoorInstance);
setIsInvul(false);
setLethalable(false);

View File

@ -28,19 +28,15 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
/**
* This class ...
* @version $Revision$ $Date$
*/
public class L2DoormenInstance extends L2NpcInstance
{
/**
* @param objectID
* @param template
* Creates a doorman.
* @param template the doorman NPC template
*/
public L2DoormenInstance(int objectID, L2NpcTemplate template)
public L2DoormenInstance(L2NpcTemplate template)
{
super(objectID, template);
super(template);
setInstanceType(InstanceType.L2DoormenInstance);
}

View File

@ -28,9 +28,14 @@ public class L2EffectPointInstance extends L2Npc
{
private final L2PcInstance _owner;
public L2EffectPointInstance(int objectId, L2NpcTemplate template, L2Character owner)
/**
* Creates an effect point.
* @param template the effect point NPC template
* @param owner the owner
*/
public L2EffectPointInstance(L2NpcTemplate template, L2Character owner)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2EffectPointInstance);
setIsInvul(false);
_owner = owner == null ? null : owner.getActingPlayer();
@ -53,7 +58,6 @@ public class L2EffectPointInstance extends L2Npc
@Override
public void onAction(L2PcInstance player, boolean interact)
{
// Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
player.sendPacket(ActionFailed.STATIC_PACKET);
}

View File

@ -33,12 +33,16 @@ public class L2EventMonsterInstance extends L2MonsterInstance
// Event mobs should drop items to ground
// but item pickup must be protected to killer
// Todo: Some mobs need protect drop for spawner
// TODO: Some mobs need protect drop for spawner
public boolean drop_on_ground = false;
public L2EventMonsterInstance(int objectId, L2NpcTemplate template)
/**
* Creates an event monster.
* @param template the event monster NPC template
*/
public L2EventMonsterInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2EventMobInstance);
}

View File

@ -29,9 +29,9 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
// handled by scripted AI.
public class L2FeedableBeastInstance extends L2MonsterInstance
{
public L2FeedableBeastInstance(int objectId, L2NpcTemplate template)
public L2FeedableBeastInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2FeedableBeastInstance);
}
}

View File

@ -31,9 +31,13 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
public final class L2FishermanInstance extends L2MerchantInstance
{
public L2FishermanInstance(int objectId, L2NpcTemplate template)
/**
* Creates a fisherman.
* @param template the fisherman NPC template
*/
public L2FishermanInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2FishermanInstance);
}

View File

@ -36,9 +36,13 @@ public class L2FlameTowerInstance extends L2Tower
private int _upgradeLevel = 0;
private List<Integer> _zoneList;
public L2FlameTowerInstance(int objectId, L2NpcTemplate template)
/**
* Creates a flame tower.
* @param template the flame tower NPC template
*/
public L2FlameTowerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2FlameTowerInstance);
}

View File

@ -1,32 +0,0 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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.
*
* L2J Server 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.model.actor.instance;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
public final class L2FlyMonsterInstance extends L2MonsterInstance
{
public L2FlyMonsterInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
setInstanceType(InstanceType.L2FlyMonsterInstance);
setIsFlying(true);
}
}

View File

@ -1,32 +0,0 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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.
*
* L2J Server 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.model.actor.instance;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
public final class L2FlyNpcInstance extends L2NpcInstance
{
public L2FlyNpcInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
setInstanceType(InstanceType.L2FlyNpcInstance);
setIsFlying(true);
}
}

View File

@ -1,32 +0,0 @@
/*
* Copyright (C) 2004-2015 L2J Server
*
* This file is part of L2J Server.
*
* L2J Server 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.
*
* L2J Server 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.model.actor.instance;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
public final class L2FlyRaidBossInstance extends L2RaidBossInstance
{
public L2FlyRaidBossInstance(int objectId, L2NpcTemplate template)
{
super(objectId, template);
setInstanceType(InstanceType.L2FlyRaidBossInstance);
setIsFlying(true);
}
}

View File

@ -25,9 +25,13 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
public final class L2FlyTerrainObjectInstance extends L2Npc
{
public L2FlyTerrainObjectInstance(int objectId, L2NpcTemplate template)
/**
* Creates a fly terrain object.
* @param template the fly terrain object
*/
public L2FlyTerrainObjectInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2FlyTerrainObjectInstance);
setIsFlying(true);
}

View File

@ -37,12 +37,15 @@ import com.l2jserver.gameserver.network.serverpackets.NpcSay;
public class L2FortCommanderInstance extends L2DefenderInstance
{
private boolean _canTalk;
public L2FortCommanderInstance(int objectId, L2NpcTemplate template)
/**
* Creates a fort commander.
* @param template the fort commander NPC template
*/
public L2FortCommanderInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2FortCommanderInstance);
_canTalk = true;
}

View File

@ -27,9 +27,13 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
public class L2FortDoormenInstance extends L2DoormenInstance
{
public L2FortDoormenInstance(int objectID, L2NpcTemplate template)
/**
* Creates a fort doorman.
* @param template the fort doorman NPC template
*/
public L2FortDoormenInstance(L2NpcTemplate template)
{
super(objectID, template);
super(template);
setInstanceType(InstanceType.L2FortDoormenInstance);
}

View File

@ -22,7 +22,6 @@ import java.util.StringTokenizer;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
@ -57,9 +56,13 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
36363
};
public L2FortLogisticsInstance(int objectID, L2NpcTemplate template)
/**
* Creates a fort logistics.
* @param template the fort logistics NPC template
*/
public L2FortLogisticsInstance(L2NpcTemplate template)
{
super(objectID, template);
super(template);
setInstanceType(InstanceType.L2FortLogisticsInstance);
}
@ -147,8 +150,8 @@ public class L2FortLogisticsInstance extends L2MerchantInstance
if (level > 0)
{
// spawn box
L2NpcTemplate BoxTemplate = NpcData.getInstance().getTemplate(SUPPLY_BOX_IDS[level - 1]);
L2MonsterInstance box = new L2MonsterInstance(IdFactory.getInstance().getNextId(), BoxTemplate);
L2NpcTemplate boxTemplate = NpcData.getInstance().getTemplate(SUPPLY_BOX_IDS[level - 1]);
L2MonsterInstance box = new L2MonsterInstance(boxTemplate);
box.setCurrentHp(box.getMaxHp());
box.setCurrentMp(box.getMaxMp());
box.setHeading(0);

View File

@ -48,9 +48,13 @@ public class L2FortManagerInstance extends L2MerchantInstance
protected static final int COND_BUSY_BECAUSE_OF_SIEGE = 1;
protected static final int COND_OWNER = 2;
public L2FortManagerInstance(int objectId, L2NpcTemplate template)
/**
* Creates a fort manager.
* @param template the fort manager NPC template
*/
public L2FortManagerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2FortManagerInstance);
}

View File

@ -30,9 +30,13 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
*/
public class L2FriendlyMobInstance extends L2Attackable
{
public L2FriendlyMobInstance(int objectId, L2NpcTemplate template)
/**
* Creates a friendly monster.
* @param template the friendly monster NPC template
*/
public L2FriendlyMobInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2FriendlyMobInstance);
}

View File

@ -38,13 +38,12 @@ public final class L2GrandBossInstance extends L2MonsterInstance
private boolean _useRaidCurse = true;
/**
* Constructor for L2GrandBossInstance. This represent all grandbosses.
* @param objectId ID of the instance
* @param template L2NpcTemplate of the instance
* Creates a grand boss.
* @param template the grand boss NPC template
*/
public L2GrandBossInstance(int objectId, L2NpcTemplate template)
public L2GrandBossInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2GrandBossInstance);
setIsRaid(true);
setLethalable(false);

View File

@ -44,19 +44,12 @@ public class L2GuardInstance extends L2Attackable
private static Logger _log = Logger.getLogger(L2GuardInstance.class.getName());
/**
* Constructor of L2GuardInstance (use L2Character and L2NpcInstance constructor).<br>
* <B><U> Actions</U> :</B>
* <ul>
* <li>Call the L2Character constructor to set the _template of the L2GuardInstance (copy skills from template to object and link _calculators to NPC_STD_CALCULATOR)</li>
* <li>Set the name of the L2GuardInstance</li>
* <li>Create a RandomAnimation Task that will be launched after the calculated delay if the server allow it</li>
* </ul>
* @param objectId the identifier of the object to initialized
* @param template to apply to the NPC
* Creates a guard.
* @param template the guard NPC template
*/
public L2GuardInstance(int objectId, L2NpcTemplate template)
public L2GuardInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2GuardInstance);
}

View File

@ -37,12 +37,12 @@ public class L2MerchantInstance extends L2NpcInstance
private MerchantPriceConfig _mpc;
/**
* @param objectId
* @param template
* Creates a merchant,
* @param template the merchant NPC template
*/
public L2MerchantInstance(int objectId, L2NpcTemplate template)
public L2MerchantInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2MerchantInstance);
}

View File

@ -37,6 +37,8 @@ import com.l2jserver.gameserver.util.MinionList;
*/
public class L2MonsterInstance extends L2Attackable
{
private static final int MONSTER_MAINTENANCE_INTERVAL = 1000;
protected boolean _enableMinions = true;
private L2MonsterInstance _master = null;
@ -44,22 +46,13 @@ public class L2MonsterInstance extends L2Attackable
protected ScheduledFuture<?> _maintenanceTask = null;
private static final int MONSTER_MAINTENANCE_INTERVAL = 1000;
/**
* Constructor of L2MonsterInstance (use L2Character and L2NpcInstance constructor).<br>
* <B><U> Actions</U> :</B>
* <ul>
* <li>Call the L2Character constructor to set the _template of the L2MonsterInstance (copy skills from template to object and link _calculators to NPC_STD_CALCULATOR)</li>
* <li>Set the name of the L2MonsterInstance</li>
* <li>Create a RandomAnimation Task that will be launched after the calculated delay if the server allow it</li>
* </ul>
* @param objectId the identifier of the object to initialized
* @param template to apply to the NPC
* Creates a monster.
* @param template the monster NPC template
*/
public L2MonsterInstance(int objectId, L2NpcTemplate template)
public L2MonsterInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2MonsterInstance);
setAutoAttackable(true);
}

View File

@ -38,9 +38,13 @@ import com.l2jserver.util.StringUtil;
public class L2NpcInstance extends L2Npc
{
public L2NpcInstance(int objectId, L2NpcTemplate template)
/**
* Creates a NPC.
* @param template the NPC template
*/
public L2NpcInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2NpcInstance);
setIsInvul(false);
}

View File

@ -29,9 +29,13 @@ import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
*/
public final class L2ObservationInstance extends L2Npc
{
public L2ObservationInstance(int objectId, L2NpcTemplate template)
/**
* Creates an observation.
* @param template the observation NPC template
*/
public L2ObservationInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ObservationInstance);
}

View File

@ -29,9 +29,13 @@ import com.l2jserver.gameserver.model.olympiad.Olympiad;
*/
public class L2OlympiadManagerInstance extends L2Npc
{
public L2OlympiadManagerInstance(int objectId, L2NpcTemplate template)
/**
* Creates an olympiad manager.
* @param template the olympiad manager NPC template
*/
public L2OlympiadManagerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2OlympiadManagerInstance);
}

View File

@ -875,6 +875,47 @@ public final class L2PcInstance extends L2Playable
private volatile int _actionMask;
/**
* Creates a player.
* @param objectId the object ID
* @param template the player template
* @param accountName the account name
* @param app the player appearance
*/
private L2PcInstance(int objectId, L2PcTemplate template, String accountName, PcAppearance app)
{
super(objectId, template);
setInstanceType(InstanceType.L2PcInstance);
super.initCharStatusUpdateValues();
initPcStatusUpdateValues();
for (int i = 0; i < _htmlActionCaches.length; ++i)
{
_htmlActionCaches[i] = new LinkedList<>();
}
_accountName = accountName;
app.setOwner(this);
_appearance = app;
// Create an AI
getAI();
// Create a L2Radar object
_radar = new L2Radar(this);
}
/**
* Creates a player.
* @param template the player template
* @param accountName the account name
* @param app the player appearance
*/
private L2PcInstance(L2PcTemplate template, String accountName, PcAppearance app)
{
this(IdFactory.getInstance().getNextId(), template, accountName, app);
}
public void setPvpFlagLasts(long time)
{
_pvpFlagLasts = time;
@ -951,7 +992,7 @@ public final class L2PcInstance extends L2Playable
public static L2PcInstance create(L2PcTemplate template, String accountName, String name, PcAppearance app)
{
// Create a new L2PcInstance with an account name
L2PcInstance player = new L2PcInstance(IdFactory.getInstance().getNextId(), template, accountName, app);
L2PcInstance player = new L2PcInstance(template, accountName, app);
// Set the name of the L2PcInstance
player.setName(name);
// Set Character's create time
@ -1115,42 +1156,6 @@ public final class L2PcInstance extends L2Playable
_mpUpdateDecCheck = getMaxMp() - _mpUpdateInterval;
}
/**
* Constructor of L2PcInstance (use L2Character constructor).<br>
* <B><U> Actions</U> :</B>
* <ul>
* <li>Call the L2Character constructor to create an empty _skills slot and copy basic Calculator set to this L2PcInstance</li>
* <li>Set the name of the L2PcInstance</li>
* </ul>
* <FONT COLOR=#FF0000><B> <U>Caution</U> : This method SET the level of the L2PcInstance to 1</B></FONT>
* @param objectId Identifier of the object to initialized
* @param template The L2PcTemplate to apply to the L2PcInstance
* @param accountName The name of the account including this L2PcInstance
* @param app
*/
private L2PcInstance(int objectId, L2PcTemplate template, String accountName, PcAppearance app)
{
super(objectId, template);
setInstanceType(InstanceType.L2PcInstance);
super.initCharStatusUpdateValues();
initPcStatusUpdateValues();
for (int i = 0; i < _htmlActionCaches.length; ++i)
{
_htmlActionCaches[i] = new LinkedList<>();
}
_accountName = accountName;
app.setOwner(this);
_appearance = app;
// Create an AI
getAI();
// Create a L2Radar object
_radar = new L2Radar(this);
}
@Override
public final PcKnownList getKnownList()
{

View File

@ -43,7 +43,6 @@ import com.l2jserver.gameserver.enums.ItemLocation;
import com.l2jserver.gameserver.enums.PartyDistributionType;
import com.l2jserver.gameserver.handler.IItemHandler;
import com.l2jserver.gameserver.handler.ItemHandler;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
import com.l2jserver.gameserver.instancemanager.FortSiegeManager;
import com.l2jserver.gameserver.instancemanager.ItemsOnGroundManager;
@ -97,6 +96,42 @@ public class L2PetInstance extends L2Summon
private long _expBeforeDeath = 0;
private int _curWeightPenalty = 0;
/**
* Creates a pet.
* @param template the pet NPC template
* @param owner the owner
* @param control the summoning item
*/
public L2PetInstance(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
{
this(template, owner, control, (byte) (template.getDisplayId() == 12564 ? owner.getLevel() : template.getLevel()));
}
/**
* Creates a pet.
* @param template the pet NPC template
* @param owner the pet NPC template
* @param control the summoning item
* @param level the level
*/
public L2PetInstance(L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control, byte level)
{
super(template, owner);
setInstanceType(InstanceType.L2PetInstance);
_controlObjectId = control.getObjectId();
getStat().setLevel((byte) Math.max(level, PetDataTable.getInstance().getPetMinLevel(template.getId())));
_inventory = new PetInventory(this);
_inventory.restore();
int npcId = template.getId();
_mountable = PetDataTable.isMountable(npcId);
getPetData();
getPetLevelData();
}
public final L2PetLevelData getPetLevelData()
{
if (_leveldata == null)
@ -239,44 +274,6 @@ public class L2PetInstance extends L2Summon
return pet;
}
/**
* Constructor for new pet
* @param objectId
* @param template
* @param owner
* @param control
*/
public L2PetInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control)
{
this(objectId, template, owner, control, (byte) (template.getDisplayId() == 12564 ? owner.getLevel() : template.getLevel()));
}
/**
* Constructor for restored pet
* @param objectId
* @param template
* @param owner
* @param control
* @param level
*/
public L2PetInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, L2ItemInstance control, byte level)
{
super(objectId, template, owner);
setInstanceType(InstanceType.L2PetInstance);
_controlObjectId = control.getObjectId();
getStat().setLevel((byte) Math.max(level, PetDataTable.getInstance().getPetMinLevel(template.getId())));
_inventory = new PetInventory(this);
_inventory.restore();
int npcId = template.getId();
_mountable = PetDataTable.isMountable(npcId);
getPetData();
getPetLevelData();
}
@Override
public PetStat getStat()
{
@ -863,27 +860,26 @@ public class L2PetInstance extends L2Summon
statement.setInt(1, control.getObjectId());
try (ResultSet rset = statement.executeQuery())
{
final int id = IdFactory.getInstance().getNextId();
if (!rset.next())
{
if (template.isType("L2BabyPet"))
{
pet = new L2BabyPetInstance(id, template, owner, control);
pet = new L2BabyPetInstance(template, owner, control);
}
else
{
pet = new L2PetInstance(id, template, owner, control);
pet = new L2PetInstance(template, owner, control);
}
return pet;
}
if (template.isType("L2BabyPet"))
{
pet = new L2BabyPetInstance(id, template, owner, control, rset.getByte("level"));
pet = new L2BabyPetInstance(template, owner, control, rset.getByte("level"));
}
else
{
pet = new L2PetInstance(id, template, owner, control, rset.getByte("level"));
pet = new L2PetInstance(template, owner, control, rset.getByte("level"));
}
pet._respawned = true;

View File

@ -26,9 +26,13 @@ import com.l2jserver.gameserver.util.Evolve;
public class L2PetManagerInstance extends L2MerchantInstance
{
public L2PetManagerInstance(int objectID, L2NpcTemplate template)
/**
* Creates a pet manager.
* @param template the pet manager NPC template.
*/
public L2PetManagerInstance(L2NpcTemplate template)
{
super(objectID, template);
super(template);
setInstanceType(InstanceType.L2PetManagerInstance);
}

View File

@ -36,9 +36,13 @@ public final class L2QuestGuardInstance extends L2GuardInstance
private boolean _isAutoAttackable = true;
private boolean _isPassive = false;
public L2QuestGuardInstance(int objectId, L2NpcTemplate template)
/**
* Creates a quest guard.
* @param template the quest guard NPC template
*/
public L2QuestGuardInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2QuestGuardInstance);
}

View File

@ -92,9 +92,13 @@ public class L2RaceManagerInstance extends L2Npc
100000
};
public L2RaceManagerInstance(int objectId, L2NpcTemplate template)
/**
* Creates a race manager.
* @param template the race manager NPC template
*/
public L2RaceManagerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2RaceManagerInstance);
if (_notInitialized)
{

View File

@ -43,19 +43,12 @@ public class L2RaidBossInstance extends L2MonsterInstance
private boolean _useRaidCurse = true;
/**
* Constructor of L2RaidBossInstance (use L2Character and L2NpcInstance constructor).<br>
* <B><U>Actions</U>:</B>
* <ul>
* <li>Call the L2Character constructor to set the _template of the L2RaidBossInstance (copy skills from template to object and link _calculators to NPC_STD_CALCULATOR)</li>
* <li>Set the name of the L2RaidBossInstance</li>
* <li>Create a RandomAnimation Task that will be launched after the calculated delay if the server allow it</li>
* </ul>
* @param objectId the identifier of the object to initialized
* @param template to apply to the NPC
* Creates a raid boss.
* @param template the raid boss template
*/
public L2RaidBossInstance(int objectId, L2NpcTemplate template)
public L2RaidBossInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2RaidBossInstance);
setIsRaid(true);
setLethalable(false);

View File

@ -44,9 +44,12 @@ public class L2SepulcherMonsterInstance extends L2MonsterInstance
protected Future<?> _changeImmortalTask = null;
protected Future<?> _onDeadEventTask = null;
public L2SepulcherMonsterInstance(int objectId, L2NpcTemplate template)
/**
* @param template
*/
public L2SepulcherMonsterInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2SepulcherMonsterInstance);
setShowSummonAnimation(true);
switch (template.getId())

View File

@ -54,9 +54,13 @@ public class L2SepulcherNpcInstance extends L2Npc
private static final String HTML_FILE_PATH = "data/html/SepulcherNpc/";
private static final int HALLS_KEY = 7260;
public L2SepulcherNpcInstance(int objectID, L2NpcTemplate template)
/**
* Creates a sepulcher.
* @param template the sepulcher NPC template
*/
public L2SepulcherNpcInstance(L2NpcTemplate template)
{
super(objectID, template);
super(template);
setInstanceType(InstanceType.L2SepulcherNpcInstance);
setShowSummonAnimation(true);

View File

@ -72,9 +72,9 @@ public class L2ServitorInstance extends L2Summon implements Runnable
private int _referenceSkill;
public L2ServitorInstance(int objectId, L2NpcTemplate template, L2PcInstance owner)
public L2ServitorInstance(L2NpcTemplate template, L2PcInstance owner)
{
super(objectId, template, owner);
super(template, owner);
setInstanceType(InstanceType.L2ServitorInstance);
setShowSummonAnimation(true);
}

View File

@ -39,9 +39,9 @@ public class L2ShuttleInstance extends L2Vehicle
{
private L2ShuttleData _shuttleData;
public L2ShuttleInstance(int objectId, L2CharTemplate template)
public L2ShuttleInstance(L2CharTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2ShuttleInstance);
setAI(new L2ShuttleAI(new AIAccessor()));
}

View File

@ -43,9 +43,16 @@ public class L2SiegeFlagInstance extends L2Npc
private final boolean _isAdvanced;
private boolean _canTalk;
public L2SiegeFlagInstance(L2PcInstance player, int objectId, L2NpcTemplate template, boolean advanced, boolean outPost)
/**
* Creates a siege flag.
* @param player
* @param template
* @param advanced
* @param outPost
*/
public L2SiegeFlagInstance(L2PcInstance player, L2NpcTemplate template, boolean advanced, boolean outPost)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2SiegeFlagInstance);
_clan = player.getClan();

View File

@ -81,6 +81,18 @@ public final class L2StaticObjectInstance extends L2Character
}
}
/**
* Creates a static object.
* @param template the static object
* @param staticId the static ID
*/
public L2StaticObjectInstance(L2CharTemplate template, int staticId)
{
super(template);
setInstanceType(InstanceType.L2StaticObjectInstance);
_staticObjectId = staticId;
}
@Override
protected L2CharacterAI initAI()
{
@ -97,18 +109,6 @@ public final class L2StaticObjectInstance extends L2Character
return _staticObjectId;
}
/**
* @param objectId
* @param template
* @param staticId
*/
public L2StaticObjectInstance(int objectId, L2CharTemplate template, int staticId)
{
super(objectId, template);
setInstanceType(InstanceType.L2StaticObjectInstance);
_staticObjectId = staticId;
}
@Override
public final StaticObjectKnownList getKnownList()
{

View File

@ -29,7 +29,6 @@ import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.enums.InstanceType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
@ -64,16 +63,16 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
protected boolean _isFreyaBeast;
private List<Skill> _beastSkills = null;
public L2TamedBeastInstance(int objectId, int npcTemplateId)
public L2TamedBeastInstance(int npcTemplateId)
{
super(IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(npcTemplateId));
super(NpcData.getInstance().getTemplate(npcTemplateId));
setInstanceType(InstanceType.L2TamedBeastInstance);
setHome(this);
}
public L2TamedBeastInstance(int npcTemplateId, L2PcInstance owner, int foodSkillId, int x, int y, int z)
{
super(IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(npcTemplateId));
super(NpcData.getInstance().getTemplate(npcTemplateId));
_isFreyaBeast = false;
setInstanceType(InstanceType.L2TamedBeastInstance);
setCurrentHp(getMaxHp());
@ -86,7 +85,7 @@ public final class L2TamedBeastInstance extends L2FeedableBeastInstance
public L2TamedBeastInstance(int npcTemplateId, L2PcInstance owner, int food, int x, int y, int z, boolean isFreyaBeast)
{
super(IdFactory.getInstance().getNextId(), NpcData.getInstance().getTemplate(npcTemplateId));
super(NpcData.getInstance().getTemplate(npcTemplateId));
_isFreyaBeast = isFreyaBeast;
setInstanceType(InstanceType.L2TamedBeastInstance);
setCurrentHp(getMaxHp());

View File

@ -63,12 +63,12 @@ public final class L2TeleporterInstance extends L2Npc
private static final int COND_REGULAR = 3;
/**
* @param objectId
* @param template
* Creates a teleporter.
* @param template the teleporter NPC template
*/
public L2TeleporterInstance(int objectId, L2NpcTemplate template)
public L2TeleporterInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2TeleporterInstance);
}

View File

@ -25,9 +25,13 @@ import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
public final class L2TerrainObjectInstance extends L2Npc
{
public L2TerrainObjectInstance(int objectId, L2NpcTemplate template)
/**
* Creates a terrain object.
* @param template the terrain object NPC template
*/
public L2TerrainObjectInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2TerrainObjectInstance);
}

View File

@ -23,9 +23,13 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
public class L2TrainerInstance extends L2NpcInstance
{
public L2TrainerInstance(int objectId, L2NpcTemplate template)
/**
* Creates a trainer.
* @param template the trainer NPC template
*/
public L2TrainerInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2TrainerInstance);
}

View File

@ -64,9 +64,15 @@ public final class L2TrapInstance extends L2Npc
// Tasks
private ScheduledFuture<?> _trapTask = null;
public L2TrapInstance(int objectId, L2NpcTemplate template, int instanceId, int lifeTime)
/**
* Creates a trap.
* @param template the trap NPC template
* @param instanceId the instance ID
* @param lifeTime the life time
*/
public L2TrapInstance(L2NpcTemplate template, int instanceId, int lifeTime)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2TrapInstance);
setInstanceId(instanceId);
setName(template.getName());
@ -84,9 +90,15 @@ public final class L2TrapInstance extends L2Npc
}
}
public L2TrapInstance(int objectId, L2NpcTemplate template, L2PcInstance owner, int lifeTime)
/**
* Creates a trap.
* @param template the trap NPC template
* @param owner the owner
* @param lifeTime the life time
*/
public L2TrapInstance(L2NpcTemplate template, L2PcInstance owner, int lifeTime)
{
this(objectId, template, owner.getInstanceId(), lifeTime);
this(template, owner.getInstanceId(), lifeTime);
_owner = owner;
}

View File

@ -24,9 +24,13 @@ import com.l2jserver.gameserver.model.base.PlayerClass;
public final class L2VillageMasterDElfInstance extends L2VillageMasterInstance
{
public L2VillageMasterDElfInstance(int objectId, L2NpcTemplate template)
/**
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterDElfInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
@Override

View File

@ -24,9 +24,13 @@ import com.l2jserver.gameserver.model.base.PlayerClass;
public final class L2VillageMasterDwarfInstance extends L2VillageMasterInstance
{
public L2VillageMasterDwarfInstance(int objectId, L2NpcTemplate template)
/**
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterDwarfInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
@Override

View File

@ -25,9 +25,13 @@ import com.l2jserver.gameserver.model.base.PlayerClass;
public final class L2VillageMasterFighterInstance extends L2VillageMasterInstance
{
public L2VillageMasterFighterInstance(int objectId, L2NpcTemplate template)
/**
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterFighterInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
@Override

View File

@ -60,12 +60,12 @@ public class L2VillageMasterInstance extends L2NpcInstance
private static Logger _log = Logger.getLogger(L2VillageMasterInstance.class.getName());
/**
* @param objectId
* @param template
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterInstance(int objectId, L2NpcTemplate template)
public L2VillageMasterInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2VillageMasterInstance);
}

View File

@ -24,9 +24,13 @@ import com.l2jserver.gameserver.model.base.PlayerClass;
public final class L2VillageMasterKamaelInstance extends L2VillageMasterInstance
{
public L2VillageMasterKamaelInstance(int objectId, L2NpcTemplate template)
/**
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterKamaelInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
@Override

View File

@ -25,9 +25,13 @@ import com.l2jserver.gameserver.model.base.PlayerClass;
public final class L2VillageMasterMysticInstance extends L2VillageMasterInstance
{
public L2VillageMasterMysticInstance(int objectId, L2NpcTemplate template)
/**
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterMysticInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
@Override

View File

@ -24,9 +24,13 @@ import com.l2jserver.gameserver.model.base.PlayerClass;
public final class L2VillageMasterOrcInstance extends L2VillageMasterInstance
{
public L2VillageMasterOrcInstance(int objectId, L2NpcTemplate template)
/**
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterOrcInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
@Override

View File

@ -25,9 +25,13 @@ import com.l2jserver.gameserver.model.base.PlayerClass;
public final class L2VillageMasterPriestInstance extends L2VillageMasterInstance
{
public L2VillageMasterPriestInstance(int objectId, L2NpcTemplate template)
/**
* Creates a village master.
* @param template the village master NPC template
*/
public L2VillageMasterPriestInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
}
@Override

View File

@ -24,12 +24,12 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
public class L2WarehouseInstance extends L2NpcInstance
{
/**
* @param objectId
* @param template
* Creates a warehouse NPC.
* @param template the warehouse NPC template
*/
public L2WarehouseInstance(int objectId, L2NpcTemplate template)
public L2WarehouseInstance(L2NpcTemplate template)
{
super(objectId, template);
super(template);
setInstanceType(InstanceType.L2WarehouseInstance);
}

View File

@ -46,7 +46,6 @@ import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.enums.ChatType;
import com.l2jserver.gameserver.enums.InstanceReenterType;
import com.l2jserver.gameserver.enums.InstanceRemoveBuffType;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.L2World;
@ -273,7 +272,7 @@ public final class Instance
return;
}
final L2DoorInstance newdoor = new L2DoorInstance(IdFactory.getInstance().getNextId(), new L2DoorTemplate(set));
final L2DoorInstance newdoor = new L2DoorInstance(new L2DoorTemplate(set));
newdoor.setInstanceId(getId());
newdoor.setCurrentHp(newdoor.getMaxHp());
newdoor.spawnMe(newdoor.getTemplate().getX(), newdoor.getTemplate().getY(), newdoor.getTemplate().getZ());

View File

@ -43,7 +43,6 @@ import com.l2jserver.gameserver.data.xml.impl.DoorData;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.enums.QuestSound;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.instancemanager.CastleManager;
import com.l2jserver.gameserver.instancemanager.FortManager;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
@ -1790,7 +1789,7 @@ public abstract class AbstractScript extends ManagedScript
public L2TrapInstance addTrap(int trapId, int x, int y, int z, int heading, Skill skill, int instanceId)
{
final L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(trapId);
L2TrapInstance trap = new L2TrapInstance(IdFactory.getInstance().getNextId(), npcTemplate, instanceId, -1);
L2TrapInstance trap = new L2TrapInstance(npcTemplate, instanceId, -1);
trap.setCurrentHp(trap.getMaxHp());
trap.setCurrentMp(trap.getMaxMp());
trap.setIsInvul(true);

View File

@ -18,17 +18,14 @@
*/
package com.l2jserver.gameserver.util;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Logger;
import com.l2jserver.Config;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.idfactory.IdFactory;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2MonsterInstance;
@ -55,7 +52,6 @@ public class MinionList
{
throw new NullPointerException("MinionList: master is null");
}
_master = pMaster;
}
@ -346,10 +342,7 @@ public class MinionList
{
return null;
}
// Create and Init the Minion and generate its Identifier
L2MonsterInstance minion = new L2MonsterInstance(IdFactory.getInstance().getNextId(), minionTemplate);
return initializeNpcInstance(master, minion);
return initializeNpcInstance(master, new L2MonsterInstance(minionTemplate));
}
protected static final L2MonsterInstance initializeNpcInstance(L2MonsterInstance master, L2MonsterInstance minion)
@ -422,18 +415,8 @@ public class MinionList
return _minionReferences.size();
}
public final int lazyCountSpawnedMinionsGroups()
public final long lazyCountSpawnedMinionsGroups()
{
Set<Integer> seenGroups = new HashSet<>();
for (L2MonsterInstance minion : _minionReferences)
{
if (minion == null)
{
continue;
}
seenGroups.add(minion.getId());
}
return seenGroups.size();
return _minionReferences.stream().distinct().count();
}
}

View File

@ -24,10 +24,9 @@ import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.StringJoiner;
import java.util.StringTokenizer;
@ -309,10 +308,9 @@ public final class Util
public static String implodeString(Iterable<String> strArray, String strDelim)
{
final StringJoiner sj = new StringJoiner(strDelim);
for (String strValue : strArray)
for (String str : strArray)
{
sj.add(strValue);
sj.add(str);
}
return sj.toString();
}
@ -709,26 +707,7 @@ public final class Util
*/
public static void fillMultiEditContent(L2PcInstance activeChar, String text)
{
text = text.replaceAll("<br>", Config.EOL);
List<String> arg = new ArrayList<>();
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
arg.add(activeChar.getName());
arg.add(Integer.toString(activeChar.getObjectId()));
arg.add(activeChar.getAccountName());
arg.add("9");
arg.add(" ");
arg.add(" ");
arg.add(text);
arg.add("0");
arg.add("0");
arg.add("0");
arg.add("0");
activeChar.sendPacket(new ShowBoard(arg));
activeChar.sendPacket(new ShowBoard(Arrays.asList("0", "0", "0", "0", "0", "0", activeChar.getName(), Integer.toString(activeChar.getObjectId()), activeChar.getAccountName(), "9", " ", " ", text.replaceAll("<br>", Config.EOL), "0", "0", "0", "0")));
}
/**