Loc.java 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 net.sf.l2j.gameserver.handler.usercommandhandlers;
  16. import net.sf.l2j.gameserver.datatables.MapRegionTable;
  17. import net.sf.l2j.gameserver.handler.IUserCommandHandler;
  18. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  19. import net.sf.l2j.gameserver.network.SystemMessageId;
  20. import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
  21. /**
  22. *
  23. *
  24. */
  25. public class Loc implements IUserCommandHandler
  26. {
  27. private static final int[] COMMAND_IDS = { 0 };
  28. /* (non-Javadoc)
  29. * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.L2PcInstance)
  30. */
  31. public boolean useUserCommand(int id, L2PcInstance activeChar)
  32. {
  33. int _nearestTown=MapRegionTable.getInstance().getClosestTownNumber(activeChar);
  34. SystemMessageId msg;
  35. switch (_nearestTown)
  36. {
  37. case 0: msg = SystemMessageId.LOC_TI_S1_S2_S3; break;
  38. case 1: msg = SystemMessageId.LOC_ELVEN_S1_S2_S3; break;
  39. case 2: msg = SystemMessageId.LOC_DARK_ELVEN_S1_S2_S3; break;
  40. case 3: msg = SystemMessageId.LOC_ORC_S1_S2_S3; break;
  41. case 4: msg = SystemMessageId.LOC_DWARVEN_S1_S2_S3; break;
  42. case 5: msg = SystemMessageId.LOC_GLUDIO_S1_S2_S3; break;
  43. case 6: msg = SystemMessageId.LOC_GLUDIN_S1_S2_S3; break;
  44. case 7: msg = SystemMessageId.LOC_DION_S1_S2_S3; break;
  45. case 8: msg = SystemMessageId.LOC_GIRAN_S1_S2_S3; break;
  46. case 9: msg = SystemMessageId.LOC_OREN_S1_S2_S3; break;
  47. case 10: msg = SystemMessageId.LOC_ADEN_S1_S2_S3; break;
  48. case 11: msg = SystemMessageId.LOC_HUNTER_S1_S2_S3; break;
  49. case 12: msg = SystemMessageId.LOC_GIRAN_HARBOR_S1_S2_S3; break;
  50. case 13: msg = SystemMessageId.LOC_HEINE_S1_S2_S3; break;
  51. case 14: msg = SystemMessageId.LOC_RUNE_S1_S2_S3; break;
  52. case 15: msg = SystemMessageId.LOC_GODDARD_S1_S2_S3; break;
  53. case 16: msg = SystemMessageId.LOC_SCHUTTGART_S1_S2_S3;break;
  54. case 17: msg = SystemMessageId.LOC_FLORAN_S1_S2_S3;break;
  55. case 18: msg = SystemMessageId.LOC_PRIMEVAL_ISLE_S1_S2_S3;break;
  56. case 19: msg = SystemMessageId.LOC_KAMAEL_VILLAGE_S1_S2_S3;break;
  57. case 20: msg = SystemMessageId.LOC_WASTELANDS_CAMP_S1_S2_S3;break;
  58. case 21: msg = SystemMessageId.LOC_FANTASY_ISLAND_S1_S2_S3;break;
  59. default: msg = SystemMessageId.LOC_ADEN_S1_S2_S3;
  60. }
  61. SystemMessage sm = new SystemMessage(msg);
  62. sm.addNumber(activeChar.getX());
  63. sm.addNumber(activeChar.getY());
  64. sm.addNumber(activeChar.getZ());
  65. activeChar.sendPacket(sm);
  66. return true;
  67. }
  68. /* (non-Javadoc)
  69. * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()
  70. */
  71. public int[] getUserCommandList()
  72. {
  73. return COMMAND_IDS;
  74. }
  75. }