Character online time
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
- jorgeromero
- Posts: 65
- Joined: Thu Sep 03, 2009 4:33 pm
- Location: France
Re: Character online time
Anyone got a solution for this?
-
- Posts: 32
- Joined: Wed May 06, 2009 11:11 pm
Re: Character online time
It's rather simple...
Code: Select all
### Eclipse Workspace Patch 1.0#P L2J_ServerIndex: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java===================================================================--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5165)+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)@@ -7828,7 +7828,7 @@ long totalOnlineTime = _onlineTime; if (_onlineBeginTime > 0)- totalOnlineTime += (System.currentTimeMillis()-_onlineBeginTime)/1000;+ totalOnlineTime += (System.currentTimeMillis()-getOfflineStartTime()-_onlineBeginTime)/1000; statement.setLong(35, totalOnlineTime); statement.setInt(36, getPunishLevel().value());
- lucan
- Posts: 590
- Joined: Wed Mar 16, 2011 10:39 pm
- Location: Brazil
Re: Character online time
Sorry for necroposting but i need this to .py script.Szponiasty wrote:Have fun.Code: Select all
private long getLastSeen(String CharName) { //lastaccess long chObjectId = getObjectIdByName(CharName); long result = -1; if (chObjectId < 1) return result; L2PcInstance _playerInstance = L2World.getInstance().findPlayer((int)chObjectId); if (_playerInstance != null && (_playerInstance.isOnline() == 1)) return 0; Connection con = null; try { // CharName con = L2DatabaseFactory.getInstance().getConnection(); PreparedStatement statement = con.prepareStatement("SELECT lastaccess FROM characters WHERE charId=?"); statement.setLong(1, chObjectId); ResultSet rset = statement.executeQuery(); if (rset.next()) { result = rset.getLong(1); } //_log.warning("Repair Attempt: Output Result for searching characters on account:"+result); rset.close(); statement.close(); } catch (SQLException e) { e.printStackTrace(); return result; } finally { try { if (con != null) con.close(); } catch (SQLException e) { // I really don't care... } } return result; }
PS. You can access that also in L2PcInstance with no need for SQL queries.Make getters for that variables, as they're private as I recall (or make them public If you want to).Code: Select all
L2pcInstance.javalong _onlineTimelong _onlineBeginTime
I need know the online time of a character, someone can help me?