Try this.
Index: dist/game/data/scripts/ai/others/Chests.java
===================================================================
--- dist/game/data/scripts/ai/others/Chests.java (revision 7463)
+++ dist/game/data/scripts/ai/others/Chests.java (working copy)
@@ -64,13 +64,14 @@
// 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
final ChestInstance chest = (ChestInstance) npc;
- if (chest.isInteracted())
+ if (!chest.isInteracted())
{
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 (skill.getId() == SKILL_DELUXE_KEY)
+ if (isDeluxeSkill)
{
// check the chance to open the box
final int keyLevelNeeded = chest.getLevel() / 10;
Index: java/org/l2jmobius/gameserver/handler/itemhandlers/ChestKey.java
===================================================================
--- java/org/l2jmobius/gameserver/handler/itemhandlers/ChestKey.java (revision 7463)
+++ java/org/l2jmobius/gameserver/handler/itemhandlers/ChestKey.java (working copy)
@@ -53,7 +53,6 @@
final PlayerInstance player = (PlayerInstance) playable;
final int itemId = item.getItemId();
- final Skill skill = SkillTable.getInstance().getSkill(2229, itemId - 6664); // box key skill
final WorldObject target = player.getTarget();
if (!(target instanceof ChestInstance))
{
@@ -65,11 +64,13 @@
final ChestInstance chest = (ChestInstance) target;
if (chest.isDead() || chest.isInteracted())
{
- player.sendMessage("The chest Is empty.");
+ player.sendMessage("The chest is empty.");
player.sendPacket(ActionFailed.STATIC_PACKET);
return;
}
+
+ final Skill skill = SkillTable.getInstance().getSkill(2229, itemId - 6664); // box key skill
player.useMagic(skill, false, false);
}
}
Index: java/org/l2jmobius/gameserver/handler/skillhandlers/DeluxeKey.java
===================================================================
--- java/org/l2jmobius/gameserver/handler/skillhandlers/DeluxeKey.java (revision 7541)
+++ java/org/l2jmobius/gameserver/handler/skillhandlers/DeluxeKey.java (working copy)
@@ -51,7 +51,7 @@
return;
}
- LOGGER.info("Delux key casting succeded.");
+ // 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.
}
Not sure about
if ((Rnd.get(100) < IS_BOX) || isDeluxeSkill)
proper method might be
if (Rnd.get(100) < IS_BOX)