Guest User

leagueofelo

a guest
Jan 26th, 2013
615
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.49 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Server_BETA
  3. Index: java/com/l2jserver/gameserver/model/entity/Ranks.java
  4. ===================================================================
  5. --- java/com/l2jserver/gameserver/model/entity/Ranks.java (revision 0)
  6. +++ java/com/l2jserver/gameserver/model/entity/Ranks.java (revision 0)
  7. @@ -0,0 +1,46 @@
  8. +/*
  9. + * Copyright (C) 2004-2013 L2J Server
  10. + *
  11. + * This file is part of L2J Server.
  12. + *
  13. + * L2J Server is free software: you can redistribute it and/or modify
  14. + * it under the terms of the GNU General Public License as published by
  15. + * the Free Software Foundation, either version 3 of the License, or
  16. + * (at your option) any later version.
  17. + *
  18. + * L2J Server is distributed in the hope that it will be useful,
  19. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  21. + * General Public License for more details.
  22. + *
  23. + * You should have received a copy of the GNU General Public License
  24. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  25. + */
  26. +package com.l2jserver.gameserver.model.entity;
  27. +
  28. +/**
  29. + * @author Marwan
  30. + */
  31. +public enum Ranks
  32. +{
  33. + Rank("Ranked", 100),
  34. + Rank2("Unranked", 0);
  35. + private final String rank;
  36. + private final int pts;
  37. +
  38. + Ranks(String r, int p)
  39. + {
  40. + rank = r;
  41. + pts = p;
  42. + }
  43. +
  44. + public String getRank()
  45. + {
  46. + return rank;
  47. + }
  48. +
  49. + public int getRankPts()
  50. + {
  51. + return pts;
  52. + }
  53. +}
  54. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  55. ===================================================================
  56. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5757)
  57. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  58. @@ -167,6 +167,8 @@
  59. import com.l2jserver.gameserver.model.entity.Hero;
  60. import com.l2jserver.gameserver.model.entity.Instance;
  61. import com.l2jserver.gameserver.model.entity.L2Event;
  62. +import com.l2jserver.gameserver.model.entity.LeagueOfElo;
  63. +import com.l2jserver.gameserver.model.entity.Ranks;
  64. import com.l2jserver.gameserver.model.entity.Siege;
  65. import com.l2jserver.gameserver.model.entity.TvTEvent;
  66. import com.l2jserver.gameserver.model.fishing.L2Fish;
  67. @@ -306,6 +308,38 @@
  68. */
  69. public final class L2PcInstance extends L2Playable
  70. {
  71. + String rank = "Unranked";
  72. +
  73. + public void setRank(String ranks)
  74. + {
  75. + rank = ranks;
  76. + }
  77. +
  78. + public String getRank()
  79. + {
  80. +
  81. + return rank;
  82. + }
  83. +
  84. + int rankpts;
  85. +
  86. + public void SetRankPts(int i)
  87. + {
  88. + rankpts = i;
  89. + for (Ranks r : Ranks.values())
  90. + {
  91. + if (this.getRankPts() >= r.getRankPts())
  92. + {
  93. + this.setRank(r.getRank());
  94. + }
  95. + }
  96. + }
  97. +
  98. + public int getRankPts()
  99. + {
  100. + return rankpts;
  101. + }
  102. +
  103. // Character Skill SQL String Definitions:
  104. private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?";
  105. private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
  106. @@ -325,8 +359,8 @@
  107.  
  108. // Character Character SQL String Definitions:
  109. private static final String INSERT_CHARACTER = "INSERT INTO characters (account_name,charId,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,face,hairStyle,hairColor,sex,exp,sp,karma,fame,pvpkills,pkkills,clanid,race,classid,deletetime,cancraft,title,title_color,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,createDate) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  110. - private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=? WHERE charId=?";
  111. - private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createDate,language FROM characters WHERE charId=?";
  112. + private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,face=?,hairStyle=?,hairColor=?,sex=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,fame=?,pvpkills=?,pkkills=?,clanid=?,race=?,classid=?,deletetime=?,title=?,title_color=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,punish_level=?,punish_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,rank=? WHERE charId=?";
  113. + private static final String RESTORE_CHARACTER = "SELECT account_name, charId, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, face, hairStyle, hairColor, sex, heading, x, y, z, exp, expBeforeDeath, sp, karma, fame, pvpkills, pkkills, clanid, race, classid, deletetime, cancraft, title, title_color, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, punish_level, punish_timer, newbie, nobless, power_grade, subpledge, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createDate,language,rank FROM characters WHERE charId=?";
  114.  
  115. // Character Teleport Bookmark:
  116. private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
  117. @@ -5810,10 +5844,41 @@
  118. * attacker and Karam loss for the killed L2PcInstance</li> <li>If the killed L2PcInstance has Karma, manage Drop Item</li> <li>Kill the L2PcInstance</li>
  119. * @param killer
  120. */
  121. + boolean blue = false;
  122. + boolean red = false;
  123. +
  124. + public void setBlue(boolean h)
  125. + {
  126. + blue = h;
  127. + }
  128. +
  129. + public boolean isBlue()
  130. + {
  131. + return blue;
  132. + }
  133. +
  134. + public void setRed(boolean h)
  135. + {
  136. + red = h;
  137. + }
  138. +
  139. + public boolean isRed()
  140. + {
  141. + return red;
  142. + }
  143. +
  144. @Override
  145. public boolean doDie(L2Character killer)
  146. {
  147. // Kill the L2PcInstance
  148. +
  149. + // Kill the L2PcInstance
  150. + if (isRed() || isBlue())
  151. + {
  152. + sendMessage("You will be respawned in 1 minute");
  153. + LeagueOfElo.res(this);
  154. + }
  155. +
  156. if (!super.doDie(killer))
  157. {
  158. return false;
  159. @@ -6220,6 +6285,14 @@
  160. */
  161. public void increasePvpKills(L2Character target)
  162. {
  163. + if (isRed())
  164. + {
  165. + LeagueOfElo.redpts += 1;
  166. + }
  167. + if (isBlue())
  168. + {
  169. + LeagueOfElo.bluepts += 1;
  170. + }
  171. if ((target instanceof L2PcInstance) && AntiFeedManager.getInstance().check(this, target))
  172. {
  173. // Add karma to attacker and increase its PK counter
  174. @@ -7715,7 +7788,11 @@
  175. player = new L2PcInstance(objectId, template, rset.getString("account_name"), app);
  176. player.setName(rset.getString("char_name"));
  177. player._lastAccess = rset.getLong("lastAccess");
  178.  
  179. + player.setRank(rset.getString("rank"));
  180. player.getStat().setExp(rset.getLong("exp"));
  181. player.setExpBeforeDeath(rset.getLong("expBeforeDeath"));
  182. player.getStat().setLevel(rset.getByte("level"));
  183. @@ -8241,6 +8318,8 @@
  184. store(true);
  185. }
  186.  
  187. + public static int wins, loses = 0;
  188. +
  189. private void storeCharBase()
  190. {
  191. try (Connection con = L2DatabaseFactory.getInstance().getConnection())
  192. @@ -8313,7 +8392,10 @@
  193. statement.setInt(50, getBookMarkSlot());
  194. statement.setInt(51, getVitalityPoints());
  195. statement.setString(52, getLang());
  196. - statement.setInt(53, getObjectId());
  197. + statement.setString(53, getRank());
  198. + statement.setInt(54, wins);
  199. + statement.setInt(55, loses);
  200. + statement.setInt(54, getObjectId());
  201.  
  202. statement.execute();
  203. statement.close();
  204. @@ -11883,6 +11965,7 @@
  205.  
  206. public void onActionRequest()
  207. {
  208. +
  209. if (isSpawnProtected())
  210. {
  211. sendPacket(SystemMessageId.YOU_ARE_NO_LONGER_PROTECTED_FROM_AGGRESSIVE_MONSTERS);
  212. Index: java/com/l2jserver/gameserver/model/entity/LeagueOfElo.java
  213. ===================================================================
  214. --- java/com/l2jserver/gameserver/model/entity/LeagueOfElo.java (revision 0)
  215. +++ java/com/l2jserver/gameserver/model/entity/LeagueOfElo.java (revision 0)
  216. @@ -0,0 +1,290 @@
  217. +/* This program is free software; you can redistribute it and/or modify
  218. + * it under the terms of the GNU General Public License as published by
  219. + * the Free Software Foundation; either version 2, or (at your option)
  220. + * any later version.
  221. + *
  222. + * This program is distributed in the hope that it will be useful,
  223. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  224. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  225. + * GNU General Public License for more details.
  226. + *
  227. + * You should have received a copy of the GNU General Public License
  228. + * along with this program; if not, write to the Free Software
  229. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  230. + * 02111-1307, USA.
  231. + *
  232. + * http://www.gnu.org/copyleft/gpl.html
  233. + */
  234. +package com.l2jserver.gameserver.model.entity;
  235. +
  236. +import java.util.Vector;
  237. +
  238. +import javolution.util.FastList;
  239. +
  240. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  241. +import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
  242. +
  243. +/**
  244. + * @author Marwan
  245. + */
  246. +public class LeagueOfElo
  247. +{
  248. + @SuppressWarnings("unused")
  249. + public static FastList<L2PcInstance> vs5, svs5 = new FastList<L2PcInstance>();
  250. + public static FastList<L2PcInstance> sfiver, sfiveb = new FastList<L2PcInstance>();
  251. + public static FastList<L2PcInstance> fiver, fiveb = new FastList<L2PcInstance>();
  252. + public static Vector<L2PcInstance> team1, team2 = new Vector<L2PcInstance>();
  253. + public static int redpts, bluepts = 0;
  254. + public static int blue, red;
  255. +
  256. + public static void Team5v5()
  257. + {
  258. + int redpts = 0, bluepts = 0;
  259. + if (vs5.size() == 10)
  260. + {
  261. +
  262. + boolean AddRed = true;
  263. + for (L2PcInstance a : vs5)
  264. + {
  265. + if (AddRed == true)
  266. + {
  267. + // add to red
  268. + fiver.add(a);
  269. + }
  270. + else
  271. + {
  272. + // add to blue
  273. + fiveb.add(a);
  274. + }
  275. + AddRed = !AddRed;
  276. + }
  277. +
  278. + for (L2PcInstance redp : fiver)
  279. + {
  280. + redp.getAppearance().setNameColor(255, 0, 0);
  281. + redp.sendMessage("Youre in red team");
  282. + redp.teleToLocation(147771, 46712, -3411);
  283. + redp.setRed(true);
  284. + }
  285. + for (L2PcInstance bluep : fiveb)
  286. + {
  287. + bluep.getAppearance().setNameColor(0, 0, 255);
  288. + bluep.sendMessage("Youre in blue team");
  289. + bluep.teleToLocation(151248, 46721, -3406);
  290. + bluep.setBlue(true);
  291. + }
  292. + wait(10);
  293. + if (redpts > bluepts)
  294. + {
  295. + for (L2PcInstance k : fiver)
  296. + {
  297. + k.sendMessage("You won");
  298. + k.SetRankPts(k.getRankPts() + 15);
  299. + }
  300. + for (L2PcInstance k : fiveb)
  301. + {
  302. + k.sendMessage("You lost");
  303. + k.SetRankPts(k.getRankPts() - 15);
  304. + }
  305. + }
  306. + else if (bluepts > redpts)
  307. + {
  308. + for (L2PcInstance k : fiver)
  309. + {
  310. + k.sendMessage("You lost");
  311. + k.SetRankPts(k.getRankPts() - 15);
  312. + }
  313. + for (L2PcInstance k : fiveb)
  314. + {
  315. + k.sendMessage("You won");
  316. + k.SetRankPts(k.getRankPts() + 15);
  317. + }
  318. + }
  319. + else if (bluepts == redpts)
  320. + {
  321. + for (L2PcInstance k : fiver)
  322. + {
  323. + k.sendMessage("You won");
  324. + k.SetRankPts(k.getRankPts() + 5);
  325. + }
  326. + for (L2PcInstance k : fiveb)
  327. + {
  328. + k.sendMessage("Match end in tie");
  329. + k.SetRankPts(k.getRankPts() + 5);
  330. + }
  331. + }
  332. + }
  333. + }
  334. +
  335. + public static void Solo5vs5()
  336. + {
  337. +
  338. + if (svs5.size() == 2)
  339. + {
  340. +
  341. + boolean AddRed = true;
  342. + for (L2PcInstance a : svs5)
  343. + {
  344. + if (AddRed == true)
  345. + {
  346. + // add to red
  347. + sfiver.add(a);
  348. + }
  349. + else
  350. + {
  351. + // add to blue
  352. + sfiveb.add(a);
  353. + }
  354. + AddRed = !AddRed;
  355. + }
  356. +
  357. + for (L2PcInstance redp : sfiver)
  358. + {
  359. + redp.getAppearance().setNameColor(255, 0, 0);
  360. + redp.sendMessage("Youre in red team");
  361. + redp.teleToLocation(147771, 46712, -3411);
  362. + redp.setRed(true);
  363. + }
  364. + for (L2PcInstance bluep : sfiveb)
  365. + {
  366. + bluep.getAppearance().setNameColor(0, 0, 255);
  367. + bluep.sendMessage("Youre in blue team");
  368. + bluep.teleToLocation(151248, 46721, -3406);
  369. + bluep.setBlue(true);
  370. + }
  371. + wait(10);
  372. + if (redpts > bluepts)
  373. + {
  374. + for (L2PcInstance k : sfiver)
  375. + {
  376. + k.sendMessage("You won");
  377. + k.SetRankPts(k.getRankPts() + 15);
  378. + }
  379. + for (L2PcInstance k : sfiveb)
  380. + {
  381. + k.sendMessage("You lost");
  382. + k.SetRankPts(k.getRankPts() - 15);
  383. + }
  384. + }
  385. + else if (bluepts > redpts)
  386. + {
  387. + for (L2PcInstance k : sfiver)
  388. + {
  389. + k.sendMessage("You lost");
  390. + k.SetRankPts(k.getRankPts() - 15);
  391. + }
  392. + for (L2PcInstance k : sfiveb)
  393. + {
  394. + k.sendMessage("You won");
  395. + k.SetRankPts(k.getRankPts() + 15);
  396. + }
  397. + }
  398. + else if (bluepts == redpts)
  399. + {
  400. + for (L2PcInstance k : sfiver)
  401. + {
  402. + k.sendMessage("You won");
  403. + k.SetRankPts(k.getRankPts() + 5);
  404. + }
  405. + for (L2PcInstance k : sfiveb)
  406. + {
  407. + k.sendMessage("Match end in tie");
  408. + k.SetRankPts(k.getRankPts() + 5);
  409. + }
  410. + }
  411. +
  412. + }
  413. + }
  414. +
  415. + public static void svs5reg(L2PcInstance p)
  416. + {
  417. + svs5.add(p);
  418. + }
  419. +
  420. + public static void res(L2PcInstance a)
  421. + {
  422. + wait(1);
  423. + a.doRevive();
  424. + }
  425. +
  426. +
  427. + public static void wait(int i)
  428. + {
  429. + try
  430. + {
  431. + Thread.sleep(i * 60000);
  432. + }
  433. + catch (InterruptedException ie)
  434. + {
  435. + ie.printStackTrace();
  436. + }
  437. + }
  438. +
  439. +}
  440. \ No newline at end of file
  441. ### Eclipse Workspace Patch 1.0
  442. #P L2J_Server_BETA2
  443. Index: java/com/l2jserver/gameserver/model/actor/instance/L2LeagueInstance.java
  444. ===================================================================
  445. --- java/com/l2jserver/gameserver/model/actor/instance/L2LeagueInstance.java (revision 0)
  446. +++ java/com/l2jserver/gameserver/model/actor/instance/L2LeagueInstance.java (revision 0)
  447. @@ -0,0 +1,310 @@
  448. +package com.l2jserver.gameserver.model.actor.instance;
  449. +
  450. +import java.sql.Connection;
  451. +import java.sql.PreparedStatement;
  452. +import java.sql.ResultSet;
  453. +import java.sql.SQLException;
  454. +import java.util.StringTokenizer;
  455. +
  456. +import javolution.text.TextBuilder;
  457. +
  458. +import com.l2jserver.L2DatabaseFactory;
  459. +import com.l2jserver.gameserver.model.L2World;
  460. +import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
  461. +import com.l2jserver.gameserver.model.entity.LeagueOfElo;
  462. +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  463. +
  464. +/**
  465. + * @author Marwan
  466. + * @version 1.0
  467. + */
  468. +public class L2LeagueInstance extends L2NpcInstance
  469. +{
  470. + boolean r = true;
  471. +
  472. + public L2LeagueInstance (int objectId, L2NpcTemplate template)
  473. + {
  474. + super(objectId, template);
  475. + }
  476. +
  477. + @Override
  478. + public void onBypassFeedback(L2PcInstance activeChar, String command)
  479. + {
  480. +
  481. + if (command.startsWith("teamm"))
  482. + {
  483. + Connection con = null;
  484. + try
  485. + {
  486. +
  487. + con = L2DatabaseFactory.getInstance().getConnection();
  488. + PreparedStatement stm = con.prepareStatement("SELECT member1,member2,member3,member4 FROM rankedteams WHERE leader=?");
  489. + stm.setString(1, activeChar.getName());
  490. + ResultSet rs = stm.executeQuery();
  491. + L2PcInstance h;
  492. + while (rs.next())
  493. + {
  494. + if (r)
  495. + {
  496. +
  497. + L2PcInstance t1 = L2World.getInstance().getPlayer(rs.getString("member1"));
  498. + L2PcInstance t2 = L2World.getInstance().getPlayer(rs.getString("member2"));
  499. + L2PcInstance t3 = L2World.getInstance().getPlayer(rs.getString("member3"));
  500. + L2PcInstance t4 = L2World.getInstance().getPlayer(rs.getString("member4"));
  501. + if (t1.isOnline() && t2.isOnline() && t3.isOnline() && t4.isOnline())
  502. + {
  503. + activeChar.sendMessage("Registartion Succesfull");
  504. + LeagueOfElo.team1.add(t1);
  505. + LeagueOfElo.team1.add(t2);
  506. + LeagueOfElo.team1.add(t3);
  507. + LeagueOfElo.team1.add(t4);
  508. + LeagueOfElo.team1.add(activeChar);
  509. + LeagueOfElo.red = 5;
  510. + }
  511. + else
  512. + {
  513. + activeChar.sendMessage("someone in your team is offline biatch");
  514. + }
  515. + r = false;
  516. + return;
  517. + }
  518. + else
  519. + {
  520. + L2PcInstance t1 = L2World.getInstance().getPlayer(rs.getString("member1"));
  521. + L2PcInstance t2 = L2World.getInstance().getPlayer(rs.getString("member2"));
  522. + L2PcInstance t3 = L2World.getInstance().getPlayer(rs.getString("member3"));
  523. + L2PcInstance t4 = L2World.getInstance().getPlayer(rs.getString("member4"));
  524. + if (t1.isOnline() && t2.isOnline() && t3.isOnline() && t4.isOnline())
  525. + {
  526. + activeChar.sendMessage("Registartion Succesfull");
  527. + LeagueOfElo.team2.add(t1);
  528. + LeagueOfElo.team2.add(t2);
  529. + LeagueOfElo.team2.add(t3);
  530. + LeagueOfElo.team2.add(t4);
  531. + LeagueOfElo.team2.add(activeChar);
  532. + LeagueOfElo.blue = 5;
  533. + }
  534. + else
  535. + {
  536. + activeChar.sendMessage("someone in your team is offline biatch");
  537. + }
  538. + r = true;
  539. + }
  540. +
  541. + rs.close();
  542. + stm.close();
  543. + }
  544. + }
  545. + catch (SQLException sqle)
  546. + {
  547. + }
  548. + finally
  549. + {
  550. +
  551. + try
  552. + {
  553. + con.close();
  554. + }
  555. + catch (SQLException e)
  556. + {
  557. + // TODO Auto-generated catch block
  558. + e.printStackTrace();
  559. + }
  560. +
  561. + }
  562. + if ((LeagueOfElo.red == 5) && (LeagueOfElo.blue == 5))
  563. + {
  564. + LeagueOfElo.Team5v5();
  565. + }
  566. +
  567. + }
  568. + else if (command.startsWith("status"))
  569. + {
  570. + TextBuilder sb = new TextBuilder();
  571. + Connection con = null;
  572. + sb.append("<html><title>League Of Elo</title><body><br><br>");
  573. + try
  574. + {
  575. + con = L2DatabaseFactory.getInstance().getConnection();
  576. +
  577. + PreparedStatement statement = con.prepareStatement("SELECT * FROM characters where `char_name`=? ");
  578. +
  579. + statement.setString(1, activeChar.getName());
  580. + statement.execute();
  581. + ResultSet result = statement.executeQuery();
  582. +
  583. + while (result.next())
  584. + {
  585. + sb.append("Wins : " + result.getInt(62) + "<br>");
  586. + sb.append("Loses : " + result.getInt(63));
  587. + sb.append("</body></html>");
  588. + }
  589. + statement.close();
  590. + }
  591. + catch (Exception e)
  592. + {
  593. +
  594. + }
  595. + finally
  596. + {
  597. +
  598. + try
  599. + {
  600. + con.close();
  601. + }
  602. + catch (SQLException e)
  603. + {
  604. + // TODO Auto-generated catch block
  605. + e.printStackTrace();
  606. + }
  607. + }
  608. + NpcHtmlMessage msg = new NpcHtmlMessage(6);
  609. + msg.setHtml(sb.toString());
  610. + activeChar.sendPacket(msg);
  611. +
  612. + }
  613. +
  614. + else if (command.startsWith("team"))
  615. + {
  616. +
  617. + TextBuilder sb = new TextBuilder();
  618. + Connection con = null;
  619. + sb.append("<html><title>League Of Elo</title><body><br><br>");
  620. + try
  621. + {
  622. + con = L2DatabaseFactory.getInstance().getConnection();
  623. +
  624. + PreparedStatement statement = con.prepareStatement("SELECT * FROM rankedteams where `leader`=? OR `member1`=?");
  625. +
  626. + statement.setString(1, activeChar.getName());
  627. + statement.setString(2, activeChar.getName());
  628. + statement.execute();
  629. + ResultSet result = statement.executeQuery();
  630. +
  631. + while (result.next())
  632. + {
  633. + sb.append("Team Name : " + result.getString(1) + "<br>");
  634. + sb.append("Team Leader : " + result.getString(2) + "<br>");
  635. + sb.append("Team Members : " + result.getString(3) + " " + result.getString(4) + " " + result.getString(5) + " " + result.getString(6));
  636. + sb.append("<br>Wins : " + result.getString(7) + "<br>");
  637. + sb.append("Loses : " + result.getString(8) + "</body></html>");
  638. + }
  639. + statement.close();
  640. + }
  641. + catch (Exception e)
  642. + {
  643. +
  644. + }
  645. + finally
  646. + {
  647. +
  648. + try
  649. + {
  650. + con.close();
  651. + }
  652. + catch (SQLException e)
  653. + {
  654. + // TODO Auto-generated catch block
  655. + e.printStackTrace();
  656. + }
  657. + }
  658. + NpcHtmlMessage msg = new NpcHtmlMessage(6);
  659. + msg.setHtml(sb.toString());
  660. + activeChar.sendPacket(msg);
  661. +
  662. + }
  663. + else if (command.startsWith("createt"))
  664. + {
  665. + TextBuilder tb = new TextBuilder();
  666. + tb.append("<html><title>League Of Elo</title><body><center><br>");
  667. + tb.append("Name: <edit var=\"name\" width=\"50\" height=\"50\"><br>");
  668. + tb.append("<br><br><center><button value=\"Post\" action=\"bypass -h _npc_" + this.getObjectId() + "_create $name\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></center>");
  669. + NpcHtmlMessage msg = new NpcHtmlMessage(7);
  670. + msg.setHtml(tb.toString());
  671. + activeChar.sendPacket(msg);
  672. + }
  673. + else if (command.startsWith("create "))
  674. + {
  675. + String name = "";
  676. + StringTokenizer st = new StringTokenizer(command, " ");
  677. + st.nextToken();
  678. + while (st.hasMoreTokens())
  679. + {
  680. + name = name + st.nextToken();
  681. + }
  682. + Connection con = null;
  683. + try
  684. + {
  685. +
  686. + con = L2DatabaseFactory.getInstance().getConnection();
  687. +
  688. + PreparedStatement statement = con.prepareStatement("INSERT INTO rankedteams VALUES (?,?,?,?,?,?,?,?)");
  689. +
  690. + statement.setString(1, name);
  691. + statement.setString(2, activeChar.getName());
  692. + statement.setString(3, activeChar.getParty().getPartyMembers().getLast().getName());
  693. + statement.setString(4, activeChar.getParty().getPartyMembers().getFirst().getName());
  694. + statement.setString(5, activeChar.getParty().getPartyMembers().getFirst().getName());
  695. + statement.setString(6, activeChar.getParty().getPartyMembers().getFirst().getName());
  696. + statement.setInt(7, 1);
  697. + statement.setInt(8, 1);
  698. + statement.execute();
  699. + statement.close();
  700. +
  701. + activeChar.sendMessage("Succesfull");
  702. +
  703. + }
  704. + catch (Exception e)
  705. + {
  706. + }
  707. + finally
  708. + {
  709. +
  710. + try
  711. + {
  712. + con.close();
  713. + }
  714. + catch (SQLException e)
  715. + {
  716. + // TODO Auto-generated catch block
  717. + e.printStackTrace();
  718. + }
  719. + }
  720. + }
  721. +
  722. + else if (command.startsWith("five"))
  723. + {
  724. + activeChar.sendMessage("Registration Successful");
  725. + LeagueOfElo.svs5.add(activeChar);
  726. + if (LeagueOfElo.svs5.size() == 2)
  727. + {
  728. + LeagueOfElo.Solo5vs5();
  729. + }
  730. + }
  731. + }
  732. +
  733. + @Override
  734. + public void showChatWindow(L2PcInstance player, int val)
  735. + {
  736. + TextBuilder tb = new TextBuilder();
  737. + tb.append("<html><title>League Of Elo</title><body><center><br>");
  738. + tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
  739. + tb.append("<tr>");
  740. + tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
  741. + tb.append("<td valign=\"top\"><font color=\"FF6600\">LeagueOfElo</font>");
  742. + tb.append("<br1><font color=\"FF6600\">" + player.getName() + " </font>Your current ranking is " + player.getRank() + "<br1></td>");
  743. + tb.append("</tr>");
  744. + tb.append("</table>");
  745. + tb.append("<br><img src=\"l2ui.squaregray\" width=\"270\" height=\"1\"><br>");
  746. + tb.append("<button value=\"Create Ranked Team\" action=\"bypass -h createt\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
  747. + tb.append("<button value=\"Register 5vs5 Solo Match\" action=\"bypass -h npc_" + this.getObjectId() + "_five\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
  748. + tb.append("<button value=\"Register 5v5 Team Match\" action=\"bypass -h npc_" + this.getObjectId() + "_teamm\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
  749. + tb.append("<button value=\"Team Info\" action=\"bypass -h npc_" + this.getObjectId() + "_team\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
  750. + tb.append("<button value=\"My Status\" action=\"bypass -h npc_" + this.getObjectId() + "_status\" width=160 height=32 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\">");
  751. +
  752. + NpcHtmlMessage msg = new NpcHtmlMessage(this.getObjectId());
  753. + msg.setHtml(tb.toString());
  754. + player.sendPacket(msg);
  755. + }
  756. +
  757. +}
  758. \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment