Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2jFrozen_GameServer
- Index: head-src/com/l2jfrozen/gameserver/custom/DropEvent.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/custom/DropEvent.java (revision 0)
- +++ head-src/com/l2jfrozen/gameserver/custom/DropEvent.java (working copy)
- @@ -0,0 +1,95 @@
- +package com.l2jfrozen.gameserver.custom;
- +
- +import java.util.Calendar;
- +import java.util.Date;
- +import java.util.Timer;
- +import java.util.TimerTask;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.entity.Announcements;
- +
- +/**
- + * @author João Vitor Barbosa
- + *
- + */
- +public class DropEvent {
- +
- + private static boolean status;
- + private float rateXp = Config.EVENT_RATE_XP;
- + private float rateSp = Config.EVENT_RATE_SP;
- + private float rateAdena = Config.EVENT_RATE_ADENA;
- + private float rateSpoil = Config.EVENT_RATE_SPOIL;
- + private int[] daysEvent = {1, 6, 7}; // Sunday = 1, Monday = 2, Tuesday = 3, Wednesday = 4, Thursday = 5, Friday = 6, Saturday = 7
- + private int delayMinAnnounce = 60; // 60 = 1 hour
- +
- + public void verificationDay() {
- + Calendar c = Calendar.getInstance();
- + c.set(Calendar.HOUR_OF_DAY, 0);
- + c.set(Calendar.MINUTE, 0);
- + c.set(Calendar.SECOND, 0);
- +
- + Date time = c.getTime();
- +
- + Timer timer = new Timer();
- + timer.schedule(new TimerTask() {
- + @Override
- + public void run() {
- + updateStatus();
- + if(status) {
- + announceEventOn();
- + }
- + }
- + }, time, 24* 60* 60 * 1000);
- + }
- +
- + public void announceEventOn() {
- + final Timer timer = new Timer();
- + timer.schedule(new TimerTask() {
- + @Override
- + public void run() {
- + if(status) {
- + Announcements.getInstance().gameAnnounceToAll("DropEvent is running!");
- + } else {
- + timer.cancel();
- + }
- + }
- + }, 0, delayMinAnnounce * 60000);
- + }
- +
- + public void sendMessage(L2PcInstance player) {
- + if(status) {
- + player.sendMessage("DropEvent is running!");
- + }
- + }
- +
- + public int getDayWeek() {
- + return Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
- + }
- +
- + public boolean updateStatus() {
- + for(int day : daysEvent) {
- + if(day == getDayWeek()) {
- + return status = true;
- + }
- + }
- + return status = false;
- + }
- +
- + public float getRateXp() {
- + return status ? rateXp : 1;
- + }
- +
- + public float getRateSp() {
- + return status ? rateSp : 1;
- + }
- +
- + public float getRateAdena() {
- + return status ? rateAdena : 1;
- + }
- +
- + public float getRateSpoil() {
- + return status ? rateSpoil : 1;
- + }
- +
- +}
- Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java (revision 1118)
- +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2NpcInstance.java (working copy)
- @@ -33,6 +33,7 @@
- import com.l2jfrozen.Config;
- import com.l2jfrozen.gameserver.ai.CtrlIntention;
- import com.l2jfrozen.gameserver.cache.HtmCache;
- +import com.l2jfrozen.gameserver.custom.DropEvent;
- import com.l2jfrozen.gameserver.datatables.MobGroupTable;
- import com.l2jfrozen.gameserver.datatables.SkillTable;
- import com.l2jfrozen.gameserver.datatables.sql.ClanTable;
- @@ -3023,7 +3024,8 @@
- public int getExpReward()
- {
- final double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
- - return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
- + DropEvent event = new DropEvent();
- + return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP * event.getRateXp());
- }
- /**
- @@ -3034,7 +3036,8 @@
- public int getSpReward()
- {
- final double rateSp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
- - return (int) (getTemplate().rewardSp * rateSp * Config.RATE_SP);
- + DropEvent event = new DropEvent();
- + return (int) (getTemplate().rewardSp * rateSp * Config.RATE_SP * event.getRateSp());
- }
- /**
- Index: head-src/com/l2jfrozen/gameserver/model/L2Attackable.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (revision 1118)
- +++ head-src/com/l2jfrozen/gameserver/model/L2Attackable.java (working copy)
- @@ -32,6 +32,7 @@
- import com.l2jfrozen.gameserver.ai.L2CharacterAI;
- import com.l2jfrozen.gameserver.ai.L2FortSiegeGuardAI;
- import com.l2jfrozen.gameserver.ai.L2SiegeGuardAI;
- +import com.l2jfrozen.gameserver.custom.DropEvent;
- import com.l2jfrozen.gameserver.datatables.sql.ItemTable;
- import com.l2jfrozen.gameserver.managers.CursedWeaponsManager;
- import com.l2jfrozen.gameserver.model.actor.instance.L2DoorInstance;
- @@ -1339,6 +1340,9 @@
- {
- dropChance *= Config.DONATOR_ADENA_RATE;
- }
- +
- + DropEvent event = new DropEvent();
- + dropChance *= event.getRateAdena();
- }
- }
- @@ -1364,6 +1368,9 @@
- {
- dropChance *= Config.DONATOR_SPOIL_RATE;
- }
- +
- + DropEvent event = new DropEvent();
- + dropChance *= event.getRateSpoil();
- }
- }
- else
- Index: head-src/com/l2jfrozen/Config.java
- ===================================================================
- --- head-src/com/l2jfrozen/Config.java (revision 1118)
- +++ head-src/com/l2jfrozen/Config.java (working copy)
- @@ -2428,6 +2428,13 @@
- public static String PVP1_CUSTOM_MESSAGE;
- public static String PVP2_CUSTOM_MESSAGE;
- + // DropEvent
- + public static boolean ENABLE_DROP_EVENT;
- + public static float EVENT_RATE_XP;
- + public static float EVENT_RATE_SP;
- + public static float EVENT_RATE_ADENA;
- + public static float EVENT_RATE_SPOIL;
- +
- // ============================================================
- public static void loadL2JFrozenConfig()
- {
- @@ -2546,6 +2553,13 @@
- FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!");
- PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!");
- PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!");
- +
- + // EventDrop
- + ENABLE_DROP_EVENT = Boolean.parseBoolean(L2JFrozenSettings.getProperty("EnableDropEvent", "true"));
- + EVENT_RATE_XP = Float.parseFloat(L2JFrozenSettings.getProperty("EventRateXp", "2.0"));
- + EVENT_RATE_SP = Float.parseFloat(L2JFrozenSettings.getProperty("EventRateSp", "2.0"));
- + EVENT_RATE_ADENA = Float.parseFloat(L2JFrozenSettings.getProperty("EventRateAdena", "2.0"));
- + EVENT_RATE_SPOIL = Float.parseFloat(L2JFrozenSettings.getProperty("EventRateSpoil", "2.0"));
- }
- catch (final Exception e)
- {
- Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (revision 1118)
- +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -31,6 +31,7 @@
- import com.l2jfrozen.crypt.nProtect.RestrictionType;
- import com.l2jfrozen.gameserver.communitybbs.Manager.RegionBBSManager;
- import com.l2jfrozen.gameserver.controllers.GameTimeController;
- +import com.l2jfrozen.gameserver.custom.DropEvent;
- import com.l2jfrozen.gameserver.datatables.CharSchemesTable;
- import com.l2jfrozen.gameserver.datatables.GmListTable;
- import com.l2jfrozen.gameserver.datatables.SkillTable;
- @@ -256,6 +257,9 @@
- }
- }
- + DropEvent event = new DropEvent();
- + event.sendMessage(activeChar);
- +
- // Restores custom status
- activeChar.restoreCustomStatus();
- Index: head-src/com/l2jfrozen/gameserver/GameServer.java
- ===================================================================
- --- head-src/com/l2jfrozen/gameserver/GameServer.java (revision 1118)
- +++ head-src/com/l2jfrozen/gameserver/GameServer.java (working copy)
- @@ -44,6 +44,7 @@
- import com.l2jfrozen.gameserver.controllers.GameTimeController;
- import com.l2jfrozen.gameserver.controllers.RecipeController;
- import com.l2jfrozen.gameserver.controllers.TradeController;
- +import com.l2jfrozen.gameserver.custom.DropEvent;
- import com.l2jfrozen.gameserver.datatables.GmListTable;
- import com.l2jfrozen.gameserver.datatables.HeroSkillTable;
- import com.l2jfrozen.gameserver.datatables.NobleSkillTable;
- @@ -541,6 +542,11 @@
- }
- Util.printSection("Custom Mods");
- + // DropEvent
- + if (Config.ENABLE_DROP_EVENT) {
- + new DropEvent().verificationDay();
- + LOGGER.info("DropEvent loaded");
- + }
- if (Config.L2JMOD_ALLOW_WEDDING || Config.ALLOW_AWAY_STATUS || Config.PCB_ENABLE || Config.POWERPAK_ENABLED)
- {
- Index: config/functions/l2jfrozen.properties
- ===================================================================
- --- config/functions/l2jfrozen.properties (revision 1118)
- +++ config/functions/l2jfrozen.properties (working copy)
- @@ -281,4 +281,14 @@
- ProtectorSkillLevel = 13
- ProtectorSkillTime = 600
- # Npc Protector Message
- -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
- \ No newline at end of file
- +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
- +
- +#=============================================================
- +# DropEvent - By João Vitor Barbosa
- +#=============================================================
- +# How to disable only an rate drop? Add 1.0, example: EventRateAdena = 1.0
- +EnableDropEvent = true
- +EventRateXp = 5.0
- +EventRateSp = 5.0
- +EventRateAdena = 5.0
- +EventRateSpoil = 5.0
- \ No newline at end of file
Add Comment
Please, Sign In to add comment