L2Object rework.

This commit is contained in:
MobiusDev 2018-09-08 04:13:34 +00:00
parent e5c0665db3
commit 2bb8220df2
250 changed files with 1750 additions and 5952 deletions

View File

@ -163,10 +163,6 @@
<admin command="admin_para_all_menu" accessLevel="100" />
<admin command="admin_unpara_menu" accessLevel="100" />
<admin command="admin_para_menu" accessLevel="100" />
<admin command="admin_polyself" accessLevel="100" />
<admin command="admin_unpolyself" accessLevel="100" />
<admin command="admin_polyself_menu" accessLevel="100" />
<admin command="admin_unpolyself_menu" accessLevel="100" />
<admin command="admin_clearteams" accessLevel="100" />
<admin command="admin_setteam_close" accessLevel="100" />
<admin command="admin_setteam" accessLevel="100" />
@ -237,8 +233,6 @@
<admin command="admin_event_name" accessLevel="100" />
<admin command="admin_event_control_kill" accessLevel="100" />
<admin command="admin_event_control_res" accessLevel="100" />
<admin command="admin_event_control_poly" accessLevel="100" />
<admin command="admin_event_control_unpoly" accessLevel="100" />
<admin command="admin_event_control_transform" accessLevel="100" />
<admin command="admin_event_control_untransform" accessLevel="100" />
<admin command="admin_event_control_prize" accessLevel="100" />
@ -435,9 +429,7 @@
<!-- ADMIN PLEDGE -->
<admin command="admin_pledge" accessLevel="100" />
<!-- ADMIN POLYMORPH -->
<admin command="admin_polymorph" accessLevel="100" />
<admin command="admin_unpolymorph" accessLevel="100" />
<!-- ADMIN TRANSFORM -->
<admin command="admin_transform" accessLevel="100" />
<admin command="admin_untransform" accessLevel="100" />
<admin command="admin_transform_menu" accessLevel="100" />

View File

@ -16,12 +16,6 @@
Character Based:<br1>
<table width=270>
<tr>
<td><button value="PolyMorph" action="bypass -h admin_polymorph_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Poly" action="bypass -h admin_unpolymorph_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Poly Self" action="bypass -h admin_polyself_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="UnPolySlf" action="bypass -h admin_unpolyself_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
<tr>
<td><button value="Para" action="bypass -h admin_para_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Para" action="bypass -h admin_unpara_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Para All" action="bypass -h admin_para_all_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>

View File

