Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: dist/game/config/L2JMods.properties
- ===================================================================
- --- dist/game/config/L2JMods.properties (revision 13243)
- +++ dist/game/config/L2JMods.properties (working copy)
- @@ -507,4 +507,46 @@
- # Enables .changepassword voiced command which allows the players to change their account's password ingame.
- # Default: False
- -AllowChangePassword = False
- \ No newline at end of file
- +AllowChangePassword = False
- +
- +# ---------------------------------------------------------------------------
- +# Dressme System Aparience
- +# ---------------------------------------------------------------------------
- +# Normal Stones destroy the appearance weapon/armor. Blessed don't destroy the appearance weapon/armor and not cost.
- +# Cannot be remove appearance from weapon.
- +# You need set the items Id here and the ItemHandler in respective XML.
- +# For the remove appearance item you need set item id here and the ItemHandler in respective XML.
- +
- +# -----------------
- +# Weapon Section
- +# -----------------
- +# Normal Stone Id
- +WeaponNormalStoneAppearanceId = 111000
- +
- +# Blessed Stone Id
- +WeaponBlessedStoneAppearanceId = 111001
- +
- +# Price Id
- +WeaponAppearanceStonePriceId = 57
- +
- +# Price Count
- +WeaponAppearanceStonePriceCount = 100000
- +
- +
- +# -----------------
- +# Armor Section
- +# -----------------
- +# Normal Stone Id
- +ArmorNormalStoneAppearanceId = 111002
- +
- +# Blessed Stone Id
- +ArmorBlessedStoneAppearanceId = 111003
- +
- +# Price Id
- +ArmorAppearanceStonePriceId = 57
- +
- +# Price Count
- +ArmorAppearanceStonePriceCount = 1
- +
- +# Remove Stone Id
- +RemoveStoneAppearanceId = 111004
- \ No newline at end of file
- Index: src/main/java/com/l2jserver/Config.java
- ===================================================================
- --- src/main/java/com/l2jserver/Config.java (revision 13243)
- +++ src/main/java/com/l2jserver/Config.java (working copy)
- @@ -1111,6 +1111,17 @@
- public static boolean TRY_LOAD_UNSPECIFIED_REGIONS;
- public static Map<String, Boolean> GEODATA_REGIONS;
- + // TODO: Dressme System
- + public static int APPEARANCE_WEAPON_NORMAL_STONE_ID;
- + public static int APPEARANCE_WEAPON_BLESSED_STONE_ID;
- + public static int APPEARANCE_WEAPON_PRICE_ID;
- + public static int APPEARANCE_WEAPON_PRICE_COUNT;
- + public static int APPEARANCE_ARMOR_NORMAL_STONE_ID;
- + public static int APPEARANCE_ARMOR_BLESSED_STONE_ID;
- + public static int APPEARANCE_ARMOR_PRICE_ID;
- + public static int APPEARANCE_ARMOR_PRICE_COUNT;
- + public static int APPEARANCE_REMOVE_STONE_ID;
- +
- /**
- * This class initializes all global variables for configuration.<br>
- * 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.
- @@ -2190,6 +2201,17 @@
- TVT_EVENT_RUNNING_TIME = L2JModSettings.getInt("TvTEventRunningTime", 1800);
- TVT_EVENT_PARTICIPATION_NPC_ID = L2JModSettings.getInt("TvTEventParticipationNpcId", 0);
- + // TODO: Dressme System
- + APPEARANCE_WEAPON_NORMAL_STONE_ID = L2JModSettings.getInt("WeaponNormalStoneAppearanceId", 1);
- + APPEARANCE_WEAPON_BLESSED_STONE_ID = L2JModSettings.getInt("WeaponBlessedStoneAppearanceId", 1);
- + APPEARANCE_WEAPON_PRICE_ID = L2JModSettings.getInt("WeaponAppearanceStonePriceId", 57);
- + APPEARANCE_WEAPON_PRICE_COUNT = L2JModSettings.getInt("WeaponAppearanceStonePriceCount", 800000);
- + APPEARANCE_ARMOR_NORMAL_STONE_ID = L2JModSettings.getInt("ArmorNormalStoneAppearanceId", 1);
- + APPEARANCE_ARMOR_BLESSED_STONE_ID = L2JModSettings.getInt("ArmorBlessedStoneAppearanceId", 1);
- + APPEARANCE_ARMOR_PRICE_ID = L2JModSettings.getInt("ArmorAppearanceStonePriceId", 57);
- + APPEARANCE_ARMOR_PRICE_COUNT = L2JModSettings.getInt("ArmorAppearanceStonePriceCount", 800000);
- + APPEARANCE_REMOVE_STONE_ID = L2JModSettings.getInt("RemoveStoneAppearanceId", 1);
- +
- L2JMOD_ALLOW_WEDDING = L2JModSettings.getBoolean("AllowWedding", false);
- L2JMOD_WEDDING_PRICE = L2JModSettings.getInt("WeddingPrice", 250000000);
- L2JMOD_WEDDING_PUNISH_INFIDELITY = L2JModSettings.getBoolean("WeddingPunishInfidelity", true);
- Index: src/main/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -812,6 +812,10 @@
- private volatile int _actionMask;
- private Map<Stats, Double> _servitorShare;
- + // TODO: Appearance Stones
- + private boolean _isAddAppearance = false;
- + private L2ItemInstance _appearanceItem = null;
- +
- /**
- * Creates a player.
- * @param objectId the object ID
- @@ -14418,4 +14422,24 @@
- }
- return _servitorShare.get(stat);
- }
- +
- + public void setIsAddAppearance(boolean val)
- + {
- + _isAddAppearance = val;
- + }
- +
- + public boolean isAddAppearance()
- + {
- + return _isAddAppearance;
- + }
- +
- + public L2ItemInstance getAppearanceItem()
- + {
- + return _appearanceItem;
- + }
- +
- + public void setAppearanceItem(L2ItemInstance val)
- + {
- + _appearanceItem = val;
- + }
- }
- Index: src/main/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java (working copy)
- @@ -1001,7 +1001,7 @@
- public int getPaperdollItemDisplayId(int slot)
- {
- final L2ItemInstance item = _paperdoll[slot];
- - return (item != null) ? item.getDisplayId() : 0;
- + return (item != null) ? item.getCustomDisplayId() : 0;
- }
- public int getPaperdollAugmentationId(int slot)
- Index: src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/model/items/instance/L2ItemInstance.java (working copy)
- @@ -169,6 +169,9 @@
- private final List<Options> _enchantOptions = new ArrayList<>();
- + // TODO: Appearance Stones
- + private int _appearance = 0;
- +
- /**
- * Constructor of the L2ItemInstance from the objectId and the itemId.
- * @param objectId : int designating the ID of the object in the world
- @@ -239,18 +242,11 @@
- * <BR>
- * <B><U> Actions</U> :</B><BR>
- * <BR>
- - * <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>
- + * <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>
- * <BR>
- - * <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> Example of use </U> :</B><BR>
- - * <BR>
- - * <li>Do Pickup Item : PCInstance and Pet</li><BR>
- - * <BR>
- + * <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>
- + * Example of use </U> :</B><BR> <BR> <li>Do Pickup Item : PCInstance and Pet</li><BR> <BR>
- * @param player Player that pick up the item
- */
- public final void pickupMe(L2Character player)
- @@ -562,7 +558,7 @@
- */
- public int getLocationSlot()
- {
- - assert (_loc == ItemLocation.PAPERDOLL) || (_loc == ItemLocation.PET_EQUIP) || (_loc == ItemLocation.INVENTORY) || (_loc == ItemLocation.MAIL) || (_loc == ItemLocation.FREIGHT);
- + assert(_loc == ItemLocation.PAPERDOLL) || (_loc == ItemLocation.PET_EQUIP) || (_loc == ItemLocation.INVENTORY) || (_loc == ItemLocation.MAIL) || (_loc == ItemLocation.FREIGHT);
- return _locData;
- }
- @@ -632,6 +628,14 @@
- }
- /**
- + * @return the custom Appearance
- + */
- + public int getCustomDisplayId()
- + {
- + return (getAppearanceId() != 0) ? getAppearanceId() : getDisplayId();
- + }
- +
- + /**
- * @return {@code true} if item is an EtcItem, {@code false} otherwise.
- */
- public boolean isEtcItem()
- @@ -864,14 +868,14 @@
- public boolean isAvailable(L2PcInstance player, boolean allowAdena, boolean allowNonTradeable)
- {
- return ((!isEquipped()) // Not equipped
- - && (getItem().getType2() != L2Item.TYPE2_QUEST) // Not Quest Item
- - && ((getItem().getType2() != L2Item.TYPE2_MONEY) || (getItem().getType1() != L2Item.TYPE1_SHIELD_ARMOR)) // not money, not shield
- - && (!player.hasSummon() || (getObjectId() != player.getSummon().getControlObjectId())) // Not Control item of currently summoned pet
- - && (player.getActiveEnchantItemId() != getObjectId()) // Not momentarily used enchant scroll
- - && (player.getActiveEnchantSupportItemId() != getObjectId()) // Not momentarily used enchant support item
- - && (player.getActiveEnchantAttrItemId() != getObjectId()) // Not momentarily used enchant attribute item
- - && (allowAdena || (getId() != Inventory.ADENA_ID)) // Not Adena
- - && ((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())))));
- + && (getItem().getType2() != L2Item.TYPE2_QUEST) // Not Quest Item
- + && ((getItem().getType2() != L2Item.TYPE2_MONEY) || (getItem().getType1() != L2Item.TYPE1_SHIELD_ARMOR)) // not money, not shield
- + && (!player.hasSummon() || (getObjectId() != player.getSummon().getControlObjectId())) // Not Control item of currently summoned pet
- + && (player.getActiveEnchantItemId() != getObjectId()) // Not momentarily used enchant scroll
- + && (player.getActiveEnchantSupportItemId() != getObjectId()) // Not momentarily used enchant support item
- + && (player.getActiveEnchantAttrItemId() != getObjectId()) // Not momentarily used enchant attribute item
- + && (allowAdena || (getId() != Inventory.ADENA_ID)) // Not Adena
- + && ((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())))));
- }
- /**
- @@ -916,6 +920,35 @@
- return _augmentation;
- }
- + // TODO: Appearance Stones
- + public boolean canAppearance()
- + {
- + if (_appearance == 0)
- + {
- + return true;
- + }
- + return false;
- + }
- +
- + public int getAppearanceId()
- + {
- + return _appearance;
- + }
- +
- + public void setAppearanceId(int val)
- + {
- + _appearance = val;
- + try (Connection con = ConnectionFactory.getInstance().getConnection())
- + {
- + updateItemAttributes(con);
- + }
- + catch (SQLException e)
- + {
- + _log.log(Level.SEVERE, "Could not update atributes for item: " + this + " from DB:", e);
- + }
- +
- + }
- +
- /**
- * Sets a new augmentation
- * @param augmentation
- @@ -933,7 +966,8 @@
- _augmentation = augmentation;
- try (Connection con = ConnectionFactory.getInstance().getConnection())
- {
- - updateItemAttributes(con);
- + // TODO: Appearance Stones
- + updateItemAppearance(con);
- }
- catch (SQLException e)
- {
- @@ -976,7 +1010,8 @@
- {
- try (Connection con = ConnectionFactory.getInstance().getConnection();
- PreparedStatement ps1 = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?");
- - PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
- + PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?");
- + PreparedStatement ps3 = con.prepareStatement("SELECT appearanceId FROM item_appearance WHERE itemId=?"))
- {
- ps1.setInt(1, getObjectId());
- try (ResultSet rs = ps1.executeQuery())
- @@ -1004,6 +1039,15 @@
- }
- }
- }
- +
- + ps3.setInt(1, getObjectId());
- + try (ResultSet rs = ps3.executeQuery())
- + {
- + while (rs.next())
- + {
- + _appearance = (rs.getInt("appearanceId"));
- + }
- + }
- }
- catch (Exception e)
- {
- @@ -1025,6 +1069,20 @@
- }
- }
- + private void updateItemAppearance(Connection con)
- + {
- + try (PreparedStatement ps = con.prepareStatement("REPLACE INTO item_appearance VALUES(?,?)"))
- + {
- + ps.setInt(1, getObjectId());
- + ps.setInt(2, _appearance != 0 ? _appearance : -1);
- + ps.executeUpdate();
- + }
- + catch (SQLException e)
- + {
- + _log.log(Level.SEVERE, "Could not update atributes for item: " + this + " from DB:", e);
- + }
- + }
- +
- private void updateItemElements(Connection con)
- {
- try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
- @@ -1537,16 +1595,11 @@
- * <BR>
- * <B><U> Actions</U> :</B><BR>
- * <BR>
- - * <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>
- + * <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>
- * <BR>
- - * <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>
- + * <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>
- * <li>Drop item</li> <li>Call Pet</li><BR>
- */
- public class ItemDropTask implements Runnable
- @@ -1667,7 +1720,7 @@
- */
- private void insertIntoDb()
- {
- - assert !_existsInDb && (getObjectId() != 0);
- + assert!_existsInDb && (getObjectId() != 0);
- if (_wear)
- {
- @@ -1697,6 +1750,10 @@
- {
- updateItemAttributes(con);
- }
- + if (_appearance != 0)
- + {
- + updateItemAppearance(con);
- + }
- if (_elementals != null)
- {
- updateItemElements(con);
- Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/AbstractRefinePacket.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/network/clientpackets/AbstractRefinePacket.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/AbstractRefinePacket.java (working copy)
- @@ -227,19 +227,23 @@
- return false;
- }
- - final CrystalType grade = item.getItem().getItemGrade();
- - final LifeStone ls = _lifeStones.get(refinerItem.getId());
- -
- - // Check for item id
- - if (getGemStoneId(grade) != gemStones.getId())
- + // TODO: Appearance Stones
- + if (!player.isAddAppearance())
- {
- - return false;
- + final CrystalType grade = item.getItem().getItemGrade();
- + final LifeStone ls = _lifeStones.get(refinerItem.getId());
- +
- + // Check for item id
- + if (getGemStoneId(grade) != gemStones.getId())
- + {
- + return false;
- + }
- + // Count must be greater or equal of required number
- + if (getGemStoneCount(grade, ls.getGrade()) > gemStones.getCount())
- + {
- + return false;
- + }
- }
- - // Count must be greater or equal of required number
- - if (getGemStoneCount(grade, ls.getGrade()) > gemStones.getCount())
- - {
- - return false;
- - }
- return true;
- }
- @@ -269,26 +273,45 @@
- return false;
- }
- - final LifeStone ls = _lifeStones.get(refinerItem.getId());
- - if (ls == null)
- + // TODO: Appearance Stones
- + if (!player.isAddAppearance())
- {
- - return false;
- + final LifeStone ls = _lifeStones.get(refinerItem.getId());
- + if (ls == null)
- + {
- + return false;
- + }
- + // weapons can't be augmented with accessory ls
- + if ((item.getItem() instanceof L2Weapon) && (ls.getGrade() == GRADE_ACC))
- + {
- + return false;
- + }
- + // and accessory can't be augmented with weapon ls
- + if ((item.getItem() instanceof L2Armor) && (ls.getGrade() != GRADE_ACC))
- + {
- + return false;
- + }
- + // check for level of the lifestone
- + if (player.getLevel() < ls.getPlayerLevel())
- + {
- + return false;
- + }
- }
- - // weapons can't be augmented with accessory ls
- - if ((item.getItem() instanceof L2Weapon) && (ls.getGrade() == GRADE_ACC))
- + else
- {
- - return false;
- + if (!item.getItem().getItemType().equals(refinerItem.getItem().getItemType()))
- + {
- + return false;
- + }
- + if (refinerItem.isAugmented())
- + {
- + return false;
- + }
- + if (refinerItem.getItem().getItemGrade().isLesser(CrystalType.S))
- + {
- + return false;
- + }
- }
- - // and accessory can't be augmented with weapon ls
- - if ((item.getItem() instanceof L2Armor) && (ls.getGrade() != GRADE_ACC))
- - {
- - return false;
- - }
- - // check for level of the lifestone
- - if (player.getLevel() < ls.getPlayerLevel())
- - {
- - return false;
- - }
- return true;
- }
- @@ -311,10 +334,29 @@
- {
- return false;
- }
- - if (item.isAugmented())
- +
- + // TODO: Appearance Stones
- + if (!item.canAppearance() && player.isAddAppearance())
- {
- return false;
- }
- + if ((item.getItem().getItemGrade().isLesser(CrystalType.S80)) && player.isAddAppearance())
- + {
- + return false;
- + }
- + if (item.isArmor() && ((player.getAppearanceItem().getId() != Config.APPEARANCE_ARMOR_NORMAL_STONE_ID) || (player.getAppearanceItem().getId() != Config.APPEARANCE_ARMOR_BLESSED_STONE_ID)) && player.isAddAppearance())
- + {
- + return false;
- + }
- + if (item.isWeapon() && ((player.getAppearanceItem().getId() != Config.APPEARANCE_WEAPON_NORMAL_STONE_ID) || (player.getAppearanceItem().getId() != Config.APPEARANCE_WEAPON_BLESSED_STONE_ID)) && player.isAddAppearance())
- + {
- + return false;
- + }
- +
- + if (item.isAugmented() && !player.isAddAppearance())
- + {
- + return false;
- + }
- if (item.isHeroItem())
- {
- return false;
- @@ -373,8 +415,17 @@
- case L2Item.SLOT_LR_FINGER:
- case L2Item.SLOT_LR_EAR:
- case L2Item.SLOT_NECK:
- + // Jewerly cannot add a appearance, is absurd.
- + if (player.isAddAppearance())
- + {
- + return false;
- + }
- break;
- default:
- + if (player.isAddAppearance())
- + {
- + return true;
- + }
- return false;
- }
- }
- Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmCancelItem.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmCancelItem.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmCancelItem.java (working copy)
- @@ -60,13 +60,19 @@
- return;
- }
- - if (!item.isAugmented())
- + if (!item.isAugmented() && !activeChar.isAddAppearance())
- {
- activeChar.sendPacket(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
- return;
- }
- - if (item.isPvp() && !Config.ALT_ALLOW_AUGMENT_PVP_ITEMS)
- + if (item.canAppearance() && activeChar.isAddAppearance())
- + {
- + activeChar.sendMessage("The item don't have a appearance.");
- + return;
- + }
- +
- + if (item.isPvp() && !Config.ALT_ALLOW_AUGMENT_PVP_ITEMS && !activeChar.isAddAppearance())
- {
- activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
- return;
- Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmGemStone.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmGemStone.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmGemStone.java (working copy)
- @@ -75,17 +75,29 @@
- return;
- }
- - // Check for gemstone count
- - final LifeStone ls = getLifeStone(refinerItem.getId());
- - if (ls == null)
- + // TODO: Appearance Stones
- + if (!activeChar.isAddAppearance())
- {
- - return;
- + // Check for gemstone count
- + final LifeStone ls = getLifeStone(refinerItem.getId());
- + if (ls == null)
- + {
- + return;
- + }
- +
- + if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), ls.getGrade()))
- + {
- + activeChar.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
- + return;
- + }
- }
- -
- - if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), ls.getGrade()))
- + else
- {
- - activeChar.sendPacket(SystemMessageId.GEMSTONE_QUANTITY_IS_INCORRECT);
- - return;
- + if (_gemStoneCount != 1)
- + {
- + activeChar.sendMessage("Stone quantity is incorrect.");
- + return;
- + }
- }
- activeChar.sendPacket(new ExPutCommissionResultForVariationMake(_gemstoneItemObjId, _gemStoneCount, gemStoneItem.getId()));
- Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmRefinerItem.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmRefinerItem.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmRefinerItem.java (working copy)
- @@ -65,16 +65,33 @@
- if (!isValid(activeChar, targetItem, refinerItem))
- {
- + if ((refinerItem.getItem().getItemGrade().isLesser(CrystalType.S)) && activeChar.isAddAppearance())
- + {
- + activeChar.sendMessage("Appearance Item isn't grade S or highter.");
- + return;
- + }
- +
- activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
- return;
- }
- - final int refinerItemId = refinerItem.getItem().getId();
- - final CrystalType grade = targetItem.getItem().getItemGrade();
- - final LifeStone ls = getLifeStone(refinerItemId);
- - final int gemStoneId = getGemStoneId(grade);
- - final int gemStoneCount = getGemStoneCount(grade, ls.getGrade());
- + int refinerItemId = refinerItem.getItem().getId();
- + CrystalType grade = targetItem.getItem().getItemGrade();
- + int gemStoneId;
- + int gemStoneCount;
- + if (activeChar.isAddAppearance())
- + {
- + gemStoneId = activeChar.getAppearanceItem().getId();
- + gemStoneCount = 1;
- + }
- + else
- + {
- + final LifeStone ls = getLifeStone(refinerItemId);
- + gemStoneId = getGemStoneId(grade);
- + gemStoneCount = getGemStoneCount(grade, ls.getGrade());
- + }
- +
- activeChar.sendPacket(new ExPutIntensiveResultForVariationMake(_refinerItemObjId, refinerItemId, gemStoneId, gemStoneCount));
- }
- Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmTargetItem.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmTargetItem.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestConfirmTargetItem.java (working copy)
- @@ -20,6 +20,7 @@
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
- +import com.l2jserver.gameserver.model.items.type.CrystalType;
- import com.l2jserver.gameserver.network.SystemMessageId;
- import com.l2jserver.gameserver.network.serverpackets.ExPutItemResultForVariationMake;
- @@ -56,11 +57,28 @@
- if (!isValid(activeChar, item))
- {
- // Different system message here
- - if (item.isAugmented())
- + if (!activeChar.isAddAppearance())
- {
- - activeChar.sendPacket(SystemMessageId.ONCE_AN_ITEM_IS_AUGMENTED_IT_CANNOT_BE_AUGMENTED_AGAIN);
- - return;
- + if (item.isAugmented())
- + {
- + activeChar.sendPacket(SystemMessageId.ONCE_AN_ITEM_IS_AUGMENTED_IT_CANNOT_BE_AUGMENTED_AGAIN);
- + return;
- + }
- }
- + else
- + {
- + if (!item.canAppearance())
- + {
- + activeChar.sendMessage("Once an item get appearance cannot be obtain a new appearance.");
- + return;
- + }
- +
- + if (item.getItem().getItemGrade().isLesser(CrystalType.S))
- + {
- + activeChar.sendMessage("Appearance Item isn't grade S80 or highter.");
- + return;
- + }
- + }
- activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
- return;
- Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefine.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefine.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefine.java (working copy)
- @@ -18,7 +18,9 @@
- */
- package com.l2jserver.gameserver.network.clientpackets;
- +import com.l2jserver.Config;
- import com.l2jserver.gameserver.datatables.AugmentationData;
- +import com.l2jserver.gameserver.datatables.ItemTable;
- import com.l2jserver.gameserver.model.L2Augmentation;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
- @@ -79,60 +81,132 @@
- return;
- }
- - final LifeStone ls = getLifeStone(refinerItem.getId());
- - if (ls == null)
- + if (!activeChar.isAddAppearance())
- {
- - return;
- - }
- -
- - final int lifeStoneLevel = ls.getLevel();
- - final int lifeStoneGrade = ls.getGrade();
- - if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), lifeStoneGrade))
- - {
- - activeChar.sendPacket(new ExVariationResult(0, 0, 0));
- - activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
- - return;
- - }
- -
- - // unequip item
- - if (targetItem.isEquipped())
- - {
- - L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
- - InventoryUpdate iu = new InventoryUpdate();
- - for (L2ItemInstance itm : unequiped)
- + final LifeStone ls = getLifeStone(refinerItem.getId());
- + if (ls == null)
- {
- - iu.addModifiedItem(itm);
- + return;
- }
- +
- + final int lifeStoneLevel = ls.getLevel();
- + final int lifeStoneGrade = ls.getGrade();
- + if (_gemStoneCount != getGemStoneCount(targetItem.getItem().getItemGrade(), lifeStoneGrade))
- + {
- + activeChar.sendPacket(new ExVariationResult(0, 0, 0));
- + activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
- + return;
- + }
- +
- + // unequip item
- + if (targetItem.isEquipped())
- + {
- + L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (L2ItemInstance itm : unequiped)
- + {
- + iu.addModifiedItem(itm);
- + }
- + activeChar.sendPacket(iu);
- + activeChar.broadcastUserInfo();
- + }
- +
- + // consume the life stone
- + if (!activeChar.destroyItem("RequestRefine", refinerItem, 1, null, false))
- + {
- + return;
- + }
- +
- + // consume the gemstones
- + if (!activeChar.destroyItem("RequestRefine", gemStoneItem, _gemStoneCount, null, false))
- + {
- + return;
- + }
- +
- + final L2Augmentation aug = AugmentationData.getInstance().generateRandomAugmentation(lifeStoneLevel, lifeStoneGrade, targetItem.getItem().getBodyPart(), refinerItem.getId(), targetItem);
- + targetItem.setAugmentation(aug);
- +
- + final int stat12 = 0x0000FFFF & aug.getAugmentationId();
- + final int stat34 = aug.getAugmentationId() >> 16;
- + activeChar.sendPacket(new ExVariationResult(stat12, stat34, 1));
- +
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(targetItem);
- activeChar.sendPacket(iu);
- - activeChar.broadcastUserInfo();
- +
- + StatusUpdate su = new StatusUpdate(activeChar);
- + su.addAttribute(StatusUpdate.CUR_LOAD, activeChar.getCurrentLoad());
- + activeChar.sendPacket(su);
- }
- -
- - // consume the life stone
- - if (!activeChar.destroyItem("RequestRefine", refinerItem, 1, null, false))
- + else
- {
- - return;
- + // Set off the system
- + activeChar.setIsAddAppearance(false);
- + activeChar.setAppearanceItem(null);
- +
- + if (_gemStoneCount != 1)
- + {
- + activeChar.sendPacket(new ExVariationResult(0, 0, 0));
- + activeChar.sendPacket(SystemMessageId.AUGMENTATION_FAILED_DUE_TO_INAPPROPRIATE_CONDITIONS);
- + return;
- + }
- +
- + if (targetItem.isArmor())
- + {
- + if (gemStoneItem.getId() != Config.APPEARANCE_ARMOR_BLESSED_STONE_ID)
- + {
- + if (!activeChar.destroyItemByItemId("Price", Config.APPEARANCE_ARMOR_PRICE_ID, Config.APPEARANCE_ARMOR_PRICE_COUNT, null, true))
- + {
- + activeChar.sendPacket(new ExVariationResult(0, 0, 0));
- + activeChar.sendMessage("You need " + Config.APPEARANCE_ARMOR_PRICE_COUNT + " " + ItemTable.getInstance().getTemplate(Config.APPEARANCE_ARMOR_PRICE_ID).getName());
- + return;
- + }
- + }
- +
- + }
- + else if (targetItem.isWeapon())
- + {
- + if (gemStoneItem.getId() != Config.APPEARANCE_WEAPON_BLESSED_STONE_ID)
- + {
- + if (!activeChar.destroyItemByItemId("Price", Config.APPEARANCE_WEAPON_PRICE_ID, Config.APPEARANCE_WEAPON_PRICE_COUNT, null, true))
- + {
- + activeChar.sendPacket(new ExVariationResult(0, 0, 0));
- + activeChar.sendMessage("You need " + Config.APPEARANCE_WEAPON_PRICE_COUNT + " " + ItemTable.getInstance().getTemplate(Config.APPEARANCE_WEAPON_PRICE_ID).getName());
- + return;
- + }
- + }
- + }
- +
- + // unequip item
- + if (targetItem.isEquipped())
- + {
- + L2ItemInstance[] unequiped = activeChar.getInventory().unEquipItemInSlotAndRecord(targetItem.getLocationSlot());
- + InventoryUpdate iu = new InventoryUpdate();
- + for (L2ItemInstance itm : unequiped)
- + {
- + iu.addModifiedItem(itm);
- + }
- + activeChar.sendPacket(iu);
- + activeChar.broadcastUserInfo();
- + }
- +
- + if ((gemStoneItem.getId() != Config.APPEARANCE_ARMOR_BLESSED_STONE_ID) || (gemStoneItem.getId() != Config.APPEARANCE_WEAPON_BLESSED_STONE_ID))
- + {
- + if (!activeChar.destroyItem("RequestRefine", refinerItem, 1, null, false))
- + {
- + return;
- + }
- + }
- +
- + if (!activeChar.destroyItem("RequestRefine", gemStoneItem, _gemStoneCount, null, false))
- + {
- + return;
- + }
- +
- + targetItem.setAppearanceId(refinerItem.getId());
- + activeChar.sendPacket(new ExVariationResult(0, 0, 0));
- + activeChar.sendMessage("Appearance added succesfully!");
- }
- -
- - // consume the gemstones
- - if (!activeChar.destroyItem("RequestRefine", gemStoneItem, _gemStoneCount, null, false))
- - {
- - return;
- - }
- -
- - final L2Augmentation aug = AugmentationData.getInstance().generateRandomAugmentation(lifeStoneLevel, lifeStoneGrade, targetItem.getItem().getBodyPart(), refinerItem.getId(), targetItem);
- - targetItem.setAugmentation(aug);
- -
- - final int stat12 = 0x0000FFFF & aug.getAugmentationId();
- - final int stat34 = aug.getAugmentationId() >> 16;
- - activeChar.sendPacket(new ExVariationResult(stat12, stat34, 1));
- -
- - InventoryUpdate iu = new InventoryUpdate();
- - iu.addModifiedItem(targetItem);
- - activeChar.sendPacket(iu);
- -
- - StatusUpdate su = new StatusUpdate(activeChar);
- - su.addAttribute(StatusUpdate.CUR_LOAD, activeChar.getCurrentLoad());
- - activeChar.sendPacket(su);
- }
- @Override
- Index: src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefineCancel.java
- ===================================================================
- --- src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefineCancel.java (revision 13243)
- +++ src/main/java/com/l2jserver/gameserver/network/clientpackets/RequestRefineCancel.java (working copy)
- @@ -62,7 +62,7 @@
- return;
- }
- // cannot remove augmentation from a not augmented item
- - if (!targetItem.isAugmented())
- + if (!targetItem.isAugmented() && !activeChar.isAddAppearance())
- {
- activeChar.sendPacket(SystemMessageId.AUGMENTATION_REMOVAL_CAN_ONLY_BE_DONE_ON_AN_AUGMENTED_ITEM);
- activeChar.sendPacket(new ExVariationCancelResult(0));
- @@ -69,85 +69,115 @@
- return;
- }
- - // get the price
- - int price = 0;
- - switch (targetItem.getItem().getCrystalType())
- + // TODO: Appearance Stones
- + if (targetItem.canAppearance() && activeChar.isAddAppearance())
- {
- - case C:
- - if (targetItem.getCrystalCount() < 1720)
- - {
- - price = 95000;
- - }
- - else if (targetItem.getCrystalCount() < 2452)
- - {
- - price = 150000;
- - }
- - else
- - {
- - price = 210000;
- - }
- - break;
- - case B:
- - if (targetItem.getCrystalCount() < 1746)
- - {
- - price = 240000;
- - }
- - else
- - {
- - price = 270000;
- - }
- - break;
- - case A:
- - if (targetItem.getCrystalCount() < 2160)
- - {
- - price = 330000;
- - }
- - else if (targetItem.getCrystalCount() < 2824)
- - {
- - price = 390000;
- - }
- - else
- - {
- - price = 420000;
- - }
- - break;
- - case S:
- - price = 480000;
- - break;
- - case S80:
- - case S84:
- - price = 920000;
- - break;
- - // any other item type is not augmentable
- - default:
- + activeChar.sendMessage("The item don't have a appearance.");
- + return;
- + }
- +
- + if (!activeChar.isAddAppearance())
- + {
- + // get the price
- + int price = 0;
- + switch (targetItem.getItem().getCrystalType())
- + {
- + case C:
- + if (targetItem.getCrystalCount() < 1720)
- + {
- + price = 95000;
- + }
- + else if (targetItem.getCrystalCount() < 2452)
- + {
- + price = 150000;
- + }
- + else
- + {
- + price = 210000;
- + }
- + break;
- + case B:
- + if (targetItem.getCrystalCount() < 1746)
- + {
- + price = 240000;
- + }
- + else
- + {
- + price = 270000;
- + }
- + break;
- + case A:
- + if (targetItem.getCrystalCount() < 2160)
- + {
- + price = 330000;
- + }
- + else if (targetItem.getCrystalCount() < 2824)
- + {
- + price = 390000;
- + }
- + else
- + {
- + price = 420000;
- + }
- + break;
- + case S:
- + price = 480000;
- + break;
- + case S80:
- + case S84:
- + price = 920000;
- + break;
- + // any other item type is not augmentable
- + default:
- + activeChar.sendPacket(new ExVariationCancelResult(0));
- + return;
- + }
- +
- + // try to reduce the players adena
- + if (!activeChar.reduceAdena("RequestRefineCancel", price, null, true))
- + {
- activeChar.sendPacket(new ExVariationCancelResult(0));
- + activeChar.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
- return;
- + }
- +
- + // unequip item
- + if (targetItem.isEquipped())
- + {
- + activeChar.disarmWeapons();
- + }
- +
- + // remove the augmentation
- + targetItem.removeAugmentation();
- +
- + // send ExVariationCancelResult
- + activeChar.sendPacket(new ExVariationCancelResult(1));
- +
- + // send inventory update
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(targetItem);
- + activeChar.sendPacket(iu);
- }
- -
- - // try to reduce the players adena
- - if (!activeChar.reduceAdena("RequestRefineCancel", price, null, true))
- + else
- {
- + if (!activeChar.destroyItem("RequestRefineCancel", activeChar.getAppearanceItem().getId(), 1, null, false))
- + {
- + return;
- + }
- + // unequip item
- + if (targetItem.isEquipped())
- + {
- + activeChar.disarmWeapons();
- + }
- +
- + // Set off the system
- + activeChar.setIsAddAppearance(false);
- + activeChar.setAppearanceItem(null);
- +
- + targetItem.setAppearanceId(0);
- activeChar.sendPacket(new ExVariationCancelResult(0));
- - activeChar.sendPacket(SystemMessageId.YOU_NOT_ENOUGH_ADENA);
- - return;
- + activeChar.sendMessage("Appearance removed succesfully");
- }
- -
- - // unequip item
- - if (targetItem.isEquipped())
- - {
- - activeChar.disarmWeapons();
- - }
- -
- - // remove the augmentation
- - targetItem.removeAugmentation();
- -
- - // send ExVariationCancelResult
- - activeChar.sendPacket(new ExVariationCancelResult(1));
- -
- - // send inventory update
- - InventoryUpdate iu = new InventoryUpdate();
- - iu.addModifiedItem(targetItem);
- - activeChar.sendPacket(iu);
- }
- @Override
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement