From 232c2d37aaddc4b0a3b2deec0fa606a6341bf5d8 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Sat, 15 Oct 2022 01:13:51 +0000 Subject: [PATCH] Pets must share their master buffs. Thanks to petryxa. --- .../scripts/handlers/effecthandlers/SummonPet.java | 12 ++++++++++++ .../org/l2jmobius/gameserver/model/skill/Skill.java | 11 +++++++++-- .../scripts/handlers/effecthandlers/SummonPet.java | 12 ++++++++++++ .../org/l2jmobius/gameserver/model/skill/Skill.java | 11 +++++++++-- .../scripts/handlers/effecthandlers/SummonPet.java | 12 ++++++++++++ .../org/l2jmobius/gameserver/model/skill/Skill.java | 11 +++++++++-- 6 files changed, 63 insertions(+), 6 deletions(-) diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java index 82d092c2f5..ea5c5c2925 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java @@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.holders.PetEvolveHolder; import org.l2jmobius.gameserver.model.holders.PetItemHolder; import org.l2jmobius.gameserver.model.item.instance.Item; +import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -97,6 +98,17 @@ public class SummonPet extends AbstractEffect final Pet pet = Pet.spawnPet(npcTemplate, player, collar); player.setPet(pet); pet.setShowSummonAnimation(true); + + // Pets must have their master buffs upon spawn. + for (BuffInfo effect : player.getEffectList().getEffects()) + { + final Skill sk = effect.getSkill(); + if (!sk.isBad() && !sk.isTransformation() && skill.isSharedWithSummon()) + { + sk.applyEffects(player, pet, false, effect.getTime()); + } + } + if (!pet.isRespawned()) { pet.setCurrentHp(pet.getMaxHp()); diff --git a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skill/Skill.java b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skill/Skill.java index 6b8df43fc5..a5359a4f5e 100644 --- a/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skill/Skill.java +++ b/L2J_Mobius_Essence_4.2_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/skill/Skill.java @@ -1345,9 +1345,16 @@ public class Skill implements IIdentifiable } // Support for buff sharing feature including healing herbs. - if (_isSharedWithSummon && effected.isPlayer() && effected.hasServitors() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb)) + if (_isSharedWithSummon && effected.isPlayer() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb)) { - effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0)); + if (effected.hasServitors()) + { + effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0)); + } + if (effected.hasPet()) + { + applyEffects(effector, effector.getPet(), _isRecoveryHerb, 0); + } } } diff --git a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java index 82d092c2f5..ea5c5c2925 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java @@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.holders.PetEvolveHolder; import org.l2jmobius.gameserver.model.holders.PetItemHolder; import org.l2jmobius.gameserver.model.item.instance.Item; +import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -97,6 +98,17 @@ public class SummonPet extends AbstractEffect final Pet pet = Pet.spawnPet(npcTemplate, player, collar); player.setPet(pet); pet.setShowSummonAnimation(true); + + // Pets must have their master buffs upon spawn. + for (BuffInfo effect : player.getEffectList().getEffects()) + { + final Skill sk = effect.getSkill(); + if (!sk.isBad() && !sk.isTransformation() && skill.isSharedWithSummon()) + { + sk.applyEffects(player, pet, false, effect.getTime()); + } + } + if (!pet.isRespawned()) { pet.setCurrentHp(pet.getMaxHp()); diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/skill/Skill.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/skill/Skill.java index 6b8df43fc5..a5359a4f5e 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/skill/Skill.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/skill/Skill.java @@ -1345,9 +1345,16 @@ public class Skill implements IIdentifiable } // Support for buff sharing feature including healing herbs. - if (_isSharedWithSummon && effected.isPlayer() && effected.hasServitors() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb)) + if (_isSharedWithSummon && effected.isPlayer() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb)) { - effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0)); + if (effected.hasServitors()) + { + effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0)); + } + if (effected.hasPet()) + { + applyEffects(effector, effector.getPet(), _isRecoveryHerb, 0); + } } } diff --git a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java index 82d092c2f5..ea5c5c2925 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/dist/game/data/scripts/handlers/effecthandlers/SummonPet.java @@ -32,6 +32,7 @@ import org.l2jmobius.gameserver.model.effects.EffectType; import org.l2jmobius.gameserver.model.holders.PetEvolveHolder; import org.l2jmobius.gameserver.model.holders.PetItemHolder; import org.l2jmobius.gameserver.model.item.instance.Item; +import org.l2jmobius.gameserver.model.skill.BuffInfo; import org.l2jmobius.gameserver.model.skill.Skill; import org.l2jmobius.gameserver.network.SystemMessageId; @@ -97,6 +98,17 @@ public class SummonPet extends AbstractEffect final Pet pet = Pet.spawnPet(npcTemplate, player, collar); player.setPet(pet); pet.setShowSummonAnimation(true); + + // Pets must have their master buffs upon spawn. + for (BuffInfo effect : player.getEffectList().getEffects()) + { + final Skill sk = effect.getSkill(); + if (!sk.isBad() && !sk.isTransformation() && skill.isSharedWithSummon()) + { + sk.applyEffects(player, pet, false, effect.getTime()); + } + } + if (!pet.isRespawned()) { pet.setCurrentHp(pet.getMaxHp()); diff --git a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/Skill.java b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/Skill.java index 6b8df43fc5..a5359a4f5e 100644 --- a/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/Skill.java +++ b/L2J_Mobius_Essence_6.2_Vanguard/java/org/l2jmobius/gameserver/model/skill/Skill.java @@ -1345,9 +1345,16 @@ public class Skill implements IIdentifiable } // Support for buff sharing feature including healing herbs. - if (_isSharedWithSummon && effected.isPlayer() && effected.hasServitors() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb)) + if (_isSharedWithSummon && effected.isPlayer() && !isTransformation() && ((addContinuousEffects && isContinuous() && !_isDebuff) || _isRecoveryHerb)) { - effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0)); + if (effected.hasServitors()) + { + effected.getServitors().values().forEach(s -> applyEffects(effector, s, _isRecoveryHerb, 0)); + } + if (effected.hasPet()) + { + applyEffects(effector, effector.getPet(), _isRecoveryHerb, 0); + } } }