Hello guys, with a partner we made a little handler for a rate up event.
AdminEventRateUp.java
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.entity.Announcements;
import org.l2jmobius.gameserver.util.BuilderUtil;
/**
*
* @author 4Fun Dev
*/
public class AdminExpEvent implements IAdminCommandHandler
{
private static final String[] ADMIN_COMMANDS =
{
"admin_ExpUpOn",
"admin_ExpUpOff"
};
@Override
public boolean useAdminCommand(String command, PlayerInstance activeChar)
{
if (command.equals("admin_ExpUpOn"))
{
{
Config.RATE_XP = Config.RATE_XP * Config.SET_EVENT_EXP;
Config.RATE_SP = Config.RATE_SP * Config.SET_EVENT_SP;
Config.RATE_DROP_ADENA = Config.RATE_DROP_ADENA * Config.SET_EVENT_ADENA;
Config.RATE_DROP_ITEMS = Config.RATE_DROP_ITEMS * Config.SET_EVENT_DROP;
Config.RATE_DROP_SPOIL = Config.RATE_DROP_SPOIL * Config.SET_EVENT_SPOIL;
Announcements.getInstance().gameAnnounceToAll("Rates Up Event ON!");
Announcements.getInstance().gameAnnounceToAll("Exp: x" + Config.RATE_XP + "," + " " + "SP: x" + Config.RATE_SP + "," + " " + "Adena: x" + Config.RATE_DROP_ADENA + "," + " " + "Drop: x" + Config.RATE_DROP_ITEMS + " " + "y" + " " + "Spoil: x" + Config.RATE_DROP_SPOIL);
BuilderUtil.sendSysMessage(activeChar, "Event Started satisfactorily");
}
}
if (command.equals("admin_ExpUpOff"))
{
BuilderUtil.sendSysMessage(activeChar, "Event Ended Sucesfully);
Announcements.getInstance().gameAnnounceToAll("The Event Has Ended For Now! :(");
Announcements.getInstance().gameAnnounceToAll("All Rates Came Back To Normal");
}
return true;
}
@Override
public String[] getAdminCommandList()
{
return ADMIN_COMMANDS;
}
}
---------------------------------------------------------------------------------------
Config.java
public static boolean FORCE_COMPLETE_STATUS_UPDATE;
+++++++++++++++++++++++++++++++++++++
+// custom rateup event
+public static boolean ACTIVATE_RATE_UP_EVENT;
+public static float SET_EVENT_EXP;
+public static float SET_EVENT_SP;
+public static float SET_EVENT_ADENA;
+public static float SET_EVENT_DROP;
+public static float SET_EVENT_SPOIL;
+++++++++++++++++++++++++++++++++++++
public static int PORT_GAME;
/////////////////////////////////////////////////////// And ADD
DIFFERENT_Z_NEW_MOVIE = Integer.parseInt(CustomServerSettings.getProperty("DifferentZnewmovie", "1000"));
+++++++++++++++++++++++++++++++++++++++++++++
+// Other Event AdminRateUp
+ACTIVATE_RATE_UP_EVENT = Boolean.parseBoolean(CustomServerSettings.getProperty("AdminExpEvent", "false"));
+SET_EVENT_EXP = Float.parseFloat(CustomServerSettings.getProperty("SetEventExp", "1.00"));
+SET_EVENT_SP = Float.parseFloat(CustomServerSettings.getProperty("SetEventSp", "1.00"));
+SET_EVENT_ADENA = Float.parseFloat(CustomServerSettings.getProperty("SetEventAdena", "1.00"));
+SET_EVENT_DROP = Float.parseFloat(CustomServerSettings.getProperty("SetEventDrop", "1.00"));
+SET_EVENT_SPOIL = Float.parseFloat(CustomServerSettings.getProperty("SetEventSpoil", "1.00"));
+++++++++++++++++++++++++++++++++++++++++++++
ALLOW_SIMPLE_STATS_VIEW = Boolean.valueOf(CustomServerSettings.getProperty("AllowSimpleStatsView", "true"));
---------------------------------------------------------------------------------------
add in config/custom/other.ini
# Announce when a raidboss has spawned.
AnnounceToAllSpawnRb = False
+++++++++++++++++++++++++++++++++++++++++++++
+#Event Rate Up
+#This Default values are taken from main/Rates.ini
+#"//ExpUpOn rate" or "//ExpUpOff rate"
+AdminExpEvent = true
+#Eventexp default 1.0
+SetEventExp = 1.00
+#Eventsp default 1.0
+SetEventSp = 1.00
+#Eventadena default 1.0
+SetEventAdena = 1.00
+#Eventdrop default 1.0
+SetEventDrop = 1.00
+#Eventspoil default 1.0
+SetEventSpoil = 1.00
+++++++++++++++++++++++++++++++++++++++++++++
# Announce when a player has ben banned.
AnnounceTryBannedAccount = True
Hope all like it, is my frist job so it can ve Improved.