Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * 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 com.l2jserver.gameserver.instancemanager;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import javolution.util.FastMap;
- import com.l2jserver.L2DatabaseFactory;
- import com.l2jserver.gameserver.model.L2World;
- import com.l2jserver.gameserver.model.actor.L2Npc;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.quest.Quest;
- import com.l2jserver.gameserver.model.quest.QuestState;
- /**
- * HallOfFame
- * @author Marwan
- */
- public final class HallOfFame extends Quest
- {
- private final static int NpcId = 1234;
- String noob;
- int num = 0;
- private HallOfFame(int questId, String name, String descr)
- {
- super(questId, name, descr);
- addStartNpc(NpcId);
- addTalkId(NpcId);
- get();
- }
- @Override
- public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
- {
- QuestState st = player.getQuestState("HallOfFame");
- if (st == null)
- {
- return "";
- }
- else if (event.equalsIgnoreCase("show"))
- {
- StringBuilder sb = new StringBuilder();
- sb.append("<html><title>HallOfFame</title>");
- sb.append("<body>");
- // sb.append("<br><font color=\"0066FF\">Current Event: 1vs1 </font>");
- sb.append("<table width=270 border=0 bgcolor=\"FF9900\"><tr>");
- sb.append("<td width=135 ALIGN=\"CENTER\">HallOfFame" + "</td><br>");
- sb.append("</tr></table><br>");
- sb.append("<br><font color=\"00ff4d\">Hello " + player.getName() + "<br><br></font>");
- sb.append("<hr>");
- sb.append("<br><br><br><br>");
- sb.append("<center><img src=\"L2UI.SquareWhite\" width=300 height=1>");
- sb.append("<table bgcolor=333333 width=100>");
- sb.append("<tr>");
- sb.append("<td width=135 ALIGN=\"LEFT\"><button value=\"Vote List\" action=\"bypass -h Quest HallOfFame showlist\" width=100 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>");
- sb.append("<td width=135 ALIGN=\"RIGHT\"><button value=\"Info\" action=\"bypass -h Quest HallOfFame moreinfo\" width=100 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>");
- sb.append("</tr>");
- sb.append("</table>");
- sb.append("<br><br></center>");
- return sb.toString();
- }
- else if (event.equalsIgnoreCase("addme"))
- {
- StringBuilder sb = new StringBuilder();
- if (player.getPvpKills() >= 1000)
- {
- sb.append("<html><title>HallOfFame</title><body><font color=\"1B8900\"><center>");
- sb.append("<br><br><br></font>You have been added to the list<br1></center></body></html>");
- }
- else
- {
- sb.append("<html><title>HallOfFame</title><body><font color=\"FF0033\"><center>");
- sb.append("<br><br><br></font>You dont meet the criteria<br1></center></body></html>");
- }
- return sb.toString();
- }
- else if (event.equalsIgnoreCase("showlist"))
- {
- StringBuilder sb = new StringBuilder();
- sb.append("<html><title>HallOfFame</title><body><font color=\"525252\">");
- sb.append("<br><br><table width=300><tr><td>Num.</td><td width=80>Name</td><td>Status</td></tr><br></font>");
- sb.append("<table>" + noob + "</table></body></html>");
- return sb.toString();
- }
- else if (event.equalsIgnoreCase("moreinfo"))
- {
- StringBuilder sb = new StringBuilder();
- sb.append("<html><title>HallOfFame</title>");
- sb.append("<body><h1>Info</h1></body></html>");
- return sb.toString();
- }
- return event;
- }
- public FastMap<L2PcInstance, String> get()
- {
- try
- {
- Connection con = L2DatabaseFactory.getInstance().getConnection();
- String sql = "SELECT char_name FROM characters WHERE famer=?";
- PreparedStatement statement = con.prepareStatement(sql);
- statement.setInt(1, 1);
- ResultSet rset = statement.executeQuery();
- while (rset.next())
- {
- boolean status = false;
- for (L2PcInstance n00b : L2World.getInstance().getAllPlayersArray())
- {
- if (n00b.getName().equals(rset.getString("char_name")))
- {
- status = true;
- }
- }
- num++;
- noob += "<tr><td><font color=\"336699\">" + num + "</td><td>" + rset.getString("char_name") + "</font></td><td>";
- if (status)
- {
- noob += "<font color=\"66FF00\">Online</font></td></tr>";
- }
- else
- {
- noob += "<font color=\"66FF00\">Offline</font></td></tr>";
- }
- }
- rset.close();
- }
- catch (Exception e)
- {
- }
- return null;
- }
- @SuppressWarnings("synthetic-access")
- public static HallOfFame getInstance()
- {
- return SingletonHolder._instance;
- }
- private static class SingletonHolder
- {
- @SuppressWarnings("synthetic-access")
- private static final HallOfFame _instance = new HallOfFame(-1, "HallOfFame", "instances");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment