Guest User

kill system

a guest
Oct 29th, 2012
335
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.28 KB | None | 0 0
  1. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  2. ===================================================================
  3. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5667)
  4. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
  5.  
  6. @@ -302,6 +309,51 @@
  7. */
  8. public final class L2PcInstance extends L2Playable
  9. {
  10.  
  11. + public static int _killpts = 0;
  12.  
  13. // Character Skill SQL String Definitions:
  14. private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?";
  15. private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
  16. @@ -321,8 +373,8 @@
  17.  
  18. // Character Character SQL String Definitions:
  19. 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  20. - 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=?";
  21. - 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=?";
  22. + 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=?,killpts=? WHERE charId=?";
  23. + 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,killpts FROM characters WHERE charId=?";
  24.  
  25. // Character Teleport Bookmark:
  26. private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
  27. @@ -1637,6 +1701,21 @@
  28. }
  29. }
  30.  
  31. + public void savePts()
  32. + {
  33. + try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  34. + PreparedStatement statement = con.prepareStatement("UPDATE characters SET killpts=? WHERE charId=?"))
  35. + {
  36. + statement.setInt(1, getKillpts());
  37. + statement.setInt(2, getObjectId());
  38. + statement.execute();
  39. + statement.close();
  40. + }
  41. + catch (Exception e)
  42. + {
  43. + _log.log(Level.SEVERE, "Failed updating character online status.", e);
  44. + }
  45. + }
  46. +
  47. private void deleteRecipeData(int recipeId, boolean isDwarf)
  48. {
  49. try (Connection con = L2DatabaseFactory.getInstance().getConnection();
  50.  
  51. @@ -2750,6 +2830,28 @@
  52. _pvpKills = pvpKills;
  53. }
  54.  
  55. + public int getKillpts()
  56. + {
  57. + return _killpts;
  58. + }
  59. +
  60. + public void setKillPt(int killpts)
  61. + {
  62. + _killpts = killpts;
  63. + }
  64. +
  65. /**
  66. * @return the Fame of this L2PcInstance
  67. */
  68.  
  69. @@ -6217,18 +6401,19 @@
  70. /**
  71. * Increase the pvp kills count and send the info to the player
  72. * @param target
  73. + * @throws SQLException
  74. */
  75. public void increasePvpKills(L2Character target)
  76. {
  77. +
  78. + setKillPt(getKillpts() + 2);9
  79. }
  80.  
  81. /**
  82. @@ -7720,6 +7931,8 @@
  83. player.setName(rset.getString("char_name"));
  84. player._lastAccess = rset.getLong("lastAccess");
  85.  
  86. + player.setKillPt(rset.getInt("killpts"));
  87. +
  88. player.getStat().setExp(rset.getLong("exp"));
  89. player.setExpBeforeDeath(rset.getLong("expBeforeDeath"));
  90. player.getStat().setLevel(rset.getByte("level"));
  91. @@ -8321,7 +8534,8 @@
  92. statement.setInt(50, getBookMarkSlot());
  93. statement.setInt(51, getVitalityPoints());
  94. statement.setString(52, getLang());
  95. - statement.setInt(53, getObjectId());
  96. + statement.setInt(53, getKillpts());
  97. + statement.setInt(54, getObjectId());
  98.  
  99. statement.execute();
  100. statement.close();
  101.  
  102. public boolean isInOlympiadMode()
  103. {
  104. return _inOlympiadMode;
  105.  
  106. }
  107. \ No newline at end of file
  108.  
  109. Index: dist/game/data/scripts/handlers/voicedcommandhandlers/kill.java
  110. ===================================================================
  111. --- dist/game/data/scripts/handlers/voicedcommandhandlers/kill.java (revision 0)
  112. +++ dist/game/data/scripts/handlers/voicedcommandhandlers/kill.java (revision 0)
  113. @@ -0,0 +1,230 @@
  114. +/*
  115. + * This program is free software: you can redistribute it and/or modify it under
  116. + * the terms of the GNU General Public License as published by the Free Software
  117. + * Foundation, either version 3 of the License, or (at your option) any later
  118. + * version.
  119. + *
  120. + * This program is distributed in the hope that it will be useful, but WITHOUT
  121. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  122. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  123. + * details.
  124. + *
  125. + * You should have received a copy of the GNU General Public License along with
  126. + * this program. If not, see <http://www.gnu.org/licenses/>.
  127. + */
  128. +package handlers.voicedcommandhandlers;
  129. +
  130. +import com.l2jserver.Config;
  131. +import com.l2jserver.gameserver.cache.HtmCache;
  132. +import com.l2jserver.gameserver.datatables.SkillTable;
  133. +import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
  134. +import com.l2jserver.gameserver.model.actor.instance.L2KillInstance;
  135. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  136. +import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
  137. +import com.l2jserver.gameserver.model.effects.L2Effect;
  138. +import com.l2jserver.gameserver.model.skills.L2Skill;
  139. +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  140. +import com.l2jserver.gameserver.network.serverpackets.SkillCoolTime;
  141. +
  142. +/**
  143. + * This class trades Gold Bars for Adena and vice versa.
  144. + * @author Marwan
  145. + */
  146. +public class kill implements IVoicedCommandHandler
  147. +{
  148. + private static final String[] _voicedCommands =
  149. + {
  150. + "kill","killshop"
  151. + };
  152. +
  153. + private static final String[][] combatButtons = {
  154. + {"Full Heal", "hp", "icon.skill5934"},
  155. + {"Cure Debuff", "dbuff", "icon.skill0430"},
  156. + {"Bsoe", "bsoe", "icon.skill0430"},
  157. + {"Reuse Skills", "clearReuse", "icon.skill0430"},
  158. + {"Remove Karma", "clearKarma", "icon.skill0430"},
  159. + {"Ress Myself", "resMe", "icon.skill0430"},
  160. + };
  161. + public static void onBypass(L2PcInstance activeChar, String command)
  162. + {
  163. + if (command.equals("hp"))
  164. + {
  165. + if (activeChar.getKillpts() >= 10)
  166. + {
  167. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  168. + activeChar.setCurrentHpMp(activeChar.getMaxHp(), activeChar.getMaxMp());
  169. + activeChar.setCurrentCp(activeChar.getMaxCp());
  170. + activeChar.sendMessage("Your Hp, Cp and Mp has been restored for 10 kill pts !");
  171. + }
  172. + else
  173. + {
  174. + activeChar.sendMessage("You need more kill points.");
  175. + }
  176. + }
  177. + else if (command.equals("dbuff"))
  178. + {
  179. + L2Effect[] effects = activeChar.getAllEffects();
  180. + if ((effects == null) || (effects.length == 0))
  181. + {
  182. + return;
  183. + }
  184. + if (activeChar.getKillpts() >= 10)
  185. + {
  186. + for (L2Effect e : effects)
  187. + {
  188. + if (e.getSkill().isDebuff())
  189. + {
  190. + e.exit();
  191. + }
  192. + }
  193. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  194. + activeChar.sendMessage("Your debuffs has been removed for kill pts !");
  195. + }
  196. + else
  197. + {
  198. + activeChar.sendMessage("You need more kill pts.");
  199. + }
  200. + }
  201. + else if (command.equals("bsoe"))
  202. + {
  203. + if (activeChar.getKillpts() >= 10)
  204. + {
  205. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  206. + L2Skill GM_escape = SkillTable.getInstance().getInfo(2100, 1);
  207. + activeChar.doCast(GM_escape);
  208. + activeChar.sendMessage("You have escaped from the battle for 10 kill pts !");
  209. + }
  210. + else
  211. + {
  212. + activeChar.sendMessage("You need more kill pts !");
  213. + }
  214. + }
  215. + else if (command.equals("clearReuse"))
  216. + {
  217. + if (activeChar.getKillpts() >= 10)
  218. + {
  219. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  220. + activeChar.getSkillReuseTimeStamps().clear();
  221. + activeChar.getDisabledSkills().clear();
  222. + activeChar.sendPacket(new SkillCoolTime(activeChar));
  223. + activeChar.sendMessage("You have reused all skils for 10 kill pts!");
  224. + }
  225. + else
  226. + {
  227. + activeChar.sendMessage("You need more kill pts!");
  228. + }
  229. + }
  230. + else if (command.equals("clearKarma"))
  231. + {
  232. + if (activeChar.getKillpts() >= 10)
  233. + {
  234. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  235. + activeChar.setKarma(0);
  236. + activeChar.sendMessage("You have cleared your karma for 10 kill pts");
  237. + }
  238. + else
  239. + {
  240. + activeChar.sendMessage("You need more kill pts!");
  241. + }
  242. + }
  243. + else if (command.equals("resMe"))
  244. + {
  245. + if (activeChar.isDead())
  246. + {
  247. + if (activeChar.getKillpts() >= 10)
  248. + {
  249. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  250. + activeChar.restoreExp(100.0);
  251. + activeChar.doRevive();
  252. + activeChar.sendMessage("You have been ressurected for 10 kill pts !");
  253. + }
  254. + else
  255. + {
  256. + activeChar.sendMessage("You need more kill pts!");
  257. + }
  258. + }
  259. + }
  260. + shop(activeChar, combatButtons);
  261. + }
  262. +
  263. + @Override
  264. + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
  265. + {
  266. +
  267. + if (command.equals("kill")){
  268. + showUserPage(activeChar,"killnpc.htm");
  269. + }
  270. + if(command.equals("killshop")){
  271. +
  272. + shop(activeChar, combatButtons);
  273. + }
  274. + return false;
  275. + }
  276. +
  277. + public static void showUserPage(L2PcInstance activeChar, String filename)
  278. + {
  279. + String content = HtmCache.getInstance().getHtmForce(activeChar.getHtmlPrefix(), "data/html/killsystem/" + filename);
  280. + NpcHtmlMessage kill = new NpcHtmlMessage(5);
  281. + kill.setHtml(content);
  282. + kill.replace("%kill_points%", "" + activeChar.getKillpts());
  283. + kill.replace("%player_name%", activeChar.getName());
  284. + activeChar.sendPacket(kill);
  285. +
  286. + }
  287. + public static void shop(L2PcInstance activeChar, String[][] buttons)
  288. + {
  289. +
  290. + String text = "<html><head><title>Kill Shop</title></head><body>";
  291. + text += "";
  292. + text += "<center>";
  293. + text += "<table width=230>";
  294. + int buttonIndex = 0;
  295. + for (int i = 0; i < Math.ceil(buttons.length / (double) 2); i++)
  296. + {
  297. + text += "<tr>";
  298. + for (int x = 0; x < 2; x++)
  299. + {
  300. + if (buttonIndex < buttons.length)
  301. + {
  302. + text += "<td align=center><img src=\"" + buttons[buttonIndex][2] + "\" width=32 height=32></td>";
  303. + }
  304. + else
  305. + {
  306. + text += "<td></td>";
  307. + }
  308. + buttonIndex++;
  309. + }
  310. + buttonIndex -= 2;
  311. + text += "</tr>";
  312. + text += "<tr><td></td></tr>";
  313. + text += "<tr>";
  314. +
  315. + for (int x = 0; x < 2; x++)
  316. + {
  317. + if (buttonIndex < buttons.length)
  318. + {
  319. + text += "<td align=center><button value=\"" + buttons[buttonIndex][0] + "\" action=\"bypass -h _donate " + buttons[buttonIndex][1] + "\" width=130 height=26 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
  320. + }
  321. + else
  322. + {
  323. + text += "<td></td>";
  324. + }
  325. + buttonIndex++;
  326. + }
  327. + text += "</tr>";
  328. + text += "<tr><td></td></tr>";
  329. + }
  330. + text += "</body></html>";
  331. +
  332. + NpcHtmlMessage msg = new NpcHtmlMessage(activeChar.getObjectId());
  333. + msg.setHtml(text);
  334. + activeChar.sendPacket(msg);
  335. + }
  336. +
  337. + @Override
  338. +
  339. + public String[] getVoicedCommandList()
  340. + {
  341. + return _voicedCommands;
  342. + }
  343. +}
  344. \ No newline at end of file
  345. Index: java/com/l2jserver/gameserver/model/actor/instance/L2KillInstance.java
  346. ===================================================================
  347. --- java/com/l2jserver/gameserver/model/actor/instance/L2KillInstance.java (revision 0)
  348. +++ java/com/l2jserver/gameserver/model/actor/instance/L2KillInstance.java (revision 0)
  349. @@ -0,0 +1,251 @@
  350. +/* This program is free software; you can redistribute it and/or modify
  351. + * it under the terms of the GNU General Public License as published by
  352. + * the Free Software Foundation; either version 2, or (at your option)
  353. + * any later version.
  354. + *
  355. + * This program is distributed in the hope that it will be useful,
  356. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  357. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  358. + * GNU General Public License for more details.
  359. + *
  360. + * You should have received a copy of the GNU General Public License
  361. + * along with this program; if not, write to the Free Software
  362. + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  363. + * 02111-1307, USA.
  364. + *
  365. + * http://www.gnu.org/copyleft/gpl.html
  366. + */
  367. +package com.l2jserver.gameserver.model.actor.instance;
  368. +
  369. +import com.l2jserver.gameserver.cache.HtmCache;
  370. +import com.l2jserver.gameserver.datatables.SkillTable;
  371. +import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
  372. +import com.l2jserver.gameserver.model.effects.L2Effect;
  373. +import com.l2jserver.gameserver.model.skills.L2Skill;
  374. +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  375. +import com.l2jserver.gameserver.network.serverpackets.SkillCoolTime;
  376. +
  377. +/**
  378. + * @author Marwan
  379. + */
  380. +public class L2KillInstance extends L2NpcInstance
  381. +{
  382. +
  383. + public L2KillInstance(int objectId, L2NpcTemplate template)
  384. + {
  385. + super(objectId, template);
  386. + }
  387. +
  388. + private static final String[][] combatButtons =
  389. + {
  390. + {
  391. + "Full Heal",
  392. + "hp",
  393. + "icon.skill5934"
  394. + },
  395. + {
  396. + "Cure Debuff",
  397. + "dbuff",
  398. + "icon.skill0430"
  399. + },
  400. + {
  401. + "Bsoe",
  402. + "bsoe",
  403. + "icon.skill0430"
  404. + },
  405. + {
  406. + "Reuse Skills",
  407. + "clearReuse",
  408. + "icon.skill0430"
  409. + },
  410. + {
  411. + "Remove Karma",
  412. + "clearKarma",
  413. + "icon.skill0430"
  414. + },
  415. + {
  416. + "Ress Myself",
  417. + "resMe",
  418. + "icon.skill0430"
  419. + },
  420. + };
  421. +
  422. + public static void onBypass(L2PcInstance activeChar, String command)
  423. + {
  424. + if (command.equals("hp"))
  425. + {
  426. + if (activeChar.getKillpts() >= 10)
  427. + {
  428. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  429. + activeChar.setCurrentHpMp(activeChar.getMaxHp(), activeChar.getMaxMp());
  430. + activeChar.setCurrentCp(activeChar.getMaxCp());
  431. + activeChar.sendMessage("Your Hp, Cp and Mp has been restored for 10 kill pts !");
  432. + }
  433. + else
  434. + {
  435. + activeChar.sendMessage("You need more kill points.");
  436. + }
  437. + }
  438. + else if (command.equals("dbuff"))
  439. + {
  440. + L2Effect[] effects = activeChar.getAllEffects();
  441. + if ((effects == null) || (effects.length == 0))
  442. + {
  443. + return;
  444. + }
  445. + if (activeChar.getKillpts() >= 10)
  446. + {
  447. + for (L2Effect e : effects)
  448. + {
  449. + if (e.getSkill().isDebuff())
  450. + {
  451. + e.exit();
  452. + }
  453. + }
  454. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  455. + activeChar.sendMessage("Your debuffs has been removed for kill pts !");
  456. + }
  457. + else
  458. + {
  459. + activeChar.sendMessage("You need more kill pts.");
  460. + }
  461. + }
  462. + else if (command.equals("bsoe"))
  463. + {
  464. + if (activeChar.getKillpts() >= 10)
  465. + {
  466. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  467. + L2Skill GM_escape = SkillTable.getInstance().getInfo(2100, 1);
  468. + activeChar.doCast(GM_escape);
  469. + activeChar.sendMessage("You have escaped from the battle for 10 kill pts !");
  470. + }
  471. + else
  472. + {
  473. + activeChar.sendMessage("You need more kill pts !");
  474. + }
  475. + }
  476. + else if (command.equals("clearReuse"))
  477. + {
  478. + if (activeChar.getKillpts() >= 10)
  479. + {
  480. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  481. + activeChar.getSkillReuseTimeStamps().clear();
  482. + activeChar.getDisabledSkills().clear();
  483. + activeChar.sendPacket(new SkillCoolTime(activeChar));
  484. + activeChar.sendMessage("You have reused all skils for 10 kill pts!");
  485. + }
  486. + else
  487. + {
  488. + activeChar.sendMessage("You need more kill pts!");
  489. + }
  490. + }
  491. + else if (command.equals("clearKarma"))
  492. + {
  493. + if (activeChar.getKillpts() >= 10)
  494. + {
  495. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  496. + activeChar.setKarma(0);
  497. + activeChar.sendMessage("You have cleared your karma for 10 kill pts");
  498. + }
  499. + else
  500. + {
  501. + activeChar.sendMessage("You need more kill pts!");
  502. + }
  503. + }
  504. + else if (command.equals("resMe"))
  505. + {
  506. + if (activeChar.isDead())
  507. + {
  508. + if (activeChar.getKillpts() >= 10)
  509. + {
  510. + activeChar.setKillPt(activeChar.getKillpts() - 10);
  511. + activeChar.restoreExp(100.0);
  512. + activeChar.doRevive();
  513. + activeChar.sendMessage("You have been ressurected for 10 kill pts !");
  514. + }
  515. + else
  516. + {
  517. + activeChar.sendMessage("You need more kill pts!");
  518. + }
  519. + }
  520. + }
  521. + shop(activeChar, combatButtons);
  522. + }
  523. +
  524. + @Override
  525. + public void onBypassFeedback(L2PcInstance activeChar, String command)
  526. + {
  527. +
  528. + if (command.startsWith("show"))
  529. + {
  530. + showUserPage(activeChar, "killnpc.htm");
  531. + }
  532. + if (command.startsWith("shop"))
  533. + {
  534. + shop(activeChar, combatButtons);
  535. +
  536. + }
  537. + }
  538. +
  539. + public static void showUserPage(L2PcInstance activeChar, String filename)
  540. + {
  541. + String content = HtmCache.getInstance().getHtmForce(activeChar.getHtmlPrefix(), "data/html/userpanel/" + filename);
  542. + NpcHtmlMessage kill = new NpcHtmlMessage(5);
  543. + kill.setHtml(content);
  544. + kill.replace("%kill_points%", "" + activeChar.getKillpts());
  545. + kill.replace("%player_name%", activeChar.getName());
  546. + activeChar.sendPacket(kill);
  547. +
  548. + }
  549. +
  550. + public static void shop(L2PcInstance activeChar, String[][] buttons)
  551. + {
  552. +
  553. + String text = "<html><head><title>Kill Shop</title></head><body>";
  554. + text += "";
  555. + text += "<center>";
  556. + text += "<table width=230>";
  557. + int buttonIndex = 0;
  558. + for (int i = 0; i < Math.ceil(buttons.length / (double) 2); i++)
  559. + {
  560. + text += "<tr>";
  561. + for (int x = 0; x < 2; x++)
  562. + {
  563. + if (buttonIndex < buttons.length)
  564. + {
  565. + text += "<td align=center><img src=\"" + buttons[buttonIndex][2] + "\" width=32 height=32></td>";
  566. + }
  567. + else
  568. + {
  569. + text += "<td></td>";
  570. + }
  571. + buttonIndex++;
  572. + }
  573. + buttonIndex -= 2;
  574. + text += "</tr>";
  575. + text += "<tr><td></td></tr>";
  576. + text += "<tr>";
  577. +
  578. + for (int x = 0; x < 2; x++)
  579. + {
  580. + if (buttonIndex < buttons.length)
  581. + {
  582. + text += "<td align=center><button value=\"" + buttons[buttonIndex][0] + "\" action=\"bypass -h _donate " + buttons[buttonIndex][1] + "\" width=130 height=26 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
  583. + }
  584. + else
  585. + {
  586. + text += "<td></td>";
  587. + }
  588. + buttonIndex++;
  589. + }
  590. + text += "</tr>";
  591. + text += "<tr><td></td></tr>";
  592. + }
  593. + text += "</body></html>";
  594. +
  595. + NpcHtmlMessage msg = new NpcHtmlMessage(activeChar.getObjectId());
  596. + msg.setHtml(text);
  597. + activeChar.sendPacket(msg);
  598. + }
  599. +
  600. +}
  601. Index: java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java
  602. ===================================================================
  603. --- java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (revision 5588)
  604. +++ java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
  605. @@ -26,6 +26,7 @@
  606. import com.l2jserver.gameserver.datatables.AdminTable;
  607. import com.l2jserver.gameserver.handler.AdminCommandHandler;
  608. import com.l2jserver.gameserver.handler.BypassHandler;
  609. +import com.l2jserver.gameserver.handler.Donate;
  610. import com.l2jserver.gameserver.handler.IAdminCommandHandler;
  611. import com.l2jserver.gameserver.handler.IBypassHandler;
  612. import com.l2jserver.gameserver.model.L2CharPosition;
  613. @@ -306,6 +307,10 @@
  614. handler.useBypass("arenachange " + (arenaId - 1), activeChar, null);
  615. }
  616. }
  617. + else if(_command.startsWith("_donate"))
  618. + {
  619. + Donate.onBypass(activeChar, _command.substring(8));
  620. + }
  621. else
  622. {
  623.  
  624. Index: java/com/l2jserver/gameserver/network/clientpackets/Logout.java
  625. ===================================================================
  626. --- java/com/l2jserver/gameserver/network/clientpackets/Logout.java (revision 5667)
  627. +++ java/com/l2jserver/gameserver/network/clientpackets/Logout.java (working copy)
  628. @@ -18,6 +18,8 @@
  629. import java.util.logging.LogRecord;
  630. import java.util.logging.Logger;
  631.  
  632. +import net.phoenixengine.PhoenixInterface;
  633. +
  634. import com.l2jserver.Config;
  635. import com.l2jserver.gameserver.SevenSignsFestival;
  636. import com.l2jserver.gameserver.model.L2Party;
  637. @@ -46,9 +48,8 @@
  638. @Override
  639. protected void runImpl()
  640. {
  641. final L2PcInstance player = getClient().getActiveChar();
  642. + player.savePts();
  643. if (player == null)
  644. {
  645. return;
Advertisement
Add Comment
Please, Sign In to add comment