Skip to content
Snippets Groups Projects
Commit 955e1a7f authored by St3eT's avatar St3eT
Browse files

BETA: Implementing '''Maguen''' AI, '''Nemo''' AI and '''TARGET_PARTY''' target handler.

* Reviewed by: Zoey76, xban1x
parent 0bd80bde
No related branches found
No related tags found
No related merge requests found
Showing
with 636 additions and 3 deletions
......@@ -41,6 +41,7 @@ ai/npc/KetraOrcSupport/KetraOrcSupport.java
ai/npc/MercenaryCaptain/MercenaryCaptain.java
ai/npc/Minigame/Minigame.java
ai/npc/MonumentOfHeroes/MonumentOfHeroes.java
ai/npc/Nemo/Nemo.java
ai/npc/Nottingale/Nottingale.java
ai/npc/NpcBuffers/NpcBuffers.java
ai/npc/NpcBuffers/impl/CabaleBuffer.java
......@@ -157,6 +158,7 @@ ai/individual/Gordon.java
ai/individual/HellboundCore.java
ai/individual/Keltas.java
ai/individual/Lindvior.java
ai/individual/Maguen.java
ai/individual/NaiaLock.java
ai/individual/Orfen.java
ai/individual/OutpostCaptain.java
......
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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 ai.individual;
import ai.npc.AbstractNpcAI;
import ai.npc.Nemo.Nemo;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.model.skills.BuffInfo;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.network.NpcStringId;
/**
* Maguen AI.
* @author St3eT
*/
public final class Maguen extends AbstractNpcAI
{
// NPC
private static final int MAGUEN = 18839; // Wild Maguen
private static final int[] ELITES =
{
22750, // Elite Bgurent (Bistakon)
22751, // Elite Brakian (Bistakon)
22752, // Elite Groikan (Bistakon)
22753, // Elite Treykan (Bistakon)
22757, // Elite Turtlelian (Reptilikon)
22758, // Elite Krajian (Reptilikon)
22759, // Elite Tardyon (Reptilikon)
22763, // Elite Kanibi (Kokracon)
22764, // Elite Kiriona (Kokracon)
22765, // Elite Kaiona (Kokracon)
};
// Item
private static final int MAGUEN_PET = 15488; // Maguen Pet Collar
private static final int ELITE_MAGUEN_PET = 15489; // Elite Maguen Pet Collar
// Skills
private static final SkillHolder MACHINE = new SkillHolder(9060, 1); // Maguen Machine
private static final SkillHolder B_BUFF_1 = new SkillHolder(6343, 1); // Maguen Plasma - Power
private static final SkillHolder B_BUFF_2 = new SkillHolder(6343, 2); // Maguen Plasma - Power
private static final SkillHolder C_BUFF_1 = new SkillHolder(6365, 1); // Maguen Plasma - Speed
private static final SkillHolder C_BUFF_2 = new SkillHolder(6365, 2); // Maguen Plasma - Speed
private static final SkillHolder R_BUFF_1 = new SkillHolder(6366, 1); // Maguen Plasma - Critical
private static final SkillHolder R_BUFF_2 = new SkillHolder(6366, 2); // Maguen Plasma - Critical
private static final SkillHolder B_PLASMA1 = new SkillHolder(6367, 1); // Maguen Plasma - Bistakon
private static final SkillHolder B_PLASMA2 = new SkillHolder(6367, 2); // Maguen Plasma - Bistakon
private static final SkillHolder B_PLASMA3 = new SkillHolder(6367, 3); // Maguen Plasma - Bistakon
private static final SkillHolder C_PLASMA1 = new SkillHolder(6368, 1); // Maguen Plasma - Cokrakon
private static final SkillHolder C_PLASMA2 = new SkillHolder(6368, 2); // Maguen Plasma - Cokrakon
private static final SkillHolder C_PLASMA3 = new SkillHolder(6368, 3); // Maguen Plasma - Cokrakon
private static final SkillHolder R_PLASMA1 = new SkillHolder(6369, 1); // Maguen Plasma - Reptilikon
private static final SkillHolder R_PLASMA2 = new SkillHolder(6369, 2); // Maguen Plasma - Reptilikon
private static final SkillHolder R_PLASMA3 = new SkillHolder(6369, 3); // Maguen Plasma - Reptilikon
private Maguen()
{
super(Maguen.class.getSimpleName(), "ai/invidual");
addKillId(ELITES);
addSkillSeeId(MAGUEN);
addSpellFinishedId(MAGUEN);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
if ((npc == null) || (player == null))
{
return null;
}
switch (event)
{
case "SPAWN_MAGUEN":
{
final L2Npc maguen = addSpawn(MAGUEN, npc.getLocation(), true, 60000, true);
maguen.getVariables().set("SUMMON_PLAYER", player);
maguen.setTitle(player.getName());
maguen.setIsRunning(true);
maguen.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
maguen.broadcastStatusUpdate();
showOnScreenMsg(player, NpcStringId.MAGUEN_APPEARANCE, 2, 4000);
startQuestTimer("DIST_CHECK_TIMER", 1000, maguen, player);
break;
}
case "DIST_CHECK_TIMER":
{
if ((npc.calculateDistance(player, true, false) < 100) && (npc.getVariables().getInt("IS_NEAR_PLAYER") == 0))
{
npc.getVariables().set("IS_NEAR_PLAYER", 1);
startQuestTimer("FIRST_TIMER", 4000, npc, player);
}
else
{
startQuestTimer("DIST_CHECK_TIMER", 1000, npc, player);
}
break;
}
case "FIRST_TIMER":
{
npc.getAI().stopFollow();
final int randomEffect = getRandom(1, 3);
npc.setDisplayEffect(randomEffect);
npc.getVariables().set("NPC_EFFECT", randomEffect);
startQuestTimer("SECOND_TIMER", 5000 + getRandom(300), npc, player);
npc.broadcastSocialAction(getRandom(1, 3));
break;
}
case "SECOND_TIMER":
{
final int randomEffect = getRandom(1, 3);
npc.setDisplayEffect(4);
npc.setDisplayEffect(randomEffect);
npc.getVariables().set("NPC_EFFECT", randomEffect);
startQuestTimer("THIRD_TIMER", 4600 + getRandom(600), npc, player);
npc.broadcastSocialAction(getRandom(1, 3));
break;
}
case "THIRD_TIMER":
{
final int randomEffect = getRandom(1, 3);
npc.setDisplayEffect(4);
npc.setDisplayEffect(randomEffect);
npc.getVariables().set("NPC_EFFECT", randomEffect);
startQuestTimer("FORTH_TIMER", 4200 + getRandom(900), npc, player);
npc.broadcastSocialAction(getRandom(1, 3));
break;
}
case "FORTH_TIMER":
{
npc.getVariables().set("NPC_EFFECT", 0);
npc.setDisplayEffect(4);
startQuestTimer("END_TIMER", 500, npc, player);
npc.broadcastSocialAction(getRandom(1, 3));
break;
}
case "END_TIMER":
{
if (npc.getVariables().getInt("TEST_MAGUEN") == 1)
{
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
nemoAi().notifyEvent("DECREASE_COUNT", npc, player);
}
npc.doDie(null);
break;
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onSpellFinished(L2Npc npc, L2PcInstance player, Skill skill)
{
final BuffInfo b_info = player.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo c_info = player.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo r_info = player.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int b = b_info == null ? 0 : b_info.getSkill().getAbnormalLvl();
final int c = c_info == null ? 0 : c_info.getSkill().getAbnormalLvl();
final int r = r_info == null ? 0 : r_info.getSkill().getAbnormalLvl();
if ((b == 3) && (c == 0) && (r == 0))
{
showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_BISTAKON_HAVE_GATHERED, 2, 4000);
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
npc.setTarget(player);
npc.doCast((getRandom(100) < 70) ? B_BUFF_1.getSkill() : B_BUFF_2.getSkill());
maguenPetChance(player);
startQuestTimer("END_TIMER", 3000, npc, player);
}
else if ((b == 0) && (c == 3) && (r == 0))
{
showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_COKRAKON_HAVE_GATHERED, 2, 4000);
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
npc.setTarget(player);
npc.doCast((getRandom(100) < 70) ? C_BUFF_1.getSkill() : C_BUFF_2.getSkill());
maguenPetChance(player);
startQuestTimer("END_TIMER", 3000, npc, player);
}
else if ((b == 0) && (c == 0) && (r == 3))
{
showOnScreenMsg(player, NpcStringId.ENOUGH_MAGUEN_PLASMA_LEPTILIKON_HAVE_GATHERED, 2, 4000);
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
npc.setTarget(player);
npc.doCast((getRandom(100) < 70) ? R_BUFF_1.getSkill() : R_BUFF_2.getSkill());
maguenPetChance(player);
startQuestTimer("END_TIMER", 3000, npc, player);
}
else if ((b + c + r) == 3)
{
if ((b == 1) && (c == 1) && (r == 1))
{
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
showOnScreenMsg(player, NpcStringId.THE_PLASMAS_HAVE_FILLED_THE_AEROSCOPE_AND_ARE_HARMONIZED, 2, 4000);
SkillHolder skillToCast = null;
switch (getRandom(3))
{
case 0:
skillToCast = (getRandom(100) < 70) ? B_BUFF_1 : B_BUFF_2;
break;
case 1:
skillToCast = (getRandom(100) < 70) ? C_BUFF_1 : C_BUFF_2;
break;
case 2:
skillToCast = (getRandom(100) < 70) ? R_BUFF_1 : R_BUFF_2;
break;
}
if (skillToCast != null)
{
npc.setTarget(player);
npc.doCast(skillToCast.getSkill());
}
maguenPetChance(player);
startQuestTimer("END_TIMER", 3000, npc, player);
}
else
{
showOnScreenMsg(player, NpcStringId.THE_PLASMAS_HAVE_FILLED_THE_AEROSCOPE_BUT_THEY_ARE_RAMMING_INTO_EACH_OTHER_EXPLODING_AND_DYING, 2, 4000);
player.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
player.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
}
}
else
{
startQuestTimer("END_TIMER", 1000, npc, player);
}
npc.setDisplayEffect(4);
return super.onSpellFinished(npc, player, skill);
}
@Override
public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isSummon)
{
if ((skill == MACHINE.getSkill()) && (caster == npc.getVariables().getObject("SUMMON_PLAYER", L2PcInstance.class)))
{
if ((npc.getVariables().getInt("NPC_EFFECT") != 0) && (npc.getVariables().getInt("BLOCKED_SKILLSEE") == 0))
{
final BuffInfo i1_info = caster.getEffectList().getBuffInfoByAbnormalType(B_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i2_info = caster.getEffectList().getBuffInfoByAbnormalType(C_PLASMA1.getSkill().getAbnormalType());
final BuffInfo i3_info = caster.getEffectList().getBuffInfoByAbnormalType(R_PLASMA1.getSkill().getAbnormalType());
final int i1 = i1_info == null ? 0 : i1_info.getSkill().getAbnormalLvl();
final int i2 = i2_info == null ? 0 : i2_info.getSkill().getAbnormalLvl();
final int i3 = i3_info == null ? 0 : i3_info.getSkill().getAbnormalLvl();
caster.getEffectList().stopSkillEffects(true, B_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, C_PLASMA1.getSkill().getAbnormalType());
caster.getEffectList().stopSkillEffects(true, R_PLASMA1.getSkill().getAbnormalType());
cancelQuestTimer("FIRST_TIMER", npc, caster);
cancelQuestTimer("SECOND_TIMER", npc, caster);
cancelQuestTimer("THIRD_TIMER", npc, caster);
cancelQuestTimer("FORTH_TIMER", npc, caster);
npc.getVariables().set("BLOCKED_SKILLSEE", 1);
SkillHolder skillToCast = null;
switch (npc.getVariables().getInt("NPC_EFFECT"))
{
case 1:
{
switch (i1)
{
case 0:
skillToCast = B_PLASMA1;
break;
case 1:
skillToCast = B_PLASMA2;
break;
case 2:
skillToCast = B_PLASMA3;
break;
}
break;
}
case 2:
{
switch (i2)
{
case 0:
skillToCast = C_PLASMA1;
break;
case 1:
skillToCast = C_PLASMA2;
break;
case 2:
skillToCast = C_PLASMA3;
break;
}
break;
}
case 3:
{
switch (i3)
{
case 0:
skillToCast = R_PLASMA1;
break;
case 1:
skillToCast = R_PLASMA2;
break;
case 2:
skillToCast = R_PLASMA3;
break;
}
break;
}
}
if (skillToCast != null)
{
npc.setTarget(caster);
npc.doCast(skillToCast.getSkill());
}
}
}
return super.onSkillSee(npc, caster, skill, targets, isSummon);
}
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
{
if (killer.isInParty())
{
final L2PcInstance partyMember = getRandomPartyMember(killer);
final int i0 = 10 + (10 * killer.getParty().getMemberCount());
if ((getRandom(1000) < i0) && (npc.calculateDistance(killer, true, false) < 2000) && (npc.calculateDistance(partyMember, true, false) < 2000))
{
notifyEvent("SPAWN_MAGUEN", npc, partyMember);
}
}
return super.onKill(npc, killer, isSummon);
}
private void maguenPetChance(L2PcInstance player)
{
final int chance1 = getRandom(10000);
final int chance2 = getRandom(20);
if ((chance1 == 0) && (chance2 != 0))
{
giveItems(player, MAGUEN_PET, 1);
}
else if ((chance1 == 0) && (chance2 == 0))
{
giveItems(player, ELITE_MAGUEN_PET, 1);
}
}
private Quest nemoAi()
{
return QuestManager.getInstance().getQuest(Nemo.class.getSimpleName());
}
public static void main(String[] args)
{
new Maguen();
}
}
\ No newline at end of file
<html><body>Nemo:<br>
I have no information about the origins of this species, but what I have found is that these creatures do possess a unique energy, sort of plasma if you will. Hmm... <font color="LEVEL">Maguen Plasma</font>. I like that. I think that is what I'll call it. Anyway, when a Maguen appears it begins to bring forth one of these plasmas. It will also cycle through its various plasmas before hiding.<br>
With Blacksmith Kusto's talent and my magic we were able to create a device that could harvest these plasmas... a <font color="LEVEL">Maguen Plasma Collector</font>. I know it isn't too creative but we decided to keep the name simple to avoid explaining what it does.<br>
Ugh... fine. I'll explain it to you. When you are in the Seed and a Maguen appears you have a very limited time to collect the Maguen Plasma. If you don't collect the plasma in time the Maguen will go back into hiding. I've set up a practice Maguen if you want to try using the Maguen Plasma Collector.<br>
This isn't a real Maguen, so you won't collect any Plasma just thought you should know so you don't get your hopes up.<br>
<a action="bypass -h Quest Nemo giveCollector">Receive the Maguen Plasma Collector</a><br>
<a action="bypass -h Quest Nemo summonMaguen">Practice using the Maguen Plasma Collector</a>
</body></html>
\ No newline at end of file
<html><body>Nemo:<br>
Here is the Maguen Plasma Collector.<br>
Remember these rules:<br>
1. Collect <font color="LEVEL">one of each type</font>, or <font color="LEVEL">several of the same type</font>.<br>
2. Collecting random Maguen Plasmas can overload the Plasma Collector and will release any plasma you have collected. Yes, this means you'll have to start all over again.
</body></html>
\ No newline at end of file
<html><body>Nemo:<br>
Are you pulling my leg? You're NOT an adventurer? Or you ARE? You have one? You want another? What is it?! Tell me!!<br>
You've confused me. I don't know what to say... I need a moment...
</body></html>
\ No newline at end of file
<html><body>Nemo:<br>
Everything needs preparation. Did you think about how you are going to use it when you carry all that stuff? Make yourself lighter, or empty your inventory. Sheez.
</body></html>
\ No newline at end of file
<html><body>Nemo:<br>
Take a look at the top of the Maguen's head. Observe the aura of the Plasma that the Maguen is producing. Use the Maguen Plasma Collector when the Maguen summons the Plasma you wish to collect.
</body></html>
\ No newline at end of file
<html><body>Nemo:<br>
This is my magic's limit, now I can't help you. Look around... there are others just like you.
</body></html>
\ No newline at end of file
<html><body>Nemo:<br>
Who are you? What business do you have with the Great Magician of Oren? Speak! Hmm... not a chatty one, are you? Well if you must know, I am here on important business.<br>
It is said that a mysterious creature can only be found on this Seed. Have you heard of a <font color="LEVEL">Maguen</font>? Yes, I know it is a silly name. But aren't you the least bit intrigued?<br>
<a action="bypass -h Quest Nemo 32735-01.html">What is a Maguen?</a><br>
<a action="bypass -h npc_%objectId%_Quest">Quest</a>
</body></html>
\ No newline at end of file
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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 ai.npc.Nemo;
import ai.individual.Maguen;
import ai.npc.AbstractNpcAI;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.instancemanager.QuestManager;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.quest.Quest;
import com.l2jserver.gameserver.network.NpcStringId;
/**
* Nemo AI.
* @author St3eT
*/
public final class Nemo extends AbstractNpcAI
{
// NPC
private static final int NEMO = 32735; // Nemo
private static final int MAGUEN = 18839; // Wild Maguen
// Items
private static final int COLLECTOR = 15487; // Maguen Plasma Collector
// Misc
private static final int MAXIMUM_MAGUEN = 18; // Maximum maguens in one time
private Nemo()
{
super(Nemo.class.getSimpleName(), "ai/npc");
addStartNpc(NEMO);
addFirstTalkId(NEMO);
addTalkId(NEMO);
}
@Override
public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
{
String htmltext = null;
switch (event)
{
case "32735-01.html":
{
htmltext = event;
break;
}
case "giveCollector":
{
if (hasQuestItems(player, COLLECTOR))
{
htmltext = "32735-03.html";
}
else if (!player.isInventoryUnder90(false))
{
htmltext = "32735-04.html";
}
else
{
htmltext = "32735-02.html";
giveItems(player, COLLECTOR, 1);
}
break;
}
case "summonMaguen":
{
if ((player.getVariables().getInt("TEST_MAGUEN", 0) == 0) && (npc.getScriptValue() < MAXIMUM_MAGUEN))
{
final L2Npc maguen = addSpawn(MAGUEN, npc.getLocation(), true, 60000, true);
maguen.getVariables().set("SUMMON_PLAYER", player);
maguen.getVariables().set("SPAWNED_NPC", npc);
maguen.getVariables().set("TEST_MAGUEN", 1);
player.getVariables().set("TEST_MAGUEN", 1);
maguen.setTitle(player.getName());
maguen.setIsRunning(true);
maguen.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, player);
maguen.broadcastStatusUpdate();
showOnScreenMsg(player, NpcStringId.MAGUEN_APPEARANCE, 2, 4000);
maguenAi().startQuestTimer("DIST_CHECK_TIMER", 1000, maguen, player);
npc.setScriptValue(npc.getScriptValue() + 1);
htmltext = "32735-05.html";
}
else
{
htmltext = "32735-06.html";
}
break;
}
case "DECREASE_COUNT":
{
final L2Npc spawnedNpc = npc.getVariables().getObject("SPAWNED_NPC", L2Npc.class);
if ((spawnedNpc != null) && (spawnedNpc.getScriptValue() > 0))
{
player.getVariables().remove("TEST_MAGUEN");
spawnedNpc.setScriptValue(spawnedNpc.getScriptValue() - 1);
}
}
}
return htmltext;
}
private Quest maguenAi()
{
return QuestManager.getInstance().getQuest(Maguen.class.getSimpleName());
}
public static void main(String[] args)
{
new Nemo();
}
}
\ No newline at end of file
......@@ -233,6 +233,7 @@ import handlers.targethandlers.Pet;
import handlers.targethandlers.Self;
import handlers.targethandlers.Servitor;
import handlers.targethandlers.Summon;
import handlers.targethandlers.TargetParty;
import handlers.targethandlers.Unlockable;
import handlers.telnethandlers.ChatsHandler;
import handlers.telnethandlers.DebugHandler;
......@@ -546,6 +547,7 @@ public class MasterHandler
Self.class,
Servitor.class,
Summon.class,
TargetParty.class,
Unlockable.class,
},
{
......
/*
* Copyright (C) 2004-2014 L2J DataPack
*
* This file is part of L2J DataPack.
*
* L2J DataPack 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.
*
* L2J DataPack 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 handlers.targethandlers;
import java.util.ArrayList;
import java.util.List;
import com.l2jserver.gameserver.handler.ITargetTypeHandler;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.model.skills.targets.L2TargetType;
import com.l2jserver.gameserver.network.SystemMessageId;
/**
* @author St3eT
*/
public class TargetParty implements ITargetTypeHandler
{
@Override
public L2Object[] getTargetList(Skill skill, L2Character activeChar, boolean onlyFirst, L2Character target)
{
List<L2Character> targetList = new ArrayList<>();
// Check for null target or any other invalid target
if ((target == null) || target.isDead() || (target == activeChar))
{
activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
return EMPTY_TARGET_LIST;
}
final int radius = skill.getAffectRange();
final L2PcInstance player = (L2PcInstance) activeChar.getTarget();
if (player.isInParty())
{
for (L2PcInstance partyMember : player.getParty().getMembers())
{
if ((partyMember == null))
{
continue;
}
if (Skill.addCharacter(player, partyMember, radius, false))
{
targetList.add(partyMember);
}
if (Skill.addSummon(player, partyMember, radius, false))
{
targetList.add(partyMember.getSummon());
}
}
}
else
{
targetList.add(target);
}
return targetList.toArray(new L2Character[targetList.size()]);
}
@Override
public Enum<L2TargetType> getTargetType()
{
return L2TargetType.TARGET_PARTY;
}
}
\ No newline at end of file
......@@ -1233,6 +1233,7 @@
<set name="is_sellable" val="false" />
<set name="is_depositable" val="false" />
<set name="is_oly_restricted" val="true" />
<set name="handler" val="ItemSkills" />
<set name="item_skill" val="9060-1" />
</item>
<item id="15488" type="EtcItem" name="Maguen Pet Collar">
......
......@@ -975,7 +975,7 @@
<set name="mpInitialConsume" val="22" />
<set name="operateType" val="A2" />
<set name="reuseDelay" val="2000" />
<set name="targetType" val="PARTY" />
<set name="targetType" val="TARGET_PARTY" />
<for>
<effect name="Buff">
<mul order="0x30" stat="mAtk" val="#mAtk" />
......@@ -1003,7 +1003,7 @@
<set name="mpInitialConsume" val="22" />
<set name="operateType" val="A2" />
<set name="reuseDelay" val="2000" />
<set name="targetType" val="PARTY" />
<set name="targetType" val="TARGET_PARTY" />
<for>
<effect name="Buff">
<mul order="0x30" stat="mAtkSpd" val="#pmAtkSpd" />
......@@ -1033,7 +1033,7 @@
<set name="mpInitialConsume" val="22" />
<set name="operateType" val="A2" />
<set name="reuseDelay" val="2000" />
<set name="targetType" val="PARTY" />
<set name="targetType" val="TARGET_PARTY" />
<for>
<effect name="Buff">
<basemul order="0x30" stat="rCrit" val="#rCrit" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment