Addition of Residence of King Petram.

Contributed by robikbobik.
This commit is contained in:
MobiusDevelopment
2019-10-25 13:53:37 +00:00
parent ef63536082
commit bd83f08bd2
9 changed files with 648 additions and 3 deletions

View File

@@ -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 <font color="LEVEL">the stones covering the body of the King of the Earth Spirits make it virtually invulnerable</font>.<br>
He is really incredibly strong and dangerous. Therefore, to meet with Peter must be prepared. You have to develop <font color="LEVEL">a force that will help resist earth energy</font>. When you are ready, come along with colleagues, and I will tell you where to find this giant.<br>
<font color="LEVEL">(You need a command channel of 27 or more characters.)</font><br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 2">Move to Petrama</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ResidenceOfKingPetram ENTER">Move to Petram</Button>
</body></html>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<instance id="198" maxWorlds="80" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
<time duration="120" empty="0" />
<removeBuffs type="ALL" />
<locations>
<enter type="FIXED">
<location x="222081" y="190538" z="-15485" />
</enter>
<exit type="ORIGIN" />
</locations>
<conditions>
<condition type="Party" />
<condition type="CommandChannel" />
<condition type="CommandChannelLeader" />
<condition type="GroupMin">
<param name="limit" value="27" />
</condition>
<condition type="GroupMax">
<param name="limit" value="100" />
</condition>
<condition type="Level">
<param name="min" value="76" />
<param name="max" value="82" />
</condition>
<condition type="Distance" />
<condition type="Reenter" />
</conditions>
<reenter apply="ON_ENTER">
<reset day="WEDNESDAY" hour="6" minute="30" />
</reenter>
</instance>

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@@ -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 <font color="LEVEL">the stones covering the body of the King of the Earth Spirits make it virtually invulnerable</font>.<br>
He is really incredibly strong and dangerous. Therefore, to meet with Peter must be prepared. You have to develop <font color="LEVEL">a force that will help resist earth energy</font>. When you are ready, come along with colleagues, and I will tell you where to find this giant.<br>
<font color="LEVEL">(You need a command channel of 27 or more characters.)</font><br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 2">Move to Petrama</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ResidenceOfKingPetram ENTER">Move to Petram</Button>
</body></html>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<instance id="198" maxWorlds="80" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
<time duration="120" empty="0" />
<removeBuffs type="ALL" />
<locations>
<enter type="FIXED">
<location x="222081" y="190538" z="-15485" />
</enter>
<exit type="ORIGIN" />
</locations>
<conditions>
<condition type="Party" />
<condition type="CommandChannel" />
<condition type="CommandChannelLeader" />
<condition type="GroupMin">
<param name="limit" value="27" />
</condition>
<condition type="GroupMax">
<param name="limit" value="100" />
</condition>
<condition type="Level">
<param name="min" value="76" />
<param name="max" value="82" />
</condition>
<condition type="Distance" />
<condition type="Reenter" />
</conditions>
<reenter apply="ON_ENTER">
<reset day="WEDNESDAY" hour="6" minute="30" />
</reenter>
</instance>

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

@@ -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 <font color="LEVEL">the stones covering the body of the King of the Earth Spirits make it virtually invulnerable</font>.<br>
He is really incredibly strong and dangerous. Therefore, to meet with Peter must be prepared. You have to develop <font color="LEVEL">a force that will help resist earth energy</font>. When you are ready, come along with colleagues, and I will tell you where to find this giant.<br>
<font color="LEVEL">(You need a command channel of 27 or more characters.)</font><br>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h npc_%objectId%_Chat 2">Move to Petrama</Button>
<Button ALIGN=LEFT ICON="NORMAL" action="bypass -h Quest ResidenceOfKingPetram ENTER">Move to Petram</Button>
</body></html>

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<instance id="198" maxWorlds="80" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/instance.xsd">
<time duration="120" empty="0" />
<removeBuffs type="ALL" />
<locations>
<enter type="FIXED">
<location x="222081" y="190538" z="-15485" />
</enter>
<exit type="ORIGIN" />
</locations>
<conditions>
<condition type="Party" />
<condition type="CommandChannel" />
<condition type="CommandChannelLeader" />
<condition type="GroupMin">
<param name="limit" value="27" />
</condition>
<condition type="GroupMax">
<param name="limit" value="100" />
</condition>
<condition type="Level">
<param name="min" value="76" />
<param name="max" value="82" />
</condition>
<condition type="Distance" />
<condition type="Reenter" />
</conditions>
<reenter apply="ON_ENTER">
<reset day="WEDNESDAY" hour="6" minute="30" />
</reenter>
</instance>

View File

@@ -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 <http://www.gnu.org/licenses/>.
*/
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();
}
}