diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java index 4e4e0dbc..4bbd495b 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerEquipController.java @@ -169,15 +169,25 @@ public class GPlayerEquipController { @PostMapping("/wear/{petId}/{equipId}") public NewsContext wear(@CurrentPlayer Player player, @PathVariable Integer petId, @PathVariable Integer equipId){ + //获取装备信息 + PetEquip info = petEquipService.getById(equipId); + + if(Objects.isNull(info)) NewsContext.onFail("背包里没有这个装备"); + if(!Objects.equals(info.getEquipPlayerId(), player.getPlayerId())) NewsContext.onFail("这个装备不是你的"); + + //脱掉之前的部位装备 + petEquipService.update(Wrappers.lambdaQuery(PetEquip.class) + .eq(PetEquip::getEquipPlayerId,player.getPlayerId()) + .eq(PetEquip::getEquipPetId,petId) + .eq(PetEquip::getEquipPosition,info.getEquipPosition()) + ); +// PetEquip before = new PetEquip(); + + // //脱掉之前的部位装备 // PetEquip info = new PetEquip(); // info.setEquipPlayerId(player.getPlayerId()); // info.setEquipPetId(petId); -// petEquipService.update(Wrappers.lambdaQuery(PetEquip.class).eq( -// PetEquip::getEquipPlayerId,player.getPlayerId(), -// PetEquip::getEquipPetId,petId, -// PetEquip::getEquipPetId,petId, -// ); // // if(Objects.isNull(info)){ // return NewsContext.onFail("没有找到锻造台");