@ -136,7 +136,7 @@ public final class TeredorWarzone extends AbstractInstance
}
case "TEREDOR_LAIR_CHECK":
{
final Location spawnLoc = npc.getSpawn().getLocation();
final Location spawnLoc = npc.getSpawn();
if (((spawnLoc.getX() - npc.getX()) > 1000) || ((spawnLoc.getX() - npc.getX()) < -2000))
{

View File

@ -112,7 +112,6 @@ import handlers.admincommandhandlers.AdminPcCafePoints;
import handlers.admincommandhandlers.AdminPcCondOverride;
import handlers.admincommandhandlers.AdminPetition;
import handlers.admincommandhandlers.AdminPledge;
import handlers.admincommandhandlers.AdminPolymorph;
import handlers.admincommandhandlers.AdminPremium;
import handlers.admincommandhandlers.AdminPrimePoints;
import handlers.admincommandhandlers.AdminPunishment;
@ -134,6 +133,7 @@ import handlers.admincommandhandlers.AdminTarget;
import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
import handlers.admincommandhandlers.AdminTest;
import handlers.admincommandhandlers.AdminTransform;
import handlers.admincommandhandlers.AdminUnblockIp;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
@ -445,7 +445,6 @@ public class MasterHandler
AdminPForge.class,
AdminPledge.class,
AdminZones.class,
AdminPolymorph.class,
AdminPremium.class,
AdminPrimePoints.class,
AdminPunishment.class,
@ -467,6 +466,7 @@ public class MasterHandler
AdminTargetSay.class,
AdminTeleport.class,
AdminTest.class,
AdminTransform.class,
AdminUnblockIp.class,
AdminVitality.class,
AdminZone.class,

View File

@ -58,7 +58,6 @@ import com.l2jmobius.gameserver.util.Util;
* <li>gmspeed = temporary Super Haste effect.
* <li>para/unpara = paralyze/remove paralysis from target
* <li>para_all/unpara_all = same as para/unpara, affects the whole world.
* <li>polyself/unpolyself = makes you look as a specified mob.
* <li>changename = temporary change name
* <li>clearteams/setteam_close/setteam = team related commands
* <li>social = forces an L2Character instance to broadcast social action packets.
@ -89,10 +88,6 @@ public class AdminEffects implements IAdminCommandHandler
"admin_para_all_menu",
"admin_unpara_menu",
"admin_para_menu",
"admin_polyself",
"admin_unpolyself",
"admin_polyself_menu",
"admin_unpolyself_menu",
"admin_clearteams",
"admin_setteam_close",
"admin_setteam",
@ -369,25 +364,6 @@ public class AdminEffects implements IAdminCommandHandler
{
}
}
else if (command.startsWith("admin_polyself"))
{
try
{
final String id = st.nextToken();
activeChar.getPoly().setPolyInfo("npc", id);
activeChar.teleToLocation(activeChar.getLocation());
activeChar.broadcastUserInfo();
}
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polyself <npcId>");
}
}
else if (command.startsWith("admin_unpolyself"))
{
activeChar.getPoly().setPolyInfo(null, "1");
activeChar.broadcastUserInfo();
}
else if (command.equals("admin_clearteams"))
{
L2World.getInstance().forEachVisibleObject(activeChar, L2PcInstance.class, player ->

View File

@ -65,8 +65,6 @@ public class AdminEventEngine implements IAdminCommandHandler
"admin_event_name",
"admin_event_control_kill",
"admin_event_control_res",
"admin_event_control_poly",
"admin_event_control_unpoly",
"admin_event_control_transform",
"admin_event_control_untransform",
"admin_event_control_prize",
@ -305,38 +303,6 @@ public class AdminEventEngine implements IAdminCommandHandler
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_poly"))
{
final int teamId = Integer.parseInt(st.nextToken());
final String[] polyIds = new String[st.countTokens()];
int i = 0;
while (st.hasMoreElements()) // Every next ST should be a polymorph ID
{
polyIds[i++] = st.nextToken();
}
for (L2PcInstance player : L2Event._teams.get(teamId))
{
player.getPoly().setPolyInfo("npc", polyIds[Rnd.get(polyIds.length)]);
player.teleToLocation(player.getLocation(), true);
player.broadcastUserInfo();
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_unpoly"))
{
while (st.hasMoreElements()) // Every next ST should be a team number
{
for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
{
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();
}
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_transform"))
{
final int teamId = Integer.parseInt(st.nextToken());
@ -557,7 +523,7 @@ public class AdminEventEngine implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
final StringBuilder sb = new StringBuilder();
sb.append("<html><title>[ L2J EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append("<html><title>[ EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append(L2Event._eventName);
sb.append("</font></center><br><table cellspacing=-1 width=280><tr><td align=center>Type the team ID(s) that will be affected by the commands. Commands with '*' work with only 1 team ID in the field, while '!' - none.</td></tr><tr><td align=center><edit var=\"team_number\" width=100 height=15></td></tr>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><table width=200>");
@ -566,7 +532,7 @@ public class AdminEventEngine implements IAdminCommandHandler
sb.append("<tr><td><button value=\"Start!\" action=\"bypass -h admin_event_control_begin\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>");
}
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Polymorph*\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"poly_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Polymorphs the team into the NPC with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
adminReply.setHtml(sb.toString());
activeChar.sendPacket(adminReply);

View File

@ -482,9 +482,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(target.getX());
spawn.setY(target.getY());
spawn.setZ(target.getZ());
spawn.setXYZ(target);
spawn.setAmount(mobCount);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -530,9 +528,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setAmount(1);
spawn.setHeading(h);
spawn.setRespawnDelay(60);

View File

@ -546,9 +546,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
spawn = new L2Spawn(template1);
spawn.setX(activeChar.getX());
spawn.setY(activeChar.getY());
spawn.setZ(activeChar.getZ());
spawn.setXYZ(activeChar);
spawn.setAmount(1);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -583,9 +581,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
final L2Spawn spawnDat = new L2Spawn(target.getId());
spawnDat.setX(activeChar.getX());
spawnDat.setY(activeChar.getY());
spawnDat.setZ(activeChar.getZ());
spawnDat.setXYZ(activeChar);
spawnDat.setAmount(1);
spawnDat.setHeading(activeChar.getHeading());
spawnDat.setRespawnMinDelay(43200);

View File

@ -1,198 +1,121 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jmobius.gameserver.network.serverpackets.SetupGauge;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* Polymorph admin command implementation.
* @author Zoey76
*/
public class AdminPolymorph implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_polymorph",
"admin_unpolymorph",
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
if (command.startsWith("admin_polymorph"))
{
final String[] parts = command.split(" ");
if ((parts.length < 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polymorph [type] <id>");
return false;
}
if (parts.length > 2)
{
doPolymorph(activeChar, activeChar.getTarget(), parts[2], parts[1]);
}
else
{
doPolymorph(activeChar, activeChar.getTarget(), parts[1], "npc");
}
}
else if (command.equals("admin_unpolymorph"))
{
doUnPolymorph(activeChar, activeChar.getTarget());
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
/**
* Polymorph a creature.
* @param activeChar the active Game Master
* @param obj the target
* @param id the polymorph ID
* @param type the polymorph type
*/
private static void doPolymorph(L2PcInstance activeChar, L2Object obj, String id, String type)
{
if (obj != null)
{
obj.getPoly().setPolyInfo(type, id);
// animation
if (obj.isCharacter())
{
final L2Character Char = (L2Character) obj;
final MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0);
Char.broadcastPacket(msk);
final SetupGauge sg = new SetupGauge(activeChar.getObjectId(), 0, 4000);
Char.sendPacket(sg);
}
// end of animation
obj.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Polymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
/**
* Unpolymorh a creature.
* @param activeChar the active Game Master
* @param target the target
*/
private static void doUnPolymorph(L2PcInstance activeChar, L2Object target)
{
if (target != null)
{
target.getPoly().setPolyInfo(null, "1");
target.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Unpolymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* @author Mobius
*/
public class AdminTransform implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}

View File

@ -166,9 +166,7 @@ public final class SummonNpc extends AbstractEffect
return;
}
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setHeading(player.getHeading());
spawn.stopRespawn();

View File

@ -236,7 +236,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn().getLocation();
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))

View File

@ -95,9 +95,7 @@ public class DBSpawnManager
if (template != null)
{
final L2Spawn spawn = new L2Spawn(template);
spawn.setX(rset.getInt("x"));
spawn.setY(rset.getInt("y"));
spawn.setZ(rset.getInt("z"));
spawn.setXYZ(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
spawn.setAmount(1);
spawn.setHeading(rset.getInt("heading"));

View File

@ -261,9 +261,7 @@ public final class SiegeGuardManager
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@ -18,7 +18,6 @@ package com.l2jmobius.gameserver.model;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.ActionHandler;
@ -29,7 +28,6 @@ import com.l2jmobius.gameserver.idfactory.IdFactory;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.poly.ObjectPoly;
import com.l2jmobius.gameserver.model.events.ListenersContainer;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.interfaces.IDecayable;
@ -58,18 +56,18 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
/** World Region */
private L2WorldRegion _worldRegion;
/** Instance type */
private InstanceType _instanceType = null;
private InstanceType _instanceType;
private volatile Map<String, Object> _scripts;
/** X coordinate */
private final AtomicInteger _x = new AtomicInteger(0);
private volatile int _x = 0;
/** Y coordinate */
private final AtomicInteger _y = new AtomicInteger(0);
private volatile int _y = 0;
/** Z coordinate */
private final AtomicInteger _z = new AtomicInteger(0);
private volatile int _z = 0;
/** Orientation */
private final AtomicInteger _heading = new AtomicInteger(0);
private volatile int _heading = 0;
/** Instance id of object. 0 - Global */
private Instance _instance = null;
private Instance _instance;
private boolean _isSpawned;
private boolean _isInvisible;
private boolean _isTargetable = true;
@ -253,12 +251,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
return _objectId;
}
public final ObjectPoly getPoly()
{
final ObjectPoly poly = getScript(ObjectPoly.class);
return (poly == null) ? addScript(new ObjectPoly(this)) : poly;
}
public abstract void sendInfo(L2PcInstance activeChar);
public void sendPacket(IClientOutgoingPacket... packets)
@ -546,7 +538,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getX()
{
return _x.get();
return _x;
}
/**
@ -556,7 +548,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getY()
{
return _y.get();
return _y;
}
/**
@ -566,7 +558,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getZ()
{
return _z.get();
return _z;
}
/**
@ -576,7 +568,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getHeading()
{
return _heading.get();
return _heading;
}
/**
@ -614,37 +606,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public Location getLocation()
{
return new Location(_x.get(), _y.get(), _z.get(), _heading.get());
}
/**
* Sets the X coordinate
* @param newX the X coordinate
*/
@Override
public void setX(int newX)
{
_x.set(newX);
}
/**
* Sets the Y coordinate
* @param newY the Y coordinate
*/
@Override
public void setY(int newY)
{
_y.set(newY);
}
/**
* Sets the Z coordinate
* @param newZ the Z coordinate
*/
@Override
public void setZ(int newZ)
{
_z.set(newZ);
return new Location(_x, _y, _z, _heading);
}
/**
@ -656,9 +618,9 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setXYZ(int newX, int newY, int newZ)
{
setX(newX);
setY(newY);
setZ(newZ);
_x = newX;
_y = newY;
_z = newZ;
if (_isSpawned)
{
@ -693,7 +655,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setHeading(int newHeading)
{
_heading.set(newHeading);
_heading = newHeading;
}
/**
@ -745,10 +707,10 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setLocation(Location loc)
{
_x.set(loc.getX());
_y.set(loc.getY());
_z.set(loc.getZ());
_heading.set(loc.getHeading());
_x = loc.getX();
_y = loc.getY();
_z = loc.getZ();
_heading = loc.getHeading();
}
/**
@ -760,7 +722,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance2D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2));
}
/**
@ -782,7 +744,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance3D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2));
}
/**
@ -804,7 +766,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq2D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2);
}
/**
@ -826,7 +788,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq3D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2);
}
/**
@ -848,7 +810,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDirectionTo(ILocational target)
{
int heading = Util.calculateHeadingFrom(this, target) - _heading.get();
int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0)
{
heading = 65535 + heading;

View File

@ -32,9 +32,7 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
import com.l2jmobius.gameserver.model.interfaces.ILocational;
import com.l2jmobius.gameserver.model.interfaces.INamable;
import com.l2jmobius.gameserver.model.interfaces.IPositionable;
import com.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import com.l2jmobius.gameserver.model.zone.ZoneId;
@ -45,7 +43,7 @@ import com.l2jmobius.gameserver.model.zone.ZoneId;
* The heading of the L2NpcInstance can be a random heading if not defined (value= -1) or an exact heading (ex : merchant...).
* @author Nightmare
*/
public class L2Spawn implements IPositionable, IIdentifiable, INamable
public class L2Spawn extends Location implements IIdentifiable, INamable
{
protected static final Logger LOGGER = Logger.getLogger(L2Spawn.class.getName());
@ -59,10 +57,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
private int _currentCount;
/** The current number of SpawnTask in progress or stand by of this L2Spawn */
protected int _scheduledCount;
/** The identifier of the location area where L2NpcInstance can be spwaned */
/** The identifier of the location area where L2NpcInstance can be spawned */
private int _locationId;
/** The Location of this NPC spawn. */
private Location _location = new Location(0, 0, 0, 0);
/** The spawn instance id */
private int _instanceId = 0;
/** Minimum respawn delay */
private int _respawnMinDelay;
@ -121,6 +118,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
*/
public L2Spawn(L2NpcTemplate template) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, 0);
// Set the _template of the L2Spawn
_template = template;
@ -145,6 +143,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
*/
public L2Spawn(int npcId) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, 0);
_template = Objects.requireNonNull(NpcData.getInstance().getTemplate(npcId), "NpcTemplate not found for NPC ID: " + npcId);
final String className = "com.l2jmobius.gameserver.model.actor.instance." + _template.getType() + "Instance";
@ -187,122 +186,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
return _locationId;
}
@Override
public Location getLocation()
{
return _location;
}
/**
* @return the X position of the spawn point.
*/
@Override
public int getX()
{
return _location.getX();
}
/**
* Set the X position of the spawn point.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_location.setX(x);
}
/**
* @return the Y position of the spawn point.
*/
@Override
public int getY()
{
return _location.getY();
}
/**
* Set the Y position of the spawn point.
* @param y the y coordinate
*/
@Override
public void setY(int y)
{
_location.setY(y);
}
/**
* @return the Z position of the spawn point.
*/
@Override
public int getZ()
{
return _location.getZ();
}
/**
* Set the Z position of the spawn point.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_location.setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param x The x coordinate.
* @param y The y coordinate.
* @param z The z coordinate.
*/
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param loc The location.
*/
@Override
public void setXYZ(ILocational loc)
{
setXYZ(loc.getX(), loc.getY(), loc.getZ());
}
/**
* @return the heading of L2NpcInstance when they are spawned.
*/
@Override
public int getHeading()
{
return _location.getHeading();
}
/**
* Set the heading of L2NpcInstance when they are spawned.
* @param heading
*/
@Override
public void setHeading(int heading)
{
_location.setHeading(heading);
}
/**
* Set the XYZ position of the spawn point.
* @param loc
*/
@Override
public void setLocation(Location loc)
{
_location = loc;
}
/**
* Gets the NPC ID.
* @return the NPC ID
@ -511,7 +394,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
newlocz = loc.getZ();
setLocation(loc);
}
else if ((_location.getX() == 0) && (_location.getY() == 0))
else if ((getX() == 0) && (getY() == 0))
{
LOGGER.warning("NPC " + npc + " doesn't have spawn location!");
return null;
@ -519,9 +402,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
else
{
// The L2NpcInstance is spawned at the exact position (Lox, Locy, Locz)
newlocx = _location.getX();
newlocy = _location.getY();
newlocz = _location.getZ();
newlocx = getX();
newlocy = getY();
newlocz = getZ();
}
// If random spawn system is enabled
@ -541,13 +424,13 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
npc.setRandomWalking(_randomWalk);
// Set the heading of the L2NpcInstance (random heading if not defined)
if (_location.getHeading() == -1)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
}
else
{
npc.setHeading(_location.getHeading());
npc.setHeading(getHeading());
}
// Set custom Npc server side name and title
@ -666,12 +549,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
_instanceId = instanceId;
}
@Override
public String toString()
{
return "L2Spawn ID: " + _template.getId() + " " + _location;
}
public final boolean getRandomWalking()
{
return _randomWalk;
@ -691,4 +568,10 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
{
return _spawnTemplate;
}
@Override
public String toString()
{
return "L2Spawn ID: " + _template.getId() + " X: " + getX() + " Y: " + getY() + " Z: " + getZ() + " Heading: " + getHeading();
}
}

View File

@ -67,16 +67,6 @@ public class Location implements IPositionable
return _x;
}
/**
* Set the x coordinate.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_x = x;
}
/**
* Get the y coordinate.
* @return the y coordinate
@ -87,16 +77,6 @@ public class Location implements IPositionable
return _y;
}
/**
* Set the y coordinate.
* @param y the x coordinate
*/
@Override
public void setY(int y)
{
_y = y;
}
/**
* Get the z coordinate.
* @return the z coordinate
@ -107,16 +87,6 @@ public class Location implements IPositionable
return _z;
}
/**
* Set the z coordinate.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_z = z;
}
/**
* Set the x, y, z coordinates.
* @param x the x coordinate
@ -126,9 +96,9 @@ public class Location implements IPositionable
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
_x = x;
_y = y;
_z = z;
}
/**

View File

@ -152,9 +152,7 @@ public final class MobGroup
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
spawn.setX(x + (signX * randX));
spawn.setY(y + (signY * randY));
spawn.setZ(z);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
SpawnTable.getInstance().addNewSpawn(spawn, false);

View File

@ -1,67 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.actor.poly;
import com.l2jmobius.gameserver.model.L2Object;
public class ObjectPoly
{
private final L2Object _activeObject;
private int _polyId;
private String _polyType;
public ObjectPoly(L2Object activeObject)
{
_activeObject = activeObject;
}
public void setPolyInfo(String polyType, String polyId)
{
setPolyId(Integer.parseInt(polyId));
setPolyType(polyType);
}
public final L2Object getActiveObject()
{
return _activeObject;
}
public final boolean isMorphed()
{
return _polyType != null;
}
public final int getPolyId()
{
return _polyId;
}
public final void setPolyId(int value)
{
_polyId = value;
}
public final String getPolyType()
{
return _polyType;
}
public final void setPolyType(String value)
{
_polyType = value;
}
}

View File

@ -258,7 +258,7 @@ public final class Transform implements IIdentifiable
}
// Get player a bit higher so he doesn't drops underground after transformation happens
creature.setZ(creature.getZ() + (int) getCollisionHeight(creature, 0));
creature.setXYZ(creature.getX(), creature.getY(), (int) (creature.getZ() + getCollisionHeight(creature, 0)));
if (creature.isPlayer())
{

View File

@ -482,9 +482,7 @@ public final class BlockCheckerEngine
for (int i = 0; i < _numOfBoxes; i++)
{
final L2Spawn spawn = new L2Spawn(template);
spawn.setX(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400));
spawn.setY(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
spawn.setZ(_zCoord);
spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
spawn.setAmount(1);
spawn.setHeading(1);
spawn.setRespawnDelay(1);
@ -517,9 +515,7 @@ public final class BlockCheckerEngine
try
{
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);
girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
girlSpawn.setAmount(1);
girlSpawn.setHeading(1);
girlSpawn.setRespawnDelay(1);

View File

@ -1188,9 +1188,7 @@ public final class Castle extends AbstractResidence
LOGGER.warning(Castle.class.getSimpleName() + ": " + e.getMessage());
return;
}
spawn.setX(holder.getX());
spawn.setY(holder.getY());
spawn.setZ(holder.getZ());
spawn.setXYZ(holder);
spawn.setHeading(holder.getHeading());
final L2Npc npc = spawn.doSpawn(false);
npc.broadcastInfo();

View File

@ -1141,9 +1141,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@ -1172,9 +1170,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_siegeNpcs.add(spawnDat);
@ -1201,9 +1197,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_npcCommanders.add(spawnDat);
@ -1235,9 +1229,7 @@ public final class Fort extends AbstractResidence
final int npcId = rs.getInt("npcId");
final L2Spawn spawnDat = new L2Spawn(npcId);
spawnDat.setAmount(1);
spawnDat.setX(rs.getInt("x"));
spawnDat.setY(rs.getInt("y"));
spawnDat.setZ(rs.getInt("z"));
spawnDat.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_specialEnvoys.add(spawnDat);

View File

@ -1107,9 +1107,7 @@ public class FortSiege implements Siegable
{
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.setXYZ(_sp.getLocation());
spawnDat.setHeading(_sp.getLocation().getHeading());
spawnDat.setRespawnDelay(60);
spawnDat.doSpawn();
@ -1159,9 +1157,7 @@ public class FortSiege implements Siegable
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@ -165,9 +165,7 @@ public class L2Event
try
{
final L2Spawn spawn = new L2Spawn(_npcId);
spawn.setX(target.getX() + 50);
spawn.setY(target.getY() + 50);
spawn.setZ(target.getZ());
spawn.setXYZ(target.getX() + 50, target.getY() + 50, target.getZ());
spawn.setAmount(1);
spawn.setHeading(target.getHeading());
spawn.stopRespawn();
@ -284,7 +282,6 @@ public class L2Event
player.setCurrentCp(player.getMaxCp());
}
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();

View File

@ -2239,9 +2239,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
spawn.setInstanceId(instance);
spawn.setHeading(heading);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.stopRespawn();
final L2Npc npc = spawn.doSpawn(isSummonSpawn);

View File

@ -24,24 +24,6 @@ import com.l2jmobius.gameserver.model.Location;
*/
public interface IPositionable extends ILocational
{
/**
* Sets the X coordinate of this object.
* @param x the new X coordinate
*/
void setX(int x);
/**
* Sets the Y coordinate of this object.
* @param y the new Y coordinate
*/
void setY(int y);
/**
* Sets the Z coordinate of this object.
* @param z the new Z coordinate
*/
void setZ(int z);
/**
* Sets all three coordinates of this object.
* @param x the new X coordinate

View File

@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.SpawnItem;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
public class RequestRecordInfo implements IClientIncomingPacket
@ -46,27 +45,20 @@ public class RequestRecordInfo implements IClientIncomingPacket
L2World.getInstance().forEachVisibleObject(activeChar, L2Object.class, object ->
{
if (object.getPoly().isMorphed() && object.getPoly().getPolyType().equals("item"))
if (object.isVisibleFor(activeChar))
{
client.sendPacket(new SpawnItem(object));
}
else
{
if (object.isVisibleFor(activeChar))
object.sendInfo(activeChar);
if (object.isCharacter())
{
object.sendInfo(activeChar);
if (object.isCharacter())
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
obj.getAI().describeStateToPlayer(activeChar);
}
obj.getAI().describeStateToPlayer(activeChar);
}
}
}

View File

@ -34,13 +34,6 @@ public class DropItem implements IClientOutgoingPacket
{
_item = item;
_charObjId = playerObjId;
// Future test.
if ((_item.getX() == 0) && (_item.getY() == 0))
{
LOGGER.warning("DropItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check SpawnItem, just in case.
}
}
@Override

View File

@ -17,45 +17,16 @@
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.network.OutgoingPackets;
public final class SpawnItem implements IClientOutgoingPacket
{
private final int _objectId;
private int _itemId;
private final int _x, _y, _z;
private int _stackable;
private long _count;
private final L2ItemInstance _item;
public SpawnItem(L2Object obj)
public SpawnItem(L2ItemInstance item)
{
_objectId = obj.getObjectId();
_x = obj.getX();
_y = obj.getY();
_z = obj.getZ();
// Future test.
if ((_x == 0) && (_y == 0))
{
LOGGER.warning("SpawnItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check DropItem, just in case.
}
if (obj.isItem())
{
final L2ItemInstance item = (L2ItemInstance) obj;
_itemId = item.getDisplayId();
_stackable = item.isStackable() ? 0x01 : 0x00;
_count = item.getCount();
}
else
{
_itemId = obj.getPoly().getPolyId();
_stackable = 0;
_count = 1;
}
_item = item;
}
@Override
@ -63,15 +34,14 @@ public final class SpawnItem implements IClientOutgoingPacket
{
OutgoingPackets.SPAWN_ITEM.writeId(packet);
packet.writeD(_objectId);
packet.writeD(_itemId);
packet.writeD(_x);
packet.writeD(_y);
packet.writeD(_z);
packet.writeD(_item.getObjectId());
packet.writeD(_item.getDisplayId());
packet.writeD(_item.getX());
packet.writeD(_item.getY());
packet.writeD(_item.getZ());
// only show item count if it is a stackable item
packet.writeD(_stackable);
packet.writeQ(_count);
packet.writeD(_item.isStackable() ? 0x01 : 0x00);
packet.writeQ(_item.getCount());
packet.writeD(0x00); // c2
return true;
}

View File

@ -108,6 +108,7 @@ Others:
-Reworked quest system
-Reworked spawn system
-Reworked drop system
-Reworked L2World, L2WorldRegion and L2Object
-Skill system from L2jUnity
-GeoEngine from aCis

View File

@ -163,10 +163,6 @@
<admin command="admin_para_all_menu" accessLevel="100" />
<admin command="admin_unpara_menu" accessLevel="100" />
<admin command="admin_para_menu" accessLevel="100" />
<admin command="admin_polyself" accessLevel="100" />
<admin command="admin_unpolyself" accessLevel="100" />
<admin command="admin_polyself_menu" accessLevel="100" />
<admin command="admin_unpolyself_menu" accessLevel="100" />
<admin command="admin_clearteams" accessLevel="100" />
<admin command="admin_setteam_close" accessLevel="100" />
<admin command="admin_setteam" accessLevel="100" />
@ -237,8 +233,6 @@
<admin command="admin_event_name" accessLevel="100" />
<admin command="admin_event_control_kill" accessLevel="100" />
<admin command="admin_event_control_res" accessLevel="100" />
<admin command="admin_event_control_poly" accessLevel="100" />
<admin command="admin_event_control_unpoly" accessLevel="100" />
<admin command="admin_event_control_transform" accessLevel="100" />
<admin command="admin_event_control_untransform" accessLevel="100" />
<admin command="admin_event_control_prize" accessLevel="100" />
@ -435,9 +429,7 @@
<!-- ADMIN PLEDGE -->
<admin command="admin_pledge" accessLevel="100" />
<!-- ADMIN POLYMORPH -->
<admin command="admin_polymorph" accessLevel="100" />
<admin command="admin_unpolymorph" accessLevel="100" />
<!-- ADMIN TRANSFORM -->
<admin command="admin_transform" accessLevel="100" />
<admin command="admin_untransform" accessLevel="100" />
<admin command="admin_transform_menu" accessLevel="100" />

View File

@ -16,12 +16,6 @@
Character Based:<br1>
<table width=270>
<tr>
<td><button value="PolyMorph" action="bypass -h admin_polymorph_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Poly" action="bypass -h admin_unpolymorph_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Poly Self" action="bypass -h admin_polyself_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="UnPolySlf" action="bypass -h admin_unpolyself_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
<tr>
<td><button value="Para" action="bypass -h admin_para_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Para" action="bypass -h admin_unpara_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Para All" action="bypass -h admin_para_all_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>

View File

@ -136,7 +136,7 @@ public final class TeredorWarzone extends AbstractInstance
}
case "TEREDOR_LAIR_CHECK":
{
final Location spawnLoc = npc.getSpawn().getLocation();
final Location spawnLoc = npc.getSpawn();
if (((spawnLoc.getX() - npc.getX()) > 1000) || ((spawnLoc.getX() - npc.getX()) < -2000))
{

View File

@ -112,7 +112,6 @@ import handlers.admincommandhandlers.AdminPcCafePoints;
import handlers.admincommandhandlers.AdminPcCondOverride;
import handlers.admincommandhandlers.AdminPetition;
import handlers.admincommandhandlers.AdminPledge;
import handlers.admincommandhandlers.AdminPolymorph;
import handlers.admincommandhandlers.AdminPremium;
import handlers.admincommandhandlers.AdminPrimePoints;
import handlers.admincommandhandlers.AdminPunishment;
@ -134,6 +133,7 @@ import handlers.admincommandhandlers.AdminTarget;
import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
import handlers.admincommandhandlers.AdminTest;
import handlers.admincommandhandlers.AdminTransform;
import handlers.admincommandhandlers.AdminUnblockIp;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
@ -446,7 +446,6 @@ public class MasterHandler
AdminPForge.class,
AdminPledge.class,
AdminZones.class,
AdminPolymorph.class,
AdminPremium.class,
AdminPrimePoints.class,
AdminPunishment.class,
@ -468,6 +467,7 @@ public class MasterHandler
AdminTargetSay.class,
AdminTeleport.class,
AdminTest.class,
AdminTransform.class,
AdminUnblockIp.class,
AdminVitality.class,
AdminZone.class,

View File

@ -58,7 +58,6 @@ import com.l2jmobius.gameserver.util.Util;
* <li>gmspeed = temporary Super Haste effect.
* <li>para/unpara = paralyze/remove paralysis from target
* <li>para_all/unpara_all = same as para/unpara, affects the whole world.
* <li>polyself/unpolyself = makes you look as a specified mob.
* <li>changename = temporary change name
* <li>clearteams/setteam_close/setteam = team related commands
* <li>social = forces an L2Character instance to broadcast social action packets.
@ -89,10 +88,6 @@ public class AdminEffects implements IAdminCommandHandler
"admin_para_all_menu",
"admin_unpara_menu",
"admin_para_menu",
"admin_polyself",
"admin_unpolyself",
"admin_polyself_menu",
"admin_unpolyself_menu",
"admin_clearteams",
"admin_setteam_close",
"admin_setteam",
@ -369,25 +364,6 @@ public class AdminEffects implements IAdminCommandHandler
{
}
}
else if (command.startsWith("admin_polyself"))
{
try
{
final String id = st.nextToken();
activeChar.getPoly().setPolyInfo("npc", id);
activeChar.teleToLocation(activeChar.getLocation());
activeChar.broadcastUserInfo();
}
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polyself <npcId>");
}
}
else if (command.startsWith("admin_unpolyself"))
{
activeChar.getPoly().setPolyInfo(null, "1");
activeChar.broadcastUserInfo();
}
else if (command.equals("admin_clearteams"))
{
L2World.getInstance().forEachVisibleObject(activeChar, L2PcInstance.class, player ->

View File

@ -65,8 +65,6 @@ public class AdminEventEngine implements IAdminCommandHandler
"admin_event_name",
"admin_event_control_kill",
"admin_event_control_res",
"admin_event_control_poly",
"admin_event_control_unpoly",
"admin_event_control_transform",
"admin_event_control_untransform",
"admin_event_control_prize",
@ -305,38 +303,6 @@ public class AdminEventEngine implements IAdminCommandHandler
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_poly"))
{
final int teamId = Integer.parseInt(st.nextToken());
final String[] polyIds = new String[st.countTokens()];
int i = 0;
while (st.hasMoreElements()) // Every next ST should be a polymorph ID
{
polyIds[i++] = st.nextToken();
}
for (L2PcInstance player : L2Event._teams.get(teamId))
{
player.getPoly().setPolyInfo("npc", polyIds[Rnd.get(polyIds.length)]);
player.teleToLocation(player.getLocation(), true);
player.broadcastUserInfo();
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_unpoly"))
{
while (st.hasMoreElements()) // Every next ST should be a team number
{
for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
{
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();
}
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_transform"))
{
final int teamId = Integer.parseInt(st.nextToken());
@ -557,7 +523,7 @@ public class AdminEventEngine implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
final StringBuilder sb = new StringBuilder();
sb.append("<html><title>[ L2J EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append("<html><title>[ EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append(L2Event._eventName);
sb.append("</font></center><br><table cellspacing=-1 width=280><tr><td align=center>Type the team ID(s) that will be affected by the commands. Commands with '*' work with only 1 team ID in the field, while '!' - none.</td></tr><tr><td align=center><edit var=\"team_number\" width=100 height=15></td></tr>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><table width=200>");
@ -566,7 +532,7 @@ public class AdminEventEngine implements IAdminCommandHandler
sb.append("<tr><td><button value=\"Start!\" action=\"bypass -h admin_event_control_begin\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>");
}
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Polymorph*\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"poly_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Polymorphs the team into the NPC with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
adminReply.setHtml(sb.toString());
activeChar.sendPacket(adminReply);

View File

@ -482,9 +482,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(target.getX());
spawn.setY(target.getY());
spawn.setZ(target.getZ());
spawn.setXYZ(target);
spawn.setAmount(mobCount);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -530,9 +528,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setAmount(1);
spawn.setHeading(h);
spawn.setRespawnDelay(60);

View File

@ -546,9 +546,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
spawn = new L2Spawn(template1);
spawn.setX(activeChar.getX());
spawn.setY(activeChar.getY());
spawn.setZ(activeChar.getZ());
spawn.setXYZ(activeChar);
spawn.setAmount(1);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -583,9 +581,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
final L2Spawn spawnDat = new L2Spawn(target.getId());
spawnDat.setX(activeChar.getX());
spawnDat.setY(activeChar.getY());
spawnDat.setZ(activeChar.getZ());
spawnDat.setXYZ(activeChar);
spawnDat.setAmount(1);
spawnDat.setHeading(activeChar.getHeading());
spawnDat.setRespawnMinDelay(43200);

View File

@ -1,198 +1,121 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jmobius.gameserver.network.serverpackets.SetupGauge;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* Polymorph admin command implementation.
* @author Zoey76
*/
public class AdminPolymorph implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_polymorph",
"admin_unpolymorph",
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
if (command.startsWith("admin_polymorph"))
{
final String[] parts = command.split(" ");
if ((parts.length < 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polymorph [type] <id>");
return false;
}
if (parts.length > 2)
{
doPolymorph(activeChar, activeChar.getTarget(), parts[2], parts[1]);
}
else
{
doPolymorph(activeChar, activeChar.getTarget(), parts[1], "npc");
}
}
else if (command.equals("admin_unpolymorph"))
{
doUnPolymorph(activeChar, activeChar.getTarget());
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
/**
* Polymorph a creature.
* @param activeChar the active Game Master
* @param obj the target
* @param id the polymorph ID
* @param type the polymorph type
*/
private static void doPolymorph(L2PcInstance activeChar, L2Object obj, String id, String type)
{
if (obj != null)
{
obj.getPoly().setPolyInfo(type, id);
// animation
if (obj.isCharacter())
{
final L2Character Char = (L2Character) obj;
final MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0);
Char.broadcastPacket(msk);
final SetupGauge sg = new SetupGauge(activeChar.getObjectId(), 0, 4000);
Char.sendPacket(sg);
}
// end of animation
obj.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Polymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
/**
* Unpolymorh a creature.
* @param activeChar the active Game Master
* @param target the target
*/
private static void doUnPolymorph(L2PcInstance activeChar, L2Object target)
{
if (target != null)
{
target.getPoly().setPolyInfo(null, "1");
target.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Unpolymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* @author Mobius
*/
public class AdminTransform implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}

View File

@ -166,9 +166,7 @@ public final class SummonNpc extends AbstractEffect
return;
}
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setHeading(player.getHeading());
spawn.stopRespawn();

View File

@ -236,7 +236,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn().getLocation();
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))

View File

@ -95,9 +95,7 @@ public class DBSpawnManager
if (template != null)
{
final L2Spawn spawn = new L2Spawn(template);
spawn.setX(rset.getInt("x"));
spawn.setY(rset.getInt("y"));
spawn.setZ(rset.getInt("z"));
spawn.setXYZ(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
spawn.setAmount(1);
spawn.setHeading(rset.getInt("heading"));

View File

@ -261,9 +261,7 @@ public final class SiegeGuardManager
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@ -18,7 +18,6 @@ package com.l2jmobius.gameserver.model;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.ActionHandler;
@ -29,7 +28,6 @@ import com.l2jmobius.gameserver.idfactory.IdFactory;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.poly.ObjectPoly;
import com.l2jmobius.gameserver.model.events.ListenersContainer;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.interfaces.IDecayable;
@ -58,18 +56,18 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
/** World Region */
private L2WorldRegion _worldRegion;
/** Instance type */
private InstanceType _instanceType = null;
private InstanceType _instanceType;
private volatile Map<String, Object> _scripts;
/** X coordinate */
private final AtomicInteger _x = new AtomicInteger(0);
private volatile int _x = 0;
/** Y coordinate */
private final AtomicInteger _y = new AtomicInteger(0);
private volatile int _y = 0;
/** Z coordinate */
private final AtomicInteger _z = new AtomicInteger(0);
private volatile int _z = 0;
/** Orientation */
private final AtomicInteger _heading = new AtomicInteger(0);
private volatile int _heading = 0;
/** Instance id of object. 0 - Global */
private Instance _instance = null;
private Instance _instance;
private boolean _isSpawned;
private boolean _isInvisible;
private boolean _isTargetable = true;
@ -253,12 +251,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
return _objectId;
}
public final ObjectPoly getPoly()
{
final ObjectPoly poly = getScript(ObjectPoly.class);
return (poly == null) ? addScript(new ObjectPoly(this)) : poly;
}
public abstract void sendInfo(L2PcInstance activeChar);
public void sendPacket(IClientOutgoingPacket... packets)
@ -546,7 +538,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getX()
{
return _x.get();
return _x;
}
/**
@ -556,7 +548,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getY()
{
return _y.get();
return _y;
}
/**
@ -566,7 +558,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getZ()
{
return _z.get();
return _z;
}
/**
@ -576,7 +568,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getHeading()
{
return _heading.get();
return _heading;
}
/**
@ -614,37 +606,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public Location getLocation()
{
return new Location(_x.get(), _y.get(), _z.get(), _heading.get());
}
/**
* Sets the X coordinate
* @param newX the X coordinate
*/
@Override
public void setX(int newX)
{
_x.set(newX);
}
/**
* Sets the Y coordinate
* @param newY the Y coordinate
*/
@Override
public void setY(int newY)
{
_y.set(newY);
}
/**
* Sets the Z coordinate
* @param newZ the Z coordinate
*/
@Override
public void setZ(int newZ)
{
_z.set(newZ);
return new Location(_x, _y, _z, _heading);
}
/**
@ -656,9 +618,9 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setXYZ(int newX, int newY, int newZ)
{
setX(newX);
setY(newY);
setZ(newZ);
_x = newX;
_y = newY;
_z = newZ;
if (_isSpawned)
{
@ -693,7 +655,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setHeading(int newHeading)
{
_heading.set(newHeading);
_heading = newHeading;
}
/**
@ -745,10 +707,10 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setLocation(Location loc)
{
_x.set(loc.getX());
_y.set(loc.getY());
_z.set(loc.getZ());
_heading.set(loc.getHeading());
_x = loc.getX();
_y = loc.getY();
_z = loc.getZ();
_heading = loc.getHeading();
}
/**
@ -760,7 +722,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance2D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2));
}
/**
@ -782,7 +744,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance3D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2));
}
/**
@ -804,7 +766,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq2D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2);
}
/**
@ -826,7 +788,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq3D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2);
}
/**
@ -848,7 +810,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDirectionTo(ILocational target)
{
int heading = Util.calculateHeadingFrom(this, target) - _heading.get();
int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0)
{
heading = 65535 + heading;

View File

@ -32,9 +32,7 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
import com.l2jmobius.gameserver.model.interfaces.ILocational;
import com.l2jmobius.gameserver.model.interfaces.INamable;
import com.l2jmobius.gameserver.model.interfaces.IPositionable;
import com.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import com.l2jmobius.gameserver.model.zone.ZoneId;
@ -45,7 +43,7 @@ import com.l2jmobius.gameserver.model.zone.ZoneId;
* The heading of the L2NpcInstance can be a random heading if not defined (value= -1) or an exact heading (ex : merchant...).
* @author Nightmare
*/
public class L2Spawn implements IPositionable, IIdentifiable, INamable
public class L2Spawn extends Location implements IIdentifiable, INamable
{
protected static final Logger LOGGER = Logger.getLogger(L2Spawn.class.getName());
@ -59,10 +57,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
private int _currentCount;
/** The current number of SpawnTask in progress or stand by of this L2Spawn */
protected int _scheduledCount;
/** The identifier of the location area where L2NpcInstance can be spwaned */
/** The identifier of the location area where L2NpcInstance can be spawned */
private int _locationId;
/** The Location of this NPC spawn. */
private Location _location = new Location(0, 0, 0, 0);
/** The spawn instance id */
private int _instanceId = 0;
/** Minimum respawn delay */
private int _respawnMinDelay;
@ -121,6 +118,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
*/
public L2Spawn(L2NpcTemplate template) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, 0);
// Set the _template of the L2Spawn
_template = template;
@ -145,6 +143,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
*/
public L2Spawn(int npcId) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, 0);
_template = Objects.requireNonNull(NpcData.getInstance().getTemplate(npcId), "NpcTemplate not found for NPC ID: " + npcId);
final String className = "com.l2jmobius.gameserver.model.actor.instance." + _template.getType() + "Instance";
@ -187,122 +186,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
return _locationId;
}
@Override
public Location getLocation()
{
return _location;
}
/**
* @return the X position of the spawn point.
*/
@Override
public int getX()
{
return _location.getX();
}
/**
* Set the X position of the spawn point.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_location.setX(x);
}
/**
* @return the Y position of the spawn point.
*/
@Override
public int getY()
{
return _location.getY();
}
/**
* Set the Y position of the spawn point.
* @param y the y coordinate
*/
@Override
public void setY(int y)
{
_location.setY(y);
}
/**
* @return the Z position of the spawn point.
*/
@Override
public int getZ()
{
return _location.getZ();
}
/**
* Set the Z position of the spawn point.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_location.setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param x The x coordinate.
* @param y The y coordinate.
* @param z The z coordinate.
*/
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param loc The location.
*/
@Override
public void setXYZ(ILocational loc)
{
setXYZ(loc.getX(), loc.getY(), loc.getZ());
}
/**
* @return the heading of L2NpcInstance when they are spawned.
*/
@Override
public int getHeading()
{
return _location.getHeading();
}
/**
* Set the heading of L2NpcInstance when they are spawned.
* @param heading
*/
@Override
public void setHeading(int heading)
{
_location.setHeading(heading);
}
/**
* Set the XYZ position of the spawn point.
* @param loc
*/
@Override
public void setLocation(Location loc)
{
_location = loc;
}
/**
* Gets the NPC ID.
* @return the NPC ID
@ -511,7 +394,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
newlocz = loc.getZ();
setLocation(loc);
}
else if ((_location.getX() == 0) && (_location.getY() == 0))
else if ((getX() == 0) && (getY() == 0))
{
LOGGER.warning("NPC " + npc + " doesn't have spawn location!");
return null;
@ -519,9 +402,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
else
{
// The L2NpcInstance is spawned at the exact position (Lox, Locy, Locz)
newlocx = _location.getX();
newlocy = _location.getY();
newlocz = _location.getZ();
newlocx = getX();
newlocy = getY();
newlocz = getZ();
}
// If random spawn system is enabled
@ -541,13 +424,13 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
npc.setRandomWalking(_randomWalk);
// Set the heading of the L2NpcInstance (random heading if not defined)
if (_location.getHeading() == -1)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
}
else
{
npc.setHeading(_location.getHeading());
npc.setHeading(getHeading());
}
// Set custom Npc server side name and title
@ -666,12 +549,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
_instanceId = instanceId;
}
@Override
public String toString()
{
return "L2Spawn ID: " + _template.getId() + " " + _location;
}
public final boolean getRandomWalking()
{
return _randomWalk;
@ -691,4 +568,10 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
{
return _spawnTemplate;
}
@Override
public String toString()
{
return "L2Spawn ID: " + _template.getId() + " X: " + getX() + " Y: " + getY() + " Z: " + getZ() + " Heading: " + getHeading();
}
}

View File

@ -67,16 +67,6 @@ public class Location implements IPositionable
return _x;
}
/**
* Set the x coordinate.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_x = x;
}
/**
* Get the y coordinate.
* @return the y coordinate
@ -87,16 +77,6 @@ public class Location implements IPositionable
return _y;
}
/**
* Set the y coordinate.
* @param y the x coordinate
*/
@Override
public void setY(int y)
{
_y = y;
}
/**
* Get the z coordinate.
* @return the z coordinate
@ -107,16 +87,6 @@ public class Location implements IPositionable
return _z;
}
/**
* Set the z coordinate.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_z = z;
}
/**
* Set the x, y, z coordinates.
* @param x the x coordinate
@ -126,9 +96,9 @@ public class Location implements IPositionable
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
_x = x;
_y = y;
_z = z;
}
/**

View File

@ -152,9 +152,7 @@ public final class MobGroup
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
spawn.setX(x + (signX * randX));
spawn.setY(y + (signY * randY));
spawn.setZ(z);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
SpawnTable.getInstance().addNewSpawn(spawn, false);

View File

@ -1,67 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.actor.poly;
import com.l2jmobius.gameserver.model.L2Object;
public class ObjectPoly
{
private final L2Object _activeObject;
private int _polyId;
private String _polyType;
public ObjectPoly(L2Object activeObject)
{
_activeObject = activeObject;
}
public void setPolyInfo(String polyType, String polyId)
{
setPolyId(Integer.parseInt(polyId));
setPolyType(polyType);
}
public final L2Object getActiveObject()
{
return _activeObject;
}
public final boolean isMorphed()
{
return _polyType != null;
}
public final int getPolyId()
{
return _polyId;
}
public final void setPolyId(int value)
{
_polyId = value;
}
public final String getPolyType()
{
return _polyType;
}
public final void setPolyType(String value)
{
_polyType = value;
}
}

View File

@ -258,7 +258,7 @@ public final class Transform implements IIdentifiable
}
// Get player a bit higher so he doesn't drops underground after transformation happens
creature.setZ(creature.getZ() + (int) getCollisionHeight(creature, 0));
creature.setXYZ(creature.getX(), creature.getY(), (int) (creature.getZ() + getCollisionHeight(creature, 0)));
if (creature.isPlayer())
{

View File

@ -482,9 +482,7 @@ public final class BlockCheckerEngine
for (int i = 0; i < _numOfBoxes; i++)
{
final L2Spawn spawn = new L2Spawn(template);
spawn.setX(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400));
spawn.setY(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
spawn.setZ(_zCoord);
spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
spawn.setAmount(1);
spawn.setHeading(1);
spawn.setRespawnDelay(1);
@ -517,9 +515,7 @@ public final class BlockCheckerEngine
try
{
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);
girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
girlSpawn.setAmount(1);
girlSpawn.setHeading(1);
girlSpawn.setRespawnDelay(1);

View File

@ -1188,9 +1188,7 @@ public final class Castle extends AbstractResidence
LOGGER.warning(Castle.class.getSimpleName() + ": " + e.getMessage());
return;
}
spawn.setX(holder.getX());
spawn.setY(holder.getY());
spawn.setZ(holder.getZ());
spawn.setXYZ(holder);
spawn.setHeading(holder.getHeading());
final L2Npc npc = spawn.doSpawn(false);
npc.broadcastInfo();

View File

@ -1141,9 +1141,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@ -1172,9 +1170,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_siegeNpcs.add(spawnDat);
@ -1201,9 +1197,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_npcCommanders.add(spawnDat);
@ -1235,9 +1229,7 @@ public final class Fort extends AbstractResidence
final int npcId = rs.getInt("npcId");
final L2Spawn spawnDat = new L2Spawn(npcId);
spawnDat.setAmount(1);
spawnDat.setX(rs.getInt("x"));
spawnDat.setY(rs.getInt("y"));
spawnDat.setZ(rs.getInt("z"));
spawnDat.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_specialEnvoys.add(spawnDat);

View File

@ -1107,9 +1107,7 @@ public class FortSiege implements Siegable
{
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.setXYZ(_sp.getLocation());
spawnDat.setHeading(_sp.getLocation().getHeading());
spawnDat.setRespawnDelay(60);
spawnDat.doSpawn();
@ -1159,9 +1157,7 @@ public class FortSiege implements Siegable
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@ -165,9 +165,7 @@ public class L2Event
try
{
final L2Spawn spawn = new L2Spawn(_npcId);
spawn.setX(target.getX() + 50);
spawn.setY(target.getY() + 50);
spawn.setZ(target.getZ());
spawn.setXYZ(target.getX() + 50, target.getY() + 50, target.getZ());
spawn.setAmount(1);
spawn.setHeading(target.getHeading());
spawn.stopRespawn();
@ -284,7 +282,6 @@ public class L2Event
player.setCurrentCp(player.getMaxCp());
}
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();

View File

@ -2239,9 +2239,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
spawn.setInstanceId(instance);
spawn.setHeading(heading);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.stopRespawn();
final L2Npc npc = spawn.doSpawn(isSummonSpawn);

View File

@ -24,24 +24,6 @@ import com.l2jmobius.gameserver.model.Location;
*/
public interface IPositionable extends ILocational
{
/**
* Sets the X coordinate of this object.
* @param x the new X coordinate
*/
void setX(int x);
/**
* Sets the Y coordinate of this object.
* @param y the new Y coordinate
*/
void setY(int y);
/**
* Sets the Z coordinate of this object.
* @param z the new Z coordinate
*/
void setZ(int z);
/**
* Sets all three coordinates of this object.
* @param x the new X coordinate

View File

@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.SpawnItem;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
public class RequestRecordInfo implements IClientIncomingPacket
@ -46,27 +45,20 @@ public class RequestRecordInfo implements IClientIncomingPacket
L2World.getInstance().forEachVisibleObject(activeChar, L2Object.class, object ->
{
if (object.getPoly().isMorphed() && object.getPoly().getPolyType().equals("item"))
if (object.isVisibleFor(activeChar))
{
client.sendPacket(new SpawnItem(object));
}
else
{
if (object.isVisibleFor(activeChar))
object.sendInfo(activeChar);
if (object.isCharacter())
{
object.sendInfo(activeChar);
if (object.isCharacter())
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
obj.getAI().describeStateToPlayer(activeChar);
}
obj.getAI().describeStateToPlayer(activeChar);
}
}
}

View File

@ -34,13 +34,6 @@ public class DropItem implements IClientOutgoingPacket
{
_item = item;
_charObjId = playerObjId;
// Future test.
if ((_item.getX() == 0) && (_item.getY() == 0))
{
LOGGER.warning("DropItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check SpawnItem, just in case.
}
}
@Override

View File

@ -17,45 +17,16 @@
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.network.OutgoingPackets;
public final class SpawnItem implements IClientOutgoingPacket
{
private final int _objectId;
private int _itemId;
private final int _x, _y, _z;
private int _stackable;
private long _count;
private final L2ItemInstance _item;
public SpawnItem(L2Object obj)
public SpawnItem(L2ItemInstance item)
{
_objectId = obj.getObjectId();
_x = obj.getX();
_y = obj.getY();
_z = obj.getZ();
// Future test.
if ((_x == 0) && (_y == 0))
{
LOGGER.warning("SpawnItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check DropItem, just in case.
}
if (obj.isItem())
{
final L2ItemInstance item = (L2ItemInstance) obj;
_itemId = item.getDisplayId();
_stackable = item.isStackable() ? 0x01 : 0x00;
_count = item.getCount();
}
else
{
_itemId = obj.getPoly().getPolyId();
_stackable = 0;
_count = 1;
}
_item = item;
}
@Override
@ -63,15 +34,14 @@ public final class SpawnItem implements IClientOutgoingPacket
{
OutgoingPackets.SPAWN_ITEM.writeId(packet);
packet.writeD(_objectId);
packet.writeD(_itemId);
packet.writeD(_x);
packet.writeD(_y);
packet.writeD(_z);
packet.writeD(_item.getObjectId());
packet.writeD(_item.getDisplayId());
packet.writeD(_item.getX());
packet.writeD(_item.getY());
packet.writeD(_item.getZ());
// only show item count if it is a stackable item
packet.writeD(_stackable);
packet.writeQ(_count);
packet.writeD(_item.isStackable() ? 0x01 : 0x00);
packet.writeQ(_item.getCount());
packet.writeD(0x00); // c2
return true;
}

View File

@ -122,6 +122,7 @@ Others:
-Reworked quest system
-Reworked spawn system
-Reworked drop system
-Reworked L2World, L2WorldRegion and L2Object
-Skill system from L2jUnity
-GeoEngine from aCis

View File

@ -163,10 +163,6 @@
<admin command="admin_para_all_menu" accessLevel="100" />
<admin command="admin_unpara_menu" accessLevel="100" />
<admin command="admin_para_menu" accessLevel="100" />
<admin command="admin_polyself" accessLevel="100" />
<admin command="admin_unpolyself" accessLevel="100" />
<admin command="admin_polyself_menu" accessLevel="100" />
<admin command="admin_unpolyself_menu" accessLevel="100" />
<admin command="admin_clearteams" accessLevel="100" />
<admin command="admin_setteam_close" accessLevel="100" />
<admin command="admin_setteam" accessLevel="100" />
@ -237,8 +233,6 @@
<admin command="admin_event_name" accessLevel="100" />
<admin command="admin_event_control_kill" accessLevel="100" />
<admin command="admin_event_control_res" accessLevel="100" />
<admin command="admin_event_control_poly" accessLevel="100" />
<admin command="admin_event_control_unpoly" accessLevel="100" />
<admin command="admin_event_control_transform" accessLevel="100" />
<admin command="admin_event_control_untransform" accessLevel="100" />
<admin command="admin_event_control_prize" accessLevel="100" />
@ -435,9 +429,7 @@
<!-- ADMIN PLEDGE -->
<admin command="admin_pledge" accessLevel="100" />
<!-- ADMIN POLYMORPH -->
<admin command="admin_polymorph" accessLevel="100" />
<admin command="admin_unpolymorph" accessLevel="100" />
<!-- ADMIN TRANSFORM -->
<admin command="admin_transform" accessLevel="100" />
<admin command="admin_untransform" accessLevel="100" />
<admin command="admin_transform_menu" accessLevel="100" />

View File

@ -16,12 +16,6 @@
Character Based:<br1>
<table width=270>
<tr>
<td><button value="PolyMorph" action="bypass -h admin_polymorph_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Poly" action="bypass -h admin_unpolymorph_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Poly Self" action="bypass -h admin_polyself_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="UnPolySlf" action="bypass -h admin_unpolyself_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
<tr>
<td><button value="Para" action="bypass -h admin_para_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Para" action="bypass -h admin_unpara_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Para All" action="bypass -h admin_para_all_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>

View File

@ -136,7 +136,7 @@ public final class TeredorWarzone extends AbstractInstance
}
case "TEREDOR_LAIR_CHECK":
{
final Location spawnLoc = npc.getSpawn().getLocation();
final Location spawnLoc = npc.getSpawn();
if (((spawnLoc.getX() - npc.getX()) > 1000) || ((spawnLoc.getX() - npc.getX()) < -2000))
{

View File

@ -112,7 +112,6 @@ import handlers.admincommandhandlers.AdminPcCafePoints;
import handlers.admincommandhandlers.AdminPcCondOverride;
import handlers.admincommandhandlers.AdminPetition;
import handlers.admincommandhandlers.AdminPledge;
import handlers.admincommandhandlers.AdminPolymorph;
import handlers.admincommandhandlers.AdminPremium;
import handlers.admincommandhandlers.AdminPrimePoints;
import handlers.admincommandhandlers.AdminPunishment;
@ -134,6 +133,7 @@ import handlers.admincommandhandlers.AdminTarget;
import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
import handlers.admincommandhandlers.AdminTest;
import handlers.admincommandhandlers.AdminTransform;
import handlers.admincommandhandlers.AdminUnblockIp;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
@ -447,7 +447,6 @@ public class MasterHandler
AdminPForge.class,
AdminPledge.class,
AdminZones.class,
AdminPolymorph.class,
AdminPremium.class,
AdminPrimePoints.class,
AdminPunishment.class,
@ -469,6 +468,7 @@ public class MasterHandler
AdminTargetSay.class,
AdminTeleport.class,
AdminTest.class,
AdminTransform.class,
AdminUnblockIp.class,
AdminVitality.class,
AdminZone.class,

View File

@ -58,7 +58,6 @@ import com.l2jmobius.gameserver.util.Util;
* <li>gmspeed = temporary Super Haste effect.
* <li>para/unpara = paralyze/remove paralysis from target
* <li>para_all/unpara_all = same as para/unpara, affects the whole world.
* <li>polyself/unpolyself = makes you look as a specified mob.
* <li>changename = temporary change name
* <li>clearteams/setteam_close/setteam = team related commands
* <li>social = forces an L2Character instance to broadcast social action packets.
@ -89,10 +88,6 @@ public class AdminEffects implements IAdminCommandHandler
"admin_para_all_menu",
"admin_unpara_menu",
"admin_para_menu",
"admin_polyself",
"admin_unpolyself",
"admin_polyself_menu",
"admin_unpolyself_menu",
"admin_clearteams",
"admin_setteam_close",
"admin_setteam",
@ -369,25 +364,6 @@ public class AdminEffects implements IAdminCommandHandler
{
}
}
else if (command.startsWith("admin_polyself"))
{
try
{
final String id = st.nextToken();
activeChar.getPoly().setPolyInfo("npc", id);
activeChar.teleToLocation(activeChar.getLocation());
activeChar.broadcastUserInfo();
}
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polyself <npcId>");
}
}
else if (command.startsWith("admin_unpolyself"))
{
activeChar.getPoly().setPolyInfo(null, "1");
activeChar.broadcastUserInfo();
}
else if (command.equals("admin_clearteams"))
{
L2World.getInstance().forEachVisibleObject(activeChar, L2PcInstance.class, player ->

View File

@ -65,8 +65,6 @@ public class AdminEventEngine implements IAdminCommandHandler
"admin_event_name",
"admin_event_control_kill",
"admin_event_control_res",
"admin_event_control_poly",
"admin_event_control_unpoly",
"admin_event_control_transform",
"admin_event_control_untransform",
"admin_event_control_prize",
@ -305,38 +303,6 @@ public class AdminEventEngine implements IAdminCommandHandler
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_poly"))
{
final int teamId = Integer.parseInt(st.nextToken());
final String[] polyIds = new String[st.countTokens()];
int i = 0;
while (st.hasMoreElements()) // Every next ST should be a polymorph ID
{
polyIds[i++] = st.nextToken();
}
for (L2PcInstance player : L2Event._teams.get(teamId))
{
player.getPoly().setPolyInfo("npc", polyIds[Rnd.get(polyIds.length)]);
player.teleToLocation(player.getLocation(), true);
player.broadcastUserInfo();
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_unpoly"))
{
while (st.hasMoreElements()) // Every next ST should be a team number
{
for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
{
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();
}
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_transform"))
{
final int teamId = Integer.parseInt(st.nextToken());
@ -557,7 +523,7 @@ public class AdminEventEngine implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
final StringBuilder sb = new StringBuilder();
sb.append("<html><title>[ L2J EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append("<html><title>[ EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append(L2Event._eventName);
sb.append("</font></center><br><table cellspacing=-1 width=280><tr><td align=center>Type the team ID(s) that will be affected by the commands. Commands with '*' work with only 1 team ID in the field, while '!' - none.</td></tr><tr><td align=center><edit var=\"team_number\" width=100 height=15></td></tr>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><table width=200>");
@ -566,7 +532,7 @@ public class AdminEventEngine implements IAdminCommandHandler
sb.append("<tr><td><button value=\"Start!\" action=\"bypass -h admin_event_control_begin\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>");
}
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Polymorph*\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"poly_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Polymorphs the team into the NPC with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
adminReply.setHtml(sb.toString());
activeChar.sendPacket(adminReply);

View File

@ -482,9 +482,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(target.getX());
spawn.setY(target.getY());
spawn.setZ(target.getZ());
spawn.setXYZ(target);
spawn.setAmount(mobCount);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -530,9 +528,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setAmount(1);
spawn.setHeading(h);
spawn.setRespawnDelay(60);

View File

@ -546,9 +546,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
spawn = new L2Spawn(template1);
spawn.setX(activeChar.getX());
spawn.setY(activeChar.getY());
spawn.setZ(activeChar.getZ());
spawn.setXYZ(activeChar);
spawn.setAmount(1);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -583,9 +581,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
final L2Spawn spawnDat = new L2Spawn(target.getId());
spawnDat.setX(activeChar.getX());
spawnDat.setY(activeChar.getY());
spawnDat.setZ(activeChar.getZ());
spawnDat.setXYZ(activeChar);
spawnDat.setAmount(1);
spawnDat.setHeading(activeChar.getHeading());
spawnDat.setRespawnMinDelay(43200);

View File

@ -1,198 +1,121 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jmobius.gameserver.network.serverpackets.SetupGauge;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* Polymorph admin command implementation.
* @author Zoey76
*/
public class AdminPolymorph implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_polymorph",
"admin_unpolymorph",
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
if (command.startsWith("admin_polymorph"))
{
final String[] parts = command.split(" ");
if ((parts.length < 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polymorph [type] <id>");
return false;
}
if (parts.length > 2)
{
doPolymorph(activeChar, activeChar.getTarget(), parts[2], parts[1]);
}
else
{
doPolymorph(activeChar, activeChar.getTarget(), parts[1], "npc");
}
}
else if (command.equals("admin_unpolymorph"))
{
doUnPolymorph(activeChar, activeChar.getTarget());
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
/**
* Polymorph a creature.
* @param activeChar the active Game Master
* @param obj the target
* @param id the polymorph ID
* @param type the polymorph type
*/
private static void doPolymorph(L2PcInstance activeChar, L2Object obj, String id, String type)
{
if (obj != null)
{
obj.getPoly().setPolyInfo(type, id);
// animation
if (obj.isCharacter())
{
final L2Character Char = (L2Character) obj;
final MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0);
Char.broadcastPacket(msk);
final SetupGauge sg = new SetupGauge(activeChar.getObjectId(), 0, 4000);
Char.sendPacket(sg);
}
// end of animation
obj.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Polymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
/**
* Unpolymorh a creature.
* @param activeChar the active Game Master
* @param target the target
*/
private static void doUnPolymorph(L2PcInstance activeChar, L2Object target)
{
if (target != null)
{
target.getPoly().setPolyInfo(null, "1");
target.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Unpolymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* @author Mobius
*/
public class AdminTransform implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}

View File

@ -166,9 +166,7 @@ public final class SummonNpc extends AbstractEffect
return;
}
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setHeading(player.getHeading());
spawn.stopRespawn();

View File

@ -236,7 +236,7 @@ public class L2AttackableAI extends L2CharacterAI
}
else if (npc.getSpawn() != null)
{
final Location loc = npc.getSpawn().getLocation();
final Location loc = npc.getSpawn();
final int range = Config.MAX_DRIFT_RANGE;
if (!npc.isInsideRadius3D(loc, range + range))

View File

@ -95,9 +95,7 @@ public class DBSpawnManager
if (template != null)
{
final L2Spawn spawn = new L2Spawn(template);
spawn.setX(rset.getInt("x"));
spawn.setY(rset.getInt("y"));
spawn.setZ(rset.getInt("z"));
spawn.setXYZ(rset.getInt("x"), rset.getInt("y"), rset.getInt("z"));
spawn.setAmount(1);
spawn.setHeading(rset.getInt("heading"));

View File

@ -261,9 +261,7 @@ public final class SiegeGuardManager
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@ -18,7 +18,6 @@ package com.l2jmobius.gameserver.model;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.l2jmobius.gameserver.enums.InstanceType;
import com.l2jmobius.gameserver.handler.ActionHandler;
@ -29,7 +28,6 @@ import com.l2jmobius.gameserver.idfactory.IdFactory;
import com.l2jmobius.gameserver.instancemanager.InstanceManager;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.model.actor.poly.ObjectPoly;
import com.l2jmobius.gameserver.model.events.ListenersContainer;
import com.l2jmobius.gameserver.model.instancezone.Instance;
import com.l2jmobius.gameserver.model.interfaces.IDecayable;
@ -58,18 +56,18 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
/** World Region */
private L2WorldRegion _worldRegion;
/** Instance type */
private InstanceType _instanceType = null;
private InstanceType _instanceType;
private volatile Map<String, Object> _scripts;
/** X coordinate */
private final AtomicInteger _x = new AtomicInteger(0);
private volatile int _x = 0;
/** Y coordinate */
private final AtomicInteger _y = new AtomicInteger(0);
private volatile int _y = 0;
/** Z coordinate */
private final AtomicInteger _z = new AtomicInteger(0);
private volatile int _z = 0;
/** Orientation */
private final AtomicInteger _heading = new AtomicInteger(0);
private volatile int _heading = 0;
/** Instance id of object. 0 - Global */
private Instance _instance = null;
private Instance _instance;
private boolean _isSpawned;
private boolean _isInvisible;
private boolean _isTargetable = true;
@ -253,12 +251,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
return _objectId;
}
public final ObjectPoly getPoly()
{
final ObjectPoly poly = getScript(ObjectPoly.class);
return (poly == null) ? addScript(new ObjectPoly(this)) : poly;
}
public abstract void sendInfo(L2PcInstance activeChar);
public void sendPacket(IClientOutgoingPacket... packets)
@ -546,7 +538,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getX()
{
return _x.get();
return _x;
}
/**
@ -556,7 +548,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getY()
{
return _y.get();
return _y;
}
/**
@ -566,7 +558,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getZ()
{
return _z.get();
return _z;
}
/**
@ -576,7 +568,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public int getHeading()
{
return _heading.get();
return _heading;
}
/**
@ -614,37 +606,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public Location getLocation()
{
return new Location(_x.get(), _y.get(), _z.get(), _heading.get());
}
/**
* Sets the X coordinate
* @param newX the X coordinate
*/
@Override
public void setX(int newX)
{
_x.set(newX);
}
/**
* Sets the Y coordinate
* @param newY the Y coordinate
*/
@Override
public void setY(int newY)
{
_y.set(newY);
}
/**
* Sets the Z coordinate
* @param newZ the Z coordinate
*/
@Override
public void setZ(int newZ)
{
_z.set(newZ);
return new Location(_x, _y, _z, _heading);
}
/**
@ -656,9 +618,9 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setXYZ(int newX, int newY, int newZ)
{
setX(newX);
setY(newY);
setZ(newZ);
_x = newX;
_y = newY;
_z = newZ;
if (_isSpawned)
{
@ -693,7 +655,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setHeading(int newHeading)
{
_heading.set(newHeading);
_heading = newHeading;
}
/**
@ -745,10 +707,10 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
@Override
public void setLocation(Location loc)
{
_x.set(loc.getX());
_y.set(loc.getY());
_z.set(loc.getZ());
_heading.set(loc.getHeading());
_x = loc.getX();
_y = loc.getY();
_z = loc.getZ();
_heading = loc.getHeading();
}
/**
@ -760,7 +722,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance2D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2));
}
/**
@ -782,7 +744,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistance3D(int x, int y, int z)
{
return Math.sqrt(Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2));
return Math.sqrt(Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2));
}
/**
@ -804,7 +766,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq2D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2);
}
/**
@ -826,7 +788,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDistanceSq3D(int x, int y, int z)
{
return Math.pow(x - _x.get(), 2) + Math.pow(y - _y.get(), 2) + Math.pow(z - _z.get(), 2);
return Math.pow(x - _x, 2) + Math.pow(y - _y, 2) + Math.pow(z - _z, 2);
}
/**
@ -848,7 +810,7 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
*/
public double calculateDirectionTo(ILocational target)
{
int heading = Util.calculateHeadingFrom(this, target) - _heading.get();
int heading = Util.calculateHeadingFrom(this, target) - _heading;
if (heading < 0)
{
heading = 65535 + heading;

View File

@ -32,9 +32,7 @@ import com.l2jmobius.gameserver.model.actor.L2Npc;
import com.l2jmobius.gameserver.model.actor.instance.L2MonsterInstance;
import com.l2jmobius.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jmobius.gameserver.model.interfaces.IIdentifiable;
import com.l2jmobius.gameserver.model.interfaces.ILocational;
import com.l2jmobius.gameserver.model.interfaces.INamable;
import com.l2jmobius.gameserver.model.interfaces.IPositionable;
import com.l2jmobius.gameserver.model.spawns.NpcSpawnTemplate;
import com.l2jmobius.gameserver.model.zone.ZoneId;
@ -45,7 +43,7 @@ import com.l2jmobius.gameserver.model.zone.ZoneId;
* The heading of the L2NpcInstance can be a random heading if not defined (value= -1) or an exact heading (ex : merchant...).
* @author Nightmare
*/
public class L2Spawn implements IPositionable, IIdentifiable, INamable
public class L2Spawn extends Location implements IIdentifiable, INamable
{
protected static final Logger LOGGER = Logger.getLogger(L2Spawn.class.getName());
@ -59,10 +57,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
private int _currentCount;
/** The current number of SpawnTask in progress or stand by of this L2Spawn */
protected int _scheduledCount;
/** The identifier of the location area where L2NpcInstance can be spwaned */
/** The identifier of the location area where L2NpcInstance can be spawned */
private int _locationId;
/** The Location of this NPC spawn. */
private Location _location = new Location(0, 0, 0, 0);
/** The spawn instance id */
private int _instanceId = 0;
/** Minimum respawn delay */
private int _respawnMinDelay;
@ -121,6 +118,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
*/
public L2Spawn(L2NpcTemplate template) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, 0);
// Set the _template of the L2Spawn
_template = template;
@ -145,6 +143,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
*/
public L2Spawn(int npcId) throws SecurityException, ClassNotFoundException, NoSuchMethodException, ClassCastException
{
super(0, 0, 0);
_template = Objects.requireNonNull(NpcData.getInstance().getTemplate(npcId), "NpcTemplate not found for NPC ID: " + npcId);
final String className = "com.l2jmobius.gameserver.model.actor.instance." + _template.getType() + "Instance";
@ -187,122 +186,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
return _locationId;
}
@Override
public Location getLocation()
{
return _location;
}
/**
* @return the X position of the spawn point.
*/
@Override
public int getX()
{
return _location.getX();
}
/**
* Set the X position of the spawn point.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_location.setX(x);
}
/**
* @return the Y position of the spawn point.
*/
@Override
public int getY()
{
return _location.getY();
}
/**
* Set the Y position of the spawn point.
* @param y the y coordinate
*/
@Override
public void setY(int y)
{
_location.setY(y);
}
/**
* @return the Z position of the spawn point.
*/
@Override
public int getZ()
{
return _location.getZ();
}
/**
* Set the Z position of the spawn point.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_location.setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param x The x coordinate.
* @param y The y coordinate.
* @param z The z coordinate.
*/
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
}
/**
* Set the x, y, z position of the spawn point.
* @param loc The location.
*/
@Override
public void setXYZ(ILocational loc)
{
setXYZ(loc.getX(), loc.getY(), loc.getZ());
}
/**
* @return the heading of L2NpcInstance when they are spawned.
*/
@Override
public int getHeading()
{
return _location.getHeading();
}
/**
* Set the heading of L2NpcInstance when they are spawned.
* @param heading
*/
@Override
public void setHeading(int heading)
{
_location.setHeading(heading);
}
/**
* Set the XYZ position of the spawn point.
* @param loc
*/
@Override
public void setLocation(Location loc)
{
_location = loc;
}
/**
* Gets the NPC ID.
* @return the NPC ID
@ -511,7 +394,7 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
newlocz = loc.getZ();
setLocation(loc);
}
else if ((_location.getX() == 0) && (_location.getY() == 0))
else if ((getX() == 0) && (getY() == 0))
{
LOGGER.warning("NPC " + npc + " doesn't have spawn location!");
return null;
@ -519,9 +402,9 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
else
{
// The L2NpcInstance is spawned at the exact position (Lox, Locy, Locz)
newlocx = _location.getX();
newlocy = _location.getY();
newlocz = _location.getZ();
newlocx = getX();
newlocy = getY();
newlocz = getZ();
}
// If random spawn system is enabled
@ -541,13 +424,13 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
npc.setRandomWalking(_randomWalk);
// Set the heading of the L2NpcInstance (random heading if not defined)
if (_location.getHeading() == -1)
if (getHeading() == -1)
{
npc.setHeading(Rnd.nextInt(61794));
}
else
{
npc.setHeading(_location.getHeading());
npc.setHeading(getHeading());
}
// Set custom Npc server side name and title
@ -666,12 +549,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
_instanceId = instanceId;
}
@Override
public String toString()
{
return "L2Spawn ID: " + _template.getId() + " " + _location;
}
public final boolean getRandomWalking()
{
return _randomWalk;
@ -691,4 +568,10 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
{
return _spawnTemplate;
}
@Override
public String toString()
{
return "L2Spawn ID: " + _template.getId() + " X: " + getX() + " Y: " + getY() + " Z: " + getZ() + " Heading: " + getHeading();
}
}

View File

@ -67,16 +67,6 @@ public class Location implements IPositionable
return _x;
}
/**
* Set the x coordinate.
* @param x the x coordinate
*/
@Override
public void setX(int x)
{
_x = x;
}
/**
* Get the y coordinate.
* @return the y coordinate
@ -87,16 +77,6 @@ public class Location implements IPositionable
return _y;
}
/**
* Set the y coordinate.
* @param y the x coordinate
*/
@Override
public void setY(int y)
{
_y = y;
}
/**
* Get the z coordinate.
* @return the z coordinate
@ -107,16 +87,6 @@ public class Location implements IPositionable
return _z;
}
/**
* Set the z coordinate.
* @param z the z coordinate
*/
@Override
public void setZ(int z)
{
_z = z;
}
/**
* Set the x, y, z coordinates.
* @param x the x coordinate
@ -126,9 +96,9 @@ public class Location implements IPositionable
@Override
public void setXYZ(int x, int y, int z)
{
setX(x);
setY(y);
setZ(z);
_x = x;
_y = y;
_z = z;
}
/**

View File

@ -152,9 +152,7 @@ public final class MobGroup
final int randX = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
final int randY = Rnd.nextInt(MobGroupTable.RANDOM_RANGE);
spawn.setX(x + (signX * randX));
spawn.setY(y + (signY * randY));
spawn.setZ(z);
spawn.setXYZ(x + (signX * randX), y + (signY * randY), z);
spawn.stopRespawn();
SpawnTable.getInstance().addNewSpawn(spawn, false);

View File

@ -1,67 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.gameserver.model.actor.poly;
import com.l2jmobius.gameserver.model.L2Object;
public class ObjectPoly
{
private final L2Object _activeObject;
private int _polyId;
private String _polyType;
public ObjectPoly(L2Object activeObject)
{
_activeObject = activeObject;
}
public void setPolyInfo(String polyType, String polyId)
{
setPolyId(Integer.parseInt(polyId));
setPolyType(polyType);
}
public final L2Object getActiveObject()
{
return _activeObject;
}
public final boolean isMorphed()
{
return _polyType != null;
}
public final int getPolyId()
{
return _polyId;
}
public final void setPolyId(int value)
{
_polyId = value;
}
public final String getPolyType()
{
return _polyType;
}
public final void setPolyType(String value)
{
_polyType = value;
}
}

View File

@ -258,7 +258,7 @@ public final class Transform implements IIdentifiable
}
// Get player a bit higher so he doesn't drops underground after transformation happens
creature.setZ(creature.getZ() + (int) getCollisionHeight(creature, 0));
creature.setXYZ(creature.getX(), creature.getY(), (int) (creature.getZ() + getCollisionHeight(creature, 0)));
if (creature.isPlayer())
{

View File

@ -482,9 +482,7 @@ public final class BlockCheckerEngine
for (int i = 0; i < _numOfBoxes; i++)
{
final L2Spawn spawn = new L2Spawn(template);
spawn.setX(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400));
spawn.setY(_arenaCoordinates[_arena][5] + Rnd.get(-400, 400));
spawn.setZ(_zCoord);
spawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
spawn.setAmount(1);
spawn.setHeading(1);
spawn.setRespawnDelay(1);
@ -517,9 +515,7 @@ public final class BlockCheckerEngine
try
{
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);
girlSpawn.setXYZ(_arenaCoordinates[_arena][4] + Rnd.get(-400, 400), _arenaCoordinates[_arena][5] + Rnd.get(-400, 400), _zCoord);
girlSpawn.setAmount(1);
girlSpawn.setHeading(1);
girlSpawn.setRespawnDelay(1);

View File

@ -1188,9 +1188,7 @@ public final class Castle extends AbstractResidence
LOGGER.warning(Castle.class.getSimpleName() + ": " + e.getMessage());
return;
}
spawn.setX(holder.getX());
spawn.setY(holder.getY());
spawn.setZ(holder.getZ());
spawn.setXYZ(holder);
spawn.setHeading(holder.getHeading());
final L2Npc npc = spawn.doSpawn(false);
npc.broadcastInfo();

View File

@ -1141,9 +1141,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
SpawnTable.getInstance().addNewSpawn(spawnDat, false);
@ -1172,9 +1170,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_siegeNpcs.add(spawnDat);
@ -1201,9 +1197,7 @@ public final class Fort extends AbstractResidence
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_npcCommanders.add(spawnDat);
@ -1235,9 +1229,7 @@ public final class Fort extends AbstractResidence
final int npcId = rs.getInt("npcId");
final L2Spawn spawnDat = new L2Spawn(npcId);
spawnDat.setAmount(1);
spawnDat.setX(rs.getInt("x"));
spawnDat.setY(rs.getInt("y"));
spawnDat.setZ(rs.getInt("z"));
spawnDat.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawnDat.setHeading(rs.getInt("heading"));
spawnDat.setRespawnDelay(60);
_specialEnvoys.add(spawnDat);

View File

@ -1107,9 +1107,7 @@ public class FortSiege implements Siegable
{
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.setXYZ(_sp.getLocation());
spawnDat.setHeading(_sp.getLocation().getHeading());
spawnDat.setRespawnDelay(60);
spawnDat.doSpawn();
@ -1159,9 +1157,7 @@ public class FortSiege implements Siegable
{
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.setXYZ(rs.getInt("x"), rs.getInt("y"), rs.getInt("z"));
spawn.setHeading(rs.getInt("heading"));
spawn.setRespawnDelay(rs.getInt("respawnDelay"));
spawn.setLocationId(0);

View File

@ -165,9 +165,7 @@ public class L2Event
try
{
final L2Spawn spawn = new L2Spawn(_npcId);
spawn.setX(target.getX() + 50);
spawn.setY(target.getY() + 50);
spawn.setZ(target.getZ());
spawn.setXYZ(target.getX() + 50, target.getY() + 50, target.getZ());
spawn.setAmount(1);
spawn.setHeading(target.getHeading());
spawn.stopRespawn();
@ -284,7 +282,6 @@ public class L2Event
player.setCurrentCp(player.getMaxCp());
}
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();

View File

@ -2240,9 +2240,7 @@ public abstract class AbstractScript extends ManagedScript implements IEventTime
spawn.setInstanceId(instance);
spawn.setHeading(heading);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.stopRespawn();
final L2Npc npc = spawn.doSpawn(isSummonSpawn);

View File

@ -24,24 +24,6 @@ import com.l2jmobius.gameserver.model.Location;
*/
public interface IPositionable extends ILocational
{
/**
* Sets the X coordinate of this object.
* @param x the new X coordinate
*/
void setX(int x);
/**
* Sets the Y coordinate of this object.
* @param y the new Y coordinate
*/
void setY(int y);
/**
* Sets the Z coordinate of this object.
* @param z the new Z coordinate
*/
void setZ(int z);
/**
* Sets all three coordinates of this object.
* @param x the new X coordinate

View File

@ -22,7 +22,6 @@ import com.l2jmobius.gameserver.model.L2World;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.L2GameClient;
import com.l2jmobius.gameserver.network.serverpackets.SpawnItem;
import com.l2jmobius.gameserver.network.serverpackets.UserInfo;
public class RequestRecordInfo implements IClientIncomingPacket
@ -46,27 +45,20 @@ public class RequestRecordInfo implements IClientIncomingPacket
L2World.getInstance().forEachVisibleObject(activeChar, L2Object.class, object ->
{
if (object.getPoly().isMorphed() && object.getPoly().getPolyType().equals("item"))
if (object.isVisibleFor(activeChar))
{
client.sendPacket(new SpawnItem(object));
}
else
{
if (object.isVisibleFor(activeChar))
object.sendInfo(activeChar);
if (object.isCharacter())
{
object.sendInfo(activeChar);
if (object.isCharacter())
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
// Update the state of the L2Character object client
// side by sending Server->Client packet
// MoveToPawn/CharMoveToLocation and AutoAttackStart to
// the L2PcInstance
final L2Character obj = (L2Character) object;
if (obj.getAI() != null)
{
obj.getAI().describeStateToPlayer(activeChar);
}
obj.getAI().describeStateToPlayer(activeChar);
}
}
}

View File

@ -34,13 +34,6 @@ public class DropItem implements IClientOutgoingPacket
{
_item = item;
_charObjId = playerObjId;
// Future test.
if ((_item.getX() == 0) && (_item.getY() == 0))
{
LOGGER.warning("DropItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check SpawnItem, just in case.
}
}
@Override

View File

@ -17,45 +17,16 @@
package com.l2jmobius.gameserver.network.serverpackets;
import com.l2jmobius.commons.network.PacketWriter;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.items.instance.L2ItemInstance;
import com.l2jmobius.gameserver.network.OutgoingPackets;
public final class SpawnItem implements IClientOutgoingPacket
{
private final int _objectId;
private int _itemId;
private final int _x, _y, _z;
private int _stackable;
private long _count;
private final L2ItemInstance _item;
public SpawnItem(L2Object obj)
public SpawnItem(L2ItemInstance item)
{
_objectId = obj.getObjectId();
_x = obj.getX();
_y = obj.getY();
_z = obj.getZ();
// Future test.
if ((_x == 0) && (_y == 0))
{
LOGGER.warning("SpawnItem with x=0 and y=0.");
Thread.dumpStack(); // Why? Also check DropItem, just in case.
}
if (obj.isItem())
{
final L2ItemInstance item = (L2ItemInstance) obj;
_itemId = item.getDisplayId();
_stackable = item.isStackable() ? 0x01 : 0x00;
_count = item.getCount();
}
else
{
_itemId = obj.getPoly().getPolyId();
_stackable = 0;
_count = 1;
}
_item = item;
}
@Override
@ -63,15 +34,14 @@ public final class SpawnItem implements IClientOutgoingPacket
{
OutgoingPackets.SPAWN_ITEM.writeId(packet);
packet.writeD(_objectId);
packet.writeD(_itemId);
packet.writeD(_x);
packet.writeD(_y);
packet.writeD(_z);
packet.writeD(_item.getObjectId());
packet.writeD(_item.getDisplayId());
packet.writeD(_item.getX());
packet.writeD(_item.getY());
packet.writeD(_item.getZ());
// only show item count if it is a stackable item
packet.writeD(_stackable);
packet.writeQ(_count);
packet.writeD(_item.isStackable() ? 0x01 : 0x00);
packet.writeQ(_item.getCount());
packet.writeD(0x00); // c2
return true;
}

View File

@ -131,6 +131,7 @@ Others:
-Reworked quest system
-Reworked spawn system
-Reworked drop system
-Reworked L2World, L2WorldRegion and L2Object
-Skill system from L2jUnity
-GeoEngine from aCis

View File

@ -163,10 +163,6 @@
<admin command="admin_para_all_menu" accessLevel="100" />
<admin command="admin_unpara_menu" accessLevel="100" />
<admin command="admin_para_menu" accessLevel="100" />
<admin command="admin_polyself" accessLevel="100" />
<admin command="admin_unpolyself" accessLevel="100" />
<admin command="admin_polyself_menu" accessLevel="100" />
<admin command="admin_unpolyself_menu" accessLevel="100" />
<admin command="admin_clearteams" accessLevel="100" />
<admin command="admin_setteam_close" accessLevel="100" />
<admin command="admin_setteam" accessLevel="100" />
@ -237,8 +233,6 @@
<admin command="admin_event_name" accessLevel="100" />
<admin command="admin_event_control_kill" accessLevel="100" />
<admin command="admin_event_control_res" accessLevel="100" />
<admin command="admin_event_control_poly" accessLevel="100" />
<admin command="admin_event_control_unpoly" accessLevel="100" />
<admin command="admin_event_control_transform" accessLevel="100" />
<admin command="admin_event_control_untransform" accessLevel="100" />
<admin command="admin_event_control_prize" accessLevel="100" />
@ -435,9 +429,7 @@
<!-- ADMIN PLEDGE -->
<admin command="admin_pledge" accessLevel="100" />
<!-- ADMIN POLYMORPH -->
<admin command="admin_polymorph" accessLevel="100" />
<admin command="admin_unpolymorph" accessLevel="100" />
<!-- ADMIN TRANSFORM -->
<admin command="admin_transform" accessLevel="100" />
<admin command="admin_untransform" accessLevel="100" />
<admin command="admin_transform_menu" accessLevel="100" />

View File

@ -16,12 +16,6 @@
Character Based:<br1>
<table width=270>
<tr>
<td><button value="PolyMorph" action="bypass -h admin_polymorph_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Poly" action="bypass -h admin_unpolymorph_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Poly Self" action="bypass -h admin_polyself_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="UnPolySlf" action="bypass -h admin_unpolyself_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
</tr>
<tr>
<td><button value="Para" action="bypass -h admin_para_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Un Para" action="bypass -h admin_unpara_menu $qbox" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>
<td><button value="Para All" action="bypass -h admin_para_all_menu" width=65 height=21 back="L2UI_CT1.Button_DF_Down" fore="L2UI_CT1.Button_DF"></td>

View File

@ -136,7 +136,7 @@ public final class TeredorWarzone extends AbstractInstance
}
case "TEREDOR_LAIR_CHECK":
{
final Location spawnLoc = npc.getSpawn().getLocation();
final Location spawnLoc = npc.getSpawn();
if (((spawnLoc.getX() - npc.getX()) > 1000) || ((spawnLoc.getX() - npc.getX()) < -2000))
{

View File

@ -112,7 +112,6 @@ import handlers.admincommandhandlers.AdminPcCafePoints;
import handlers.admincommandhandlers.AdminPcCondOverride;
import handlers.admincommandhandlers.AdminPetition;
import handlers.admincommandhandlers.AdminPledge;
import handlers.admincommandhandlers.AdminPolymorph;
import handlers.admincommandhandlers.AdminPremium;
import handlers.admincommandhandlers.AdminPrimePoints;
import handlers.admincommandhandlers.AdminPunishment;
@ -134,6 +133,7 @@ import handlers.admincommandhandlers.AdminTarget;
import handlers.admincommandhandlers.AdminTargetSay;
import handlers.admincommandhandlers.AdminTeleport;
import handlers.admincommandhandlers.AdminTest;
import handlers.admincommandhandlers.AdminTransform;
import handlers.admincommandhandlers.AdminUnblockIp;
import handlers.admincommandhandlers.AdminVitality;
import handlers.admincommandhandlers.AdminZone;
@ -447,7 +447,6 @@ public class MasterHandler
AdminPForge.class,
AdminPledge.class,
AdminZones.class,
AdminPolymorph.class,
AdminPremium.class,
AdminPrimePoints.class,
AdminPunishment.class,
@ -469,6 +468,7 @@ public class MasterHandler
AdminTargetSay.class,
AdminTeleport.class,
AdminTest.class,
AdminTransform.class,
AdminUnblockIp.class,
AdminVitality.class,
AdminZone.class,

View File

@ -58,7 +58,6 @@ import com.l2jmobius.gameserver.util.Util;
* <li>gmspeed = temporary Super Haste effect.
* <li>para/unpara = paralyze/remove paralysis from target
* <li>para_all/unpara_all = same as para/unpara, affects the whole world.
* <li>polyself/unpolyself = makes you look as a specified mob.
* <li>changename = temporary change name
* <li>clearteams/setteam_close/setteam = team related commands
* <li>social = forces an L2Character instance to broadcast social action packets.
@ -89,10 +88,6 @@ public class AdminEffects implements IAdminCommandHandler
"admin_para_all_menu",
"admin_unpara_menu",
"admin_para_menu",
"admin_polyself",
"admin_unpolyself",
"admin_polyself_menu",
"admin_unpolyself_menu",
"admin_clearteams",
"admin_setteam_close",
"admin_setteam",
@ -369,25 +364,6 @@ public class AdminEffects implements IAdminCommandHandler
{
}
}
else if (command.startsWith("admin_polyself"))
{
try
{
final String id = st.nextToken();
activeChar.getPoly().setPolyInfo("npc", id);
activeChar.teleToLocation(activeChar.getLocation());
activeChar.broadcastUserInfo();
}
catch (Exception e)
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polyself <npcId>");
}
}
else if (command.startsWith("admin_unpolyself"))
{
activeChar.getPoly().setPolyInfo(null, "1");
activeChar.broadcastUserInfo();
}
else if (command.equals("admin_clearteams"))
{
L2World.getInstance().forEachVisibleObject(activeChar, L2PcInstance.class, player ->

View File

@ -65,8 +65,6 @@ public class AdminEventEngine implements IAdminCommandHandler
"admin_event_name",
"admin_event_control_kill",
"admin_event_control_res",
"admin_event_control_poly",
"admin_event_control_unpoly",
"admin_event_control_transform",
"admin_event_control_untransform",
"admin_event_control_prize",
@ -305,38 +303,6 @@ public class AdminEventEngine implements IAdminCommandHandler
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_poly"))
{
final int teamId = Integer.parseInt(st.nextToken());
final String[] polyIds = new String[st.countTokens()];
int i = 0;
while (st.hasMoreElements()) // Every next ST should be a polymorph ID
{
polyIds[i++] = st.nextToken();
}
for (L2PcInstance player : L2Event._teams.get(teamId))
{
player.getPoly().setPolyInfo("npc", polyIds[Rnd.get(polyIds.length)]);
player.teleToLocation(player.getLocation(), true);
player.broadcastUserInfo();
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_unpoly"))
{
while (st.hasMoreElements()) // Every next ST should be a team number
{
for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
{
player.getPoly().setPolyInfo(null, "1");
player.decayMe();
player.spawnMe(player.getX(), player.getY(), player.getZ());
player.broadcastUserInfo();
}
}
showEventControl(activeChar);
}
else if (actualCommand.startsWith("admin_event_control_transform"))
{
final int teamId = Integer.parseInt(st.nextToken());
@ -557,7 +523,7 @@ public class AdminEventEngine implements IAdminCommandHandler
final NpcHtmlMessage adminReply = new NpcHtmlMessage(0, 1);
final StringBuilder sb = new StringBuilder();
sb.append("<html><title>[ L2J EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append("<html><title>[ EVENT ENGINE ]</title><body><br><center>Current event: <font color=\"LEVEL\">");
sb.append(L2Event._eventName);
sb.append("</font></center><br><table cellspacing=-1 width=280><tr><td align=center>Type the team ID(s) that will be affected by the commands. Commands with '*' work with only 1 team ID in the field, while '!' - none.</td></tr><tr><td align=center><edit var=\"team_number\" width=100 height=15></td></tr>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><table width=200>");
@ -566,7 +532,7 @@ public class AdminEventEngine implements IAdminCommandHandler
sb.append("<tr><td><button value=\"Start!\" action=\"bypass -h admin_event_control_begin\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>");
}
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Polymorph*\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"poly_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Polymorphs the team into the NPC with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
sb.append("<tr><td>&nbsp;</td></tr><tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Sit/Stand\" action=\"bypass -h admin_event_control_sit $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Transform*\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"transf_id\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Transforms the team into the transformation with the ID specified. Multiple IDs result in randomly chosen one for each player.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><table><tr><td width=32>Num</td><td><edit var=\"n\" width=60 height=15></td></tr><tr><td>ID</td><td><edit var=\"id\" width=60 height=15></td></tr></table></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><table cellspacing=-1><tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr><tr><td><edit var=\"player_name\" width=98 height=15></td></tr></table></td><td><font color=\"LEVEL\">Kicks the specified player(s) from the event. Blank field kicks target.</font></td></tr><tr><td>&nbsp;</td></tr><tr><td><button value=\"End!\" action=\"bypass -h admin_event_control_finish\" width=100 height=20 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr><tr><td>&nbsp;</td></tr></table></td></tr></table></body></html>");
adminReply.setHtml(sb.toString());
activeChar.sendPacket(adminReply);

View File

@ -482,9 +482,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(target.getX());
spawn.setY(target.getY());
spawn.setZ(target.getZ());
spawn.setXYZ(target);
spawn.setAmount(mobCount);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -530,9 +528,7 @@ public class AdminSpawn implements IAdminCommandHandler
try
{
final L2Spawn spawn = new L2Spawn(template1);
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setAmount(1);
spawn.setHeading(h);
spawn.setRespawnDelay(60);

View File

@ -546,9 +546,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
spawn = new L2Spawn(template1);
spawn.setX(activeChar.getX());
spawn.setY(activeChar.getY());
spawn.setZ(activeChar.getZ());
spawn.setXYZ(activeChar);
spawn.setAmount(1);
spawn.setHeading(activeChar.getHeading());
spawn.setRespawnDelay(respawnTime);
@ -583,9 +581,7 @@ public class AdminTeleport implements IAdminCommandHandler
try
{
final L2Spawn spawnDat = new L2Spawn(target.getId());
spawnDat.setX(activeChar.getX());
spawnDat.setY(activeChar.getY());
spawnDat.setZ(activeChar.getZ());
spawnDat.setXYZ(activeChar);
spawnDat.setAmount(1);
spawnDat.setHeading(activeChar.getHeading());
spawnDat.setRespawnMinDelay(43200);

View File

@ -1,198 +1,121 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse;
import com.l2jmobius.gameserver.network.serverpackets.SetupGauge;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* Polymorph admin command implementation.
* @author Zoey76
*/
public class AdminPolymorph implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_polymorph",
"admin_unpolymorph",
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
if (command.startsWith("admin_polymorph"))
{
final String[] parts = command.split(" ");
if ((parts.length < 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //polymorph [type] <id>");
return false;
}
if (parts.length > 2)
{
doPolymorph(activeChar, activeChar.getTarget(), parts[2], parts[1]);
}
else
{
doPolymorph(activeChar, activeChar.getTarget(), parts[1], "npc");
}
}
else if (command.equals("admin_unpolymorph"))
{
doUnPolymorph(activeChar, activeChar.getTarget());
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
/**
* Polymorph a creature.
* @param activeChar the active Game Master
* @param obj the target
* @param id the polymorph ID
* @param type the polymorph type
*/
private static void doPolymorph(L2PcInstance activeChar, L2Object obj, String id, String type)
{
if (obj != null)
{
obj.getPoly().setPolyInfo(type, id);
// animation
if (obj.isCharacter())
{
final L2Character Char = (L2Character) obj;
final MagicSkillUse msk = new MagicSkillUse(Char, 1008, 1, 4000, 0);
Char.broadcastPacket(msk);
final SetupGauge sg = new SetupGauge(activeChar.getObjectId(), 0, 4000);
Char.sendPacket(sg);
}
// end of animation
obj.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Polymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
/**
* Unpolymorh a creature.
* @param activeChar the active Game Master
* @param target the target
*/
private static void doUnPolymorph(L2PcInstance activeChar, L2Object target)
{
if (target != null)
{
target.getPoly().setPolyInfo(null, "1");
target.broadcastInfo();
BuilderUtil.sendSysMessage(activeChar, "Unpolymorph succeed");
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
}
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package handlers.admincommandhandlers;
import com.l2jmobius.gameserver.handler.IAdminCommandHandler;
import com.l2jmobius.gameserver.model.L2Object;
import com.l2jmobius.gameserver.model.actor.L2Character;
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.util.BuilderUtil;
import com.l2jmobius.gameserver.util.Util;
/**
* @author Mobius
*/
public class AdminTransform implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_transform",
"admin_untransform",
"admin_transform_menu",
};
@Override
public boolean useAdminCommand(String command, L2PcInstance activeChar)
{
if (command.equals("admin_transform_menu"))
{
AdminHtml.showAdminHtml(activeChar, "transform.htm");
return true;
}
else if (command.startsWith("admin_untransform"))
{
final L2Object obj = activeChar.getTarget();
if (obj.isCharacter())
{
((L2Character) obj).stopTransformation(true);
}
else
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
}
}
else if (command.startsWith("admin_transform"))
{
final L2Object obj = activeChar.getTarget();
if ((obj == null) || !obj.isPlayer())
{
activeChar.sendPacket(SystemMessageId.INVALID_TARGET);
return false;
}
final L2PcInstance player = obj.getActingPlayer();
if (activeChar.isSitting())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_SITTING);
return false;
}
if (player.isTransformed())
{
if (!command.contains(" "))
{
player.untransform();
return true;
}
activeChar.sendPacket(SystemMessageId.YOU_ALREADY_POLYMORPHED_AND_CANNOT_POLYMORPH_AGAIN);
return false;
}
if (player.isInWater())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_POLYMORPH_INTO_THE_DESIRED_FORM_IN_WATER);
return false;
}
if (player.isFlyingMounted() || player.isMounted())
{
activeChar.sendPacket(SystemMessageId.YOU_CANNOT_TRANSFORM_WHILE_RIDING_A_PET);
return false;
}
final String[] parts = command.split(" ");
if ((parts.length != 2) || !Util.isDigit(parts[1]))
{
BuilderUtil.sendSysMessage(activeChar, "Usage: //transform <id>");
return false;
}
final int id = Integer.parseInt(parts[1]);
if (!player.transform(id, true))
{
player.sendMessage("Unknown transformation ID: " + id);
return false;
}
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}

View File

@ -166,9 +166,7 @@ public final class SummonNpc extends AbstractEffect
return;
}
spawn.setX(x);
spawn.setY(y);
spawn.setZ(z);
spawn.setXYZ(x, y, z);
spawn.setHeading(player.getHeading());
spawn.stopRespawn();

Some files were not shown because too many files have changed in this diff Show More