Advertisement
warc222

kill system

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