Jump to content
  • 0

Olympiad Shows No Ranking (Acis 315)


Question

Posted (edited)

Can someone dev  help me about Olympiad Ranking didnt show me my points, someone who has experience on this project:

 

 

 

 

 

/**
* @author godson
*/
package net.sf.l2j.gameserver.model.olympiad;

import gnu.trove.map.hash.TIntIntHashMap;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;

import net.sf.l2j.Config;
import net.sf.l2j.L2DatabaseFactory;
import net.sf.l2j.gameserver.Announcements;
import net.sf.l2j.gameserver.ThreadPoolManager;
import net.sf.l2j.gameserver.instancemanager.ZoneManager;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.entity.Hero;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.SystemMessage;
import net.sf.l2j.gameserver.templates.StatsSet;

public class Olympiad
{
protected static final Logger _log = Logger.getLogger(Olympiad.class.getName());

private static Map<Integer, StatsSet> _nobles;
protected static List<StatsSet> _heroesToBe;
private static final TIntIntHashMap _noblesRank = new TIntIntHashMap();

public static final String OLYMPIAD_HTML_PATH = "data/html/olympiad/";

private static final String OLYMPIAD_LOAD_DATA = "SELECT current_cycle, period, olympiad_end, validation_end, next_weekly_change FROM olympiad_data WHERE id = 0";
private static final String OLYMPIAD_SAVE_DATA = "INSERT INTO olympiad_data (id, current_cycle, period, olympiad_end, validation_end, next_weekly_change) VALUES (0,?,?,?,?,?) ON DUPLICATE KEY UPDATE current_cycle=?, period=?, olympiad_end=?, validation_end=?, next_weekly_change=?";

private static final String OLYMPIAD_LOAD_NOBLES = "SELECT olympiad_nobles.char_id, olympiad_nobles.class_id, characters.char_name, olympiad_nobles.olympiad_points, olympiad_nobles.competitions_done, olympiad_nobles.competitions_won, olympiad_nobles.competitions_lost, olympiad_nobles.competitions_drawn FROM olympiad_nobles, characters WHERE characters.obj_Id = olympiad_nobles.char_id";
private static final String OLYMPIAD_SAVE_NOBLES = "INSERT INTO olympiad_nobles (`char_id`,`class_id`,`olympiad_points`,`competitions_done`,`competitions_won`,`competitions_lost`, `competitions_drawn`) VALUES (?,?,?,?,?,?,?)";
private static final String OLYMPIAD_UPDATE_NOBLES = "UPDATE olympiad_nobles SET olympiad_points = ?, competitions_done = ?, competitions_won = ?, competitions_lost = ?, competitions_drawn = ? WHERE char_id = ?";
private static final String OLYMPIAD_GET_HEROS = "SELECT olympiad_nobles.char_id, characters.char_name FROM olympiad_nobles, characters WHERE characters.obj_Id = olympiad_nobles.char_id AND olympiad_nobles.class_id = ? AND olympiad_nobles.competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " AND olympiad_nobles.competitions_won > 0 ORDER BY olympiad_nobles.olympiad_points DESC, olympiad_nobles.competitions_done DESC, olympiad_nobles.competitions_won DESC";
private static final String GET_ALL_CLASSIFIED_NOBLESS = "SELECT char_id from olympiad_nobles_eom WHERE competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_points DESC, competitions_done DESC, competitions_won DESC";
private static final String GET_EACH_CLASS_LEADER = "SELECT characters.char_name from olympiad_nobles_eom, characters WHERE characters.obj_Id = olympiad_nobles_eom.char_id AND olympiad_nobles_eom.class_id = ? AND olympiad_nobles_eom.competitions_done >= " + Config.ALT_OLY_MIN_MATCHES + " ORDER BY olympiad_nobles_eom.olympiad_points DESC, olympiad_nobles_eom.competitions_done DESC, olympiad_nobles_eom.competitions_won DESC LIMIT 10";

private static final String OLYMPIAD_DELETE_ALL = "TRUNCATE olympiad_nobles";
private static final String OLYMPIAD_MONTH_CLEAR = "TRUNCATE olympiad_nobles_eom";
private static final String OLYMPIAD_MONTH_CREATE = "INSERT INTO olympiad_nobles_eom SELECT char_id, class_id, olympiad_points, competitions_done, competitions_won, competitions_lost, competitions_drawn FROM olympiad_nobles";

private static final int[] HERO_IDS =
{
88,
89,
90,
91,
92,
93,
94,
95,
96,
97,
98,
99,
100,
101,
102,
103,
104,
105,
106,
107,
108,
109,
110,
111,
112,
113,
114,
115,
116,
117,
118
};

private static final int COMP_START = Config.ALT_OLY_START_TIME; // 6PM
private static final int COMP_MIN = Config.ALT_OLY_MIN; // 00 mins
private static final long COMP_PERIOD = Config.ALT_OLY_CPERIOD; // 6 hours
protected static final long WEEKLY_PERIOD = Config.ALT_OLY_WPERIOD; // 1 week
protected static final long VALIDATION_PERIOD = Config.ALT_OLY_VPERIOD; // 24 hours

protected static final int DEFAULT_POINTS = Config.ALT_OLY_START_POINTS;
protected static final int WEEKLY_POINTS = Config.ALT_OLY_WEEKLY_POINTS;

public static final String CHAR_ID = "char_id";
public static final String CLASS_ID = "class_id";
public static final String CHAR_NAME = "char_name";
public static final String POINTS = "olympiad_points";
public static final String COMP_DONE = "competitions_done";
public static final String COMP_WON = "competitions_won";
public static final String COMP_LOST = "competitions_lost";
public static final String COMP_DRAWN = "competitions_drawn";

protected long _olympiadEnd;
protected long _validationEnd;

/**
* The current period of the olympiad.<br>
* <b>0 -</b> Competition period<br>
* <b>1 -</b> Validation Period
*/
protected int _period;
protected long _nextWeeklyChange;
protected int _currentCycle;
private long _compEnd;
private Calendar _compStart;
protected static boolean _inCompPeriod;
protected static boolean _compStarted = false;

protected ScheduledFuture<?> _scheduledCompStart;
protected ScheduledFuture<?> _scheduledCompEnd;
protected ScheduledFuture<?> _scheduledOlympiadEnd;
protected ScheduledFuture<?> _scheduledWeeklyTask;
protected ScheduledFuture<?> _scheduledValdationTask;
protected ScheduledFuture<?> _gameManager = null;
protected ScheduledFuture<?> _gameAnnouncer = null;

public static Olympiad getInstance()
{
return SingletonHolder._instance;
}

protected Olympiad()
{
load();

if (_period == 0)
init();
}

private void load()
{
_nobles = new HashMap<>();

boolean loaded = false;
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery();

while (rset.next())
{
_currentCycle = rset.getInt("current_cycle");
_period = rset.getInt("period");
_olympiadEnd = rset.getLong("olympiad_end");
_validationEnd = rset.getLong("validation_end");
_nextWeeklyChange = rset.getLong("next_weekly_change");
loaded = true;
}

rset.close();
statement.close();
}
catch (Exception e)
{
_log.log(Level.WARNING, "Olympiad System: Error loading olympiad data from database: ", e);
}

if (!loaded)
{
_log.log(Level.INFO, "Olympiad System: failed to load data from database, default values are used.");

_currentCycle = 1;
_period = 0;
_olympiadEnd = 0;
_validationEnd = 0;
_nextWeeklyChange = 0;
}

switch (_period)
{
case 0:
if (_olympiadEnd == 0 || _olympiadEnd < Calendar.getInstance().getTimeInMillis())
setNewOlympiadEnd();
else
scheduleWeeklyChange();
break;
case 1:
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
{
loadNoblesRank();
_scheduledValdationTask = ThreadPoolManager.getInstance().scheduleGeneral(new ValidationEndTask(), getMillisToValidationEnd());
}
else
{
_currentCycle++;
_period = 0;
deleteNobles();
setNewOlympiadEnd();
}
break;
default:
_log.warning("Olympiad System: something went wrong loading period: " + _period);
return;
}

try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery();
StatsSet statData;

while (rset.next())
{
statData = new StatsSet();
statData.set(CLASS_ID, rset.getInt(CLASS_ID));
statData.set(CHAR_NAME, rset.getString(CHAR_NAME));
statData.set(POINTS, rset.getInt(POINTS));
statData.set(COMP_DONE, rset.getInt(COMP_DONE));
statData.set(COMP_WON, rset.getInt(COMP_WON));
statData.set(COMP_LOST, rset.getInt(COMP_LOST));
statData.set(COMP_DRAWN, rset.getInt(COMP_DRAWN));
statData.set("to_save", false);

addNobleStats(rset.getInt(CHAR_ID), statData);
}

rset.close();
statement.close();
}
catch (Exception e)
{
_log.log(Level.WARNING, "Olympiad System: Error loading noblesse data from database: ", e);
}

synchronized (this)
{
_log.info("Olympiad System: Loading Olympiad system....");
if (_period == 0)
_log.info("Olympiad System: Currently in Competition period.");
else
_log.info("Olympiad System: Currently in Validation period.");

long milliToEnd;
if (_period == 0)
milliToEnd = getMillisToOlympiadEnd();
else
milliToEnd = getMillisToValidationEnd();

_log.info("Olympiad System: " + Math.round(milliToEnd / 60000) + " minutes until period ends.");

if (_period == 0)
{
milliToEnd = getMillisToWeekChange();
_log.info("Olympiad System: Next weekly change is in " + Math.round(milliToEnd / 60000) + " minutes.");
}
}

_log.info("Olympiad System: Loaded " + _nobles.size() + " nobles.");
}

public void loadNoblesRank()
{
_noblesRank.clear();
TIntIntHashMap tmpPlace = new TIntIntHashMap();

try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery();

int place = 1;
while (rset.next())
{
tmpPlace.put(rset.getInt(CHAR_ID), place++);
}

rset.close();
statement.close();
}
catch (Exception e)
{
_log.log(Level.WARNING, "Olympiad System: Error loading noblesse data from database for Ranking: ", e);
}

int rank1 = (int) Math.round(tmpPlace.size() * 0.01);
int rank2 = (int) Math.round(tmpPlace.size() * 0.10);
int rank3 = (int) Math.round(tmpPlace.size() * 0.25);
int rank4 = (int) Math.round(tmpPlace.size() * 0.50);
if (rank1 == 0)
{
rank1 = 1;
rank2++;
rank3++;
rank4++;
}

for (int charId : tmpPlace.keys())
{
if (tmpPlace.get(charId) <= rank1)
_noblesRank.put(charId, 1);
else if (tmpPlace.get(charId) <= rank2)
_noblesRank.put(charId, 2);
else if (tmpPlace.get(charId) <= rank3)
_noblesRank.put(charId, 3);
else if (tmpPlace.get(charId) <= rank4)
_noblesRank.put(charId, 4);
else
_noblesRank.put(charId, 5);
}
}

protected void init()
{
if (_period == 1)
return;

_compStart = Calendar.getInstance();
_compStart.set(Calendar.HOUR_OF_DAY, COMP_START);
_compStart.set(Calendar.MINUTE, COMP_MIN);
_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;

if (_scheduledOlympiadEnd != null)
_scheduledOlympiadEnd.cancel(true);

_scheduledOlympiadEnd = ThreadPoolManager.getInstance().scheduleGeneral(new OlympiadEndTask(), getMillisToOlympiadEnd());

updateCompStatus();
}

protected class OlympiadEndTask implements Runnable
{
@Override
public void run()
{
Announcements.announceToAll(SystemMessage.getSystemMessage(SystemMessageId.OLYMPIAD_PERIOD_S1_HAS_ENDED).addNumber(_currentCycle));

if (_scheduledWeeklyTask != null)
_scheduledWeeklyTask.cancel(true);

saveNobleData();

_period = 1;
sortHerosToBe();
Hero.getInstance().resetData();
Hero.getInstance().computeNewHeroes(_heroesToBe);

saveOlympiadStatus();
updateMonthlyData();

Calendar validationEnd = Calendar.getInstance();
_validationEnd = validationEnd.getTimeInMillis() + VALIDATION_PERIOD;

loadNoblesRank();
_scheduledValdationTask = ThreadPoolManager.getInstance().scheduleGeneral(new ValidationEndTask(), getMillisToValidationEnd());
}
}

protected class ValidationEndTask implements Runnable
{
@Override
public void run()
{
_period = 0;
_currentCycle++;

deleteNobles();
setNewOlympiadEnd();
init();
}
}

protected static int getNobleCount()
{
return _nobles.size();
}

protected static StatsSet getNobleStats(int playerId)
{
return _nobles.get(playerId);
}

private void updateCompStatus()
{
synchronized (this)
{
long milliToStart = getMillisToCompBegin();

double numSecs = (milliToStart / 1000) % 60;
double countDown = ((milliToStart / 1000) - numSecs) / 60;
int numMins = (int) Math.floor(countDown % 60);
countDown = (countDown - numMins) / 60;
int numHours = (int) Math.floor(countDown % 24);
int numDays = (int) Math.floor((countDown - numHours) / 24);

_log.info("Olympiad System: Competition period starts in " + numDays + " days, " + numHours + " hours and " + numMins + " mins.");
_log.info("Olympiad System: Event starts/started : " + _compStart.getTime());
}

_scheduledCompStart = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
{
@Override
public void run()
{
if (isOlympiadEnd())
return;

_inCompPeriod = true;

Announcements.announceToAll(SystemMessage.getSystemMessage(SystemMessageId.THE_OLYMPIAD_GAME_HAS_STARTED));
_log.info("Olympiad System: Olympiad game started.");

_gameManager = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(OlympiadGameManager.getInstance(), 30000, 30000);
if (Config.ALT_OLY_ANNOUNCE_GAMES)
_gameAnnouncer = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new OlympiadAnnouncer(), 30000, 500);

long regEnd = getMillisToCompEnd() - 600000;
if (regEnd > 0)
{
ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
{
@Override
public void run()
{
Announcements.announceToAll(SystemMessage.getSystemMessage(SystemMessageId.OLYMPIAD_REGISTRATION_PERIOD_ENDED));
}
}, regEnd);
}

_scheduledCompEnd = ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
{
@Override
public void run()
{
if (isOlympiadEnd())
return;

_inCompPeriod = false;
Announcements.announceToAll(SystemMessage.getSystemMessage(SystemMessageId.THE_OLYMPIAD_GAME_HAS_ENDED));
_log.info("Olympiad System: Olympiad game ended.");

while (OlympiadGameManager.getInstance().isBattleStarted()) // cleared in game manager
{
// wait 1 minutes for end of pendings games
try
{
Thread.sleep(60000);
}
catch (InterruptedException e)
{
}
}

if (_gameManager != null)
{
_gameManager.cancel(false);
_gameManager = null;
}

if (_gameAnnouncer != null)
{
_gameAnnouncer.cancel(false);
_gameAnnouncer = null;
}

saveOlympiadStatus();

init();
}
}, getMillisToCompEnd());
}
}, getMillisToCompBegin());
}

private long getMillisToOlympiadEnd()
{
return (_olympiadEnd - Calendar.getInstance().getTimeInMillis());
}

public void manualSelectHeroes()
{
if (_scheduledOlympiadEnd != null)
_scheduledOlympiadEnd.cancel(true);

_scheduledOlympiadEnd = ThreadPoolManager.getInstance().scheduleGeneral(new OlympiadEndTask(), 0);
}

protected long getMillisToValidationEnd()
{
if (_validationEnd > Calendar.getInstance().getTimeInMillis())
return (_validationEnd - Calendar.getInstance().getTimeInMillis());

return 10L;
}

public boolean isOlympiadEnd()
{
return (_period != 0);
}

protected void setNewOlympiadEnd()
{
Announcements.announceToAll(SystemMessage.getSystemMessage(SystemMessageId.OLYMPIAD_PERIOD_S1_HAS_STARTED).addNumber(_currentCycle));

Calendar currentTime = Calendar.getInstance();
currentTime.add(Calendar.MONTH, 1);
currentTime.set(Calendar.DAY_OF_MONTH, 1);
currentTime.set(Calendar.AM_PM, Calendar.AM);
currentTime.set(Calendar.HOUR, 12);
currentTime.set(Calendar.MINUTE, 0);
currentTime.set(Calendar.SECOND, 0);
_olympiadEnd = currentTime.getTimeInMillis();

Calendar nextChange = Calendar.getInstance();
_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
scheduleWeeklyChange();
}

public boolean inCompPeriod()
{
return _inCompPeriod;
}

private long getMillisToCompBegin()
{
if (_compStart.getTimeInMillis() < Calendar.getInstance().getTimeInMillis() && _compEnd > Calendar.getInstance().getTimeInMillis())
return 10L;

if (_compStart.getTimeInMillis() > Calendar.getInstance().getTimeInMillis())
return (_compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());

return setNewCompBegin();
}

private long setNewCompBegin()
{
_compStart = Calendar.getInstance();
_compStart.set(Calendar.HOUR_OF_DAY, COMP_START);
_compStart.set(Calendar.MINUTE, COMP_MIN);
_compStart.add(Calendar.HOUR_OF_DAY, 24);
_compEnd = _compStart.getTimeInMillis() + COMP_PERIOD;

_log.info("Olympiad System: New schedule @ " + _compStart.getTime());

return (_compStart.getTimeInMillis() - Calendar.getInstance().getTimeInMillis());
}

protected long getMillisToCompEnd()
{
return (_compEnd - Calendar.getInstance().getTimeInMillis());
}

private long getMillisToWeekChange()
{
if (_nextWeeklyChange > Calendar.getInstance().getTimeInMillis())
return (_nextWeeklyChange - Calendar.getInstance().getTimeInMillis());

return 10L;
}

private void scheduleWeeklyChange()
{
_scheduledWeeklyTask = ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
{
@Override
public void run()
{
addWeeklyPoints();
_log.info("Olympiad System: Added weekly points to nobles.");

Calendar nextChange = Calendar.getInstance();
_nextWeeklyChange = nextChange.getTimeInMillis() + WEEKLY_PERIOD;
}
}, getMillisToWeekChange(), WEEKLY_PERIOD);
}

protected synchronized void addWeeklyPoints()
{
if (_period == 1)
return;

int currentPoints;
for (StatsSet nobleInfo : _nobles.values())
{
currentPoints = nobleInfo.getInteger(POINTS);
currentPoints += WEEKLY_POINTS;
nobleInfo.set(POINTS, currentPoints);
}
}

public int getCurrentCycle()
{
return _currentCycle;
}

public boolean playerInStadia(L2PcInstance player)
{
return ZoneManager.getOlympiadStadium(player) != null;
}

/**
* Save noblesse data to database
*/
protected synchronized void saveNobleData()
{
if (_nobles == null || _nobles.isEmpty())
return;

try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement;
for (int nobleId : _nobles.keySet())
{
StatsSet nobleInfo = _nobles.get(nobleId);

if (nobleInfo == null)
continue;

int charId = nobleId;
int classId = nobleInfo.getInteger(CLASS_ID);
int points = nobleInfo.getInteger(POINTS);
int compDone = nobleInfo.getInteger(COMP_DONE);
int compWon = nobleInfo.getInteger(COMP_WON);
int compLost = nobleInfo.getInteger(COMP_LOST);
int compDrawn = nobleInfo.getInteger(COMP_DRAWN);
boolean toSave = nobleInfo.getBool("to_save");

if (toSave)
{
statement = con.prepareStatement(OLYMPIAD_SAVE_NOBLES);
statement.setInt(1, charId);
statement.setInt(2, classId);
statement.setInt(3, points);
statement.setInt(4, compDone);
statement.setInt(5, compWon);
statement.setInt(6, compLost);
statement.setInt(7, compDrawn);

nobleInfo.set("to_save", false);
}
else
{
statement = con.prepareStatement(OLYMPIAD_UPDATE_NOBLES);
statement.setInt(1, points);
statement.setInt(2, compDone);
statement.setInt(3, compWon);
statement.setInt(4, compLost);
statement.setInt(5, compDrawn);
statement.setInt(6, charId);
}
statement.execute();
statement.close();
}
}
catch (SQLException e)
{
_log.log(Level.SEVERE, "Olympiad System: Failed to save noblesse data to database: ", e);
}
}

/**
* Save current olympiad status and update noblesse table in database
*/
public void saveOlympiadStatus()
{
saveNobleData();

try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
final PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA);

statement.setInt(1, _currentCycle);
statement.setInt(2, _period);
statement.setLong(3, _olympiadEnd);
statement.setLong(4, _validationEnd);
statement.setLong(5, _nextWeeklyChange);
statement.setInt(6, _currentCycle);
statement.setInt(7, _period);
statement.setLong(8, _olympiadEnd);
statement.setLong(9, _validationEnd);
statement.setLong(10, _nextWeeklyChange);

statement.execute();
statement.close();
}
catch (SQLException e)
{
_log.log(Level.SEVERE, "Olympiad System: Failed to save olympiad data to database: ", e);
}
}

protected void updateMonthlyData()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
statement.execute();
statement.close();
statement = con.prepareStatement(OLYMPIAD_MONTH_CREATE);
statement.execute();
statement.close();
}
catch (SQLException e)
{
_log.log(Level.SEVERE, "Olympiad System: Failed to update monthly noblese data: ", e);
}
}

protected void sortHerosToBe()
{
if (_period != 1)
return;

if (_nobles != null)
{
for (Integer nobleId : _nobles.keySet())
{
StatsSet nobleInfo = _nobles.get(nobleId);
if (nobleInfo == null)
continue;
}
}

_heroesToBe = new ArrayList<>();

try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS);
ResultSet rset;
StatsSet hero;
for (int element : HERO_IDS)
{
statement.setInt(1, element);
rset = statement.executeQuery();
statement.clearParameters();

if (rset.next())
{
hero = new StatsSet();
hero.set(CLASS_ID, element);
hero.set(CHAR_ID, rset.getInt(CHAR_ID));
hero.set(CHAR_NAME, rset.getString(CHAR_NAME));

_heroesToBe.add(hero);
}
rset.close();
}
statement.close();
}
catch (SQLException e)
{
_log.warning("Olympiad System: Couldnt load heros from DB");
}
}

public List<String> getClassLeaderBoard(int classId)
{
List<String> names = new ArrayList<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
PreparedStatement statement = con.prepareStatement(GET_EACH_CLASS_LEADER);
statement.setInt(1, classId);
ResultSet rset = statement.executeQuery();

while (rset.next())
names.add(rset.getString(CHAR_NAME));

statement.close();
rset.close();
}
catch (SQLException e)
{
_log.warning("Olympiad System: Couldn't load olympiad leaders from DB!");
}
return names;
}

public int getNoblessePasses(L2PcInstance player, boolean clear)
{
if ((player == null) || (_period != 1) || _noblesRank.isEmpty())
return 0;

final int objId = player.getObjectId();
if (!_noblesRank.containsKey(objId))
return 0;

final StatsSet noble = _nobles.get(objId);
if ((noble == null) || (noble.getInteger(POINTS) == 0))
return 0;

final int rank = _noblesRank.get(objId);
int points = (player.isHero() ? Config.ALT_OLY_HERO_POINTS : 0);
switch (rank)
{
case 1:
points += Config.ALT_OLY_RANK1_POINTS;
break;
case 2:
points += Config.ALT_OLY_RANK2_POINTS;
break;
case 3:
points += Config.ALT_OLY_RANK3_POINTS;
break;
case 4:
points += Config.ALT_OLY_RANK4_POINTS;
break;
default:
points += Config.ALT_OLY_RANK5_POINTS;
}

if (clear)
noble.set(POINTS, 0);

points *= Config.ALT_OLY_GP_PER_POINT;
return points;
}

public int getNoblePoints(int objId)
{
if ((_nobles == null) || !_nobles.containsKey(objId))
return 0;

return _nobles.get(objId).getInteger(POINTS);
}

public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE char_id = ?");
statement.setInt(1, objId);
final ResultSet rs = statement.executeQuery();
if (rs.first())
result = rs.getInt(1);
rs.close();
statement.close();
}
catch (Exception e)
{
_log.log(Level.WARNING, "Could not load last olympiad points:", e);
}
return result;
}

public int getCompetitionDone(int objId)
{
if ((_nobles == null) || !_nobles.containsKey(objId))
return 0;

return _nobles.get(objId).getInteger(COMP_DONE);
}

public int getCompetitionWon(int objId)
{
if ((_nobles == null) || !_nobles.containsKey(objId))
return 0;

return _nobles.get(objId).getInteger(COMP_WON);
}

public int getCompetitionLost(int objId)
{
if ((_nobles == null) || !_nobles.containsKey(objId))
return 0;

return _nobles.get(objId).getInteger(COMP_LOST);
}

protected void deleteNobles()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
final PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL);
statement.execute();
statement.close();
}
catch (SQLException e)
{
_log.warning("Olympiad System: Couldn't delete nobles from DB!");
}
_nobles.clear();
}

/**
* @param charId the noble object Id.
* @param data the stats set data to add.
* @return the old stats set if the noble is already present, null otherwise.
*/
protected static StatsSet addNobleStats(int charId, StatsSet data)
{
return _nobles.put(Integer.valueOf(charId), data);
}

private static class SingletonHolder
{
protected static final Olympiad _instance = new Olympiad();
}
}post-201661-0-83687600-1487470877_thumb.

Edited by dnox1987

9 answers to this question

Recommended Posts

  • 0
Posted (edited)

Read changeset 316 to 350 to know what you will benefit to simply use rev 350 (which is free). 350 to 360 being the "stabilization" cycle, where most errors (ConcurrentException, NPE) were fixed.

Edited by Tryskell
  • 0
Posted

Read changeset 316 to 350 to know what you will benefit to simply use rev 350 (which is free). 350 to 360 being the "stabilization" cycle, where most errors (ConcurrentException, NPE) were fixed.

" But, but.. I want to use Trance' Gold pack  :okey: "

  • 0
Posted (edited)

i dodnt want t loose all the items of trance :P

Worst excuse ever  :dat:

 

Using latest won't "fix" your issue. Normally points are shown at the end of olympiad. Edit GET_EACH_CLASS_LEADER to read from olympiad_nobles table.

Edited by SweeTs
  • 0
Posted (edited)

I have already answer in your PM yesterday. If your other account is janpara. I gave you the change for update the classes every day. Why you still ask for help?

 

http://pastebin.com/nhSw0XUx

Edited by 'Baggos'
  • 0
Posted

i dont have another user here and i dont know this guy? lol :troll: if you think i am the same guy you are wrong :P

No, I just saying because you ask the same "problem" the same time for the same rev.

 

Anyway..

  • 0
Posted

If you can't even copy features from one pack to another (same pack basically, only different revision) don't bother opening a server.

 

Btw, please don't go around all forum pming members, a topic is enough. Also, put code tags between the code you posted.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • General Trackers :   IPTorrents invite IPTorrents account 1 tb TorrentLeech invite Torrentleech account 1 tb buffer  InTheShaDow ( ITS ) account Acid-lounge invite Torrentday invite Crnaberza account Abn.Lol account Limit-of-eden account Norbits account Xspeeds account Xspeeds invite Bemaniso invite Wigornot account Bithumen invite Filelist account Funfile invite AvistaZ invite Potuk.net invite ResurrectThe.Net invite GrabThe.Info invite Greek-Team invite LinkoManija invite Fano.in account tracker.czech-server.com Speed.cd invite Arab-torrents.net account Arabscene.me account Scenetime account 4thd.xyz invite Btarg.com.ar account Dedbit invite Estone.cc account Speedapp invite Finvip invite Fluxzone account GigaTorrents account Gimmepeers account Haidan.video invite Mojblink account Mycarpathians invite Newinsane.info account Oscarworld.xyz account Peers.FM invite Pt.msg.vg account Ransackedcrew account Redemption invite Scene-rush account Seedfile.io invite Teracod invite Torrent.ai account Torrentmasters invite Ttsweb invite X-files invite X-ite invite Ncore account TorrentHR account Rptorrents account BwTorrents account Superbits invite Krazyzone account Immortalseed account Tntracker invite Pt.eastgame.org account Bitturk account Rstorrent account Tracker.btnext invite Torrent-turk.de account BeiTai.PT account Pt.keepfrds account 52pt.site account Pthome account Torrentseeds account Aystorrent account Blues-brothers.biz invite Divteam account Thesceneplace invite CinemaMovies.pl account Brasiltracker account Patiodebutacas account Newheaven.nl account  Swarmazon.club invite Bc-reloaded account Crazyspirits account Silentground invite Omg.wtftrackr invite Milkie.cc invite Breathetheword invite Madsrevolution account Chilebt account Yubraca account Uniongang.tv account Frboard account Exvagos account Diablotorrent account Microbit account Carp-hunter.hu account Majomparade.eu account Theshinning.me account Youiv.info account Dragonworld-reloaded account Sharewood.tv account Partis.si account Digitalcore.club invite Fuzer.me account R3vuk.wtf invite Ztracker account 1 tb buffer 3changtrai account Best-core.info account Bitsite.us account Eliteunitedcrew invite Exitorrent.org account Tophos invite Torrent.lt account Sktorrent.eu account Oshen account Pirata.digital account Esharenet account Ohmenarikgi.la Pirate-share account Immortuos account Kiesbits account Cliente.amigos-share.club account Broadcity invite Ilovetorzz account Torrentbytes account Polishsource account Portugas invite Shareisland account ArabaFenice account Hudbt.hust.edu.cn account Audiences account Nanyangpt account Pt.sjtu.edu.cn account Pt.zhixing.bjtu.edu.cn account Byr.pt invite Ptfiles invite Red-bits account Pt.hdpost.top account Irrenhaus.dyndns.dk (NewPropaganda) account Mnvv2.info (MaxNewVision V2) account 1ptba.com account Spidertk.top account Film-paleis account Generation-free account Aftershock-tracker account Twilightsdreams account Back-ups.me invite Sor-next.tk ( Spirit Of Revolution ) account Tfa.tf ( The Falling Angels ) account Hdmayi account S-f-p.dyndns.dk ( Share Friends Projekt ) account Unlimitz.biz account Pttime account St-tracker.eu account New-retro.eu account Zbbit account Tigers-dl.net account Jptvts.us account Lat-team account Club.hares.top account Falkonvision-team account Concen account Drugari account T.ceskeforum account Peeratiko.org account Zamunda.se account Central-torrent.eu account h-o-d.org account Torrentleech.pl account Demonoid invite Lst.gg account Fakedoor.store account LaidBackManor account Vrbsharezone.co.uk invite Torrenteros account Arenaelite account Datascene account Tracker.0day.community Tapochek.net invite Ptchina invite Lesaloon account Exyusubs account Therebels.tv account Ubits.club invite Zmpt.cc account Turktorrent.us account Dasunerwarte account Hawke.uno account Monikadesign account Fearnopeer account Alpharatio account Wukongwendao.top account Chinapyg account Azusa.wiki account Yggtorrent.top account Torrentdd account Cyanbug.net invite Hhanclub.top account Wintersakura.net account Xthor account Tctg.pm account Finelite invite Agsvpt.com account Pt.0ff.cc invite Qingwapt.com account Xingtan.one account Ptcafe.club invite W-o-t.pro account Coastal-crew.bounceme.net account Darkpeers.org account Pianyuan.org account Seedpool.org  account Tempelbox account Pt.itzmx.com account Itatorrents.xyz  account Letseed.org account The-new-fun.com  account Malayabits.cc account Trellas.me account Yu-scene.net account Futuretorrent.org account Bitpt.cn account Tocashare.biz  account Videoteka.org  account White-angel.hu account Xbytesv2.li account Torr9  account Desitorrents account Okpt.net account Samaritano.cc account Polishtorrent.top  account C411.org account Bigcore.eu account BJ-Share.info account Infinitylibrary.net account Beload.org account Emuwarez.com account Yhpp.cc account Funsharing ( FSC ) account Rastastugan account Tlzdigital account account Upscalevault account Bluraytracker.cz account Torrenting.com account Infire.si account Dasunerwartete.biz invite The-torrent-trader account New-asgard.xyz account Pandapt account Deildu account Tmpt.top invite Pt.gtk.pw account Capybarabr account Media.slo-bitcloud.eu account   Movies Trackers :   Secret-cinema account Anthelion account Pixelhd account Cinemageddon account Cinemaz account Retroflix account Classix-unlimited - invite Movie-Torrentz (m2g.link) invite Punck-tracker.net account Tmghub account Cathode-ray.tube account Greatposterwall account Arabicsource.net account Upload.cx account Crabpt.vip invite Onlyencodes.cc account Exyusubs account Hellashut.net invite Nordichd.sytes.net invite Locadora.cc account HD Trackers :   Blutopia buffered account Hd-olimpo buffered account Hdf.world account Torrentland.li account HdSky account Hdchina account Chdbits account Totheglory account Hdroute account Hdhome account TorrentCCF aka et8.org account 3DTorrents invite HD-Torrents account Bit-HDTV account HDME.eu invite Hdarea.co account Asiancinema.me account JoyHD invite HDSpace invite CrazyHD invite Bluebird-hd invite Htpt.cc account Hdtime invite Ourbits.club account Hd4fans account Siambit account Privatehd account Springsunday account Tjupt account Hdcity.leniter invite Ccfbits account Discfan account Pt.btschool.club account Ptsbao.club invite Hdzone.me invite Danishbytes account Zonaq.pw account Tracker.tekno3d account Arabp2p account Hd-united account Reelflix.xyz account Hdatmos.club account Anasch.cc invite Tigris-t account Nethd.org account Hd.ai invite Hitpt.com account Hdmonkey account Dragonhd.xyz account Hdclub.eu account Forum.bluraycd.com account Carpt account Hdfun.me invite Pt.hdupt invite Puntotorrent account Ultrahd account Rousi.zip account Bearbit account Hdturk.club account Asiandvdclub account Star-space.net account Nordicq.org account Hdkyl.in account Utp.to account Hdzero account Novahd account Hdtorrents.eu account   Music Trackers :   Dicmusic account Music-Vid account Open.cd account LzTr account ProAudioTorrents invite Jpopsuki invite TranceTraffic invite Audionews invite Kraytracker invite Libble.me invite Losslessclub invite Indietorrents.com invite Dimeadozen account Funkytorrents invite Karaokedl account zombtracker.the-zomb account Concertos account Sugoimusic account Satclubbing.club invite Metal.iplay invite Psyreactor invite Panda.cd account Adamsfile account Freehardmusic account Tracker.hqmusic.vn accouunt Twilightzoom account 3 tb buffer Hiresmusic account Metalguru account Musictorrents.org account Musebootlegs.com invite Zappateers.com account Jungleland.dnsalias.com account Naftamusic account   E-Learning Trackers :   Theplace account Thevault account Myanonamouse account Libranet account 420Project account Learnflakes account Pt.soulvoice.club account P2pelite account Aaaaarg.fail invite Ebooks-shares.org account Abtorrents account Pt.tu88.men invite Docspedia.world invite   TV-Trackers :   Skipthecommericals Cryptichaven account TV-Vault invite Shazbat.TV account Myspleen account Tasmanit.es invite Tvstore.me account Tvchaosuk account Jptv.club account   XXX - Porn Trackers :   FemdomCult account Pussytorrents account Adult-cinema-network account Bootytape account 1 Tb buffer Exoticaz account Bitporn account Kufirc account Gaytorrent.ru invite Nicept account Gay-torrents.org invite Ourgtn account Pt.hdbd.us account BitSexy account Happyfappy.org account Kamept.com account Lesbians4u.org account Gaming Trackers : Mteam.fr account BitGamer invite Retrowithin invite Gamegamept account   Cartoon/Anime/Comic Trackers :   Animeworld account Oldtoons.world account U2.dmhy account CartoonChaos invite Mononoke account Totallykids.tv account Bakabt.me invite Revanime account Ansktracker account Tracker.shakaw.com.br invite Bt.mdan.org account Skyey2.com account Animetracker.cc Adbt.it.cx invite Tracker.uniotaku.com account Mousebits.com account   Sports Trackers :   MMA-Tracker invite T3nnis.tv invite AcrossTheTasman account RacingForMe invite Sportscult invite Ultimatewrestlingtorrents account Worldboxingvideoarchive invite CyclingTorrents account Xtremewrestlingtorrents account Tc-boxing invite Mma-torrents account Aussierul invite Xwt-classics account Racing4everyone account Talk.tenyardtracker account Stalker.societyglitch invite Extremebits invite Rgfootball.net account F1carreras.xyz account Software/Apps Trackers : Brokenstones account Appzuniverse invite Teamos.xyz account Macbb.org account   Graphics Trackers:   Forum.Cgpersia account Cgfxw account   Others   Hduse.net account Fora.snahp.eu account Board4all.biz account Makingoff.org/forum account Xrel.to account Undergunz.su account Corebay account Endoftheinter.net ( EOTI ) account Thismight.be invite Skull.facefromouter.space account Avxhm.se (AvaxHome) account Ssdforum account Notfake.vip account Intotheinter.net account Tildes.net invite Thetoonz account Usinavirtual account Hdclasico invite HispaShare account Valentine.wtf account Adit-hd account Forum-andr.net account Warezforums account Justanothermusic.site account Forbiddenlibrary.moe account Senturion.to account Movieparadise account Dcdnet.ru account Sftdevils.net account Heavy-r.com account New-team.org account Ddl.tv account Filewarez.club account Hispamula.org account Hubwarez.tv account Ultim-zone.in account Leprosorium.ru account Planet-ultima.org account The-dark-warez.com account Koyi.pub account Tehparadox.net account Forumophilia account Torrentinvite.fr account Gmgard.com account   NZB :   Ninjacentral.co.za account Tabula-rasa.pw account Drunkenslug account Drunkenslug invite Usenet-4all account Dognzb.cr invite Kleverig account Nzb.cat account Nzbplanet.net invite Ng4you.com account NZB.to account Samuraiplace account Abhdtv.net account Abook.link account Comix.pw account House-of-usenet Secretbinaries.net account Vnext.to account Stockboxx.top account Sky-of-use.net account Prices start from 3 $ to 100 $   Payment methods: Crypto, Neteller, Revolut   If you want to buy something send me a pm or contact me on:   Email: morrison2102@gmail.com   Discord: LFC4LIFE#4173   Telegram: https://t.me/LFC4LIFE4173   Skype: morrison2102@hotmail.com
    • Don't the Classic (even before 3.0) versions have some BS like one type of shots, instead of graded ones (D, C, A, etc.), and some weird runes instead of SA options? If that is the case, adjusting Classic to Interlude just because of the client will be very hard for someone alone. It's better to buy it 😄
    • 이 HTML 테이블에 TooltipInfo 태그와 항목 ID를 추가해야 합니다. 저에게 연락 주세요. 제가 도와드리겠습니다.
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue..