Nottingale.java 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /*
  2. * Copyright (C) 2004-2015 L2J DataPack
  3. *
  4. * This file is part of L2J DataPack.
  5. *
  6. * L2J DataPack is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * L2J DataPack is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. package gracia.AI.NPC.Nottingale;
  20. import java.util.HashMap;
  21. import java.util.Map;
  22. import quests.Q10273_GoodDayToFly.Q10273_GoodDayToFly;
  23. import ai.npc.AbstractNpcAI;
  24. import com.l2jserver.gameserver.instancemanager.AirShipManager;
  25. import com.l2jserver.gameserver.model.ClanPrivilege;
  26. import com.l2jserver.gameserver.model.actor.L2Npc;
  27. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  28. import com.l2jserver.gameserver.model.quest.QuestState;
  29. import com.l2jserver.gameserver.network.serverpackets.RadarControl;
  30. /**
  31. * Nottingale AI
  32. * @author xban1x
  33. */
  34. public final class Nottingale extends AbstractNpcAI
  35. {
  36. // NPC
  37. private static final int NOTTINGALE = 32627;
  38. // Misc
  39. private static final Map<Integer, RadarControl> RADARS = new HashMap<>();
  40. static
  41. {
  42. RADARS.put(2, new RadarControl(0, -184545, 243120, 1581, 2));
  43. RADARS.put(5, new RadarControl(0, -192361, 254528, 3598, 1));
  44. RADARS.put(6, new RadarControl(0, -174600, 219711, 4424, 1));
  45. RADARS.put(7, new RadarControl(0, -181989, 208968, 4424, 1));
  46. RADARS.put(8, new RadarControl(0, -252898, 235845, 5343, 1));
  47. RADARS.put(9, new RadarControl(0, -212819, 209813, 4288, 1));
  48. RADARS.put(10, new RadarControl(0, -246899, 251918, 4352, 1));
  49. }
  50. public Nottingale()
  51. {
  52. super(Nottingale.class.getSimpleName(), "gracia/AI/NPC");
  53. addStartNpc(NOTTINGALE);
  54. addTalkId(NOTTINGALE);
  55. addFirstTalkId(NOTTINGALE);
  56. }
  57. @Override
  58. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  59. {
  60. String htmltext = null;
  61. switch (event)
  62. {
  63. case "32627-02.html":
  64. case "32627-03.html":
  65. case "32627-04.html":
  66. {
  67. if (player.getClan() != null)
  68. {
  69. if (player.hasClanPrivilege(ClanPrivilege.CL_SUMMON_AIRSHIP) && AirShipManager.getInstance().hasAirShipLicense(player.getClanId()) && !AirShipManager.getInstance().hasAirShip(player.getClanId()))
  70. {
  71. htmltext = event;
  72. }
  73. else
  74. {
  75. final QuestState st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName());
  76. if ((st != null) && st.isCompleted())
  77. {
  78. htmltext = event;
  79. }
  80. else
  81. {
  82. player.sendPacket(RADARS.get(2));
  83. htmltext = "32627-01.html";
  84. }
  85. }
  86. }
  87. else
  88. {
  89. final QuestState st = player.getQuestState(Q10273_GoodDayToFly.class.getSimpleName());
  90. if ((st != null) && st.isCompleted())
  91. {
  92. htmltext = event;
  93. }
  94. else
  95. {
  96. player.sendPacket(RADARS.get(2));
  97. htmltext = "32627-01.html";
  98. }
  99. }
  100. break;
  101. }
  102. case "32627-05.html":
  103. case "32627-06.html":
  104. case "32627-07.html":
  105. case "32627-08.html":
  106. case "32627-09.html":
  107. case "32627-10.html":
  108. {
  109. player.sendPacket(RADARS.get(Integer.valueOf(event.substring(6, 8))));
  110. htmltext = event;
  111. break;
  112. }
  113. }
  114. return htmltext;
  115. }
  116. }