Advertisement
Guest User

APPEARANCE STONES HIGH FIVE

a guest
Oct 15th, 2018
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 36.80 KB | None | 0 0
  1. Index: dist/game/config/L2JMods.properties
  2. ===================================================================
  3. --- dist/game/config/L2JMods.properties (revision 13243)
  4. +++ dist/game/config/L2JMods.properties (working copy)
  5. @@ -507,4 +507,46 @@
  6.  
  7.  # Enables .changepassword voiced command which allows the players to change their account's password ingame.
  8.  # Default: False
  9. -AllowChangePassword = False
  10. \ No newline at end of file
  11. +AllowChangePassword = False
  12. +
  13. +# ---------------------------------------------------------------------------
  14. +# Dressme System Aparience
  15. +# ---------------------------------------------------------------------------
  16. +# Normal Stones destroy the appearance weapon/armor. Blessed don't destroy the appearance weapon/armor and not cost.
  17. +# Cannot be remove appearance from weapon.
  18. +# You need set the items Id here and the ItemHandler in respective XML.
  19. +# For the remove appearance item you need set item id here and the ItemHandler in respective XML.
  20. +
  21. +# -----------------
  22. +# Weapon Section
  23. +# -----------------
  24. +# Normal Stone Id
  25. +WeaponNormalStoneAppearanceId = 111000
  26. +
  27. +# Blessed Stone Id
  28. +WeaponBlessedStoneAppearanceId = 111001
  29. +
  30. +# Price Id
  31. +WeaponAppearanceStonePriceId = 57
  32. +
  33. +# Price Count
  34. +WeaponAppearanceStonePriceCount = 100000
  35. +
  36. +
  37. +# -----------------
  38. +# Armor Section
  39. +# -----------------
  40. +# Normal Stone Id
  41. +ArmorNormalStoneAppearanceId = 111002
  42. +
  43. +# Blessed Stone Id
  44. +ArmorBlessedStoneAppearanceId = 111003
  45. +
  46. +# Price Id
  47. +ArmorAppearanceStonePriceId = 57
  48. +
  49. +# Price Count
  50. +ArmorAppearanceStonePriceCount = 1
  51. +
  52. +# Remove Stone Id
  53. +RemoveStoneAppearanceId = 111004
  54. \ No newline at end of file
  55. Index: src/main/java/com/l2jserver/Config.java
  56. ===================================================================
  57. --- src/main/java/com/l2jserver/Config.java (revision 13243)
  58. +++ src/main/java/com/l2jserver/Config.java (working copy)
  59. @@ -1111,6 +1111,17 @@
  60.     public static boolean TRY_LOAD_UNSPECIFIED_REGIONS;
  61.     public static Map<String, Boolean> GEODATA_REGIONS;
  62.    
  63. +   // TODO: Dressme System
  64. +   public static int APPEARANCE_WEAPON_NORMAL_STONE_ID;
  65. +   public static int APPEARANCE_WEAPON_BLESSED_STONE_ID;
  66. +   public static int APPEARANCE_WEAPON_PRICE_ID;
  67. +   public static int APPEARANCE_WEAPON_PRICE_COUNT;
  68. +   public static int APPEARANCE_ARMOR_NORMAL_STONE_ID;
  69. +   public static int APPEARANCE_ARMOR_BLESSED_STONE_ID;
  70. +   public static int APPEARANCE_ARMOR_PRICE_ID;
  71. +   public static int APPEARANCE_ARMOR_PRICE_COUNT;
  72. +   public static int APPEARANCE_REMOVE_STONE_ID;
  73. +  
  74.     /**
  75.      * This class initializes all global variables for configuration.<br>
  76.      * If the key doesn't appear in properties file, a default value is set by this class. {@link #CONFIGURATION_FILE} (properties file) for configuring your server.
  77. @@ -2190,6 +2201,17 @@
  78.             TVT_EVENT_RUNNING_TIME = L2JModSettings.getInt("TvTEventRunningTime", 1800);
  79.             TVT_EVENT_PARTICIPATION_NPC_ID = L2JModSettings.getInt("TvTEventParticipationNpcId", 0);
  80.            
  81. +           // TODO: Dressme System
  82. +           APPEARANCE_WEAPON_NORMAL_STONE_ID = L2JModSettings.getInt("WeaponNormalStoneAppearanceId", 1);
  83. +           APPEARANCE_WEAPON_BLESSED_STONE_ID = L2JModSettings.getInt("WeaponBlessedStoneAppearanceId", 1);
  84. +           APPEARANCE_WEAPON_PRICE_ID = L2JModSettings.getInt("WeaponAppearanceStonePriceId", 57);
  85. +           APPEARANCE_WEAPON_PRICE_COUNT = L2JModSettings.getInt("WeaponAppearanceStonePriceCount", 800000);
  86. +           APPEARANCE_ARMOR_NORMAL_STONE_ID = L2JModSettings.getInt("ArmorNormalStoneAppearanceId", 1);
  87. +           APPEARANCE_ARMOR_BLESSED_STONE_ID = L2JModSettings.getInt("ArmorBlessedStoneAppearanceId", 1);
  88. +           APPEARANCE_ARMOR_PRICE_ID = L2JModSettings.getInt("ArmorAppearanceStonePriceId", 57);
  89. +           APPEARANCE_ARMOR_PRICE_COUNT = L2JModSettings.getInt("ArmorAppearanceStonePriceCount", 800000);
  90. +           APPEARANCE_REMOVE_STONE_ID = L2JModSettings.getInt("RemoveStoneAppearanceId", 1);
  91. +          
  92.             L2JMOD_ALLOW_WEDDING = L2JModSettings.getBoolean("AllowWedding", false);
  93.             L2JMOD_WEDDING_PRICE = L2JModSettings.getInt("WeddingPrice", 250000000);
  94.             L2JMOD_WEDDING_PUNISH_INFIDELITY = L2JModSettings.getBoolean("WeddingPunishInfidelity", true);
  95. Index: src/main/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
  96. ===================================================================
  97. --- src/main/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (revision 13243)
  98. +++ src/main/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java   (working copy)
  99. @@ -812,6 +812,10 @@
  100.     private volatile int _actionMask;
  101.     private Map<Stats, Double> _servitorShare;
  102.    
  103. +   // TODO: Appearance Stones
  104. +   private boolean _isAddAppearance = false;
  105. +   private L2ItemInstance _appearanceItem = null;
  106. +  
  107.     /**
  108.      * Creates a player.
  109.      * @param objectId the object ID
  110. @@ -14418,4 +14422,24 @@
  111.         }
  112.         return _servitorShare.get(stat);
  113.     }
  114. +  
  115. +   public void setIsAddAppearance(boolean val)
  116. +   {
  117. +       _isAddAppearance = val;
  118. +   }
  119. +  
  120. +   public boolean isAddAppearance()
  121. +   {
  122. +       return _isAddAppearance;
  123. +   }
  124. +  
  125. +   public L2ItemInstance getAppearanceItem()
  126. +   {
  127. +       return _appearanceItem;
  128. +   }
  129. +  
  130. +   public void setAppearanceItem(L2ItemInstance val)
  131. +   {
  132. +       _appearanceItem = val;
  133. +   }
  134.  }
  135. Index: src/main/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java
  136. ===================================================================
  137. --- src/main/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java   (revision 13243)
  138. +++ src/main/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java   (working copy)
  139. @@ -1001,7 +1001,7 @@
  140.     public int getPaperdollItemDisplayId(int slot)
  141.     {
  142.         final L2ItemInstance item = _paperdoll[slot];
  143. -       return (item != null) ? item.getDisplayId() : 0;
  144. +       return (item != null) ? item.getCustomDisplayId() : 0;
  145.     }
  146.    
  147.     public int getPaperdollAugmentationId(int slot)
  148. Index: src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java
  149. ===================================================================
  150. --- src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java (revision 13243)
  151. +++ src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java (working copy)
  152. @@ -169,6 +169,9 @@
  153.    
  154.     private final List<Options> _enchantOptions = new ArrayList<>();
  155.    
  156. +   // TODO: Appearance Stones
  157. +   private int _appearance = 0;
  158. +  
  159.     /**
  160.      * Constructor of the L2ItemInstance from the objectId and the itemId.
  161.      * @param objectId : int designating the ID of the object in the world
  162. @@ -239,18 +242,11 @@
  163.      * <BR>
  164.      * <B><U> Actions</U> :</B><BR>
  165.      * <BR>
  166. -    * <li>Send a Server->Client Packet GetItem to player that pick up and its _knowPlayers member</li> <li>Remove the L2Object from the world</li><BR>
  167. +    * <li>Send a Server->Client Packet GetItem to player that pick up and its _knowPlayers member</li>
  168. +    * <li>Remove the L2Object from the world</li><BR>
  169.      * <BR>
  170. -    * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _allObjects of L2World </B></FONT><BR>
  171. -    * <BR>
  172. -    * <B><U> Assert </U> :</B><BR>
  173. -    * <BR>
  174. -    * <li>this instanceof L2ItemInstance</li> <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR>
  175. -    * <BR>
  176. -    * <B><U> Example of use </U> :</B><BR>
  177. -    * <BR>
  178. -    * <li>Do Pickup Item : PCInstance and Pet</li><BR>
  179. -    * <BR>
  180. +    * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T REMOVE the object from _allObjects of L2World </B></FONT><BR> <BR> <B><U> Assert </U> :</B><BR> <BR> <li>this instanceof L2ItemInstance</li> <li>_worldRegion != null <I>(L2Object is visible at the beginning)</I></li><BR> <BR> <B><U>
  181. +    * Example of use </U> :</B><BR> <BR> <li>Do Pickup Item : PCInstance and Pet</li><BR> <BR>
  182.      * @param player Player that pick up the item
  183.      */
  184.     public final void pickupMe(L2Character player)
  185. @@ -562,7 +558,7 @@
  186.      */
  187.     public int getLocationSlot()
  188.     {
  189. -       assert (_loc == ItemLocation.PAPERDOLL) || (_loc == ItemLocation.PET_EQUIP) || (_loc == ItemLocation.INVENTORY) || (_loc == ItemLocation.MAIL) || (_loc == ItemLocation.FREIGHT);
  190. +       assert(_loc == ItemLocation.PAPERDOLL) || (_loc == ItemLocation.PET_EQUIP) || (_loc == ItemLocation.INVENTORY) || (_loc == ItemLocation.MAIL) || (_loc == ItemLocation.FREIGHT);
  191.         return _locData;
  192.     }
  193.    
  194. @@ -632,6 +628,14 @@
  195.     }
  196.    
  197.     /**
  198. +    * @return the custom Appearance
  199. +    */
  200. +   public int getCustomDisplayId()
  201. +   {
  202. +       return (getAppearanceId() != 0) ? getAppearanceId() : getDisplayId();
  203. +   }
  204. +  
  205. +   /**
  206.      * @return {@code true} if item is an EtcItem, {@code false} otherwise.
  207.      */
  208.     public boolean isEtcItem()
  209. @@ -864,14 +868,14 @@
  210.     public boolean isAvailable(L2PcInstance player, boolean allowAdena, boolean allowNonTradeable)
  211.     {
  212.         return ((!isEquipped()) // Not equipped
  213. -           && (getItem().getType2() != L2Item.TYPE2_QUEST) // Not Quest Item
  214. -           && ((getItem().getType2() != L2Item.TYPE2_MONEY) || (getItem().getType1() != L2Item.TYPE1_SHIELD_ARMOR)) // not money, not shield
  215. -           && (!player.hasSummon() || (getObjectId() != player.getSummon().getControlObjectId())) // Not Control item of currently summoned pet
  216. -           && (player.getActiveEnchantItemId() != getObjectId()) // Not momentarily used enchant scroll
  217. -           && (player.getActiveEnchantSupportItemId() != getObjectId()) // Not momentarily used enchant support item
  218. -           && (player.getActiveEnchantAttrItemId() != getObjectId()) // Not momentarily used enchant attribute item
  219. -           && (allowAdena || (getId() != Inventory.ADENA_ID)) // Not Adena
  220. -           && ((player.getCurrentSkill() == null) || (player.getCurrentSkill().getSkill().getItemConsumeId() != getId())) && (!player.isCastingSimultaneouslyNow() || (player.getLastSimultaneousSkillCast() == null) || (player.getLastSimultaneousSkillCast().getItemConsumeId() != getId())) && (allowNonTradeable || (isTradeable() && (!((getItem().getItemType() == EtcItemType.PET_COLLAR) && player.havePetInvItems())))));
  221. +       && (getItem().getType2() != L2Item.TYPE2_QUEST) // Not Quest Item
  222. +       && ((getItem().getType2() != L2Item.TYPE2_MONEY) || (getItem().getType1() != L2Item.TYPE1_SHIELD_ARMOR)) // not money, not shield
  223. +       && (!player.hasSummon() || (getObjectId() != player.getSummon().getControlObjectId())) // Not Control item of currently summoned pet
  224. +       && (player.getActiveEnchantItemId() != getObjectId()) // Not momentarily used enchant scroll
  225. +       && (player.getActiveEnchantSupportItemId() != getObjectId()) // Not momentarily used enchant support item
  226. +       && (player.getActiveEnchantAttrItemId() != getObjectId()) // Not momentarily used enchant attribute item
  227. +       && (allowAdena || (getId() != Inventory.ADENA_ID)) // Not Adena
  228. +       && ((player.getCurrentSkill() == null) || (player.getCurrentSkill().getSkill().getItemConsumeId() != getId())) && (!player.isCastingSimultaneouslyNow() || (player.getLastSimultaneousSkillCast() == null) || (player.getLastSimultaneousSkillCast().getItemConsumeId() != getId())) && (allowNonTradeable || (isTradeable() && (!((getItem().getItemType() == EtcItemType.PET_COLLAR) && player.havePetInvItems())))));
  229.     }
  230.    
  231.     /**
  232. @@ -916,6 +920,35 @@
  233.         return _augmentation;
  234.     }
  235.    
  236. +   // TODO: Appearance Stones
  237. +   public boolean canAppearance()
  238. +   {
  239. +       if (_appearance == 0)
  240. +       {
  241. +           return true;
  242. +       }
  243. +       return false;
  244. +   }
  245. +  
  246. +   public int getAppearanceId()
  247. +   {
  248. +       return _appearance;
  249. +   }
  250. +  
  251. +   public void setAppearanceId(int val)
  252. +   {
  253. +       _appearance = val;
  254. +       try (Connection con = ConnectionFactory.getInstance().getConnection())
  255. +       {
  256. +           updateItemAttributes(con);
  257. +       }
  258. +       catch (SQLException e)
  259. +       {
  260. +           _log.log(Level.SEVERE, "Could not update atributes for item: " + this + " from DB:", e);
  261. +       }
  262. +      
  263. +   }
  264. +  
  265.     /**
  266.      * Sets a new augmentation
  267.      * @param augmentation
  268. @@ -933,7 +966,8 @@
  269.         _augmentation = augmentation;
  270.         try (Connection con = ConnectionFactory.getInstance().getConnection())
  271.         {
  272. -           updateItemAttributes(con);
  273. +           // TODO: Appearance Stones
  274. +           updateItemAppearance(con);
  275.         }
  276.         catch (SQLException e)
  277.         {
  278. @@ -976,7 +1010,8 @@
  279.     {
  280.         try (Connection con = ConnectionFactory.getInstance().getConnection();
  281.             PreparedStatement ps1 = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?");
  282. -           PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
  283. +           PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?");
  284. +           PreparedStatement ps3 = con.prepareStatement("SELECT appearanceId FROM item_appearance WHERE itemId=?"))
  285.         {
  286.             ps1.setInt(1, getObjectId());
  287.             try (ResultSet rs = ps1.executeQuery())
  288. @@ -1004,6 +1039,15 @@
  289.                     }
  290.                 }
  291.             }
  292. +          
  293. +           ps3.setInt(1, getObjectId());
  294. +           try (ResultSet rs = ps3.executeQuery())
  295. +           {
  296. +               while (rs.next())
  297. +               {
  298. +                   _appearance = (rs.getInt("appearanceId"));
  299. +               }
  300. +           }
  301.         }
  302.         catch (Exception e)
  303.         {
  304. @@ -1025,6 +1069,20 @@
  305.         }
  306.     }
  307.    
  308. +   private void updateItemAppearance(Connection con)
  309. +   {
  310. +       try (PreparedStatement ps = con.prepareStatement("REPLACE INTO item_appearance VALUES(?,?)"))
  311. +       {
  312. +           ps.setInt(1, getObjectId());
  313. +           ps.setInt(2, _appearance != 0 ? _appearance : -1);
  314. +           ps.executeUpdate();
  315. +       }
  316. +       catch (SQLException e)
  317. +       {
  318. +           _log.log(Level.SEVERE, "Could not update atributes for item: " + this + " from DB:", e);
  319. +       }
  320. +   }
  321. +  
  322.     private void updateItemElements(Connection con)
  323.     {
  324.         try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
  325. @@ -1537,16 +1595,11 @@
  326.      * <BR>
  327.      * <B><U> Actions</U> :</B><BR>
  328.      * <BR>
  329. -    * <li>Set the x,y,z position of the L2ItemInstance dropped and update its _worldregion</li> <li>Add the L2ItemInstance dropped to _visibleObjects of its L2WorldRegion</li> <li>Add the L2ItemInstance dropped in the world as a <B>visible</B> object</li><BR>
  330. +    * <li>Set the x,y,z position of the L2ItemInstance dropped and update its _worldregion</li>
  331. +    * <li>Add the L2ItemInstance dropped to _visibleObjects of its L2WorldRegion</li>
  332. +    * <li>Add the L2ItemInstance dropped in the world as a <B>visible</B> object</li><BR>
  333.      * <BR>
  334. -    * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object to _allObjects of L2World </B></FONT><BR>
  335. -    * <BR>
  336. -    * <B><U> Assert </U> :</B><BR>
  337. -    * <BR>
  338. -    * <li>_worldRegion == null <I>(L2Object is invisible at the beginning)</I></li><BR>
  339. -    * <BR>
  340. -    * <B><U> Example of use </U> :</B><BR>
  341. -    * <BR>
  342. +    * <FONT COLOR=#FF0000><B> <U>Caution</U> : This method DOESN'T ADD the object to _allObjects of L2World </B></FONT><BR> <BR> <B><U> Assert </U> :</B><BR> <BR> <li>_worldRegion == null <I>(L2Object is invisible at the beginning)</I></li><BR> <BR> <B><U> Example of use </U> :</B><BR> <BR>
  343.      * <li>Drop item</li> <li>Call Pet</li><BR>
  344.      */
  345.     public class ItemDropTask implements Runnable
  346. @@ -1667,7 +1720,7 @@
  347.      */
  348.     private void insertIntoDb()
  349.     {
  350. -       assert !_existsInDb && (getObjectId() != 0);
  351. +       assert!_existsInDb && (getObjectId() != 0);
  352.        
  353.         if (_wear)
  354.         {
  355. @@ -1697,6 +1750,10 @@
  356.             {
  357.                 updateItemAttributes(con);
  358.             }
  359. +           if (_appearance != 0)
  360. +           {
  361. +               updateItemAppearance(con);
  362. +           }
  363.             if (_elementals != null)
  364.             {
  365.                 updateItemElements(con);
  366. Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/AbstractRefinePacket.java
  367. ===================================================================
  368. --- src/main/java/com/l2jserver/gameserver/network/clientpackets/AbstractRefinePacket.java  (revision 13243)
  369. +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/AbstractRefinePacket.java  (working copy)
  370. @@ -227,19 +227,23 @@
  371.             return false;
  372.         }
  373.        
  374. -       final CrystalType grade = item.getItem().getItemGrade();
  375. -       final LifeStone ls = _lifeStones.get(refinerItem.getId());
  376. -      
  377. -       // Check for item id
  378. -       if (getGemStoneId(grade) != gemStones.getId())
  379. +       // TODO: Appearance Stones
  380. +       if (!player.isAddAppearance())
  381.         {
  382. -           return false;
  383. +           final CrystalType grade = item.getItem().getItemGrade();
  384. +           final LifeStone ls = _lifeStones.get(refinerItem.getId());
  385. +          
  386. +           // Check for item id
  387. +           if (getGemStoneId(grade) != gemStones.getId())
  388. +           {
  389. +               return false;
  390. +           }
  391. +           // Count must be greater or equal of required number
  392. +           if (getGemStoneCount(grade, ls.getGrade()) > gemStones.getCount())
  393. +           {
  394. +               return false;
  395. +           }
  396.         }
  397. -       // Count must be greater or equal of required number
  398. -       if (getGemStoneCount(grade, ls.getGrade()) > gemStones.getCount())
  399. -       {
  400. -           return false;
  401. -       }
  402.        
  403.         return true;
  404.     }
  405. @@ -269,26 +273,45 @@
  406.             return false;
  407.         }
  408.        
  409. -       final LifeStone ls = _lifeStones.get(refinerItem.getId());
  410. -       if (ls == null)
  411. +       // TODO: Appearance Stones
  412. +       if (!player.isAddAppearance())
  413.         {
  414. -           return false;
  415. +           final LifeStone ls = _lifeStones.get(refinerItem.getId());
  416. +           if (ls == null)
  417. +           {
  418. +               return false;
  419. +           }
  420. +           // weapons can't be augmented with accessory ls
  421. +           if ((item.getItem() instanceof L2Weapon) && (ls.getGrade() == GRADE_ACC))
  422. +           {
  423. +               return false;
  424. +           }
  425. +           // and accessory can't be augmented with weapon ls
  426. +           if ((item.getItem() instanceof L2Armor) && (ls.getGrade() != GRADE_ACC))
  427. +           {
  428. +               return false;
  429. +           }
  430. +           // check for level of the lifestone
  431. +           if (player.getLevel() < ls.getPlayerLevel())
  432. +           {
  433. +               return false;
  434. +           }
  435.         }
  436. -       // weapons can't be augmented with accessory ls
  437. -       if ((item.getItem() instanceof L2Weapon) && (ls.getGrade() == GRADE_ACC))
  438. +       else
  439.         {
  440. -           return false;
  441. +           if (!item.getItem().getItemType().equals(refinerItem.getItem().getItemType()))
  442. +           {
  443. +               return false;
  444. +           }
  445. +           if (refinerItem.isAugmented())
  446. +           {
  447. +               return false;
  448. +           }
  449. +           if (refinerItem.getItem().getItemGrade().isLesser(CrystalType.S))
  450. +           {
  451. +               return false;
  452. +           }
  453.         }
  454. -       // and accessory can't be augmented with weapon ls
  455. -       if ((item.getItem() instanceof L2Armor) && (ls.getGrade() != GRADE_ACC))
  456. -       {
  457. -           return false;
  458. -       }
  459. -       // check for level of the lifestone
  460. -       if (player.getLevel() < ls.getPlayerLevel())
  461. -       {
  462. -           return false;
  463. -       }
  464.        
  465.         return true;
  466.     }
  467. @@ -311,10 +334,29 @@
  468.         {
  469.             return false;
  470.         }
  471. -       if (item.isAugmented())
  472. +      
  473. +       // TODO: Appearance Stones
  474. +       if (!item.canAppearance() && player.isAddAppearance())
  475.         {
  476.             return false;
  477.         }
  478. +       if ((item.getItem().getItemGrade().isLesser(CrystalType.S80)) && player.isAddAppearance())
  479. +       {
  480. +           return false;
  481. +       }
  482. +       if (item.isArmor() && ((player.getAppearanceItem().getId() != Config.APPEARANCE_ARMOR_NORMAL_STONE_ID) || (player.getAppearanceItem().getId() != Config.APPEARANCE_ARMOR_BLESSED_STONE_ID)) && player.isAddAppearance())
  483. +       {
  484. +           return false;
  485. +       }
  486. +       if (item.isWeapon() && ((player.getAppearanceItem().getId() != Config.APPEARANCE_WEAPON_NORMAL_STONE_ID) || (player.getAppearanceItem().getId() != Config.APPEARANCE_WEAPON_BLESSED_STONE_ID)) && player.isAddAppearance())
  487. +       {
  488. +           return false;
  489. +       }
  490. +      
  491. +       if (item.isAugmented() && !player.isAddAppearance())
  492. +       {
  493. +           return false;
  494. +       }
  495.         if (item.isHeroItem())
  496.         {
  497.             return false;
  498. @@ -373,8 +415,17 @@
  499.                 case L2Item.SLOT_LR_FINGER:
  500.                 case L2Item.SLOT_LR_EAR:
  501.                 case L2Item.SLOT_NECK:
  502. +                   // Jewerly cannot add a appearance, is absurd.
  503. +                   if (player.isAddAppearance())
  504. +                   {
  505. +                       return false;
  506. +                   }
  507.                     break;
  508.                 default:
  509. +                   if (player.isAddAppearance())
  510. +                   {
  511. +                       return true;
  512. +                   }
  513.                     return false;
  514.             }
  515.         }
  516. Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmCancelItem.java
  517. ===================================================================
  518. --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmCancelItem.java  (revision 13243)
  519. +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmCancelItem.java  (working copy)
  520. @@ -60,13 +60,19 @@
  521.             return;
  522.         }
  523.        
  524. -       if (!item.isAugmented())
  525. +       if (!item.isAugmented() && !activeChar.isAddAppearance())
  526.         {
  527.             activeChar.sendPacket(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
  528.             return;
  529.         }
  530.        
  531. -       if (item.isPvp() && !Config.ALT_ALLOW_AUGMENT_PVP_ITEMS)
  532. +       if (item.canAppearance() && activeChar.isAddAppearance())
  533. +       {
  534. +           activeChar.sendMessage("The item don't have a appearance.");
  535. +           return;
  536. +       }
  537. +      
  538. +       if (item.isPvp() && !Config.ALT_ALLOW_AUGMENT_PVP_ITEMS && !activeChar.isAddAppearance())
  539.         {
  540.             activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
  541.             return;
  542. Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmGemStone.java
  543. ===================================================================
  544. --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmGemStone.java    (revision 13243)
  545. +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmGemStone.java    (working copy)
  546. @@ -75,17 +75,29 @@
  547.             return;
  548.         }
  549.        
  550. -       // Check for gemstone count
  551. -       final LifeStone ls = getLifeStone(refinerItem.getId());
  552. -       if (ls == null)
  553. +       // TODO: Appearance Stones
  554. +       if (!activeChar.isAddAppearance())
  555.         {
  556. -           return;
  557. +           // Check for gemstone count
  558. +           final LifeStone ls = getLifeStone(refinerItem.getId());
  559. +           if (ls == null)
  560. +           {
  561. +               return;
  562. +           }
  563. +          
  564. +           if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), ls.getGrade()))
  565. +           {
  566. +               activeChar.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
  567. +               return;
  568. +           }
  569.         }
  570. -      
  571. -       if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), ls.getGrade()))
  572. +       else
  573.         {
  574. -           activeChar.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
  575. -           return;
  576. +           if (_gemStoneCount != 1)
  577. +           {
  578. +               activeChar.sendMessage("Stone quantity is incorrect.");
  579. +               return;
  580. +           }
  581.         }
  582.        
  583.         activeChar.sendPacket(new ExPutCommissionResultForVariationMake(_gemstoneItemObjId, _gemStoneCount, gemStoneItem.getId()));
  584. Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmRefinerItem.java
  585. ===================================================================
  586. --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmRefinerItem.java (revision 13243)
  587. +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmRefinerItem.java (working copy)
  588. @@ -65,16 +65,33 @@
  589.        
  590.         if (!isValid(activeChar, targetItem, refinerItem))
  591.         {
  592. +           if ((refinerItem.getItem().getItemGrade().isLesser(CrystalType.S)) && activeChar.isAddAppearance())
  593. +           {
  594. +               activeChar.sendMessage("Appearance Item isn't grade S or highter.");
  595. +               return;
  596. +           }
  597. +          
  598.             activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
  599.             return;
  600.         }
  601.        
  602. -       final int refinerItemId = refinerItem.getItem().getId();
  603. -       final CrystalType grade = targetItem.getItem().getItemGrade();
  604. -       final LifeStone ls = getLifeStone(refinerItemId);
  605. -       final int gemStoneId = getGemStoneId(grade);
  606. -       final int gemStoneCount = getGemStoneCount(grade, ls.getGrade());
  607. +       int refinerItemId = refinerItem.getItem().getId();
  608. +       CrystalType grade = targetItem.getItem().getItemGrade();
  609. +       int gemStoneId;
  610. +       int gemStoneCount;
  611.        
  612. +       if (activeChar.isAddAppearance())
  613. +       {
  614. +           gemStoneId = activeChar.getAppearanceItem().getId();
  615. +           gemStoneCount = 1;
  616. +       }
  617. +       else
  618. +       {
  619. +           final LifeStone ls = getLifeStone(refinerItemId);
  620. +           gemStoneId = getGemStoneId(grade);
  621. +           gemStoneCount = getGemStoneCount(grade, ls.getGrade());
  622. +       }
  623. +      
  624.         activeChar.sendPacket(new ExPutIntensiveResultForVariationMake(_refinerItemObjId, refinerItemId, gemStoneId, gemStoneCount));
  625.     }
  626.    
  627. Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmTargetItem.java
  628. ===================================================================
  629. --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmTargetItem.java  (revision 13243)
  630. +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmTargetItem.java  (working copy)
  631. @@ -20,6 +20,7 @@
  632.  
  633.  import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  634.  import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
  635. +import com.l2jserver.gameserver.model.items.type.CrystalType;
  636.  import com.l2jserver.gameserver.network.SystemMessageId;
  637.  import com.l2jserver.gameserver.network.serverpackets.ExPutItemResultForVariationMake;
  638.  
  639. @@ -56,11 +57,28 @@
  640.         if (!isValid(activeChar, item))
  641.         {
  642.             // Different system message here
  643. -           if (item.isAugmented())
  644. +           if (!activeChar.isAddAppearance())
  645.             {
  646. -               activeChar.sendPacket(SystemMessageId.ONCE_AN_ITEM_IS_AUGMENTED_IT_CANNOT_BE_AUGMENTED_AGAIN);
  647. -               return;
  648. +               if (item.isAugmented())
  649. +               {
  650. +                   activeChar.sendPacket(SystemMessageId.ONCE_AN_ITEM_IS_AUGMENTED_IT_CANNOT_BE_AUGMENTED_AGAIN);
  651. +                   return;
  652. +               }
  653.             }
  654. +           else
  655. +           {
  656. +               if (!item.canAppearance())
  657. +               {
  658. +                   activeChar.sendMessage("Once an item get appearance cannot be obtain a new appearance.");
  659. +                   return;
  660. +               }
  661. +              
  662. +               if (item.getItem().getItemGrade().isLesser(CrystalType.S))
  663. +               {
  664. +                   activeChar.sendMessage("Appearance Item isn't grade S80 or highter.");
  665. +                   return;
  666. +               }
  667. +           }
  668.            
  669.             activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
  670.             return;
  671. Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefine.java
  672. ===================================================================
  673. --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefine.java (revision 13243)
  674. +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefine.java (working copy)
  675. @@ -18,7 +18,9 @@
  676.   */
  677.  package com.l2jserver.gameserver.network.clientpackets;
  678.  
  679. +import com.l2jserver.Config;
  680.  import com.l2jserver.gameserver.datatables.AugmentationData;
  681. +import com.l2jserver.gameserver.datatables.ItemTable;
  682.  import com.l2jserver.gameserver.model.L2Augmentation;
  683.  import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  684.  import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
  685. @@ -79,60 +81,132 @@
  686.             return;
  687.         }
  688.        
  689. -       final LifeStone ls = getLifeStone(refinerItem.getId());
  690. -       if (ls == null)
  691. +       if (!activeChar.isAddAppearance())
  692.         {
  693. -           return;
  694. -       }
  695. -      
  696. -       final int lifeStoneLevel = ls.getLevel();
  697. -       final int lifeStoneGrade = ls.getGrade();
  698. -       if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), lifeStoneGrade))
  699. -       {
  700. -           activeChar.sendPacket(new ExVariationResult(0, 0, 0));
  701. -           activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
  702. -           return;
  703. -       }
  704. -      
  705. -       // unequip item
  706. -       if (targetItem.isEquipped())
  707. -       {
  708. -           L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
  709. -           InventoryUpdate iu = new InventoryUpdate();
  710. -           for (L2ItemInstance itm : unequiped)
  711. +           final LifeStone ls = getLifeStone(refinerItem.getId());
  712. +           if (ls == null)
  713.             {
  714. -               iu.addModifiedItem(itm);
  715. +               return;
  716.             }
  717. +          
  718. +           final int lifeStoneLevel = ls.getLevel();
  719. +           final int lifeStoneGrade = ls.getGrade();
  720. +           if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), lifeStoneGrade))
  721. +           {
  722. +               activeChar.sendPacket(new ExVariationResult(0, 0, 0));
  723. +               activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
  724. +               return;
  725. +           }
  726. +          
  727. +           // unequip item
  728. +           if (targetItem.isEquipped())
  729. +           {
  730. +               L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
  731. +               InventoryUpdate iu = new InventoryUpdate();
  732. +               for (L2ItemInstance itm : unequiped)
  733. +               {
  734. +                   iu.addModifiedItem(itm);
  735. +               }
  736. +               activeChar.sendPacket(iu);
  737. +               activeChar.broadcastUserInfo();
  738. +           }
  739. +          
  740. +           // consume the life stone
  741. +           if (!activeChar.destroyItem("RequestRefine", refinerItem, 1, null, false))
  742. +           {
  743. +               return;
  744. +           }
  745. +          
  746. +           // consume the gemstones
  747. +           if (!activeChar.destroyItem("RequestRefine", gemStoneItem, _gemStoneCount, null, false))
  748. +           {
  749. +               return;
  750. +           }
  751. +          
  752. +           final L2Augmentation aug = AugmentationData.getInstance().generateRandomAugmentation(lifeStoneLevel, lifeStoneGrade, targetItem.getItem().getBodyPart(), refinerItem.getId(), targetItem);
  753. +           targetItem.setAugmentation(aug);
  754. +          
  755. +           final int stat12 = 0x0000FFFF & aug.getAugmentationId();
  756. +           final int stat34 = aug.getAugmentationId() >> 16;
  757. +           activeChar.sendPacket(new ExVariationResult(stat12, stat34, 1));
  758. +          
  759. +           InventoryUpdate iu = new InventoryUpdate();
  760. +           iu.addModifiedItem(targetItem);
  761.             activeChar.sendPacket(iu);
  762. -           activeChar.broadcastUserInfo();
  763. +          
  764. +           StatusUpdate su = new StatusUpdate(activeChar);
  765. +           su.addAttribute(StatusUpdate.CUR_LOAD, activeChar.getCurrentLoad());
  766. +           activeChar.sendPacket(su);
  767.         }
  768. -      
  769. -       // consume the life stone
  770. -       if (!activeChar.destroyItem("RequestRefine", refinerItem, 1, null, false))
  771. +       else
  772.         {
  773. -           return;
  774. +           // Set off the system
  775. +           activeChar.setIsAddAppearance(false);
  776. +           activeChar.setAppearanceItem(null);
  777. +          
  778. +           if (_gemStoneCount != 1)
  779. +           {
  780. +               activeChar.sendPacket(new ExVariationResult(0, 0, 0));
  781. +               activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
  782. +               return;
  783. +           }
  784. +          
  785. +           if (targetItem.isArmor())
  786. +           {
  787. +               if (gemStoneItem.getId() != Config.APPEARANCE_ARMOR_BLESSED_STONE_ID)
  788. +               {
  789. +                   if (!activeChar.destroyItemByItemId("Price", Config.APPEARANCE_ARMOR_PRICE_ID, Config.APPEARANCE_ARMOR_PRICE_COUNT, null, true))
  790. +                   {
  791. +                       activeChar.sendPacket(new ExVariationResult(0, 0, 0));
  792. +                       activeChar.sendMessage("You need " + Config.APPEARANCE_ARMOR_PRICE_COUNT + " " + ItemTable.getInstance().getTemplate(Config.APPEARANCE_ARMOR_PRICE_ID).getName());
  793. +                       return;
  794. +                   }
  795. +               }
  796. +              
  797. +           }
  798. +           else if (targetItem.isWeapon())
  799. +           {
  800. +               if (gemStoneItem.getId() != Config.APPEARANCE_WEAPON_BLESSED_STONE_ID)
  801. +               {
  802. +                   if (!activeChar.destroyItemByItemId("Price", Config.APPEARANCE_WEAPON_PRICE_ID, Config.APPEARANCE_WEAPON_PRICE_COUNT, null, true))
  803. +                   {
  804. +                       activeChar.sendPacket(new ExVariationResult(0, 0, 0));
  805. +                       activeChar.sendMessage("You need " + Config.APPEARANCE_WEAPON_PRICE_COUNT + " " + ItemTable.getInstance().getTemplate(Config.APPEARANCE_WEAPON_PRICE_ID).getName());
  806. +                       return;
  807. +                   }
  808. +               }
  809. +           }
  810. +          
  811. +           // unequip item
  812. +           if (targetItem.isEquipped())
  813. +           {
  814. +               L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
  815. +               InventoryUpdate iu = new InventoryUpdate();
  816. +               for (L2ItemInstance itm : unequiped)
  817. +               {
  818. +                   iu.addModifiedItem(itm);
  819. +               }
  820. +               activeChar.sendPacket(iu);
  821. +               activeChar.broadcastUserInfo();
  822. +           }
  823. +          
  824. +           if ((gemStoneItem.getId() != Config.APPEARANCE_ARMOR_BLESSED_STONE_ID) || (gemStoneItem.getId() != Config.APPEARANCE_WEAPON_BLESSED_STONE_ID))
  825. +           {
  826. +               if (!activeChar.destroyItem("RequestRefine", refinerItem, 1, null, false))
  827. +               {
  828. +                   return;
  829. +               }
  830. +           }
  831. +          
  832. +           if (!activeChar.destroyItem("RequestRefine", gemStoneItem, _gemStoneCount, null, false))
  833. +           {
  834. +               return;
  835. +           }
  836. +          
  837. +           targetItem.setAppearanceId(refinerItem.getId());
  838. +           activeChar.sendPacket(new ExVariationResult(0, 0, 0));
  839. +           activeChar.sendMessage("Appearance added succesfully!");
  840.         }
  841. -      
  842. -       // consume the gemstones
  843. -       if (!activeChar.destroyItem("RequestRefine", gemStoneItem, _gemStoneCount, null, false))
  844. -       {
  845. -           return;
  846. -       }
  847. -      
  848. -       final L2Augmentation aug = AugmentationData.getInstance().generateRandomAugmentation(lifeStoneLevel, lifeStoneGrade, targetItem.getItem().getBodyPart(), refinerItem.getId(), targetItem);
  849. -       targetItem.setAugmentation(aug);
  850. -      
  851. -       final int stat12 = 0x0000FFFF & aug.getAugmentationId();
  852. -       final int stat34 = aug.getAugmentationId() >> 16;
  853. -       activeChar.sendPacket(new ExVariationResult(stat12, stat34, 1));
  854. -      
  855. -       InventoryUpdate iu = new InventoryUpdate();
  856. -       iu.addModifiedItem(targetItem);
  857. -       activeChar.sendPacket(iu);
  858. -      
  859. -       StatusUpdate su = new StatusUpdate(activeChar);
  860. -       su.addAttribute(StatusUpdate.CUR_LOAD, activeChar.getCurrentLoad());
  861. -       activeChar.sendPacket(su);
  862.     }
  863.    
  864.     @Override
  865. Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefineCancel.java
  866. ===================================================================
  867. --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefineCancel.java   (revision 13243)
  868. +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefineCancel.java   (working copy)
  869. @@ -62,7 +62,7 @@
  870.             return;
  871.         }
  872.         // cannot remove augmentation from a not augmented item
  873. -       if (!targetItem.isAugmented())
  874. +       if (!targetItem.isAugmented() && !activeChar.isAddAppearance())
  875.         {
  876.             activeChar.sendPacket(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
  877.             activeChar.sendPacket(new ExVariationCancelResult(0));
  878. @@ -69,85 +69,115 @@
  879.             return;
  880.         }
  881.        
  882. -       // get the price
  883. -       int price = 0;
  884. -       switch (targetItem.getItem().getCrystalType())
  885. +       // TODO: Appearance Stones
  886. +       if (targetItem.canAppearance() && activeChar.isAddAppearance())
  887.         {
  888. -           case C:
  889. -               if (targetItem.getCrystalCount() < 1720)
  890. -               {
  891. -                   price = 95000;
  892. -               }
  893. -               else if (targetItem.getCrystalCount() < 2452)
  894. -               {
  895. -                   price = 150000;
  896. -               }
  897. -               else
  898. -               {
  899. -                   price = 210000;
  900. -               }
  901. -               break;
  902. -           case B:
  903. -               if (targetItem.getCrystalCount() < 1746)
  904. -               {
  905. -                   price = 240000;
  906. -               }
  907. -               else
  908. -               {
  909. -                   price = 270000;
  910. -               }
  911. -               break;
  912. -           case A:
  913. -               if (targetItem.getCrystalCount() < 2160)
  914. -               {
  915. -                   price = 330000;
  916. -               }
  917. -               else if (targetItem.getCrystalCount() < 2824)
  918. -               {
  919. -                   price = 390000;
  920. -               }
  921. -               else
  922. -               {
  923. -                   price = 420000;
  924. -               }
  925. -               break;
  926. -           case S:
  927. -               price = 480000;
  928. -               break;
  929. -           case S80:
  930. -           case S84:
  931. -               price = 920000;
  932. -               break;
  933. -           // any other item type is not augmentable
  934. -           default:
  935. +           activeChar.sendMessage("The item don't have a appearance.");
  936. +           return;
  937. +       }
  938. +      
  939. +       if (!activeChar.isAddAppearance())
  940. +       {
  941. +           // get the price
  942. +           int price = 0;
  943. +           switch (targetItem.getItem().getCrystalType())
  944. +           {
  945. +               case C:
  946. +                   if (targetItem.getCrystalCount() < 1720)
  947. +                   {
  948. +                       price = 95000;
  949. +                   }
  950. +                   else if (targetItem.getCrystalCount() < 2452)
  951. +                   {
  952. +                       price = 150000;
  953. +                   }
  954. +                   else
  955. +                   {
  956. +                       price = 210000;
  957. +                   }
  958. +                   break;
  959. +               case B:
  960. +                   if (targetItem.getCrystalCount() < 1746)
  961. +                   {
  962. +                       price = 240000;
  963. +                   }
  964. +                   else
  965. +                   {
  966. +                       price = 270000;
  967. +                   }
  968. +                   break;
  969. +               case A:
  970. +                   if (targetItem.getCrystalCount() < 2160)
  971. +                   {
  972. +                       price = 330000;
  973. +                   }
  974. +                   else if (targetItem.getCrystalCount() < 2824)
  975. +                   {
  976. +                       price = 390000;
  977. +                   }
  978. +                   else
  979. +                   {
  980. +                       price = 420000;
  981. +                   }
  982. +                   break;
  983. +               case S:
  984. +                   price = 480000;
  985. +                   break;
  986. +               case S80:
  987. +               case S84:
  988. +                   price = 920000;
  989. +                   break;
  990. +               // any other item type is not augmentable
  991. +               default:
  992. +                   activeChar.sendPacket(new ExVariationCancelResult(0));
  993. +                   return;
  994. +           }
  995. +          
  996. +           // try to reduce the players adena
  997. +           if (!activeChar.reduceAdena("RequestRefineCancel", price, null, true))
  998. +           {
  999.                 activeChar.sendPacket(new ExVariationCancelResult(0));
  1000. +               activeChar.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
  1001.                 return;
  1002. +           }
  1003. +          
  1004. +           // unequip item
  1005. +           if (targetItem.isEquipped())
  1006. +           {
  1007. +               activeChar.disarmWeapons();
  1008. +           }
  1009. +          
  1010. +           // remove the augmentation
  1011. +           targetItem.removeAugmentation();
  1012. +          
  1013. +           // send ExVariationCancelResult
  1014. +           activeChar.sendPacket(new ExVariationCancelResult(1));
  1015. +          
  1016. +           // send inventory update
  1017. +           InventoryUpdate iu = new InventoryUpdate();
  1018. +           iu.addModifiedItem(targetItem);
  1019. +           activeChar.sendPacket(iu);
  1020.         }
  1021. -      
  1022. -       // try to reduce the players adena
  1023. -       if (!activeChar.reduceAdena("RequestRefineCancel", price, null, true))
  1024. +       else
  1025.         {
  1026. +           if (!activeChar.destroyItem("RequestRefineCancel", activeChar.getAppearanceItem().getId(), 1, null, false))
  1027. +           {
  1028. +               return;
  1029. +           }
  1030. +           // unequip item
  1031. +           if (targetItem.isEquipped())
  1032. +           {
  1033. +               activeChar.disarmWeapons();
  1034. +           }
  1035. +          
  1036. +           // Set off the system
  1037. +           activeChar.setIsAddAppearance(false);
  1038. +           activeChar.setAppearanceItem(null);
  1039. +          
  1040. +           targetItem.setAppearanceId(0);
  1041.             activeChar.sendPacket(new ExVariationCancelResult(0));
  1042. -           activeChar.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
  1043. -           return;
  1044. +           activeChar.sendMessage("Appearance removed succesfully");
  1045.         }
  1046. -      
  1047. -       // unequip item
  1048. -       if (targetItem.isEquipped())
  1049. -       {
  1050. -           activeChar.disarmWeapons();
  1051. -       }
  1052. -      
  1053. -       // remove the augmentation
  1054. -       targetItem.removeAugmentation();
  1055. -      
  1056. -       // send ExVariationCancelResult
  1057. -       activeChar.sendPacket(new ExVariationCancelResult(1));
  1058. -      
  1059. -       // send inventory update
  1060. -       InventoryUpdate iu = new InventoryUpdate();
  1061. -       iu.addModifiedItem(targetItem);
  1062. -       activeChar.sendPacket(iu);
  1063.     }
  1064.    
  1065.     @Override
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement