Index: java/config/altsettings.properties =================================================================== --- java/config/altsettings.properties (revision 1224) +++ java/config/altsettings.properties (working copy) @@ -256,7 +256,7 @@ #----------------------------------- # Minimal party size to enter rift. Min = 2, Max = 9. # If in rift party will become smaller all members will be teleported back -RiftMinPartySize = 5 +RiftMinPartySize = 2 # Number of maximum jumps between rooms allowed, after this time party will be teleported back MaxRiftJumps = 4 Index: java/config/sevensigns.properties =================================================================== --- java/config/sevensigns.properties (revision 1224) +++ java/config/sevensigns.properties (working copy) @@ -8,11 +8,11 @@ # ----------------------------------------- # Require a player to be in a castle/alliance-owning clan to be able to sign for Dawn. -AltRequireCastleForDawn = False +AltDenyDuskForCastle = True # Determines whether castle ownership is determined by clan or by alliance. # Default is by alliance, as on official servers. -AltRequireClanCastle = False +AltRequireClanCastle = True # ----------------------------------------- # Festival Rules. @@ -56,4 +56,4 @@ # At what point the Chests Spawn in. # Default : 15 minutes -AltFestivalChestspawn = 900000 +AltFestivalChestSpawn = 900000 Index: java/net/sf/l2j/Config.java =================================================================== --- java/net/sf/l2j/Config.java (revision 1224) +++ java/net/sf/l2j/Config.java (working copy) @@ -165,8 +165,8 @@ /** Alternative gameing - magic dmg failures */ public static boolean ALT_GAME_MAGICFAILURES; - /** Alternative gaming - player must be in a castle-owning clan or ally to sign up for Dawn. */ - public static boolean ALT_GAME_REQUIRE_CASTLE_DAWN; + /** Alternative gaming - player must not be in a castle-owning clan or ally to sign up for Dusk. */ + public static boolean ALT_GAME_DENY_DUSK_CASTLE; /** Alternative gaming - allow clan-based castle ownage check rather than ally-based. */ public static boolean ALT_GAME_REQUIRE_CLAN_CASTLE; @@ -1720,8 +1720,8 @@ SevenSettings.load(is); is.close(); - ALT_GAME_REQUIRE_CASTLE_DAWN = Boolean.parseBoolean(SevenSettings.getProperty("AltRequireCastleForDawn", "False")); - ALT_GAME_REQUIRE_CLAN_CASTLE = Boolean.parseBoolean(SevenSettings.getProperty("AltRequireClanCastle", "False")); + ALT_GAME_DENY_DUSK_CASTLE = Boolean.parseBoolean(SevenSettings.getProperty("AltDenyDuskForCastle", "True")); + ALT_GAME_REQUIRE_CLAN_CASTLE = Boolean.parseBoolean(SevenSettings.getProperty("AltRequireClanCastle", "True")); ALT_FESTIVAL_MIN_PLAYER = Integer.parseInt(SevenSettings.getProperty("AltFestivalMinPlayer", "5")); ALT_MAXIMUM_PLAYER_CONTRIB = Integer.parseInt(SevenSettings.getProperty("AltMaxPlayerContrib", "1000000")); ALT_FESTIVAL_MANAGER_START = Long.parseLong(SevenSettings.getProperty("AltFestivalManagerStart", "120000")); @@ -2325,7 +2325,7 @@ else if (pName.equalsIgnoreCase("AltKarmaPlayerCanTeleport")) ALT_GAME_KARMA_PLAYER_CAN_TELEPORT = Boolean.valueOf(pValue); else if (pName.equalsIgnoreCase("AltKarmaPlayerCanTrade")) ALT_GAME_KARMA_PLAYER_CAN_TRADE = Boolean.valueOf(pValue); else if (pName.equalsIgnoreCase("AltKarmaPlayerCanUseWareHouse")) ALT_GAME_KARMA_PLAYER_CAN_USE_WAREHOUSE = Boolean.valueOf(pValue); - else if (pName.equalsIgnoreCase("AltRequireCastleForDawn")) ALT_GAME_REQUIRE_CASTLE_DAWN = Boolean.valueOf(pValue); + else if (pName.equalsIgnoreCase("AltDenyDuskForCastle")) ALT_GAME_DENY_DUSK_CASTLE = Boolean.valueOf(pValue); else if (pName.equalsIgnoreCase("AltRequireClanCastle")) ALT_GAME_REQUIRE_CLAN_CASTLE = Boolean.valueOf(pValue); else if (pName.equalsIgnoreCase("AltFreeTeleporting")) ALT_GAME_FREE_TELEPORT = Boolean.valueOf(pValue); else if (pName.equalsIgnoreCase("AltSubClassWithoutQuests")) ALT_GAME_SUBCLASS_WITHOUT_QUESTS = Boolean.valueOf(pValue); Index: java/net/sf/l2j/gameserver/model/actor/instance/L2FestivalGuideInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2FestivalGuideInstance.java (revision 1224) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2FestivalGuideInstance.java (working copy) @@ -61,7 +61,7 @@ case 31132: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_31; _festivalOracle = SevenSigns.CABAL_DAWN; - _blueStonesNeeded = 900; + _blueStonesNeeded = 900; _greenStonesNeeded = 540; _redStonesNeeded = 270; break; @@ -69,7 +69,7 @@ case 31133: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_42; _festivalOracle = SevenSigns.CABAL_DAWN; - _blueStonesNeeded = 1500; + _blueStonesNeeded = 1500; _greenStonesNeeded = 900; _redStonesNeeded = 450; break; @@ -77,7 +77,7 @@ case 31134: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_53; _festivalOracle = SevenSigns.CABAL_DAWN; - _blueStonesNeeded = 3000; + _blueStonesNeeded = 3000; _greenStonesNeeded = 1800; _redStonesNeeded = 900; break; @@ -85,7 +85,7 @@ case 31135: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_64; _festivalOracle = SevenSigns.CABAL_DAWN; - _blueStonesNeeded = 4500; + _blueStonesNeeded = 4500; _greenStonesNeeded = 2700; _redStonesNeeded = 1350; break; @@ -93,7 +93,7 @@ case 31136: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_NONE; _festivalOracle = SevenSigns.CABAL_DAWN; - _blueStonesNeeded = 6000; + _blueStonesNeeded = 6000; _greenStonesNeeded = 3600; _redStonesNeeded = 1800; break; @@ -102,7 +102,7 @@ case 31142: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_31; _festivalOracle = SevenSigns.CABAL_DUSK; - _blueStonesNeeded = 900; + _blueStonesNeeded = 900; _greenStonesNeeded = 540; _redStonesNeeded = 270; break; @@ -110,7 +110,7 @@ case 31143: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_42; _festivalOracle = SevenSigns.CABAL_DUSK; - _blueStonesNeeded = 1500; + _blueStonesNeeded = 1500; _greenStonesNeeded = 900; _redStonesNeeded = 450; break; @@ -118,7 +118,7 @@ case 31144: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_53; _festivalOracle = SevenSigns.CABAL_DUSK; - _blueStonesNeeded = 3000; + _blueStonesNeeded = 3000; _greenStonesNeeded = 1800; _redStonesNeeded = 900; break; @@ -126,7 +126,7 @@ case 31145: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_64; _festivalOracle = SevenSigns.CABAL_DUSK; - _blueStonesNeeded = 4500; + _blueStonesNeeded = 4500; _greenStonesNeeded = 2700; _redStonesNeeded = 1350; break; @@ -134,7 +134,7 @@ case 31146: _festivalType = SevenSignsFestival.FESTIVAL_LEVEL_MAX_NONE; _festivalOracle = SevenSigns.CABAL_DUSK; - _blueStonesNeeded = 6000; + _blueStonesNeeded = 6000; _greenStonesNeeded = 3600; _redStonesNeeded = 1800; break; @@ -158,7 +158,7 @@ switch (val) { case 1: // Become a Participant // Check if the festival period is active, if not then don't allow registration. - if (SevenSigns.getInstance().isSealValidationPeriod()) + if (!SevenSigns.getInstance().isCompetitionPeriod()) { showChatWindow(player, 2, "a", false); return; @@ -237,7 +237,7 @@ break; case 3: // Score Registration // Check if the festival period is active, if not then don't register the score. - if (SevenSigns.getInstance().isSealValidationPeriod()) + if (!SevenSigns.getInstance().isCompetitionPeriod()) { showChatWindow(player, 3, "a", false); return; @@ -286,6 +286,7 @@ offeringCount = bloodOfferings.getCount(); int offeringScore = offeringCount * SevenSignsFestival.FESTIVAL_OFFERING_VALUE; + SevenSignsFestival.getInstance().addAccumulatedBonus(_festivalType, offeringScore); boolean isHighestScore = SevenSignsFestival.getInstance().setFinalScore(player, _festivalOracle, _festivalType, offeringScore); player.destroyItem("SevenSigns", bloodOfferings, this, false); Index: java/net/sf/l2j/gameserver/model/actor/instance/L2SignsPriestInstance.java =================================================================== --- java/net/sf/l2j/gameserver/model/actor/instance/L2SignsPriestInstance.java (revision 1224) +++ java/net/sf/l2j/gameserver/model/actor/instance/L2SignsPriestInstance.java (working copy) @@ -141,6 +141,12 @@ showChatWindow(player, val, SevenSigns.getCabalShortName(cabal), false); break; case 4: // Join a Cabal - SevenSigns 4 [0]1 x + if (!SevenSigns.getInstance().isCompetitionPeriod()) + { + player.sendMessage("You can join a cabal only during the competition period."); + return; + } + int newSeal = Integer.parseInt(command.substring(15)); int oldCabal = SevenSigns.getInstance().getPlayerCabal(player); @@ -156,68 +162,56 @@ player.sendMessage("You must have already completed your first class transfer."); break; } - else if (player.getClassId().level() >= 2) + else { - if (Config.ALT_GAME_REQUIRE_CASTLE_DAWN) - { - if (getPlayerAllyHasCastle(player)) + if (cabal == SevenSigns.CABAL_DUSK) + { + if (Config.ALT_GAME_DENY_DUSK_CASTLE && getPlayerClanHasCastle(player)) { - if (cabal == SevenSigns.CABAL_DUSK) - { - player.sendMessage("You must not be a member of a castle-owning clan to join the Revolutionaries of Dusk."); - return; - } + player.sendMessage("You must not be a member of a castle-owning clan to join the Revolutionaries of Dusk."); + return; } - /*if (!getPlayerAllyHasCastle(player)) + } + else if (cabal == SevenSigns.CABAL_DAWN) + { + /* + * If the player is trying to join the Lords of Dawn, check if they are + * carrying a Lord's certificate. + * + * If not then try to take the required amount of adena instead. + */ + if (player.getClassId().level() >= 2) { - if (cabal == SevenSigns.CABAL_DAWN) - { - player.sendMessage("You must be a member of a castle-owning clan to join the Lords Of Dawn."); - return; - } - } -*/ - else - { - /* - * If the player is trying to join the Lords of Dawn, check if they are - * carrying a Lord's certificate. - * - * If not then try to take the required amount of adena instead. - */ - if (cabal == SevenSigns.CABAL_DAWN) + boolean allowJoinDawn = false; + + if (player.destroyItemByItemId( + "SevenSigns", + SevenSigns.CERTIFICATE_OF_APPROVAL_ID, + 1, this, false)) { - boolean allowJoinDawn = false; + sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM); + sm.addNumber(1); + sm.addItemName(SevenSigns.CERTIFICATE_OF_APPROVAL_ID); + player.sendPacket(sm); + allowJoinDawn = true; + } + else if (player.reduceAdena("SevenSigns", + SevenSigns.ADENA_JOIN_DAWN_COST, this, + false)) + { + sm = new SystemMessage(SystemMessageId.DISSAPEARED_ADENA); + sm.addNumber(SevenSigns.ADENA_JOIN_DAWN_COST); + player.sendPacket(sm); + allowJoinDawn = true; + } - if (player.destroyItemByItemId( - "SevenSigns", - SevenSigns.CERTIFICATE_OF_APPROVAL_ID, - 1, this, false)) - { - sm = new SystemMessage(SystemMessageId.DISSAPEARED_ITEM); - sm.addNumber(1); - sm.addItemName(SevenSigns.CERTIFICATE_OF_APPROVAL_ID); - player.sendPacket(sm); - allowJoinDawn = true; - } - else if (player.reduceAdena("SevenSigns", - SevenSigns.ADENA_JOIN_DAWN_COST, this, - false)) - { - sm = new SystemMessage(SystemMessageId.DISSAPEARED_ADENA); - sm.addNumber(SevenSigns.ADENA_JOIN_DAWN_COST); - player.sendPacket(sm); - allowJoinDawn = true; - } - - if (!allowJoinDawn) - { - player.sendMessage("You must be a member of a castle-owning clan, have a Certificate of Lord's Approval, or pay 50000 adena to join the Lords of Dawn."); - return; - } + if (!allowJoinDawn) + { + player.sendMessage("You must be a member of a castle-owning clan, have a Certificate of Lord's Approval, or pay 50000 adena to join the Lords of Dawn."); + return; } } - } + } } SevenSigns.getInstance().setPlayerInfo(player, cabal, newSeal); @@ -587,7 +581,7 @@ } } - private final boolean getPlayerAllyHasCastle(L2PcInstance player) + private final boolean getPlayerClanHasCastle(L2PcInstance player) { L2Clan playerClan = player.getClan(); Index: java/net/sf/l2j/gameserver/serverpackets/SSQStatus.java =================================================================== --- java/net/sf/l2j/gameserver/serverpackets/SSQStatus.java (revision 1224) +++ java/net/sf/l2j/gameserver/serverpackets/SSQStatus.java (working copy) @@ -25,7 +25,6 @@ import net.sf.l2j.gameserver.SevenSignsFestival; import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance; import net.sf.l2j.gameserver.network.SystemMessageId; -import net.sf.l2j.gameserver.templates.StatsSet; /** * Seven Signs Record Update @@ -193,14 +192,13 @@ // Dusk Score \\ writeD(duskScore); - StatsSet highScoreData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DUSK, i); - String[] partyMembers = highScoreData.getString("members").split(","); + String[] duskPartyMembers = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DUSK, i).getString("members").split(","); - if (partyMembers != null) + if (duskPartyMembers != null && !duskPartyMembers[0].equals("")) { - writeC(partyMembers.length); + writeC(duskPartyMembers.length); - for (String partyMember : partyMembers) + for (String partyMember : duskPartyMembers) writeS(partyMember); } else @@ -211,14 +209,13 @@ // Dawn Score \\ writeD(dawnScore); - highScoreData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DAWN, i); - partyMembers = highScoreData.getString("members").split(","); + String[] dawnPartyMembers = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DAWN, i).getString("members").split(","); - if (partyMembers != null) + if (dawnPartyMembers != null && !dawnPartyMembers[0].equals("")) { - writeC(partyMembers.length); + writeC(dawnPartyMembers.length); - for (String partyMember : partyMembers) + for (String partyMember : dawnPartyMembers) writeS(partyMember); } else Index: java/net/sf/l2j/gameserver/SevenSigns.java =================================================================== --- java/net/sf/l2j/gameserver/SevenSigns.java (revision 1224) +++ java/net/sf/l2j/gameserver/SevenSigns.java (working copy) @@ -478,6 +478,16 @@ { return (_activePeriod == PERIOD_SEAL_VALIDATION); } + + public final boolean isRecruitingPeriod() + { + return (_activePeriod == PERIOD_COMP_RECRUITING); + } + + public final boolean isCompetitionPeriod() + { + return (_activePeriod == PERIOD_COMPETITION); + } public final boolean isCompResultsPeriod() { @@ -1369,6 +1379,8 @@ _log.info("SevenSigns: The " + getCabalName(_previousWinner) + " have won the competition with " + getCurrentScore(_previousWinner) + " points!"); break; case PERIOD_SEAL_VALIDATION: // Reset for New Cycle + + _currentCycle++; SevenSignsFestival.getInstance().rewardHighestRanked(); // reward highest ranking members from cycle @@ -1391,8 +1403,6 @@ _dawnFestivalScore = 0; _duskFestivalScore = 0; - - _currentCycle++; break; } Index: java/net/sf/l2j/gameserver/SevenSignsFestival.java =================================================================== --- java/net/sf/l2j/gameserver/SevenSignsFestival.java (revision 1224) +++ java/net/sf/l2j/gameserver/SevenSignsFestival.java (working copy) @@ -23,6 +23,8 @@ import java.sql.SQLException; import java.util.List; import java.util.Map; +import java.util.Timer; +import java.util.TimerTask; import java.util.concurrent.ScheduledFuture; import java.util.logging.Logger; @@ -816,7 +818,7 @@ restoreFestivalData(); - if (SevenSigns.getInstance().isSealValidationPeriod()) + if (!SevenSigns.getInstance().isCompetitionPeriod()) { _log.info("SevenSignsFestival: Initialization bypassed due to Seal Validation in effect."); return; @@ -1330,7 +1332,7 @@ public final int getMinsToNextCycle() { - if (SevenSigns.getInstance().isSealValidationPeriod()) + if (!SevenSigns.getInstance().isCompetitionPeriod()) return -1; return Math.round((_nextFestivalCycleStart - System.currentTimeMillis()) / 60000); @@ -1338,7 +1340,7 @@ public final int getMinsToNextFestival() { - if (SevenSigns.getInstance().isSealValidationPeriod()) + if (!SevenSigns.getInstance().isCompetitionPeriod()) return -1; return Math.round((_nextFestivalStart - System.currentTimeMillis()) / 60000) + 1; @@ -1346,7 +1348,7 @@ public final String getTimeToNextFestivalStr() { - if (SevenSigns.getInstance().isSealValidationPeriod()) + if (!SevenSigns.getInstance().isCompetitionPeriod()) return "This is the Seal Validation period. Festivals will resume next week."; return "The next festival will begin in " + getMinsToNextFestival() + " minute(s)."; @@ -1398,7 +1400,7 @@ public final boolean isParticipant(L2PcInstance player) { - if (SevenSigns.getInstance().isSealValidationPeriod()) + if (!SevenSigns.getInstance().isCompetitionPeriod()) return false; if (_managerInstance == null) @@ -1598,11 +1600,6 @@ // Check if this is the highest score for this level range so far for the player's cabal. if (offeringScore > thisCabalHighScore) { - // If the current score is greater than that for the other cabal, - // then they already have the points from this festival. - if (thisCabalHighScore > otherCabalHighScore) - return false; - partyMembers = new FastList(); List prevParticipants = getPreviousParticipants(oracle, festivalId); @@ -1620,14 +1617,14 @@ offeringScore + ") so far for " + SevenSigns.getCabalName(oracle) + " in " + getFestivalName(festivalId)); // Only add the score to the cabal's overall if it's higher than the other cabal's score. - if (offeringScore > otherCabalHighScore) + if (offeringScore > otherCabalHighScore && !(thisCabalHighScore > otherCabalHighScore)) { int contribPoints = FESTIVAL_LEVEL_SCORES[festivalId]; // Give this cabal the festival points, while deducting them from the other. SevenSigns.getInstance().addFestivalScore(oracle, contribPoints); - //if (Config.DEBUG) + if (Config.DEBUG) _log.info("SevenSignsFestival: This is the highest score overall so far for the " + getFestivalName(festivalId) + " festival!"); } @@ -1675,6 +1672,12 @@ _accumulatedBonuses.set(festivalId, newTotalBonus); } + public void addAccumulatedBonus(int festivalId, int amount) + { + int newTotalBonus = _accumulatedBonuses.get(festivalId) + amount; + _accumulatedBonuses.set(festivalId, newTotalBonus); + } + /** * Calculate and return the proportion of the accumulated bonus for the festival * where the player was in the winning party, if the winning party's cabal won the event. @@ -1785,6 +1788,20 @@ private class FestivalManager implements Runnable { protected Map _festivalInstances; + Timer _festivalStart; + TimerTask _festivalStartTask; + Timer _festivalFirstSpawn; + TimerTask _festivalFirstSpawnTask; + Timer _festivalFirstSwarm; + TimerTask _festivalFirstSwarmTask; + Timer _festivalSecondSpawn; + TimerTask _festivalSecondSpawnTask; + Timer _festivalSecondSwarm; + TimerTask _festivalSecondSwarmTask; + Timer _festivalChestSpawn; + TimerTask _festivalChestSpawnTask; + Timer _festivalEnd; + TimerTask _festivalEndTask; public FestivalManager() { @@ -1799,12 +1816,12 @@ setNextFestivalStart(Config.ALT_FESTIVAL_CYCLE_LENGTH - FESTIVAL_SIGNUP_TIME); } - public synchronized void run() + public void run() { // The manager shouldn't be running if Seal Validation is in effect. - if (SevenSigns.getInstance().isSealValidationPeriod()) - return; - + if (!SevenSigns.getInstance().isCompetitionPeriod()) + return; + // If the next period is due to start before the end of this // festival cycle, then don't run it. if (SevenSigns.getInstance().getMilliToPeriodChange() < Config.ALT_FESTIVAL_CYCLE_LENGTH) @@ -1814,154 +1831,269 @@ _log.info("SevenSignsFestival: Festival manager initialized. Those wishing to participate have " + getMinsToNextFestival() + " minute(s) to sign up."); sendMessageToAll("Festival Guide", "The main event will start in " + getMinsToNextFestival() + " minutes. Please register now."); - - // Stand by until the allowed signup period has elapsed. - try { - wait(FESTIVAL_SIGNUP_TIME); - } - catch (InterruptedException e) { } - - // Clear past participants, they can no longer register their score if not done so already. - _dawnPreviousParticipants.clear(); - _duskPreviousParticipants.clear(); - - // Get rid of random monsters that avoided deletion after last festival - for (L2DarknessFestival festivalInst : _festivalInstances.values()) - festivalInst.unspawnMobs(); - - /* INITIATION */ - // Set the festival timer to 0, as it is just beginning. - long elapsedTime = 0; - - // Create the instances for the festivals in both Oracles, - // but only if they have participants signed up for them. - for (int i = 0; i < FESTIVAL_COUNT; i++) - { - if (_duskFestivalParticipants.get(i) != null) - _festivalInstances.put(10 + i, new L2DarknessFestival(SevenSigns.CABAL_DUSK, i)); - - if (_dawnFestivalParticipants.get(i) != null) - _festivalInstances.put(20 + i, new L2DarknessFestival(SevenSigns.CABAL_DAWN, i)); - } - - // Prevent future signups while festival is in progress. - _festivalInitialized = true; - - setNextFestivalStart(Config.ALT_FESTIVAL_CYCLE_LENGTH); - sendMessageToAll("Festival Guide", "The main event is now starting."); - - if (Config.DEBUG) - _log.info("SevenSignsFestival: The current set of festivals will begin in " + (Config.ALT_FESTIVAL_FIRST_SPAWN / 60000) + " minute(s)."); - - // Stand by for a short length of time before starting the festival. - try { - wait(Config.ALT_FESTIVAL_FIRST_SPAWN); - } - catch (InterruptedException e) { } - - elapsedTime = Config.ALT_FESTIVAL_FIRST_SPAWN; - - // Participants can now opt to increase the challenge, if desired. - _festivalInProgress = true; - - - /* PROPOGATION */ - // Sequentially set all festivals to begin, spawn the Festival Witch and notify participants. - for (L2DarknessFestival festivalInst : _festivalInstances.values()) - { - festivalInst.festivalStart(); - festivalInst.sendMessageToParticipants("The festival is about to begin!"); - } - - if (Config.DEBUG) - _log.info("SevenSignsFestival: Each of the festivals will end in " + (Config.ALT_FESTIVAL_LENGTH / 60000) + " minutes. New participants can signup then."); - - - // After a short time period, move all idle spawns to the center of the arena. - try { - wait(Config.ALT_FESTIVAL_FIRST_SWARM - Config.ALT_FESTIVAL_FIRST_SPAWN); - } - catch (InterruptedException e) { } - - elapsedTime += Config.ALT_FESTIVAL_FIRST_SWARM - Config.ALT_FESTIVAL_FIRST_SPAWN; - - for (L2DarknessFestival festivalInst : _festivalInstances.values()) - festivalInst.moveMonstersToCenter(); - - - // Stand by until the time comes for the second spawn. - try { - wait(Config.ALT_FESTIVAL_SECOND_SPAWN - Config.ALT_FESTIVAL_FIRST_SWARM); - } - catch (InterruptedException e) { } - - // Spawn an extra set of monsters (archers) on the free platforms with - // a faster respawn when killed. - for (L2DarknessFestival festivalInst : _festivalInstances.values()) - { - festivalInst.spawnFestivalMonsters(FESTIVAL_DEFAULT_RESPAWN / 2, 2); - festivalInst.sendMessageToParticipants("The festival will end in " + ((Config.ALT_FESTIVAL_LENGTH - Config.ALT_FESTIVAL_SECOND_SPAWN) / 60000) + " minute(s)."); - } - - elapsedTime += Config.ALT_FESTIVAL_SECOND_SPAWN - Config.ALT_FESTIVAL_FIRST_SWARM; - - - // After another short time period, again move all idle spawns to the center of the arena. - try { - wait(Config.ALT_FESTIVAL_SECOND_SWARM - Config.ALT_FESTIVAL_SECOND_SPAWN); - } - catch (InterruptedException e) { } - - for (L2DarknessFestival festivalInst : _festivalInstances.values()) - festivalInst.moveMonstersToCenter(); - - elapsedTime += Config.ALT_FESTIVAL_SECOND_SWARM - Config.ALT_FESTIVAL_SECOND_SPAWN; - - - // Stand by until the time comes for the chests to be spawned. - try { - wait(Config.ALT_FESTIVAL_CHEST_SPAWN - Config.ALT_FESTIVAL_SECOND_SWARM); - } - catch (InterruptedException e) { } - - // Spawn the festival chests, which enable the team to gain greater rewards - // for each chest they kill. - for (L2DarknessFestival festivalInst : _festivalInstances.values()) - { - festivalInst.spawnFestivalMonsters(FESTIVAL_DEFAULT_RESPAWN, 3); - festivalInst.sendMessageToParticipants("The chests have spawned! Be quick, the festival will end soon."); - } - - elapsedTime += Config.ALT_FESTIVAL_CHEST_SPAWN - Config.ALT_FESTIVAL_SECOND_SWARM; - - // Stand by and wait until it's time to end the festival. - try { - wait(Config.ALT_FESTIVAL_LENGTH - elapsedTime); - } - catch (InterruptedException e) { } - - // Participants can no longer opt to increase the challenge, as the festival will soon close. - _festivalInProgress = false; - - - /* TERMINATION */ - // Sequentially begin the ending sequence for all running festivals. - for (L2DarknessFestival festivalInst : _festivalInstances.values()) - festivalInst.festivalEnd(); - - // Clear the participants list for the next round of signups. - _dawnFestivalParticipants.clear(); - _duskFestivalParticipants.clear(); - - // Allow signups for the next festival cycle. - _festivalInitialized = false; - - sendMessageToAll("Festival Witch", "That will do! I'll move you to the outside soon."); - - if (Config.DEBUG) - _log.info("SevenSignsFestival: The next set of festivals begin in " + getMinsToNextFestival() + " minute(s)."); + + createStartTask(); + createFirstSpawnTask(); + createFirstSwarmTask(); + createSecondSpawnTask(); + createSecondSwarmTask(); + createChestSpawnTask(); + createEndTask(); } + private void createStartTask() + { + if(_festivalStartTask != null) + { + _festivalStartTask.cancel(); + _festivalStartTask = null; + } + + if(_festivalStart != null) + { + _festivalStart.cancel(); + _festivalStart = null; + } + + _festivalStart = new Timer(); + _festivalStartTask = new TimerTask() + { + @Override + public void run() + { + // Clear past participants, they can no longer register their score if not done so already. + _dawnPreviousParticipants.clear(); + _duskPreviousParticipants.clear(); + + // Get rid of random monsters that avoided deletion after last festival + for (L2DarknessFestival festivalInst : _festivalInstances.values()) + festivalInst.unspawnMobs(); + + // Create the instances for the festivals in both Oracles, + // but only if they have participants signed up for them. + for (int i = 0; i < FESTIVAL_COUNT; i++) + { + if (_duskFestivalParticipants.get(i) != null) + _festivalInstances.put(10 + i, new L2DarknessFestival(SevenSigns.CABAL_DUSK, i)); + + if (_dawnFestivalParticipants.get(i) != null) + _festivalInstances.put(20 + i, new L2DarknessFestival(SevenSigns.CABAL_DAWN, i)); + } + + // Prevent future signups while festival is in progress. + _festivalInitialized = true; + + setNextFestivalStart(Config.ALT_FESTIVAL_CYCLE_LENGTH); + sendMessageToAll("Festival Guide", "The main event is now starting."); + + if (Config.DEBUG) + _log.info("SevenSignsFestival: The current set of festivals will begin in " + (Config.ALT_FESTIVAL_FIRST_SPAWN / 60000) + " minute(s)."); + } + }; + _festivalStart.schedule(_festivalStartTask, FESTIVAL_SIGNUP_TIME); + } + + private void createFirstSpawnTask() + { + if(_festivalFirstSpawnTask != null) + { + _festivalFirstSpawnTask.cancel(); + _festivalFirstSpawnTask = null; + } + + if(_festivalFirstSpawn != null) + { + _festivalFirstSpawn.cancel(); + _festivalFirstSpawn = null; + } + + _festivalFirstSpawn = new Timer(); + _festivalFirstSpawnTask = new TimerTask() + { + @Override + public void run() + { + // Participants can now opt to increase the challenge, if desired. + _festivalInProgress = true; + + + /* PROPOGATION */ + // Sequentially set all festivals to begin, spawn the Festival Witch and notify participants. + for (L2DarknessFestival festivalInst : _festivalInstances.values()) + { + festivalInst.festivalStart(); + festivalInst.sendMessageToParticipants("The festival is about to begin!"); + } + + if (Config.DEBUG) + _log.info("SevenSignsFestival: Each of the festivals will end in " + (Config.ALT_FESTIVAL_LENGTH / 60000) + " minutes. New participants can signup then."); + } + }; + _festivalFirstSpawn.schedule(_festivalFirstSpawnTask, (FESTIVAL_SIGNUP_TIME + Config.ALT_FESTIVAL_FIRST_SPAWN)); + } + + private void createFirstSwarmTask() + { + if(_festivalFirstSwarmTask != null) + { + _festivalFirstSwarmTask.cancel(); + _festivalFirstSwarmTask = null; + } + + if(_festivalFirstSwarm != null) + { + _festivalFirstSwarm.cancel(); + _festivalFirstSwarm = null; + } + + _festivalFirstSwarm = new Timer(); + _festivalFirstSwarmTask = new TimerTask() + { + @Override + public void run() + { + for (L2DarknessFestival festivalInst : _festivalInstances.values()) + festivalInst.moveMonstersToCenter(); + } + }; + _festivalFirstSwarm.schedule(_festivalFirstSwarmTask, (FESTIVAL_SIGNUP_TIME + Config.ALT_FESTIVAL_FIRST_SWARM)); + } + + private void createSecondSpawnTask() + { + if(_festivalSecondSpawnTask != null) + { + _festivalSecondSpawnTask.cancel(); + _festivalSecondSpawnTask = null; + } + + if(_festivalSecondSpawn != null) + { + _festivalSecondSpawn.cancel(); + _festivalSecondSpawn = null; + } + + _festivalSecondSpawn = new Timer(); + _festivalSecondSpawnTask = new TimerTask() + { + @Override + public void run() + { + // Spawn an extra set of monsters (archers) on the free platforms with + // a faster respawn when killed. + for (L2DarknessFestival festivalInst : _festivalInstances.values()) + { + festivalInst.spawnFestivalMonsters(FESTIVAL_DEFAULT_RESPAWN / 2, 2); + festivalInst.sendMessageToParticipants("The festival will end in " + ((Config.ALT_FESTIVAL_LENGTH - Config.ALT_FESTIVAL_SECOND_SPAWN) / 60000) + " minute(s)."); + } + } + }; + _festivalSecondSpawn.schedule(_festivalSecondSpawnTask, (FESTIVAL_SIGNUP_TIME + Config.ALT_FESTIVAL_SECOND_SPAWN)); + } + + private void createSecondSwarmTask() + { + if(_festivalSecondSwarmTask != null) + { + _festivalSecondSwarmTask.cancel(); + _festivalSecondSwarmTask = null; + } + + if(_festivalSecondSwarm != null) + { + _festivalSecondSwarm.cancel(); + _festivalSecondSwarm = null; + } + + _festivalSecondSwarm = new Timer(); + _festivalSecondSwarmTask = new TimerTask() + { + @Override + public void run() + { + for (L2DarknessFestival festivalInst : _festivalInstances.values()) + festivalInst.moveMonstersToCenter(); + } + }; + _festivalSecondSwarm.schedule(_festivalSecondSwarmTask, (FESTIVAL_SIGNUP_TIME + Config.ALT_FESTIVAL_SECOND_SWARM)); + } + + private void createChestSpawnTask() + { + if(_festivalChestSpawnTask != null) + { + _festivalChestSpawnTask.cancel(); + _festivalChestSpawnTask = null; + } + + if(_festivalChestSpawn != null) + { + _festivalChestSpawn.cancel(); + _festivalChestSpawn = null; + } + + _festivalChestSpawn = new Timer(); + _festivalChestSpawnTask = new TimerTask() + { + @Override + public void run() + { + // Spawn the festival chests, which enable the team to gain greater rewards + // for each chest they kill. + for (L2DarknessFestival festivalInst : _festivalInstances.values()) + { + festivalInst.spawnFestivalMonsters(FESTIVAL_DEFAULT_RESPAWN, 3); + festivalInst.sendMessageToParticipants("The chests have spawned! Be quick, the festival will end soon."); + } + } + }; + _festivalChestSpawn.schedule(_festivalChestSpawnTask, (FESTIVAL_SIGNUP_TIME + Config.ALT_FESTIVAL_CHEST_SPAWN)); + } + + private void createEndTask() + { + if(_festivalEndTask != null) + { + _festivalEndTask.cancel(); + _festivalEndTask = null; + } + + if(_festivalEnd != null) + { + _festivalEnd.cancel(); + _festivalEnd = null; + } + + _festivalEnd = new Timer(); + _festivalEndTask = new TimerTask() + { + @Override + public void run() + { + // Participants can no longer opt to increase the challenge, as the festival will soon close. + _festivalInProgress = false; + + sendMessageToAll("Festival Witch", "That will do! I'll move you to the outside soon."); + + /* TERMINATION */ + // Sequentially begin the ending sequence for all running festivals. + for (L2DarknessFestival festivalInst : _festivalInstances.values()) + festivalInst.festivalEnd(); + + // Clear the participants list for the next round of signups. + _dawnFestivalParticipants.clear(); + _duskFestivalParticipants.clear(); + + // Allow signups for the next festival cycle. + _festivalInitialized = false; + + if (Config.DEBUG) + _log.info("SevenSignsFestival: The next set of festivals begin in " + getMinsToNextFestival() + " minute(s)."); + } + }; + _festivalEnd.schedule(_festivalEndTask, (FESTIVAL_SIGNUP_TIME + Config.ALT_FESTIVAL_LENGTH)); + } + /** * Returns the running instance of a festival for the given Oracle and festivalID. *
@@ -2057,7 +2189,7 @@ _log.info("SevenSignsFestival: Initializing festival for " + SevenSigns.getCabalShortName(_cabal) + " (" + getFestivalName(_levelRange) + ")"); // Teleport all players to arena and notify them. - if (_participants.size() > 0) + if (_participants != null && _participants.size() > 0) { for (L2PcInstance participant : _participants) { @@ -2130,7 +2262,7 @@ _witchInst.broadcastPacket(msu); // Send a message to all participants from the witch. - sendMessageToParticipants("The festival will begin in 2 minutes."); + sendMessageToParticipants("The festival will begin in " + (Config.ALT_FESTIVAL_FIRST_SPAWN / 60000) + " minute(s)."); } protected void festivalStart() @@ -2293,7 +2425,7 @@ public void sendMessageToParticipants(String message) { - if (_participants.size() > 0) + if (_participants != null && _participants.size() > 0) { CreatureSay cs = new CreatureSay(_witchInst.getObjectId(), 0, "Festival Witch", message); @@ -2307,7 +2439,7 @@ if (Config.DEBUG) _log.info("SevenSignsFestival: Ending festival for " + SevenSigns.getCabalShortName(_cabal) + " (" + getFestivalName(_levelRange) + ")"); - if (_participants.size() > 0) + if (_participants != null && _participants.size() > 0) { for (L2PcInstance participant : _participants) { Index: java/net/sf/l2j/gameserver/Shutdown.java =================================================================== --- java/net/sf/l2j/gameserver/Shutdown.java (revision 1224) +++ java/net/sf/l2j/gameserver/Shutdown.java (working copy) @@ -406,7 +406,7 @@ disconnectAllCharacters(); // Seven Signs data is now saved along with Festival data. - if (!SevenSigns.getInstance().isSealValidationPeriod()) + if (SevenSigns.getInstance().isCompetitionPeriod()) SevenSignsFestival.getInstance().saveFestivalData(false); // Save Seven Signs data before closing. :) Index: java/net/sf/l2j/gameserver/taskmanager/tasks/TaskSevenSignsUpdate.java =================================================================== --- java/net/sf/l2j/gameserver/taskmanager/tasks/TaskSevenSignsUpdate.java (revision 1224) +++ java/net/sf/l2j/gameserver/taskmanager/tasks/TaskSevenSignsUpdate.java (working copy) @@ -49,7 +49,7 @@ try { SevenSigns.getInstance().saveSevenSignsData(null, true); - if (!SevenSigns.getInstance().isSealValidationPeriod()) + if (SevenSigns.getInstance().isCompetitionPeriod()) SevenSignsFestival.getInstance().saveFestivalData(false); _log.info("SevenSigns: Data updated successfully.");