L2StaticObjectInstanceActionShift.java 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package handlers.actionhandlers;
  16. import com.l2jserver.gameserver.handler.IActionHandler;
  17. import com.l2jserver.gameserver.model.L2Object;
  18. import com.l2jserver.gameserver.model.L2Object.InstanceType;
  19. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  20. import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance;
  21. import com.l2jserver.gameserver.network.serverpackets.MyTargetSelected;
  22. import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  23. import com.l2jserver.gameserver.network.serverpackets.StaticObject;
  24. import com.l2jserver.util.StringUtil;
  25. public class L2StaticObjectInstanceActionShift implements IActionHandler
  26. {
  27. @Override
  28. public boolean action(L2PcInstance activeChar, L2Object target, boolean interact)
  29. {
  30. if (activeChar.getAccessLevel().isGm())
  31. {
  32. activeChar.setTarget(target);
  33. activeChar.sendPacket(new MyTargetSelected(target.getObjectId(), activeChar.getLevel()));
  34. StaticObject su = new StaticObject((L2StaticObjectInstance)target);
  35. activeChar.sendPacket(su);
  36. NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
  37. final String html1 = StringUtil.concat(
  38. "<html><body><center><font color=\"LEVEL\">Static Object Info</font></center><br><table border=0><tr><td>Coords X,Y,Z: </td><td>",
  39. String.valueOf(target.getX()),
  40. ", ",
  41. String.valueOf(target.getY()),
  42. ", ",
  43. String.valueOf(target.getZ()),
  44. "</td></tr><tr><td>Object ID: </td><td>",
  45. String.valueOf(target.getObjectId()),
  46. "</td></tr><tr><td>Static Object ID: </td><td>",
  47. String.valueOf(((L2StaticObjectInstance)target).getStaticObjectId()),
  48. "</td></tr><tr><td>Mesh Index: </td><td>",
  49. String.valueOf(((L2StaticObjectInstance)target).getMeshIndex()),
  50. "</td></tr><tr><td><br></td></tr><tr><td>Class: </td><td>",
  51. target.getClass().getSimpleName(),
  52. "</td></tr></table></body></html>"
  53. );
  54. html.setHtml(html1);
  55. activeChar.sendPacket(html);
  56. }
  57. return true;
  58. }
  59. @Override
  60. public InstanceType getInstanceType()
  61. {
  62. return InstanceType.L2StaticObjectInstance;
  63. }
  64. }