diff --git a/trunk/java/com/l2jserver/gameserver/data/xml/impl/HennaData.java b/trunk/java/com/l2jserver/gameserver/data/xml/impl/HennaData.java index 769f862398..65a521f3ad 100644 --- a/trunk/java/com/l2jserver/gameserver/data/xml/impl/HennaData.java +++ b/trunk/java/com/l2jserver/gameserver/data/xml/impl/HennaData.java @@ -29,6 +29,7 @@ import org.w3c.dom.Node; import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.base.ClassId; +import com.l2jserver.gameserver.model.holders.SkillHolder; import com.l2jserver.gameserver.model.items.L2Henna; import com.l2jserver.util.data.xml.IXmlReader; @@ -85,6 +86,7 @@ public final class HennaData implements IXmlReader { final StatsSet set = new StatsSet(); final List wearClassIds = new ArrayList<>(); + final List skills = new ArrayList<>(); NamedNodeMap attrs = d.getAttributes(); Node attr; for (int i = 0; i < attrs.getLength(); i++) @@ -124,6 +126,19 @@ public final class HennaData implements IXmlReader set.set("cancel_fee", attr.getNodeValue()); break; } + case "skills": + { + for (Node i = c.getFirstChild(); i != null; i = i.getNextSibling()) + { + if ("skill".equals(i.getNodeName())) + { + final int skillId = Integer.parseInt(i.getAttributes().getNamedItem("id").getNodeValue()); + final int skillLevel = Integer.parseInt(i.getAttributes().getNamedItem("level").getNodeValue()); + skills.add(new SkillHolder(skillId, skillLevel)); + } + } + break; + } case "classId": { wearClassIds.add(ClassId.getClassId(Integer.parseInt(c.getTextContent()))); @@ -133,6 +148,7 @@ public final class HennaData implements IXmlReader } final L2Henna henna = new L2Henna(set); henna.setWearClassIds(wearClassIds); + henna.setSkills(skills); _hennaList.put(henna.getDyeId(), henna); } diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java index cad0d72c57..51839e2402 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java @@ -201,6 +201,7 @@ import com.l2jserver.gameserver.model.events.EventDispatcher; import com.l2jserver.gameserver.model.events.impl.character.npc.OnNpcSocialActionSee; import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerEquipItem; import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerFameChanged; +import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerHennaAdd; import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerHennaRemove; import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerKarmaChanged; import com.l2jserver.gameserver.model.events.impl.character.player.OnPlayerLogin; @@ -4202,8 +4203,7 @@ public final class L2PcInstance extends L2Playable } /** - * Send packet StatusUpdate with current HP,MP and CP to the L2PcInstance and only current HP, MP and Level to all other L2PcInstance of the Party. Actions : - *
  • Send the Server->Client packet StatusUpdate with current HP, MP and CP to this L2PcInstance

  • + * Send packet StatusUpdate with current HP,MP and CP to the L2PcInstance and only current HP, MP and Level to all other L2PcInstance of the Party. Actions :
  • Send the Server->Client packet StatusUpdate with current HP, MP and CP to this L2PcInstance

  • *
  • Send the Server->Client packet PartySmallWindowUpdate with current HP, MP and Level to all other L2PcInstance of the Party
  • Caution : This method DOESN'T SEND current HP and MP to all L2PcInstance of the _statusListener */ @Override @@ -4267,10 +4267,8 @@ public final class L2PcInstance extends L2Playable /** * Send a Server->Client packet UserInfo to this L2PcInstance and CharInfo to all L2PcInstance in its _KnownPlayers. Concept : Others L2PcInstance in the detection area of the L2PcInstance are identified in _knownPlayers. In order to inform other players of this - * L2PcInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet Actions : - *
  • Send a Server->Client packet UserInfo to this L2PcInstance (Public and Private Data)
  • - *
  • Send a Server->Client packet CharInfo to all L2PcInstance in _KnownPlayers of the L2PcInstance (Public data only)
  • - * Caution : DON'T SEND UserInfo packet to other players instead of CharInfo packet. Indeed, UserInfo packet contains PRIVATE DATA as MaxHP, STR, DEX... + * L2PcInstance state modifications, server just need to go through _knownPlayers to send Server->Client Packet Actions :
  • Send a Server->Client packet UserInfo to this L2PcInstance (Public and Private Data)
  • Send a Server->Client packet CharInfo to all L2PcInstance in + * _KnownPlayers of the L2PcInstance (Public data only)
  • Caution : DON'T SEND UserInfo packet to other players instead of CharInfo packet. Indeed, UserInfo packet contains PRIVATE DATA as MaxHP, STR, DEX... */ public final void broadcastUserInfo() { @@ -4469,10 +4467,8 @@ public final class L2PcInstance extends L2Playable } /** - * Manage Interact Task with another L2PcInstance. Actions : - *
  • If the private store is a STORE_PRIVATE_SELL, send a Server->Client PrivateBuyListSell packet to the L2PcInstance
  • - *
  • If the private store is a STORE_PRIVATE_BUY, send a Server->Client PrivateBuyListBuy packet to the L2PcInstance
  • - *
  • If the private store is a STORE_PRIVATE_MANUFACTURE, send a Server->Client RecipeShopSellList packet to the L2PcInstance
  • + * Manage Interact Task with another L2PcInstance. Actions :
  • If the private store is a STORE_PRIVATE_SELL, send a Server->Client PrivateBuyListSell packet to the L2PcInstance
  • If the private store is a STORE_PRIVATE_BUY, send a Server->Client PrivateBuyListBuy packet + * to the L2PcInstance
  • If the private store is a STORE_PRIVATE_MANUFACTURE, send a Server->Client RecipeShopSellList packet to the L2PcInstance
  • * @param target The L2Character targeted */ public void doInteract(L2Character target) @@ -4546,13 +4542,9 @@ public final class L2PcInstance extends L2Playable } /** - * Manage Pickup Task. Actions : - *
  • Send a Server->Client packet StopMove to this L2PcInstance
  • - *
  • Remove the L2ItemInstance from the world and send server->client GetItem packets
  • - *
  • Send a System Message to the L2PcInstance : YOU_PICKED_UP_S1_ADENA or YOU_PICKED_UP_S1_S2
  • - *
  • Add the Item to the L2PcInstance inventory
  • - *
  • Send a Server->Client packet InventoryUpdate to this L2PcInstance with NewItem (use a new slot) or ModifiedItem (increase amount)
  • - *
  • Send a Server->Client packet StatusUpdate to this L2PcInstance with current weight
  • Caution : If a Party is in progress, distribute Items between party members + * Manage Pickup Task. Actions :
  • Send a Server->Client packet StopMove to this L2PcInstance
  • Remove the L2ItemInstance from the world and send server->client GetItem packets
  • Send a System Message to the L2PcInstance : YOU_PICKED_UP_S1_ADENA or + * YOU_PICKED_UP_S1_S2
  • Add the Item to the L2PcInstance inventory
  • Send a Server->Client packet InventoryUpdate to this L2PcInstance with NewItem (use a new slot) or ModifiedItem (increase amount)
  • Send a Server->Client packet StatusUpdate to this L2PcInstance with + * current weight
  • Caution : If a Party is in progress, distribute Items between party members * @param object The L2ItemInstance to pick up */ @Override @@ -5271,12 +5263,8 @@ public final class L2PcInstance extends L2Playable } /** - * Kill the L2Character, Apply Death Penalty, Manage gain/loss Karma and Item Drop. Actions : - *
  • Reduce the Experience of the L2PcInstance in function of the calculated Death Penalty
  • - *
  • If necessary, unsummon the Pet of the killed L2PcInstance
  • - *
  • Manage Karma gain for attacker and Karam loss for the killed L2PcInstance
  • - *
  • If the killed L2PcInstance has Karma, manage Drop Item
  • - *
  • Kill the L2PcInstance
  • + * Kill the L2Character, Apply Death Penalty, Manage gain/loss Karma and Item Drop. Actions :
  • Reduce the Experience of the L2PcInstance in function of the calculated Death Penalty
  • If necessary, unsummon the Pet of the killed L2PcInstance
  • Manage Karma gain for + * attacker and Karam loss for the killed L2PcInstance
  • If the killed L2PcInstance has Karma, manage Drop Item
  • Kill the L2PcInstance
  • * @param killer */ @Override @@ -5767,11 +5755,7 @@ public final class L2PcInstance extends L2Playable /** * Reduce the Experience (and level if necessary) of the L2PcInstance in function of the calculated Death Penalty.
    - * Actions : - *
  • Calculate the Experience loss
  • - *
  • Set the value of _expBeforeDeath
  • - *
  • Set the new Experience value of the L2PcInstance and Decrease its level if necessary
  • - *
  • Send a Server->Client StatusUpdate packet with its new Experience
  • + * Actions :
  • Calculate the Experience loss
  • Set the value of _expBeforeDeath
  • Set the new Experience value of the L2PcInstance and Decrease its level if necessary
  • Send a Server->Client StatusUpdate packet with its new Experience
  • * @param killer * @param atWar */ @@ -5846,9 +5830,7 @@ public final class L2PcInstance extends L2Playable } /** - * Stop the HP/MP/CP Regeneration task. Actions : - *
  • Set the RegenActive flag to False
  • - *
  • Stop the HP/MP/CP Regeneration task
  • + * Stop the HP/MP/CP Regeneration task. Actions :
  • Set the RegenActive flag to False
  • Stop the HP/MP/CP Regeneration task
  • */ public void stopAllTimers() { @@ -6210,10 +6192,7 @@ public final class L2PcInstance extends L2Playable } /** - * Set the Private Store type of the L2PcInstance. Values : - *
  • 0 : STORE_PRIVATE_NONE
  • - *
  • 1 : STORE_PRIVATE_SELL
  • - *
  • 2 : sellmanage

  • + * Set the Private Store type of the L2PcInstance. Values :
  • 0 : STORE_PRIVATE_NONE
  • 1 : STORE_PRIVATE_SELL
  • 2 : sellmanage

  • *
  • 3 : STORE_PRIVATE_BUY

  • *
  • 4 : buymanage

  • *
  • 5 : STORE_PRIVATE_MANUFACTURE

  • @@ -6230,10 +6209,7 @@ public final class L2PcInstance extends L2Playable } /** - * Values : - *
  • 0 : STORE_PRIVATE_NONE
  • - *
  • 1 : STORE_PRIVATE_SELL
  • - *
  • 2 : sellmanage

  • + * Values :
  • 0 : STORE_PRIVATE_NONE
  • 1 : STORE_PRIVATE_SELL
  • 2 : sellmanage

  • *
  • 3 : STORE_PRIVATE_BUY

  • *
  • 4 : buymanage

  • *
  • 5 : STORE_PRIVATE_MANUFACTURE

  • @@ -7044,11 +7020,8 @@ public final class L2PcInstance extends L2Playable } /** - * Retrieve a L2PcInstance from the characters table of the database and add it in _allObjects of the L2world. Actions : - *
  • Retrieve the L2PcInstance from the characters table of the database
  • - *
  • Add the L2PcInstance object in _allObjects
  • - *
  • Set the x,y,z position of the L2PcInstance and make it invisible
  • - *
  • Update the overloaded status of the L2PcInstance
  • + * Retrieve a L2PcInstance from the characters table of the database and add it in _allObjects of the L2world. Actions :
  • Retrieve the L2PcInstance from the characters table of the database
  • Add the L2PcInstance object in _allObjects
  • Set the x,y,z position of + * the L2PcInstance and make it invisible
  • Update the overloaded status of the L2PcInstance
  • * @param objectId Identifier of the object to initialized * @return The L2PcInstance loaded from the database */ @@ -7918,10 +7891,8 @@ public final class L2PcInstance extends L2Playable } /** - * Add a skill to the L2PcInstance _skills and its Func objects to the calculator set of the L2PcInstance and save update in the character_skills table of the database. Concept : All skills own by a L2PcInstance are identified in _skills Actions : - *
  • Replace oldSkill by newSkill or Add the newSkill
  • - *
  • If an old skill has been replaced, remove all its Func objects of L2Character calculator set
  • - *
  • Add Func objects of newSkill to the calculator set of the L2Character
  • + * Add a skill to the L2PcInstance _skills and its Func objects to the calculator set of the L2PcInstance and save update in the character_skills table of the database. Concept : All skills own by a L2PcInstance are identified in _skills Actions :
  • Replace + * oldSkill by newSkill or Add the newSkill
  • If an old skill has been replaced, remove all its Func objects of L2Character calculator set
  • Add Func objects of newSkill to the calculator set of the L2Character
  • * @param newSkill The L2Skill to add to the L2Character * @param store * @return The L2Skill replaced or null if just added a new L2Skill @@ -7952,10 +7923,8 @@ public final class L2PcInstance extends L2Playable } /** - * Remove a skill from the L2Character and its Func objects from calculator set of the L2Character and save update in the character_skills table of the database. Concept : All skills own by a L2Character are identified in _skills Actions : - *
  • Remove the skill from the L2Character _skills
  • - *
  • Remove all its Func objects from the L2Character calculator set
  • Overridden in : - *
  • L2PcInstance : Save update in the character_skills table of the database
  • + * Remove a skill from the L2Character and its Func objects from calculator set of the L2Character and save update in the character_skills table of the database. Concept : All skills own by a L2Character are identified in _skills Actions :
  • Remove the + * skill from the L2Character _skills
  • Remove all its Func objects from the L2Character calculator set
  • Overridden in :
  • L2PcInstance : Save update in the character_skills table of the database
  • * @param skill The L2Skill to remove from the L2Character * @return The L2Skill removed */ @@ -8367,6 +8336,15 @@ public final class L2PcInstance extends L2Playable // Calculate Henna modifiers of this L2PcInstance recalcHennaStats(); + // Remove Henna skills + for (SkillHolder skill : henna.getSkills()) + { + if (getAllSkills().contains(skill.getSkill())) + { + removeSkill(skill.getSkill(), true); + } + } + // Send Server->Client HennaInfo packet to this L2PcInstance sendPacket(new HennaInfo(this)); @@ -8374,6 +8352,8 @@ public final class L2PcInstance extends L2Playable UserInfo ui = new UserInfo(this, false); ui.addComponentType(UserInfoType.BASE_STATS, UserInfoType.MAX_HPCPMP, UserInfoType.STATS, UserInfoType.SPEED); sendPacket(ui); + sendSkillList(); + // Add the recovered dyes to the player's inventory and notify them. getInventory().addItem("Henna", henna.getDyeItemId(), henna.getCancelCount(), this, null); reduceAdena("Henna", henna.getCancelFee(), this, false); @@ -8405,6 +8385,15 @@ public final class L2PcInstance extends L2Playable // Calculate Henna modifiers of this L2PcInstance recalcHennaStats(); + // Add Henna skills + for (SkillHolder skill : henna.getSkills()) + { + if (!getAllSkills().contains(skill)) + { + addSkill(skill.getSkill(), true); + } + } + try (Connection con = ConnectionFactory.getInstance().getConnection(); PreparedStatement ps = con.prepareStatement(ADD_CHAR_HENNA)) { @@ -8426,9 +8415,10 @@ public final class L2PcInstance extends L2Playable UserInfo ui = new UserInfo(this, false); ui.addComponentType(UserInfoType.BASE_STATS, UserInfoType.MAX_HPCPMP, UserInfoType.STATS, UserInfoType.SPEED); sendPacket(ui); + sendSkillList(); // Notify to scripts - EventDispatcher.getInstance().notifyEventAsync(new OnPlayerHennaRemove(this, henna), this); + EventDispatcher.getInstance().notifyEventAsync(new OnPlayerHennaAdd(this, henna), this); return true; } } @@ -8889,7 +8879,7 @@ public final class L2PcInstance extends L2Playable switch (sklTargetType) { - // Target the player if skill type is AURA, PARTY, CLAN or SELF + // Target the player if skill type is AURA, PARTY, CLAN or SELF case AURA: case FRONT_AURA: case BEHIND_AURA: @@ -9633,7 +9623,7 @@ public final class L2PcInstance extends L2Playable } if ((magic && (item.getItem().getDefaultAction() == ActionType.SPIRITSHOT)) // - || (physical && (item.getItem().getDefaultAction() == ActionType.SOULSHOT))) + || (physical && (item.getItem().getDefaultAction() == ActionType.SOULSHOT))) { handler.useItem(this, item, false); } diff --git a/trunk/java/com/l2jserver/gameserver/model/items/L2Henna.java b/trunk/java/com/l2jserver/gameserver/model/items/L2Henna.java index a78b705cd4..6289f8e1ae 100644 --- a/trunk/java/com/l2jserver/gameserver/model/items/L2Henna.java +++ b/trunk/java/com/l2jserver/gameserver/model/items/L2Henna.java @@ -23,6 +23,7 @@ import java.util.List; import com.l2jserver.gameserver.model.StatsSet; import com.l2jserver.gameserver.model.base.ClassId; +import com.l2jserver.gameserver.model.holders.SkillHolder; /** * Class for the Henna object. @@ -46,6 +47,7 @@ public class L2Henna private final int _cancel_fee; private final int _cancel_count; private final List _wear_class; + private final List _skills; public L2Henna(StatsSet set) { @@ -65,6 +67,7 @@ public class L2Henna _cancel_fee = set.getInt("cancel_fee"); _cancel_count = set.getInt("cancel_count"); _wear_class = new ArrayList<>(); + _skills = new ArrayList<>(); } /** @@ -211,4 +214,14 @@ public class L2Henna { _wear_class.addAll(wearClassIds); } + + public List getSkills() + { + return _skills; + } + + public void setSkills(List skills) + { + _skills.addAll(skills); + } } \ No newline at end of file