Advertisement
Guest User

Untitled

a guest
Oct 7th, 2013
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 8.72 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Server
  3. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  4. ===================================================================
  5. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 6242)
  6. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  7. @@ -328,9 +328,9 @@
  8.     private static final String DELETE_ITEM_REUSE_SAVE = "DELETE FROM character_item_reuse_save WHERE charId=?";
  9.    
  10.     // Character Character SQL String Definitions:
  11. -   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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  12. -   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=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=? WHERE charId=?";
  13. -   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, clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createDate,language FROM characters WHERE charId=?";
  14. +   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,customherotime) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  15. +   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=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,bookmarkslot=?,vitality_points=?,language=?,customherotime=? WHERE charId=?";
  16. +   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, clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,bookmarkslot,vitality_points,createDate,language,customherotime FROM characters WHERE charId=?";
  17.    
  18.     // Character Teleport Bookmark:
  19.     private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
  20. @@ -504,6 +509,7 @@
  21.     private int _eventEffectId = 0;
  22.     private boolean _isInSiege;
  23.     private boolean _isInHideoutSiege = false;
  24. +   public long customherotime = -1;
  25.    
  26.     public enum PunishLevel
  27.     {
  28. @@ -7567,6 +7573,7 @@
  29.             statement.setInt(35, isNoble() ? 1 : 0);
  30.             statement.setLong(36, 0);
  31.             statement.setDate(37, new Date(getCreateDate().getTimeInMillis()));
  32. +           statement.setLong(38, customherotime);
  33.             statement.executeUpdate();
  34.         }
  35.         catch (Exception e)
  36. @@ -7758,6 +7765,7 @@
  37.                    
  38.                     // Language
  39.                     player.setLang(rset.getString("language"));
  40. +                   player.customherotime = rset.getLong("customherotime");
  41.                    
  42.                     // Retrieve the name and ID of the other characters assigned to this account.
  43.                     try (PreparedStatement stmt = con.prepareStatement("SELECT charId, char_name FROM characters WHERE account_name=? AND charId<>?"))
  44. @@ -8207,7 +8215,8 @@
  45.             statement.setInt(49, getBookMarkSlot());
  46.             statement.setInt(50, getVitalityPoints());
  47.             statement.setString(51, getLang());
  48. -           statement.setInt(52, getObjectId());
  49. +           statement.setLong(52, customherotime);
  50. +           statement.setInt(53, getObjectId());
  51.            
  52.             statement.execute();
  53.             statement.close();
  54. Index: java/com/custom/CustomHero.java
  55. ===================================================================
  56. --- java/com/custom/CustomHero.java (revision 0)
  57. +++ java/com/custom/CustomHero.java (working copy)
  58. @@ -0,0 +1,79 @@
  59. +/*
  60. + * Copyright (C) 2004-2013 L2J Server
  61. + *
  62. + * This file is part of L2J Server.
  63. + *
  64. + * L2J Server is free software: you can redistribute it and/or modify
  65. + * it under the terms of the GNU General Public License as published by
  66. + * the Free Software Foundation, either version 3 of the License, or
  67. + * (at your option) any later version.
  68. + *
  69. + * L2J Server is distributed in the hope that it will be useful,
  70. + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  71. + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  72. + * General Public License for more details.
  73. + *
  74. + * You should have received a copy of the GNU General Public License
  75. + * along with this program. If not, see <http://www.gnu.org/licenses/>.
  76. + */
  77. +package com.custom;
  78. +
  79. +import java.util.Calendar;
  80. +import java.util.StringTokenizer;
  81. +
  82. +import com.l2jserver.gameserver.handler.IAdminCommandHandler;
  83. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  84. +
  85. +/*
  86. + * @author Wyatt
  87. + */
  88. +
  89. +public class CustomHero implements IAdminCommandHandler
  90. +{
  91. +   private static final String[] ADMIN_COMMANDS =
  92. +   {
  93. +       "admin_customhero"
  94. +   };
  95. +  
  96. +   @Override
  97. +   public boolean useAdminCommand(String command, L2PcInstance activeChar)
  98. +   {
  99. +       if (command.toLowerCase().startsWith("admin_customhero"))
  100. +       {
  101. +           StringTokenizer st = new StringTokenizer(command);
  102. +           st.nextToken();
  103. +           int days = 0;
  104. +           L2PcInstance player = ((L2PcInstance) activeChar.getTarget());
  105. +          
  106. +           if (st.hasMoreTokens())
  107. +           {
  108. +               days = Integer.parseInt(st.nextToken());
  109. +           }
  110. +          
  111. +           if (player != null)
  112. +           {
  113. +               if (days != 0)
  114. +               {
  115. +                   player.customherotime = Calendar.getInstance().getTimeInMillis() + (86400000 * days);
  116. +               }
  117. +               else
  118. +               {
  119. +                   player.customherotime = 0;
  120. +               }
  121. +               player.setHero(true);
  122. +               player.broadcastUserInfo();
  123. +           }
  124. +           else
  125. +           {
  126. +               activeChar.sendMessage("You must target a player.");
  127. +           }
  128. +       }
  129. +       return true;
  130. +   }
  131. +  
  132. +   @Override
  133. +   public String[] getAdminCommandList()
  134. +   {
  135. +       return ADMIN_COMMANDS;
  136. +   }
  137. +}
  138. Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
  139. ===================================================================
  140. --- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 6242)
  141. +++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
  142. @@ -19,6 +19,7 @@
  143.  package com.l2jserver.gameserver.network.clientpackets;
  144.  
  145.  import java.io.UnsupportedEncodingException;
  146. +import java.util.Calendar;
  147.  
  148.  import javolution.util.FastList;
  149.  
  150. @@ -579,6 +580,15 @@
  151.        
  152.         TvTEvent.onLogin(activeChar);
  153.        
  154. +       if ((activeChar.customherotime == 0) || (activeChar.customherotime > Calendar.getInstance().getTimeInMillis()))
  155. +       {
  156. +           activeChar.setHero(true);
  157. +       }
  158. +       else
  159. +       {
  160. +           activeChar.customherotime = -1;
  161. +       }
  162. +      
  163.         if (Config.WELCOME_MESSAGE_ENABLED)
  164.         {
  165.             activeChar.sendPacket(new ExShowScreenMessage(Config.WELCOME_MESSAGE_TEXT, Config.WELCOME_MESSAGE_TIME));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement