Jump to content
  • 0

How to reset Olympiad info instantly


tiguz

Question

Hello! I have a custom feature to change a player's base class. So in order to not mess the olympiad, when a player changes his baseclass, a statement is executed to reset his fights/points.

The db is updated correctly, but back in game, if I restart the char and use /olympiadstat, I still have the old points/fights.

 

I saw in other servers that this info is updated instantly. 

How can I do it instantly too?

atm this is what Im running: 

 

          // Reset olympiad data for this player.

            statement = con.prepareStatement("UPDATE olympiad_nobles SET class_id=?, olympiad_points=?, competitions_done=?, competitions_won=?, competitions_lost=?, competitions_drawn=? WHERE char_Id=?");                        
            statement.setInt(1, player.getClassId().getId());
            statement.setInt(2, 18);
            statement.setInt(3, 0);
            statement.setInt(4, 0);
            statement.setInt(5, 0);
            statement.setInt(6, 0);
            statement.setInt(7, player.getObjectId());
            statement.execute();
            statement.close();

 

Any help is welcome!

Edited by tiguz
Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

Its because you are changing only the database and that means your new stats will be applied  only after the server restart.

In order to change it instantly you have to do some changes where the player stats are stored about olympiad.

example 

private static final Map<Integer, StatsSet> _nobles = new HashMap<>();
private static final Map<Integer, Integer> _noblesRank = new HashMap<>();

these maps (Olympiad.java) contains infos about players. you should check there if the player is inside and change/add the values

Edited by melron
Link to comment
Share on other sites

  • 0
21 minutes ago, melron said:

Its because you are changing only the database and that means your new stats will be applied  only after the server restart.

In order to change it instantly you have to do some changes where the player stats are stored about olympiad.

example 


private static final Map<Integer, Integer> _noblesRank = new HashMap<>();

this map (Olympiad.java) contains infos about players. you should check there if the player is inside and change/add the values

thx for the reply Melron. but im not sure if I understood what you mean. Can you be more detailed pls?

Link to comment
Share on other sites

  • 0

He can't be more detailed. You have to clear record for that specific player. If you still don't get then, for example _nobles.remove(player.getObjectId());

  • Thanks 1
Link to comment
Share on other sites

  • 0
2 hours ago, tiguz said:

thx for the reply Melron. but im not sure if I understood what you mean. Can you be more detailed pls?

public void removeInfo(final L2PcInstance activeChar)
{
   _noblesRank.remove(activeChar.getObjectId());
}

I can analyze it more if you want.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...