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

@ -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);
}