diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/html/teleporter/34049-1.htm b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/html/teleporter/34049-1.htm index 607147213e..97d8acd570 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/html/teleporter/34049-1.htm +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/html/teleporter/34049-1.htm @@ -4,5 +4,5 @@ Oh, I got you interested, right? As a child I read an old book about the King of He's just huge! His body is like a rock, and his fists are like huge boulders. What else to tell? Hmm ..... Oh, yes! In that old book it was written that the stones covering the body of the King of the Earth Spirits make it virtually invulnerable.
He is really incredibly strong and dangerous. Therefore, to meet with Peter must be prepared. You have to develop a force that will help resist earth energy. When you are ready, come along with colleagues, and I will tell you where to find this giant.
(You need a command channel of 27 or more characters.)
- + \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/instances/ResidenceOfKingPetram.xml b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/instances/ResidenceOfKingPetram.xml new file mode 100644 index 0000000000..bd2fd39fed --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/instances/ResidenceOfKingPetram.xml @@ -0,0 +1,31 @@ + + + diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java new file mode 100644 index 0000000000..10b689adf3 --- /dev/null +++ b/L2J_Mobius_Classic_2.3_SevenSigns/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java @@ -0,0 +1,184 @@ +/* + * 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 instances.ResidenceOfKingPetram; + +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance; +import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.instancezone.Instance; +import org.l2jmobius.gameserver.model.skills.Skill; + +import instances.AbstractInstance; + +/** + * @author RobikBobik + * @NOTE: Retail like working + * @TODO: Rewrite code to modern style. + * @TODO: Petram Skills and minion skills + */ +public class ResidenceOfKingPetram extends AbstractInstance +{ + // NPCs + private static final int TRITAN = 34049; + private static final int PETRAM = 29108; + private static final int PETRAM_PIECE = 29116; + private static final int PETRAM_FRAGMENT = 29117; + // Skills + private static SkillHolder EARTh_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. + private static SkillHolder EARTh_FURY = new SkillHolder(50059, 1); // When change invul state. + private static SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID. + // Misc + private static final int TEMPLATE_ID = 198; + private RaidBossInstance _petram = null; + private MonsterInstance _minion_1 = null; + private MonsterInstance _minion_2 = null; + private MonsterInstance _minion_3 = null; + private MonsterInstance _minion_4 = null; + private boolean _spawned_minions; + + public ResidenceOfKingPetram() + { + super(TEMPLATE_ID); + addStartNpc(TRITAN); + addKillId(PETRAM, PETRAM_PIECE, PETRAM_FRAGMENT); + addAttackId(PETRAM); + addSpawnId(PETRAM); + addInstanceLeaveId(TEMPLATE_ID); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + switch (event) + { + case "ENTER": + { + enterInstance(player, npc, TEMPLATE_ID); + _petram = (RaidBossInstance) addSpawn(PETRAM, 222063, 191514, -15486, 50142, false, 0, true, player.getInstanceId()); + break; + } + case "SPAWN_MINION": + { + _petram.useMagic(EARTh_ENERGY.getSkill()); + + // Prevent to double or higher spawn when HP is between 68-70% + etc... + if (!_spawned_minions) + { + _minion_1 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()); + _minion_2 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()); + _minion_3 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()); + _minion_4 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()); + _spawned_minions = true; + } + + startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); + break; + } + case "SUPPORT_PETRAM": + { + _minion_1.setTarget(_petram); + _minion_1.useMagic(TEST.getSkill()); + _minion_2.setTarget(_petram); + _minion_2.useMagic(TEST.getSkill()); + _minion_3.setTarget(_petram); + _minion_3.useMagic(TEST.getSkill()); + _minion_4.setTarget(_petram); + _minion_4.useMagic(TEST.getSkill()); + startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 + break; + } + case "INVUL_MODE": + { + _petram.useMagic(EARTh_FURY.getSkill()); + if (_petram.isInvul()) + { + _petram.setIsInvul(false); + _petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); + } + else + { + _petram.setIsInvul(true); + _petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + } + break; + } + } + return null; + } + + @Override + public String onSpawn(Npc npc) + { + return super.onSpawn(npc); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getId() == PETRAM) + { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.70)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.68))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.40)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.38))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.20)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.18))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.10)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.08))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + } + return super.onAttack(npc, attacker, damage, isSummon, skill); + } + + @Override + public String onKill(Npc npc, PlayerInstance player, boolean isSummon) + { + if (npc.getId() == PETRAM) + { + final Instance world = npc.getInstanceWorld(); + if (world != null) + { + world.finishInstance(); + } + } + else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead())) + { + startQuestTimer("INVUL_MODE", 3000, _petram, null); + _spawned_minions = false; + } + return super.onKill(npc, player, isSummon); + } + + public static void main(String[] args) + { + new ResidenceOfKingPetram(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/html/teleporter/34049-1.htm b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/html/teleporter/34049-1.htm index 607147213e..97d8acd570 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/html/teleporter/34049-1.htm +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/html/teleporter/34049-1.htm @@ -4,5 +4,5 @@ Oh, I got you interested, right? As a child I read an old book about the King of He's just huge! His body is like a rock, and his fists are like huge boulders. What else to tell? Hmm ..... Oh, yes! In that old book it was written that the stones covering the body of the King of the Earth Spirits make it virtually invulnerable.
He is really incredibly strong and dangerous. Therefore, to meet with Peter must be prepared. You have to develop a force that will help resist earth energy. When you are ready, come along with colleagues, and I will tell you where to find this giant.
(You need a command channel of 27 or more characters.)
- + \ No newline at end of file diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/instances/ResidenceOfKingPetram.xml b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/instances/ResidenceOfKingPetram.xml new file mode 100644 index 0000000000..bd2fd39fed --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/instances/ResidenceOfKingPetram.xml @@ -0,0 +1,31 @@ + + + diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java new file mode 100644 index 0000000000..10b689adf3 --- /dev/null +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java @@ -0,0 +1,184 @@ +/* + * 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 instances.ResidenceOfKingPetram; + +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance; +import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.instancezone.Instance; +import org.l2jmobius.gameserver.model.skills.Skill; + +import instances.AbstractInstance; + +/** + * @author RobikBobik + * @NOTE: Retail like working + * @TODO: Rewrite code to modern style. + * @TODO: Petram Skills and minion skills + */ +public class ResidenceOfKingPetram extends AbstractInstance +{ + // NPCs + private static final int TRITAN = 34049; + private static final int PETRAM = 29108; + private static final int PETRAM_PIECE = 29116; + private static final int PETRAM_FRAGMENT = 29117; + // Skills + private static SkillHolder EARTh_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. + private static SkillHolder EARTh_FURY = new SkillHolder(50059, 1); // When change invul state. + private static SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID. + // Misc + private static final int TEMPLATE_ID = 198; + private RaidBossInstance _petram = null; + private MonsterInstance _minion_1 = null; + private MonsterInstance _minion_2 = null; + private MonsterInstance _minion_3 = null; + private MonsterInstance _minion_4 = null; + private boolean _spawned_minions; + + public ResidenceOfKingPetram() + { + super(TEMPLATE_ID); + addStartNpc(TRITAN); + addKillId(PETRAM, PETRAM_PIECE, PETRAM_FRAGMENT); + addAttackId(PETRAM); + addSpawnId(PETRAM); + addInstanceLeaveId(TEMPLATE_ID); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + switch (event) + { + case "ENTER": + { + enterInstance(player, npc, TEMPLATE_ID); + _petram = (RaidBossInstance) addSpawn(PETRAM, 222063, 191514, -15486, 50142, false, 0, true, player.getInstanceId()); + break; + } + case "SPAWN_MINION": + { + _petram.useMagic(EARTh_ENERGY.getSkill()); + + // Prevent to double or higher spawn when HP is between 68-70% + etc... + if (!_spawned_minions) + { + _minion_1 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()); + _minion_2 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()); + _minion_3 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()); + _minion_4 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()); + _spawned_minions = true; + } + + startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); + break; + } + case "SUPPORT_PETRAM": + { + _minion_1.setTarget(_petram); + _minion_1.useMagic(TEST.getSkill()); + _minion_2.setTarget(_petram); + _minion_2.useMagic(TEST.getSkill()); + _minion_3.setTarget(_petram); + _minion_3.useMagic(TEST.getSkill()); + _minion_4.setTarget(_petram); + _minion_4.useMagic(TEST.getSkill()); + startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 + break; + } + case "INVUL_MODE": + { + _petram.useMagic(EARTh_FURY.getSkill()); + if (_petram.isInvul()) + { + _petram.setIsInvul(false); + _petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); + } + else + { + _petram.setIsInvul(true); + _petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + } + break; + } + } + return null; + } + + @Override + public String onSpawn(Npc npc) + { + return super.onSpawn(npc); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getId() == PETRAM) + { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.70)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.68))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.40)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.38))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.20)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.18))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.10)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.08))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + } + return super.onAttack(npc, attacker, damage, isSummon, skill); + } + + @Override + public String onKill(Npc npc, PlayerInstance player, boolean isSummon) + { + if (npc.getId() == PETRAM) + { + final Instance world = npc.getInstanceWorld(); + if (world != null) + { + world.finishInstance(); + } + } + else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead())) + { + startQuestTimer("INVUL_MODE", 3000, _petram, null); + _spawned_minions = false; + } + return super.onKill(npc, player, isSummon); + } + + public static void main(String[] args) + { + new ResidenceOfKingPetram(); + } +} \ No newline at end of file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/html/teleporter/34049-1.htm b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/html/teleporter/34049-1.htm index 607147213e..97d8acd570 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/html/teleporter/34049-1.htm +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/html/teleporter/34049-1.htm @@ -4,5 +4,5 @@ Oh, I got you interested, right? As a child I read an old book about the King of He's just huge! His body is like a rock, and his fists are like huge boulders. What else to tell? Hmm ..... Oh, yes! In that old book it was written that the stones covering the body of the King of the Earth Spirits make it virtually invulnerable.
He is really incredibly strong and dangerous. Therefore, to meet with Peter must be prepared. You have to develop a force that will help resist earth energy. When you are ready, come along with colleagues, and I will tell you where to find this giant.
(You need a command channel of 27 or more characters.)
- + \ No newline at end of file diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/instances/ResidenceOfKingPetram.xml b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/instances/ResidenceOfKingPetram.xml new file mode 100644 index 0000000000..bd2fd39fed --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/instances/ResidenceOfKingPetram.xml @@ -0,0 +1,31 @@ + + + diff --git a/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java new file mode 100644 index 0000000000..10b689adf3 --- /dev/null +++ b/L2J_Mobius_Classic_3.0_TheKamael/dist/game/data/scripts/instances/ResidenceOfKingPetram/ResidenceOfKingPetram.java @@ -0,0 +1,184 @@ +/* + * 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 instances.ResidenceOfKingPetram; + +import org.l2jmobius.gameserver.enums.ChatType; +import org.l2jmobius.gameserver.model.actor.Npc; +import org.l2jmobius.gameserver.model.actor.instance.MonsterInstance; +import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; +import org.l2jmobius.gameserver.model.actor.instance.RaidBossInstance; +import org.l2jmobius.gameserver.model.holders.SkillHolder; +import org.l2jmobius.gameserver.model.instancezone.Instance; +import org.l2jmobius.gameserver.model.skills.Skill; + +import instances.AbstractInstance; + +/** + * @author RobikBobik + * @NOTE: Retail like working + * @TODO: Rewrite code to modern style. + * @TODO: Petram Skills and minion skills + */ +public class ResidenceOfKingPetram extends AbstractInstance +{ + // NPCs + private static final int TRITAN = 34049; + private static final int PETRAM = 29108; + private static final int PETRAM_PIECE = 29116; + private static final int PETRAM_FRAGMENT = 29117; + // Skills + private static SkillHolder EARTh_ENERGY = new SkillHolder(50066, 1); // When spawn Minion. + private static SkillHolder EARTh_FURY = new SkillHolder(50059, 1); // When change invul state. + private static SkillHolder TEST = new SkillHolder(5712, 1); // TODO: This test skill is only for visual effect, but need to find correct skill ID. + // Misc + private static final int TEMPLATE_ID = 198; + private RaidBossInstance _petram = null; + private MonsterInstance _minion_1 = null; + private MonsterInstance _minion_2 = null; + private MonsterInstance _minion_3 = null; + private MonsterInstance _minion_4 = null; + private boolean _spawned_minions; + + public ResidenceOfKingPetram() + { + super(TEMPLATE_ID); + addStartNpc(TRITAN); + addKillId(PETRAM, PETRAM_PIECE, PETRAM_FRAGMENT); + addAttackId(PETRAM); + addSpawnId(PETRAM); + addInstanceLeaveId(TEMPLATE_ID); + } + + @Override + public String onAdvEvent(String event, Npc npc, PlayerInstance player) + { + switch (event) + { + case "ENTER": + { + enterInstance(player, npc, TEMPLATE_ID); + _petram = (RaidBossInstance) addSpawn(PETRAM, 222063, 191514, -15486, 50142, false, 0, true, player.getInstanceId()); + break; + } + case "SPAWN_MINION": + { + _petram.useMagic(EARTh_ENERGY.getSkill()); + + // Prevent to double or higher spawn when HP is between 68-70% + etc... + if (!_spawned_minions) + { + _minion_1 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 221543, 191530, -15486, 1131, false, -1, true, npc.getInstanceId()); + _minion_2 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222069, 192019, -15486, 49364, false, -1, true, npc.getInstanceId()); + _minion_3 = (MonsterInstance) addSpawn(npc, PETRAM_PIECE, 222595, 191479, -15486, 34013, false, -1, true, npc.getInstanceId()); + _minion_4 = (MonsterInstance) addSpawn(npc, PETRAM_FRAGMENT, 222077, 191017, -15486, 16383, false, -1, true, npc.getInstanceId()); + _spawned_minions = true; + } + + startQuestTimer("SUPPORT_PETRAM", 3000, npc, null); + break; + } + case "SUPPORT_PETRAM": + { + _minion_1.setTarget(_petram); + _minion_1.useMagic(TEST.getSkill()); + _minion_2.setTarget(_petram); + _minion_2.useMagic(TEST.getSkill()); + _minion_3.setTarget(_petram); + _minion_3.useMagic(TEST.getSkill()); + _minion_4.setTarget(_petram); + _minion_4.useMagic(TEST.getSkill()); + startQuestTimer("SUPPORT_PETRAM", 10100, npc, null); // NOTE: When find correct skill this number is reuse skill + 100 + break; + } + case "INVUL_MODE": + { + _petram.useMagic(EARTh_FURY.getSkill()); + if (_petram.isInvul()) + { + _petram.setIsInvul(false); + _petram.broadcastSay(ChatType.NPC_SHOUT, "Nooooo... Nooooo..."); + } + else + { + _petram.setIsInvul(true); + _petram.broadcastSay(ChatType.NPC_SHOUT, "HaHa, fighters lets kill them. Now Im invul!!!"); + } + break; + } + } + return null; + } + + @Override + public String onSpawn(Npc npc) + { + return super.onSpawn(npc); + } + + @Override + public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill) + { + if (npc.getId() == PETRAM) + { + if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.70)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.68))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.40)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.38))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.20)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.18))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + else if ((npc.getCurrentHp() < (npc.getMaxHp() * 0.10)) && (npc.getCurrentHp() > (npc.getMaxHp() * 0.08))) + { + startQuestTimer("INVUL_MODE", 1000, npc, null); + startQuestTimer("SPAWN_MINION", 1000, npc, null); + } + } + return super.onAttack(npc, attacker, damage, isSummon, skill); + } + + @Override + public String onKill(Npc npc, PlayerInstance player, boolean isSummon) + { + if (npc.getId() == PETRAM) + { + final Instance world = npc.getInstanceWorld(); + if (world != null) + { + world.finishInstance(); + } + } + else if ((_minion_1.isDead()) && (_minion_2.isDead()) && (_minion_3.isDead()) && (_minion_4.isDead())) + { + startQuestTimer("INVUL_MODE", 3000, _petram, null); + _spawned_minions = false; + } + return super.onKill(npc, player, isSummon); + } + + public static void main(String[] args) + { + new ResidenceOfKingPetram(); + } +} \ No newline at end of file