Jump to content

Question

Posted

hello all...i try to adapt 1 community board from hi5 to freya...but i have 1 problem. with l2j hi5 server the database isnt same with l2j freya pack and in code cannot connect to sql for take the info about pvp pk stats from chars..this i think is the problem..

 

download patch if some one want download to see better the code:  http://www.4shared.com/file/2zTLm3-Sba/TopPlayers.html

 

the error in gs when i press the pvp/pk info button in community board:  error.png

 

the code:::

package com.l2jserver.gameserver.communitybbs;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Map;

import javolution.text.TextBuilder;
import javolution.util.FastMap;

import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;

public class TopPlayers
{
    private int pos;
    private TextBuilder _topList = new TextBuilder();
    String sort = "";
    
    public TopPlayers(String file)
    {
        loadDB(file);
    }
    
    @SuppressWarnings("null")
    private void loadDB(String file)
    {
        Connection con = null;
        
        switch (file)
        {
            case "toppvp":
                sort = "pvpkills";
                break;
            case "toppk":
                sort = "pkkills";
                break;
            case "topadena":
                sort = "SUM(it.count)";
                break;
            case "toprbrank":
                sort = "SUM(chr.points)";
                break;
            case "toponline":
                sort = "onlinetime";
                break;
            default:
                break;
        
        }
        
        try
        {
            pos = 0;
            con = L2DatabaseFactory.getInstance().getConnection();
            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.charId=chr.charId LEFT OUTER JOIN items it ON ch.charId=it.owner_id WHERE item_id=57 GROUP BY ch.charId ORDER BY " + sort + " DESC LIMIT " + Config.TOP_PLAYER_RESULTS);
            
            ResultSet result = statement.executeQuery();
            
            while (result.next())
            {
                boolean status = false;
                pos++;
                
                if (result.getInt("online") == 1)
                    status = true;
                String timeon = getPlayerRunTime(result.getInt("ch.onlinetime"));
                String adenas = getAdenas(result.getInt("SUM(it.count)"));
                
                addChar(pos, result.getString("ch.char_name"), result.getInt("base_class"), result.getInt("ch.pvpkills"), result.getInt("ch.pkkills"), result.getInt("SUM(chr.points)"), adenas, timeon, status);
            }
            
            result.close();
            statement.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
        finally
        {
            try
            {
                con.close();
            }
            catch (Exception e)
            {
                
            }
        }
    }
    
    public String loadTopList()
    {
        return _topList.toString();
    }
    
    private void addChar(int position, String name, int classid, int pvp, int pk, int raid, String adenas, String online, boolean isOnline)
    {
        _topList.append("<table border=0 cellspacing=0 cellpadding=2 bgcolor=050505 height=" + Config.TOP_PLAYER_ROW_HEIGHT + "><tr><td FIXWIDTH=5></td>");
        _topList.append("<td FIXWIDTH=20>" + position + ".</td>");
        _topList.append("<td FIXWIDTH=180>" + name + "</td>");
        _topList.append("<td FIXWIDTH=175>" + className(classid) + "</td>");
        _topList.append("<td FIXWIDTH=60>" + pvp + "</td>");
        _topList.append("<td FIXWIDTH=60>" + pk + "</td>");
        _topList.append("<td FIXWIDTH=65>" + raid + "</td>");
        _topList.append("<td FIXWIDTH=150>" + adenas + "</td>");
        _topList.append("<td FIXWIDTH=148>" + online + "</td>");
        _topList.append("<td FIXWIDTH=65>" + ((isOnline) ? "<font color=99FF00>Online</font>" : "<font color=CC0000>Offline</font>") + "</td>");
        _topList.append("</tr></table><img src=\"L2UI.Squaregray\" width=\"758\" height=\"1\">");
        
    }
    
    public final static String className(int classid)
    {
        Map<Integer, String> classList;
        classList = new FastMap<Integer, String>();
        classList.put(0, "Fighter");
        classList.put(1, "Warrior");
        classList.put(2, "Gladiator");
        classList.put(3, "Warlord");
        classList.put(4, "Knight");
        classList.put(5, "Paladin");
        classList.put(6, "Dark Avenger");
        classList.put(7, "Rogue");
        classList.put(8, "Treasure Hunter");
        classList.put(9, "Hawkeye");
        classList.put(10, "Mage");
        classList.put(11, "Wizard");
        classList.put(12, "Sorcerer");
        classList.put(13, "Necromancer");
        classList.put(14, "Warlock");
        classList.put(15, "Cleric");
        classList.put(16, "Bishop");
        classList.put(17, "Prophet");
        classList.put(18, "Elven Fighter");
        classList.put(19, "Elven Knight");
        classList.put(20, "Temple Knight");
        classList.put(21, "Swordsinger");
        classList.put(22, "Elven Scout");
        classList.put(23, "Plains Walker");
        classList.put(24, "Silver Ranger");
        classList.put(25, "Elven Mage");
        classList.put(26, "Elven Wizard");
        classList.put(27, "Spellsinger");
        classList.put(28, "Elemental Summoner");
        classList.put(29, "Oracle");
        classList.put(30, "Elder");
        classList.put(31, "Dark Fighter");
        classList.put(32, "Palus Knightr");
        classList.put(33, "Shillien Knight");
        classList.put(34, "Bladedancer");
        classList.put(35, "Assasin");
        classList.put(36, "Abyss Walker");
        classList.put(37, "Phantom Ranger");
        classList.put(38, "Dark Mage");
        classList.put(39, "Dark Wizard");
        classList.put(40, "Spellhowler");
        classList.put(41, "Phantom Summoner");
        classList.put(42, "Shillien Oracle");
        classList.put(43, "Shilien Elder");
        classList.put(44, "Orc Fighter");
        classList.put(45, "Orc Raider");
        classList.put(46, "Destroyer");
        classList.put(47, "Orc Monk");
        classList.put(48, "Tyrant");
        classList.put(49, "Orc Mage");
        classList.put(50, "Orc Shaman");
        classList.put(51, "Overlord");
        classList.put(52, "Warcryer");
        classList.put(53, "Dwarven Fighter");
        classList.put(54, "Scavenger");
        classList.put(55, "Bounty Hunter");
        classList.put(56, "Artisan");
        classList.put(57, "Warsmith");
        classList.put(88, "Duelist");
        classList.put(89, "Dreadnought");
        classList.put(90, "Phoenix Knight");
        classList.put(91, "Hell Knight");
        classList.put(92, "Sagittarius");
        classList.put(93, "Adventurer");
        classList.put(94, "Archmage");
        classList.put(95, "Soultaker");
        classList.put(96, "Arcana Lord");
        classList.put(97, "Cardinal");
        classList.put(98, "Hierophant");
        classList.put(99, "Evas Templar");
        classList.put(100, "Sword Muse");
        classList.put(101, "Wind Rider");
        classList.put(102, "Moonlight Sentinel");
        classList.put(103, "Mystic Muse");
        classList.put(104, "Elemental Master");
        classList.put(105, "Evas Saint");
        classList.put(106, "Shillien Templar");
        classList.put(107, "Spectral Dancer");
        classList.put(108, "Ghost Hunter");
        classList.put(109, "Ghost Sentinel");
        classList.put(110, "Storm Screamer");
        classList.put(111, "Spectral Master");
        classList.put(112, "Shillien Saint");
        classList.put(113, "Titan");
        classList.put(114, "Grand Khavatari");
        classList.put(115, "Dominator");
        classList.put(116, "Doomcryer");
        classList.put(117, "Fortune Seeker");
        classList.put(118, "Maestro");
        classList.put(123, "Male Soldier");
        classList.put(124, "Female Soldier");
        classList.put(125, "Trooper");
        classList.put(126, "Warder");
        classList.put(127, "Berserker");
        classList.put(128, "Male Soulbreaker");
        classList.put(129, "Female Soulbreaker");
        classList.put(130, "Arbalester");
        classList.put(131, "Doombringer");
        classList.put(132, "Male Soulhound");
        classList.put(133, "Female Soulhound");
        classList.put(134, "Trickster");
        classList.put(135, "Inspector");
        classList.put(136, "Judicator");
        
        return classList.get(classid);
    }
    
    public 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;
    }
    public 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;
    }
}

 

3 answers to this question

Recommended Posts

  • 0
Posted

its SQL problem i think...

 

what is the size of your INT?
 

Example:
 

CREATE TABLE `TEST` (
  `id` int(11) NOT NULL auto_increment,
  t  int unsigned,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

insert into TEST (t) VALUES (2147483680);

 

  • 0
Posted

 

its SQL problem i think...

 

what is the size of your INT?

 

Example:

 

CREATE TABLE `TEST` (
  `id` int(11) NOT NULL auto_increment,
  t  int unsigned,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

insert into TEST (t) VALUES (2147483680);

havent in code any sql file :(   http://www.maxcheaters.com/topic/135419-smart-community-board-epic-share/

Guest
This topic is now closed to further replies.


  • Posts

    • From Salvation onwards I think you need a patched nwindow.dll that allows such modifications, try to see if you get what you need here: https://drive.google.com/drive/u/1/folders/1LLbQFGf8KlR-O0Iv5umfF-pwZgrDh9bd
    • hello everyone! I am wanting to save the files (Ini. - Data - ) of the EP5 Client: Salvation... But they generate the error "corrupt files"... I tried several versions of L2FileEditor without good results. I need help! Thank you!
    • Opening December 6th at 19:00 (GMT +3)! Open Beta Test from November 30th!   https://l2soe.com/   🌟 Introducing L2 Saga of Eternia: A Revolution in Lineage 2 High Five! 🌟   Dear Lineage 2 enthusiasts, Prepare to witness the future of private servers! L2 Saga of Eternia is not just another High Five project—it’s a game-changing experience designed to compete with the giants of the Lineage 2 private server scene. Built for the community, by the community, we’re here to raise the bar in quality, innovation, and longevity. What Sets Us Apart? 💎 No Wipes, Ever Say goodbye to the fear of losing your progress. Our server is built to last and will never close. Stability and consistency are our promises to you. ⚔️ Weekly New Content Our dedicated development team ensures fresh challenges, events, and updates every week. From custom quests to exclusive features, there will always be something exciting to explore. 💰 No Pay-to-Win Skill and strategy matter most here. Enjoy a balanced gameplay environment where your achievements come from effort, not your wallet. 🌍 A Massive Community With 2000+ players expected, join a vibrant and active community of like-minded adventurers ready to conquer the world of Aden. 🏆 Fair and Competitive Gameplay Our systems are designed to promote healthy competition while avoiding abusive mechanics and exploits. 🔧 Professional Development From advanced bug fixes to carefully curated content, we pride ourselves on smooth performance, no lag, and unparalleled server quality. Key Features Chronicle: High Five with unique interface Rate: Dynamic x10 rates Class Balance: Carefully fine-tuned for a fair experience PvP Focused: PvP Ranking & aura display effect for 3 Top PvPers every week Custom Events: Seasonal and permanent events to keep you engaged Additional Features:   Custom Endgame Content: Introduce unique dungeons, raids, or zones unavailable in other servers. Player-Driven Economy: Implement a strong market system and avoid overinflated drops or rewards. Epic Siege Battles: Announce special large-scale sieges and PvP events. Incentives for Streamers and Clans: Attract influencers and big clans to boost server publicity. Roadmap Transparency: Share a public roadmap of planned updates to build trust and excitemen   Here you can read all the features: https://l2soe.com/features   Video preview: Join the Revolution! This is your chance to be part of something legendary. L2 Saga of Eternia is not just a server; it’s a movement to redefine what Lineage 2 can be. Whether you’re a seasoned veteran or a newcomer to the world of Aden, we invite you to experience Lineage 2 at its finest.   Official Launch Date: December 6th 2024 Website: https://l2soe.com/ Facebook: https://www.facebook.com/l2soe Discord: https://discord.com/invite/l2eternia   Let’s build the ultimate Lineage 2 experience together. See you in-game! 🎮
    • That's like a tutorial on how to run l2 on MacOS Xd but good job for the investigation. 
    • small update: dc robe set sold   wts adena 1kk = 1.5$ 
  • Topics

×
×
  • Create New...