Always use static modifier when adding values to static lists and maps.

This commit is contained in:
MobiusDevelopment
2019-04-08 10:30:59 +00:00
parent d4993f701e
commit bc61b48a56
262 changed files with 27272 additions and 26968 deletions

View File

@@ -1,114 +1,114 @@
/*
* 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 ai.areas.DragonValley;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.Npc;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
import ai.AbstractNpcAI;
/**
* Leopard Dragon Hachling AI.
* @author Mobius
*/
public final class LeopardDragonHachling extends AbstractNpcAI
{
// NPCs
private static final int DRAGON_HACHLING = 23434;
private static final int LEOPARD_DRAGON = 23435;
// Locations
private static final List<Location> TRANSFORM_LOCATIONS = new ArrayList<>();
{
TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944));
TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076));
TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776));
TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648));
}
private LeopardDragonHachling()
{
addAttackId(DRAGON_HACHLING);
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
if ((npc != null) && event.equals("MOVE_TO_TRANSFORM"))
{
if (npc.calculateDistance2D(nearestLocation(npc)) < 100)
{
final int random = getRandom(1, 4);
for (int counter = 1; counter < random; counter++)
{
final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time
leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH));
addAttackDesire(leopard, player);
}
cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player);
npc.deleteMe();
}
else
{
npc.abortAttack();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc));
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
{
if (npc.getScriptValue() == 0)
{
npc.setScriptValue(1);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON));
startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true);
}
npc.abortAttack();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc));
return null;
}
private Location nearestLocation(Npc npc)
{
Location gotoLoc = TRANSFORM_LOCATIONS.get(0);
for (Location loc : TRANSFORM_LOCATIONS)
{
if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc))
{
gotoLoc = loc;
}
}
return gotoLoc;
}
public static void main(String[] args)
{
new LeopardDragonHachling();
}
}
/*
* 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 ai.areas.DragonValley;
import java.util.ArrayList;
import java.util.List;
import com.l2jmobius.gameserver.ai.CtrlIntention;
import com.l2jmobius.gameserver.enums.ChatType;
import com.l2jmobius.gameserver.model.Location;
import com.l2jmobius.gameserver.model.actor.Npc;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.NpcSay;
import ai.AbstractNpcAI;
/**
* Leopard Dragon Hachling AI.
* @author Mobius
*/
public final class LeopardDragonHachling extends AbstractNpcAI
{
// NPCs
private static final int DRAGON_HACHLING = 23434;
private static final int LEOPARD_DRAGON = 23435;
// Locations
private static final List<Location> TRANSFORM_LOCATIONS = new ArrayList<>();
static
{
TRANSFORM_LOCATIONS.add(new Location(84199, 120022, -2944));
TRANSFORM_LOCATIONS.add(new Location(92138, 113735, -3076));
TRANSFORM_LOCATIONS.add(new Location(103925, 122422, -3776));
TRANSFORM_LOCATIONS.add(new Location(122040, 115493, -3648));
}
private LeopardDragonHachling()
{
addAttackId(DRAGON_HACHLING);
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
if ((npc != null) && event.equals("MOVE_TO_TRANSFORM"))
{
if (npc.calculateDistance2D(nearestLocation(npc)) < 100)
{
final int random = getRandom(1, 4);
for (int counter = 1; counter < random; counter++)
{
final Npc leopard = addSpawn(LEOPARD_DRAGON, npc.getLocation(), true, 300000); // 5 minute despawn time
leopard.broadcastPacket(new NpcSay(leopard.getObjectId(), ChatType.NPC_GENERAL, LEOPARD_DRAGON, NpcStringId.I_M_GOING_TO_TRANSFORM_WITH_THE_POWER_OF_THE_VORTEX_YOU_JUST_WATCH));
addAttackDesire(leopard, player);
}
cancelQuestTimer("MOVE_TO_TRANSFORM", npc, player);
npc.deleteMe();
}
else
{
npc.abortAttack();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc));
}
}
return super.onAdvEvent(event, npc, player);
}
@Override
public String onAttack(Npc npc, PlayerInstance attacker, int damage, boolean isSummon, Skill skill)
{
if (npc.getScriptValue() == 0)
{
npc.setScriptValue(1);
npc.broadcastPacket(new NpcSay(npc.getObjectId(), ChatType.NPC_GENERAL, DRAGON_HACHLING, NpcStringId.HEY_THAT_HURT_YOU_JUST_WAIT_HERE_AND_I_LL_BE_BACK_AS_A_STRONGER_DRAGON));
startQuestTimer("MOVE_TO_TRANSFORM", 1000, npc, attacker, true);
}
npc.abortAttack();
npc.getAI().setIntention(CtrlIntention.AI_INTENTION_MOVE_TO, nearestLocation(npc));
return null;
}
private Location nearestLocation(Npc npc)
{
Location gotoLoc = TRANSFORM_LOCATIONS.get(0);
for (Location loc : TRANSFORM_LOCATIONS)
{
if (npc.calculateDistance2D(loc) < npc.calculateDistance2D(gotoLoc))
{
gotoLoc = loc;
}
}
return gotoLoc;
}
public static void main(String[] args)
{
new LeopardDragonHachling();
}
}

View File

@@ -109,7 +109,8 @@ public final class Raina extends AbstractNpcAI
subclassSetMap.put(PlayerClass.Spellhowler, subclasseSet5);
}
private static final Map<CategoryType, Integer> classCloak = new HashMap<>();
private static final Map<CategoryType, Integer> classCloak = new HashMap<>();
static
{
classCloak.put(CategoryType.SIXTH_SIGEL_GROUP, 30310); // Abelius Cloak
classCloak.put(CategoryType.SIXTH_TIR_GROUP, 30311); // Sapyros Cloak Grade
@@ -121,7 +122,8 @@ public final class Raina extends AbstractNpcAI
classCloak.put(CategoryType.SIXTH_EOLH_GROUP, 30317); // Laksis Cloak Grade
}
private static final List<PlayerClass> dualClassList = new ArrayList<>();
private static final List<PlayerClass> dualClassList = new ArrayList<>();
static
{
dualClassList.addAll(Arrays.asList(PlayerClass.sigelPhoenixKnight, PlayerClass.sigelHellKnight, PlayerClass.sigelEvasTemplar, PlayerClass.sigelShilenTemplar));
dualClassList.addAll(Arrays.asList(PlayerClass.tyrrDuelist, PlayerClass.tyrrDreadnought, PlayerClass.tyrrTitan, PlayerClass.tyrrGrandKhavatari, PlayerClass.tyrrDoombringer));

View File

@@ -62,7 +62,8 @@ public final class Antharas extends AbstractNpcAI
private static final int BOMBER = 29070; // Dragon Bomber
private static final int HEART = 13001; // Heart of Warding
private static final int CUBE = 31859; // Teleportation Cubic
private static final Map<Integer, Location> INVISIBLE_NPC = new HashMap<>();
private static final Map<Integer, Location> INVISIBLE_NPC = new HashMap<>();
static
{
INVISIBLE_NPC.put(29077, new Location(177229, 113298, -7735));
INVISIBLE_NPC.put(29078, new Location(176707, 113585, -7735));

View File

@@ -49,7 +49,8 @@ public final class Core extends AbstractNpcAI
private static final int DOOM_WRAITH = 29008;
private static final int SUSCEPTOR = 29011;
// Spawns
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
static
{
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488));
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17564, 109548, -6488));

View File

@@ -66,7 +66,8 @@ import ai.AbstractNpcAI;
public final class ClassMaster extends AbstractNpcAI implements IXmlReader
{
// NPCs
private static final List<Integer> CLASS_MASTERS = new ArrayList<>();
private static final List<Integer> CLASS_MASTERS = new ArrayList<>();
static
{
CLASS_MASTERS.add(31756); // Mr. Cat
CLASS_MASTERS.add(31757); // Queen of Hearts

View File

@@ -55,7 +55,8 @@ public final class OlyManager extends AbstractNpcAI implements IBypassHandler
// NPC
private static final int MANAGER = 31688;
// Misc
private static final Map<CategoryType, Integer> EQUIPMENT_MULTISELL = new HashMap<>();
private static final Map<CategoryType, Integer> EQUIPMENT_MULTISELL = new HashMap<>();
static
{
EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_SIGEL_GROUP, 917);
EQUIPMENT_MULTISELL.put(CategoryType.SIXTH_TIR_GROUP, 918);

View File

@@ -1,121 +1,122 @@
/*
* 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 handlers.effecthandlers;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.World;
import com.l2jmobius.gameserver.model.actor.Creature;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectType;
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest;
/**
* @author Mobius
*/
public final class AirBind extends AbstractEffect
{
// skill data
/*
* 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 handlers.effecthandlers;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.ai.CtrlEvent;
import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.model.StatsSet;
import com.l2jmobius.gameserver.model.World;
import com.l2jmobius.gameserver.model.actor.Creature;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.effects.AbstractEffect;
import com.l2jmobius.gameserver.model.effects.EffectType;
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.network.serverpackets.ExAlterSkillRequest;
/**
* @author Mobius
*/
public final class AirBind extends AbstractEffect
{
// skill data
private static final Map<ClassId, Integer> _chainedAirSkills = new HashMap<>(36);
{
_chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit
_chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit
_chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit
_chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit
_chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit
_chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit
}
public AirBind(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return false;
}
@Override
public EffectType getEffectType()
{
return EffectType.KNOCK;
}
@Override
public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200))
{
if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) //
&& nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive())
{
final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId());
if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1)
{
nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5));
}
}
}
}
@Override
public void onExit(Creature effector, Creature effected, Skill skill)
{
if (!effected.isPlayer())
{
effected.getAI().notifyEvent(CtrlEvent.EVT_THINK);
}
}
}
static
{
_chainedAirSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.SIGEL_EVA_TEMPLAR, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.SIGEL_SHILLIEN_TEMPLAR, 10249); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_DUELIST, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_DREADNOUGHT, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_TITAN, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_GRAND_KHAVATARI, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_MAESTRO, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.TYRR_DOOMBRINGER, 10499); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_ADVENTURER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_WIND_RIDER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_GHOST_HUNTER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.OTHELL_FORTUNE_SEEKER, 10749); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_SAGITTARIUS, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_MOONLIGHT_SENTINEL, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_GHOST_SENTINEL, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.YUL_TRICKSTER, 10999); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_ARCHMAGE, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_SOULTAKER, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_MYSTIC_MUSE, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_STORM_SCREAMER, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.FEOH_SOUL_HOUND, 11249); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_HIEROPHANT, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_SWORD_MUSE, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_SPECTRAL_DANCER, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_DOMINATOR, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.ISS_DOOMCRYER, 11749); // Heavy Hit
_chainedAirSkills.put(ClassId.WYNN_ARCANA_LORD, 11499); // Heavy Hit
_chainedAirSkills.put(ClassId.WYNN_ELEMENTAL_MASTER, 11499); // Heavy Hit
_chainedAirSkills.put(ClassId.WYNN_SPECTRAL_MASTER, 11499); // Heavy Hit
_chainedAirSkills.put(ClassId.AEORE_CARDINAL, 11999); // Heavy Hit
_chainedAirSkills.put(ClassId.AEORE_EVA_SAINT, 11999); // Heavy Hit
_chainedAirSkills.put(ClassId.AEORE_SHILLIEN_SAINT, 11999); // Heavy Hit
}
public AirBind(StatsSet params)
{
}
@Override
public boolean isInstant()
{
return false;
}
@Override
public EffectType getEffectType()
{
return EffectType.KNOCK;
}
@Override
public void continuousInstant(Creature effector, Creature effected, Skill skill, ItemInstance item)
{
for (PlayerInstance nearbyPlayer : World.getInstance().getVisibleObjectsInRange(effected, PlayerInstance.class, 1200))
{
if ((nearbyPlayer.getRace() != Race.ERTHEIA) && (nearbyPlayer.getTarget() == effected) //
&& nearbyPlayer.isInCategory(CategoryType.SIXTH_CLASS_GROUP) && !nearbyPlayer.isAlterSkillActive())
{
final int chainSkill = _chainedAirSkills.get(nearbyPlayer.getClassId());
if (nearbyPlayer.getSkillRemainingReuseTime(chainSkill) == -1)
{
nearbyPlayer.sendPacket(new ExAlterSkillRequest(nearbyPlayer, chainSkill, chainSkill, 5));
}
}
}
}
@Override
public void onExit(Creature effector, Creature effected, Skill skill)
{
if (!effected.isPlayer())
{
effected.getAI().notifyEvent(CtrlEvent.EVT_THINK);
}
}
}

