Advertisement
tiagopgeremias

KillBossEvent

Dec 29th, 2016
910
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 10.30 KB | None | 0 0
  1. diff --git a/aCis_gameserver/config/events.properties b/aCis_gameserver/config/events.properties
  2. index d0e7892..120a73a 100644
  3. --- a/aCis_gameserver/config/events.properties
  4. +++ b/aCis_gameserver/config/events.properties
  5. @@ -241,4 +241,24 @@ AltFishChampionshipReward1 = 800000
  6.  AltFishChampionshipReward2 = 500000
  7.  AltFishChampionshipReward3 = 300000
  8.  AltFishChampionshipReward4 = 200000
  9. -AltFishChampionshipReward5 = 100000
  10. \ No newline at end of file
  11. +AltFishChampionshipReward5 = 100000
  12. +
  13. +#=============================================================
  14. +#                     Kill Boss Event
  15. +#=============================================================
  16. +# Enable event?
  17. +KBEEnable = True
  18. +# Event Interval in minutes
  19. +KBEInterval = 2
  20. +# Event Duration in minutes
  21. +KBEDuration = 1
  22. +# Boss ID - Separated by ( , ) - Random Selected
  23. +KBEListBossID = 25126,25450
  24. +# Boss Title
  25. +KBETitle = [Event - Boss]
  26. +# Define Spawn X,Y,Z - Separated by ( ; ) - Random Selected
  27. +KBEListSpawn = -16376,-53944,-10448
  28. +#Announcement Start Event (Separated by ; )
  29. +KBEStartAnnounce = [Kill The Boss (ON)]: Kill the boss of the event and get special items;[Kill The Boss (ON)] You have 15 minutes to kill the boss.
  30. +#Announcement End Event (Separated by ; )
  31. +KBEEndAnnounce = [Kill The Boss (OFF)]: The event is over, stay tuned for the next event;[Kill The Boss (OFF)] Thank you Guys!
  32. \ No newline at end of file
  33. diff --git a/aCis_gameserver/java/net/sf/l2j/Config.java b/aCis_gameserver/java/net/sf/l2j/Config.java
  34. index a8e02f8..e3c7184 100644
  35. --- a/aCis_gameserver/java/net/sf/l2j/Config.java
  36. +++ b/aCis_gameserver/java/net/sf/l2j/Config.java
  37. @@ -222,6 +222,16 @@ public final class Config
  38.     public static int ALT_FISH_CHAMPIONSHIP_REWARD_4;
  39.     public static int ALT_FISH_CHAMPIONSHIP_REWARD_5;
  40.    
  41. +   /** Kill Boss Event */
  42. +   public static boolean KBE_ENABLE;
  43. +   public static int KBE_INTERVAL;
  44. +   public static int KBE_DURATION;
  45. +   public static int[] KBE_LIST_BOSS_ID;
  46. +   public static String KBE_TITLE;
  47. +   public static int[][] KBE_SPAWN;
  48. +   public static String[] KBE_ANNOUNCE_START;
  49. +   public static String[] KBE_ANNOUNCE_END;
  50. +  
  51.     // --------------------------------------------------
  52.     // GeoEngine
  53.     // --------------------------------------------------
  54. @@ -903,6 +913,48 @@ public final class Config
  55.         ALT_FISH_CHAMPIONSHIP_REWARD_3 = events.getProperty("AltFishChampionshipReward3", 300000);
  56.         ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
  57.         ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);
  58. +      
  59. +       //----------------------------------------------
  60. +       //  KILL BOSS EVENT
  61. +       //  @author: TpgX
  62. +       //----------------------------------------------
  63. +       String tmpList;
  64. +       String[] _tmpList;
  65. +
  66. +       KBE_ENABLE = events.getProperty("KBEEnable", false);
  67. +       KBE_INTERVAL = events.getProperty("KBEInterval", 720);
  68. +       KBE_DURATION = events.getProperty("KBEDuration", 15);
  69. +       tmpList = events.getProperty("KBEStartAnnounce", "[Kill Boss]: Start Event!");
  70. +       _tmpList = tmpList.split(";");
  71. +       KBE_ANNOUNCE_START = new String[_tmpList.length];
  72. +
  73. +       for(int i = 0 ; i < _tmpList.length ; i++){
  74. +           KBE_ANNOUNCE_START[i] = _tmpList[i];
  75. +       }
  76. +       tmpList = events.getProperty("KBEEndAnnounce", "[Kill Boss]: Over Event!");
  77. +       _tmpList = tmpList.split(";");
  78. +       KBE_ANNOUNCE_END = new String[_tmpList.length];
  79. +
  80. +       for(int i = 0 ; i < _tmpList.length ; i++){
  81. +           KBE_ANNOUNCE_END[i] = _tmpList[i];
  82. +       }
  83. +
  84. +       tmpList =  events.getProperty("KBEListBossID","20938");
  85. +       String[] bossList = tmpList.split(",");
  86. +       KBE_LIST_BOSS_ID = new int[bossList.length];
  87. +
  88. +       for (int i = 0 ; i < bossList.length ; i++)
  89. +           KBE_LIST_BOSS_ID[i] = Integer.parseInt(bossList[i]);
  90. +
  91. +       KBE_TITLE = events.getProperty("KBETitle","[Event - Boss]");
  92. +       tmpList = events.getProperty("KBEListSpawn","150086, 46733,-3412");
  93. +       _tmpList = tmpList.split(";");
  94. +       KBE_SPAWN = new int[_tmpList.length][];
  95. +
  96. +       for(int i = 0 ; i < _tmpList.length ; i++){
  97. +           String[] spawnList = _tmpList[i].split(",");
  98. +           KBE_SPAWN[i] = new int[]{Integer.parseInt(spawnList[0]),Integer.parseInt(spawnList[1]),Integer.parseInt(spawnList[2])};
  99. +       }
  100.     }
  101.    
  102.     /**
  103. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
  104. index 6df234c..9835315 100644
  105. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
  106. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/GameServer.java
  107. @@ -96,6 +96,7 @@ import net.sf.l2j.gameserver.instancemanager.SevenSignsFestival;
  108.  import net.sf.l2j.gameserver.instancemanager.SiegeManager;
  109.  import net.sf.l2j.gameserver.instancemanager.ZoneManager;
  110.  import net.sf.l2j.gameserver.instancemanager.games.MonsterRace;
  111. +import net.sf.l2j.gameserver.model.KillBossEvent;
  112.  import net.sf.l2j.gameserver.model.L2Manor;
  113.  import net.sf.l2j.gameserver.model.World;
  114.  import net.sf.l2j.gameserver.model.entity.Hero;
  115. @@ -284,6 +285,8 @@ public class GameServer
  116.        
  117.         if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED)
  118.             FishingChampionshipManager.getInstance();
  119. +       if(Config.KBE_ENABLE)
  120. +           KillBossEvent.init();  
  121.        
  122.         StringUtil.printSection("Handlers");
  123.         _log.config("AutoSpawnHandler: Loaded " + AutoSpawnManager.getInstance().size() + " handlers.");
  124. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/model/KillBossEvent.java b/aCis_gameserver/java/net/sf/l2j/gameserver/model/KillBossEvent.java
  125. new file mode 100644
  126. index 0000000..a2596f8
  127. --- /dev/null
  128. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/model/KillBossEvent.java
  129. @@ -0,0 +1,127 @@
  130. +/*
  131. + * This program is free software: you can redistribute it and/or modify it under
  132. + * the terms of the GNU General Public License as published by the Free Software
  133. + * Foundation, either version 3 of the License, or (at your option) any later
  134. + * version.
  135. + *
  136. + * This program is distributed in the hope that it will be useful, but WITHOUT
  137. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  138. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  139. + * details.
  140. + *
  141. + * You should have received a copy of the GNU General Public License along with
  142. + * this program. If not, see <http://www.gnu.org/licenses/>.
  143. + */
  144. +package net.sf.l2j.gameserver.model;
  145. +
  146. +import java.util.logging.Logger;
  147. +import net.sf.l2j.commons.concurrent.ThreadPool;
  148. +import net.sf.l2j.commons.random.Rnd;
  149. +
  150. +import net.sf.l2j.Config;
  151. +import net.sf.l2j.gameserver.datatables.NpcTable;
  152. +import net.sf.l2j.gameserver.datatables.SpawnTable;
  153. +import net.sf.l2j.gameserver.model.actor.L2Npc;
  154. +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
  155. +import net.sf.l2j.gameserver.util.Broadcast;
  156. +
  157. +/**
  158. + * @author Tiago
  159. + *
  160. + */
  161. +public class KillBossEvent
  162. +{
  163. +   protected static final Logger _log = Logger.getLogger(KillBossEvent.class.getName());
  164. +   private static int bossId;
  165. +   private static L2Npc _witchInst;
  166. +   private static int[] localization;
  167. +   private static boolean statusEvent = false;
  168. +
  169. +   protected static void start(){
  170. +
  171. +       try{
  172. +
  173. +           System.out.println("Quantidade de Boss no Evento" + Config.KBE_LIST_BOSS_ID.length);
  174. +           bossId = Config.KBE_LIST_BOSS_ID[Rnd.get(Config.KBE_LIST_BOSS_ID.length)];
  175. +           localization = Config.KBE_SPAWN[Rnd.get(Config.KBE_SPAWN.length)];
  176. +
  177. +           NpcTemplate _bossNpc = NpcTable.getInstance().getTemplate(bossId);
  178. +           L2Spawn bossSpawn = new L2Spawn(_bossNpc);
  179. +
  180. +           bossSpawn.setLoc(localization[0], localization[1],localization[2],0);
  181. +           bossSpawn.setRespawnState(false);
  182. +           SpawnTable.getInstance().addNewSpawn(bossSpawn, false);
  183. +           _witchInst = bossSpawn.doSpawn(false);
  184. +
  185. +           for(int i = 0 ; i < Config.KBE_ANNOUNCE_START.length ; i++){
  186. +               Broadcast.announceToOnlinePlayers(Config.KBE_ANNOUNCE_START[i], true);
  187. +           }
  188. +
  189. +
  190. +           statusEvent = true;
  191. +
  192. +           sleep(Config.KBE_DURATION);
  193. +
  194. +
  195. +           SpawnTable.getInstance().deleteSpawn(bossSpawn, false);
  196. +           _witchInst.getSpawn().setRespawnState(false);
  197. +           _witchInst.deleteMe();
  198. +           SpawnTable.getInstance().deleteSpawn(_witchInst.getSpawn(), false);
  199. +
  200. +           for(int i = 0 ; i < Config.KBE_ANNOUNCE_END.length ; i++){
  201. +               Broadcast.announceToOnlinePlayers(Config.KBE_ANNOUNCE_END[i], true);
  202. +           }
  203. +
  204. +           statusEvent = false;
  205. +
  206. +       }catch(Exception e){
  207. +           _log.warning("[ERRO]: "+e.toString());
  208. +       }
  209. +   }
  210. +
  211. +   public static int getBossSelected()
  212. +   {
  213. +       return bossId;
  214. +   }
  215. +
  216. +   /**
  217. +    * {@literal Init Thread}
  218. +    * @author Tiago
  219. +    */
  220. +   public static void init()
  221. +   {
  222. +       ThreadPool.scheduleAtFixedRate(new Runnable()
  223. +       {
  224. +           @Override
  225. +           public void run()
  226. +           {
  227. +               start();
  228. +           }
  229. +       }, Config.KBE_INTERVAL*1000*60, Config.KBE_INTERVAL*1000*60);
  230. +   }
  231. +
  232. +   /**
  233. +    * {@literal Check status from Event}
  234. +    * @author Tiago
  235. +    * @return Boolean
  236. +    */
  237. +   public static Boolean statusKillTheBossEvent(){
  238. +       return KillBossEvent.statusEvent;
  239. +   }
  240. +
  241. +   /**
  242. +    * @author Tiago
  243. +    * @param minutes  Integer minutes
  244. +    */
  245. +   private static void sleep(int minutes){
  246. +       try
  247. +       {
  248. +           Thread.sleep(minutes * 1000 * 60);
  249. +       }
  250. +       catch (InterruptedException e)
  251. +       {
  252. +           e.printStackTrace();
  253. +       }
  254. +   }
  255. +
  256. +}
  257. \ No newline at end of file
  258. diff --git a/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java b/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
  259. index 27ae67c..c3bbe05 100644
  260. --- a/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
  261. +++ b/aCis_gameserver/java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
  262. @@ -17,6 +17,7 @@ package net.sf.l2j.gameserver.network.serverpackets;
  263.  import net.sf.l2j.Config;
  264.  import net.sf.l2j.gameserver.datatables.ClanTable;
  265.  import net.sf.l2j.gameserver.model.L2Clan;
  266. +import net.sf.l2j.gameserver.model.KillBossEvent;
  267.  import net.sf.l2j.gameserver.model.L2Object.PolyType;
  268.  import net.sf.l2j.gameserver.model.actor.L2Character;
  269.  import net.sf.l2j.gameserver.model.actor.L2Npc;
  270. @@ -92,6 +93,8 @@ public abstract class AbstractNpcInfo extends L2GameServerPacket
  271.            
  272.             if (_npc.isChampion())
  273.                 _title = ("Champion");
  274. +           else if (KillBossEvent.statusKillTheBossEvent() && _npc.getNpcId() == KillBossEvent.getBossSelected())
  275. +               _title = (Config.KBE_TITLE);
  276.             else if (_npc.getTemplate().isCustomNpc())
  277.                 _title = _npc.getTemplate().getTitle();
  278.             else
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement