{
activeChar.sendPacket(Msg.YOU_HAVE_FAILED_TO_UNLOCK_THE_DOOR);
}
return;
}
L2ChestInstance target = (L2ChestInstance) targ;
if(target.isDead())
{
return;
}
if(target.isFake())
{
target.onOpen((L2Player) activeChar);
return;
}
double chance = getActivateRate();
double levelmod = (double) getMagicLevel() - target.getLevel();
chance += levelmod * getLevelModifier();
if(chance < 0)
{
chance = 1;
}
if(chance < 100)
{
activeChar.sendMessage(new CustomMessage("l2p.gameserver.skills.skillclasses.Unlock.Chance", activeChar).addString(getName()).addNumber((long) chance));
}
if(Rnd.chance(chance))
{
activeChar.sendMessage(new CustomMessage("l2p.gameserver.skills.skillclasses.Unlock.Success", activeChar));
target.onOpen((L2Player) activeChar);
}
else
{
activeChar.sendPacket(new SystemMessage(SystemMessage.S1_HAS_FAILED).addString(getName()));
target.doDie(activeChar);
}
}
}
}