Loc.java 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  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 =
  28. {
  29. 0
  30. };
  31. /**
  32. *
  33. * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#useUserCommand(int, net.sf.l2j.gameserver.model.actor.instance.L2PcInstance)
  34. */
  35. public boolean useUserCommand(int id, L2PcInstance activeChar)
  36. {
  37. int _nearestTown = MapRegionTable.getInstance().getClosestTownNumber(activeChar);
  38. SystemMessageId msg;
  39. switch (_nearestTown)
  40. {
  41. case 0:
  42. msg = SystemMessageId.LOC_TI_S1_S2_S3;
  43. break;
  44. case 1:
  45. msg = SystemMessageId.LOC_ELVEN_S1_S2_S3;
  46. break;
  47. case 2:
  48. msg = SystemMessageId.LOC_DARK_ELVEN_S1_S2_S3;
  49. break;
  50. case 3:
  51. msg = SystemMessageId.LOC_ORC_S1_S2_S3;
  52. break;
  53. case 4:
  54. msg = SystemMessageId.LOC_DWARVEN_S1_S2_S3;
  55. break;
  56. case 5:
  57. msg = SystemMessageId.LOC_GLUDIO_S1_S2_S3;
  58. break;
  59. case 6:
  60. msg = SystemMessageId.LOC_GLUDIN_S1_S2_S3;
  61. break;
  62. case 7:
  63. msg = SystemMessageId.LOC_DION_S1_S2_S3;
  64. break;
  65. case 8:
  66. msg = SystemMessageId.LOC_GIRAN_S1_S2_S3;
  67. break;
  68. case 9:
  69. msg = SystemMessageId.LOC_OREN_S1_S2_S3;
  70. break;
  71. case 10:
  72. msg = SystemMessageId.LOC_ADEN_S1_S2_S3;
  73. break;
  74. case 11:
  75. msg = SystemMessageId.LOC_HUNTER_S1_S2_S3;
  76. break;
  77. case 12:
  78. msg = SystemMessageId.LOC_GIRAN_HARBOR_S1_S2_S3;
  79. break;
  80. case 13:
  81. msg = SystemMessageId.LOC_HEINE_S1_S2_S3;
  82. break;
  83. case 14:
  84. msg = SystemMessageId.LOC_RUNE_S1_S2_S3;
  85. break;
  86. case 15:
  87. msg = SystemMessageId.LOC_GODDARD_S1_S2_S3;
  88. break;
  89. case 16:
  90. msg = SystemMessageId.LOC_SCHUTTGART_S1_S2_S3;
  91. break;
  92. case 17:
  93. msg = SystemMessageId.LOC_FLORAN_S1_S2_S3;
  94. break;
  95. case 18:
  96. msg = SystemMessageId.LOC_PRIMEVAL_ISLE_S1_S2_S3;
  97. break;
  98. case 19:
  99. msg = SystemMessageId.LOC_KAMAEL_VILLAGE_S1_S2_S3;
  100. break;
  101. case 20:
  102. msg = SystemMessageId.LOC_WASTELANDS_CAMP_S1_S2_S3;
  103. break;
  104. case 21:
  105. msg = SystemMessageId.LOC_FANTASY_ISLAND_S1_S2_S3;
  106. break;
  107. default:
  108. msg = SystemMessageId.LOC_ADEN_S1_S2_S3;
  109. }
  110. SystemMessage sm = new SystemMessage(msg);
  111. sm.addNumber(activeChar.getX());
  112. sm.addNumber(activeChar.getY());
  113. sm.addNumber(activeChar.getZ());
  114. activeChar.sendPacket(sm);
  115. return true;
  116. }
  117. /**
  118. *
  119. * @see net.sf.l2j.gameserver.handler.IUserCommandHandler#getUserCommandList()
  120. */
  121. public int[] getUserCommandList()
  122. {
  123. return COMMAND_IDS;
  124. }
  125. }