Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #---------------------------------------------------------------
- # XFactor - Cobra for Maxcheaters.com
- #---------------------------------------------------------------
- XFactorEventEnabled = false
- XFactorEventInterval = 11:00,15:00
- XFactorEventParticipationTime = 5
- XFactorEventRunningTime = 15
- XFactorEventParticipationNpcId = 1000000
- XFactorEventParticipationNpcCoordinates = 45451,48530,-3059
- XFactorEventMinPlayersInTeams = 1
- XFactorEventMaxPlayersInTeams = 50
- XFactorEventMinPlayerLevel = 1
- XFactorEventMaxPlayerLevel = 85
- XFactorEventRespawnTeleportDelay = 3
- XFactorEventStartLeaveTeleportDelay = 3
- XFactorEventTeam1Name = Knights
- XFactorEventTeam1Coordinates = 85578,256956,-11670
- XFactorEventTeam2Name = Zombies
- XFactorEventTeam2Coordinates = 85578,256956,-11670
- XFactorEventReward = 57,100000;5575,1000
- XFactorEventTargetTeamMembersAllowed = true
- XFactorEventScrollsAllowed = false
- XFactorEventPotionsAllowed = false
- XFactorEventSummonByItemAllowed = false
- Index: C:/l2j core/Shadow/java/net/sf/l2j/Config.java
- ===================================================================
- C:/l2j core/Shadow/java/net/sf/l2j/Config.java (revision 2944)
- C:/l2j core/Shadow/java/net/sf/l2j/Config.java (working copy)
- @@ -557,7 +557,90 @@
- //XFactor - Cobra for Maxcheaters.com
- public static boolean XFactor_EVENT_ENABLED;
- public static String[] XFactor_EVENT_INTERVAL;
- public static int XFactor_EVENT_PARTICIPATION_TIME;
- public static int XFactor_EVENT_RUNNING_TIME;
- public static int XFactor_EVENT_PARTICIPATION_NPC_ID;
- public static int[] XFactor_EVENT_PARTICIPATION_NPC_COORDINATES = new int[3];
- public static int XFactor_EVENT_MIN_PLAYERS_IN_TEAMS;
- public static int XFactor_EVENT_MAX_PLAYERS_IN_TEAMS;
- public static int XFactor_EVENT_RESPAWN_TELEPORT_DELAY;
- public static int XFactor_EVENT_START_LEAVE_TELEPORT_DELAY;
- public static String XFactor_EVENT_TEAM_1_NAME;
- public static int[] XFactor_EVENT_TEAM_1_COORDINATES = new int[3];
- public static String XFactor_EVENT_TEAM_2_NAME;
- public static int[] XFactor_EVENT_TEAM_2_COORDINATES = new int[3];
- public static List<int[]> XFactor_EVENT_REWARDS = new FastList<int[]>();
- public static boolean XFactor_EVENT_TARGET_TEAM_MEMBERS_ALLOWED;
- public static boolean XFactor_EVENT_SCROLL_ALLOWED;
- public static boolean XFactor_EVENT_POTIONS_ALLOWED;
- public static boolean XFactor_EVENT_SUMMON_BY_ITEM_ALLOWED;
- public static List<Integer> XFactor_DOORS_IDS_TO_OPEN = new ArrayList<Integer>();
- public static List<Integer> XFactor_DOORS_IDS_TO_CLOSE = new ArrayList<Integer>();
- public static boolean XFactor_REWARD_TEAM_TIE;
- public static byte XFactor_EVENT_MIN_LVL;
- public static byte XFactor_EVENT_MAX_LVL;
- //XFactor - Cobra for Maxcheaters.com
- XFactor_EVENT_ENABLED = Boolean.parseBoolean(L2JModSettings.getProperty("XFactorEventEnabled", "false"));
- XFactor_EVENT_INTERVAL = L2JModSettings.getProperty("XFactorEventInterval", "20:00").split(",");
- XFactor_EVENT_PARTICIPATION_TIME = Integer.parseInt(L2JModSettings.getProperty("XFactorEventParticipationTime", "3600"));
- XFactor_EVENT_RUNNING_TIME = Integer.parseInt(L2JModSettings.getProperty("XFactorEventRunningTime", "1800"));
- XFactor_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(L2JModSettings.getProperty("XFactorEventParticipationNpcId", "0"));
- if (XFactor_EVENT_PARTICIPATION_NPC_ID == 0)
- {
- XFactor_EVENT_ENABLED = false;
- _log.warning("XFactorEventEngine[Config.load()]: invalid config property -> XFactorEventParticipationNpcId");
- }
- else
- {
- String[] propertySplit = L2JModSettings.getProperty("XFactorEventParticipationNpcCoordinates", "0,0,0").split(",");
- if (propertySplit.length < 3)
- {
- XFactor_EVENT_ENABLED = false;
- _log.warning("XFactorEventEngine[Config.load()]: invalid config property -> XFactorEventParticipationNpcCoordinates");
- }
- else
- {
- XFactor_EVENT_REWARDS = new FastList<int[]>();
- XFactor_DOORS_IDS_TO_OPEN = new ArrayList<Integer>();
- XFactor_DOORS_IDS_TO_CLOSE = new ArrayList<Integer>();
- XFactor_EVENT_PARTICIPATION_NPC_COORDINATES = new int[3];
- XFactor_EVENT_TEAM_1_COORDINATES = new int[3];
- XFactor_EVENT_TEAM_2_COORDINATES = new int[3];
- XFactor_EVENT_PARTICIPATION_NPC_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
- XFactor_EVENT_PARTICIPATION_NPC_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
- XFactor_EVENT_PARTICIPATION_NPC_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
- XFactor_EVENT_MIN_PLAYERS_IN_TEAMS = Integer.parseInt(L2JModSettings.getProperty("XFactorEventMinPlayersInTeams", "1"));
- XFactor_EVENT_MAX_PLAYERS_IN_TEAMS = Integer.parseInt(L2JModSettings.getProperty("XFactorEventMaxPlayersInTeams", "20"));
- XFactor_EVENT_MIN_LVL = (byte)Integer.parseInt(L2JModSettings.getProperty("XFactorEventMinPlayerLevel", "1"));
- XFactor_EVENT_MAX_LVL = (byte)Integer.parseInt(L2JModSettings.getProperty("XFactorEventMaxPlayerLevel", "80"));
- XFactor_EVENT_RESPAWN_TELEPORT_DELAY = Integer.parseInt(L2JModSettings.getProperty("XFactorEventRespawnTeleportDelay", "20"));
- XFactor_EVENT_START_LEAVE_TELEPORT_DELAY = Integer.parseInt(L2JModSettings.getProperty("XFactorEventStartLeaveTeleportDelay", "20"));
- XFactor_EVENT_TEAM_1_NAME = L2JModSettings.getProperty("XFactorEventTeam1Name", "Team1");
- propertySplit = L2JModSettings.getProperty("XFactorEventTeam1Coordinates", "0,0,0").split(",");
- if (propertySplit.length < 3)
- {
- XFactor_EVENT_ENABLED = false;
- _log.warning("XFactorEventEngine[Config.load()]: invalid config property -> XFactorEventTeam1Coordinates");
- }
- else
- {
- XFactor_EVENT_TEAM_1_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
- XFactor_EVENT_TEAM_1_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
- XFactor_EVENT_TEAM_1_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
- XFactor_EVENT_TEAM_2_NAME = L2JModSettings.getProperty("XFactorEventTeam2Name", "Team2");
- propertySplit = L2JModSettings.getProperty("XFactorEventTeam2Coordinates", "0,0,0").split(",");
- if (propertySplit.length < 3)
- {
- XFactor_EVENT_ENABLED= false;
- _log.warning("XFactorEventEngine[Config.load()]: invalid config property -> XFactorEventTeam2Coordinates");
- }
- else
- {
- XFactor_EVENT_TEAM_2_COORDINATES[0] = Integer.parseInt(propertySplit[0]);
- XFactor_EVENT_TEAM_2_COORDINATES[1] = Integer.parseInt(propertySplit[1]);
- XFactor_EVENT_TEAM_2_COORDINATES[2] = Integer.parseInt(propertySplit[2]);
- propertySplit = L2JModSettings.getProperty("XFactorEventReward", "57,100000").split(";");
- for (String reward : propertySplit)
- {
- String[] rewardSplit = reward.split(",");
- if (rewardSplit.length != 2)
- _log.warning(StringUtil.concat(
- "XFactorEventEngine[Config.load()]: invalid config property -> XFactorEventReward \"",
- reward, "\""));
- else
- {
- try
- {
- XFactor_EVENT_REWARDS.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
- }
- catch (NumberFormatException nfe)
- {
- if (!reward.equals(""))
- _log.warning(StringUtil.concat(
- "XFactorEventEngine[Config.load()]: invalid config property -> XFactorEventReward \"",
- reward, "\""));
- }
- }
- }
- XFactor_EVENT_TARGET_TEAM_MEMBERS_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("XFactorEventTargetTeamMembersAllowed", "true"));
- XFactor_EVENT_SCROLL_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("XFactorEventScrollAllowed", "false"));
- XFactor_EVENT_POTIONS_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("XFactorEventPotionsAllowed", "false"));
- XFactor_EVENT_SUMMON_BY_ITEM_ALLOWED = Boolean.parseBoolean(L2JModSettings.getProperty("XFactorEventSummonByItemAllowed", "false"));
- XFactor_REWARD_TEAM_TIE = Boolean.parseBoolean(L2JModSettings.getProperty("XFactorRewardTeamTie", "false"));
- propertySplit = L2JModSettings.getProperty("XFactorDoorsToOpen", "").split(";");
- for (String door : propertySplit)
- {
- try
- {
- XFactor_DOORS_IDS_TO_OPEN.add(Integer.parseInt(door));
- }
- catch (NumberFormatException nfe)
- {
- if (!door.equals(""))
- _log.warning(StringUtil.concat(
- "XFactorEventEngine[Config.load()]: invalid config property -> XFactorDoorsToOpen \"",
- door, "\""));
- }
- }
- propertySplit = L2JModSettings.getProperty("XFactorDoorsToClose", "").split(";");
- for (String door : propertySplit)
- {
- try
- {
- XFactor_DOORS_IDS_TO_CLOSE.add(Integer.parseInt(door));
- }
- catch (NumberFormatException nfe)
- {
- if (!door.equals(""))
- _log.warning(StringUtil.concat(
- "XFactorEventEngine[Config.load()]: invalid config property -> XFactorDoorsToClose \"",
- door, "\""));
- }
- }
- }
- }
- }
- }
- //XFactor - Cobra for Maxcheaters.com
- //XFactor - Cobra for Maxcheaters.com
- else if (pName.equalsIgnoreCase("XFactorEventEnabled")) XFactor_EVENT_ENABLED = Boolean.parseBoolean(pValue);
- else if (pName.equalsIgnoreCase("XFactorEventInterval")) XFactor_EVENT_INTERVAL = pValue.split(",");
- else if (pName.equalsIgnoreCase("XFactorEventParticipationTime")) XFactor_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
- else if (pName.equalsIgnoreCase("XFactorEventRunningTime")) XFactor_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
- else if (pName.equalsIgnoreCase("XFactorEventParticipationNpcId")) XFactor_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
- //XFactor - Cobra for Maxcheaters.com
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/network/serverpackets/Die.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/network/serverpackets/Die.java (revision 2944)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/network/serverpackets/Die.java (working copy)
- @@ -25,6 +25,9 @@
- import net.sf.l2j.gameserver.model.entity.Castle;
- import net.sf.l2j.gameserver.model.entity.Fort;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- +import net.sf.l2j.gameserver.model.entity.XFactorEvent;
- +import net.sf.l2j.gameserver.model.entity.afterlifeEvent;
- +import net.sf.l2j.gameserver.model.entity.eridanusEvent;
- @@ -59,8 +62,12 @@
- _clan=player.getClan();
- }
- //shadow
- _charObjId = cha.getObjectId();
- - _canTeleport = !(cha instanceof L2PcInstance && TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(_charObjId));
- _canTeleport = !(cha instanceof L2PcInstance && TvTEvent.isStarted() && TvTEvent.isPlayerParticipant(_charObjId)
- || afterlifeEvent.isStarted() && afterlifeEvent.isPlayerParticipant(_charObjId)
- || XFactorEvent.isStarted() && XFactorEvent.isPlayerParticipant(_charObjId)
- || eridanusEvent.isStarted() && eridanusEvent.isPlayerParticipant(_charObjId));
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (revision 2944)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/network/clientpackets/Logout.java (working copy)
- @@ -27,6 +27,9 @@
- import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- +import net.sf.l2j.gameserver.model.entity.XFactorEvent;
- +import net.sf.l2j.gameserver.model.entity.afterlifeEvent;
- +import net.sf.l2j.gameserver.model.entity.eridanusEvent;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
- @@ -101,7 +104,11 @@
- {
- player.removeSkill(SkillTable.getInstance().getInfo(4289, 1));
- }
- -
- //shadow
- afterlifeEvent.onLogout(player);
- XFactorEvent.onLogout(player);
- eridanusEvent.onLogout(player);
- TvTEvent.onLogout(player);
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java (revision 2944)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/actor/instance/L2CubicInstance.java (working copy)
- @@ -12,6 +12,7 @@
- package net.sf.l2j.gameserver.model.actor.instance;
- import java.util.List;
- import java.util.concurrent.Future;
- import java.util.logging.Level;
- @@ -33,6 +34,12 @@
- import net.sf.l2j.gameserver.model.actor.L2Character;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- import net.sf.l2j.gameserver.model.entity.TvTEventTeam;
- +import net.sf.l2j.gameserver.model.entity.XFactorEvent;
- +import net.sf.l2j.gameserver.model.entity.XFactorEventTeam;
- if (XFactorEvent.isStarted() && XFactorEvent.isPlayerParticipant(_owner.getObjectId()))
- {
- XFactorEventTeam enemyTeam = XFactorEvent.getParticipantEnemyTeam(_owner.getObjectId());
- if (ownerTarget.getActingPlayer() != null)
- {
- L2PcInstance target = ownerTarget.getActingPlayer();
- if (enemyTeam.containsPlayer(target.getObjectId()) && !(target.isDead()))
- {
- _target = (L2Character) ownerTarget;
- }
- }
- return;
- }
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 2944)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -76,6 +76,7 @@
- import net.sf.l2j.gameserver.instancemanager.ItemsOnGroundManager;
- import net.sf.l2j.gameserver.instancemanager.QuestManager;
- import net.sf.l2j.gameserver.instancemanager.SiegeManager;
- +import net.sf.l2j.gameserver.instancemanager.TownManager;
- import net.sf.l2j.gameserver.model.BlockList;
- import net.sf.l2j.gameserver.model.FishData;
- import net.sf.l2j.gameserver.model.L2AccessLevel;
- @@ -128,6 +129,9 @@
- import net.sf.l2j.gameserver.model.entity.L2Event;
- import net.sf.l2j.gameserver.model.entity.Siege;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- +import net.sf.l2j.gameserver.model.entity.XFactorEvent;
- @@ -138,6 +142,7 @@
- import net.sf.l2j.gameserver.model.quest.Quest;
- import net.sf.l2j.gameserver.model.quest.QuestState;
- import net.sf.l2j.gameserver.model.quest.State;
- +import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
- import net.sf.l2j.gameserver.network.L2GameClient;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.AbnormalStatusUpdate;
- @@ -145,6 +150,7 @@
- import net.sf.l2j.gameserver.network.serverpackets.ChangeWaitType;
- import net.sf.l2j.gameserver.network.serverpackets.CharInfo;
- import net.sf.l2j.gameserver.network.serverpackets.ConfirmDlg;
- +import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- import net.sf.l2j.gameserver.network.serverpackets.EtcStatusUpdate;
- import net.sf.l2j.gameserver.network.serverpackets.ExAutoSoulShot;
- import net.sf.l2j.gameserver.network.serverpackets.ExBrExtraUserInfo;
- @@ -495,7 +501,13 @@
- public int _XFactorstreaks;
- public boolean _XFactorstate = false;
- @@ -2181,7 +2193,22 @@
- if (abortAttack) abortAttack();
- broadcastUserInfo();
- //XFactor
- public int getXFactorStreaks()
- {
- return _XFactorstreaks;
- }
- //XFactor
- @@ -3771,7 +3801,34 @@
- player.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- //XFactor
- if (!XFactorEvent.onAction( player, getObjectId()))
- {
- player.sendPacket(ActionFailed.STATIC_PACKET);
- return;
- }
- //Xfactor
- @@ -5017,12 +5103,39 @@
- L2PcInstance pk = killer.getActingPlayer();
- //XFactor
- XFactorEvent.onKill(killer, this);
- //XFactor
- //XFactor
- if (XFactorEvent.isStarted() && XFactorEvent.isPlayerParticipant(pk.getObjectId()) && XFactorEvent.isPlayerParticipant(killer.getObjectId()))
- {
- pk._XFactorstreaks++;
- }
- //XFactor
- // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
- sendPacket(new UserInfo(this));
- @@ -8090,6 +8265,22 @@
- //XFactor
- if (XFactorEvent.isStarted() && XFactorEvent.isPlayerParticipant(getObjectId()))
- return true;
- //XFactor
- @@ -11645,6 +11864,23 @@
- if (!TvTEvent.isInactive() && TvTEvent.isPlayerParticipant(getObjectId()))
- TvTEvent.removeParticipant(getObjectId());
- //XFactor
- if (!XFactorEvent.isInactive() && XFactorEvent.isPlayerParticipant(getObjectId()))
- XFactorEvent.removeParticipant(getObjectId());
- //XFactor
- @@ -12036,6 +12272,15 @@
- //XFactor
- && !(XFactorEvent.isStarted() && XFactorEvent.isPlayerParticipant(getObjectId()))
- //XFactor
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorManager.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorManager.java (revision 0)
- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorManager.java (revision 0)
- /*
- * 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.entity;
- import java.util.Calendar;
- import java.util.Collection;
- import java.util.concurrent.ScheduledFuture;
- import java.util.logging.Logger;
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.ThreadPoolManager;
- import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.network.serverpackets.CreatureSay;
- public class XFactorManager
- {
- protected static final Logger _log = Logger.getLogger(XFactorManager.class.getName());
- private static XFactorManager _instance = null;
- private XFactorStartTask _task;
- Collection<L2PcInstance> myplayers = L2World.getInstance().getAllPlayers().values();
- private XFactorManager()
- {
- if (Config.XFactor_EVENT_ENABLED)
- {
- XFactorEvent.init();
- this.scheduleEventStart();
- _log.info("XFactorEventEngine[XFactorManager.XFactorManager()]: Started.");
- }
- else
- {
- _log.info("XFactorEventEngine[XFactorManager.XFactorManager()]: Engine is disabled.");
- }
- }
- public static XFactorManager getInstance()
- {
- return _instance == null ? (_instance = new XFactorManager()) : _instance;
- }
- public void scheduleEventStart()
- {
- try {
- Calendar currentTime = Calendar.getInstance();
- Calendar nextStartTime = null;
- Calendar testStartTime = null;
- for (String timeOfDay : Config.XFactor_EVENT_INTERVAL) {
- testStartTime = Calendar.getInstance();
- testStartTime.setLenient(true);
- String[] splitTimeOfDay = timeOfDay.split(":");
- testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
- testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
- if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
- {
- testStartTime.add(Calendar.DAY_OF_MONTH, 1);
- }
- if (nextStartTime == null || testStartTime.getTimeInMillis() < nextStartTime.getTimeInMillis())
- {
- nextStartTime = testStartTime;
- }
- }
- _task = new XFactorStartTask(nextStartTime.getTimeInMillis());
- ThreadPoolManager.getInstance().executeTask(_task);
- }
- catch (Exception e)
- {
- _log.warning("XFactorEventEngine[XFactorManager.scheduleEventStart()]: Error figuring out a start time. Check XFactorEventInterval in config file.");
- }
- }
- public void startReg()
- {
- if (!XFactorEvent.startParticipation())
- {
- for (L2PcInstance onlinePlayer : myplayers)
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Event was Shut Down!");
- onlinePlayer.sendPacket(message);
- }
- _log.warning("XFactorEventEngine[XFactorManager.run()]: Error spawning event npc for participation.");
- this.scheduleEventStart();
- }
- else
- {
- for (L2PcInstance onlinePlayer : myplayers)
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Validation Period Started! It lasts for " + Config.XFactor_EVENT_PARTICIPATION_TIME + " minute(s).");
- onlinePlayer.sendPacket(message);
- }
- // schedule registration end
- _task.setStartTime(System.currentTimeMillis() + 60000L * Config.XFactor_EVENT_PARTICIPATION_TIME);
- ThreadPoolManager.getInstance().executeTask(_task);
- }
- }
- public void startEvent()
- {
- if (!XFactorEvent.startFight())
- {
- for (L2PcInstance onlinePlayer : myplayers)
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Event Is Shutting down! Players missed the sign up period!");
- onlinePlayer.sendPacket(message);
- }
- _log.info("XFactorEventEngine[XFactorManager.run()]: Lack of registration, abort event.");
- this.scheduleEventStart();
- }
- else
- {
- _task.setStartTime(System.currentTimeMillis() + 60000L * Config.XFactor_EVENT_RUNNING_TIME);
- ThreadPoolManager.getInstance().executeTask(_task);
- eventscheduler(1 * 901 * 1000); //executed once validation ends
- }
- }
- private void eventscheduler(long l2reaction)
- {
- long l2reactionstartimer = System.currentTimeMillis();
- int countdown = (int) (l2reaction / 1000);
- while (l2reactionstartimer + l2reaction > System.currentTimeMillis())
- {
- countdown--;
- {
- switch (countdown)
- {
- case 900: //start of first prep period
- {
- XFactorEvent.eventstatepos(); //enables team state
- XFactorEvent.teleporteams();// ports to prep period
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "2 minute(s) prep for the first round.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 840: //1 minute first prep period
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "1 minute(s) prep for the first round.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 780: //start of first round
- {
- XFactorEvent.setstreaknull(); //restart point
- XFactorEvent.eventstateneg(); //disables team state
- XFactorEvent.teleporteamsinside(); //port inside
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "First Round Started! 3 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 720: //first round 2 minutes left
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "First Round! 2 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 660: //first round 1 minutes left
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "First Round! 1 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 600: //start of second prep period
- {
- XFactorEvent.round1();
- XFactorEvent.eventstatepos(); //enables team state
- XFactorEvent.recoveryteamport();// ports to prep period
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "2 minute(s) prep for the second round.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 540:
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "1 minute(s) prep for the second round.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 480: //start of second round
- {
- XFactorEvent.setstreaknull(); //restart point
- XFactorEvent.eventstateneg(); //disables team state
- XFactorEvent.teleporteamsinside();//port inside
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Second Round Started! 3 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 420:
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Second Round! 2 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 360:
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Second Round! 1 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 300: //start of third prep period
- {
- XFactorEvent.round2();
- XFactorEvent.eventstatepos(); //enables team state
- XFactorEvent.recoveryteamport();// ports to prep period
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "2 minute(s) prep for the third round.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 240:
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "1 minute(s) prep for the third round.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 180: //start of third round
- {
- XFactorEvent.setstreaknull(); //restart point
- XFactorEvent.eventstateneg(); //disables team state
- XFactorEvent.teleporteamsinside();//port inside
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Third Round started! 3 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 120:
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Third Round! 2 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- case 60:
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", "Third Round! 1 minute(s) left.");
- XFactorEvent.sendPacket(message);
- }
- break;
- }
- if (countdown == 0)
- {
- //ends event and catches the third round winner
- }
- }
- long startl2reactionsecondtimer = System.currentTimeMillis();
- while (startl2reactionsecondtimer + 1000 > System.currentTimeMillis())
- {
- try
- {
- Thread.sleep(1);
- }
- catch (InterruptedException ie)
- {
- }
- }
- }
- }
- public void endEvent()
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor", XFactorEvent.validoutcome());
- XFactorEvent.sendPacket(message);
- XFactorEvent.stopFight();
- this.scheduleEventStart();
- }
- public void skipDelay()
- {
- if (_task.nextRun.cancel(false))
- {
- _task.setStartTime(System.currentTimeMillis());
- ThreadPoolManager.getInstance().executeTask(_task);
- }
- }
- class XFactorStartTask implements Runnable
- {
- private long _startTime;
- public ScheduledFuture<?> nextRun;
- public XFactorStartTask(long startTime)
- {
- _startTime = startTime;
- }
- public void setStartTime(long startTime)
- {
- _startTime = startTime;
- }
- public void run()
- {
- int delay = (int) Math.round((_startTime - System.currentTimeMillis()) / 1000.0);
- if (delay > 0)
- {
- this.announce(delay);
- }
- int nextMsg = 0;
- if (delay > 3600)
- {
- nextMsg = delay - 3600;
- }
- else if (delay > 1800)
- {
- nextMsg = delay - 1800;
- }
- else if (delay > 900)
- {
- nextMsg = delay - 900;
- }
- else if (delay > 600)
- {
- nextMsg = delay - 600;
- }
- else if (delay > 300)
- {
- nextMsg = delay - 300;
- }
- else if (delay > 60)
- {
- nextMsg = delay - 60;
- }
- else if (delay > 5)
- {
- nextMsg = delay - 5;
- }
- else if (delay > 0)
- {
- nextMsg = delay;
- }
- else
- {
- // start
- if (XFactorEvent.isInactive())
- {
- XFactorManager.this.startReg();
- }
- else if (XFactorEvent.isParticipating())
- {
- XFactorManager.this.startEvent();
- }
- else
- {
- XFactorManager.this.endEvent();
- }
- }
- if (delay > 0)
- {
- nextRun = ThreadPoolManager.getInstance().scheduleGeneral(this, nextMsg*1000);
- }
- }
- private void announce(long time)
- {
- if (time >= 3600 && time % 3600 == 0)
- {
- if (XFactorEvent.isParticipating())
- {
- for (L2PcInstance onlinePlayer : myplayers)
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", ""+ (time / 60 / 60) + " hour(s) until validation is over");
- onlinePlayer.sendPacket(message);
- }
- }
- }
- else if (time >= 60)
- {
- if (XFactorEvent.isParticipating())
- {
- for (L2PcInstance onlinePlayer : myplayers)
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", ""+ (time / 60) + " minute(s) until validation is over!");
- onlinePlayer.sendPacket(message);
- }
- }
- }
- else
- {
- if (XFactorEvent.isParticipating())
- {
- for (L2PcInstance onlinePlayer : myplayers)
- {
- CreatureSay message = new CreatureSay(0, 15, "XFactor Event", ""+ time + " second(s) until validation is over!");
- onlinePlayer.sendPacket(message);
- }
- }
- }
- }
- }
- }
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorEventTeleporter.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorEventTeleporter.java (revision 0)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorEventTeleporter.java (revision 0)
- @@ -0,0 +1,98 @@
- /*
- * 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.entity;
- import net.sf.l2j.Config;
- import net.sf.l2j.gameserver.ThreadPoolManager;
- import net.sf.l2j.gameserver.datatables.SkillTable;
- import net.sf.l2j.gameserver.model.L2Skill;
- import net.sf.l2j.gameserver.model.actor.L2Summon;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.util.Rnd;
- public class XFactorEventTeleporter implements Runnable
- {
- private L2PcInstance _playerInstance = null;
- private int[] _coordinates = new int[3];
- private boolean _adminRemove = false;
- public XFactorEventTeleporter(L2PcInstance playerInstance, int[] coordinates, boolean fastSchedule, boolean adminRemove)
- {
- _playerInstance = playerInstance;
- _coordinates = coordinates;
- _adminRemove = adminRemove;
- long delay = (XFactorEvent.isStarted() ? Config.XFactor_EVENT_RESPAWN_TELEPORT_DELAY : Config.XFactor_EVENT_START_LEAVE_TELEPORT_DELAY) * 1000;
- ThreadPoolManager.getInstance().scheduleGeneral(this, fastSchedule ? 0 : delay);
- }
- public void run()
- {
- if (_playerInstance == null)
- {
- return;
- }
- L2Summon summon = _playerInstance.getPet();
- if (summon != null)
- {
- summon.unSummon(_playerInstance);
- }
- L2Skill noblesse = SkillTable.getInstance().getInfo(1323, 1);
- noblesse.getEffects(_playerInstance, _playerInstance);
- _playerInstance.doRevive();
- _playerInstance.setCurrentCp(_playerInstance.getMaxCp());
- _playerInstance.setCurrentHp(_playerInstance.getMaxHp());
- _playerInstance.setCurrentMp(_playerInstance.getMaxMp());
- _playerInstance.setInstanceId(0);
- /*if (XFactorEvent.isStarted() || XFactorEvent.isStarting())
- {
- _playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(1150)-50, _coordinates[ 1 ] + Rnd.get(1150)-50, _coordinates[ 2 ], false );
- }
- */
- if (XFactorEvent.isInactivating() || XFactorEvent.isRewarding() || XFactorEvent.isInactive())
- {
- _playerInstance.teleToLocation( _coordinates[ 0 ] + Rnd.get(101)-50, _coordinates[ 1 ] + Rnd.get(101)-50, _coordinates[ 2 ], false );
- }
- if (_playerInstance._XFactorstate == true)
- {
- _playerInstance.teleToLocation(45451 + Rnd.get(120)-50, 48530 + Rnd.get(120)-50, -3059, false );
- _playerInstance.sendMessage("porting back to base due to a preperation period.");
- }
- if (XFactorEvent.isStarted() && !_adminRemove)
- {
- _playerInstance.setTeam(1);
- }
- else
- {
- _playerInstance.setTeam(0);
- }
- _playerInstance.broadcastStatusUpdate();
- _playerInstance.broadcastUserInfo();
- }
- }
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorEventTeam.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorEventTeam.java (revision 0)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/entity/XFactorEventTeam.java (revision 0)
- @@ -0,0 +1,137 @@
- /*
- * 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.entity;
- import java.util.Map;
- import javolution.util.FastMap;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- public class XFactorEventTeam
- {
- private String _name;
- private int[] _coordinates = new int[3];
- private short _points;
- private Map<Integer, L2PcInstance> _participatedPlayers = new FastMap<Integer, L2PcInstance>();
- public XFactorEventTeam(String name, int[] coordinates)
- {
- _name = name;
- _coordinates = coordinates;
- _points = 0;
- }
- public boolean addPlayer(L2PcInstance playerInstance)
- {
- if (playerInstance == null)
- {
- return false;
- }
- synchronized (_participatedPlayers)
- {
- _participatedPlayers.put(playerInstance.getObjectId(), playerInstance);
- }
- return true;
- }
- public void removePlayer(int playerObjectId)
- {
- synchronized (_participatedPlayers)
- {
- _participatedPlayers.remove(playerObjectId);
- }
- }
- public void increasePoints()
- {
- ++_points;
- }
- public void cleanMe()
- {
- _participatedPlayers.clear();
- _participatedPlayers = new FastMap<Integer, L2PcInstance>();
- _points = 0;
- }
- public boolean containsPlayer(int playerObjectId)
- {
- boolean containsPlayer;
- synchronized (_participatedPlayers)
- {
- containsPlayer = _participatedPlayers.containsKey(playerObjectId);
- }
- return containsPlayer;
- }
- public String getName()
- {
- return _name;
- }
- public int[] getCoordinates()
- {
- return _coordinates;
- }
- public short getPoints()
- {
- return _points;
- }
- public Map<Integer, L2PcInstance> getParticipatedPlayers()
- {
- Map<Integer, L2PcInstance> participatedPlayers = null;
- synchronized (_participatedPlayers)
- {
- participatedPlayers = _participatedPlayers;
- }
- return participatedPlayers;
- }
- public int getParticipatedPlayerCount()
- {
- int participatedPlayerCount;
- synchronized (_participatedPlayers)
- {
- participatedPlayerCount = _participatedPlayers.size();
- }
- return participatedPlayerCount;
- }
- }
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java (revision 2944)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/model/olympiad/Olympiad.java (working copy)
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.entity.Hero;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- +import net.sf.l2j.gameserver.model.entity.XFactorEvent;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.NpcHtmlMessage;
- import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- @@ -870,13 +873,38 @@
- spectator.sendPacket(new SystemMessage(SystemMessageId.WHILE_YOU_ARE_ON_THE_WAITING_LIST_YOU_ARE_NOT_ALLOWED_TO_WATCH_THE_GAME));
- return;
- }
- if (!XFactorEvent.isInactive()
- && XFactorEvent.isPlayerParticipant(spectator.getObjectId()))
- {
- spectator.sendMessage("You can not observe games while registered for XFactor");
- return;
- }
- //Xfactor
- ndex: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillMount.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillMount.java (revision 2944)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/skills/l2skills/L2SkillMount.java (working copy)
- @@ -19,6 +19,9 @@
- import net.sf.l2j.gameserver.model.actor.L2Character;
- import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
- import net.sf.l2j.gameserver.model.entity.TvTEvent;
- +import net.sf.l2j.gameserver.model.entity.XFactorEvent;
- import net.sf.l2j.gameserver.network.SystemMessageId;
- import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
- import net.sf.l2j.gameserver.templates.StatsSet;
- @@ -43,7 +46,13 @@
- if (!TvTEvent.onItemSummon(caster.getObjectId()))
- return;
- if (!XFactorEvent.onItemSummon(caster.getObjectId()))
- return;
- Index: C:/l2j core/Shadow/java/net/sf/l2j/gameserver/GameServer.java
- ===================================================================
- --- C:/l2j core/Shadow/java/net/sf/l2j/gameserver/GameServer.java (revision 2944)
- +++ C:/l2j core/Shadow/java/net/sf/l2j/gameserver/GameServer.java (working copy)
- @@ -101,6 +101,9 @@
- import net.sf.l2j.gameserver.model.L2World;
- import net.sf.l2j.gameserver.model.entity.Hero;
- import net.sf.l2j.gameserver.model.entity.TvTManager;
- +import net.sf.l2j.gameserver.model.entity.XFactorManager;
- import net.sf.l2j.gameserver.model.olympiad.Olympiad;
- import net.sf.l2j.gameserver.network.L2GameClient;
- import net.sf.l2j.gameserver.network.L2GamePacketHandler;
- @@ -451,7 +454,11 @@
- {
- _log.log(Level.WARNING, "DynamicExtension could not be loaded and initialized", ex);
- }
- + XFactorManager.getInstance();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement