Jump to content
  • 0

REQUEST [HELP]


Question

Posted

Xerete! 

 oi efialtes pou vlepoume merikes fores!!!

http://prntscr.com/hl3uol

http://prntscr.com/hl3vm2

http://prntscr.com/hl3vqw

 

 

 

/*
 * This program is free software: you can redistribute it and/or modify it under
 * the terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License, or (at your option) any later
 * version.
 *
 * This program is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
 * details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this program. If not, see <http://www.gnu.org/licenses/>.
 */
package net.sf.l2j.gameserver.communitybbs.tasks;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
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.ThreadPoolManager;

public class PlayerStatsUpdateTask
  {
       static Logger _log = Logger.getLogger(PlayerStatsUpdateTask.class.getName());
       private static StringBuilder _pvpList = new StringBuilder();
       private static StringBuilder _pkList = new StringBuilder();
       private static StringBuilder _raidList = new StringBuilder();
       private static StringBuilder _adenaList = new StringBuilder();      
       private static StringBuilder _onlineList = new StringBuilder();
       private static String _lastUpdate = "error";
       Connection con = L2DatabaseFactory.getInstance().getConnection();      
      
       public static void updateTask()
       {
               _log.log(Level.INFO, "[CommunityBoard]: Started player stats update task!");
              
               ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Runnable()
           {
                       @Override
                       public void run()
                   {
                       PlayerStatsUpdateTask.cleanUpTask();
                       PlayerStatsUpdateTask.updatePvPList();
                       PlayerStatsUpdateTask.updatePkList();
                       PlayerStatsUpdateTask.updateRaidList();
                       PlayerStatsUpdateTask.updateAdenaList();
                       PlayerStatsUpdateTask.updateOnlineList();
                      
                       Date date = new Date();
                       PlayerStatsUpdateTask.lastUpdate(date.toString());                             
                   }
           }, 1000L, 600000L);
       }
      
       static void cleanUpTask()
       {
               _pvpList.delete(0, _pvpList.length());
           _pkList.delete(0, _pkList.length());
           _raidList.delete(0, _raidList.length());
           _adenaList.delete(0, _adenaList.length());
           _onlineList.delete(0, _onlineList.length());               
       }
      
        static void updatePvPList()
        {
                try
                {
                        Connection con = L2DatabaseFactory.getInstance().getConnection();Throwable localThrowable3 = null;
                    try
                    {
                        int pos = 0;
                        
                        PreparedStatement statement = con.prepareStatement("SELECT SUM(chr.points), SUM(it.count), ch.char_name, ch.pkkills, ch.pvpkills, ch.onlinetime, ch.base_class, ch.online FROM characters ch LEFT JOIN character_raid_points chr ON ch.obj_Id=chr.char_id LEFT OUTER JOIN items it ON ch.obj_Id=it.owner_id WHERE item_id=57 GROUP BY ch.obj_Id ORDER BY pvpkills DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
                        ResultSet result = statement.executeQuery();
                        while (result.next()) 
                        {
                                pos++;
                                boolean status = false;
                                if (result.getInt("online") == 1)
                                {
                                        status = true;
                                }
                            String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
                            String adenas = getAdenas(result.getInt("SUM(it.count)"));                          

                            _pvpList.append("<table border=0 cellspacing=0 cellpadding=2 height=" + Config.TOP_PLAYER_ROW_HEIGHT + " width=610><tr><td FIXWIDTH=5></td>");
                            _pvpList.append("<td FIXWIDTH=25>" + pos + "</td>");
                            _pvpList.append("<td FIXWIDTH=180>" + result.getString("ch.char_name") + "</td>");
                            _pvpList.append("<td FIXWIDTH=175>" + className(result.getInt("base_class")) + "</td>");
                            _pvpList.append("<td FIXWIDTH=60>" + result.getInt("ch.pvpkills") + "</td>");
                            _pvpList.append("<td FIXWIDTH=60>" + result.getInt("ch.pkkills") + "</td>");
                            _pvpList.append("<td FIXWIDTH=70>" + result.getInt("SUM(chr.points)") + "</td>");
                            _pvpList.append("<td FIXWIDTH=140>" + adenas + "</td>");
                            _pvpList.append("<td FIXWIDTH=150>" + timeon + "</td>");
                            _pvpList.append("<td FIXWIDTH=65>" + (status ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
                            _pvpList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");                       
                        }
                        result.close();
                        statement.close();
                    }
                    catch (Throwable localThrowable1)
                    {
                        localThrowable3 = localThrowable1;throw localThrowable1;
                    }
                    finally
                    {
                        if (con != null)
                        {
                                if (localThrowable3 != null)
                                {
                                        try
                                        {
                                                con.close();
                                        }
                                        catch (Throwable localThrowable2)
                                        {
                                                localThrowable3.addSuppressed(localThrowable2);
                                        }
                                }
                                else
                                {
                                        con.close();
                                }
                        }
                    }
                }
                catch (Exception e)
                {
                        _log.log(Level.WARNING, "Failed to update pvp list!");
                        e.printStackTrace();
                }
        }
        
        static void updatePkList()
        {
                try
                {
                        Connection con = L2DatabaseFactory.getInstance().getConnection();Throwable localThrowable3 = null;
                        try
                        {
                                int pos = 0;
                                
                                PreparedStatement statement = con.prepareStatement("SELECT SUM(chr.points), SUM(it.count), ch.char_name, ch.pkkills, ch.pvpkills, ch.onlinetime, ch.base_class, ch.online FROM characters ch LEFT JOIN character_raid_points chr ON ch.obj_Id=chr.char_id LEFT OUTER JOIN items it ON ch.obj_Id=it.owner_id WHERE item_id=57 GROUP BY ch.obj_Id ORDER BY pkkills DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
                            ResultSet result = statement.executeQuery();
                            while (result.next())
                            {
                                pos++;
                                boolean status = false;
                                if (result.getInt("online") == 1)
                                {
                                        status = true;
                                }
                                String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
                                String adenas = getAdenas(result.getInt("SUM(it.count)"));
                                
                                _pkList.append("<table border=0 cellspacing=0 cellpadding=2 height=" + Config.TOP_PLAYER_ROW_HEIGHT + " width=610><tr><td FIXWIDTH=5></td>");
                                _pkList.append("<td FIXWIDTH=25>" + pos + "</td>");
                                _pkList.append("<td FIXWIDTH=180>" + result.getString("ch.char_name") + "</td>");
                                _pkList.append("<td FIXWIDTH=175>" + className(result.getInt("base_class")) + "</td>");
                                _pkList.append("<td FIXWIDTH=60>" + result.getInt("ch.pvpkills") + "</td>");
                                _pkList.append("<td FIXWIDTH=60>" + result.getInt("ch.pkkills") + "</td>");
                                _pkList.append("<td FIXWIDTH=70>" + result.getInt("SUM(chr.points)") + "</td>");
                                _pkList.append("<td FIXWIDTH=140>" + adenas + "</td>");
                                _pkList.append("<td FIXWIDTH=150>" + timeon + "</td>");
                                _pkList.append("<td FIXWIDTH=65>" + (status ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
                                _pkList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");                                
                            }
                            result.close();
                            statement.close();
                        }
                        catch (Throwable localThrowable1)
                        {
                                localThrowable3 = localThrowable1;throw localThrowable1;
                        }
                        finally
                        {
                                if (con != null)
                                {
                                        if (localThrowable3 != null)
                                        {
                                                try
                                                {
                                                        con.close();
                                                }
                                                catch (Throwable localThrowable2)
                                                {
                                                        localThrowable3.addSuppressed(localThrowable2);
                                                }
                                        }
                                        else
                                        {
                                                con.close();
                                        }
                                }
                        }
                }
                catch (Exception e)
                {
                        _log.log(Level.WARNING, "Failed to update pk list!");
                        e.printStackTrace();
                }
        }
        
        static void updateRaidList()
        {
                try
                {
                        Connection con = L2DatabaseFactory.getInstance().getConnection();Throwable localThrowable3 = null;
                        try
                        {
                                int pos = 0;
                                        
                                PreparedStatement statement = con.prepareStatement("SELECT SUM(chr.points), SUM(it.count), ch.char_name, ch.pkkills, ch.pvpkills, ch.onlinetime, ch.base_class, ch.online FROM characters ch LEFT JOIN character_raid_points chr ON ch.obj_Id=chr.char_id LEFT OUTER JOIN items it ON ch.obj_Id=it.owner_id WHERE item_id=57 GROUP BY ch.obj_Id ORDER BY SUM(chr.points) DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
                                ResultSet result = statement.executeQuery();
                                while (result.next())
                                {
                                        pos++;
                                    boolean status = false;
                                    if (result.getInt("online") == 1)
                                    {
                                        status = true;
                                    }
                                    String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
                                    String adenas = getAdenas(result.getInt("SUM(it.count)"));
                                        
                                    _raidList.append("<table border=0 cellspacing=0 cellpadding=2 height=" + Config.TOP_PLAYER_ROW_HEIGHT + " width=610><tr><td FIXWIDTH=5></td>");
                                    _raidList.append("<td FIXWIDTH=25>" + pos + "</td>");
                                    _raidList.append("<td FIXWIDTH=180>" + result.getString("ch.char_name") + "</td>");
                                    _raidList.append("<td FIXWIDTH=175>" + className(result.getInt("base_class")) + "</td>");
                                    _raidList.append("<td FIXWIDTH=60>" + result.getInt("ch.pvpkills") + "</td>");
                                    _raidList.append("<td FIXWIDTH=60>" + result.getInt("ch.pkkills") + "</td>");
                                    _raidList.append("<td FIXWIDTH=70>" + result.getInt("SUM(chr.points)") + "</td>");
                                    _raidList.append("<td FIXWIDTH=140>" + adenas + "</td>");
                                    _raidList.append("<td FIXWIDTH=150>" + timeon + "</td>");
                                    _raidList.append("<td FIXWIDTH=65>" + (status ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
                                    _raidList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");
                                }
                                result.close();
                                statement.close();
                        }
                        catch (Throwable localThrowable1)
                        {
                                localThrowable3 = localThrowable1;throw localThrowable1;
                        }
                        finally
                        {
                                if (con != null)
                                {
                                        if (localThrowable3 != null)
                                        {
                                                try
                                                {
                                                        con.close();
                                                }
                                                catch (Throwable localThrowable2)
                                            {
                                                        localThrowable3.addSuppressed(localThrowable2);
                                            }
                                        }
                                        else
                                        {
                                                con.close();
                                        }
                                }
                        }
                }
                catch (Exception e)
                {
                        _log.log(Level.WARNING, "Failed to update raid list!");
                        e.printStackTrace();
                }
        }
        
        static void updateAdenaList()
        {
                try
                {
                        Connection con = L2DatabaseFactory.getInstance().getConnection();Throwable localThrowable3 = null;
                        try
                        {
                                int pos = 0;
                                
                            PreparedStatement statement = con.prepareStatement("SELECT SUM(chr.points), SUM(it.count), ch.char_name, ch.pkkills, ch.pvpkills, ch.onlinetime, ch.base_class, ch.online FROM characters ch LEFT JOIN character_raid_points chr ON ch.obj_Id=chr.char_id LEFT OUTER JOIN items it ON ch.obj_Id=it.owner_id WHERE item_id=57 GROUP BY ch.obj_Id ORDER BY SUM(it.count) DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
                            ResultSet result = statement.executeQuery();
                            while (result.next())
                            {
                                pos++;
                                boolean status = false;
                                if (result.getInt("online") == 1)
                                {
                                        status = true;
                                }
                                String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
                                String adenas = getAdenas(result.getInt("SUM(it.count)"));
                                
                                _adenaList.append("<table border=0 cellspacing=0 cellpadding=2 height=" + Config.TOP_PLAYER_ROW_HEIGHT + " width=610><tr><td FIXWIDTH=5></td>");
                                _adenaList.append("<td FIXWIDTH=25>" + pos + "</td>");
                                _adenaList.append("<td FIXWIDTH=180>" + result.getString("ch.char_name") + "</td>");
                                _adenaList.append("<td FIXWIDTH=175>" + className(result.getInt("base_class")) + "</td>");
                                _adenaList.append("<td FIXWIDTH=60>" + result.getInt("ch.pvpkills") + "</td>");
                                _adenaList.append("<td FIXWIDTH=60>" + result.getInt("ch.pkkills") + "</td>");
                                _adenaList.append("<td FIXWIDTH=70>" + result.getInt("SUM(chr.points)") + "</td>");
                                _adenaList.append("<td FIXWIDTH=140>" + adenas + "</td>");
                                _adenaList.append("<td FIXWIDTH=150>" + timeon + "</td>");
                                _adenaList.append("<td FIXWIDTH=65>" + (status ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
                                _adenaList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");                                                                                             
                            }
                            result.close();
                            statement.close();
                        }
                        catch (Throwable localThrowable1)
                        {
                                localThrowable3 = localThrowable1;throw localThrowable1;
                        }
                        finally
                        {
                                if (con != null)
                                {
                                        if (localThrowable3 != null)
                                        {
                                                try
                                                {
                                                        con.close();
                                                }
                                                catch (Throwable localThrowable2)
                                                {
                                                        localThrowable3.addSuppressed(localThrowable2);
                                                }
                                        }
                                        else
                                        {
                                                con.close();
                                        }
                                }
                        }
                }
                catch (Exception e)
                {
                        _log.log(Level.WARNING, "Failed to update adena list!");
                        e.printStackTrace();
                }
        }
        
        static void updateOnlineList()
        {
                try
                {
                        Connection con = L2DatabaseFactory.getInstance().getConnection();Throwable localThrowable3 = null;
                        try
                        {
                                int pos = 0;
                            PreparedStatement statement = con.prepareStatement("SELECT SUM(chr.points), SUM(it.count), ch.char_name, ch.pkkills, ch.pvpkills, ch.onlinetime, ch.base_class, ch.online FROM characters ch LEFT JOIN character_raid_points chr ON ch.obj_Id=chr.char_id LEFT OUTER JOIN items it ON ch.obj_Id=it.owner_id WHERE item_id=57 GROUP BY ch.obj_Id ORDER BY onlinetime DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
                            ResultSet result = statement.executeQuery();
                            while (result.next())     
                            {
                                pos++;
                                boolean status = false;
                                if (result.getInt("online") == 1)
                                {
                                        status = true;
                                }
                                String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
                                String adenas = getAdenas(result.getInt("SUM(it.count)"));
                                
                                _onlineList.append("<table border=0 cellspacing=0 cellpadding=2 height=" + Config.TOP_PLAYER_ROW_HEIGHT + " width=610><tr><td FIXWIDTH=5></td>");
                                _onlineList.append("<td FIXWIDTH=25>" + pos + "</td>");
                                _onlineList.append("<td FIXWIDTH=180>" + result.getString("ch.char_name") + "</td>");
                                _onlineList.append("<td FIXWIDTH=175>" + className(result.getInt("base_class")) + "</td>");
                                _onlineList.append("<td FIXWIDTH=60>" + result.getInt("ch.pvpkills") + "</td>");
                                _onlineList.append("<td FIXWIDTH=60>" + result.getInt("ch.pkkills") + "</td>");
                                _onlineList.append("<td FIXWIDTH=70>" + result.getInt("SUM(chr.points)") + "</td>");
                                _onlineList.append("<td FIXWIDTH=140>" + adenas + "</td>");
                                _onlineList.append("<td FIXWIDTH=150>" + timeon + "</td>");
                                _onlineList.append("<td FIXWIDTH=65>" + (status ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
                                _onlineList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");                            
                            }
                            result.close();
                            statement.close();
                        }
                        catch (Throwable localThrowable1)
                        {
                                localThrowable3 = localThrowable1;throw localThrowable1;
                        }
                        finally
                        {
                                if (con != null)
                                {
                                        if (localThrowable3 != null)
                                        {
                                                try
                                                {
                                                        con.close();
                                                }
                                                catch (Throwable localThrowable2)
                                                {
                                                        localThrowable3.addSuppressed(localThrowable2);
                                                }
                                        }
                                        else
                                        {
                                                con.close();
                                        }
                                }
                        }
                }
                catch (Exception e)
                {
                        _log.log(Level.WARNING, "Failed to update online time list!");
                    e.printStackTrace();
                }
        }
        
        public static String pvpList()
        {
                return _pvpList.toString();
        }
        
        public static String pkList()
        {
            return _pkList.toString();
        }
        
        public static String raidList()
        {
            return _raidList.toString();
        }
        
        public static String adenaList()
        {
            return _adenaList.toString();
        }
        
        public static String onlineList()
        {
            return _onlineList.toString();
        }
        
        static void lastUpdate(String format)
        {
            _lastUpdate = format;
        }
        
        public static String getLastUpdate()
        {
            return _lastUpdate;
        }       
        
        public static final String className(int classid)
        {
                Map<Integer, String> classList = new HashMap<>();
                
                classList.put(Integer.valueOf(0), "Fighter");
            classList.put(Integer.valueOf(1), "Warrior");
                classList.put(Integer.valueOf(2), "Gladiator");
                classList.put(Integer.valueOf(3), "Warlord");
                classList.put(Integer.valueOf(4), "Knight");
                classList.put(Integer.valueOf(5), "Paladin");
                classList.put(Integer.valueOf(6), "Dark Avenger");
                classList.put(Integer.valueOf(7), "Rogue");
                classList.put(Integer.valueOf(8), "Treasure Hunter");
            classList.put(Integer.valueOf(9), "Hawkeye");
                classList.put(Integer.valueOf(10), "Mage");
                classList.put(Integer.valueOf(11), "Wizard");
                classList.put(Integer.valueOf(12), "Sorcerer");
                classList.put(Integer.valueOf(13), "Necromancer");
                classList.put(Integer.valueOf(14), "Warlock");
                classList.put(Integer.valueOf(15), "Cleric");
                classList.put(Integer.valueOf(16), "Bishop");
                classList.put(Integer.valueOf(17), "Prophet");
                classList.put(Integer.valueOf(18), "Elven Fighter");
                classList.put(Integer.valueOf(19), "Elven Knight");
                classList.put(Integer.valueOf(20), "Temple Knight");
                classList.put(Integer.valueOf(21), "Swordsinger");
                classList.put(Integer.valueOf(22), "Elven Scout");
                classList.put(Integer.valueOf(23), "Plains Walker");
                classList.put(Integer.valueOf(24), "Silver Ranger");
                classList.put(Integer.valueOf(25), "Elven Mage");
                classList.put(Integer.valueOf(26), "Elven Wizard");
                classList.put(Integer.valueOf(27), "Spellsinger");
                classList.put(Integer.valueOf(28), "Elemental Summoner");
                classList.put(Integer.valueOf(29), "Oracle");
                classList.put(Integer.valueOf(30), "Elder");
                classList.put(Integer.valueOf(31), "Dark Fighter");
                classList.put(Integer.valueOf(32), "Palus Knightr");
                classList.put(Integer.valueOf(33), "Shillien Knight");
                classList.put(Integer.valueOf(34), "Bladedancer");
                classList.put(Integer.valueOf(35), "Assasin");
                classList.put(Integer.valueOf(36), "Abyss Walker");
                classList.put(Integer.valueOf(37), "Phantom Ranger");
                classList.put(Integer.valueOf(38), "Dark Mage");
                classList.put(Integer.valueOf(39), "Dark Wizard");
                classList.put(Integer.valueOf(40), "Spellhowler");
                classList.put(Integer.valueOf(41), "Phantom Summoner");
                classList.put(Integer.valueOf(42), "Shillien Oracle");
                classList.put(Integer.valueOf(43), "Shilien Elder");
                classList.put(Integer.valueOf(44), "Orc Fighter");
                classList.put(Integer.valueOf(45), "Orc Raider");
                classList.put(Integer.valueOf(46), "Destroyer");
                classList.put(Integer.valueOf(47), "Orc Monk");
                classList.put(Integer.valueOf(48), "Tyrant");
                classList.put(Integer.valueOf(49), "Orc Mage");
                classList.put(Integer.valueOf(50), "Orc Shaman");
                classList.put(Integer.valueOf(51), "Overlord");
                classList.put(Integer.valueOf(52), "Warcryer");
                classList.put(Integer.valueOf(53), "Dwarven Fighter");
                classList.put(Integer.valueOf(54), "Scavenger");
                classList.put(Integer.valueOf(55), "Bounty Hunter");
                classList.put(Integer.valueOf(56), "Artisan");
                classList.put(Integer.valueOf(57), "Warsmith");
                classList.put(Integer.valueOf(88), "Duelist");
                classList.put(Integer.valueOf(89), "Dreadnought");
                classList.put(Integer.valueOf(90), "Phoenix Knight");
                classList.put(Integer.valueOf(91), "Hell Knight");
                classList.put(Integer.valueOf(92), "Sagittarius");
                classList.put(Integer.valueOf(93), "Adventurer");
                classList.put(Integer.valueOf(94), "Archmage");
                classList.put(Integer.valueOf(95), "Soultaker");
                classList.put(Integer.valueOf(96), "Arcana Lord");
                classList.put(Integer.valueOf(97), "Cardinal");
                classList.put(Integer.valueOf(98), "Hierophant");
                classList.put(Integer.valueOf(99), "Evas Templar");
                classList.put(Integer.valueOf(100), "Sword Muse");
                classList.put(Integer.valueOf(101), "Wind Rider");
                classList.put(Integer.valueOf(102), "Moonlight Sentinel");
                classList.put(Integer.valueOf(103), "Mystic Muse");
                classList.put(Integer.valueOf(104), "Elemental Master");
                classList.put(Integer.valueOf(105), "Evas Saint");
                classList.put(Integer.valueOf(106), "Shillien Templar");
                classList.put(Integer.valueOf(107), "Spectral Dancer");
                classList.put(Integer.valueOf(108), "Ghost Hunter");
                classList.put(Integer.valueOf(109), "Ghost Sentinel");
                classList.put(Integer.valueOf(110), "Storm Screamer");
                classList.put(Integer.valueOf(111), "Spectral Master");
                classList.put(Integer.valueOf(112), "Shillien Saint");
                classList.put(Integer.valueOf(113), "Titan");
                classList.put(Integer.valueOf(114), "Grand Khavatari");
                classList.put(Integer.valueOf(115), "Dominator");
                classList.put(Integer.valueOf(116), "Doomcryer");
                classList.put(Integer.valueOf(117), "Fortune Seeker");
                classList.put(Integer.valueOf(118), "Maestro");
                  
                return classList.get(Integer.valueOf(classid));                 
        }
        
        static String getPlayerRunTime(int secs)
        {
                String timeResult = "";
                if (secs >= 86400)
                {
                        timeResult = Integer.toString(secs / 86400) + " Days " + Integer.toString(secs % 86400 / 3600) + " hours";
                }
                else
                {
                        timeResult = Integer.toString(secs / 3600) + " Hours " + Integer.toString(secs % 3600 / 60) + " mins";
                }
                return timeResult;
        }
        
        static String getAdenas(int adena)
        {
                String adenas = "";
                if (adena >= 1000000000)
                {
                        adenas = Integer.toString(adena / 1000000000) + " Billion " + Integer.toString(adena % 1000000000 / 1000000) + " million";
                }
                else
                {
                        adenas = Integer.toString(adena / 1000000) + " Million " + Integer.toString(adena % 1000000 / 1000) + " k";
                }
                return adenas;
        }
}

2 answers to this question

Recommended Posts

  • 0
Posted (edited)
try to change
String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
String adenas = getAdenas(result.getInt("SUM(it.count)")); 

to

String timeon = getPlayerRunTime(result.getLong("ch.onlinetime"));
String adenas = getAdenas(result.getLong("SUM(it.count)")); 

you also need to change

static String getPlayerRunTime

and

static String getAdenas

to long

 

Edited by Zacapa
Guest
This topic is now closed to further replies.


  • Posts

    • I do what I like because I don't need to push myself to do things for L2 as a means of income. You, on the other hand, are here trying to scam people for $20k files... But, since you're so talented and competent, I suppose you must be thriving on the fruits of your talents as an L2Off dev, no? Oh wait Guess not
    • If you have error [ERR] 1067 - Invalid default value for 'createDate'   `createDate` date DEFAULT NULL '00-00-0000', need use   `createDate` date DEFAULT NULL,
    • @Vedi don't give up bro. We are waiting for this project to come back stronger.  
    • Welcome to L2EpicFail Server developed by gamers for gamers!  OBT - 7th March 2024 at 18:00 GMT+0 GRAND OPENING - 14th March 2025 at 18:00 GMT+0 Website : https://l2epic.fail/ Discord : https://discord.gg/6hwhrkrHBG     Server Features and Rates Xp – 15x Sp – 9x Adena – 6x Drop – 2x Spoil - 2x Seal Stones drop -  3x   Epic Raid Boss drop - 1x Regular RBs - EXP 5x, SP 5x, drop 4x   Quest drop - 1x (some quests customized to 3x) Quest reward - 1x, Adena 3x, EXP 3x, SP 3x     Premium Account Xp +20% Sp +20% Adena +20% Drop +20% Spoil +20% Quest reward +20%   get by vote or donate World chat 20 times/day use ">" in chat. Buff Book outside of town. Applies to all accounts.     Special Features Classic interface ActiveAnticheat Vote System Missions Attendance check And more in information below     Noblesse There are 3 ways how to make noblesse 1 - Retail Quest with killing barakiel 2 - Modifed Quest, choose killing mobs for 100 items instead of barakiel 3 - Can be bought for Epic Coins     Raid Rank Killing regular Raids gives points according to the level of the RB to the clan of the player who killed the boss. At the end of every month, there will be rewards for top clans. For more info, follow our Discord.   monthly period killing RB = points to clan according to RB level rewards up to Valakas Necklace (not the first month) current statistics can be checked online     Epic Bosses & Respawns   Queen Ant 20 - 30 hours respawn window 1 hour always displayed in .epic auto PvP zone (max 43 level) HP boosted drop chance 40% guards, nurses lvl 40   Orfen 20 - 30 hours respawn window 1 hour always displayed in .epic auto PvP zone (max 56 level) HP boosted drop chance 40% earring gives +1 WIT, +1 INT   Core 20 - 30 hours respawn window 1 hour always displayed in .epic auto PvP zone (max 56 level) HP boosted drop chance 40% ring gives +1 STR, +1 DEX   Zaken 44 - 54 hours respawn window 1 hour always displayed in .epic auto PvP zone (max A grade) doors opened only 5 mins HP boosted   Baium Every Sunday 20:30 - 21:30 window 1 hour always displayed in .epic auto PvP zone (13 - 14th ToI level) regular HP   Frintezza Every Monday, Wednesday, Friday 20:00 - 21:00 window 1 hour always displayed in .epic auto PvP zone (all IT entrance) max 5 parties to entry max 500 range from NPC   Antharas Every two weeks on Saturday 21:00 - 22:00 window 1 hour always displayed in .epic auto PvP zone (bridge to heart)   Valakas Every two weeks on Saturday 21:00 - 22:00 window 1 hour always displayed in .epic auto PvP zone (Klein to heart)   every Epic RB drops Epic Medals equal to RB level x 10     Regular Bosses all regular RBs HP boosted M. def boosted a bit to give advantage to fighters all regular RBs respawn 24 - 30 hours every RB drops Epic Medals equal to RB level     Added Skills Mass Sweep - All Bounty Hunters 40+ Block Buff - All Characters, toggle Escape: 20 seconds - All Characters, no more SoEs   Skills autolearn. Losing skills after 16 levels of delevel. Max buffs 24 + 4 with books (no autolearn)     Augments NoGrade - 4% chance MidGrade - 5% chance HighGrade - 7% chance TopGrade - 6% chance   GM shop weapon/armor/jwl (max C grade) shots/spiritshots (max C grade) mana potions (500 MP, 5s)     NPC buffer all buffs, songs, dances including 3rd prof + resists 1 hour duration all chars Buff Book in inventory     Global Gatekeeper all towns including cata/necro ToI 3/5/7/10th     Olympiad Thursday to Saturday 18:00 - 23:50 UTC+0 period 7 days no class participants min 5 base class participants min 10 max enchant +6     Class Transfer 1st class 50k adena 2nd class 500k adena 3rd class 20kk adena + 700 Halisha marks (tradeable)     Noblesse Quest Quest retail like. Moonstone Shards, Demons Blood etc. quest drop boosted     Subclass Quest To get the quest, you have to be 75+ on your main character (start Reorin in Giran) Bring item from Cabrio chest Bring items from Hallate, Kernon and Golkonda chests Bring this back to Reorin Bring 984 B-grade crystals and top B weapon to Reorin Get low A-grade weapon as reward Done , you can take subclass (up to 5) from any Master in town     Clans all clan members get clan skills (no need for titles) max clan slots 65, max ppl in PvP zone 63 leave/dismiss penalty 0 hours max clans in ally 3     Others   max 3 windows per HWID (only one in PvP zone) protection after teleport for 20 seconds arrows and spellbooks drop turned off weight limit 10x, stackable enchants and LS champions blue (5x HP) min level for trade = 40, chat = 20 BoM/MoM spawned in towns Edited November 1, 2024 by NevesOma
    • Im searching to developer to help me 🙂 pm me 🙂
  • Topics

×
×
  • Create New...