11-07-2010, 04:16 PM
Помогите найти ошибку в скрипте вывода топ10 в камунити
При сборке ядра ошибки нету просто не выводит в камунити
При сборке ядра ошибки нету просто не выводит в камунити
скрипт
Код:
package ru.nproject.gameserver.communitybbs.Manager;
import ru.nproject.Config;
import ru.nproject.L2DatabaseFactory;
import ru.nproject.gameserver.cache.HtmCache;
import ru.nproject.gameserver.model.actor.instance.L2PcInstance;
import ru.nproject.gameserver.network.serverpackets.ShowBoard;
import java.util.Calendar;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.StringTokenizer;
import java.util.Map;
import javolution.util.FastMap;
import javolution.text.TextBuilder;
public class StatBBSManager extends BaseBBSManager
{
private static StatBBSManager _Instance = null;
public static StatBBSManager getInstance()
{
if(_Instance == null)
_Instance = new StatBBSManager();
return _Instance;
}
@Override
public void parsecmd(String command, L2PcInstance activeChar)
{
String content = HtmCache.getInstance().getHtmForce("data/html/CommunityBoard/28.htm");
content = content.replaceAll("%TopPvp%", GetTop("pvpkills"));
content = content.replaceAll("%TopPk%", GetTop("pkkills"));
content = content.replaceAll("%TopLvl%", GetTop("level"));
separateAndSend(content, activeChar);
}
public static String GetTop(String Index2)
{
TextBuilder html = new TextBuilder("");
int index = 0;
Connection con = null;
try
{
con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement statement = con.prepareStatement("SELECT c.char_name, c.base_class, c."+ Index2 +", c.level, c.online, cl.clan_name, cl.ally_name FROM characters c LEFT JOIN clan_data cl ON cl.clan_id=c.clanid WHERE c.accesslevel=0 ORDER BY c."+ Index2 +" DESC, c.char_name ASC LIMIT 10");
ResultSet rset = statement.executeQuery();
while (rset.next())
{
index++;
html.append("<table border=0 cellspacing=0 cellpadding=2 width=750>");
html.append("<tr><td FIXWIDTH=10></td>");
html.append("<td FIXWIDTH=40>"+ index +"</td>");
html.append("<td FIXWIDTH=150>"+ rset.getString("char_name") +" +</td>");
html.append("<td FIXWIDTH=80>"+ rset.getInt("level") +"</td>");
html.append("<td FIXWIDTH=160>"+ className(rset.getInt("base_class")) +"</td>");
html.append("<td FIXWIDTH=160>"+ rset.getString("clan_name") +"</td>");
html.append("<td FIXWIDTH=160>"+ rset.getString("ally_name") +"</td>");
html.append("<td FIXWIDTH=60>"+ rset.getInt(Index2) +"</td>");
if (rset.getInt("online") == 1)
{
html.append("<td FIXWIDTH=90><font color=99FF00>Online</font></td>");
}
else
{
html.append("<td FIXWIDTH=90><font color=CC0000>Offline</font></td>");
}
html.append("<td FIXWIDTH=5></td></tr>");
html.append("</table><img src=\"L2UI.Squaregray\" width=\"740\" height=\"1\"><br>");
}
rset.close();
statement.close();
con.close();
}
catch (Exception e)
{
}
return html.toString();
}
private static final String className(int classId)
{
Map classList = new FastMap();
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");
classList.put(Integer.valueOf(123), "Male Soldier");
classList.put(Integer.valueOf(124), "Female Soldier");
classList.put(Integer.valueOf(125), "Trooper");
classList.put(Integer.valueOf(126), "Warder");
classList.put(Integer.valueOf(127), "Berserker");
classList.put(Integer.valueOf(128), "Male Soulbreaker");
classList.put(Integer.valueOf(129), "Female Soulbreaker");
classList.put(Integer.valueOf(130), "Arbalester");
classList.put(Integer.valueOf(131), "Doombringer");
classList.put(Integer.valueOf(132), "Male Soulhound");
classList.put(Integer.valueOf(133), "Female Soulhound");
classList.put(Integer.valueOf(134), "Trickster");
classList.put(Integer.valueOf(135), "Inspector");
classList.put(Integer.valueOf(136), "Judicator");
return (String)classList.get(Integer.valueOf(classId));
}
@Override
public void parsewrite(String ar1, String ar2, String ar3, String ar4, String ar5, L2PcInstance activeChar)
{
}
}
Человек просто обязан ошибаться, раз другие учатся на его ошибках .......