Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- Index: java/net/sf/l2j/gameserver/model/KillTheMobEvent.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/KillTheMobEvent.java (revision 0)
- +++ java/net/sf/l2j/gameserver/model/KillTheMobEvent.java (working copy)
- @@ -0,0 +1,84 @@
- +/*
- + * This program is free software: you can redistribute it and/or modify it under
- + * the terms of the GNU General Public License as published by the Free Software
- + * Foundation, either version 3 of the License, or (at your option) any later
- + * version.
- + *
- + * This program is distributed in the hope that it will be useful, but WITHOUT
- + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- + * details.
- + *
- + * You should have received a copy of the GNU General Public License along with
- + * this program. If not, see <http://www.gnu.org/licenses/>.
- + */
- +package net.sf.l2j.gameserver.model;
- +
- +import net.sf.l2j.Config;
- +import net.sf.l2j.gameserver.ThreadPoolManager;
- +import net.sf.l2j.gameserver.datatables.NpcTable;
- +import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- +import net.sf.l2j.gameserver.model.actor.template.NpcTemplate;
- +import net.sf.l2j.gameserver.util.Broadcast;
- +import net.sf.l2j.util.Rnd;
- +
- +/**
- + * @author Bluur
- + * @version 1.1
- + *
- + */
- +public class KillTheMobEvent
- +{
- + private static boolean eventEnabled = false;
- + private static int mobSelected;
- +
- + protected static void start()
- + {
- + mobSelected = Config.KILL_THE_MOB_MOB_IDS[Rnd.get(Config.KILL_THE_MOB_MOB_IDS.length)];
- + NpcTemplate mob = NpcTable.getInstance().getTemplate(mobSelected);
- +
- + if (mob == null)
- + {
- + System.out.println("[Kill The Mob]: ID incorreto, evento cancelado...");
- + return;
- + }
- +
- + eventEnabled = true;
- +
- + Broadcast.announceToOnlinePlayers("[Kill The Mob]: The event was started!", true);
- + Broadcast.announceToOnlinePlayers("[Kill The Mob]: Search and kill the " + mob.getName(), true);
- +
- + sleep(Config.KILL_THE_MOB_DURATION_EVENT); //event time
- + eventEnabled = false;
- + Broadcast.announceToOnlinePlayers("[Kill The Mob]: The event is over!", true);
- + }
- +
- + public static void checkerToReward(int id, L2PcInstance player)
- + {
- + if (id == mobSelected && player.getLevel() >= Config.KILL_THE_MOB_MIN_LEVEL && player.getLevel() <= Config.KILL_THE_MOB_MAX_LEVEL)
- + player.addItem("", Config.KILL_THE_MOB_REWARD_ID, Config.KILL_THE_MOB_REWARD_COUNT, player, true);
- + }
- +
- + public static int getMobSelected()
- + {
- + return mobSelected;
- + }
- +
- + public static boolean isEventEnabled()
- + {
- + return eventEnabled;
- + }
- +
- + public static void init()
- + {
- + ThreadPoolManager.getInstance().scheduleEffectAtFixedRate(new Runnable()
- + {
- + @Override
- + public void run()
- + {
- + start();
- + }
- + }, Config.KILL_THE_MOB_INTERVAL_EVENT*1000*60, Config.KILL_THE_MOB_INTERVAL_EVENT*1000*60);
- + }
- +
- + private static void sleep(int value)
- + {
- + try
- + {
- + Thread.sleep(value * 1000 * 60);
- + }
- + catch (InterruptedException e)
- + {
- + e.printStackTrace();
- + }
- + }
- +}
- Index: java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/GameServer.java (revision 1)
- +++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -93,6 +93,7 @@
- import net.sf.l2j.gameserver.instancemanager.SiegeManager;
- import net.sf.l2j.gameserver.instancemanager.ZoneManager;
- import net.sf.l2j.gameserver.instancemanager.games.MonsterRace;
- +import net.sf.l2j.gameserver.model.KillTheMobEvent;
- import net.sf.l2j.gameserver.model.L2Manor;
- import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.entity.Hero;
- @@ -292,6 +293,9 @@
- if (Config.ALT_FISH_CHAMPIONSHIP_ENABLED)
- FishingChampionshipManager.getInstance();
- + if (Config.KILL_THE_MOB_ENABLE)
- + KillTheMobEvent.init();
- +
- Util.printSection("System");
- TaskManager.getInstance();
- Index: java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java (revision 1)
- +++ java/net/sf/l2j/gameserver/network/serverpackets/AbstractNpcInfo.java (working copy)
- @@ -16,6 +16,7 @@
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.datatables.ClanTable;
- +import net.sf.l2j.gameserver.model.KillTheMobEvent;
- import net.sf.l2j.gameserver.model.L2Clan;
- import net.sf.l2j.gameserver.model.actor.L2Character;
- import net.sf.l2j.gameserver.model.actor.L2Npc;
- @@ -78,6 +79,8 @@
- if (_npc.isChampion())
- _title = ("Champion");
- + else if (KillTheMobEvent.isEventEnabled() && _npc.getNpcId() == KillTheMobEvent.getMobSelected())
- + _title = (Config.KILL_THE_MOB_TITLE);
- else if (_npc.getTemplate().isCustomNpc())
- _title = _npc.getTemplate().getTitle();
- else
- Index: java/net/sf/l2j/Config.java
- ===================================================================
- --- java/net/sf/l2j/Config.java (revision 1)
- +++ java/net/sf/l2j/Config.java (working copy)
- @@ -226,6 +226,31 @@
- public static int ALT_FISH_CHAMPIONSHIP_REWARD_4;
- public static int ALT_FISH_CHAMPIONSHIP_REWARD_5;
- + /** Kill The Mob */
- + public static boolean KILL_THE_MOB_ENABLE;
- + public static String KILL_THE_MOB_MOB_IDS_LIST;
- + public static int[] KILL_THE_MOB_MOB_IDS;
- + public static String KILL_THE_MOB_TITLE;
- + public static int KILL_THE_MOB_MIN_LEVEL;
- + public static int KILL_THE_MOB_MAX_LEVEL;
- + public static int KILL_THE_MOB_REWARD_ID;
- + public static int KILL_THE_MOB_REWARD_COUNT;
- + public static int KILL_THE_MOB_DURATION_EVENT;
- + public static int KILL_THE_MOB_INTERVAL_EVENT;
- +
- // --------------------------------------------------
- // HexID
- // --------------------------------------------------
- @@ -879,6 +904,28 @@
- ALT_FISH_CHAMPIONSHIP_REWARD_4 = events.getProperty("AltFishChampionshipReward4", 200000);
- ALT_FISH_CHAMPIONSHIP_REWARD_5 = events.getProperty("AltFishChampionshipReward5", 100000);
- + KILL_THE_MOB_ENABLE = events.getProperty("KillTheMobEnable", false);
- + KILL_THE_MOB_INTERVAL_EVENT = events.getProperty("KillTheMobIntervalEvent", 60);
- + KILL_THE_MOB_DURATION_EVENT = events.getProperty("KillTheMobDurationEvent", 10);
- + KILL_THE_MOB_MOB_IDS_LIST = events.getProperty("KillTheMobListID", "20941,20940");
- + KILL_THE_MOB_TITLE = events.getProperty("KillTheMobTitle", "");
- + KILL_THE_MOB_MIN_LEVEL = events.getProperty("KillTheMobMinLevelPlayer", 20);
- + KILL_THE_MOB_MAX_LEVEL = events.getProperty("KillTheMobMaxLevelPlayer", 80);
- + KILL_THE_MOB_REWARD_ID = events.getProperty("KillTheMobRewardID", 57);
- + KILL_THE_MOB_REWARD_COUNT = events.getProperty("KillTheMobRewardCount", 100);
- + String[] mobsList = KILL_THE_MOB_MOB_IDS_LIST.split(",");
- + KILL_THE_MOB_MOB_IDS = new int[mobsList.length];
- + for (int i = 0; i < mobsList.length; i++)
- + KILL_THE_MOB_MOB_IDS[i] = Integer.parseInt(mobsList[i]);
- +
- // FloodProtector
- ExProperties security = load(FLOOD_PROTECTOR_FILE);
- loadFloodProtectorConfig(security, FLOOD_PROTECTOR_ROLL_DICE, "RollDice", "42");
- Index: config/events.properties
- ===================================================================
- --- config/events.properties (revision 1)
- +++ config/events.properties (working copy)
- @@ -251,4 +251,26 @@
- AltFishChampionshipReward2 = 500000
- AltFishChampionshipReward3 = 300000
- AltFishChampionshipReward4 = 200000
- -AltFishChampionshipReward5 = 100000
- \ No newline at end of file
- +AltFishChampionshipReward5 = 100000
- +
- +#=============================================================
- +# Kill The Mob
- +#=============================================================
- +# Enable event?
- +KillTheMobEnable = False
- +# Event interval in minutes
- +KillTheMobIntervalEvent = 10
- +# Event duration in minutes
- +KillTheMobDurationEvent = 5
- +# List of ID random
- +KillTheMobListID = 20938,20939,20941,20940
- +# Mob title to be killed
- +KillTheMobTitle = [Kill The Mob]
- +# Minimum player level
- +KillTheMobMinLevelPlayer = 20
- +# Maximum player level
- +KillTheMobMaxLevelPlayer = 80
- +# Reward item_ID
- +KillTheMobRewardID = 6393
- +# Reward item_count
- +KillTheMobRewardCount = 1
- Index: java/net/sf/l2j/gameserver/model/actor/L2Attackable.java
- ===================================================================
- --- java/net/sf/l2j/gameserver/model/actor/L2Attackable.java (revision 1)
- +++ java/net/sf/l2j/gameserver/model/actor/L2Attackable.java (working copy)
- @@ -30,6 +30,7 @@
- import net.sf.l2j.gameserver.datatables.HerbDropTable;
- import net.sf.l2j.gameserver.datatables.ItemTable;
- import net.sf.l2j.gameserver.instancemanager.CursedWeaponsManager;
- +import net.sf.l2j.gameserver.model.KillTheMobEvent;
- import net.sf.l2j.gameserver.model.L2CharPosition;
- import net.sf.l2j.gameserver.model.L2CommandChannel;
- import net.sf.l2j.gameserver.model.L2Manor;
- @@ -1312,6 +1313,9 @@
- }
- }
- + if (KillTheMobEvent.isEventEnabled())
- + KillTheMobEvent.checkerToReward(getNpcId(), player);
- +
- // Apply special item drop for champions.
- if (isChampion() && Config.CHAMPION_REWARD > 0)
- {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement