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.


×
×
  • Create New...