View File

@@ -55,7 +55,8 @@ public final class KnockBack extends AbstractEffect
private final FlyType _type;
// skill data
private static final Map<ClassId, Integer> _chainKnockSkills = new HashMap<>(36);
private static final Map<ClassId, Integer> _chainKnockSkills = new HashMap<>(36);
static
{
_chainKnockSkills.put(ClassId.SIGEL_PHOENIX_KNIGHT, 10250); // Heavy Hit
_chainKnockSkills.put(ClassId.SIGEL_HELL_KNIGHT, 10250); // Heavy Hit

View File

@@ -1,87 +1,88 @@
/*
* 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 handlers.itemhandlers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.enums.ItemGrade;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.handler.IItemHandler;
import com.l2jmobius.gameserver.model.ItemInfo;
import com.l2jmobius.gameserver.model.actor.Playable;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList;
/**
* @author Mobius
*/
public class ChangeAttributeCrystal implements IItemHandler
{
/*
* 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 handlers.itemhandlers;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.l2jmobius.gameserver.enums.ItemGrade;
import com.l2jmobius.gameserver.enums.PrivateStoreType;
import com.l2jmobius.gameserver.handler.IItemHandler;
import com.l2jmobius.gameserver.model.ItemInfo;
import com.l2jmobius.gameserver.model.actor.Playable;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.items.instance.ItemInstance;
import com.l2jmobius.gameserver.network.SystemMessageId;
import com.l2jmobius.gameserver.network.serverpackets.SystemMessage;
import com.l2jmobius.gameserver.network.serverpackets.attributechange.ExChangeAttributeItemList;
/**
* @author Mobius
*/
public class ChangeAttributeCrystal implements IItemHandler
{
private static final Map<Integer, ItemGrade> ITEM_GRADES = new HashMap<>();
{
ITEM_GRADES.put(33502, ItemGrade.S);
ITEM_GRADES.put(35749, ItemGrade.R);
ITEM_GRADES.put(45817, ItemGrade.R);
}
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (!playable.isPlayer())
{
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
return false;
}
final PlayerInstance player = playable.getActingPlayer();
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP));
return false;
}
if (ITEM_GRADES.get(item.getId()) == null)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED));
return false;
}
final List<ItemInfo> itemList = new ArrayList<>();
for (ItemInstance i : player.getInventory().getItems())
{
if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId())))
{
itemList.add(new ItemInfo(i));
}
}
if (itemList.isEmpty())
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST));
return false;
}
player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()])));
return true;
}
static
{
ITEM_GRADES.put(33502, ItemGrade.S);
ITEM_GRADES.put(35749, ItemGrade.R);
ITEM_GRADES.put(45817, ItemGrade.R);
}
@Override
public boolean useItem(Playable playable, ItemInstance item, boolean forceUse)
{
if (!playable.isPlayer())
{
playable.sendPacket(SystemMessageId.YOUR_PET_CANNOT_CARRY_THIS_ITEM);
return false;
}
final PlayerInstance player = playable.getActingPlayer();
if (player.getPrivateStoreType() != PrivateStoreType.NONE)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_CANNOT_CHANGE_AN_ATTRIBUTE_WHILE_USING_A_PRIVATE_STORE_OR_WORKSHOP));
return false;
}
if (ITEM_GRADES.get(item.getId()) == null)
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.CHANGING_ATTRIBUTES_HAS_BEEN_FAILED));
return false;
}
final List<ItemInfo> itemList = new ArrayList<>();
for (ItemInstance i : player.getInventory().getItems())
{
if (i.isWeapon() && i.hasAttributes() && (i.getItem().getItemGrade() == ITEM_GRADES.get(item.getId())))
{
itemList.add(new ItemInfo(i));
}
}
if (itemList.isEmpty())
{
player.sendPacket(SystemMessage.getSystemMessage(SystemMessageId.THE_ITEM_FOR_CHANGING_AN_ATTRIBUTE_DOES_NOT_EXIST));
return false;
}
player.sendPacket(new ExChangeAttributeItemList(item.getId(), itemList.toArray(new ItemInfo[itemList.size()])));
return true;
}
}

