Advertisement
Guest User

Core for Apperance by NeverMore

a guest
Oct 27th, 2012
521
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 22.85 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_Server 2 latest
  3. Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  4. ===================================================================
  5. --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (revision 5537)
  6. +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java    (working copy)
  7. @@ -316,8 +316,8 @@
  8.    
  9.     // Character Character SQL String Definitions:
  10.     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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  11. -   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=?";
  12. -   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=?";
  13. +   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=?,namec=? WHERE charId=?";
  14. +   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,namec FROM characters WHERE charId=?"; //survey
  15.    
  16.     // Character Teleport Bookmark:
  17.     private static final String INSERT_TP_BOOKMARK = "INSERT INTO character_tpbookmark (charId,Id,x,y,z,icon,tag,name) values (?,?,?,?,?,?,?,?)";
  18. @@ -7240,6 +7240,9 @@
  19.                 player.setName(rset.getString("char_name"));
  20.                 player._lastAccess = rset.getLong("lastAccess");
  21.                
  22. +               // Appearance
  23. +               player.setNamec(rset.getString("namec"));
  24. +              
  25.                 player.getStat().setExp(rset.getLong("exp"));
  26.                 player.setExpBeforeDeath(rset.getLong("expBeforeDeath"));
  27.                 player.getStat().setLevel(rset.getByte("level"));
  28. @@ -7314,7 +7317,7 @@
  29.  
  30.                 player.setTitle(rset.getString("title"));
  31. -               player.getAppearance().setTitleColor(rset.getInt("title_color"));
  32. +               player.setTitlec(rset.getString("title_color"));
  33.                 player.setAccessLevel(rset.getInt("accesslevel"));
  34.                 player.setFistsWeaponItem(player.findFistsWeaponItem(activeClassId));
  35.                 player.setUptime(System.currentTimeMillis());
  36.                
  37. @@ -7781,7 +7784,7 @@
  38.             statement.setInt(25, getClassId().getId());
  39.             statement.setLong(26, getDeleteTimer());
  40.             statement.setString(27, getTitle());
  41. -           statement.setInt(28, getAppearance().getTitleColor());
  42. +           statement.setString(28, getTitlec());
  43.             statement.setInt(29, getAccessLevel().getLevel());
  44.             statement.setInt(30, isOnlineInt());
  45.             statement.setInt(31, isIn7sDungeon() ? 1 : 0);
  46. @@ -7812,7 +7815,8 @@
  47.             statement.setInt(50, getBookMarkSlot());
  48.             statement.setInt(51, getVitalityPoints());
  49.             statement.setString(52, getLang());
  50. -           statement.setInt(53, getObjectId());
  51. +           statement.setString(53, getNamec());
  52. +           statement.setInt(54, getObjectId());
  53.            
  54.             statement.execute();
  55.             statement.close();
  56. @@ -14182,6 +14186,26 @@
  57.             return true;
  58.     }
  59.    
  60. +   // Appearance system start
  61. +   public String _namec = "FFFFFF";
  62. +   public String getNamec()
  63. +   {
  64. +       return _namec;
  65. +   }
  66. +   public void setNamec(String val)
  67. +   {
  68. +       _namec = val;
  69. +   }
  70. +   public String _titlec = "FFFFFF";
  71. +   public String getTitlec()
  72. +   {
  73. +       return _titlec;
  74. +   }
  75. +   public void setTitlec(String val)
  76. +   {
  77. +       _titlec = val;
  78. +   }   // Appearance system end
  79. +  
  80.     public void teleportBookmarkAdd(int x,int y,int z,int icon, String tag, String name)
  81.     {
  82.         if(this == null)
  83. Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
  84. ===================================================================
  85. --- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 5526)
  86. +++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
  87. @@ -447,29 +456,28 @@
  88.                 obj.sendPacket(sm);
  89.             }
  90.         }
  91. -
  92. +      
  93. +       // Appearance
  94. +       if (!activeChar.isGM())
  95. +       {
  96. +           activeChar.getAppearance().setNameColor(Integer.decode("0x" + activeChar.getNamec()));
  97. +           activeChar.getAppearance().setTitleColor(Integer.decode("0x" + activeChar.getTitlec()));
  98. +       }
  99.         activeChar.sendPacket(SystemMessageId.WELCOME_TO_LINEAGE);
  100. Index: java/com/l2jserver/gameserver/model/actor/instance/L2AppearanceInstance.java
  101. ===================================================================
  102. --- java/com/l2jserver/gameserver/model/actor/instance/L2AppearanceInstance.java    (revision 0)
  103. +++ java/com/l2jserver/gameserver/model/actor/instance/L2AppearanceInstance.java    (revision 0)
  104. @@ -0,0 +1,370 @@
  105. +/*
  106. + * This program is free software: you can redistribute it and/or modify it under
  107. + * the terms of the GNU General Public License as published by the Free Software
  108. + * Foundation, either version 3 of the License, or (at your option) any later
  109. + * version.
  110. + *
  111. + * This program is distributed in the hope that it will be useful, but WITHOUT
  112. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  113. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  114. + * details.
  115. + *
  116. + * You should have received a copy of the GNU General Public License along with
  117. + * this program. If not, see <http://www.gnu.org/licenses/>.
  118. + */
  119. +package com.l2jserver.gameserver.model.actor.instance;
  120. +
  121. +import java.util.regex.Matcher;
  122. +import java.util.regex.Pattern;
  123. +import java.util.regex.PatternSyntaxException;
  124. +
  125. +import javolution.text.TextBuilder;
  126. +
  127. +import com.l2jserver.Config;
  128. +import com.l2jserver.gameserver.ThreadPoolManager;
  129. +import com.l2jserver.gameserver.communitybbs.Manager.RegionBBSManager;
  130. +import com.l2jserver.gameserver.datatables.CharNameTable;
  131. +import com.l2jserver.gameserver.instancemanager.TransformationManager;
  132. +import com.l2jserver.gameserver.model.actor.L2Npc;
  133. +import com.l2jserver.gameserver.model.actor.appearance.PcAppearance;
  134. +import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
  135. +import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;
  136. +import com.l2jserver.gameserver.network.communityserver.writepackets.WorldInfo;
  137. +import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage;
  138. +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  139. +import com.l2jserver.gameserver.network.serverpackets.PartySmallWindowAll;
  140. +import com.l2jserver.gameserver.network.serverpackets.PartySmallWindowDeleteAll;
  141. +import com.l2jserver.gameserver.util.Util;
  142. +
  143. +/**
  144. + *
  145. + * @author NeverMore
  146. + *
  147. + */
  148. +public final class L2AppearanceInstance extends L2Npc
  149. +{
  150. +
  151. +   public L2AppearanceInstance(int objectId, L2NpcTemplate template)
  152. +   {
  153. +       super(objectId, template);
  154. +   }
  155. +  
  156. +   @Override
  157. +   public void onBypassFeedback(L2PcInstance player, String command)
  158. +   {
  159. +       if (player == null)
  160. +       {
  161. +           return;
  162. +       }
  163. +       if (command.startsWith("info"))
  164. +       {
  165. +           showInfoWindow(player);
  166. +       }
  167. +       if (command.startsWith("namec"))
  168. +       {
  169. +           try
  170. +           {
  171. +               String val = command.substring(6);
  172. +               player.getAppearance().setNameColor(Integer.decode("0x" + val));
  173. +               ExShowScreenMessage message = new ExShowScreenMessage("Your name color has been changed", 4000);
  174. +               player.sendPacket(message);
  175. +               player.sendMessage("Your name color has been changed");
  176. +               player.broadcastUserInfo();
  177. +               player.setNamec(val);
  178. +           }
  179. +           catch (Exception e)
  180. +           { //Case of empty color or invalid hex string
  181. +               ExShowScreenMessage message = new ExShowScreenMessage("You need to specify a valid new color.", 4000);
  182. +               player.sendPacket(message);
  183. +               player.sendMessage("You need to specify a valid new color.");
  184. +           }
  185. +           return;
  186. +       }
  187. +       if (command.startsWith("titlec"))
  188. +       {
  189. +           try
  190. +           {
  191. +               String val = command.substring(7);
  192. +               player.getAppearance().setTitleColor(Integer.decode("0x" + val));
  193. +               ExShowScreenMessage message = new ExShowScreenMessage("Your title color has been changed", 4000);
  194. +               player.sendPacket(message);
  195. +               player.sendMessage("Your title color has been changed");
  196. +               player.broadcastUserInfo();
  197. +               player.setTitlec(val);
  198. +           }
  199. +           catch (Exception e)
  200. +           { //Case of empty color or invalid hex string
  201. +               ExShowScreenMessage message = new ExShowScreenMessage("You need to specify a valid new color.", 4000);
  202. +               player.sendPacket(message);
  203. +               player.sendMessage("You need to specify a valid new color.");
  204. +           }
  205. +           return;
  206. +       }
  207. +       if (command.startsWith("name"))
  208. +       {
  209. +           try
  210. +           {
  211. +               String val = command.substring(5);
  212. +               if (val.length() > 16)
  213. +               {
  214. +                   ExShowScreenMessage message1 = new ExShowScreenMessage("Name cannot be more than 16 characters", 4000);
  215. +                   player.sendPacket(message1);
  216. +                   return;
  217. +               }
  218. +               if (CharNameTable.getInstance().getIdByName(val) > 0)
  219. +               {
  220. +                   ExShowScreenMessage message = new ExShowScreenMessage("Problem, name "+val+" already exists! Try something else", 4000);
  221. +                   player.sendPacket(message);
  222. +                   player.sendMessage("Problem, name "+val+" already exists! Try something else");
  223. +                   return;
  224. +               }
  225. +               if (Config.FORBIDDEN_NAMES.length > 1)
  226. +               {
  227. +                   for (String st : Config.FORBIDDEN_NAMES)
  228. +                   {
  229. +                       if (val.toLowerCase().contains(st.toLowerCase()))
  230. +                       {
  231. +                           ExShowScreenMessage message1 = new ExShowScreenMessage("This name is forbidden ,try something else.", 4000);
  232. +                           player.sendPacket(message1);
  233. +                           return;
  234. +                       }
  235. +                   }
  236. +               }
  237. +               if (!Util.isAlphaNumeric(val) || !isValidName(val))
  238. +               {
  239. +                   ExShowScreenMessage message1 = new ExShowScreenMessage("This name is not valid ,try something else.", 4000);
  240. +                   player.sendPacket(message1);
  241. +                   return;
  242. +               }
  243. +               player.setName(val);
  244. +               player.store();
  245. +          
  246. +               ExShowScreenMessage message = new ExShowScreenMessage("You successfully changed your name to "+val+"", 4000);
  247. +               player.sendPacket(message);            
  248. +               player.sendMessage("You successfully changed your name to "+val);
  249. +               player.broadcastUserInfo();
  250. +               CommunityServerThread.getInstance().sendPacket(new WorldInfo(player, null, WorldInfo.TYPE_UPDATE_PLAYER_DATA));
  251. +              
  252. +               if (player.isInParty())
  253. +               {
  254. +                   // Delete party window for other party members
  255. +                   player.getParty().broadcastToPartyMembers(player, PartySmallWindowDeleteAll.STATIC_PACKET);
  256. +                   for (L2PcInstance member : player.getParty().getMembers())
  257. +                   {
  258. +                       // And re-add
  259. +                       if (member != player)
  260. +                           member.sendPacket(new PartySmallWindowAll(member, player.getParty()));
  261. +                   }
  262. +               }
  263. +               if (player.getClan() != null)
  264. +               {
  265. +                   player.getClan().broadcastClanStatus();
  266. +               }              
  267. +               RegionBBSManager.getInstance().changeCommunityBoard();
  268. +               return;
  269. +           }
  270. +           catch (Exception e)
  271. +           { //Case of empty name
  272. +               ExShowScreenMessage message = new ExShowScreenMessage("Enter the Name into the box.", 4000);
  273. +               player.sendPacket(message);
  274. +               player.sendMessage("Enter the Name into the box.");
  275. +           }
  276. +       }
  277. +       if (command.startsWith("sex"))
  278. +       {
  279. +           player.getAppearance().setSex(player.getAppearance().getSex() ? false : true);
  280. +           ExShowScreenMessage message = new ExShowScreenMessage("Your gender has been changed!", 4000);
  281. +           player.sendPacket(message);
  282. +           player.sendMessage("Your gender has been changed!");
  283. +           player.broadcastUserInfo();
  284. +           // Transform-untransorm player quickly to force the client to reload the character textures
  285. +           TransformationManager.getInstance().transformPlayer(105, player);
  286. +           ThreadPoolManager.getInstance().scheduleGeneral(new Untransform(player), 200);
  287. +           return;
  288. +       }
  289. +       if (command.startsWith("face"))
  290. +       {
  291. +           try
  292. +           {
  293. +               String val = command.substring(5);
  294. +               int faceVal = Integer.parseInt(val);
  295. +               if ((faceVal != 0) && (faceVal != 1) && (faceVal != 2))
  296. +               {
  297. +                   ExShowScreenMessage message1 = new ExShowScreenMessage("Invalid face id | Possible id's (0,1,2)", 4000);
  298. +                   player.sendPacket(message1);
  299. +                   return;
  300. +               }
  301. +               if (faceVal == PcAppearance.getFace())
  302. +               {
  303. +                   ExShowScreenMessage message1 = new ExShowScreenMessage(" Id " + faceVal + " is your current face id ! Try something else ! ", 4000);
  304. +                   player.sendPacket(message1);
  305. +                   return;
  306. +               }
  307. +               PcAppearance.setFace(faceVal);
  308. +               ExShowScreenMessage message = new ExShowScreenMessage("Your face id has been changed!", 4000);
  309. +               player.sendPacket(message);
  310. +               player.sendMessage("Your face id has been changed!");
  311. +               player.broadcastUserInfo();
  312. +               // Transform-untransorm player quickly to force the client to reload the character textures
  313. +               TransformationManager.getInstance().transformPlayer(105, player);
  314. +               ThreadPoolManager.getInstance().scheduleGeneral(new Untransform(player), 200);
  315. +
  316. +           }
  317. +           catch (Exception e)
  318. +           { //Case of empty id or invalid id
  319. +               ExShowScreenMessage message1 = new ExShowScreenMessage("Fill into the box the face id (0,1,2).", 4000);
  320. +               player.sendPacket(message1);
  321. +               player.sendMessage("Fill into the box the face id (0,1,2).");
  322. +           }      
  323. +       }
  324. +       if (command.startsWith("hair"))
  325. +       {
  326. +           try
  327. +           {
  328. +               String val = command.substring(5);
  329. +               int hairVal = Integer.parseInt(val);
  330. +               if ((hairVal != 0) && (hairVal != 1) && (hairVal != 2) && (hairVal != 3))
  331. +               {
  332. +                   ExShowScreenMessage message1 = new ExShowScreenMessage("Invalid hair id | Possible id's (0,1,2,3)", 4000);
  333. +                   player.sendPacket(message1);
  334. +                   return;
  335. +               }
  336. +               if (hairVal == PcAppearance.getHairStyle())
  337. +               {
  338. +                   ExShowScreenMessage message1 = new ExShowScreenMessage(" Id " + hairVal + " is your current hair id ! Try something else ! ", 4000);
  339. +                   player.sendPacket(message1);
  340. +                   return;
  341. +               }
  342. +               PcAppearance.setHairStyle(hairVal);
  343. +               ExShowScreenMessage message = new ExShowScreenMessage("Your hair id has been changed!", 4000);
  344. +               player.sendPacket(message);
  345. +               player.sendMessage("Your hair id has been changed!");
  346. +               player.broadcastUserInfo();
  347. +               // Transform-untransorm player quickly to force the client to reload the character textures
  348. +               TransformationManager.getInstance().transformPlayer(105, player);
  349. +               ThreadPoolManager.getInstance().scheduleGeneral(new Untransform(player), 200);
  350. +
  351. +           }
  352. +           catch (Exception e)
  353. +           { //Case of empty id or invalid id
  354. +               ExShowScreenMessage message1 = new ExShowScreenMessage("Fill into the box the hair id (0,1,2,3).", 4000);
  355. +               player.sendPacket(message1);
  356. +               player.sendMessage("Fill into the box the hair id (0,1,2,3).");
  357. +           }  
  358. +       }
  359. +   }
  360. +  
  361. +   /**
  362. +    * @param val
  363. +    * @return
  364. +    */
  365. +   private boolean isValidName(String val)
  366. +   {
  367. +       boolean result = true;
  368. +       String test = val;
  369. +       Pattern pattern;
  370. +       try
  371. +       {
  372. +           pattern = Pattern.compile(Config.CNAME_TEMPLATE);
  373. +       }
  374. +       catch (PatternSyntaxException e) // case of illegal pattern
  375. +       {
  376. +           _log.warning("ERROR : Character name pattern of config is wrong!");
  377. +           pattern = Pattern.compile(".*");
  378. +       }
  379. +       Matcher regexp = pattern.matcher(test);
  380. +       if (!regexp.matches())
  381. +       {
  382. +           result = false;
  383. +       }
  384. +       return result;
  385. +   }
  386. +
  387. +   @Override
  388. +   public void showChatWindow(L2PcInstance player)
  389. +   {
  390. +       if (player == null)
  391. +       {
  392. +           return;
  393. +       }
  394. +       NpcHtmlMessage nhm = new NpcHtmlMessage(2);
  395. +       TextBuilder tb = new TextBuilder("");
  396. +      
  397. +       tb.append("<html>");
  398. +       tb.append(" <head>");
  399. +       tb.append(" <title>Appearance Manager</title>");
  400. +       tb.append(" </head>");
  401. +       tb.append("<body>");
  402. +       tb.append("<center>");
  403. +       tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"444444\">");
  404. +       tb.append("<tr>");
  405. +       tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
  406. +       tb.append("<td valign=\"top\"><font color=\"FF6600\">Appearance manager</font>");
  407. +       tb.append("<br1><font color=\"00FF00\">"+ player.getName() +"</font>, use this npc to change your appearance.</td>");
  408. +       tb.append("</tr></table></center><br><center>");
  409. +       tb.append("<br><edit var=\"val\" width=140 height=20><br>");
  410. +       tb.append("<table width=125 border=0 bgcolor=444444><tr><br><br><br><br>");
  411. +       tb.append("<td><button action=\"bypass -h npc_" + getObjectId() + "_name $val\" value=\"Name\" width=90 height=24 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
  412. +       tb.append("<td><button action=\"bypass -h npc_" + getObjectId() + "_sex\" value=\"Sex\" width=90 height=24 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
  413. +       tb.append("</tr></table>");
  414. +       tb.append("<table width=125 border=0 bgcolor=444444><tr><br><br><br><br>");
  415. +       tb.append("<td><button action=\"bypass -h npc_" + getObjectId() + "_namec $val\" value=\"Name Color\" width=90 height=24 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
  416. +       tb.append("<td><button action=\"bypass -h npc_" + getObjectId() + "_titlec $val\" value=\"Title Color\" width=90 height=24 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
  417. +       tb.append("</tr></table>");
  418. +       tb.append("<table width=125 border=0 bgcolor=444444><tr><br><br><br><br>");
  419. +       tb.append("<td><button action=\"bypass -h npc_" + getObjectId() + "_hair $val\" value=\"Hair id\" width=90 height=24 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
  420. +       tb.append("<td><button action=\"bypass -h npc_" + getObjectId() + "_face $val\" value=\"Face id\" width=90 height=24 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
  421. +       tb.append("</tr></table><br><br>");
  422. +       tb.append("<table width=125 border=0 bgcolor=444444><tr><br><br><br><br>");
  423. +       tb.append("<td><button action=\"bypass -h npc_" + getObjectId() + "_info\" value=\"How to use ?\" width=130 height=18 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>");
  424. +       tb.append("</tr></table>");
  425. +       tb.append("</center><br><br>");
  426. +       tb.append("<br><br><center><font color=\"A9A9A9\">~ by NeverMore ~</font></center>");
  427. +       tb.append("</body>");
  428. +       tb.append("</html>");
  429. +       nhm.setHtml(tb.toString());
  430. +       player.sendPacket(nhm);    
  431. +   }
  432. +
  433. +   public void showInfoWindow(L2PcInstance player)
  434. +   {
  435. +       NpcHtmlMessage nhm = new NpcHtmlMessage(1);
  436. +       TextBuilder tb = new TextBuilder("");
  437. +      
  438. +       tb.append("<html>");
  439. +       tb.append(" <head>");
  440. +       tb.append(" <title>Appearance Manager</title>");
  441. +       tb.append(" </head>");
  442. +       tb.append("<body>");
  443. +       tb.append("<center>");
  444. +       tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"444444\">");
  445. +       tb.append("<tr>");
  446. +       tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
  447. +       tb.append("<td valign=\"top\"><font color=\"FF6600\">Appearance manager</font>");
  448. +       tb.append("<br1><font color=\"00FF00\">"+ player.getName() +"</font>, use this npc to change your appearance.</td>");
  449. +       tb.append("</tr></table></center><br><center>");
  450. +       tb.append("<br><br>Using this npc , you can change your Name / Title and Name Color / Sex / Hair and Face id!<br>Just fill into the box the required value's and press the button you want.");
  451. +       tb.append("</center>");
  452. +       tb.append("<br><br><center><font color=\"A9A9A9\">~ by NeverMore ~</font></center>");
  453. +       tb.append("</body>");
  454. +       tb.append("</html>");
  455. +       nhm.setHtml(tb.toString());
  456. +       player.sendPacket(nhm);    
  457. +   }
  458. +  
  459. +   private final class Untransform implements Runnable
  460. +   {
  461. +       private final L2PcInstance _player;
  462. +
  463. +       protected Untransform(L2PcInstance player)
  464. +       {
  465. +           _player = player;
  466. +       }
  467. +
  468. +       @Override
  469. +       public void run()
  470. +       {
  471. +           _player.untransform();
  472. +       }
  473. +   }
  474. +}
  475. \ No newline at end of file
  476. Index: java/com/l2jserver/gameserver/model/actor/appearance/PcAppearance.java
  477. ===================================================================
  478. --- java/com/l2jserver/gameserver/model/actor/appearance/PcAppearance.java  (revision 5526)
  479. +++ java/com/l2jserver/gameserver/model/actor/appearance/PcAppearance.java  (working copy)
  480. @@ -20,11 +20,11 @@
  481.  {
  482.     private L2PcInstance _owner;
  483.    
  484. -   private byte _face;
  485. +   private static byte _face;
  486.    
  487.     private byte _hairColor;
  488.    
  489. -   private byte _hairStyle;
  490. +   private static byte _hairStyle;
  491.    
  492.     private boolean _sex; // Female true(1)
  493.    
  494. @@ -94,7 +94,7 @@
  495.         return _visibleTitle;
  496.     }
  497.    
  498. -   public final byte getFace()
  499. +   public final static byte getFace()
  500.     {
  501.         return _face;
  502.     }
  503. @@ -102,7 +102,7 @@
  504.     /**
  505.      * @param value
  506.      */
  507. -   public final void setFace(int value)
  508. +   public final static void setFace(int value)
  509.     {
  510.         _face = (byte) value;
  511.     }
  512. @@ -120,7 +120,7 @@
  513.         _hairColor = (byte) value;
  514.     }
  515.    
  516. -   public final byte getHairStyle()
  517. +   public final static byte getHairStyle()
  518.     {
  519.         return _hairStyle;
  520.     }
  521. @@ -128,7 +128,7 @@
  522.     /**
  523.      * @param value
  524.      */
  525. -   public final void setHairStyle(int value)
  526. +   public final static void setHairStyle(int value)
  527.     {
  528.         _hairStyle = (byte) value;
  529.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement