diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java index 610ee9e614..fdbe2a8762 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -162,7 +162,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new); EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new); EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new); - EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new); EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new); EffectHandler.getInstance().registerHandler("Grow", Grow::new); EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new); diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java index 660f187dc9..dff027d7f7 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/MasterHandler.java @@ -184,6 +184,7 @@ import handlers.communityboard.HomepageBoard; import handlers.communityboard.MailBoard; import handlers.communityboard.MemoBoard; import handlers.communityboard.RegionBoard; +import handlers.itemhandlers.AddSpiritExp; import handlers.itemhandlers.Appearance; import handlers.itemhandlers.BeastSoulShot; import handlers.itemhandlers.BeastSpiritShot; @@ -531,6 +532,7 @@ public class MasterHandler }, { // Item Handlers + AddSpiritExp.class, Appearance.class, BeastSoulShot.class, BeastSpiritShot.class, diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java deleted file mode 100644 index 5ab943b1f0..0000000000 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.enums.ElementalType; -import org.l2jmobius.gameserver.model.ElementalSpirit; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; -import org.l2jmobius.gameserver.model.skills.Skill; - -/** - * @author Mobius - */ -public class GiveSpiritExp extends AbstractEffect -{ - private final ElementalType _type; - private final int _amount; - - public GiveSpiritExp(StatSet params) - { - _type = params.getEnum("type", ElementalType.class, ElementalType.NONE); - _amount = params.getInt("amount"); - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - if (effected == null) - { - return; - } - - final PlayerInstance player = effected.getActingPlayer(); - if (player == null) - { - return; - } - - final ElementalSpirit spirit = player.getElementalSpirit(_type); - if (spirit != null) - { - spirit.addExperience(_amount); - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java new file mode 100644 index 0000000000..a90af4ed16 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java @@ -0,0 +1,95 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.itemhandlers; + +import org.l2jmobius.gameserver.enums.ElementalType; +import org.l2jmobius.gameserver.handler.IItemHandler; +import org.l2jmobius.gameserver.model.ElementalSpirit; +import org.l2jmobius.gameserver.model.actor.Playable; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.SystemMessageId; + +/** + * @author Mobius + */ +public class AddSpiritExp implements IItemHandler +{ + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); + + ElementalSpirit spirit = null; + switch (item.getId()) + { + case 91999: + case 91035: + { + spirit = player.getElementalSpirit(ElementalType.WATER); + break; + } + case 92000: + case 91036: + { + spirit = player.getElementalSpirit(ElementalType.FIRE); + break; + } + case 92001: + case 91037: + { + spirit = player.getElementalSpirit(ElementalType.WIND); + break; + } + case 92002: + case 91038: + { + spirit = player.getElementalSpirit(ElementalType.EARTH); + break; + } + } + + if ((spirit != null) && checkConditions(player, spirit)) + { + player.destroyItem("AddSpiritExp item", item, 1, player, true); + spirit.addExperience(9300); + return true; + } + + return false; + } + + private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit) + { + if (player.isInBattle()) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE); + return false; + } + if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel())) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/items/91000-91099.xml b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/items/91000-91099.xml index aa90223751..b669b7bcf9 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/items/91000-91099.xml +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/items/91000-91099.xml @@ -319,26 +319,38 @@ + + + + + + + + + + + + diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt index e93ce6a3da..29e13a15f8 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/stats/skills/documentation.txt @@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius) GiveFame: Gives a given amount of Fame. (l2jmobius) GiveRecommendation: Gives recommendations to a player. Blue name. GiveSp: Gives a given amount of SP. -GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius) GiveXp: Gives a given amount of XP. (l2jmobius) Grow: Sets NPC collision to its growth collision. HairAccessorySet: See/Unsee hair accessory. diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/ElementalSpirit.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/ElementalSpirit.java index c7ff2e4d7a..6618f7d350 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/ElementalSpirit.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/ElementalSpirit.java @@ -76,7 +76,6 @@ public class ElementalSpirit final UserInfo userInfo = new UserInfo(_owner); userInfo.addComponentType(UserInfoType.ATT_SPIRITS); _owner.sendPacket(userInfo); - } _owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience())); } diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java index 610ee9e614..fdbe2a8762 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -162,7 +162,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new); EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new); EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new); - EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new); EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new); EffectHandler.getInstance().registerHandler("Grow", Grow::new); EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new); diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java index 1a8f5a9463..47d4aa8e81 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/MasterHandler.java @@ -185,6 +185,7 @@ import handlers.communityboard.HomepageBoard; import handlers.communityboard.MailBoard; import handlers.communityboard.MemoBoard; import handlers.communityboard.RegionBoard; +import handlers.itemhandlers.AddSpiritExp; import handlers.itemhandlers.Appearance; import handlers.itemhandlers.BeastSoulShot; import handlers.itemhandlers.BeastSpiritShot; @@ -533,6 +534,7 @@ public class MasterHandler }, { // Item Handlers + AddSpiritExp.class, Appearance.class, BeastSoulShot.class, BeastSpiritShot.class, diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java deleted file mode 100644 index 5ab943b1f0..0000000000 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.enums.ElementalType; -import org.l2jmobius.gameserver.model.ElementalSpirit; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; -import org.l2jmobius.gameserver.model.skills.Skill; - -/** - * @author Mobius - */ -public class GiveSpiritExp extends AbstractEffect -{ - private final ElementalType _type; - private final int _amount; - - public GiveSpiritExp(StatSet params) - { - _type = params.getEnum("type", ElementalType.class, ElementalType.NONE); - _amount = params.getInt("amount"); - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - if (effected == null) - { - return; - } - - final PlayerInstance player = effected.getActingPlayer(); - if (player == null) - { - return; - } - - final ElementalSpirit spirit = player.getElementalSpirit(_type); - if (spirit != null) - { - spirit.addExperience(_amount); - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java new file mode 100644 index 0000000000..a90af4ed16 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java @@ -0,0 +1,95 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.itemhandlers; + +import org.l2jmobius.gameserver.enums.ElementalType; +import org.l2jmobius.gameserver.handler.IItemHandler; +import org.l2jmobius.gameserver.model.ElementalSpirit; +import org.l2jmobius.gameserver.model.actor.Playable; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.SystemMessageId; + +/** + * @author Mobius + */ +public class AddSpiritExp implements IItemHandler +{ + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); + + ElementalSpirit spirit = null; + switch (item.getId()) + { + case 91999: + case 91035: + { + spirit = player.getElementalSpirit(ElementalType.WATER); + break; + } + case 92000: + case 91036: + { + spirit = player.getElementalSpirit(ElementalType.FIRE); + break; + } + case 92001: + case 91037: + { + spirit = player.getElementalSpirit(ElementalType.WIND); + break; + } + case 92002: + case 91038: + { + spirit = player.getElementalSpirit(ElementalType.EARTH); + break; + } + } + + if ((spirit != null) && checkConditions(player, spirit)) + { + player.destroyItem("AddSpiritExp item", item, 1, player, true); + spirit.addExperience(9300); + return true; + } + + return false; + } + + private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit) + { + if (player.isInBattle()) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE); + return false; + } + if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel())) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/items/91000-91099.xml b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/items/91000-91099.xml index aa90223751..b669b7bcf9 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/items/91000-91099.xml +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/items/91000-91099.xml @@ -319,26 +319,38 @@ + + + + + + + + + + + + diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt index e93ce6a3da..29e13a15f8 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/stats/skills/documentation.txt @@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius) GiveFame: Gives a given amount of Fame. (l2jmobius) GiveRecommendation: Gives recommendations to a player. Blue name. GiveSp: Gives a given amount of SP. -GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius) GiveXp: Gives a given amount of XP. (l2jmobius) Grow: Sets NPC collision to its growth collision. HairAccessorySet: See/Unsee hair accessory. diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ElementalSpirit.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ElementalSpirit.java index c7ff2e4d7a..6618f7d350 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ElementalSpirit.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/ElementalSpirit.java @@ -76,7 +76,6 @@ public class ElementalSpirit final UserInfo userInfo = new UserInfo(_owner); userInfo.addComponentType(UserInfoType.ATT_SPIRITS); _owner.sendPacket(userInfo); - } _owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience())); } diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java index 152706f735..c259f5eb2b 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -162,7 +162,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new); EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new); EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new); - EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new); EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new); EffectHandler.getInstance().registerHandler("Grow", Grow::new); EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new); diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java index 1a8f5a9463..47d4aa8e81 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/MasterHandler.java @@ -185,6 +185,7 @@ import handlers.communityboard.HomepageBoard; import handlers.communityboard.MailBoard; import handlers.communityboard.MemoBoard; import handlers.communityboard.RegionBoard; +import handlers.itemhandlers.AddSpiritExp; import handlers.itemhandlers.Appearance; import handlers.itemhandlers.BeastSoulShot; import handlers.itemhandlers.BeastSpiritShot; @@ -533,6 +534,7 @@ public class MasterHandler }, { // Item Handlers + AddSpiritExp.class, Appearance.class, BeastSoulShot.class, BeastSpiritShot.class, diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java deleted file mode 100644 index 5ab943b1f0..0000000000 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.enums.ElementalType; -import org.l2jmobius.gameserver.model.ElementalSpirit; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; -import org.l2jmobius.gameserver.model.skills.Skill; - -/** - * @author Mobius - */ -public class GiveSpiritExp extends AbstractEffect -{ - private final ElementalType _type; - private final int _amount; - - public GiveSpiritExp(StatSet params) - { - _type = params.getEnum("type", ElementalType.class, ElementalType.NONE); - _amount = params.getInt("amount"); - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - if (effected == null) - { - return; - } - - final PlayerInstance player = effected.getActingPlayer(); - if (player == null) - { - return; - } - - final ElementalSpirit spirit = player.getElementalSpirit(_type); - if (spirit != null) - { - spirit.addExperience(_amount); - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java new file mode 100644 index 0000000000..a90af4ed16 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java @@ -0,0 +1,95 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.itemhandlers; + +import org.l2jmobius.gameserver.enums.ElementalType; +import org.l2jmobius.gameserver.handler.IItemHandler; +import org.l2jmobius.gameserver.model.ElementalSpirit; +import org.l2jmobius.gameserver.model.actor.Playable; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.SystemMessageId; + +/** + * @author Mobius + */ +public class AddSpiritExp implements IItemHandler +{ + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); + + ElementalSpirit spirit = null; + switch (item.getId()) + { + case 91999: + case 91035: + { + spirit = player.getElementalSpirit(ElementalType.WATER); + break; + } + case 92000: + case 91036: + { + spirit = player.getElementalSpirit(ElementalType.FIRE); + break; + } + case 92001: + case 91037: + { + spirit = player.getElementalSpirit(ElementalType.WIND); + break; + } + case 92002: + case 91038: + { + spirit = player.getElementalSpirit(ElementalType.EARTH); + break; + } + } + + if ((spirit != null) && checkConditions(player, spirit)) + { + player.destroyItem("AddSpiritExp item", item, 1, player, true); + spirit.addExperience(9300); + return true; + } + + return false; + } + + private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit) + { + if (player.isInBattle()) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE); + return false; + } + if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel())) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91000-91099.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91000-91099.xml index 05747012e1..ab568af9f8 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91000-91099.xml +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91000-91099.xml @@ -319,26 +319,38 @@ + + + + + + + + + + + + diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml index 54c54eb66e..deb9d3d971 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/91900-91999.xml @@ -1323,10 +1323,13 @@ + + + diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/92000-92099.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/92000-92099.xml index 91bd8e8358..f250ec2f07 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/92000-92099.xml +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/items/92000-92099.xml @@ -3,29 +3,38 @@ + + + + + + + + + diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt index 458e2bf4e3..f8884db193 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/stats/skills/documentation.txt @@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius) GiveFame: Gives a given amount of Fame. (l2jmobius) GiveRecommendation: Gives recommendations to a player. Blue name. GiveSp: Gives a given amount of SP. -GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius) GiveXp: Gives a given amount of XP. (l2jmobius) Grow: Sets NPC collision to its growth collision. HairAccessorySet: See/Unsee hair accessory. diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ElementalSpirit.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ElementalSpirit.java index c7ff2e4d7a..6618f7d350 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ElementalSpirit.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/ElementalSpirit.java @@ -76,7 +76,6 @@ public class ElementalSpirit final UserInfo userInfo = new UserInfo(_owner); userInfo.addComponentType(UserInfoType.ATT_SPIRITS); _owner.sendPacket(userInfo); - } _owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience())); } diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java index 12f9142f76..0a9d59c545 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/EffectMasterHandler.java @@ -162,7 +162,6 @@ public class EffectMasterHandler EffectHandler.getInstance().registerHandler("GiveFame", GiveFame::new); EffectHandler.getInstance().registerHandler("GiveRecommendation", GiveRecommendation::new); EffectHandler.getInstance().registerHandler("GiveSp", GiveSp::new); - EffectHandler.getInstance().registerHandler("GiveSpiritExp", GiveSpiritExp::new); EffectHandler.getInstance().registerHandler("GiveXp", GiveXp::new); EffectHandler.getInstance().registerHandler("Grow", Grow::new); EffectHandler.getInstance().registerHandler("HairAccessorySet", HairAccessorySet::new); diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java index 4529b05dc1..32d94019d0 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/MasterHandler.java @@ -185,6 +185,7 @@ import handlers.communityboard.HomepageBoard; import handlers.communityboard.MailBoard; import handlers.communityboard.MemoBoard; import handlers.communityboard.RegionBoard; +import handlers.itemhandlers.AddSpiritExp; import handlers.itemhandlers.Appearance; import handlers.itemhandlers.BeastSoulShot; import handlers.itemhandlers.BeastSpiritShot; @@ -534,6 +535,7 @@ public class MasterHandler }, { // Item Handlers + AddSpiritExp.class, Appearance.class, BeastSoulShot.class, BeastSpiritShot.class, diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java deleted file mode 100644 index 5ab943b1f0..0000000000 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/GiveSpiritExp.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * This file is part of the L2J Mobius project. - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package handlers.effecthandlers; - -import org.l2jmobius.gameserver.enums.ElementalType; -import org.l2jmobius.gameserver.model.ElementalSpirit; -import org.l2jmobius.gameserver.model.StatSet; -import org.l2jmobius.gameserver.model.actor.Creature; -import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; -import org.l2jmobius.gameserver.model.effects.AbstractEffect; -import org.l2jmobius.gameserver.model.items.instance.ItemInstance; -import org.l2jmobius.gameserver.model.skills.Skill; - -/** - * @author Mobius - */ -public class GiveSpiritExp extends AbstractEffect -{ - private final ElementalType _type; - private final int _amount; - - public GiveSpiritExp(StatSet params) - { - _type = params.getEnum("type", ElementalType.class, ElementalType.NONE); - _amount = params.getInt("amount"); - } - - @Override - public boolean isInstant() - { - return true; - } - - @Override - public void instant(Creature effector, Creature effected, Skill skill, ItemInstance item) - { - if (effected == null) - { - return; - } - - final PlayerInstance player = effected.getActingPlayer(); - if (player == null) - { - return; - } - - final ElementalSpirit spirit = player.getElementalSpirit(_type); - if (spirit != null) - { - spirit.addExperience(_amount); - } - } -} \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java new file mode 100644 index 0000000000..a90af4ed16 --- /dev/null +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/scripts/handlers/itemhandlers/AddSpiritExp.java @@ -0,0 +1,95 @@ +/* + * This file is part of the L2J Mobius project. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package handlers.itemhandlers; + +import org.l2jmobius.gameserver.enums.ElementalType; +import org.l2jmobius.gameserver.handler.IItemHandler; +import org.l2jmobius.gameserver.model.ElementalSpirit; +import org.l2jmobius.gameserver.model.actor.Playable; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.items.instance.ItemInstance; +import org.l2jmobius.gameserver.network.SystemMessageId; + +/** + * @author Mobius + */ +public class AddSpiritExp implements IItemHandler +{ + @Override + public boolean useItem(Playable playable, ItemInstance item, boolean forceUse) + { + if (!playable.isPlayer()) + { + playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM); + return false; + } + final PlayerInstance player = playable.getActingPlayer(); + + ElementalSpirit spirit = null; + switch (item.getId()) + { + case 91999: + case 91035: + { + spirit = player.getElementalSpirit(ElementalType.WATER); + break; + } + case 92000: + case 91036: + { + spirit = player.getElementalSpirit(ElementalType.FIRE); + break; + } + case 92001: + case 91037: + { + spirit = player.getElementalSpirit(ElementalType.WIND); + break; + } + case 92002: + case 91038: + { + spirit = player.getElementalSpirit(ElementalType.EARTH); + break; + } + } + + if ((spirit != null) && checkConditions(player, spirit)) + { + player.destroyItem("AddSpiritExp item", item, 1, player, true); + spirit.addExperience(9300); + return true; + } + + return false; + } + + private boolean checkConditions(PlayerInstance player, ElementalSpirit spirit) + { + if (player.isInBattle()) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_DURING_BATTLE); + return false; + } + if ((spirit.getLevel() == spirit.getMaxLevel()) && (spirit.getExperience() == spirit.getExperienceToNextLevel())) + { + player.sendPacket(SystemMessageId.UNABLE_TO_ABSORB_BECAUSE_REACHED_MAXIMUM_LEVEL); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91000-91099.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91000-91099.xml index f6f0d02e92..09ab0f7abd 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91000-91099.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/91000-91099.xml @@ -319,26 +319,38 @@ + + + + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92000-92099.xml b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92000-92099.xml index 55e6286740..a387bf5955 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92000-92099.xml +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/items/92000-92099.xml @@ -3,29 +3,38 @@ + + + + + + + + + diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt index a8b5268dc1..58d6c9593a 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/dist/game/data/stats/skills/documentation.txt @@ -133,7 +133,6 @@ GiveExpAndSp: Gives a given amount of XP and SP. (l2jmobius) GiveFame: Gives a given amount of Fame. (l2jmobius) GiveRecommendation: Gives recommendations to a player. Blue name. GiveSp: Gives a given amount of SP. -GiveSpiritExp: Adds set amount of experience to spirit. (l2jmobius) GiveXp: Gives a given amount of XP. (l2jmobius) Grow: Sets NPC collision to its growth collision. HairAccessorySet: See/Unsee hair accessory. diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ElementalSpirit.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ElementalSpirit.java index 7f807267ae..25dcc21dbb 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ElementalSpirit.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/ElementalSpirit.java @@ -76,7 +76,6 @@ public class ElementalSpirit final UserInfo userInfo = new UserInfo(_owner); userInfo.addComponentType(UserInfoType.ATT_SPIRITS); _owner.sendPacket(userInfo); - } _owner.sendPacket(new ExElementalSpiritGetExp(getType(), _data.getExperience())); } @@ -101,7 +100,7 @@ public class ElementalSpirit { final int stage = _data.getStage(); final int level = _data.getLevel(); - final int points = (stage > 3 ? ((stage - 2) * 20) : (stage - 1 ) * 10) + (stage > 2 ? (level * 2) : level * 1); + final int points = (stage > 3 ? ((stage - 2) * 20) : (stage - 1) * 10) + (stage > 2 ? (level * 2) : level * 1); return max(points - _data.getAttackPoints() - _data.getDefensePoints() - _data.getCritDamagePoints() - _data.getCritRatePoints(), 0); }