View File

@@ -46,7 +46,8 @@ public final class Q00032_AnObviousLie extends Quest
// Misc
private static final int MIN_LVL = 45;
// Reward
private static final Map<String, Integer> EARS = new HashMap<>();
private static final Map<String, Integer> EARS = new HashMap<>();
static
{
EARS.put("cat", 6843); // Cat Ears
EARS.put("raccoon", 7680); // Raccoon ears

View File

@@ -45,7 +45,7 @@ public final class Q00344_1000YearsTheEndOfLamentation extends Quest
private static final ItemHolder CRUCIFIX = new ItemHolder(4273, 1);
// Monsters
private static final Map<Integer, Double> MONSTER_CHANCES = new HashMap<>();
static
{
MONSTER_CHANCES.put(20236, 0.58); // Cave Servant
MONSTER_CHANCES.put(20238, 0.75); // Cave Servant Warrior

View File

@@ -103,7 +103,8 @@ public final class Q00420_LittleWing extends Quest
private static final int HATCHLING_FOOD = 4038;
private static final List<Integer> EGGS = Arrays.asList(EXARION_EGG, SUZET_EGG, KALIBRAN_EGG, SHAMHAI_EGG, ZWOV_EGG);
// Drake Drops
private static final Map<Integer, Integer> EGG_DROPS = new HashMap<>();
private static final Map<Integer, Integer> EGG_DROPS = new HashMap<>();
static
{
EGG_DROPS.put(LESSER_BASILISK, SHAMHAI_EGG);
EGG_DROPS.put(BASILISK, SHAMHAI_EGG);

View File

@@ -1,194 +1,195 @@
/*
* 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 quests.Q10790_AMercenaryHelper;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.model.actor.Npc;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.quest.QuestState;
import com.l2jmobius.gameserver.model.quest.State;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList;
import com.l2jmobius.gameserver.util.Util;
/**
* A Mercenary Helper (10790)
* @author Stayway
*/
public class Q10790_AMercenaryHelper extends Quest
{
// NPC
private static final int DOKARA = 33847;
// Monsters
private static final int SPLINTER_STAKATO = 21508;
private static final int SPLINTER_STAKATO_WORKER = 21509;
private static final int SPLINTER_STAKATO_SOLDIER = 21510;
private static final int SPLINTER_STAKATO_DRONE = 21511;
private static final int NEEDLE_STAKATO = 21513;
private static final int NEEDLE_STAKATO_WORKER = 21514;
private static final int NEEDLE_STAKATO_SOLDIER = 21515;
private static final int NEEDLE_STAKATO_DRONE = 21516;
/*
* 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 quests.Q10790_AMercenaryHelper;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.gameserver.enums.Race;
import com.l2jmobius.gameserver.model.actor.Npc;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.base.ClassId;
import com.l2jmobius.gameserver.model.holders.ItemHolder;
import com.l2jmobius.gameserver.model.quest.Quest;
import com.l2jmobius.gameserver.model.quest.QuestState;
import com.l2jmobius.gameserver.model.quest.State;
import com.l2jmobius.gameserver.network.NpcStringId;
import com.l2jmobius.gameserver.network.serverpackets.ExQuestNpcLogList;
import com.l2jmobius.gameserver.util.Util;
/**
* A Mercenary Helper (10790)
* @author Stayway
*/
public class Q10790_AMercenaryHelper extends Quest
{
// NPC
private static final int DOKARA = 33847;
// Monsters
private static final int SPLINTER_STAKATO = 21508;
private static final int SPLINTER_STAKATO_WORKER = 21509;
private static final int SPLINTER_STAKATO_SOLDIER = 21510;
private static final int SPLINTER_STAKATO_DRONE = 21511;
private static final int NEEDLE_STAKATO = 21513;
private static final int NEEDLE_STAKATO_WORKER = 21514;
private static final int NEEDLE_STAKATO_SOLDIER = 21515;
private static final int NEEDLE_STAKATO_DRONE = 21516;
private static final Map<Integer, Integer> MOBS_REQUIRED = new HashMap<>();
{
MOBS_REQUIRED.put(SPLINTER_STAKATO, 50);
}
// Item
private static final ItemHolder GUILD_COIN = new ItemHolder(37045, 3);
private static final ItemHolder ENCHANT_ARMOR_A = new ItemHolder(26351, 3);
// Rewards
private static final int EXP_REWARD = 942690;
private static final int SP_REWARD = 226;
// Other
private static final int MIN_LEVEL = 65;
private static final int MAX_LEVEL = 70;
public Q10790_AMercenaryHelper()
{
super(10790);
addStartNpc(DOKARA);
addTalkId(DOKARA);
addKillId(SPLINTER_STAKATO, SPLINTER_STAKATO_WORKER, SPLINTER_STAKATO_SOLDIER, SPLINTER_STAKATO_DRONE, NEEDLE_STAKATO, NEEDLE_STAKATO_WORKER, NEEDLE_STAKATO_SOLDIER, NEEDLE_STAKATO_DRONE);
addCondMinLevel(MIN_LEVEL, "no_level.htm");
addCondRace(Race.ERTHEIA, "no Ertheia.html");
addCondClassId(ClassId.MARAUDER, "no_class.html");
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, false);
if (qs == null)
{
return null;
}
String htmltext = null;
switch (event)
{
case "33847-02.htm":
case "33847-03.htm":
{
htmltext = event;
break;
}
case "33847-04.htm": // start the quest
{
qs.startQuest();
qs.set(Integer.toString(SPLINTER_STAKATO), 0);
htmltext = event;
break;
}
case "33847-07.html":
{
if (qs.isCond(2))
{
giveItems(player, GUILD_COIN);
giveItems(player, ENCHANT_ARMOR_A);
addExpAndSp(player, EXP_REWARD, SP_REWARD);
qs.exitQuest(false, true);
htmltext = event;
}
break;
}
}
return htmltext;
}
@Override
public String onTalk(Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, true);
String htmltext = null;
switch (qs.getState())
{
case State.CREATED:
{
if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL))
{
htmltext = "no_level.html";
}
else
{
htmltext = "33847-01.htm";
}
break;
}
case State.STARTED:
{
if (qs.isCond(1))
{
htmltext = "33847-05.html"; // Need find proper html
}
else if (qs.isCond(2))
{
htmltext = "33847-06.html";
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(player);
break;
}
}
return htmltext;
}
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
if ((qs != null) && qs.isStarted() && qs.isCond(1) && Util.checkIfInRange(1500, npc, qs.getPlayer(), false))
{
int kills = 0;
switch (npc.getId())
{
case SPLINTER_STAKATO:
case SPLINTER_STAKATO_WORKER:
case SPLINTER_STAKATO_SOLDIER:
case SPLINTER_STAKATO_DRONE:
case NEEDLE_STAKATO:
case NEEDLE_STAKATO_WORKER:
case NEEDLE_STAKATO_SOLDIER:
case NEEDLE_STAKATO_DRONE:
{
kills = qs.getInt(Integer.toString(SPLINTER_STAKATO));
kills++;
qs.set(Integer.toString(SPLINTER_STAKATO), kills);
break;
}
}
final ExQuestNpcLogList log = new ExQuestNpcLogList(getId());
log.addNpc(SPLINTER_STAKATO, qs.getInt(Integer.toString(SPLINTER_STAKATO)));
log.addNpcString(NpcStringId.KILL_STAKATOS, qs.getInt(Integer.toString(SPLINTER_STAKATO)));
killer.sendPacket(log);
if ((qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)) && (qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)))
{
qs.setCond(2);
}
}
return super.onKill(npc, killer, isSummon);
}
}
static
{
MOBS_REQUIRED.put(SPLINTER_STAKATO, 50);
}
// Item
private static final ItemHolder GUILD_COIN = new ItemHolder(37045, 3);
private static final ItemHolder ENCHANT_ARMOR_A = new ItemHolder(26351, 3);
// Rewards
private static final int EXP_REWARD = 942690;
private static final int SP_REWARD = 226;
// Other
private static final int MIN_LEVEL = 65;
private static final int MAX_LEVEL = 70;
public Q10790_AMercenaryHelper()
{
super(10790);
addStartNpc(DOKARA);
addTalkId(DOKARA);
addKillId(SPLINTER_STAKATO, SPLINTER_STAKATO_WORKER, SPLINTER_STAKATO_SOLDIER, SPLINTER_STAKATO_DRONE, NEEDLE_STAKATO, NEEDLE_STAKATO_WORKER, NEEDLE_STAKATO_SOLDIER, NEEDLE_STAKATO_DRONE);
addCondMinLevel(MIN_LEVEL, "no_level.htm");
addCondRace(Race.ERTHEIA, "no Ertheia.html");
addCondClassId(ClassId.MARAUDER, "no_class.html");
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, false);
if (qs == null)
{
return null;
}
String htmltext = null;
switch (event)
{
case "33847-02.htm":
case "33847-03.htm":
{
htmltext = event;
break;
}
case "33847-04.htm": // start the quest
{
qs.startQuest();
qs.set(Integer.toString(SPLINTER_STAKATO), 0);
htmltext = event;
break;
}
case "33847-07.html":
{
if (qs.isCond(2))
{
giveItems(player, GUILD_COIN);
giveItems(player, ENCHANT_ARMOR_A);
addExpAndSp(player, EXP_REWARD, SP_REWARD);
qs.exitQuest(false, true);
htmltext = event;
}
break;
}
}
return htmltext;
}
@Override
public String onTalk(Npc npc, PlayerInstance player)
{
final QuestState qs = getQuestState(player, true);
String htmltext = null;
switch (qs.getState())
{
case State.CREATED:
{
if ((player.getLevel() < MIN_LEVEL) || (player.getLevel() > MAX_LEVEL))
{
htmltext = "no_level.html";
}
else
{
htmltext = "33847-01.htm";
}
break;
}
case State.STARTED:
{
if (qs.isCond(1))
{
htmltext = "33847-05.html"; // Need find proper html
}
else if (qs.isCond(2))
{
htmltext = "33847-06.html";
}
break;
}
case State.COMPLETED:
{
htmltext = getAlreadyCompletedMsg(player);
break;
}
}
return htmltext;
}
@Override
public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{
final QuestState qs = getRandomPartyMemberState(killer, -1, 3, npc);
if ((qs != null) && qs.isStarted() && qs.isCond(1) && Util.checkIfInRange(1500, npc, qs.getPlayer(), false))
{
int kills = 0;
switch (npc.getId())
{
case SPLINTER_STAKATO:
case SPLINTER_STAKATO_WORKER:
case SPLINTER_STAKATO_SOLDIER:
case SPLINTER_STAKATO_DRONE:
case NEEDLE_STAKATO:
case NEEDLE_STAKATO_WORKER:
case NEEDLE_STAKATO_SOLDIER:
case NEEDLE_STAKATO_DRONE:
{
kills = qs.getInt(Integer.toString(SPLINTER_STAKATO));
kills++;
qs.set(Integer.toString(SPLINTER_STAKATO), kills);
break;
}
}
final ExQuestNpcLogList log = new ExQuestNpcLogList(getId());
log.addNpc(SPLINTER_STAKATO, qs.getInt(Integer.toString(SPLINTER_STAKATO)));
log.addNpcString(NpcStringId.KILL_STAKATOS, qs.getInt(Integer.toString(SPLINTER_STAKATO)));
killer.sendPacket(log);
if ((qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)) && (qs.getInt(Integer.toString(SPLINTER_STAKATO)) >= MOBS_REQUIRED.get(SPLINTER_STAKATO)))
{
qs.setCond(2);
}
}
return super.onKill(npc, killer, isSummon);
}
}