L2StaticObjectInstanceActionShift.java 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. public boolean action(L2PcInstance activeChar, L2Object target, boolean interact)
  28. {
  29. if (activeChar.getAccessLevel().isGm())
  30. {
  31. activeChar.setTarget(target);
  32. activeChar.sendPacket(new MyTargetSelected(target.getObjectId(), activeChar.getLevel()));
  33. StaticObject su = new StaticObject((L2StaticObjectInstance)target);
  34. activeChar.sendPacket(su);
  35. NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
  36. final String html1 = StringUtil.concat(
  37. "<html><body><center><font color=\"LEVEL\">Static Object Info</font></center><br><table border=0><tr><td>Coords X,Y,Z: </td><td>",
  38. String.valueOf(target.getX()),
  39. ", ",
  40. String.valueOf(target.getY()),
  41. ", ",
  42. String.valueOf(target.getZ()),
  43. "</td></tr><tr><td>Object ID: </td><td>",
  44. String.valueOf(target.getObjectId()),
  45. "</td></tr><tr><td>Static Object ID: </td><td>",
  46. String.valueOf(((L2StaticObjectInstance)target).getStaticObjectId()),
  47. "</td></tr><tr><td>Mesh Index: </td><td>",
  48. String.valueOf(((L2StaticObjectInstance)target).getMeshIndex()),
  49. "</td></tr><tr><td><br></td></tr><tr><td>Class: </td><td>",
  50. target.getClass().getSimpleName(),
  51. "</td></tr></table></body></html>"
  52. );
  53. html.setHtml(html1);
  54. activeChar.sendPacket(html);
  55. }
  56. return true;
  57. }
  58. public InstanceType getInstanceType()
  59. {
  60. return InstanceType.L2StaticObjectInstance;
  61. }
  62. }