public void open(Player player) { // Ouvrir coffre if (player.getFight() != null || player.getIsTalkingWith() != 0 || player.getIsTradingWith() != 0 || player.getCurJobAction() != null || player.getCurExchange() != null) return; House house = World.data.getHouse(this.getHouse()); Trunk trunk = player.getCurTrunk(); if (trunk == null) return; if (trunk.getOwner() == player.getAccount().getUUID() || (player.getGuild() == null ? false : player.getGuild().getId() == house.getGuildId() && house.canDo(HouseRight.CG_NO_CODE.getId()))) { open(player, "-", true); } else if (player.getGuild() == null && house.canDo( HouseRight.CO_CANT_OPEN.getId())) { // si on compare par id ça bug (guild null) SocketManager.GAME_SEND_MESSAGE( player, "Ce coffre ne peut être ouvert que par les membres de la guilde !", Server.config.getMotdColor()); return; } else if (trunk.getOwner() > 0) { // Une personne autre le possède, il faut le code pour rentrer SocketManager.GAME_SEND_KODE(player, "CK0|8"); // 8 étant le nombre de chiffre du code } else if (trunk.getOwner() == 0) { // Coffre a personne return; } else { return; } }
public static void open(Player player, String packet, boolean isTrunk) { // Ouvrir un coffre Trunk trunk = player.getCurTrunk(); if (trunk == null) return; if (packet.compareTo(trunk.getKey()) == 0 || isTrunk) { // Si c'est chez lui ou que le mot de passe est bon SocketManager.GAME_SEND_ECK_PACKET(player.getAccount().getGameClient(), 5, ""); SocketManager.GAME_SEND_EL_TRUNK_PACKET(player, trunk); closeCode(player); } else if (packet.compareTo(trunk.getKey()) != 0) { // Mauvais code SocketManager.GAME_SEND_KODE(player, "KE"); Trunk.closeCode(player); player.setCurTrunk(null); } }
public static void closeCode(Player player) { SocketManager.GAME_SEND_KODE(player, "V"); }
public void lock(Player player) { SocketManager.GAME_SEND_KODE(player, "CK1|8"); }