From 61767ea93f93fa93318246d00693122e5c2caf7e Mon Sep 17 00:00:00 2001 From: "PC-20230316NUNE\\Administrator" <2858626794@qq.com> Date: Tue, 9 Jan 2024 12:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../game/GPlayerEquipController.java | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) 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("没有找到锻造台");