Gladicek

LoveYourGatekeper (UPDATED)

Jan 1st, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.45 KB | None | 0 0
  1. Index: 32477-1.htm
  2. ===================================================================
  3. --- 32477-1.htm (revision 0)
  4. +++ 32477-1.htm (working copy)
  5. @@ -0,0 +1,14 @@
  6. +<html><head><body>Volunteer:<br>
  7. +We gatekeepers are under constant criticism and attack, always dealing with complaints that our teleportation services are too slow or too limited.
  8. +We don't retaliate, but not because we can't, mind you.
  9. +I'm sure you can see some of our strength in the way we endure the attacks upon us.<br>
  10. +But this is only a glimpse of our true power. We have decided to use our power for the greater good.<br>
  11. +Just 10,000 Adena, my friend! For a donation of 10,000 Adena, you too can purchase a genuine <font color="LEVEL">Gatekeeper Transformation Stick</font>.
  12. +You can make a donation once a day to earn this Shadow Item which gives you the ability to transform into a gatekeeper and experience our great powers.
  13. +You can only use the gatekeeper powers when you have this stick equipped.
  14. +Once you remove it, you will revert to your original form.<br>
  15. +The money that you donate will benefit our Gatekeeper Welfare Foundation, so please participate! <br>
  16. +<a action="bypass -h Quest LoveYourGatekeeper 32477.htm">Back</a>
  17. +</body></html>
  18. +
  19. +
  20. Index: 32477-2.htm
  21. ===================================================================
  22. --- 32477-2.htm (revision 0)
  23. +++ 32477-2.htm (working copy)
  24. @@ -0,0 +1,5 @@
  25. +<html><head><body>Volunteer:<br>
  26. +You don't have enough Adena.
  27. + A Gatekeeper Transformation Stick costs 10,000 Adena!<br>
  28. + Don't worry about the expense -- it's worth it.<br>
  29. + <a action="bypass -h Quest LoveYourGatekeeper 32477.htm">Back</a></body></html>
  30. Index: 32477-3.htm
  31. ===================================================================
  32. --- 32477-3.htm (revision 0)
  33. +++ 32477-3.htm (working copy)
  34. @@ -0,0 +1,6 @@
  35. +<html><head><body>Volunteer:<br>
  36. +Oh...you've gone too far!<br>
  37. + Is 10,000 Adena really such an exorbitant sum? <br>
  38. + <a action="bypass -h Quest LoveYourGatekeeper 32477.htm">Go back.</a>
  39. + </body></html>
  40. +
  41. Index: 32477.htm
  42. ===================================================================
  43. --- 32477.htm   (revision 0)
  44. +++ 32477.htm   (working copy)
  45. @@ -0,0 +1,11 @@
  46. +<html><head><body>
  47. +Volunteer:<br>
  48. +Goodness! Don't hit me!<br>
  49. +I am from the Gatekeeper Welfare Foundation.
  50. +We are currently sponsoring a <font color="LEVEL">"Love Your Gatekeeper" campaign</font>.
  51. + Please take part and show your support for our brave gatekeepers. <br>
  52. + <a action="bypass -h Quest LoveYourGatekeeper 32477-1.htm">Learn about the campaign.</a><br>
  53. + <a action="bypass -h Quest LoveYourGatekeeper transform_stick">Purchase a Transformation Stick.</a><br>
  54. + <a action="bypass -h Quest LoveYourGatekeeper transform">Encourage the gatekeeper.</a></body>
  55. + </html>
  56. +
  57. Index: config.xml
  58. ===================================================================
  59. --- config.xml  (revision 0)
  60. +++ config.xml  (working copy)
  61. @@ -0,0 +1,25 @@
  62. +<?xml version="1.0" encoding="UTF-8"?>
  63. +<event name="Love Your Gatekeeper" active="27 02 2008-28 02 2008" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../xsd/eventConfig.xsd">
  64. +   <spawnlist>
  65. +       <add npc="32477" x="82766" y="149438" z="-3464" heading="33865" />
  66. +       <add npc="32477" x="82286" y="53291" z="-1488" heading="15250" />
  67. +       <add npc="32477" x="147060" y="25943" z="-2008" heading="18774" />
  68. +       <add npc="32477" x="148096" y="-55466" z="-2728" heading="40541" />
  69. +       <add npc="32477" x="87116" y="-141332" z="-1336" heading="52193" />
  70. +       <add npc="32477" x="43521" y="-47542" z="-792" heading="31655" />
  71. +       <add npc="32477" x="17203" y="144949" z="-3024" heading="18166" />
  72. +       <add npc="32477" x="111164" y="221062" z="-3544" heading="2714" />
  73. +       <add npc="32477" x="-13869" y="122063" z="-2984" heading="18270" />
  74. +       <add npc="32477" x="-83161" y="150915" z="-3120" heading="17311" />
  75. +       <add npc="32477" x="45402" y="48355" z="-3056" heading="49153" />
  76. +       <add npc="32477" x="115616" y="-177941" z="-896" heading="30708" />
  77. +       <add npc="32477" x="-44928" y="-113608" z="-192" heading="30212" />
  78. +       <add npc="32477" x="-84037" y="243194" z="-3728" heading="8992" />
  79. +       <add npc="32477" x="-119690" y="44583" z="360" heading="29289" />
  80. +       <add npc="32477" x="12084" y="16576" z="-4584" heading="57345" />
  81. +   </spawnlist>
  82. +   <messages>
  83. +       <add type="onEnd" text="Love Your Gatekeeper: Event end!" />
  84. +       <add type="onEnter" text="Love Your Gatekeeper: Event ongoing!" />
  85. +   </messages>
  86. +</event>
  87. \ No newline at end of file
  88. Index: LoveYourGatekeeper.java
  89. ===================================================================
  90. --- LoveYourGatekeeper.java (revision 0)
  91. +++ LoveYourGatekeeper.java (working copy)
  92. @@ -0,0 +1,126 @@
  93. +/*
  94. + * This program is free software: you can redistribute it and/or modify it under
  95. + * the terms of the GNU General Public License as published by the Free Software
  96. + * Foundation, either version 3 of the License, or (at your option) any later
  97. + * version.
  98. + *
  99. + * This program is distributed in the hope that it will be useful, but WITHOUT
  100. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  101. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  102. + * details.
  103. + *
  104. + * You should have received a copy of the GNU General Public License along with
  105. + * this program. If not, see <http://www.gnu.org/licenses/>.
  106. + */
  107. +package events.LoveYourGatekeeper;
  108. +
  109. +import com.l2jserver.gameserver.model.actor.L2Npc;
  110. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  111. +import com.l2jserver.gameserver.model.event.LongTimeEvent;
  112. +import com.l2jserver.gameserver.model.holders.SkillHolder;
  113. +import com.l2jserver.gameserver.model.quest.QuestState;
  114. +import com.l2jserver.gameserver.network.SystemMessageId;
  115. +import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
  116. +
  117. +/**
  118. + * Retail Event 'Love Your Gatekeeper'
  119. + * @author Gladicek
  120. + * TODO: Retail like spawns for Volunteers
  121. + */
  122. +
  123. +public class LoveYourGatekeeper extends LongTimeEvent
  124. +{
  125. +   // Volunteer
  126. +   private static final int NpcId = 32477;
  127. +   // Items
  128. +   private static final int ItemId = 12814; // Shadow Item - Gatekeeper Transformation Stick
  129. +   private static final int ADENA = 57;
  130. +   // Time
  131. +   private static final int HOURS = 24;
  132. +   // Setting
  133. +   private static final int PRICE1 = 10000;
  134. +   private static final int PRICE2 = 5000;
  135. +   // Skills
  136. +   private static SkillHolder TELEPORTER_TRANSFORM = new SkillHolder(5655, 1);
  137. +  
  138. +   public LoveYourGatekeeper(String name, String descr)
  139. +   {
  140. +       super(name, descr);
  141. +       addStartNpc(NpcId);
  142. +       addFirstTalkId(NpcId);
  143. +       addTalkId(NpcId);
  144. +   }
  145. +  
  146. +   @Override
  147. +   public String onFirstTalk(L2Npc npc, L2PcInstance player)
  148. +   {
  149. +       if (player.getQuestState(getName()) == null)
  150. +       {
  151. +           newQuestState(player);
  152. +       }
  153. +       return "32477.htm";
  154. +   }
  155. +  
  156. +   @Override
  157. +   public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  158. +   {
  159. +       String htmltext = event;
  160. +       final QuestState st = player.getQuestState(getName());
  161. +       if (st == null)
  162. +       {
  163. +           return getNoQuestMsg(player);
  164. +       }
  165. +      
  166. +       switch (event)
  167. +       {
  168. +           case "transform_stick":
  169. +           {
  170. +               if (st.getQuestItemsCount(ADENA) >= PRICE1)
  171. +               {
  172. +                   long _reuse = 0;
  173. +                   String _streuse = st.get("reuse");
  174. +                   if (_streuse != null)
  175. +                   {
  176. +                       _reuse = Long.parseLong(_streuse);
  177. +                   }
  178. +                   if (_reuse > System.currentTimeMillis())
  179. +                   {
  180. +                       long remainingTime = (_reuse - System.currentTimeMillis()) / 1000;
  181. +                       int hours = (int) (remainingTime / 3600);
  182. +                       int minutes = (int) ((remainingTime % 3600) / 60);
  183. +                       SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES);
  184. +                       sm.addItemName(ItemId);
  185. +                       sm.addNumber(hours);
  186. +                       sm.addNumber(minutes);
  187. +                       player.sendPacket(sm);
  188. +                   }
  189. +                   st.takeItems(ADENA, PRICE1);
  190. +                   st.giveItems(ItemId, 1);
  191. +                   st.set("reuse", String.valueOf(System.currentTimeMillis() + (HOURS * 3600000)));
  192. +                  
  193. +               }
  194. +               else if (st.getQuestItemsCount(ADENA) < PRICE2)
  195. +               {
  196. +                   htmltext = "32477-2.htm";  
  197. +               }
  198. +               else
  199. +                   htmltext = "32477-3.htm";
  200. +           }
  201. +           case "transform":
  202. +           {
  203. +               if (player.getFirstEffect(107) != null)
  204. +               {
  205. +                   return null;
  206. +               }
  207. +               npc.doCast(TELEPORTER_TRANSFORM.getSkill());
  208. +           }
  209. +          
  210. +       }
  211. +       return htmltext;
  212. +   }
  213. +  
  214. +   public static void main(String[] args)
  215. +   {
  216. +       new LoveYourGatekeeper(LoveYourGatekeeper.class.getSimpleName(), "events");
  217. +   }
  218. +}
Advertisement
Add Comment
Please, Sign In to add comment