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