Sync with L2jServer HighFive Feb 15th 2015.

This commit is contained in:
mobius
2015-02-15 23:48:35 +00:00
parent f2d6aedabe
commit 06c765ea63
45 changed files with 474 additions and 843 deletions

View File

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

View File

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