From 29076e5871264e7f04845afd7d77f07a5a136621 Mon Sep 17 00:00:00 2001 From: MobiusDev <8391001+MobiusDevelopment@users.noreply.github.com> Date: Wed, 11 Oct 2017 14:00:39 +0000 Subject: [PATCH] Clan Flag. Thanks gamelike85, gigilo1968. --- .../scripts/ai/others/Servitors/ClanFlag.java | 103 ++++++++++++++++++ .../dist/game/data/stats/npcs/19200-19299.xml | 16 +-- .../game/data/stats/skills/15000-15099.xml | 27 +++-- .../gameserver/model/skills/Skill.java | 11 ++ .../gameserver/model/skills/SkillCaster.java | 33 ++++++ .../scripts/ai/others/Servitors/ClanFlag.java | 103 ++++++++++++++++++ .../dist/game/data/stats/npcs/19200-19299.xml | 16 +-- .../game/data/stats/skills/15000-15099.xml | 27 +++-- .../gameserver/model/skills/Skill.java | 11 ++ .../gameserver/model/skills/SkillCaster.java | 33 ++++++ .../scripts/ai/others/Servitors/ClanFlag.java | 103 ++++++++++++++++++ .../dist/game/data/stats/npcs/19200-19299.xml | 16 +-- .../game/data/stats/skills/15000-15099.xml | 27 +++-- .../gameserver/model/skills/Skill.java | 11 ++ .../gameserver/model/skills/SkillCaster.java | 33 ++++++ .../gameserver/model/skills/Skill.java | 11 ++ .../gameserver/model/skills/SkillCaster.java | 33 ++++++ 17 files changed, 542 insertions(+), 72 deletions(-) create mode 100644 L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java create mode 100644 L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java create mode 100644 L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java new file mode 100644 index 0000000000..4a3da31ada --- /dev/null +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java @@ -0,0 +1,103 @@ +/* + * 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 ai.others.Servitors; + +import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.L2Clan; +import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; + +import ai.AbstractNpcAI; + +/** + * @author Mobius + */ +public class ClanFlag extends AbstractNpcAI +{ + // NPC + private static final int CLAN_FLAG = 19269; + // Skills + private static final SkillHolder BUFF = new SkillHolder(15095, 1); + private static final SkillHolder DEBUFF = new SkillHolder(15096, 1); + + private ClanFlag() + { + addSpawnId(CLAN_FLAG); + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("END_OF_LIFE", 1800000, npc, null); + getTimers().addTimer("SKILL_CAST", 1000, npc, null); + return super.onSpawn(npc); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "SKILL_CAST": + { + if (npc.getSummoner() != null) + { + final L2Clan summonerClan = npc.getSummoner().getClan(); + if (summonerClan != null) + { + L2World.getInstance().forEachVisibleObjectInRange(npc, L2PcInstance.class, 2000, target -> + { + if ((target != null) && !target.isDead() && GeoEngine.getInstance().canSeeTarget(npc, target)) + { + final L2Clan targetClan = target.getClan(); + if (targetClan != null) + { + if (targetClan == summonerClan) + { + BUFF.getSkill().applyEffects(npc, target); + } + else if (targetClan.isAtWarWith(summonerClan)) + { + DEBUFF.getSkill().applyEffects(npc, target); + } + } + } + }); + getTimers().addTimer("SKILL_CAST", 3000, npc, null); + return; + } + } + getTimers().addTimer("END_OF_LIFE", 100, npc, null); + break; + } + case "END_OF_LIFE": + { + getTimers().cancelTimer("SKILL_CAST", npc, null); + npc.deleteMe(); + break; + } + } + } + + public static void main(String[] args) + { + new ClanFlag(); + } +} diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml index f5fe1ba983..12e86c9f99 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/npcs/19200-19299.xml @@ -2662,11 +2662,9 @@ - - + CONSTRUCT ETC - @@ -2678,17 +2676,9 @@ - - - - - - - - - - + + diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/15000-15099.xml b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/15000-15099.xml index f5649177ef..9cb0c72102 100644 --- a/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/15000-15099.xml +++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/stats/skills/15000-15099.xml @@ -2985,7 +2985,6 @@ SINGLE - icon.etc_alliance_flag_i00 A1 @@ -2999,28 +2998,36 @@ 1800000 SELF SINGLE + 100 8 + + + 19269 + + BranchSys2.icon.skill20006 - A2 - 1500 + A5 + false FLAG_BUF + REAL_TARGET NONE NONE -5 - 99 + 0 + 90 1 - 40 + 600 2000 - 1 + 4 SELF POINT_BLANK FRIEND_PC @@ -3048,10 +3055,9 @@ - icon.skill1167 - A2 + A5 FLAG_DEBUF NONE NONE @@ -3062,13 +3068,12 @@ 100 99 1 - 40 + 5 POISON 2000 true SELF - POINT_BLANK - NOT_FRIEND_PC + SINGLE diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/Skill.java index e4882978d7..66f8e4461c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -99,6 +99,8 @@ public final class Skill implements IIdentifiable private final int _itemConsumeCount; /** Id of item consumed by this skill from caster. */ private final int _itemConsumeId; + /** Clan points consumed by this skill from caster's clan */ + private final int _clanRepConsume; /** Cast range: how far can be the target. */ private final int _castRange; /** Effect range: how far the skill affect the target. */ @@ -227,6 +229,7 @@ public final class Skill implements IIdentifiable _hpConsume = set.getInt("hpConsume", 0); _itemConsumeCount = set.getInt("itemConsumeCount", 0); _itemConsumeId = set.getInt("itemConsumeId", 0); + _clanRepConsume = set.getInt("clanRepConsume", 0); _castRange = set.getInt("castRange", -1); _effectRange = set.getInt("effectRange", -1); @@ -724,6 +727,14 @@ public final class Skill implements IIdentifiable return _itemConsumeId; } + /** + * @return Clan points consumed by this skill from caster's clan + */ + public int getClanRepConsume() + { + return _clanRepConsume; + } + /** * @return Returns the level. */ diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 466dacc40c..0dc48d41ab 100644 --- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.enums.ItemSkillType; import com.l2jmobius.gameserver.enums.NextActionType; import com.l2jmobius.gameserver.enums.StatusUpdateType; import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; @@ -339,6 +340,27 @@ public class SkillCaster implements Runnable } } + if (caster.isPlayer()) + { + final L2PcInstance player = caster.getActingPlayer(); + final L2Clan clan = player.getClan(); + + // Consume clan reputation points + if (_skill.getClanRepConsume() > 0) + { + if ((clan == null) || (clan.getReputationScore() < _skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + clan.takeReputationScore(_skill.getClanRepConsume(), true); + + final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CLAN_REPUTATION_HAS_BEEN_CONSUMED); + msg.addInt(_skill.getClanRepConsume()); + player.sendPacket(msg); + } + } + // Trigger any skill cast start effects. if (target.isCharacter()) { @@ -959,6 +981,17 @@ public class SkillCaster implements Runnable return false; } + // Consume clan reputation points + if (skill.getClanRepConsume() > 0) + { + final L2Clan clan = player.getClan(); + if ((clan == null) || (clan.getReputationScore() < skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + } + // Check for skill reuse (fixes macro right click press exploit). if (caster.hasSkillReuse(skill.getReuseHashCode())) { diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java new file mode 100644 index 0000000000..4a3da31ada --- /dev/null +++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java @@ -0,0 +1,103 @@ +/* + * 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 ai.others.Servitors; + +import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.L2Clan; +import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; + +import ai.AbstractNpcAI; + +/** + * @author Mobius + */ +public class ClanFlag extends AbstractNpcAI +{ + // NPC + private static final int CLAN_FLAG = 19269; + // Skills + private static final SkillHolder BUFF = new SkillHolder(15095, 1); + private static final SkillHolder DEBUFF = new SkillHolder(15096, 1); + + private ClanFlag() + { + addSpawnId(CLAN_FLAG); + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("END_OF_LIFE", 1800000, npc, null); + getTimers().addTimer("SKILL_CAST", 1000, npc, null); + return super.onSpawn(npc); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "SKILL_CAST": + { + if (npc.getSummoner() != null) + { + final L2Clan summonerClan = npc.getSummoner().getClan(); + if (summonerClan != null) + { + L2World.getInstance().forEachVisibleObjectInRange(npc, L2PcInstance.class, 2000, target -> + { + if ((target != null) && !target.isDead() && GeoEngine.getInstance().canSeeTarget(npc, target)) + { + final L2Clan targetClan = target.getClan(); + if (targetClan != null) + { + if (targetClan == summonerClan) + { + BUFF.getSkill().applyEffects(npc, target); + } + else if (targetClan.isAtWarWith(summonerClan)) + { + DEBUFF.getSkill().applyEffects(npc, target); + } + } + } + }); + getTimers().addTimer("SKILL_CAST", 3000, npc, null); + return; + } + } + getTimers().addTimer("END_OF_LIFE", 100, npc, null); + break; + } + case "END_OF_LIFE": + { + getTimers().cancelTimer("SKILL_CAST", npc, null); + npc.deleteMe(); + break; + } + } + } + + public static void main(String[] args) + { + new ClanFlag(); + } +} diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml index f5fe1ba983..12e86c9f99 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/npcs/19200-19299.xml @@ -2662,11 +2662,9 @@ - - + CONSTRUCT ETC - @@ -2678,17 +2676,9 @@ - - - - - - - - - - + + diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/15000-15099.xml b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/15000-15099.xml index f712a33eac..ff3ec6bad7 100644 --- a/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/15000-15099.xml +++ b/L2J_Mobius_2.5_Underground/dist/game/data/stats/skills/15000-15099.xml @@ -2985,7 +2985,6 @@ SINGLE - icon.etc_alliance_flag_i00 A1 @@ -2999,28 +2998,36 @@ 1800000 SELF SINGLE + 100 8 + + + 19269 + + BranchSys2.icon.skill20006 - A2 - 1500 + A5 + false FLAG_BUF + REAL_TARGET NONE NONE -5 - 99 + 0 + 90 1 - 40 + 600 2000 - 1 + 4 SELF POINT_BLANK FRIEND_PC @@ -3048,10 +3055,9 @@ - icon.skill1167 - A2 + A5 FLAG_DEBUF NONE NONE @@ -3062,13 +3068,12 @@ 100 99 1 - 40 + 5 POISON 2000 true SELF - POINT_BLANK - NOT_FRIEND_PC + SINGLE diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java index 8ab3e84e85..c1894f4a4e 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -99,6 +99,8 @@ public final class Skill implements IIdentifiable private final int _itemConsumeCount; /** Id of item consumed by this skill from caster. */ private final int _itemConsumeId; + /** Clan points consumed by this skill from caster's clan */ + private final int _clanRepConsume; /** Cast range: how far can be the target. */ private final int _castRange; /** Effect range: how far the skill affect the target. */ @@ -227,6 +229,7 @@ public final class Skill implements IIdentifiable _hpConsume = set.getInt("hpConsume", 0); _itemConsumeCount = set.getInt("itemConsumeCount", 0); _itemConsumeId = set.getInt("itemConsumeId", 0); + _clanRepConsume = set.getInt("clanRepConsume", 0); _castRange = set.getInt("castRange", -1); _effectRange = set.getInt("effectRange", -1); @@ -724,6 +727,14 @@ public final class Skill implements IIdentifiable return _itemConsumeId; } + /** + * @return Clan points consumed by this skill from caster's clan + */ + public int getClanRepConsume() + { + return _clanRepConsume; + } + /** * @return Returns the level. */ diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 466dacc40c..0dc48d41ab 100644 --- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.enums.ItemSkillType; import com.l2jmobius.gameserver.enums.NextActionType; import com.l2jmobius.gameserver.enums.StatusUpdateType; import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; @@ -339,6 +340,27 @@ public class SkillCaster implements Runnable } } + if (caster.isPlayer()) + { + final L2PcInstance player = caster.getActingPlayer(); + final L2Clan clan = player.getClan(); + + // Consume clan reputation points + if (_skill.getClanRepConsume() > 0) + { + if ((clan == null) || (clan.getReputationScore() < _skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + clan.takeReputationScore(_skill.getClanRepConsume(), true); + + final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CLAN_REPUTATION_HAS_BEEN_CONSUMED); + msg.addInt(_skill.getClanRepConsume()); + player.sendPacket(msg); + } + } + // Trigger any skill cast start effects. if (target.isCharacter()) { @@ -959,6 +981,17 @@ public class SkillCaster implements Runnable return false; } + // Consume clan reputation points + if (skill.getClanRepConsume() > 0) + { + final L2Clan clan = player.getClan(); + if ((clan == null) || (clan.getReputationScore() < skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + } + // Check for skill reuse (fixes macro right click press exploit). if (caster.hasSkillReuse(skill.getReuseHashCode())) { diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java new file mode 100644 index 0000000000..4a3da31ada --- /dev/null +++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/ai/others/Servitors/ClanFlag.java @@ -0,0 +1,103 @@ +/* + * 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 ai.others.Servitors; + +import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.L2Clan; +import com.l2jmobius.gameserver.model.L2World; +import com.l2jmobius.gameserver.model.StatsSet; +import com.l2jmobius.gameserver.model.actor.L2Npc; +import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance; +import com.l2jmobius.gameserver.model.holders.SkillHolder; + +import ai.AbstractNpcAI; + +/** + * @author Mobius + */ +public class ClanFlag extends AbstractNpcAI +{ + // NPC + private static final int CLAN_FLAG = 19269; + // Skills + private static final SkillHolder BUFF = new SkillHolder(15095, 1); + private static final SkillHolder DEBUFF = new SkillHolder(15096, 1); + + private ClanFlag() + { + addSpawnId(CLAN_FLAG); + } + + @Override + public String onSpawn(L2Npc npc) + { + getTimers().addTimer("END_OF_LIFE", 1800000, npc, null); + getTimers().addTimer("SKILL_CAST", 1000, npc, null); + return super.onSpawn(npc); + } + + @Override + public void onTimerEvent(String event, StatsSet params, L2Npc npc, L2PcInstance player) + { + switch (event) + { + case "SKILL_CAST": + { + if (npc.getSummoner() != null) + { + final L2Clan summonerClan = npc.getSummoner().getClan(); + if (summonerClan != null) + { + L2World.getInstance().forEachVisibleObjectInRange(npc, L2PcInstance.class, 2000, target -> + { + if ((target != null) && !target.isDead() && GeoEngine.getInstance().canSeeTarget(npc, target)) + { + final L2Clan targetClan = target.getClan(); + if (targetClan != null) + { + if (targetClan == summonerClan) + { + BUFF.getSkill().applyEffects(npc, target); + } + else if (targetClan.isAtWarWith(summonerClan)) + { + DEBUFF.getSkill().applyEffects(npc, target); + } + } + } + }); + getTimers().addTimer("SKILL_CAST", 3000, npc, null); + return; + } + } + getTimers().addTimer("END_OF_LIFE", 100, npc, null); + break; + } + case "END_OF_LIFE": + { + getTimers().cancelTimer("SKILL_CAST", npc, null); + npc.deleteMe(); + break; + } + } + } + + public static void main(String[] args) + { + new ClanFlag(); + } +} diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml index f5fe1ba983..12e86c9f99 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/npcs/19200-19299.xml @@ -2662,11 +2662,9 @@ - - + CONSTRUCT ETC - @@ -2678,17 +2676,9 @@ - - - - - - - - - - + + diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/15000-15099.xml b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/15000-15099.xml index f712a33eac..ff3ec6bad7 100644 --- a/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/15000-15099.xml +++ b/L2J_Mobius_3.0_Helios/dist/game/data/stats/skills/15000-15099.xml @@ -2985,7 +2985,6 @@ SINGLE - icon.etc_alliance_flag_i00 A1 @@ -2999,28 +2998,36 @@ 1800000 SELF SINGLE + 100 8 + + + 19269 + + BranchSys2.icon.skill20006 - A2 - 1500 + A5 + false FLAG_BUF + REAL_TARGET NONE NONE -5 - 99 + 0 + 90 1 - 40 + 600 2000 - 1 + 4 SELF POINT_BLANK FRIEND_PC @@ -3048,10 +3055,9 @@ - icon.skill1167 - A2 + A5 FLAG_DEBUF NONE NONE @@ -3062,13 +3068,12 @@ 100 99 1 - 40 + 5 POISON 2000 true SELF - POINT_BLANK - NOT_FRIEND_PC + SINGLE diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java index 8ab3e84e85..c1894f4a4e 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -99,6 +99,8 @@ public final class Skill implements IIdentifiable private final int _itemConsumeCount; /** Id of item consumed by this skill from caster. */ private final int _itemConsumeId; + /** Clan points consumed by this skill from caster's clan */ + private final int _clanRepConsume; /** Cast range: how far can be the target. */ private final int _castRange; /** Effect range: how far the skill affect the target. */ @@ -227,6 +229,7 @@ public final class Skill implements IIdentifiable _hpConsume = set.getInt("hpConsume", 0); _itemConsumeCount = set.getInt("itemConsumeCount", 0); _itemConsumeId = set.getInt("itemConsumeId", 0); + _clanRepConsume = set.getInt("clanRepConsume", 0); _castRange = set.getInt("castRange", -1); _effectRange = set.getInt("effectRange", -1); @@ -724,6 +727,14 @@ public final class Skill implements IIdentifiable return _itemConsumeId; } + /** + * @return Clan points consumed by this skill from caster's clan + */ + public int getClanRepConsume() + { + return _clanRepConsume; + } + /** * @return Returns the level. */ diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 466dacc40c..0dc48d41ab 100644 --- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.enums.ItemSkillType; import com.l2jmobius.gameserver.enums.NextActionType; import com.l2jmobius.gameserver.enums.StatusUpdateType; import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; @@ -339,6 +340,27 @@ public class SkillCaster implements Runnable } } + if (caster.isPlayer()) + { + final L2PcInstance player = caster.getActingPlayer(); + final L2Clan clan = player.getClan(); + + // Consume clan reputation points + if (_skill.getClanRepConsume() > 0) + { + if ((clan == null) || (clan.getReputationScore() < _skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + clan.takeReputationScore(_skill.getClanRepConsume(), true); + + final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CLAN_REPUTATION_HAS_BEEN_CONSUMED); + msg.addInt(_skill.getClanRepConsume()); + player.sendPacket(msg); + } + } + // Trigger any skill cast start effects. if (target.isCharacter()) { @@ -959,6 +981,17 @@ public class SkillCaster implements Runnable return false; } + // Consume clan reputation points + if (skill.getClanRepConsume() > 0) + { + final L2Clan clan = player.getClan(); + if ((clan == null) || (clan.getReputationScore() < skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + } + // Check for skill reuse (fixes macro right click press exploit). if (caster.hasSkillReuse(skill.getReuseHashCode())) { diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java index 8ab3e84e85..c1894f4a4e 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/Skill.java @@ -99,6 +99,8 @@ public final class Skill implements IIdentifiable private final int _itemConsumeCount; /** Id of item consumed by this skill from caster. */ private final int _itemConsumeId; + /** Clan points consumed by this skill from caster's clan */ + private final int _clanRepConsume; /** Cast range: how far can be the target. */ private final int _castRange; /** Effect range: how far the skill affect the target. */ @@ -227,6 +229,7 @@ public final class Skill implements IIdentifiable _hpConsume = set.getInt("hpConsume", 0); _itemConsumeCount = set.getInt("itemConsumeCount", 0); _itemConsumeId = set.getInt("itemConsumeId", 0); + _clanRepConsume = set.getInt("clanRepConsume", 0); _castRange = set.getInt("castRange", -1); _effectRange = set.getInt("effectRange", -1); @@ -724,6 +727,14 @@ public final class Skill implements IIdentifiable return _itemConsumeId; } + /** + * @return Clan points consumed by this skill from caster's clan + */ + public int getClanRepConsume() + { + return _clanRepConsume; + } + /** * @return Returns the level. */ diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java index 466dacc40c..0dc48d41ab 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/skills/SkillCaster.java @@ -38,6 +38,7 @@ import com.l2jmobius.gameserver.enums.ItemSkillType; import com.l2jmobius.gameserver.enums.NextActionType; import com.l2jmobius.gameserver.enums.StatusUpdateType; import com.l2jmobius.gameserver.geoengine.GeoEngine; +import com.l2jmobius.gameserver.model.L2Clan; import com.l2jmobius.gameserver.model.L2Object; import com.l2jmobius.gameserver.model.L2World; import com.l2jmobius.gameserver.model.Location; @@ -339,6 +340,27 @@ public class SkillCaster implements Runnable } } + if (caster.isPlayer()) + { + final L2PcInstance player = caster.getActingPlayer(); + final L2Clan clan = player.getClan(); + + // Consume clan reputation points + if (_skill.getClanRepConsume() > 0) + { + if ((clan == null) || (clan.getReputationScore() < _skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + clan.takeReputationScore(_skill.getClanRepConsume(), true); + + final SystemMessage msg = SystemMessage.getSystemMessage(SystemMessageId.S1_CLAN_REPUTATION_HAS_BEEN_CONSUMED); + msg.addInt(_skill.getClanRepConsume()); + player.sendPacket(msg); + } + } + // Trigger any skill cast start effects. if (target.isCharacter()) { @@ -959,6 +981,17 @@ public class SkillCaster implements Runnable return false; } + // Consume clan reputation points + if (skill.getClanRepConsume() > 0) + { + final L2Clan clan = player.getClan(); + if ((clan == null) || (clan.getReputationScore() < skill.getClanRepConsume())) + { + player.sendPacket(SystemMessageId.THE_CLAN_REPUTATION_IS_TOO_LOW); + return false; + } + } + // Check for skill reuse (fixes macro right click press exploit). if (caster.hasSkillReuse(skill.getReuseHashCode())) {