From 2178de8b65bec493fa3182d397a4b6d450ed5a6b Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Tue, 20 Dec 2016 20:48:38 +0000 Subject: [PATCH] Use triggerCast instead of applyEffect when NPC is buffing player. --- .../ai/others/AdventurersGuide/AdventurersGuide.java | 7 ++++--- .../scripts/ai/others/Proclaimer/Proclaimer.java | 3 ++- .../scripts/events/HuntForSanta/HuntForSanta.java | 12 +++++------- .../Q00144_PailakaInjuredDragon.java | 3 ++- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/AdventurersGuide/AdventurersGuide.java b/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/AdventurersGuide/AdventurersGuide.java index 25c476d7cc..7a0a53fcea 100644 --- a/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/AdventurersGuide/AdventurersGuide.java +++ b/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/AdventurersGuide/AdventurersGuide.java @@ -20,6 +20,7 @@ import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.skills.Skill; +import com.l2jmobius.gameserver.model.skills.SkillCaster; import ai.AbstractNpcAI; @@ -121,13 +122,13 @@ public final class AdventurersGuide extends AbstractNpcAI for (SkillHolder holder : GROUP_BUFFS) { - holder.getSkill().applyEffects(npc, player); + SkillCaster.triggerCast(npc, player, holder.getSkill()); } - skill.applyEffects(npc, player); + SkillCaster.triggerCast(npc, player, skill); if ((player.getLevel() < 40) && (player.getClassId().level() <= 1)) { - BLESS_PROTECTION.getSkill().applyEffects(npc, player); + SkillCaster.triggerCast(npc, player, BLESS_PROTECTION.getSkill()); } return null; } diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/Proclaimer/Proclaimer.java b/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/Proclaimer/Proclaimer.java index fc4c7baa84..36600d35dc 100644 --- a/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/Proclaimer/Proclaimer.java +++ b/L2J_Mobius_Underground/dist/game/data/scripts/ai/others/Proclaimer/Proclaimer.java @@ -21,6 +21,7 @@ import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.actor.L2Npc; import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; import com.l2jmobius.gameserver.model.holders.SkillHolder; +import com.l2jmobius.gameserver.model.skills.SkillCaster; import com.l2jmobius.gameserver.network.NpcStringId; import com.l2jmobius.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jmobius.gameserver.network.serverpackets.NpcSay; @@ -90,7 +91,7 @@ public final class Proclaimer extends AbstractNpcAI { if (!player.isOnDarkSide()) { - XP_BUFF.getSkill().applyEffects(npc, player); + SkillCaster.triggerCast(npc, player, XP_BUFF.getSkill()); } else { diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java b/L2J_Mobius_Underground/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java index 0d90fec64d..1c9e0eef5c 100644 --- a/L2J_Mobius_Underground/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java +++ b/L2J_Mobius_Underground/dist/game/data/scripts/events/HuntForSanta/HuntForSanta.java @@ -22,7 +22,7 @@ import com.l2jmobius.gameserver.model.holders.SkillHolder; import com.l2jmobius.gameserver.model.quest.LongTimeEvent; import com.l2jmobius.gameserver.model.skills.BuffInfo; import com.l2jmobius.gameserver.model.skills.Skill; -import com.l2jmobius.gameserver.network.serverpackets.MagicSkillUse; +import com.l2jmobius.gameserver.model.skills.SkillCaster; import com.l2jmobius.gameserver.util.Util; /** @@ -97,8 +97,7 @@ public final class HuntForSanta extends LongTimeEvent private String applyBuff(L2Npc npc, L2PcInstance player, Skill skill) { removeBuffs(player); - npc.broadcastPacket(new MagicSkillUse(npc, player, skill.getId(), 1, 0, 0)); - skill.applyEffects(npc, player); + SkillCaster.triggerCast(npc, player, skill); return "34008-2.htm"; } @@ -111,10 +110,9 @@ public final class HuntForSanta extends LongTimeEvent if (Util.calculateDistance(npc, member, false, false) < 500) { removeBuffs(member); - npc.broadcastPacket(new MagicSkillUse(npc, member, BUFF_STOCKING.getSkillId(), 1, 0, 0)); - BUFF_STOCKING.getSkill().applyEffects(npc, member); - BUFF_TREE.getSkill().applyEffects(npc, member); - BUFF_SNOWMAN.getSkill().applyEffects(npc, member); + SkillCaster.triggerCast(npc, member, BUFF_STOCKING.getSkill()); + SkillCaster.triggerCast(npc, member, BUFF_TREE.getSkill()); + SkillCaster.triggerCast(npc, member, BUFF_SNOWMAN.getSkill()); } } return "34008-2.htm"; diff --git a/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java b/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java index 183a6d0943..568fc7c863 100644 --- a/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java +++ b/L2J_Mobius_Underground/dist/game/data/scripts/quests/Q00144_PailakaInjuredDragon/Q00144_PailakaInjuredDragon.java @@ -24,6 +24,7 @@ import com.l2jmobius.gameserver.model.instancezone.Instance; import com.l2jmobius.gameserver.model.quest.Quest; import com.l2jmobius.gameserver.model.quest.QuestState; import com.l2jmobius.gameserver.model.quest.State; +import com.l2jmobius.gameserver.model.skills.SkillCaster; /** * @author Mathael @@ -215,7 +216,7 @@ public class Q00144_PailakaInjuredDragon extends Quest if (BUFF_COUNT < 5) { final int key = Integer.parseInt(event.substring(request.length() + 1)) - 1; - BUFFS[key].getSkill().applyEffects(npc, player); + SkillCaster.triggerCast(npc, player, BUFFS[key].getSkill()); BUFF_COUNT++; if (BUFF_COUNT < 5) {