public boolean setFinalScore(L2PcInstance player, int oracle, int festivalId, int offeringScore)
{
ArrayList<String> partyMembers;
int currDawnHighScore = getHighestScore(SevenSigns.CABAL_DAWN, festivalId);
int currDuskHighScore = getHighestScore(SevenSigns.CABAL_DUSK, festivalId);
int thisCabalHighScore = 0;
int otherCabalHighScore = 0;
if (oracle == SevenSigns.CABAL_DAWN) {
thisCabalHighScore = currDawnHighScore;
otherCabalHighScore = currDuskHighScore;
_dawnFestivalScores.put(festivalId, offeringScore);
}
else {
thisCabalHighScore = currDuskHighScore;
otherCabalHighScore = currDawnHighScore;
_duskFestivalScores.put(festivalId, offeringScore);
}
StatsSet currFestData = _festivalData.get(_festivalCycle).get(festivalId);
// 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 ArrayList<String>();
ArrayList<L2PcInstance> prevParticipants = getPreviousParticipants(oracle, festivalId);
// Record a string list of the party members involved.
for (L2PcInstance partyMember : prevParticipants)
partyMembers.add(partyMember.getName());
// Update the highest scores and party list.
currFestData.set("date", System.currentTimeMillis());
currFestData.set("score", offeringScore);
currFestData.set("members", implodeString(partyMembers, ","));
//if (Config.DEBUG)
_log.info("SevenSignsFestival: " + player.getName() + "'s party has the highest score (" +
offeringScore + ") so far for " + SevenSigns.getCabalName(oracle) + " in " + getFestivalName(festivalId));
// Only add the score to the overall if it's higher than the Dusk score.
if (offeringScore > otherCabalHighScore) {
int contribPoints = FESTIVAL_LEVEL_SCORES[festivalId];
// Add the points to the cabal with the highest score, while reducing it from the other.
//_signsInstance.addFestivalScore(SevenSigns.CABAL_DAWN, contribPoints);
_signsInstance.addFestivalScore(oracle, contribPoints);
//if (Config.DEBUG)
_log.info("SevenSignsFestival: This is the highest score overall so far for this festival!");
}
try {
saveFestivalData(false);
}
catch (Exception e) {
_log.severe("SevenSignsFestival: Failed to save configuration data: " + e);
}
return true;
}
return false;
}