Fixed chest key issues.
This commit is contained in:
@@ -33,14 +33,16 @@ public class Chests extends Quest
|
|||||||
{
|
{
|
||||||
// NPCs
|
// NPCs
|
||||||
private static final int[] CHESTS =
|
private static final int[] CHESTS =
|
||||||
{// @formatter:off
|
{
|
||||||
|
// @formatter:off
|
||||||
18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,
|
18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,
|
||||||
18276,18277,18278,18279,18280,18281,18282,18283,18284,18285,18286,
|
18276,18277,18278,18279,18280,18281,18282,18283,18284,18285,18286,
|
||||||
18287,18288,18289,18290,18291,18292,18293,18294,18295,18296,18297,
|
18287,18288,18289,18290,18291,18292,18293,18294,18295,18296,18297,
|
||||||
18298,21671,21694,21717,21740,21763,21786,21801,21802,21803,21804,
|
18298,21671,21694,21717,21740,21763,21786,21801,21802,21803,21804,
|
||||||
21805,21806,21807,21808,21809,21810,21811,21812,21813,21814,21815,
|
21805,21806,21807,21808,21809,21810,21811,21812,21813,21814,21815,
|
||||||
21816,21817,21818,21819,21820,21821,21822
|
21816,21817,21818,21819,21820,21821,21822
|
||||||
}; // @formatter:on
|
// @formatter:on
|
||||||
|
};
|
||||||
// Skill
|
// Skill
|
||||||
private static final int SKILL_DELUXE_KEY = 2229;
|
private static final int SKILL_DELUXE_KEY = 2229;
|
||||||
// Misc
|
// Misc
|
||||||
@@ -64,13 +66,14 @@ public class Chests extends Quest
|
|||||||
// if this has already been interacted, no further ai decisions are needed
|
// if this has already been interacted, no further ai decisions are needed
|
||||||
// if it's the first interaction, check if this is a box or mimic
|
// if it's the first interaction, check if this is a box or mimic
|
||||||
final ChestInstance chest = (ChestInstance) npc;
|
final ChestInstance chest = (ChestInstance) npc;
|
||||||
if (chest.isInteracted())
|
if (!chest.isInteracted())
|
||||||
{
|
{
|
||||||
chest.setInteracted();
|
chest.setInteracted();
|
||||||
if (Rnd.get(100) < IS_BOX)
|
final boolean isDeluxeSkill = skill.getId() == SKILL_DELUXE_KEY;
|
||||||
|
if ((Rnd.get(100) < IS_BOX) || isDeluxeSkill)
|
||||||
{
|
{
|
||||||
// if it's a box, either it will be successfully openned by a proper key, or instantly disappear
|
// if it's a box, either it will be successfully opened by a proper key, or instantly disappear
|
||||||
if (skill.getId() == SKILL_DELUXE_KEY)
|
if (isDeluxeSkill)
|
||||||
{
|
{
|
||||||
// check the chance to open the box
|
// check the chance to open the box
|
||||||
final int keyLevelNeeded = chest.getLevel() / 10;
|
final int keyLevelNeeded = chest.getLevel() / 10;
|
||||||
|
@@ -53,7 +53,6 @@ public class ChestKey implements IItemHandler
|
|||||||
|
|
||||||
final PlayerInstance player = (PlayerInstance) playable;
|
final PlayerInstance player = (PlayerInstance) playable;
|
||||||
final int itemId = item.getItemId();
|
final int itemId = item.getItemId();
|
||||||
final Skill skill = SkillTable.getInstance().getSkill(2229, itemId - 6664); // box key skill
|
|
||||||
final WorldObject target = player.getTarget();
|
final WorldObject target = player.getTarget();
|
||||||
if (!(target instanceof ChestInstance))
|
if (!(target instanceof ChestInstance))
|
||||||
{
|
{
|
||||||
@@ -65,11 +64,12 @@ public class ChestKey implements IItemHandler
|
|||||||
final ChestInstance chest = (ChestInstance) target;
|
final ChestInstance chest = (ChestInstance) target;
|
||||||
if (chest.isDead() || chest.isInteracted())
|
if (chest.isDead() || chest.isInteracted())
|
||||||
{
|
{
|
||||||
player.sendMessage("The chest Is empty.");
|
player.sendMessage("The chest is empty.");
|
||||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Skill skill = SkillTable.getInstance().getSkill(2229, itemId - 6664); // box key skill
|
||||||
player.useMagic(skill, false, false);
|
player.useMagic(skill, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.handler.skillhandlers;
|
package org.l2jmobius.gameserver.handler.skillhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.handler.ISkillHandler;
|
import org.l2jmobius.gameserver.handler.ISkillHandler;
|
||||||
import org.l2jmobius.gameserver.model.Skill;
|
import org.l2jmobius.gameserver.model.Skill;
|
||||||
@@ -30,8 +29,6 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
*/
|
*/
|
||||||
public class DeluxeKey implements ISkillHandler
|
public class DeluxeKey implements ISkillHandler
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(DeluxeKey.class.getName());
|
|
||||||
|
|
||||||
private static final SkillType[] SKILL_IDS =
|
private static final SkillType[] SKILL_IDS =
|
||||||
{
|
{
|
||||||
SkillType.DELUXE_KEY_UNLOCK
|
SkillType.DELUXE_KEY_UNLOCK
|
||||||
@@ -45,14 +42,11 @@ public class DeluxeKey implements ISkillHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Creature> targetList = skill.getTargetList(creature);
|
if (skill.getTargetList(creature) == null)
|
||||||
if (targetList == null)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Delux key casting succeded.");
|
|
||||||
|
|
||||||
// This is just a dummy skill handler for the golden food and crystal food skills, since the AI responce onSkillUse handles the rest.
|
// This is just a dummy skill handler for the golden food and crystal food skills, since the AI responce onSkillUse handles the rest.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -33,14 +33,16 @@ public class Chests extends Quest
|
|||||||
{
|
{
|
||||||
// NPCs
|
// NPCs
|
||||||
private static final int[] CHESTS =
|
private static final int[] CHESTS =
|
||||||
{// @formatter:off
|
{
|
||||||
|
// @formatter:off
|
||||||
18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,
|
18265,18266,18267,18268,18269,18270,18271,18272,18273,18274,18275,
|
||||||
18276,18277,18278,18279,18280,18281,18282,18283,18284,18285,18286,
|
18276,18277,18278,18279,18280,18281,18282,18283,18284,18285,18286,
|
||||||
18287,18288,18289,18290,18291,18292,18293,18294,18295,18296,18297,
|
18287,18288,18289,18290,18291,18292,18293,18294,18295,18296,18297,
|
||||||
18298,21671,21694,21717,21740,21763,21786,21801,21802,21803,21804,
|
18298,21671,21694,21717,21740,21763,21786,21801,21802,21803,21804,
|
||||||
21805,21806,21807,21808,21809,21810,21811,21812,21813,21814,21815,
|
21805,21806,21807,21808,21809,21810,21811,21812,21813,21814,21815,
|
||||||
21816,21817,21818,21819,21820,21821,21822
|
21816,21817,21818,21819,21820,21821,21822
|
||||||
}; // @formatter:on
|
// @formatter:on
|
||||||
|
};
|
||||||
// Skill
|
// Skill
|
||||||
private static final int SKILL_DELUXE_KEY = 2229;
|
private static final int SKILL_DELUXE_KEY = 2229;
|
||||||
// Misc
|
// Misc
|
||||||
@@ -64,13 +66,14 @@ public class Chests extends Quest
|
|||||||
// if this has already been interacted, no further ai decisions are needed
|
// if this has already been interacted, no further ai decisions are needed
|
||||||
// if it's the first interaction, check if this is a box or mimic
|
// if it's the first interaction, check if this is a box or mimic
|
||||||
final ChestInstance chest = (ChestInstance) npc;
|
final ChestInstance chest = (ChestInstance) npc;
|
||||||
if (chest.isInteracted())
|
if (!chest.isInteracted())
|
||||||
{
|
{
|
||||||
chest.setInteracted();
|
chest.setInteracted();
|
||||||
if (Rnd.get(100) < IS_BOX)
|
final boolean isDeluxeSkill = skill.getId() == SKILL_DELUXE_KEY;
|
||||||
|
if ((Rnd.get(100) < IS_BOX) || isDeluxeSkill)
|
||||||
{
|
{
|
||||||
// if it's a box, either it will be successfully openned by a proper key, or instantly disappear
|
// if it's a box, either it will be successfully opened by a proper key, or instantly disappear
|
||||||
if (skill.getId() == SKILL_DELUXE_KEY)
|
if (isDeluxeSkill)
|
||||||
{
|
{
|
||||||
// check the chance to open the box
|
// check the chance to open the box
|
||||||
final int keyLevelNeeded = chest.getLevel() / 10;
|
final int keyLevelNeeded = chest.getLevel() / 10;
|
||||||
|
@@ -53,7 +53,6 @@ public class ChestKey implements IItemHandler
|
|||||||
|
|
||||||
final PlayerInstance player = (PlayerInstance) playable;
|
final PlayerInstance player = (PlayerInstance) playable;
|
||||||
final int itemId = item.getItemId();
|
final int itemId = item.getItemId();
|
||||||
final Skill skill = SkillTable.getInstance().getSkill(2229, itemId - 6664); // box key skill
|
|
||||||
final WorldObject target = player.getTarget();
|
final WorldObject target = player.getTarget();
|
||||||
if (!(target instanceof ChestInstance))
|
if (!(target instanceof ChestInstance))
|
||||||
{
|
{
|
||||||
@@ -65,11 +64,12 @@ public class ChestKey implements IItemHandler
|
|||||||
final ChestInstance chest = (ChestInstance) target;
|
final ChestInstance chest = (ChestInstance) target;
|
||||||
if (chest.isDead() || chest.isInteracted())
|
if (chest.isDead() || chest.isInteracted())
|
||||||
{
|
{
|
||||||
player.sendMessage("The chest Is empty.");
|
player.sendMessage("The chest is empty.");
|
||||||
player.sendPacket(ActionFailed.STATIC_PACKET);
|
player.sendPacket(ActionFailed.STATIC_PACKET);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final Skill skill = SkillTable.getInstance().getSkill(2229, itemId - 6664); // box key skill
|
||||||
player.useMagic(skill, false, false);
|
player.useMagic(skill, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,7 +17,6 @@
|
|||||||
package org.l2jmobius.gameserver.handler.skillhandlers;
|
package org.l2jmobius.gameserver.handler.skillhandlers;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.handler.ISkillHandler;
|
import org.l2jmobius.gameserver.handler.ISkillHandler;
|
||||||
import org.l2jmobius.gameserver.model.Skill;
|
import org.l2jmobius.gameserver.model.Skill;
|
||||||
@@ -30,8 +29,6 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
*/
|
*/
|
||||||
public class DeluxeKey implements ISkillHandler
|
public class DeluxeKey implements ISkillHandler
|
||||||
{
|
{
|
||||||
private static final Logger LOGGER = Logger.getLogger(DeluxeKey.class.getName());
|
|
||||||
|
|
||||||
private static final SkillType[] SKILL_IDS =
|
private static final SkillType[] SKILL_IDS =
|
||||||
{
|
{
|
||||||
SkillType.DELUXE_KEY_UNLOCK
|
SkillType.DELUXE_KEY_UNLOCK
|
||||||
@@ -45,14 +42,11 @@ public class DeluxeKey implements ISkillHandler
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<Creature> targetList = skill.getTargetList(creature);
|
if (skill.getTargetList(creature) == null)
|
||||||
if (targetList == null)
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOGGER.info("Delux key casting succeded.");
|
|
||||||
|
|
||||||
// This is just a dummy skill handler for the golden food and crystal food skills, since the AI responce onSkillUse handles the rest.
|
// This is just a dummy skill handler for the golden food and crystal food skills, since the AI responce onSkillUse handles the rest.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user