Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2JHellasC
- Index: java/com/l2jhellas/Config.java
- ===================================================================
- --- java/com/l2jhellas/Config.java (revision 519)
- +++ java/com/l2jhellas/Config.java (working copy)
- @@ -81,12 +82,16 @@
- private static final String EVENT_RAID_CONFIG_FILE = "./config/Events/Raid.ini";
- private static final String EVENT_WEDDING_CONFIG_FILE = "./config/Events/Wedding.ini";
- // Mods Folder
- + private static final String MOD_OTHERS_CONFIG_FILE = "./config/Mods/Others.ini";
- private static final String MOD_CHAMPIONS_CONFIG_FILE = "./config/Mods/Champions.ini";
- private static final String MOD_L2JHellas_CONFIG_FILE = "./config/Mods/L2JHellas.ini";
- private static final String MOD_RANK_CONFIG_FILE = "./config/Mods/Rank PvP System.ini";
- @@ -347,6 +352,37 @@
- public static boolean CHAMPION_ENABLE;
- /**
- + * Others Mods Config File
- + */
- + // 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;
- +
- + /**
- * PvP Config File
- */
- public static boolean REMOVE_BUFFS_ON_DIE;
- @@ -1592,6 +1628,76 @@
- CHAMPION_SPCL_LVL_DIFF = Integer.parseInt(ChampionSettings.getProperty("ChampionSpecialItemLevelDiff", "0"));
- /**
- + * Others Mods
- + */
- + // EventDrop
- + ENABLE_DROP_EVENT = Boolean.parseBoolean(OthersSettings.getProperty("EnableDropEvent", "true"));
- + EVENT_RATE_XP = Float.parseFloat(OthersSettings.getProperty("EventRateXp", "2.0"));
- + EVENT_RATE_SP = Float.parseFloat(OthersSettings.getProperty("EventRateSp", "2.0"));
- + EVENT_RATE_ADENA = Float.parseFloat(OthersSettings.getProperty("EventRateAdena", "2.0"));
- + EVENT_RATE_SPOIL = Float.parseFloat(OthersSettings.getProperty("EventRateSpoil", "2.0"));
- +
- + /**
- * PvP
- */
- Properties PvPSettings = new Properties();
- Index: java/com/l2jhellas/gameserver/custom/DropEvent.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/custom/DropEvent.java (revision 0)
- +++ java/com/l2jhellas/gameserver/custom/DropEvent.java (working copy)
- @@ -0,0 +1,95 @@
- +package com.l2jhellas.gameserver.custom;
- +
- +import java.util.Calendar;
- +import java.util.Date;
- +import java.util.Timer;
- +import java.util.TimerTask;
- +
- +import com.l2jhellas.Config;
- +import com.l2jhellas.gameserver.Announcements;
- +import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- +
- +/**
- + * @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() {
- + Timer timer = new Timer();
- + timer.schedule(new TimerTask() {
- + @Override
- + public void run() {
- + if(status) {
- + Announcements.getInstance().announceToAll("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: java/com/l2jhellas/gameserver/model/actor/L2Attackable.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/model/actor/L2Attackable.java (revision 519)
- +++ java/com/l2jhellas/gameserver/model/actor/L2Attackable.java (working copy)
- @@ -30,6 +30,7 @@
- import com.l2jhellas.gameserver.ai.L2AttackableAI;
- import com.l2jhellas.gameserver.ai.L2CharacterAI;
- import com.l2jhellas.gameserver.ai.L2SiegeGuardAI;
- +import com.l2jhellas.gameserver.custom.DropEvent;
- import com.l2jhellas.gameserver.datatables.sql.ItemTable;
- import com.l2jhellas.gameserver.instancemanager.CursedWeaponsManager;
- import com.l2jhellas.gameserver.model.L2CharPosition;
- @@ -1182,10 +1183,11 @@
- }
- // Applies Drop rates
- + DropEvent event = new DropEvent();
- if (drop.getItemId() == 57)
- - dropChance *= (lastAttacker.getPremiumService() == 1 ? Config.PREMIUM_RATE_DROP_ADENA : Config.RATE_DROP_ADENA);
- + dropChance *= (lastAttacker.getPremiumService() == 1 ? (Config.PREMIUM_RATE_DROP_ADENA * event.getRateAdena()) : (Config.RATE_DROP_ADENA * event.getRateAdena()));
- else if (isSweep)
- - dropChance *= (lastAttacker.getPremiumService() == 1 ? Config.PREMIUM_RATE_DROP_SPOIL : Config.RATE_DROP_SPOIL);
- + dropChance *= (lastAttacker.getPremiumService() == 1 ? (Config.PREMIUM_RATE_DROP_SPOIL * event.getRateSpoil()) : (Config.RATE_DROP_SPOIL * event.getRateSpoil()));
- else
- if (lastAttacker.getPremiumService() == 1)
- dropChance *= isRaid() && !isRaidMinion() ? Config.PREMIUM_RATE_DROP_ITEMS_BY_RAID : Config.PREMIUM_RATE_DROP_ITEMS;
- Index: java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java (revision 519)
- +++ java/com/l2jhellas/gameserver/network/clientpackets/EnterWorld.java (working copy)
- @@ -14,10 +14,16 @@
- */
- package com.l2jhellas.gameserver.network.clientpackets;
- import com.l2jhellas.gameserver.TaskPriority;
- +import com.l2jhellas.gameserver.custom.DropEvent;
- import com.l2jhellas.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jhellas.gameserver.network.serverpackets.CreatureSay;
- /**
- * Enter World Packet Handler
- @@ -44,9 +50,77 @@
- _log.warning(EnterWorld.class.getName() + ": EnterWorld failed! activeChar is null...");
- getClient().closeNow();
- return;
- - }
- - activeChar.checks();
- + }
- +
- + activeChar.checks();
- +
- + DropEvent event = new DropEvent();
- + event.sendMessage(activeChar);
- @Override
- public String getType()
- Index: config/Mods/Others.ini
- ===================================================================
- --- config/Mods/Others.ini (revision 0)
- +++ config/Mods/Others.ini (working copy)
- @@ -0,0 +1,63 @@
- +#=============================================================
- +# 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
- Index: java/com/l2jhellas/gameserver/GameServer.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/GameServer.java (revision 519)
- +++ java/com/l2jhellas/gameserver/GameServer.java (working copy)
- @@ -43,6 +43,9 @@
- import com.l2jhellas.gameserver.controllers.GameTimeController;
- import com.l2jhellas.gameserver.controllers.RecipeController;
- import com.l2jhellas.gameserver.controllers.TradeController;
- +import com.l2jhellas.gameserver.custom.DropEvent;
- import com.l2jhellas.gameserver.datatables.EventDroplist;
- import com.l2jhellas.gameserver.datatables.csv.ExtractableItemsData;
- import com.l2jhellas.gameserver.datatables.sql.BuffTemplateTable;
- @@ -373,6 +376,19 @@
- {
- CoupleManager.getInstance();
- }
- +
- + // DropEvent
- + if (Config.ENABLE_DROP_EVENT) {
- + new DropEvent().verificationDay();
- + _log.info("DropEvent loaded");
- + }
- IpCatcher.ipsLoad();
- // run garbage collector
- Index: java/com/l2jhellas/gameserver/model/actor/L2Npc.java
- ===================================================================
- --- java/com/l2jhellas/gameserver/model/actor/L2Npc.java (revision 519)
- +++ java/com/l2jhellas/gameserver/model/actor/L2Npc.java (working copy)
- @@ -18,7 +18,6 @@
- import java.text.DateFormat;
- import java.util.ArrayList;
- -import java.util.Calendar;
- import java.util.List;
- import com.l2jhellas.Config;
- @@ -27,6 +26,7 @@
- import com.l2jhellas.gameserver.ThreadPoolManager;
- import com.l2jhellas.gameserver.ai.CtrlIntention;
- import com.l2jhellas.gameserver.cache.HtmCache;
- +import com.l2jhellas.gameserver.custom.DropEvent;
- import com.l2jhellas.gameserver.datatables.sql.BuffTemplateTable;
- import com.l2jhellas.gameserver.datatables.sql.ClanTable;
- import com.l2jhellas.gameserver.datatables.sql.ItemTable;
- @@ -2305,29 +2305,14 @@
- player.sendPacket(ActionFailed.STATIC_PACKET);
- }
- - private int Savvato()
- - {
- - return Calendar.SATURDAY;
- - }
- - private int dayofweek()
- - {
- - return Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
- - }
- -
- /**
- * Return the Exp Reward of this L2Npc contained in the L2NpcTemplate (modified by RATE_XP).<BR><BR>
- */
- public int getExpReward()
- {
- final double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
- - int exp=0;
- -
- - if(Config.ALLOW_SATURDAY_RATE_XP_SP && dayofweek() == Savvato())
- - exp = (int) (getTemplate().rewardExp * rateXp * Config.SATURDAY_RATE_XP);
- - else
- - exp = (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
- -
- - return exp;
- + DropEvent event = new DropEvent();
- + return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP * event.getRateXp());
- }
- /**
- @@ -2336,14 +2321,8 @@
- public int getSpReward()
- {
- double rateSp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
- - int sp=0;
- -
- - if(Config.ALLOW_SATURDAY_RATE_XP_SP && dayofweek() == Savvato())
- - sp = (int) (getTemplate().rewardSp * rateSp * Config.SATURDAY_RATE_SP);
- - else
- - sp = (int) (getTemplate().rewardSp * rateSp * Config.RATE_SP);
- -
- - return sp;
- + DropEvent event = new DropEvent();
- + return (int) (getTemplate().rewardSp * rateSp * Config.RATE_SP * event.getRateSp());
- }
- /**
- @@ -2353,10 +2332,11 @@
- public int getExpReward(int isPremium)
- {
- double rateXp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
- + DropEvent event = new DropEvent();
- if (isPremium == 1)
- - return (int) (getTemplate().rewardExp * rateXp * Config.PREMIUM_RATE_XP);
- + return (int) (getTemplate().rewardExp * rateXp * Config.PREMIUM_RATE_XP * event.getRateXp());
- else
- - return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP);
- + return (int) (getTemplate().rewardExp * rateXp * Config.RATE_XP * event.getRateXp());
- }
- /**
- @@ -2366,10 +2346,11 @@
- public int getSpReward(int isPremium)
- {
- double rateSp = getStat().calcStat(Stats.MAX_HP, 1, this, null);
- + DropEvent event = new DropEvent();
- if (isPremium == 1)
- - return (int) (getTemplate().rewardSp * rateSp * Config.PREMIUM_RATE_SP);
- + return (int) (getTemplate().rewardSp * rateSp * Config.PREMIUM_RATE_SP * event.getRateSp());
- else
- - return (int) (getTemplate().rewardSp * rateSp * Config.RATE_SP);
- + return (int) (getTemplate().rewardSp * rateSp * Config.RATE_SP * event.getRateSp());
- }
- /**
Add Comment
Please, Sign In to add comment