Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/CustomMods/SpecialMods.ini b/config/CustomMods/SpecialMods.ini
- index 28c8e27..661452f 100644
- --- a/config/CustomMods/SpecialMods.ini
- +++ b/config/CustomMods/SpecialMods.ini
- @@ -1,4 +1,12 @@
- #=====================================================
- +# View Drop Mob Shift
- +#=====================================================
- +#Enable? Retail: False
- +AltGameViewNpc = True
- #=====================================================
- # Admin Login On Skill Super Haste Active
- #=====================================================
- #Start with the super rod skill activated?
- diff --git a/java/net/sf/l2j/Config.java b/java/net/sf/l2j/Config.java
- index e0d8b1a..d159519 100644
- --- a/java/net/sf/l2j/Config.java
- +++ b/java/net/sf/l2j/Config.java
- @@ -52,6 +52,8 @@
- // Clans settings
- // --------------------------------------------------
- /** Clans */
- + public static boolean ALT_GAME_VIEWNPC;
- public static boolean ANNOUNCE_BOSS_ALIVE;
- public static boolean ANNOUNCE_RAIDBOS_KILL;
- public static boolean ANNOUNCE_GRANDBOS_KILL;
- @@ -1410,6 +1412,7 @@
- private static final void loadSpecial()
- {
- final ExProperties Special = initProperties(SPECIAL_MODS);
- + ALT_GAME_VIEWNPC = Boolean.parseBoolean(Special.getProperty("AltGameViewNpc", "False"));
- AUTO_LOOT_EXCLUDE_ITEMS = Special.getProperty("AutoLootExcludeItems", "1341,1342,1343,1344,1345");
- String[] array = AUTO_LOOT_EXCLUDE_ITEMS.split(",");
- AUTO_LOOT_LIST_EXCLUDE_ITEMS = new int[array.length];
- diff --git a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- index 1eeeed6..1c2a717 100644
- --- a/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- +++ b/java/net/sf/l2j/gameserver/handler/VoicedCommandHandler.java
- @@ -27,6 +27,7 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.GameServer;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.GainXpSp;
- +import net.sf.l2j.gameserver.handler.voicedcommandhandlers.Shiff_Mod;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoicedBanking;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoicedBossSpawn;
- import net.sf.l2j.gameserver.handler.voicedcommandhandlers.VoicedCastles;
- @@ -58,6 +59,7 @@
- private VoicedCommandHandler()
- {
- _datatable = new HashMap<>();
- + registerVoicedCommandHandler(new Shiff_Mod());
- if(Config.ENABLE_COMMAND_RAID)
- {
- registerVoicedCommandHandler(new VoicedBossSpawn());
- diff --git a/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java
- index 09a06a9..48cdbd5 100644
- --- a/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java
- +++ b/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminEditChar.java
- @@ -579,7 +579,7 @@
- * @param player : The {@link Player} who requested that action.
- * @param targetPlayer : The {@link Player} target to gather informations from.
- */
- - private static void gatherPlayerInfo(Player player, Player targetPlayer)
- + public static void gatherPlayerInfo(Player player, Player targetPlayer)
- {
- final NpcHtmlMessage html = new NpcHtmlMessage(0);
- gatherPlayerInfo(player, targetPlayer, html);
- diff --git a/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Shiff_Mod.java b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Shiff_Mod.java
- new file mode 100644
- index 0000000..6c8586e
- --- /dev/null
- +++ b/java/net/sf/l2j/gameserver/handler/voicedcommandhandlers/Shiff_Mod.java
- @@ -0,0 +1,193 @@
- +/* 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 net.sf.l2j.gameserver.handler.voicedcommandhandlers;
- +
- +import java.text.DecimalFormat;
- +import java.util.StringTokenizer;
- +
- +import net.sf.l2j.commons.lang.StringUtil;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.data.xml.IconTable;
- +import net.sf.l2j.gameserver.data.xml.ItemData;
- +import net.sf.l2j.gameserver.data.xml.NpcData;
- +import net.sf.l2j.gameserver.handler.IVoicedCommandHandler;
- +import net.sf.l2j.gameserver.model.actor.Player;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.model.item.DropCategory;
- +import net.sf.l2j.gameserver.model.item.DropData;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- +import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- +public class Shiff_Mod implements IVoicedCommandHandler
- +{
- + private final static int PAGE_LIMIT = 15;
- + private static final String[] _voicedCommands =
- + {
- + "shifffmodddrop",
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, Player activeChar, String target)
- + {
- +
- + if (activeChar.isDead() || activeChar.isFakeDeath() || activeChar.getKarma() > 0 || activeChar.getPvpFlag() > 0 || activeChar.isAlikeDead() || activeChar.isFestivalParticipant() || activeChar.isInJail()
- + || activeChar.isInOlympiadMode() || activeChar.isInObserverMode() || activeChar.isFlying() || activeChar.isTeleporting() || activeChar.isParalyzed()
- + || activeChar.isSleeping() || activeChar.isInDuel () || activeChar.isBetrayed() || activeChar.isMounted() || activeChar.isRooted())
- + {
- + activeChar.sendMessage("You Cannot Use This Command Right Now");
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + return false;
- + }
- + if (command.startsWith("shifffmodddrop"))
- + {
- + final StringTokenizer st = new StringTokenizer(command, " ");
- + st.nextToken();
- + int npcId = Integer.parseInt(st.nextToken());
- + int page = (st.hasMoreTokens()) ? Integer.parseInt(st.nextToken()) : 1;
- +
- + ShiffNpcDropList(activeChar, npcId, page);
- + }
- + return true;
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return _voicedCommands;
- + }
- +
- + private static void ShiffNpcDropList(Player activeChar, int npcId, int page)
- + {
- + final NpcTemplate npcData = NpcData.getInstance().getTemplate(npcId);
- + if (npcData == null)
- + {
- + activeChar.sendMessage("Npc template is unknown for id: " + npcId + ".");
- + return;
- + }
- +
- + final StringBuilder sb = new StringBuilder(2000);
- +
- + if (!npcData.getDropData().isEmpty())
- + {
- + StringUtil.append(sb, "<html><title> ", npcData.getName(), " Drop List ", page, "</title><body>");
- + StringUtil.append(sb, "<center><img src=\"l2ui_ch3.herotower_deco\" width=256 height=32><br>");
- + StringUtil.append(sb, "<img src=\"L2UI.SquareGray\" width=280 height=1>");
- + StringUtil.append(sb, "<table border=0 bgcolor=000000 width=\"290\"><tr>");
- + StringUtil.append(sb, "<td align=center><font color=\"LEVEL\">Name Item</font></td>");
- + StringUtil.append(sb, "<td align=center><font color=\"FF6600\">Quantity Drop</font></td>");
- + StringUtil.append(sb, "<td align=center>Chance Drop</td>");
- + StringUtil.append(sb, "</tr></table>");
- + StringUtil.append(sb, "<img src=\"L2UI.SquareGray\" width=280 height=1>");
- + StringUtil.append(sb, "<br><img src=\"L2UI.SquareGray\" width=280 height=1>");
- +
- + int myPage = 1;
- + int i = 0;
- + int shown = 0;
- + boolean hasMore = false;
- +
- + for (DropCategory cat : npcData.getDropData())
- + {
- + if (shown == PAGE_LIMIT)
- + {
- + hasMore = true;
- + break;
- + }
- +
- + for (DropData drop : cat.getAllDrops())
- + {
- + if (myPage != page)
- + {
- + i++;
- + if (i == PAGE_LIMIT)
- + {
- + myPage++;
- + i = 0;
- + }
- + continue;
- + }
- +
- + if (shown == PAGE_LIMIT)
- + {
- + hasMore = true;
- + break;
- + }
- +
- +
- +
- + DecimalFormat df2 = new DecimalFormat("##.##");
- +
- + double ChanceInt = ((double)drop.getChance()/10000 * Config.RATE_DROP_ITEMS);
- + String Chance = df2.format(ChanceInt);
- +
- + int caluleAdena = ((int)Config.RATE_DROP_ADENA + (int)Config.RATE_DROP_ITEMS);
- +
- +
- + StringUtil.append(sb, "<table bgcolor=000000><tr>");
- + StringUtil.append(sb, "<td><img src=\"" + IconTable.getIcon(drop.getItemId()) + "\" width=32 height=32></td><td>");
- + StringUtil.append(sb, "<table><tr><td><font color=\"LEVEL\">", ItemData.getInstance().getTemplate(drop.getItemId()).getName(), "</font>");
- +
- + //calculando porcentagem Adenas Drop
- + if(drop.getItemId() == 57) {
- + StringUtil.append(sb, "<font color=\"FF6600\"> (", drop.getMinDrop() * caluleAdena, "/", drop.getMaxDrop() * caluleAdena , ")</font>");
- + }
- + else
- + {
- + //calculando porcentagem Items Drop
- + StringUtil.append(sb, "<font color=\"FF6600\"> (", drop.getMinDrop() , "/", drop.getMaxDrop() , ")</font>");
- + }
- + StringUtil.append(sb, "</td></tr>");
- + StringUtil.append(sb, "<tr><td>Rate: " + String.valueOf(Chance) + "%" + (drop.isQuestDrop() ? "Quest" : (cat.isSweep() ? "<font color=\"00FF00\"> Sweep</font><img src=\"L2UI.SquareGray\" width=233 height=1>" : "<font color=\"3BB9FF\"> Drop</font><img src=\"L2UI.SquareGray\" width=233 height=1>")) + "</td></tr></table></td></tr>");
- + shown++;
- + }
- + }
- +
- +
- + StringUtil.append(sb, "</table>");
- + StringUtil.append(sb, "<img src=\"L2UI.SquareGray\" width=280 height=1><br>");
- + StringUtil.append(sb, "<img src=\"L2UI.SquareGray\" width=280 height=1>");
- + StringUtil.append(sb, "<table width=\"100%\" bgcolor=000000><tr>");
- +
- + if (page > 1)
- + {
- + StringUtil.append(sb, "<td width=120><a action=\"bypass -h voiced_shifffmodddrop ", npcId, " ", page - 1, "\">Prev Page</a></td>");
- + if (!hasMore)
- + StringUtil.append(sb, "<td width=100>Page ", page, "</td><td width=70></td></tr>");
- + }
- +
- + if (hasMore)
- + {
- + if (page <= 1)
- + StringUtil.append(sb, "<td width=120></td>");
- +
- + StringUtil.append(sb, "<td width=100>Page ", page, "</td><td width=70><a action=\"bypass -h voiced_shifffmodddrop ", npcId, " ", page + 1, "\">Next Page</a></td></tr>");
- + }
- + StringUtil.append(sb, "</table>");
- + }
- + else
- + StringUtil.append(sb, "This NPC has no drops.");
- +
- + StringUtil.append(sb, "</body></html>");
- +
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setHtml(sb.toString());
- + activeChar.sendPacket(html);
- + }
- +
- + public void addRadar(Player activeChar, int x, int y, int z)
- + {
- + activeChar.getRadarList().addMarker(x, y, z);
- + }
- +
- +}
- \ No newline at end of file
- diff --git a/java/net/sf/l2j/gameserver/model/WorldObject.java b/java/net/sf/l2j/gameserver/model/WorldObject.java
- index 491d925..aec4dc6 100644
- --- a/java/net/sf/l2j/gameserver/model/WorldObject.java
- +++ b/java/net/sf/l2j/gameserver/model/WorldObject.java
- @@ -175,7 +175,10 @@
- {
- _name = value;
- }
- -
- + public void onActionShift(Player player)
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- public final int getObjectId()
- {
- return _objectId;
- diff --git a/java/net/sf/l2j/gameserver/model/actor/Creature.java b/java/net/sf/l2j/gameserver/model/actor/Creature.java
- index 95d63d2..c669703 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/Creature.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/Creature.java
- @@ -48,6 +48,7 @@
- import net.sf.l2j.gameserver.model.location.Location;
- import net.sf.l2j.gameserver.model.zone.type.WaterZone;
- import net.sf.l2j.gameserver.network.serverpackets.AbstractNpcInfo.NpcInfo;
- +import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- import net.sf.l2j.gameserver.network.serverpackets.ChangeMoveType;
- import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket;
- import net.sf.l2j.gameserver.network.serverpackets.Revive;
- @@ -1436,7 +1437,16 @@
- player.getAI().tryToInteract(this, isCtrlPressed, isShiftPressed);
- }
- }
- + @Override
- + public void onActionShift(Player player)
- + {
- + if (player.getTarget() != this)
- + player.setTarget(this);
- +
- + else
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + super.onActionShift(player);
- + }
- /**
- * @return true if this {@link Creature} is inside an active {@link WorldRegion}.
- */
- @@ -1884,7 +1894,6 @@
- {
- return false;
- }
- -
- /**
- * Test and cast curses if :
- * <ul>
- diff --git a/java/net/sf/l2j/gameserver/model/actor/Npc.java b/java/net/sf/l2j/gameserver/model/actor/Npc.java
- index 17a0088..95069bd 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/Npc.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/Npc.java
- @@ -2,6 +2,7 @@
- import java.text.DateFormat;
- import java.util.ArrayList;
- +import java.util.Arrays;
- import java.util.List;
- import java.util.Map;
- import java.util.StringTokenizer;
- @@ -33,6 +34,8 @@
- import net.sf.l2j.gameserver.enums.items.ShotType;
- import net.sf.l2j.gameserver.idfactory.IdFactory;
- import net.sf.l2j.gameserver.model.WorldObject;
- +import net.sf.l2j.gameserver.model.actor.instance.Merchant;
- +import net.sf.l2j.gameserver.model.actor.instance.Monster;
- import net.sf.l2j.gameserver.model.actor.status.NpcStatus;
- import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- import net.sf.l2j.gameserver.model.clanhall.ClanHall;
- @@ -224,7 +227,69 @@
- {
- return (_shotsMask & type.getMask()) == type.getMask();
- }
- -
- + @Override
- + public void onActionShift(Player player)
- + {
- + // Check if the L2PcInstance is a GM
- + if (player.isGM())
- + {
- + final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile("data/html/admin/npcinfo.htm");
- + html.replace("%class%", getClass().getSimpleName());
- + html.replace("%id%", getTemplate().getNpcId());
- + html.replace("%lvl%", getTemplate().getLevel());
- + html.replace("%name%", getTemplate().getName());
- + html.replace("%race%", getTemplate().getRace().toString());
- + html.replace("%tmplid%", getTemplate().getIdTemplate());
- + html.replace("%aggro%", getTemplate().getAggroRange());
- + html.replace("%corpse%", StringUtil.getTimeStamp(getTemplate().getCorpseTime()));
- + html.replace("%enchant%", getTemplate().getEnchantEffect());
- + html.replace("%loc%", getX() + " " + getY() + " " + getZ());
- +
- + if (getSpawn() != null)
- + {
- + html.replace("%spawn%", getSpawn().getLoc().toString());
- + html.replace("%resp%", StringUtil.getTimeStamp(getSpawn().getRespawnDelay()));
- + html.replace("%rand_resp%", StringUtil.getTimeStamp(getSpawn().getRespawnRandom()));
- + }
- + else
- + {
- + html.replace("%spawn%", "<font color=FF0000>null</font>");
- + html.replace("%loc2d%", "<font color=FF0000>--</font>");
- + html.replace("%loc3d%", "<font color=FF0000>--</font>");
- + html.replace("%resp%", "<font color=FF0000>--</font>");
- + html.replace("%rand_resp%", "<font color=FF0000>--</font>");
- + }
- +
- + html.replace("%ai_type%", getTemplate().getAiType().name());
- + html.replace("%ai_clan%", (getTemplate().getClans() != null) ? "<tr><td width=100><font color=\"LEVEL\">Clan:</font></td><td align=right width=170>" + Arrays.toString(getTemplate().getClans()) + " " + getTemplate().getClanRange() + "</td></tr>" + ((getTemplate().getIgnoredIds() != null) ? "<tr><td width=100><font color=\"LEVEL\">Ignored ids:</font></td><td align=right width=170>" + Arrays.toString(getTemplate().getIgnoredIds()) + "</td></tr>" : "") : "");
- + html.replace("%ai_move%", String.valueOf(getTemplate().canMove()));
- + html.replace("%ai_seed%", String.valueOf(getTemplate().isSeedable()));
- + html.replace("%ai_ssinfo%", _currentSsCount + "[" + getTemplate().getSsCount() + "] - " + getTemplate().getSsRate() + "%");
- + html.replace("%ai_spsinfo%", _currentSpsCount + "[" + getTemplate().getSpsCount() + "] - " + getTemplate().getSpsRate() + "%");
- + html.replace("%butt%", ((this instanceof Merchant) ? "<button value=\"Shop\" action=\"bypass -h admin_show_shop " + getNpcId() + "\" width=65 height=19 back=\"L2UI_ch3.smallbutton2_over\" fore=\"L2UI_ch3.smallbutton2\">" : ""));
- + player.sendPacket(html);
- + }
- + else if (Config.ALT_GAME_VIEWNPC)
- + {
- + if (!(this instanceof Monster))
- + {
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + return;
- + }
- + final NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
- + html.setFile("data/html/custom/dropNpc/npcinfo.htm");
- + html.replace("%id%", getTemplate().getNpcId());
- + html.replace("%lvl%", getTemplate().getLevel());
- + html.replace("%name%", getTemplate().getName());
- + html.replace("%loc%", getX() + " " + getY() + " " + getZ());
- + player.sendPacket(html);
- + }
- + if (player.getTarget() != this)
- + player.setTarget(this);
- + else
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- @Override
- public void setChargedShot(ShotType type, boolean charged)
- {
- diff --git a/java/net/sf/l2j/gameserver/model/actor/Player.java b/java/net/sf/l2j/gameserver/model/actor/Player.java
- index 44ffc27..6b4802b 100644
- --- a/java/net/sf/l2j/gameserver/model/actor/Player.java
- +++ b/java/net/sf/l2j/gameserver/model/actor/Player.java
- @@ -84,6 +84,7 @@
- import net.sf.l2j.gameserver.geoengine.GeoEngine;
- import net.sf.l2j.gameserver.handler.IItemHandler;
- import net.sf.l2j.gameserver.handler.ItemHandler;
- +import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEditChar;
- import net.sf.l2j.gameserver.handler.skillhandlers.SummonFriend;
- import net.sf.l2j.gameserver.model.AccessLevel;
- import net.sf.l2j.gameserver.model.PetDataEntry;
- @@ -665,7 +666,14 @@
- {
- return super.denyAiAction() || isInStoreMode() || _operateType == OperateType.OBSERVE;
- }
- -
- + @Override
- + public void onActionShift(Player player)
- + {
- + if (player.isGM())
- + AdminEditChar.gatherPlayerInfo(player, this);
- +
- + super.onActionShift(player);
- + }
- @Override
- public PlayerMove getMove()
- {
- diff --git a/java/net/sf/l2j/gameserver/model/item/DropData.java b/java/net/sf/l2j/gameserver/model/item/DropData.java
- index c36b9ee..d8fde92 100644
- --- a/java/net/sf/l2j/gameserver/model/item/DropData.java
- +++ b/java/net/sf/l2j/gameserver/model/item/DropData.java
- @@ -1,5 +1,7 @@
- package net.sf.l2j.gameserver.model.item;
- +import java.util.Arrays;
- +
- /**
- * A container used by monster drops.<br>
- * <br>
- @@ -10,6 +12,8 @@
- public static final int MAX_CHANCE = 1000000;
- private final int _itemId;
- + private String _questID = null;
- + private String[] _stateID = null;
- private final int _minDrop;
- private final int _maxDrop;
- private final int _chance;
- @@ -25,9 +29,28 @@
- @Override
- public String toString()
- {
- - return "DropData =[ItemID: " + _itemId + " Min: " + _minDrop + " Max: " + _maxDrop + " Chance: " + (_chance / 10000.0) + "%]";
- + String out = "ItemID: " + _itemId + " Min: " + _minDrop + " Max: " + _maxDrop + " Chance: " + (_chance / 10000.0) + "%";
- + if (isQuestDrop())
- + {
- + out = out + " QuestID: " + getQuestID() + " StateID's: " + Arrays.toString(getStateIDs());
- + }
- + return out;
- + //return "DropData =[ItemID: " + _itemId + " Min: " + _minDrop + " Max: " + _maxDrop + " Chance: " + (_chance / 10000.0) + "%]";
- + }
- + public String getQuestID()
- + {
- + return this._questID;
- }
- + public String[] getStateIDs()
- + {
- + return this._stateID;
- + }
- +
- + public boolean isQuestDrop()
- + {
- + return (this._questID != null) && (this._stateID != null);
- + }
- /**
- * @return the id of the dropped item.
- */
- diff --git a/java/net/sf/l2j/gameserver/network/clientpackets/Action.java b/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
- index e963ca2..52bfaed 100644
- --- a/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
- +++ b/java/net/sf/l2j/gameserver/network/clientpackets/Action.java
- @@ -1,63 +1,85 @@
- package net.sf.l2j.gameserver.network.clientpackets;
- import net.sf.l2j.gameserver.model.World;
- import net.sf.l2j.gameserver.model.WorldObject;
- import net.sf.l2j.gameserver.model.actor.Player;
- -import net.sf.l2j.gameserver.model.entity.Duel.DuelState;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- public final class Action extends L2GameClientPacket
- {
- private int _objectId;
- - private boolean _isShiftAction;
- + @SuppressWarnings("unused")
- + private int _originX, _originY, _originZ;
- + private int _actionId;
- @Override
- protected void readImpl()
- {
- _objectId = readD();
- - readD(); // originX
- - readD(); // originY
- - readD(); // originZ
- - _isShiftAction = readC() != 0;
- + _originX = readD();
- + _originY = readD();
- + _originZ = readD();
- + _actionId = readC();
- }
- @Override
- protected void runImpl()
- {
- - final Player player = getClient().getPlayer();
- - if (player == null)
- + final Player activeChar = getClient().getPlayer();
- + if (activeChar == null)
- return;
- - if (player.isInObserverMode())
- + if (activeChar.isInObserverMode())
- {
- - player.sendPacket(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE);
- - player.sendPacket(ActionFailed.STATIC_PACKET);
- + activeChar.sendPacket(SystemMessageId.OBSERVERS_CANNOT_PARTICIPATE);
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- - if (player.getActiveRequester() != null)
- + if (activeChar.getActiveRequester() != null || activeChar.isOutOfControl())
- {
- - player.sendPacket(ActionFailed.STATIC_PACKET);
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- - final WorldObject target = (player.getTargetId() == _objectId) ? player.getTarget() : World.getInstance().getObject(_objectId);
- - if (target == null)
- + final WorldObject obj = (activeChar.getTargetId() == _objectId) ? activeChar.getTarget() : World.getInstance().getObject(_objectId);
- + if (obj == null)
- {
- - player.sendPacket(ActionFailed.STATIC_PACKET);
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- - final Player targetPlayer = target.getActingPlayer();
- - if (targetPlayer != null && targetPlayer.getDuelState() == DuelState.DEAD)
- + switch (_actionId)
- {
- - player.sendPacket(SystemMessageId.OTHER_PARTY_IS_FROZEN);
- - player.sendPacket(ActionFailed.STATIC_PACKET);
- - return;
- + case 0:
- + obj.onAction(activeChar, false, false);
- + break;
- +
- + case 1:
- + obj.onActionShift(activeChar);
- + break;
- +
- + default:
- + // Invalid action detected (probably client cheating), log this
- + LOGGER.warn(activeChar.getName() + " requested invalid action: " + _actionId);
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + break;
- }
- -
- - target.onAction(player, false, _isShiftAction);
- }
- @Override
Add Comment
Please, Sign In to add comment