L2JMobius

C6 Delux key

caioconc · 6 · 6671

Offline caioconc

  • Heir
  • **
    • Posts: 33
hello,

It turns out that when using the key in the boxes is never given the prize.

 Delux key is implemented ? I noticed that in the file (DeluxeKey.java), the verification function of chansse is not called (Chests.java//quests)!


LOGGER.info("Delux key casting succeded.") (ok)
....


Online Strelook66

  • Knight
  • ***
    • Posts: 82
Hi,

I can confirm that the keys won't ever open a chest, it will just attack the player even if the success rate is 100%. No error or anything.


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16050
Try this.
Code: [Select]
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
Code: [Select]
if ((Rnd.get(100) < IS_BOX) || isDeluxeSkill)proper method might be
Code: [Select]
if (Rnd.get(100) < IS_BOX)


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16050

Online Strelook66

  • Knight
  • ***
    • Posts: 82
Sorry for the late response, got home quite late. Yes it works, it opens the chests. What i noticed is that every time a chest is opened successfully and receive the drops, it also says: "That is the incorrect target" in the chat.

*UPDATE*

This is the correct method for this check:

Code: [Select]
if (Rnd.get(100) < IS_BOX)


Online Mobius

  • Distinguished King
  • *****
    • Posts: 16050