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

@@ -1,491 +1,495 @@
/*
* 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.others.AdventureGuildsman;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.model.actor.Npc;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
import com.l2jmobius.gameserver.network.serverpackets.ExShowQuestInfo;
import ai.AbstractNpcAI;
/**
* Adventure Guildsman AI.
* @author ChaosPaladin
*/
public class AdventureGuildsman extends AbstractNpcAI
{
// NPC
private static final int ADVENTURE_GUILDSMAN = 33946;
// Items
private static final int PCCAFE_LOTTERY_TICKET_30DAYS = 15358;
private static final int PCCAFE_1ST_LOTTERY_TICKET_30DAYS = 15359;
private static final int PCCAFE_2ND_LOTTERY_TICKET_30DAYS = 15360;
private static final int PCCAFE_3RD_LOTTERY_TICKET_30DAYS = 15361;
private static final int PCCAFE_4TH_LOTTERY_TICKET_30DAYS = 15362;
private static final int PCCAFE_5TH_LOTTERY_TICKET_30DAYS = 15363;
private static final int VOUCHER_LEV_85 = 17739;
private static final int VOUCHER_LEV_90 = 17740;
private static final int VOUCHER_LEV_95 = 17741;
private static final int VOUCHER_LEV_97 = 17742;
private static final int SEAL_LEV_85 = 17743;
private static final int SEAL_LEV_90 = 17744;
private static final int SEAL_LEV_95 = 17745;
private static final int SEAL_LEV_97 = 17746;
// Skills
private static final SkillHolder KNIGHT = new SkillHolder(17294, 1); // Player Commendation - Knight's Harmony
private static final SkillHolder WARRIOR = new SkillHolder(17295, 1); // Player Commendation - Warrior's Harmony
private static final SkillHolder WIZARD = new SkillHolder(17296, 1); // Player Commendation - Wizard's Harmony
private static final SkillHolder[] GROUP_MELODY =
{
new SkillHolder(9273, 1), // Player Commendation - Horn Melody
new SkillHolder(9274, 1), // Player Commendation - Drum Melody
new SkillHolder(9275, 1), // Player Commendation - Lute Melody
new SkillHolder(9276, 1), // Player Commendation - Pipe Organ Melody
new SkillHolder(9277, 1), // Player Commendation - Guitar Melody
new SkillHolder(9278, 1), // Player Commendation - Harp Melody
};
private static final SkillHolder[] GROUP_SONATA =
{
new SkillHolder(17291, 1), // Player Commendation - Prevailing Sonata
new SkillHolder(17292, 1), // Player Commendation - Daring Sonata
new SkillHolder(17293, 1), // Player Commendation - Refreshing Sonata
};
// Misc
//@formatter:off
/*
* 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.others.AdventureGuildsman;
import java.util.HashMap;
import java.util.Map;
import com.l2jmobius.commons.util.CommonUtil;
import com.l2jmobius.gameserver.data.xml.impl.MultisellData;
import com.l2jmobius.gameserver.enums.CategoryType;
import com.l2jmobius.gameserver.model.actor.Npc;
import com.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import com.l2jmobius.gameserver.model.holders.SkillHolder;
import com.l2jmobius.gameserver.model.skills.Skill;
import com.l2jmobius.gameserver.model.skills.SkillCaster;
import com.l2jmobius.gameserver.network.serverpackets.ExShowQuestInfo;
import ai.AbstractNpcAI;
/**
* Adventure Guildsman AI.
* @author ChaosPaladin
*/
public class AdventureGuildsman extends AbstractNpcAI
{
// NPC
private static final int ADVENTURE_GUILDSMAN = 33946;
// Items
private static final int PCCAFE_LOTTERY_TICKET_30DAYS = 15358;
private static final int PCCAFE_1ST_LOTTERY_TICKET_30DAYS = 15359;
private static final int PCCAFE_2ND_LOTTERY_TICKET_30DAYS = 15360;
private static final int PCCAFE_3RD_LOTTERY_TICKET_30DAYS = 15361;
private static final int PCCAFE_4TH_LOTTERY_TICKET_30DAYS = 15362;
private static final int PCCAFE_5TH_LOTTERY_TICKET_30DAYS = 15363;
private static final int VOUCHER_LEV_85 = 17739;
private static final int VOUCHER_LEV_90 = 17740;
private static final int VOUCHER_LEV_95 = 17741;
private static final int VOUCHER_LEV_97 = 17742;
private static final int SEAL_LEV_85 = 17743;
private static final int SEAL_LEV_90 = 17744;
private static final int SEAL_LEV_95 = 17745;
private static final int SEAL_LEV_97 = 17746;
// Skills
private static final SkillHolder KNIGHT = new SkillHolder(17294, 1); // Player Commendation - Knight's Harmony
private static final SkillHolder WARRIOR = new SkillHolder(17295, 1); // Player Commendation - Warrior's Harmony
private static final SkillHolder WIZARD = new SkillHolder(17296, 1); // Player Commendation - Wizard's Harmony
private static final SkillHolder[] GROUP_MELODY =
{
new SkillHolder(9273, 1), // Player Commendation - Horn Melody
new SkillHolder(9274, 1), // Player Commendation - Drum Melody
new SkillHolder(9275, 1), // Player Commendation - Lute Melody
new SkillHolder(9276, 1), // Player Commendation - Pipe Organ Melody
new SkillHolder(9277, 1), // Player Commendation - Guitar Melody
new SkillHolder(9278, 1), // Player Commendation - Harp Melody
};
private static final SkillHolder[] GROUP_SONATA =
{
new SkillHolder(17291, 1), // Player Commendation - Prevailing Sonata
new SkillHolder(17292, 1), // Player Commendation - Daring Sonata
new SkillHolder(17293, 1), // Player Commendation - Refreshing Sonata
};
// Misc
//@formatter:off
private static final Map<CategoryType, Integer> R_CLASS_TALISMAN = new HashMap<>();
{
R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 737);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 738);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 739);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 740);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 741);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 742);
R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736);
R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741);
}
static
{
R_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 735);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 736);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 737);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 738);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 739);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 740);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 741);
R_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 742);
R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 736);
R_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 741);
}
private static final Map<CategoryType, Integer> R90_CLASS_TALISMAN = new HashMap<>();
{
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 745);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 746);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 747);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 748);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 749);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 750);
R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744);
R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749);
}
static
{
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 743);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 744);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 745);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 746);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 747);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 748);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 749);
R90_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 750);
R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 744);
R90_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 749);
}
private static final Map<CategoryType, Integer> R95_CLASS_TALISMAN = new HashMap<>();
{
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 753);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 754);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 755);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 756);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 757);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 758);
R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752);
R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757);
}
static
{
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 751);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 752);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 753);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 754);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 755);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 756);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 757);
R95_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 758);
R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 752);
R95_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 757);
}
private static final Map<CategoryType, Integer> R99_CLASS_TALISMAN = new HashMap<>();
{
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 761);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 762);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 763);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 764);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 765);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 766);
R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 760);
R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 765);
}
//@formatter:on
private static final String USED_PC_LOTTERY_TICKET = "USED_PC_LOTTERY_TICKET";
private AdventureGuildsman()
{
addStartNpc(ADVENTURE_GUILDSMAN);
addTalkId(ADVENTURE_GUILDSMAN);
addFirstTalkId(ADVENTURE_GUILDSMAN);
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = null;
switch (event)
{
case "pccafe_list":
{
htmltext = "pccafe_list001.htm";
break;
}
case "quest_list":
{
player.sendPacket(ExShowQuestInfo.STATIC_PACKET);
break;
}
case "buff_list":
{
htmltext = "pccafe_buff_1001.htm";
break;
}
case "item_list":
{
htmltext = "pccafe_item001.htm";
break;
}
case "pccafe_help_inzone001.htm":
case "pccafe_help_lottery001.htm":
case "pccafe_help_lottery002.htm":
case "adventurer_agent_town_voucher_change.htm":
case "life_crystal_merge001.htm":
case "life_crystal_merge002.htm":
case "voucher_trader1001.htm":
case "voucher_trader2001.htm":
case "voucher_trader3001.htm":
case "voucher_trader4001.htm":
case "voucher_trader1004.htm":
case "voucher_trader2004.htm":
case "voucher_trader3004.htm":
case "voucher_trader4004.htm":
case "voucher_trader1005.htm":
case "voucher_trader2005.htm":
case "voucher_trader3005.htm":
case "voucher_trader4005.htm":
case "voucher_trader1006.htm":
case "voucher_trader2006.htm":
case "voucher_trader3006.htm":
case "voucher_trader4006.htm":
{
htmltext = event;
break;
}
case "index":
{
htmltext = player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm";
break;
}
case "buff_setlist":
{
htmltext = "pccafe_newbuff_001.htm";
break;
}
case "buff_group":
{
htmltext = player.getPcCafePoints() >= 120 ? applyBuffsGroup(npc, player, GROUP_MELODY.length) : "pccafe_buff_1001.htm";
break;
}
case "knight":
{
htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, KNIGHT.getSkill()) : "pccafe_buff_1001.htm";
break;
}
case "warrior":
{
htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WARRIOR.getSkill()) : "pccafe_buff_1001.htm";
break;
}
case "wizard":
{
htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WIZARD.getSkill()) : "pccafe_buff_1001.htm";
break;
}
case "give_lottery_ticket":
{
if (!player.getVariables().getBoolean(USED_PC_LOTTERY_TICKET, false))
{
player.getVariables().set(USED_PC_LOTTERY_TICKET, true);
giveItems(player, PCCAFE_LOTTERY_TICKET_30DAYS, 1);
}
else
{
htmltext = "pccafe_help_lottery_notoneday.htm";
}
break;
}
case "trade_10":
{
htmltext = tradeItem(player, PCCAFE_5TH_LOTTERY_TICKET_30DAYS, 10);
break;
}
case "trade_100":
{
htmltext = tradeItem(player, PCCAFE_4TH_LOTTERY_TICKET_30DAYS, 100);
break;
}
case "trade_200":
{
htmltext = tradeItem(player, PCCAFE_3RD_LOTTERY_TICKET_30DAYS, 200);
break;
}
case "trade_1000":
{
htmltext = tradeItem(player, PCCAFE_2ND_LOTTERY_TICKET_30DAYS, 1000);
break;
}
case "trade_10000":
{
htmltext = tradeItem(player, PCCAFE_1ST_LOTTERY_TICKET_30DAYS, 10000);
break;
}
case "trade_seal85":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_85))
{
takeItems(player, VOUCHER_LEV_85, 1);
giveItems(player, SEAL_LEV_85, 20);
addExpAndSp(player, 60000000, 0);
}
else
{
htmltext = "voucher_trader1003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "trade_seal90":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_90))
{
takeItems(player, VOUCHER_LEV_90, 1);
giveItems(player, SEAL_LEV_90, 20);
addExpAndSp(player, 66000000, 0);
}
else
{
htmltext = "voucher_trader2003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "trade_seal95":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_95))
{
takeItems(player, VOUCHER_LEV_95, 1);
giveItems(player, SEAL_LEV_95, 20);
addExpAndSp(player, 68000000, 0);
}
else
{
htmltext = "voucher_trader3003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "trade_seal97":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_97))
{
takeItems(player, VOUCHER_LEV_97, 1);
giveItems(player, SEAL_LEV_97, 20);
addExpAndSp(player, 76000000, 0);
}
else
{
htmltext = "voucher_trader3003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "give_talismanR_by_class":
{
int multisellId = -1;
for (CategoryType type : R_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
case "give_talismanR90_by_class":
{
int multisellId = -1;
for (CategoryType type : R90_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R90_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
case "give_talismanR95_by_class":
{
int multisellId = -1;
for (CategoryType type : R95_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R95_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
case "give_talismanR99_by_class":
{
int multisellId = -1;
for (CategoryType type : R99_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R99_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
}
if (event.startsWith("melody"))
{
final int buffOffset = CommonUtil.constrain(Integer.parseInt(event.substring(event.indexOf(" ") + 1)), 0, GROUP_MELODY.length);
if (player.getPcCafePoints() >= 20)
{
npc.setTarget(player);
npc.doCast(GROUP_MELODY[buffOffset].getSkill());
player.setPcCafePoints(player.getPcCafePoints() - 20);
htmltext = "pccafe_buff_1001.htm";
}
else
{
htmltext = "pccafe_notpoint001.htm";
}
}
return htmltext;
}
private String applyBuffs(Npc npc, PlayerInstance player, Skill skill)
{
for (SkillHolder holder : GROUP_MELODY)
{
SkillCaster.triggerCast(npc, player, holder.getSkill());
}
for (SkillHolder holder : GROUP_SONATA)
{
SkillCaster.triggerCast(npc, player, holder.getSkill());
}
SkillCaster.triggerCast(npc, player, skill);
player.setPcCafePoints(player.getPcCafePoints() - 200);
return null;
}
private String applyBuffsGroup(Npc npc, PlayerInstance player, int length)
{
for (SkillHolder holder : GROUP_MELODY)
{
SkillCaster.triggerCast(npc, player, holder.getSkill());
}
player.setPcCafePoints(player.getPcCafePoints() - 120);
return null;
}
private String tradeItem(PlayerInstance player, int itemId, int points)
{
if (player.getPcCafePoints() >= 200000)
{
return "pccafe_help_lottery_fail2.htm";
}
if (takeItems(player, itemId, 1))
{
player.setPcCafePoints(player.getPcCafePoints() + points);
return "pccafe_help_lottery003.htm";
}
return "pccafe_help_lottery_fail.htm";
}
@Override
public String onFirstTalk(Npc npc, PlayerInstance player)
{
return player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm";
}
public static void main(String[] args)
{
new AdventureGuildsman();
}
}
static
{
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_SIGEL_GROUP, 759);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_TIR_GROUP, 760);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_OTHEL_GROUP, 761);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_YR_GROUP, 762);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_WYNN_GROUP, 763);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_IS_GROUP, 764);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_FEOH_GROUP, 765);
R99_CLASS_TALISMAN.put(CategoryType.SIXTH_EOLH_GROUP, 766);
R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_FIGHTER_GROUP, 760);
R99_CLASS_TALISMAN.put(CategoryType.ERTHEIA_WIZARD_GROUP, 765);
}
//@formatter:on
private static final String USED_PC_LOTTERY_TICKET = "USED_PC_LOTTERY_TICKET";
private AdventureGuildsman()
{
addStartNpc(ADVENTURE_GUILDSMAN);
addTalkId(ADVENTURE_GUILDSMAN);
addFirstTalkId(ADVENTURE_GUILDSMAN);
}
@Override
public String onAdvEvent(String event, Npc npc, PlayerInstance player)
{
String htmltext = null;
switch (event)
{
case "pccafe_list":
{
htmltext = "pccafe_list001.htm";
break;
}
case "quest_list":
{
player.sendPacket(ExShowQuestInfo.STATIC_PACKET);
break;
}
case "buff_list":
{
htmltext = "pccafe_buff_1001.htm";
break;
}
case "item_list":
{
htmltext = "pccafe_item001.htm";
break;
}
case "pccafe_help_inzone001.htm":
case "pccafe_help_lottery001.htm":
case "pccafe_help_lottery002.htm":
case "adventurer_agent_town_voucher_change.htm":
case "life_crystal_merge001.htm":
case "life_crystal_merge002.htm":
case "voucher_trader1001.htm":
case "voucher_trader2001.htm":
case "voucher_trader3001.htm":
case "voucher_trader4001.htm":
case "voucher_trader1004.htm":
case "voucher_trader2004.htm":
case "voucher_trader3004.htm":
case "voucher_trader4004.htm":
case "voucher_trader1005.htm":
case "voucher_trader2005.htm":
case "voucher_trader3005.htm":
case "voucher_trader4005.htm":
case "voucher_trader1006.htm":
case "voucher_trader2006.htm":
case "voucher_trader3006.htm":
case "voucher_trader4006.htm":
{
htmltext = event;
break;
}
case "index":
{
htmltext = player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm";
break;
}
case "buff_setlist":
{
htmltext = "pccafe_newbuff_001.htm";
break;
}
case "buff_group":
{
htmltext = player.getPcCafePoints() >= 120 ? applyBuffsGroup(npc, player, GROUP_MELODY.length) : "pccafe_buff_1001.htm";
break;
}
case "knight":
{
htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, KNIGHT.getSkill()) : "pccafe_buff_1001.htm";
break;
}
case "warrior":
{
htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WARRIOR.getSkill()) : "pccafe_buff_1001.htm";
break;
}
case "wizard":
{
htmltext = player.getPcCafePoints() >= 200 ? applyBuffs(npc, player, WIZARD.getSkill()) : "pccafe_buff_1001.htm";
break;
}
case "give_lottery_ticket":
{
if (!player.getVariables().getBoolean(USED_PC_LOTTERY_TICKET, false))
{
player.getVariables().set(USED_PC_LOTTERY_TICKET, true);
giveItems(player, PCCAFE_LOTTERY_TICKET_30DAYS, 1);
}
else
{
htmltext = "pccafe_help_lottery_notoneday.htm";
}
break;
}
case "trade_10":
{
htmltext = tradeItem(player, PCCAFE_5TH_LOTTERY_TICKET_30DAYS, 10);
break;
}
case "trade_100":
{
htmltext = tradeItem(player, PCCAFE_4TH_LOTTERY_TICKET_30DAYS, 100);
break;
}
case "trade_200":
{
htmltext = tradeItem(player, PCCAFE_3RD_LOTTERY_TICKET_30DAYS, 200);
break;
}
case "trade_1000":
{
htmltext = tradeItem(player, PCCAFE_2ND_LOTTERY_TICKET_30DAYS, 1000);
break;
}
case "trade_10000":
{
htmltext = tradeItem(player, PCCAFE_1ST_LOTTERY_TICKET_30DAYS, 10000);
break;
}
case "trade_seal85":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_85))
{
takeItems(player, VOUCHER_LEV_85, 1);
giveItems(player, SEAL_LEV_85, 20);
addExpAndSp(player, 60000000, 0);
}
else
{
htmltext = "voucher_trader1003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "trade_seal90":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_90))
{
takeItems(player, VOUCHER_LEV_90, 1);
giveItems(player, SEAL_LEV_90, 20);
addExpAndSp(player, 66000000, 0);
}
else
{
htmltext = "voucher_trader2003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "trade_seal95":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_95))
{
takeItems(player, VOUCHER_LEV_95, 1);
giveItems(player, SEAL_LEV_95, 20);
addExpAndSp(player, 68000000, 0);
}
else
{
htmltext = "voucher_trader3003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "trade_seal97":
{
if (player.isInCategory(CategoryType.SIXTH_CLASS_GROUP))
{
if (hasQuestItems(player, VOUCHER_LEV_97))
{
takeItems(player, VOUCHER_LEV_97, 1);
giveItems(player, SEAL_LEV_97, 20);
addExpAndSp(player, 76000000, 0);
}
else
{
htmltext = "voucher_trader3003b.htm";
}
}
else
{
htmltext = "voucher_trader1007.htm";
}
break;
}
case "give_talismanR_by_class":
{
int multisellId = -1;
for (CategoryType type : R_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
case "give_talismanR90_by_class":
{
int multisellId = -1;
for (CategoryType type : R90_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R90_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
case "give_talismanR95_by_class":
{
int multisellId = -1;
for (CategoryType type : R95_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R95_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
case "give_talismanR99_by_class":
{
int multisellId = -1;
for (CategoryType type : R99_CLASS_TALISMAN.keySet())
{
if (player.isInCategory(type))
{
multisellId = R99_CLASS_TALISMAN.get(type);
break;
}
}
if (multisellId > 0)
{
MultisellData.getInstance().separateAndSend(multisellId, player, npc, false);
}
break;
}
}
if (event.startsWith("melody"))
{
final int buffOffset = CommonUtil.constrain(Integer.parseInt(event.substring(event.indexOf(" ") + 1)), 0, GROUP_MELODY.length);
if (player.getPcCafePoints() >= 20)
{
npc.setTarget(player);
npc.doCast(GROUP_MELODY[buffOffset].getSkill());
player.setPcCafePoints(player.getPcCafePoints() - 20);
htmltext = "pccafe_buff_1001.htm";
}
else
{
htmltext = "pccafe_notpoint001.htm";
}
}
return htmltext;
}
private String applyBuffs(Npc npc, PlayerInstance player, Skill skill)
{
for (SkillHolder holder : GROUP_MELODY)
{
SkillCaster.triggerCast(npc, player, holder.getSkill());
}
for (SkillHolder holder : GROUP_SONATA)
{
SkillCaster.triggerCast(npc, player, holder.getSkill());
}
SkillCaster.triggerCast(npc, player, skill);
player.setPcCafePoints(player.getPcCafePoints() - 200);
return null;
}
private String applyBuffsGroup(Npc npc, PlayerInstance player, int length)
{
for (SkillHolder holder : GROUP_MELODY)
{
SkillCaster.triggerCast(npc, player, holder.getSkill());
}
player.setPcCafePoints(player.getPcCafePoints() - 120);
return null;
}
private String tradeItem(PlayerInstance player, int itemId, int points)
{
if (player.getPcCafePoints() >= 200000)
{
return "pccafe_help_lottery_fail2.htm";
}
if (takeItems(player, itemId, 1))
{
player.setPcCafePoints(player.getPcCafePoints() + points);
return "pccafe_help_lottery003.htm";
}
return "pccafe_help_lottery_fail.htm";
}
@Override
public String onFirstTalk(Npc npc, PlayerInstance player)
{
return player.getLevel() < 40 ? "adventurer_agent_town_77001.htm" : "adventurer_agent_town_77001e.htm";
}
public static void main(String[] args)
{
new AdventureGuildsman();
}
}

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);