Sync with L2jServer HighFive Feb 15th 2015.
This commit is contained in:
parent
f2d6aedabe
commit
06c765ea63
@ -28,7 +28,6 @@ import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
|
||||
import com.l2jserver.gameserver.instancemanager.ZoneManager;
|
||||
@ -41,7 +40,6 @@ import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.effects.L2EffectType;
|
||||
import com.l2jserver.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
@ -117,15 +115,11 @@ public final class Beleth extends AbstractNpcAI
|
||||
{
|
||||
try
|
||||
{
|
||||
L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
|
||||
if (template != null)
|
||||
{
|
||||
L2Spawn spawn = new L2Spawn(template);
|
||||
spawn.setInstanceId(loc.getInstanceId());
|
||||
spawn.setLocation(loc);
|
||||
spawn.setAmount(spawn.getAmount() + 1);
|
||||
return spawn.doSpawn();
|
||||
}
|
||||
final L2Spawn spawn = new L2Spawn(npcId);
|
||||
spawn.setInstanceId(loc.getInstanceId());
|
||||
spawn.setLocation(loc);
|
||||
spawn.setAmount(spawn.getAmount() + 1);
|
||||
return spawn.doSpawn();
|
||||
}
|
||||
catch (Exception ignored)
|
||||
{
|
||||
|
@ -18,8 +18,6 @@
|
||||
*/
|
||||
package ai.npc;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
@ -38,8 +36,6 @@ import com.l2jserver.gameserver.util.Broadcast;
|
||||
*/
|
||||
public abstract class AbstractNpcAI extends Quest
|
||||
{
|
||||
public final Logger _log = Logger.getLogger(getClass().getSimpleName());
|
||||
|
||||
public AbstractNpcAI(String name, String descr)
|
||||
{
|
||||
super(-1, name, descr);
|
||||
|
@ -30,7 +30,6 @@ import org.w3c.dom.Node;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.xml.IXmlReader;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.L2Territory;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
@ -227,7 +226,7 @@ public class TarBeetleSpawn implements IXmlReader
|
||||
final Location location = _zones.get(Rnd.get(_zones.size())).getRandomPoint();
|
||||
if (location != null)
|
||||
{
|
||||
final L2Spawn spawn = new L2Spawn(NpcData.getInstance().getTemplate(18804));
|
||||
final L2Spawn spawn = new L2Spawn(18804);
|
||||
spawn.setHeading(Rnd.get(65535));
|
||||
spawn.setX(location.getX());
|
||||
spawn.setY(location.getY());
|
||||
|
@ -24,7 +24,6 @@ import java.util.Map.Entry;
|
||||
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
@ -65,7 +64,7 @@ public final class FortressOfResistance extends ClanHallSiegeEngine
|
||||
|
||||
try
|
||||
{
|
||||
_nurka = new L2Spawn(NpcData.getInstance().getTemplate(BLOODY_LORD_NURKA));
|
||||
_nurka = new L2Spawn(BLOODY_LORD_NURKA);
|
||||
_nurka.setAmount(1);
|
||||
_nurka.setRespawnDelay(10800);
|
||||
// @formatter:off
|
||||
|
@ -35,7 +35,6 @@ import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
|
||||
@ -715,7 +714,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine
|
||||
{
|
||||
try
|
||||
{
|
||||
_gourds[i] = new L2Spawn(NpcData.getInstance().getTemplate(GOURDS[i]));
|
||||
_gourds[i] = new L2Spawn(GOURDS[i]);
|
||||
_gourds[i].setX(ARENAS[i].getX() + 150);
|
||||
_gourds[i].setY(ARENAS[i].getY() + 150);
|
||||
_gourds[i].setZ(ARENAS[i].getZ());
|
||||
|
@ -32,7 +32,6 @@ import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.ai.L2SpecialSiegeGuardAI;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.enums.SiegeClanType;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2ClanMember;
|
||||
@ -43,7 +42,6 @@ import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.TeleportWhereType;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.entity.Siegable;
|
||||
import com.l2jserver.gameserver.model.entity.clanhall.ClanHallSiegeEngine;
|
||||
import com.l2jserver.gameserver.model.entity.clanhall.SiegeStatus;
|
||||
@ -629,20 +627,6 @@ public abstract class FlagWar extends ClanHallSiegeEngine
|
||||
{
|
||||
try
|
||||
{
|
||||
L2NpcTemplate mahumTemplate = NpcData.getInstance().getTemplate(data.npc);
|
||||
L2NpcTemplate flagTemplate = NpcData.getInstance().getTemplate(data.flag);
|
||||
|
||||
if (flagTemplate == null)
|
||||
{
|
||||
_log.warning(getName() + ": Flag L2NpcTemplate[" + data.flag + "] does not exist!");
|
||||
throw new NullPointerException();
|
||||
}
|
||||
else if (mahumTemplate == null)
|
||||
{
|
||||
_log.warning(getName() + ": Ally L2NpcTemplate[" + data.npc + "] does not exist!");
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
if (_firstPhase)
|
||||
{
|
||||
@ -654,13 +638,13 @@ public abstract class FlagWar extends ClanHallSiegeEngine
|
||||
}
|
||||
Location loc = FLAG_COORDS[index];
|
||||
|
||||
data.flagInstance = new L2Spawn(flagTemplate);
|
||||
data.flagInstance = new L2Spawn(data.flag);
|
||||
data.flagInstance.setLocation(loc);
|
||||
data.flagInstance.setRespawnDelay(10000);
|
||||
data.flagInstance.setAmount(1);
|
||||
data.flagInstance.init();
|
||||
|
||||
data.warrior = new L2Spawn(mahumTemplate);
|
||||
data.warrior = new L2Spawn(data.npc);
|
||||
data.warrior.setLocation(loc);
|
||||
data.warrior.setRespawnDelay(10000);
|
||||
data.warrior.setAmount(1);
|
||||
|
@ -396,23 +396,21 @@ public class AdminSpawn implements IAdminCommandHandler
|
||||
target = activeChar;
|
||||
}
|
||||
|
||||
L2NpcTemplate template1;
|
||||
L2NpcTemplate template;
|
||||
if (monsterId.matches("[0-9]*"))
|
||||
{
|
||||
// First parameter was an ID number
|
||||
int monsterTemplate = Integer.parseInt(monsterId);
|
||||
template1 = NpcData.getInstance().getTemplate(monsterTemplate);
|
||||
template = NpcData.getInstance().getTemplate(Integer.parseInt(monsterId));
|
||||
}
|
||||
else
|
||||
{
|
||||
// First parameter wasn't just numbers so go by name not ID
|
||||
monsterId = monsterId.replace('_', ' ');
|
||||
template1 = NpcData.getInstance().getTemplateByName(monsterId);
|
||||
template = NpcData.getInstance().getTemplateByName(monsterId.replace('_', ' '));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
L2Spawn spawn = new L2Spawn(template1);
|
||||
final L2Spawn spawn = new L2Spawn(template);
|
||||
if (Config.SAVE_GMSPAWN_ON_CUSTOM)
|
||||
{
|
||||
spawn.setCustom(true);
|
||||
@ -435,15 +433,15 @@ public class AdminSpawn implements IAdminCommandHandler
|
||||
// TODO add checks for GrandBossSpawnManager
|
||||
if (RaidBossSpawnManager.getInstance().isDefined(spawn.getId()))
|
||||
{
|
||||
activeChar.sendMessage("You cannot spawn another instance of " + template1.getName() + ".");
|
||||
activeChar.sendMessage("You cannot spawn another instance of " + template.getName() + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (RaidBossSpawnManager.getInstance().getValidTemplate(spawn.getId()) != null)
|
||||
if (template.isType("L2RaidBoss"))
|
||||
{
|
||||
spawn.setRespawnMinDelay(43200);
|
||||
spawn.setRespawnMaxDelay(129600);
|
||||
RaidBossSpawnManager.getInstance().addNewSpawn(spawn, 0, template1.getBaseHpMax(), template1.getBaseMpMax(), permanent);
|
||||
RaidBossSpawnManager.getInstance().addNewSpawn(spawn, 0, template.getBaseHpMax(), template.getBaseMpMax(), permanent);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -454,7 +452,7 @@ public class AdminSpawn implements IAdminCommandHandler
|
||||
{
|
||||
spawn.stopRespawn();
|
||||
}
|
||||
activeChar.sendMessage("Created " + template1.getName() + " on " + target.getObjectId());
|
||||
activeChar.sendMessage("Created " + template.getName() + " on " + target.getObjectId());
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -28,7 +28,6 @@ import java.util.logging.Logger;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.handler.IAdminCommandHandler;
|
||||
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
|
||||
@ -41,7 +40,6 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2GrandBossInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2RaidBossInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
|
||||
import com.l2jserver.util.StringUtil;
|
||||
@ -544,15 +542,6 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
{
|
||||
L2Npc target = (L2Npc) obj;
|
||||
|
||||
int monsterTemplate = target.getTemplate().getId();
|
||||
L2NpcTemplate template1 = NpcData.getInstance().getTemplate(monsterTemplate);
|
||||
if (template1 == null)
|
||||
{
|
||||
activeChar.sendMessage("Incorrect monster template.");
|
||||
_log.warning("ERROR: NPC " + target.getObjectId() + " has a 'null' template.");
|
||||
return;
|
||||
}
|
||||
|
||||
L2Spawn spawn = target.getSpawn();
|
||||
if (spawn == null)
|
||||
{
|
||||
@ -568,9 +557,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
|
||||
try
|
||||
{
|
||||
// L2MonsterInstance mob = new L2MonsterInstance(monsterTemplate, template1);
|
||||
|
||||
spawn = new L2Spawn(template1);
|
||||
spawn = new L2Spawn(target.getTemplate().getId());
|
||||
if (Config.SAVE_GMSPAWN_ON_CUSTOM)
|
||||
{
|
||||
spawn.setCustom(true);
|
||||
@ -592,7 +579,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
SpawnTable.getInstance().addNewSpawn(spawn, true);
|
||||
spawn.init();
|
||||
|
||||
activeChar.sendMessage("Created " + template1.getName() + " on " + target.getObjectId() + ".");
|
||||
activeChar.sendMessage("Created " + target.getTemplate().getName() + " on " + target.getObjectId() + ".");
|
||||
|
||||
if (Config.DEBUG)
|
||||
{
|
||||
@ -621,8 +608,7 @@ public class AdminTeleport implements IAdminCommandHandler
|
||||
RaidBossSpawnManager.getInstance().deleteSpawn(spawn, true);
|
||||
try
|
||||
{
|
||||
L2NpcTemplate template = NpcData.getInstance().getTemplate(target.getId());
|
||||
L2Spawn spawnDat = new L2Spawn(template);
|
||||
final L2Spawn spawnDat = new L2Spawn(target.getId());
|
||||
if (Config.SAVE_GMSPAWN_ON_CUSTOM)
|
||||
{
|
||||
spawn.setCustom(true);
|
||||
|
@ -98,7 +98,7 @@ public class QuestLink implements IBypassHandler
|
||||
|
||||
for (Quest quest : quests)
|
||||
{
|
||||
final QuestState qs = player.getQuestState(quest.getScriptName());
|
||||
final QuestState qs = player.getQuestState(quest.getName());
|
||||
if ((qs == null) || qs.isCreated())
|
||||
{
|
||||
state = quest.isCustomQuest() ? "" : "01";
|
||||
|
@ -145,7 +145,7 @@ public final class SummonNpc extends AbstractEffect
|
||||
L2Spawn spawn;
|
||||
try
|
||||
{
|
||||
spawn = new L2Spawn(npcTemplate);
|
||||
spawn = new L2Spawn(_npcId);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -28,11 +28,9 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.gameserver.data.xml.IXmlReader;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
|
||||
/**
|
||||
* Hellbound Spawns parser.
|
||||
@ -88,13 +86,6 @@ public final class HellboundSpawns implements IXmlReader
|
||||
}
|
||||
|
||||
final int npcId = Integer.parseInt(id.getNodeValue());
|
||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
|
||||
if (template == null)
|
||||
{
|
||||
LOGGER.warning(getClass().getSimpleName() + ": Missing NPC template for ID: " + npcId + "!");
|
||||
return;
|
||||
}
|
||||
|
||||
Location loc = null;
|
||||
int delay = 0;
|
||||
int randomInterval = 0;
|
||||
@ -129,7 +120,7 @@ public final class HellboundSpawns implements IXmlReader
|
||||
|
||||
try
|
||||
{
|
||||
final L2Spawn spawn = new L2Spawn(template);
|
||||
final L2Spawn spawn = new L2Spawn(npcId);
|
||||
spawn.setAmount(1);
|
||||
if (loc == null)
|
||||
{
|
||||
|
@ -19,10 +19,8 @@
|
||||
package instances;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import ai.npc.AbstractNpcAI;
|
||||
|
||||
@ -46,8 +44,6 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
*/
|
||||
public abstract class AbstractInstance extends AbstractNpcAI
|
||||
{
|
||||
public final Logger _log = Logger.getLogger(getClass().getSimpleName());
|
||||
|
||||
public AbstractInstance(String name, String desc)
|
||||
{
|
||||
super(name, desc);
|
||||
@ -181,7 +177,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
|
||||
protected void handleRemoveBuffs(InstanceWorld world)
|
||||
{
|
||||
for (Integer objId : world.getAllowed())
|
||||
for (int objId : world.getAllowed())
|
||||
{
|
||||
final L2PcInstance player = L2World.getInstance().getPlayer(objId);
|
||||
|
||||
@ -201,8 +197,8 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
|
||||
/**
|
||||
* Spawns group of instance NPC's
|
||||
* @param groupName - name of group from XML definition to spawn
|
||||
* @param instanceId - ID of instance
|
||||
* @param groupName the name of group from XML definition to spawn
|
||||
* @param instanceId the instance ID
|
||||
* @return list of spawned NPC's
|
||||
*/
|
||||
protected List<L2Npc> spawnGroup(String groupName, int instanceId)
|
||||
@ -211,9 +207,9 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Reenter time for every player in InstanceWorld.
|
||||
* @param world - the InstanceWorld
|
||||
* @param time - Time in miliseconds
|
||||
* Sets reenter time for every player in the instance.
|
||||
* @param world the instance
|
||||
* @param time the time in milliseconds
|
||||
*/
|
||||
protected void setReenterTime(InstanceWorld world, long time)
|
||||
{
|
||||
@ -236,8 +232,6 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
private void handleRemoveBuffs(L2PcInstance player, InstanceWorld world)
|
||||
{
|
||||
final Instance inst = InstanceManager.getInstance().getInstance(world.getInstanceId());
|
||||
final List<BuffInfo> buffToRemove = new ArrayList<>();
|
||||
|
||||
switch (inst.getRemoveBuffType())
|
||||
{
|
||||
case ALL:
|
||||
@ -259,7 +253,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
{
|
||||
if (!inst.getBuffExceptionList().contains(info.getSkill().getId()))
|
||||
{
|
||||
buffToRemove.add(info);
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
|
||||
}
|
||||
}
|
||||
|
||||
@ -269,7 +263,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
{
|
||||
if (!inst.getBuffExceptionList().contains(info.getSkill().getId()))
|
||||
{
|
||||
buffToRemove.add(info);
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -281,7 +275,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
{
|
||||
if (!inst.getBuffExceptionList().contains(info.getSkill().getId()))
|
||||
{
|
||||
buffToRemove.add(info);
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -293,7 +287,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
{
|
||||
if (inst.getBuffExceptionList().contains(info.getSkill().getId()))
|
||||
{
|
||||
buffToRemove.add(info);
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
|
||||
}
|
||||
}
|
||||
|
||||
@ -303,7 +297,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
{
|
||||
if (inst.getBuffExceptionList().contains(info.getSkill().getId()))
|
||||
{
|
||||
buffToRemove.add(info);
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -315,17 +309,12 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
{
|
||||
if (inst.getBuffExceptionList().contains(info.getSkill().getId()))
|
||||
{
|
||||
buffToRemove.add(info);
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (BuffInfo info : buffToRemove)
|
||||
{
|
||||
info.getEffected().getEffectList().stopSkillEffects(true, info.getSkill());
|
||||
}
|
||||
}
|
||||
}
|
@ -190,7 +190,7 @@ public final class Q00501_ProofOfClanAlliance extends Quest
|
||||
{
|
||||
if (npc.getSummonedNpcCount() < 4)
|
||||
{
|
||||
takeItems(player, ADENA_TO_RESTART_GAME, Inventory.ADENA_ID);
|
||||
takeItems(player, Inventory.ADENA_ID, ADENA_TO_RESTART_GAME);
|
||||
}
|
||||
htmltext = event;
|
||||
}
|
||||
|
@ -352,7 +352,6 @@
|
||||
<set name="price" val="200" />
|
||||
<set name="handler" val="SoulShots" />
|
||||
<set name="item_skill" val="9193-1" />
|
||||
<set name="commissionItemType" val="SOULSHOT" />
|
||||
</item>
|
||||
<item id="17755" name="Human Male Wig - A" additionalName="" type="Armor">
|
||||
<set name="icon" val="BranchSys.icon.br_plastic_hair_f_i00" />
|
||||
|
@ -300,7 +300,6 @@
|
||||
<set name="is_stackable" val="true" />
|
||||
<set name="handler" val="SpiritShot" />
|
||||
<set name="item_skill" val="9194-1" />
|
||||
<set name="commissionItemType" val="SPIRITSHOT" />
|
||||
</item>
|
||||
<item id="19442" name="Blessed Spiritshot (R-grade)" additionalName="" type="EtcItem">
|
||||
<!-- The power of a higher-level spirit is bestowed upon a weapon, temporarily increasing its M. Atk. significantly. Can be used with an R-grade weapon. -->
|
||||
@ -314,7 +313,6 @@
|
||||
<set name="is_stackable" val="true" />
|
||||
<set name="handler" val="BlessedSpiritShot" />
|
||||
<set name="item_skill" val="9195-1" />
|
||||
<set name="commissionItemType" val="SPIRITSHOT" />
|
||||
</item>
|
||||
<item id="19443" name="Orichalcum Bolt" additionalName="" type="EtcItem">
|
||||
<!-- Bolt made of Orichalcum. Used as bolts for R-grade Crossbows. -->
|
||||
|
@ -100,7 +100,6 @@
|
||||
<set name="is_stackable" val="true" />
|
||||
<set name="handler" val="BlessedSpiritShot" />
|
||||
<set name="item_skill" val="9195-1" />
|
||||
<set name="commissionItemType" val="SPIRITSHOT" />
|
||||
</item>
|
||||
<item id="34617" name="Player Commendation - Agathion's Gift" additionalName="PC-exclusive" type="EtcItem">
|
||||
<!-- When used, you can receive an Agathion's gift. -->
|
||||
|
@ -1410,21 +1410,24 @@
|
||||
<set name="hitTime" val="20000" />
|
||||
</skill>
|
||||
<skill id="9193" levels="1" name="Soulshot (R-grade)">
|
||||
<!-- AUTO GENERATED SKILL -->
|
||||
<set name="icon" val="icon.skill0000" />
|
||||
<set name="isMagic" val="2" /> <!-- Static Skill -->
|
||||
<set name="magicLvl" val="1" />
|
||||
<set name="operateType" val="ACTIVE_INSTANT" />
|
||||
<set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
|
||||
<set name="targetType" val="SELF" />
|
||||
</skill>
|
||||
<skill id="9194" levels="1" name="Spiritshot (R-grade)">
|
||||
<!-- AUTO GENERATED SKILL -->
|
||||
<set name="icon" val="icon.skill0000" />
|
||||
<set name="isMagic" val="2" /> <!-- Static Skill -->
|
||||
<set name="magicLvl" val="1" />
|
||||
<set name="operateType" val="ACTIVE_INSTANT" />
|
||||
<set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
|
||||
<set name="targetType" val="SELF" />
|
||||
</skill>
|
||||
<skill id="9195" levels="1" name="Blessed Spiritshot (R-grade)">
|
||||
<!-- AUTO GENERATED SKILL -->
|
||||
<set name="icon" val="icon.skill0000" />
|
||||
<set name="isMagic" val="2" /> <!-- Static Skill -->
|
||||
<set name="magicLvl" val="1" />
|
||||
<set name="operateType" val="ACTIVE_INSTANT" />
|
||||
<set name="rideState" val="NONE;STRIDER;WYVERN;WOLF" />
|
||||
<set name="targetType" val="SELF" />
|
||||
</skill>
|
||||
<skill id="9196" levels="1" name="Blessed Scroll: Enchant Armor (R-grade)">
|
||||
|
@ -83,6 +83,11 @@ public final class SpawnTable implements IXmlReader
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verifies if the template exists and it's spawnable.
|
||||
* @param npcId the NPC ID
|
||||
* @return {@code true} if the NPC ID belongs to an spawnable tempalte, {@code false} otherwise
|
||||
*/
|
||||
private boolean checkTemplate(int npcId)
|
||||
{
|
||||
L2NpcTemplate npcTemplate = NpcData.getInstance().getTemplate(npcId);
|
||||
@ -297,7 +302,7 @@ public final class SpawnTable implements IXmlReader
|
||||
int ret = 0;
|
||||
try
|
||||
{
|
||||
spawnDat = new L2Spawn(NpcData.getInstance().getTemplate(spawnInfo.getInt("npcTemplateid")));
|
||||
spawnDat = new L2Spawn(spawnInfo.getInt("npcTemplateid"));
|
||||
spawnDat.setAmount(spawnInfo.getInt("count", 1));
|
||||
spawnDat.setX(spawnInfo.getInt("x", 0));
|
||||
spawnDat.setY(spawnInfo.getInt("y", 0));
|
||||
|
@ -27,9 +27,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.entity.Fort;
|
||||
|
||||
public final class FortSiegeGuardManager
|
||||
@ -117,24 +115,16 @@ public final class FortSiegeGuardManager
|
||||
ArrayList<L2Spawn> siegeGuardSpawns = new ArrayList<>();
|
||||
while (rs.next())
|
||||
{
|
||||
L2NpcTemplate template = NpcData.getInstance().getTemplate(rs.getInt("npcId"));
|
||||
if (template != null)
|
||||
{
|
||||
L2Spawn spawn = new L2Spawn(template);
|
||||
spawn.setAmount(1);
|
||||
spawn.setX(rs.getInt("x"));
|
||||
spawn.setY(rs.getInt("y"));
|
||||
spawn.setZ(rs.getInt("z"));
|
||||
spawn.setHeading(rs.getInt("heading"));
|
||||
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
|
||||
spawn.setLocationId(0);
|
||||
|
||||
siegeGuardSpawns.add(spawn);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Missing npc data in npc table for ID: " + rs.getInt("npcId"));
|
||||
}
|
||||
final L2Spawn spawn = new L2Spawn(rs.getInt("npcId"));
|
||||
spawn.setAmount(1);
|
||||
spawn.setX(rs.getInt("x"));
|
||||
spawn.setY(rs.getInt("y"));
|
||||
spawn.setZ(rs.getInt("z"));
|
||||
spawn.setHeading(rs.getInt("heading"));
|
||||
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
|
||||
spawn.setLocationId(0);
|
||||
|
||||
siegeGuardSpawns.add(spawn);
|
||||
}
|
||||
_siegeGuards.put(fortId, siegeGuardSpawns);
|
||||
}
|
||||
|
@ -36,7 +36,6 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.instancemanager.tasks.FourSepulchersChangeAttackTimeTask;
|
||||
import com.l2jserver.gameserver.instancemanager.tasks.FourSepulchersChangeCoolDownTimeTask;
|
||||
@ -48,7 +47,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2SepulcherMonsterInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2SepulcherNpcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.quest.Quest;
|
||||
import com.l2jserver.gameserver.model.quest.QuestState;
|
||||
@ -276,25 +274,14 @@ public final class FourSepulchersManager
|
||||
{
|
||||
_managers = new ArrayList<>();
|
||||
|
||||
int i = 31921;
|
||||
for (L2Spawn spawnDat; i <= 31924; i++)
|
||||
for (int npcId = 31921; npcId <= 31924; npcId++)
|
||||
{
|
||||
if ((i < 31921) || (i > 31924))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
L2NpcTemplate template1 = NpcData.getInstance().getTemplate(i);
|
||||
if (template1 == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
spawnDat = new L2Spawn(template1);
|
||||
|
||||
final L2Spawn spawnDat = new L2Spawn(npcId);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setRespawnDelay(60);
|
||||
switch (i)
|
||||
switch (npcId)
|
||||
{
|
||||
case 31921: // conquerors
|
||||
spawnDat.setX(181061);
|
||||
@ -427,29 +414,18 @@ public final class FourSepulchersManager
|
||||
ps.setInt(1, 0);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template1;
|
||||
while (rs.next())
|
||||
{
|
||||
template1 = NpcData.getInstance().getTemplate(rs.getInt("npc_templateid"));
|
||||
if (template1 != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template1);
|
||||
spawnDat.setAmount(rs.getInt("count"));
|
||||
spawnDat.setX(rs.getInt("locx"));
|
||||
spawnDat.setY(rs.getInt("locy"));
|
||||
spawnDat.setZ(rs.getInt("locz"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
int keyNpcId = rs.getInt("key_npc_id");
|
||||
_mysteriousBoxSpawns.put(keyNpcId, spawnDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.LoadMysteriousBox: Data missing in NPC table for ID: " + rs.getInt("npc_templateid") + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npc_templateid"));
|
||||
spawnDat.setAmount(rs.getInt("count"));
|
||||
spawnDat.setX(rs.getInt("locx"));
|
||||
spawnDat.setY(rs.getInt("locy"));
|
||||
spawnDat.setZ(rs.getInt("locz"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
int keyNpcId = rs.getInt("key_npc_id");
|
||||
_mysteriousBoxSpawns.put(keyNpcId, spawnDat);
|
||||
}
|
||||
}
|
||||
_log.info(getClass().getSimpleName() + ": loaded " + _mysteriousBoxSpawns.size() + " Mysterious-Box spawns.");
|
||||
@ -463,29 +439,19 @@ public final class FourSepulchersManager
|
||||
|
||||
private void initKeyBoxSpawns()
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
for (Entry<Integer, Integer> keyNpc : _keyBoxNpc.entrySet())
|
||||
{
|
||||
try
|
||||
{
|
||||
template = NpcData.getInstance().getTemplate(keyNpc.getValue());
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(0);
|
||||
spawnDat.setY(0);
|
||||
spawnDat.setZ(0);
|
||||
spawnDat.setHeading(0);
|
||||
spawnDat.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_keyBoxSpawns.put(keyNpc.getKey(), spawnDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.InitKeyBoxSpawns: Data missing in NPC table for ID: " + keyNpc.getValue() + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(keyNpc.getValue());
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(0);
|
||||
spawnDat.setY(0);
|
||||
spawnDat.setZ(0);
|
||||
spawnDat.setHeading(0);
|
||||
spawnDat.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_keyBoxSpawns.put(keyNpc.getKey(), spawnDat);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -506,8 +472,6 @@ public final class FourSepulchersManager
|
||||
try (ResultSet rs1 = ps1.executeQuery();
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where key_npc_id = ? and spawntype = ? ORDER BY id"))
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template1;
|
||||
while (rs1.next())
|
||||
{
|
||||
int keyNpcId = rs1.getInt("key_npc_id");
|
||||
@ -519,24 +483,16 @@ public final class FourSepulchersManager
|
||||
_physicalSpawns = new ArrayList<>();
|
||||
while (rs2.next())
|
||||
{
|
||||
template1 = NpcData.getInstance().getTemplate(rs2.getInt("npc_templateid"));
|
||||
if (template1 != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template1);
|
||||
spawnDat.setAmount(rs2.getInt("count"));
|
||||
spawnDat.setX(rs2.getInt("locx"));
|
||||
spawnDat.setY(rs2.getInt("locy"));
|
||||
spawnDat.setZ(rs2.getInt("locz"));
|
||||
spawnDat.setHeading(rs2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_physicalSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.LoadPhysicalMonsters: Data missing in NPC table for ID: " + rs2.getInt("npc_templateid") + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rs2.getInt("npc_templateid"));
|
||||
spawnDat.setAmount(rs2.getInt("count"));
|
||||
spawnDat.setX(rs2.getInt("locx"));
|
||||
spawnDat.setY(rs2.getInt("locy"));
|
||||
spawnDat.setZ(rs2.getInt("locz"));
|
||||
spawnDat.setHeading(rs2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_physicalSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
}
|
||||
ps2.clearParameters();
|
||||
@ -563,8 +519,6 @@ public final class FourSepulchersManager
|
||||
try (ResultSet rs1 = ps1.executeQuery();
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist WHERE key_npc_id = ? AND spawntype = ? ORDER BY id"))
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template1;
|
||||
while (rs1.next())
|
||||
{
|
||||
int keyNpcId = rs1.getInt("key_npc_id");
|
||||
@ -577,24 +531,16 @@ public final class FourSepulchersManager
|
||||
|
||||
while (rset2.next())
|
||||
{
|
||||
template1 = NpcData.getInstance().getTemplate(rset2.getInt("npc_templateid"));
|
||||
if (template1 != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template1);
|
||||
spawnDat.setAmount(rset2.getInt("count"));
|
||||
spawnDat.setX(rset2.getInt("locx"));
|
||||
spawnDat.setY(rset2.getInt("locy"));
|
||||
spawnDat.setZ(rset2.getInt("locz"));
|
||||
spawnDat.setHeading(rset2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_magicalSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.LoadMagicalMonsters: Data missing in NPC table for ID: " + rset2.getInt("npc_templateid") + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rset2.getInt("npc_templateid"));
|
||||
spawnDat.setAmount(rset2.getInt("count"));
|
||||
spawnDat.setX(rset2.getInt("locx"));
|
||||
spawnDat.setY(rset2.getInt("locy"));
|
||||
spawnDat.setZ(rset2.getInt("locz"));
|
||||
spawnDat.setHeading(rset2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_magicalSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
}
|
||||
ps2.clearParameters();
|
||||
@ -622,8 +568,6 @@ public final class FourSepulchersManager
|
||||
try (ResultSet rs1 = ps1.executeQuery();
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist WHERE key_npc_id = ? AND spawntype = ? ORDER BY id"))
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template1;
|
||||
while (rs1.next())
|
||||
{
|
||||
int keyNpcId = rs1.getInt("key_npc_id");
|
||||
@ -638,24 +582,16 @@ public final class FourSepulchersManager
|
||||
|
||||
while (rset2.next())
|
||||
{
|
||||
template1 = NpcData.getInstance().getTemplate(rset2.getInt("npc_templateid"));
|
||||
if (template1 != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template1);
|
||||
spawnDat.setAmount(rset2.getInt("count"));
|
||||
spawnDat.setX(rset2.getInt("locx"));
|
||||
spawnDat.setY(rset2.getInt("locy"));
|
||||
spawnDat.setZ(rset2.getInt("locz"));
|
||||
spawnDat.setHeading(rset2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_dukeFinalSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.LoadDukeMonsters: Data missing in NPC table for ID: " + rset2.getInt("npc_templateid") + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rset2.getInt("npc_templateid"));
|
||||
spawnDat.setAmount(rset2.getInt("count"));
|
||||
spawnDat.setX(rset2.getInt("locx"));
|
||||
spawnDat.setY(rset2.getInt("locy"));
|
||||
spawnDat.setZ(rset2.getInt("locz"));
|
||||
spawnDat.setHeading(rset2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rset2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_dukeFinalSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
}
|
||||
ps2.clearParameters();
|
||||
@ -683,8 +619,6 @@ public final class FourSepulchersManager
|
||||
try (ResultSet rs1 = ps1.executeQuery();
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist WHERE key_npc_id = ? and spawntype = ? ORDER BY id"))
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template1;
|
||||
while (rs1.next())
|
||||
{
|
||||
int keyNpcId = rs1.getInt("key_npc_id");
|
||||
@ -697,24 +631,16 @@ public final class FourSepulchersManager
|
||||
|
||||
while (rs2.next())
|
||||
{
|
||||
template1 = NpcData.getInstance().getTemplate(rs2.getInt("npc_templateid"));
|
||||
if (template1 != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template1);
|
||||
spawnDat.setAmount(rs2.getInt("count"));
|
||||
spawnDat.setX(rs2.getInt("locx"));
|
||||
spawnDat.setY(rs2.getInt("locy"));
|
||||
spawnDat.setZ(rs2.getInt("locz"));
|
||||
spawnDat.setHeading(rs2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_emperorsGraveSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.LoadEmperorsGraveMonsters: Data missing in NPC table for ID: " + rs2.getInt("npc_templateid") + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rs2.getInt("npc_templateid"));
|
||||
spawnDat.setAmount(rs2.getInt("count"));
|
||||
spawnDat.setX(rs2.getInt("locx"));
|
||||
spawnDat.setY(rs2.getInt("locy"));
|
||||
spawnDat.setZ(rs2.getInt("locz"));
|
||||
spawnDat.setHeading(rs2.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs2.getInt("respawn_delay"));
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_emperorsGraveSpawns.add(spawnDat);
|
||||
loaded++;
|
||||
}
|
||||
}
|
||||
ps2.clearParameters();
|
||||
@ -740,66 +666,43 @@ public final class FourSepulchersManager
|
||||
31944
|
||||
};
|
||||
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
|
||||
_shadowSpawns.clear();
|
||||
|
||||
for (int i = 0; i <= 3; i++)
|
||||
{
|
||||
template = NpcData.getInstance().getTemplate(_shadowSpawnLoc[locNo][i][0]);
|
||||
if (template != null)
|
||||
try
|
||||
{
|
||||
try
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(_shadowSpawnLoc[locNo][i][1]);
|
||||
spawnDat.setY(_shadowSpawnLoc[locNo][i][2]);
|
||||
spawnDat.setZ(_shadowSpawnLoc[locNo][i][3]);
|
||||
spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
int keyNpcId = gateKeeper[i];
|
||||
_shadowSpawns.put(keyNpcId, spawnDat);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.SEVERE, "Error on InitLocationShadowSpawns", e);
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(_shadowSpawnLoc[locNo][i][0]);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(_shadowSpawnLoc[locNo][i][1]);
|
||||
spawnDat.setY(_shadowSpawnLoc[locNo][i][2]);
|
||||
spawnDat.setZ(_shadowSpawnLoc[locNo][i][3]);
|
||||
spawnDat.setHeading(_shadowSpawnLoc[locNo][i][4]);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_shadowSpawns.put(gateKeeper[i], spawnDat);
|
||||
}
|
||||
else
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.warning("FourSepulchersManager.InitLocationShadowSpawns: Data missing in NPC table for ID: " + _shadowSpawnLoc[locNo][i][0] + ".");
|
||||
_log.log(Level.SEVERE, "Error on InitLocationShadowSpawns", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void initExecutionerSpawns()
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
|
||||
for (int keyNpcId : _victim.keySet())
|
||||
{
|
||||
try
|
||||
{
|
||||
template = NpcData.getInstance().getTemplate(_victim.get(keyNpcId));
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(0);
|
||||
spawnDat.setY(0);
|
||||
spawnDat.setZ(0);
|
||||
spawnDat.setHeading(0);
|
||||
spawnDat.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_executionerSpawns.put(keyNpcId, spawnDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.InitExecutionerSpawns: Data missing in NPC table for ID: " + _victim.get(keyNpcId) + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(_victim.get(keyNpcId));
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(0);
|
||||
spawnDat.setY(0);
|
||||
spawnDat.setZ(0);
|
||||
spawnDat.setHeading(0);
|
||||
spawnDat.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
_executionerSpawns.put(keyNpcId, spawnDat);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -1183,7 +1086,6 @@ public final class FourSepulchersManager
|
||||
|
||||
List<L2Spawn> monsterList;
|
||||
List<L2SepulcherMonsterInstance> mobs = new ArrayList<>();
|
||||
L2Spawn keyBoxMobSpawn;
|
||||
|
||||
if (Rnd.get(2) == 0)
|
||||
{
|
||||
@ -1229,21 +1131,13 @@ public final class FourSepulchersManager
|
||||
{
|
||||
try
|
||||
{
|
||||
L2NpcTemplate template = NpcData.getInstance().getTemplate(18149);
|
||||
if (template != null)
|
||||
{
|
||||
keyBoxMobSpawn = new L2Spawn(template);
|
||||
keyBoxMobSpawn.setAmount(1);
|
||||
keyBoxMobSpawn.setLocation(spawnDat.getLocation());
|
||||
keyBoxMobSpawn.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(keyBoxMobSpawn, false);
|
||||
mob = (L2SepulcherMonsterInstance) keyBoxMobSpawn.doSpawn();
|
||||
keyBoxMobSpawn.stopRespawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FourSepulchersManager.SpawnMonster: Data missing in NPC table for ID: 18149");
|
||||
}
|
||||
final L2Spawn keyBoxMobSpawn = new L2Spawn(18149);
|
||||
keyBoxMobSpawn.setAmount(1);
|
||||
keyBoxMobSpawn.setLocation(spawnDat.getLocation());
|
||||
keyBoxMobSpawn.setRespawnDelay(3600);
|
||||
SpawnTable.getInstance().addNewSpawn(keyBoxMobSpawn, false);
|
||||
mob = (L2SepulcherMonsterInstance) keyBoxMobSpawn.doSpawn();
|
||||
keyBoxMobSpawn.stopRespawn();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -32,12 +32,10 @@ import java.util.logging.Logger;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2RaidBossInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
@ -82,29 +80,17 @@ public class RaidBossSpawnManager
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM raidboss_spawnlist ORDER BY boss_id");
|
||||
ResultSet rset = statement.executeQuery())
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
long respawnTime;
|
||||
while (rset.next())
|
||||
{
|
||||
template = getValidTemplate(rset.getInt("boss_id"));
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setX(rset.getInt("loc_x"));
|
||||
spawnDat.setY(rset.getInt("loc_y"));
|
||||
spawnDat.setZ(rset.getInt("loc_z"));
|
||||
spawnDat.setAmount(rset.getInt("amount"));
|
||||
spawnDat.setHeading(rset.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rset.getInt("respawn_delay"), rset.getInt("respawn_random"));
|
||||
respawnTime = rset.getLong("respawn_time");
|
||||
|
||||
addNewSpawn(spawnDat, respawnTime, rset.getDouble("currentHP"), rset.getDouble("currentMP"), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Could not load raidboss #" + rset.getInt("boss_id") + " from DB");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rset.getInt("boss_id"));
|
||||
spawnDat.setX(rset.getInt("loc_x"));
|
||||
spawnDat.setY(rset.getInt("loc_y"));
|
||||
spawnDat.setZ(rset.getInt("loc_z"));
|
||||
spawnDat.setAmount(rset.getInt("amount"));
|
||||
spawnDat.setHeading(rset.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rset.getInt("respawn_delay"), rset.getInt("respawn_random"));
|
||||
|
||||
addNewSpawn(spawnDat, rset.getLong("respawn_time"), rset.getDouble("currentHP"), rset.getDouble("currentMP"), false);
|
||||
}
|
||||
|
||||
_log.info(getClass().getSimpleName() + ": Loaded " + _bosses.size() + " Instances");
|
||||
@ -481,25 +467,6 @@ public class RaidBossSpawnManager
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the valid template.
|
||||
* @param bossId the boss id
|
||||
* @return the valid template
|
||||
*/
|
||||
public L2NpcTemplate getValidTemplate(int bossId)
|
||||
{
|
||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(bossId);
|
||||
if (template == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (!template.isType("L2RaidBoss"))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return template;
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify spawn night boss.
|
||||
* @param raidboss the raidboss
|
||||
|
@ -27,10 +27,8 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.entity.Castle;
|
||||
|
||||
public final class SiegeGuardManager
|
||||
@ -208,28 +206,18 @@ public final class SiegeGuardManager
|
||||
}
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
L2Spawn spawn1;
|
||||
L2NpcTemplate template1;
|
||||
while (rs.next())
|
||||
{
|
||||
template1 = NpcData.getInstance().getTemplate(rs.getInt("npcId"));
|
||||
if (template1 != null)
|
||||
{
|
||||
spawn1 = new L2Spawn(template1);
|
||||
spawn1.setAmount(1);
|
||||
spawn1.setX(rs.getInt("x"));
|
||||
spawn1.setY(rs.getInt("y"));
|
||||
spawn1.setZ(rs.getInt("z"));
|
||||
spawn1.setHeading(rs.getInt("heading"));
|
||||
spawn1.setRespawnDelay(rs.getInt("respawnDelay"));
|
||||
spawn1.setLocationId(0);
|
||||
|
||||
_siegeGuardSpawn.add(spawn1);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Missing npc data in npc table for id: " + rs.getInt("npcId"));
|
||||
}
|
||||
final L2Spawn spawn = new L2Spawn(rs.getInt("npcId"));
|
||||
spawn.setAmount(1);
|
||||
spawn.setX(rs.getInt("x"));
|
||||
spawn.setY(rs.getInt("y"));
|
||||
spawn.setZ(rs.getInt("z"));
|
||||
spawn.setHeading(rs.getInt("heading"));
|
||||
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
|
||||
spawn.setLocationId(0);
|
||||
|
||||
_siegeGuardSpawn.add(spawn);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -33,12 +33,10 @@ import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.idfactory.IdFactory;
|
||||
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.interfaces.IIdentifiable;
|
||||
import com.l2jserver.gameserver.util.Broadcast;
|
||||
import com.l2jserver.util.Rnd;
|
||||
@ -465,15 +463,7 @@ public class AutoSpawnHandler
|
||||
final int z = locationList[locationIndex].getZ();
|
||||
final int heading = locationList[locationIndex].getHeading();
|
||||
|
||||
// Fetch the template for this NPC ID and create a new spawn.
|
||||
L2NpcTemplate npcTemp = NpcData.getInstance().getTemplate(spawnInst.getId());
|
||||
if (npcTemp == null)
|
||||
{
|
||||
_log.warning("Couldnt find NPC id" + spawnInst.getId() + " Try to update your DP");
|
||||
return;
|
||||
}
|
||||
|
||||
L2Spawn newSpawn = new L2Spawn(npcTemp);
|
||||
final L2Spawn newSpawn = new L2Spawn(spawnInst.getId());
|
||||
newSpawn.setX(x);
|
||||
newSpawn.setY(y);
|
||||
newSpawn.setZ(z);
|
||||
|
@ -30,6 +30,7 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GeoData;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.sql.impl.TerritoryTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.NpcPersonalAIData;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
@ -147,6 +148,19 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
|
||||
_constructor = Class.forName(className).asSubclass(L2Npc.class).getConstructor(L2NpcTemplate.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a spawn.
|
||||
* @param npcId the NPC ID
|
||||
* @throws ClassCastException
|
||||
* @throws NoSuchMethodException
|
||||
* @throws ClassNotFoundException
|
||||
* @throws SecurityException
|
||||
*/
|
||||
public L2Spawn(int npcId) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
|
||||
{
|
||||
this(NpcData.getInstance().getTemplate(npcId));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the maximum number of L2NpcInstance that this L2Spawn can manage.
|
||||
*/
|
||||
|
@ -32,6 +32,7 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ItemsAutoDestroy;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
import com.l2jserver.gameserver.datatables.NpcPersonalAIData;
|
||||
import com.l2jserver.gameserver.enums.AISkillScope;
|
||||
@ -173,6 +174,15 @@ public class L2Npc extends L2Character
|
||||
setIsFlying(template.isFlying());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a NPC.
|
||||
* @param npcId the NPC ID
|
||||
*/
|
||||
public L2Npc(int npcId)
|
||||
{
|
||||
this(NpcData.getInstance().getTemplate(npcId));
|
||||
}
|
||||
|
||||
public int getSoulShotChance()
|
||||
{
|
||||
return getTemplate().getSoulShotChance();
|
||||
|
@ -717,6 +717,7 @@ public final class L2PcInstance extends L2Playable
|
||||
private boolean _exchangeRefusal = false; // Exchange refusal
|
||||
|
||||
private L2Party _party;
|
||||
PartyDistributionType _partyDistributionType;
|
||||
|
||||
// this is needed to find the inviting player for Party response
|
||||
// there can only be one active party request at once
|
||||
@ -6771,6 +6772,16 @@ public final class L2PcInstance extends L2Playable
|
||||
return _party;
|
||||
}
|
||||
|
||||
public void setPartyDistributionType(PartyDistributionType pdt)
|
||||
{
|
||||
_partyDistributionType = pdt;
|
||||
}
|
||||
|
||||
public PartyDistributionType getPartyDistributionType()
|
||||
{
|
||||
return _partyDistributionType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return True if the L2PcInstance is a GM.
|
||||
*/
|
||||
@ -10898,6 +10909,7 @@ public final class L2PcInstance extends L2Playable
|
||||
super.doRevive();
|
||||
updateEffectIcons();
|
||||
sendPacket(new EtcStatusUpdate(this));
|
||||
_revivePet = false;
|
||||
_reviveRequested = 0;
|
||||
_revivePower = 0;
|
||||
|
||||
@ -13496,6 +13508,11 @@ public final class L2PcInstance extends L2Playable
|
||||
activeChar.sendPacket(new RecipeShopMsg(this));
|
||||
break;
|
||||
}
|
||||
if (isMounted())
|
||||
{
|
||||
// Required double send for fix Mounted H5+
|
||||
sendPacket(new CharInfo(activeChar));
|
||||
}
|
||||
}
|
||||
|
||||
public void showQuestMovie(int id)
|
||||
|
@ -27,7 +27,6 @@ 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.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.enums.Team;
|
||||
@ -38,7 +37,6 @@ import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.L2Summon;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2BlockInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.model.skills.Skill;
|
||||
@ -478,15 +476,13 @@ public final class BlockCheckerEngine
|
||||
// random % 2, if == 0 will spawn a red block
|
||||
// if != 0, will spawn a blue block
|
||||
byte random = 2;
|
||||
// common template
|
||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(18672);
|
||||
// Spawn blocks
|
||||
try
|
||||
{
|
||||
// Creates 50 new blocks
|
||||
for (int i = 0; i < _numOfBoxes; i++)
|
||||
{
|
||||
L2Spawn spawn = new L2Spawn(template);
|
||||
final L2Spawn spawn = new L2Spawn(18672);
|
||||
spawn.setX(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400));
|
||||
spawn.setY(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
|
||||
spawn.setZ(_zCoord);
|
||||
@ -519,10 +515,9 @@ public final class BlockCheckerEngine
|
||||
// Spawn the block carrying girl
|
||||
if ((_round == 1) || (_round == 2))
|
||||
{
|
||||
L2NpcTemplate girl = NpcData.getInstance().getTemplate(18676);
|
||||
try
|
||||
{
|
||||
final L2Spawn girlSpawn = new L2Spawn(girl);
|
||||
final L2Spawn girlSpawn = new L2Spawn(18676);
|
||||
girlSpawn.setX(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400));
|
||||
girlSpawn.setY(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
|
||||
girlSpawn.setZ(_zCoord);
|
||||
@ -575,7 +570,7 @@ public final class BlockCheckerEngine
|
||||
|
||||
/*
|
||||
* private class CountDown implements Runnable {
|
||||
* @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_WILL_END_IN_5_SECONDS)); ThreadPoolManager.getInstance().scheduleGeneral(new EndEvent(), 5000); } }
|
||||
* @Override public void run() { _holder.broadCastPacketToTeam(SystemMessage.getSystemMessage(SystemMessageId.BLOCK_CHECKER_ENDS_5)); ThreadPoolManager.getInstance().scheduleGeneral(new EndEvent(), 5000); } }
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -40,7 +40,6 @@ import com.l2jserver.gameserver.FortUpdater.UpdaterType;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.StaticObjectData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.enums.MountType;
|
||||
@ -54,7 +53,6 @@ import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2FortZone;
|
||||
import com.l2jserver.gameserver.model.zone.type.L2SiegeZone;
|
||||
@ -1168,28 +1166,18 @@ public final class Fort extends AbstractResidence
|
||||
ps.setInt(2, 0);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
while (rs.next())
|
||||
{
|
||||
template = NpcData.getInstance().getTemplate(rs.getInt("npcId"));
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
spawnDat.doSpawn();
|
||||
spawnDat.startRespawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Fort " + getResidenceId() + " initNpcs: Data missing in NPC table for ID: " + rs.getInt("npcId") + ".");
|
||||
}
|
||||
L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
|
||||
spawnDat.doSpawn();
|
||||
spawnDat.startRespawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1209,26 +1197,16 @@ public final class Fort extends AbstractResidence
|
||||
ps.setInt(2, 2);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
while (rs.next())
|
||||
{
|
||||
template = NpcData.getInstance().getTemplate(rs.getInt("npcId"));
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
_siegeNpcs.add(spawnDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Fort " + getResidenceId() + " initSiegeNpcs: Data missing in NPC table for ID: " + rs.getInt("npcId") + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
_siegeNpcs.add(spawnDat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1248,26 +1226,16 @@ public final class Fort extends AbstractResidence
|
||||
ps.setInt(2, 1);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
while (rs.next())
|
||||
{
|
||||
template = NpcData.getInstance().getTemplate(rs.getInt("npcId"));
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
_npcCommanders.add(spawnDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Fort " + getResidenceId() + " initNpcCommanders: Data missing in NPC table for ID: " + rs.getInt("npcId") + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
_npcCommanders.add(spawnDat);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1290,30 +1258,19 @@ public final class Fort extends AbstractResidence
|
||||
ps.setInt(2, 3);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template;
|
||||
while (rs.next())
|
||||
{
|
||||
int castleId = rs.getInt("castleId");
|
||||
int npcId = rs.getInt("npcId");
|
||||
template = NpcData.getInstance().getTemplate(npcId);
|
||||
if (template != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
_specialEnvoys.add(spawnDat);
|
||||
_envoyCastles.put(npcId, castleId);
|
||||
_availableCastles.add(castleId);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Fort " + getResidenceId() + " initSpecialEnvoys: Data missing in NPC table for ID: " + rs.getInt("npcId") + ".");
|
||||
}
|
||||
final int castleId = rs.getInt("castleId");
|
||||
final L2Spawn spawnDat = new L2Spawn(rs.getInt("npcId"));
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(rs.getInt("x"));
|
||||
spawnDat.setY(rs.getInt("y"));
|
||||
spawnDat.setZ(rs.getInt("z"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(60);
|
||||
_specialEnvoys.add(spawnDat);
|
||||
_envoyCastles.put(spawnDat.getId(), castleId);
|
||||
_availableCastles.add(castleId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.enums.FortTeleportWhoType;
|
||||
import com.l2jserver.gameserver.enums.SiegeClanType;
|
||||
@ -51,7 +50,6 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2FortCommanderInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jserver.gameserver.model.events.impl.sieges.fort.OnFortSiegeFinish;
|
||||
import com.l2jserver.gameserver.model.events.impl.sieges.fort.OnFortSiegeStart;
|
||||
@ -1098,28 +1096,18 @@ public class FortSiege implements Siegable
|
||||
try
|
||||
{
|
||||
_commanders.clear();
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate template1;
|
||||
for (FortSiegeSpawn _sp : FortSiegeManager.getInstance().getCommanderSpawnList(getFort().getResidenceId()))
|
||||
{
|
||||
template1 = NpcData.getInstance().getTemplate(_sp.getId());
|
||||
if (template1 != null)
|
||||
{
|
||||
spawnDat = new L2Spawn(template1);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(_sp.getLocation().getX());
|
||||
spawnDat.setY(_sp.getLocation().getY());
|
||||
spawnDat.setZ(_sp.getLocation().getZ());
|
||||
spawnDat.setHeading(_sp.getLocation().getHeading());
|
||||
spawnDat.setRespawnDelay(60);
|
||||
spawnDat.doSpawn();
|
||||
spawnDat.stopRespawn();
|
||||
_commanders.add(spawnDat);
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("FortSiege.spawnCommander: Data missing in NPC table for ID: " + _sp.getId() + ".");
|
||||
}
|
||||
final L2Spawn spawnDat = new L2Spawn(_sp.getId());
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setX(_sp.getLocation().getX());
|
||||
spawnDat.setY(_sp.getLocation().getY());
|
||||
spawnDat.setZ(_sp.getLocation().getZ());
|
||||
spawnDat.setHeading(_sp.getLocation().getHeading());
|
||||
spawnDat.setRespawnDelay(60);
|
||||
spawnDat.doSpawn();
|
||||
spawnDat.stopRespawn();
|
||||
_commanders.add(spawnDat);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
|
@ -42,7 +42,6 @@ import org.w3c.dom.Node;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
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;
|
||||
@ -58,7 +57,6 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2DoorTemplate;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.holders.InstanceReenterTimeHolder;
|
||||
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -464,8 +462,6 @@ public final class Instance
|
||||
|
||||
private void parseInstance(Node n) throws Exception
|
||||
{
|
||||
L2Spawn spawnDat;
|
||||
L2NpcTemplate npcTemplate;
|
||||
_name = n.getAttributes().getNamedItem("name").getNodeValue();
|
||||
Node a = n.getAttributes().getNamedItem("ejectTime");
|
||||
if (a != null)
|
||||
@ -596,45 +592,38 @@ public final class Instance
|
||||
{
|
||||
allowRandomWalk = Boolean.valueOf(d.getAttributes().getNamedItem("allowRandomWalk").getNodeValue());
|
||||
}
|
||||
npcTemplate = NpcData.getInstance().getTemplate(npcId);
|
||||
if (npcTemplate != null)
|
||||
|
||||
final L2Spawn spawnDat = new L2Spawn(npcId);
|
||||
spawnDat.setX(x);
|
||||
spawnDat.setY(y);
|
||||
spawnDat.setZ(z);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setHeading(heading);
|
||||
spawnDat.setRespawnDelay(respawn, respawnRandom);
|
||||
if (respawn == 0)
|
||||
{
|
||||
spawnDat = new L2Spawn(npcTemplate);
|
||||
spawnDat.setX(x);
|
||||
spawnDat.setY(y);
|
||||
spawnDat.setZ(z);
|
||||
spawnDat.setAmount(1);
|
||||
spawnDat.setHeading(heading);
|
||||
spawnDat.setRespawnDelay(respawn, respawnRandom);
|
||||
if (respawn == 0)
|
||||
{
|
||||
spawnDat.stopRespawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDat.startRespawn();
|
||||
}
|
||||
spawnDat.setInstanceId(getId());
|
||||
if (allowRandomWalk == null)
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!_allowRandomWalk);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!allowRandomWalk);
|
||||
}
|
||||
if (spawnGroup.equals("general"))
|
||||
{
|
||||
spawnDat.doSpawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
manualSpawn.add(spawnDat);
|
||||
}
|
||||
spawnDat.stopRespawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
_log.warning("Instance: Data missing in NPC table for ID: " + npcId + " in Instance " + getId());
|
||||
spawnDat.startRespawn();
|
||||
}
|
||||
spawnDat.setInstanceId(getId());
|
||||
if (allowRandomWalk == null)
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!_allowRandomWalk);
|
||||
}
|
||||
else
|
||||
{
|
||||
spawnDat.setIsNoRndWalk(!allowRandomWalk);
|
||||
}
|
||||
if (spawnGroup.equals("general"))
|
||||
{
|
||||
spawnDat.doSpawn();
|
||||
}
|
||||
else
|
||||
{
|
||||
manualSpawn.add(spawnDat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.holders.PlayerEventHolder;
|
||||
import com.l2jserver.gameserver.network.serverpackets.CharInfo;
|
||||
import com.l2jserver.gameserver.network.serverpackets.MagicSkillUse;
|
||||
@ -164,13 +163,9 @@ public class L2Event
|
||||
*/
|
||||
public static void spawnEventNpc(L2PcInstance target)
|
||||
{
|
||||
|
||||
L2NpcTemplate template = NpcData.getInstance().getTemplate(_npcId);
|
||||
|
||||
try
|
||||
{
|
||||
L2Spawn spawn = new L2Spawn(template);
|
||||
|
||||
final L2Spawn spawn = new L2Spawn(_npcId);
|
||||
spawn.setX(target.getX() + 50);
|
||||
spawn.setY(target.getY() + 50);
|
||||
spawn.setZ(target.getZ());
|
||||
|
@ -35,7 +35,6 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.data.xml.impl.SiegeScheduleData;
|
||||
import com.l2jserver.gameserver.enums.SiegeClanType;
|
||||
import com.l2jserver.gameserver.enums.SiegeTeleportWhoType;
|
||||
@ -1552,7 +1551,7 @@ public class Siege implements Siegable
|
||||
{
|
||||
try
|
||||
{
|
||||
final L2Spawn spawn = new L2Spawn(NpcData.getInstance().getTemplate(ts.getId()));
|
||||
final L2Spawn spawn = new L2Spawn(ts.getId());
|
||||
spawn.setLocation(ts.getLocation());
|
||||
_controlTowers.add((L2ControlTowerInstance) spawn.doSpawn());
|
||||
}
|
||||
@ -1573,7 +1572,7 @@ public class Siege implements Siegable
|
||||
{
|
||||
try
|
||||
{
|
||||
final L2Spawn spawn = new L2Spawn(NpcData.getInstance().getTemplate(ts.getId()));
|
||||
final L2Spawn spawn = new L2Spawn(ts.getId());
|
||||
spawn.setLocation(ts.getLocation());
|
||||
final L2FlameTowerInstance tower = (L2FlameTowerInstance) spawn.doSpawn();
|
||||
tower.setUpgradeLevel(ts.getUpgradeLevel());
|
||||
|
@ -29,7 +29,6 @@ import java.util.logging.Logger;
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.cache.HtmCache;
|
||||
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.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
@ -45,7 +44,6 @@ import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2ServitorInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.events.EventDispatcher;
|
||||
import com.l2jserver.gameserver.model.events.impl.events.OnTvTEventFinish;
|
||||
import com.l2jserver.gameserver.model.events.impl.events.OnTvTEventKill;
|
||||
@ -117,17 +115,9 @@ public class TvTEvent
|
||||
*/
|
||||
public static boolean startParticipation()
|
||||
{
|
||||
L2NpcTemplate tmpl = NpcData.getInstance().getTemplate(Config.TVT_EVENT_PARTICIPATION_NPC_ID);
|
||||
|
||||
if (tmpl == null)
|
||||
{
|
||||
_log.warning("TvTEventEngine[TvTEvent.startParticipation()]: L2NpcTemplate is a NullPointer -> Invalid npc id in configs?");
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_npcSpawn = new L2Spawn(tmpl);
|
||||
_npcSpawn = new L2Spawn(Config.TVT_EVENT_PARTICIPATION_NPC_ID);
|
||||
|
||||
_npcSpawn.setX(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[0]);
|
||||
_npcSpawn.setY(Config.TVT_EVENT_PARTICIPATION_NPC_COORDINATES[1]);
|
||||
|
@ -33,7 +33,6 @@ import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.enums.ChatType;
|
||||
import com.l2jserver.gameserver.enums.SiegeClanType;
|
||||
import com.l2jserver.gameserver.instancemanager.CHSiegeManager;
|
||||
@ -46,7 +45,6 @@ import com.l2jserver.gameserver.model.Location;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
import com.l2jserver.gameserver.model.actor.L2Npc;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
|
||||
import com.l2jserver.gameserver.model.entity.Siegable;
|
||||
import com.l2jserver.gameserver.model.quest.Quest;
|
||||
import com.l2jserver.gameserver.network.NpcStringId;
|
||||
@ -159,9 +157,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
final int npcId = rset.getInt("npcId");
|
||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
|
||||
L2Spawn spawn = new L2Spawn(template);
|
||||
final L2Spawn spawn = new L2Spawn(rset.getInt("npcId"));
|
||||
spawn.setX(rset.getInt("x"));
|
||||
spawn.setY(rset.getInt("y"));
|
||||
spawn.setZ(rset.getInt("z"));
|
||||
|
@ -109,7 +109,7 @@ public class LongTimeEvent extends Quest
|
||||
*/
|
||||
private void loadConfig()
|
||||
{
|
||||
File configFile = new File("data/scripts/events/" + getScriptName() + "/config.xml");
|
||||
File configFile = new File("data/scripts/events/" + getName() + "/config.xml");
|
||||
try
|
||||
{
|
||||
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
||||
@ -117,7 +117,7 @@ public class LongTimeEvent extends Quest
|
||||
Document doc = db.parse(configFile);
|
||||
if (!doc.getDocumentElement().getNodeName().equalsIgnoreCase("event"))
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: bad config file!");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: bad config file!");
|
||||
}
|
||||
_eventName = doc.getDocumentElement().getAttributes().getNamedItem("name").getNodeValue();
|
||||
String period = doc.getDocumentElement().getAttributes().getNamedItem("active").getNodeValue();
|
||||
@ -140,7 +140,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (_eventPeriod == null)
|
||||
{
|
||||
throw new NullPointerException("WARNING!!! " + getScriptName() + " event: illegal event period");
|
||||
throw new NullPointerException("WARNING!!! " + getName() + " event: illegal event period");
|
||||
}
|
||||
|
||||
Date today = new Date();
|
||||
@ -172,19 +172,19 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (ItemTable.getInstance().getTemplate(itemId) == null)
|
||||
{
|
||||
_log.warning(getScriptName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
_log.warning(getName() + " event: " + itemId + " is wrong item id, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (minCount > maxCount)
|
||||
{
|
||||
_log.warning(getScriptName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
_log.warning(getName() + " event: item " + itemId + " - min greater than max, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((finalChance < 10000) || (finalChance > 1000000))
|
||||
{
|
||||
_log.warning(getScriptName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
_log.warning(getName() + " event: item " + itemId + " - incorrect drop chance, item was not added in droplist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -192,7 +192,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
_log.warning("Wrong number format in config.xml droplist block for " + getScriptName() + " event");
|
||||
_log.warning("Wrong number format in config.xml droplist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -214,7 +214,7 @@ public class LongTimeEvent extends Quest
|
||||
|
||||
if (NpcData.getInstance().getTemplate(npcId) == null)
|
||||
{
|
||||
_log.warning(getScriptName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
_log.warning(getName() + " event: " + npcId + " is wrong NPC id, NPC was not added in spawnlist");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (NumberFormatException nfe)
|
||||
{
|
||||
_log.warning("Wrong number format in config.xml spawnlist block for " + getScriptName() + " event");
|
||||
_log.warning("Wrong number format in config.xml spawnlist block for " + getName() + " event");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -255,7 +255,7 @@ public class LongTimeEvent extends Quest
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_log.log(Level.WARNING, getScriptName() + " event: error reading " + configFile.getAbsolutePath() + " ! " + e.getMessage(), e);
|
||||
_log.log(Level.WARNING, getName() + " event: error reading " + configFile.getAbsolutePath() + " ! " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.model.events;
|
||||
|
||||
import java.io.File;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
@ -36,6 +37,8 @@ import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.script.ScriptException;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.gameserver.GameTimeController;
|
||||
import com.l2jserver.gameserver.ai.CtrlIntention;
|
||||
@ -113,6 +116,7 @@ import com.l2jserver.gameserver.model.events.returns.AbstractEventReturn;
|
||||
import com.l2jserver.gameserver.model.events.returns.TerminateReturn;
|
||||
import com.l2jserver.gameserver.model.holders.ItemHolder;
|
||||
import com.l2jserver.gameserver.model.holders.SkillHolder;
|
||||
import com.l2jserver.gameserver.model.interfaces.INamable;
|
||||
import com.l2jserver.gameserver.model.interfaces.IPositionable;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.Inventory;
|
||||
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
|
||||
@ -131,21 +135,26 @@ import com.l2jserver.gameserver.network.serverpackets.ExUserInfoInvenWeight;
|
||||
import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SpecialCamera;
|
||||
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
|
||||
import com.l2jserver.gameserver.scripting.ManagedScript;
|
||||
import com.l2jserver.gameserver.scripting.L2ScriptEngineManager;
|
||||
import com.l2jserver.gameserver.scripting.ScriptManager;
|
||||
import com.l2jserver.gameserver.util.MinionList;
|
||||
import com.l2jserver.util.Rnd;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
* Abstract script.
|
||||
* @author KenM, UnAfraid, Zoey76
|
||||
*/
|
||||
public abstract class AbstractScript extends ManagedScript
|
||||
public abstract class AbstractScript implements INamable
|
||||
{
|
||||
protected static final Logger _log = Logger.getLogger(AbstractScript.class.getName());
|
||||
public static final Logger _log = Logger.getLogger(AbstractScript.class.getName());
|
||||
private final Map<ListenerRegisterType, Set<Integer>> _registeredIds = new ConcurrentHashMap<>();
|
||||
private final List<AbstractEventListener> _listeners = new CopyOnWriteArrayList<>();
|
||||
private final File _scriptFile;
|
||||
private boolean _isActive;
|
||||
|
||||
public AbstractScript()
|
||||
{
|
||||
_scriptFile = L2ScriptEngineManager.getInstance().getCurrentLoadingScript();
|
||||
initializeAnnotationListeners();
|
||||
}
|
||||
|
||||
@ -300,10 +309,38 @@ public abstract class AbstractScript extends ManagedScript
|
||||
}
|
||||
}
|
||||
|
||||
public void setActive(boolean status)
|
||||
{
|
||||
_isActive = status;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return _isActive;
|
||||
}
|
||||
|
||||
public File getScriptFile()
|
||||
{
|
||||
return _scriptFile;
|
||||
}
|
||||
|
||||
public boolean reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
L2ScriptEngineManager.getInstance().executeScript(getScriptFile());
|
||||
return true;
|
||||
}
|
||||
catch (ScriptException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unloads all listeners registered by this class.
|
||||
* @return {@code true}
|
||||
*/
|
||||
@Override
|
||||
public boolean unload()
|
||||
{
|
||||
_listeners.forEach(AbstractEventListener::unregisterMe);
|
||||
@ -311,6 +348,8 @@ public abstract class AbstractScript extends ManagedScript
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract ScriptManager<?> getManager();
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@ -1718,13 +1757,6 @@ public abstract class AbstractScript extends ManagedScript
|
||||
{
|
||||
try
|
||||
{
|
||||
final L2NpcTemplate template = NpcData.getInstance().getTemplate(npcId);
|
||||
if (template == null)
|
||||
{
|
||||
_log.severe("Couldn't find NPC template for ID:" + npcId + "!");
|
||||
return null;
|
||||
}
|
||||
|
||||
if ((x == 0) && (y == 0))
|
||||
{
|
||||
_log.log(Level.SEVERE, "addSpawn(): invalid spawn coordinates for NPC #" + npcId + "!");
|
||||
@ -1748,7 +1780,7 @@ public abstract class AbstractScript extends ManagedScript
|
||||
y += offset;
|
||||
}
|
||||
|
||||
final L2Spawn spawn = new L2Spawn(template);
|
||||
final L2Spawn spawn = new L2Spawn(npcId);
|
||||
spawn.setInstanceId(instanceId);
|
||||
spawn.setHeading(heading);
|
||||
spawn.setX(x);
|
||||
@ -2318,24 +2350,34 @@ public abstract class AbstractScript extends ManagedScript
|
||||
*/
|
||||
public static boolean takeItems(L2PcInstance player, int itemId, long amount)
|
||||
{
|
||||
// Get object item from player's inventory list
|
||||
final L2ItemInstance item = player.getInventory().getItemByItemId(itemId);
|
||||
if (item == null)
|
||||
final List<L2ItemInstance> items = player.getInventory().getItemsByItemId(itemId);
|
||||
if (amount < 0)
|
||||
{
|
||||
return false;
|
||||
items.forEach(i -> takeItem(player, i, i.getCount()));
|
||||
}
|
||||
|
||||
// Tests on count value in order not to have negative value
|
||||
if ((amount < 0) || (amount > item.getCount()))
|
||||
else
|
||||
{
|
||||
amount = item.getCount();
|
||||
long currentCount = 0;
|
||||
for (L2ItemInstance i : items)
|
||||
{
|
||||
long toDelete = i.getCount();
|
||||
if ((currentCount + toDelete) > amount)
|
||||
{
|
||||
toDelete = amount - currentCount;
|
||||
}
|
||||
takeItem(player, i, toDelete);
|
||||
currentCount += toDelete;
|
||||
}
|
||||
}
|
||||
|
||||
// Destroy the quantity of items wanted
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean takeItem(L2PcInstance player, L2ItemInstance item, long toDelete)
|
||||
{
|
||||
if (item.isEquipped())
|
||||
{
|
||||
final L2ItemInstance[] unequiped = player.getInventory().unEquipItemInBodySlotAndRecord(item.getItem().getBodyPart());
|
||||
InventoryUpdate iu = new InventoryUpdate();
|
||||
final InventoryUpdate iu = new InventoryUpdate();
|
||||
for (L2ItemInstance itm : unequiped)
|
||||
{
|
||||
iu.addModifiedItem(itm);
|
||||
@ -2343,7 +2385,7 @@ public abstract class AbstractScript extends ManagedScript
|
||||
player.sendPacket(iu);
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
return player.destroyItemByItemId("Quest", itemId, amount, player, true);
|
||||
return player.destroyItemByItemId("Quest", item.getId(), toDelete, player, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -673,7 +673,7 @@ public class PcInventory extends Inventory
|
||||
@Override
|
||||
public L2ItemInstance destroyItem(String process, L2ItemInstance item, L2PcInstance actor, Object reference)
|
||||
{
|
||||
return this.destroyItem(process, item, item.getCount(), actor, reference);
|
||||
return destroyItem(process, item, item.getCount(), actor, reference);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,7 +35,6 @@ import java.util.concurrent.locks.ReentrantReadWriteLock.ReadLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock.WriteLock;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
@ -81,8 +80,6 @@ import com.l2jserver.util.Util;
|
||||
*/
|
||||
public class Quest extends AbstractScript implements IIdentifiable
|
||||
{
|
||||
public static final Logger _log = Logger.getLogger(Quest.class.getName());
|
||||
|
||||
/** Map containing lists of timers from the name of the timer. */
|
||||
private volatile Map<String, List<QuestTimer>> _questTimers = null;
|
||||
private final ReentrantReadWriteLock _rwLock = new ReentrantReadWriteLock();
|
||||
@ -109,22 +106,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
private static final int RESET_HOUR = 6;
|
||||
private static final int RESET_MINUTES = 30;
|
||||
|
||||
/**
|
||||
* @return the reset hour for a daily quest, could be overridden on a script.
|
||||
*/
|
||||
public int getResetHour()
|
||||
{
|
||||
return RESET_HOUR;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reset minutes for a daily quest, could be overridden on a script.
|
||||
*/
|
||||
public int getResetMinutes()
|
||||
{
|
||||
return RESET_MINUTES;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Quest object constructor.<br>
|
||||
* Constructing a quest also calls the {@code init_LoadGlobalData} convenience method.
|
||||
@ -149,6 +130,24 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
loadGlobalData();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reset hour for a daily quest.
|
||||
* @return the reset hour
|
||||
*/
|
||||
public int getResetHour()
|
||||
{
|
||||
return RESET_HOUR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the reset minutes for a daily quest.
|
||||
* @return the reset minutes
|
||||
*/
|
||||
public int getResetMinutes()
|
||||
{
|
||||
return RESET_MINUTES;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is, by default, called by the constructor of all scripts.<br>
|
||||
* Children of this class can implement this function in order to define what variables to load and what structures to save them in.<br>
|
||||
@ -217,9 +216,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
return _initialState;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name of the quest
|
||||
*/
|
||||
@Override
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
@ -2725,12 +2722,6 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
takeItems(player, -1, questItemIds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScriptName()
|
||||
{
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setActive(boolean status)
|
||||
{
|
||||
@ -2789,7 +2780,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
}
|
||||
|
||||
@Override
|
||||
public ScriptManager<?> getScriptManager()
|
||||
public ScriptManager<?> getManager()
|
||||
{
|
||||
return QuestManager.getInstance();
|
||||
}
|
||||
|
@ -446,50 +446,28 @@ public final class Formulas
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate the CP regen rate (base + modifiers).
|
||||
* @param cha
|
||||
* @return
|
||||
* Calculates the CP regeneration rate (base + modifiers).
|
||||
* @param player the player
|
||||
* @return the CP regeneration rate
|
||||
*/
|
||||
public static final double calcCpRegen(L2Character cha)
|
||||
public static final double calcCpRegen(L2PcInstance player)
|
||||
{
|
||||
double init = cha.isPlayer() ? cha.getActingPlayer().getTemplate().getBaseCpRegen(cha.getLevel()) : cha.getTemplate().getBaseHpReg();
|
||||
// With CON bonus
|
||||
final double init = player.getActingPlayer().getTemplate().getBaseCpRegen(player.getLevel()) * player.getLevelMod() * BaseStats.CON.calcBonus(player);
|
||||
double cpRegenMultiplier = Config.CP_REGEN_MULTIPLIER;
|
||||
double cpRegenBonus = 0;
|
||||
|
||||
if (cha.isPlayer())
|
||||
if (player.isSitting())
|
||||
{
|
||||
L2PcInstance player = cha.getActingPlayer();
|
||||
|
||||
// Calculate Movement bonus
|
||||
if (player.isSitting())
|
||||
{
|
||||
cpRegenMultiplier *= 1.5; // Sitting
|
||||
}
|
||||
else if (!player.isMoving())
|
||||
{
|
||||
cpRegenMultiplier *= 1.1; // Staying
|
||||
}
|
||||
else if (player.isRunning())
|
||||
{
|
||||
cpRegenMultiplier *= 0.7; // Running
|
||||
}
|
||||
cpRegenMultiplier *= 1.5; // Sitting
|
||||
}
|
||||
else
|
||||
else if (!player.isMoving())
|
||||
{
|
||||
// Calculate Movement bonus
|
||||
if (!cha.isMoving())
|
||||
{
|
||||
cpRegenMultiplier *= 1.1; // Staying
|
||||
}
|
||||
else if (cha.isRunning())
|
||||
{
|
||||
cpRegenMultiplier *= 0.7; // Running
|
||||
}
|
||||
cpRegenMultiplier *= 1.1; // Staying
|
||||
}
|
||||
|
||||
// Apply CON bonus
|
||||
init *= cha.getLevelMod() * BaseStats.CON.calcBonus(cha);
|
||||
return (cha.calcStat(Stats.REGENERATE_CP_RATE, Math.max(1, init), null, null) * cpRegenMultiplier) + cpRegenBonus;
|
||||
else if (player.isRunning())
|
||||
{
|
||||
cpRegenMultiplier *= 0.7; // Running
|
||||
}
|
||||
return player.calcStat(Stats.REGENERATE_CP_RATE, Math.max(1, init), null, null) * cpRegenMultiplier;
|
||||
}
|
||||
|
||||
public static final double calcSiegeRegenModifier(L2PcInstance activeChar)
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
package com.l2jserver.gameserver.network.clientpackets;
|
||||
|
||||
import com.l2jserver.gameserver.model.L2Party.messageType;
|
||||
import com.l2jserver.gameserver.model.L2Party;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoom;
|
||||
import com.l2jserver.gameserver.model.PartyMatchRoomList;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -56,84 +56,83 @@ public final class RequestAnswerJoinParty extends L2GameClientPacket
|
||||
|
||||
requestor.sendPacket(new JoinParty(_response));
|
||||
|
||||
if (_response == 1)
|
||||
switch (_response)
|
||||
{
|
||||
if (requestor.isInParty())
|
||||
case -1: // Party disable by player client config
|
||||
{
|
||||
if (requestor.getParty().getMemberCount() >= 9)
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PARTY_IS_FULL);
|
||||
player.sendPacket(sm);
|
||||
requestor.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_SET_TO_REFUSE_PARTY_REQUESTS_AND_CANNOT_RECEIVE_A_PARTY_REQUEST);
|
||||
sm.addPcName(player);
|
||||
requestor.sendPacket(sm);
|
||||
break;
|
||||
}
|
||||
player.joinParty(requestor.getParty());
|
||||
|
||||
if (requestor.isInPartyMatchRoom() && player.isInPartyMatchRoom())
|
||||
case 0: // Party cancel by player
|
||||
{
|
||||
final PartyMatchRoomList list = PartyMatchRoomList.getInstance();
|
||||
if ((list != null) && (list.getPlayerRoomId(requestor) == list.getPlayerRoomId(player)))
|
||||
|
||||
// requestor.sendPacket(SystemMessageId.THE_PLAYER_DECLINED_TO_JOIN_YOUR_PARTY); FIXME: Done in client?
|
||||
break;
|
||||
}
|
||||
case 1: // Party accept by player
|
||||
{
|
||||
if (requestor.isInParty())
|
||||
{
|
||||
final PartyMatchRoom room = list.getPlayerRoom(requestor);
|
||||
if (room != null)
|
||||
if (requestor.getParty().getMemberCount() >= 9)
|
||||
{
|
||||
final ExManagePartyRoomMember packet = new ExManagePartyRoomMember(player, room, 1);
|
||||
for (L2PcInstance member : room.getPartyMembers())
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.THE_PARTY_IS_FULL);
|
||||
player.sendPacket(sm);
|
||||
requestor.sendPacket(sm);
|
||||
return;
|
||||
}
|
||||
player.joinParty(requestor.getParty());
|
||||
}
|
||||
else
|
||||
{
|
||||
requestor.setParty(new L2Party(requestor, requestor.getPartyDistributionType()));
|
||||
player.joinParty(requestor.getParty());
|
||||
}
|
||||
|
||||
if (requestor.isInPartyMatchRoom() && player.isInPartyMatchRoom())
|
||||
{
|
||||
final PartyMatchRoomList list = PartyMatchRoomList.getInstance();
|
||||
if ((list != null) && (list.getPlayerRoomId(requestor) == list.getPlayerRoomId(player)))
|
||||
{
|
||||
final PartyMatchRoom room = list.getPlayerRoom(requestor);
|
||||
if (room != null)
|
||||
{
|
||||
if (member != null)
|
||||
final ExManagePartyRoomMember packet = new ExManagePartyRoomMember(player, room, 1);
|
||||
for (L2PcInstance member : room.getPartyMembers())
|
||||
{
|
||||
member.sendPacket(packet);
|
||||
if (member != null)
|
||||
{
|
||||
member.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (requestor.isInPartyMatchRoom() && !player.isInPartyMatchRoom())
|
||||
{
|
||||
final PartyMatchRoomList list = PartyMatchRoomList.getInstance();
|
||||
if (list != null)
|
||||
else if (requestor.isInPartyMatchRoom() && !player.isInPartyMatchRoom())
|
||||
{
|
||||
final PartyMatchRoom room = list.getPlayerRoom(requestor);
|
||||
if (room != null)
|
||||
final PartyMatchRoomList list = PartyMatchRoomList.getInstance();
|
||||
if (list != null)
|
||||
{
|
||||
room.addMember(player);
|
||||
ExManagePartyRoomMember packet = new ExManagePartyRoomMember(player, room, 1);
|
||||
for (L2PcInstance member : room.getPartyMembers())
|
||||
final PartyMatchRoom room = list.getPlayerRoom(requestor);
|
||||
if (room != null)
|
||||
{
|
||||
if (member != null)
|
||||
room.addMember(player);
|
||||
ExManagePartyRoomMember packet = new ExManagePartyRoomMember(player, room, 1);
|
||||
for (L2PcInstance member : room.getPartyMembers())
|
||||
{
|
||||
member.sendPacket(packet);
|
||||
if (member != null)
|
||||
{
|
||||
member.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
player.setPartyRoom(room.getId());
|
||||
// player.setPartyMatching(1);
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
player.setPartyRoom(room.getId());
|
||||
// player.setPartyMatching(1);
|
||||
player.broadcastUserInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (_response == -1)
|
||||
{
|
||||
SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.C1_IS_SET_TO_REFUSE_PARTY_REQUESTS_AND_CANNOT_RECEIVE_A_PARTY_REQUEST);
|
||||
sm.addPcName(player);
|
||||
requestor.sendPacket(sm);
|
||||
|
||||
// activate garbage collection if there are no other members in party (happens when we were creating new one)
|
||||
if (requestor.isInParty() && (requestor.getParty().getMemberCount() == 1))
|
||||
{
|
||||
requestor.getParty().removePartyMember(requestor, messageType.None);
|
||||
}
|
||||
}
|
||||
else
|
||||
// 0
|
||||
{
|
||||
// requestor.sendPacket(SystemMessageId.THE_PLAYER_DECLINED_TO_JOIN_YOUR_PARTY); FIXME: Done in client?
|
||||
|
||||
// activate garbage collection if there are no other members in party (happens when we were creating new one)
|
||||
if (requestor.isInParty() && (requestor.getParty().getMemberCount() == 1))
|
||||
{
|
||||
requestor.getParty().removePartyMember(requestor, messageType.None);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,11 +201,10 @@ public final class RequestJoinParty extends L2GameClientPacket
|
||||
|
||||
if (!target.isProcessingRequest())
|
||||
{
|
||||
requestor.setParty(new L2Party(requestor, partyDistributionType));
|
||||
|
||||
requestor.onTransactionRequest(target);
|
||||
target.sendPacket(new AskJoinParty(requestor.getName(), partyDistributionType));
|
||||
requestor.getParty().setPendingInvitation(true);
|
||||
target.setActiveRequester(requestor);
|
||||
requestor.onTransactionRequest(target);
|
||||
requestor.setPartyDistributionType(partyDistributionType);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -47,7 +47,7 @@ public final class RequestPledgeCrest extends L2GameClientPacket
|
||||
}
|
||||
|
||||
final L2PcInstance activeChar = getClient().getActiveChar();
|
||||
if (activeChar.getClan().getId() == _clanId)
|
||||
if ((activeChar.getClan() != null) && (activeChar.getClan().getId() == _clanId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -386,7 +386,7 @@ public final class L2ScriptEngineManager
|
||||
/**
|
||||
* @return Returns the currentLoadingScript.
|
||||
*/
|
||||
protected File getCurrentLoadingScript()
|
||||
public File getCurrentLoadingScript()
|
||||
{
|
||||
return _currentLoadingScript;
|
||||
}
|
||||
|
@ -1,98 +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.scripting;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.script.ScriptException;
|
||||
|
||||
/**
|
||||
* Abstract class for classes that are meant to be implemented by scripts.<BR>
|
||||
* @author KenM
|
||||
*/
|
||||
public abstract class ManagedScript
|
||||
{
|
||||
private final File _scriptFile;
|
||||
private long _lastLoadTime;
|
||||
private boolean _isActive;
|
||||
|
||||
public ManagedScript()
|
||||
{
|
||||
_scriptFile = L2ScriptEngineManager.getInstance().getCurrentLoadingScript();
|
||||
setLastLoadTime(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to reload this script and to refresh the necessary bindings with it ScriptControler.<BR>
|
||||
* Subclasses of this class should override this method to properly refresh their bindings when necessary.
|
||||
* @return true if and only if the script was reloaded, false otherwise.
|
||||
*/
|
||||
public boolean reload()
|
||||
{
|
||||
try
|
||||
{
|
||||
L2ScriptEngineManager.getInstance().executeScript(getScriptFile());
|
||||
return true;
|
||||
}
|
||||
catch (ScriptException e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public abstract boolean unload();
|
||||
|
||||
public void setActive(boolean status)
|
||||
{
|
||||
_isActive = status;
|
||||
}
|
||||
|
||||
public boolean isActive()
|
||||
{
|
||||
return _isActive;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the scriptFile.
|
||||
*/
|
||||
public File getScriptFile()
|
||||
{
|
||||
return _scriptFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param lastLoadTime The lastLoadTime to set.
|
||||
*/
|
||||
protected void setLastLoadTime(long lastLoadTime)
|
||||
{
|
||||
_lastLoadTime = lastLoadTime;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the lastLoadTime.
|
||||
*/
|
||||
protected long getLastLoadTime()
|
||||
{
|
||||
return _lastLoadTime;
|
||||
}
|
||||
|
||||
public abstract String getScriptName();
|
||||
|
||||
public abstract ScriptManager<?> getScriptManager();
|
||||
}
|
@ -20,11 +20,13 @@ package com.l2jserver.gameserver.scripting;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import com.l2jserver.gameserver.model.events.AbstractScript;
|
||||
|
||||
/**
|
||||
* @author KenM
|
||||
* @param <S>
|
||||
*/
|
||||
public abstract class ScriptManager<S extends ManagedScript>
|
||||
public abstract class ScriptManager<S extends AbstractScript>
|
||||
{
|
||||
public abstract Map<String, S> getScripts();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user