提交锻造系统

This commit is contained in:
PC-20230316NUNE\Administrator
2024-01-08 18:55:00 +08:00
parent e737a09828
commit e8a1cb9362
39 changed files with 9319 additions and 2035 deletions

View File

@@ -21,10 +21,7 @@ import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.Arrays;
@@ -48,7 +45,7 @@ public class GPlayerEquipController {
@Autowired
ResourceService resourceService;
//获取玩家宠物列表
//锻造装备(扣除玩家锻造石 打造一件装备)
@ApiImplicitParams({})
@ApiOperation(value = "锻造装备(扣除玩家锻造石 打造一件装备)")
@GetMapping("/forging")
@@ -75,6 +72,7 @@ public class GPlayerEquipController {
//随机取一个装备
TbGRoleEquip equipInfo = GRandomUtil.randomArray(equips);
//封装
PetEquip equip = new PetEquip();
equip.setEquipCfgId(equipInfo.id);
equip.setEquipPlayerId(player.getPlayerId());
@@ -109,6 +107,18 @@ public class GPlayerEquipController {
}
//获取所有装备
@ApiImplicitParams({})
@ApiOperation(value = "获取所有装备")
@GetMapping("/all")
public NewsContext<List<PetEquip>> all(@CurrentPlayer Player player){
return NewsContext.onSuccess("获取成功",
petEquipService.list(Wrappers.lambdaQuery(PetEquip.class)
.eq(PetEquip::getEquipPlayerId,player.getPlayerId()))
);
}
//获取锻造台等级
@ApiImplicitParams({})
@ApiOperation(value = "获取锻造台")
@@ -122,15 +132,35 @@ public class GPlayerEquipController {
try{
info = EquipForgingBench.builder().playerId(player.getPlayerId())
.forgingQuality(TD.DATA.getTbGRoleEquipQuality().getDataList().get(0).id)
.forgingLevel(TD.DATA.getTbGRoleEquipLevel().getDataList().get(0).id).build();
.forgingExp(0).build();
equipForgingBenchService.saveOrUpdate(info);
}catch (Exception ignored){}
assert equipForgingBenchService != null;
info = equipForgingBenchService.getById(player.getPlayerId());
info = equipForgingBenchService.getOne(Wrappers.lambdaQuery(EquipForgingBench.class).eq(EquipForgingBench::getPlayerId,player.getPlayerId()));
}
return NewsContext.onSuccess("获取成功",info);
}
//设置锻造宠
@ApiImplicitParams({})
@ApiOperation(value = "设置锻造宠")
@PostMapping("/forging/petId/{petId}")
public NewsContext<EquipForgingBench> setForgingPetId(@CurrentPlayer Player player, @PathVariable Integer petId){
EquipForgingBench info = equipForgingBenchService.getOne(Wrappers.lambdaQuery(EquipForgingBench.class).eq(EquipForgingBench::getPlayerId,player.getPlayerId()));
if(Objects.isNull(info)){
return NewsContext.onFail("没有找到锻造台");
}
info.setForgingPetId(petId);
equipForgingBenchService.saveOrUpdate(info);
return NewsContext.onSuccess("设置成功",info);
}
}

View File

@@ -1,11 +1,16 @@
package cn.jisol.game.entity.table;
import cfg.TB.TbGRoleEquipLevel;
import cn.jisol.game.data.TD;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Builder;
import lombok.Data;
import java.util.List;
import java.util.stream.Collectors;
@Builder
@Data
@TableName("`equip_forging_bench`")
@@ -14,7 +19,13 @@ public class EquipForgingBench {
@TableId(type = IdType.AUTO)
private Integer forgingId; //锻造台Id
private Long playerId; //锻造台所属的玩家Id
private Integer forgingLevel; //锻造等级
private Integer forgingQuality; //锻造品质等级
private Integer forgingExp; //锻造等级经验
private Integer forgingQuality; //锻造品质等级
private Integer forgingPetId; //当前占用宠物Id
//获取锻造等级
public Integer getForgingLevel() {
List<TbGRoleEquipLevel> collect = TD.DATA.getTbGRoleEquipLevel().getDataList().stream().filter(info -> info.exp <= this.forgingExp).collect(Collectors.toList());
return collect.get(collect.size() - 1).id;
}
}

View File

@@ -1,402 +1,402 @@
[
{
"id": 1,
"exp": 1
"exp": 0
},
{
"id": 2,
"exp": 2
"exp": 1
},
{
"id": 3,
"exp": 3
"exp": 2
},
{
"id": 4,
"exp": 4
"exp": 3
},
{
"id": 5,
"exp": 5
"exp": 4
},
{
"id": 6,
"exp": 6
"exp": 5
},
{
"id": 7,
"exp": 7
"exp": 6
},
{
"id": 8,
"exp": 8
"exp": 7
},
{
"id": 9,
"exp": 9
"exp": 8
},
{
"id": 10,
"exp": 10
"exp": 9
},
{
"id": 11,
"exp": 11
"exp": 10
},
{
"id": 12,
"exp": 12
"exp": 11
},
{
"id": 13,
"exp": 13
"exp": 12
},
{
"id": 14,
"exp": 14
"exp": 13
},
{
"id": 15,
"exp": 15
"exp": 14
},
{
"id": 16,
"exp": 16
"exp": 15
},
{
"id": 17,
"exp": 17
"exp": 16
},
{
"id": 18,
"exp": 18
"exp": 17
},
{
"id": 19,
"exp": 19
"exp": 18
},
{
"id": 20,
"exp": 20
"exp": 19
},
{
"id": 21,
"exp": 21
"exp": 20
},
{
"id": 22,
"exp": 22
"exp": 21
},
{
"id": 23,
"exp": 23
"exp": 22
},
{
"id": 24,
"exp": 24
"exp": 23
},
{
"id": 25,
"exp": 25
"exp": 24
},
{
"id": 26,
"exp": 26
"exp": 25
},
{
"id": 27,
"exp": 27
"exp": 26
},
{
"id": 28,
"exp": 28
"exp": 27
},
{
"id": 29,
"exp": 29
"exp": 28
},
{
"id": 30,
"exp": 30
"exp": 29
},
{
"id": 31,
"exp": 31
"exp": 30
},
{
"id": 32,
"exp": 32
"exp": 31
},
{
"id": 33,
"exp": 33
"exp": 32
},
{
"id": 34,
"exp": 34
"exp": 33
},
{
"id": 35,
"exp": 35
"exp": 34
},
{
"id": 36,
"exp": 36
"exp": 35
},
{
"id": 37,
"exp": 37
"exp": 36
},
{
"id": 38,
"exp": 38
"exp": 37
},
{
"id": 39,
"exp": 39
"exp": 38
},
{
"id": 40,
"exp": 40
"exp": 39
},
{
"id": 41,
"exp": 41
"exp": 40
},
{
"id": 42,
"exp": 42
"exp": 41
},
{
"id": 43,
"exp": 43
"exp": 42
},
{
"id": 44,
"exp": 44
"exp": 43
},
{
"id": 45,
"exp": 45
"exp": 44
},
{
"id": 46,
"exp": 46
"exp": 45
},
{
"id": 47,
"exp": 47
"exp": 46
},
{
"id": 48,
"exp": 48
"exp": 47
},
{
"id": 49,
"exp": 49
"exp": 48
},
{
"id": 50,
"exp": 50
"exp": 49
},
{
"id": 51,
"exp": 51
"exp": 50
},
{
"id": 52,
"exp": 52
"exp": 51
},
{
"id": 53,
"exp": 53
"exp": 52
},
{
"id": 54,
"exp": 54
"exp": 53
},
{
"id": 55,
"exp": 55
"exp": 54
},
{
"id": 56,
"exp": 56
"exp": 55
},
{
"id": 57,
"exp": 57
"exp": 56
},
{
"id": 58,
"exp": 58
"exp": 57
},
{
"id": 59,
"exp": 59
"exp": 58
},
{
"id": 60,
"exp": 60
"exp": 59
},
{
"id": 61,
"exp": 61
"exp": 60
},
{
"id": 62,
"exp": 62
"exp": 61
},
{
"id": 63,
"exp": 63
"exp": 62
},
{
"id": 64,
"exp": 64
"exp": 63
},
{
"id": 65,
"exp": 65
"exp": 64
},
{
"id": 66,
"exp": 66
"exp": 65
},
{
"id": 67,
"exp": 67
"exp": 66
},
{
"id": 68,
"exp": 68
"exp": 67
},
{
"id": 69,
"exp": 69
"exp": 68
},
{
"id": 70,
"exp": 70
"exp": 69
},
{
"id": 71,
"exp": 71
"exp": 70
},
{
"id": 72,
"exp": 72
"exp": 71
},
{
"id": 73,
"exp": 73
"exp": 72
},
{
"id": 74,
"exp": 74
"exp": 73
},
{
"id": 75,
"exp": 75
"exp": 74
},
{
"id": 76,
"exp": 76
"exp": 75
},
{
"id": 77,
"exp": 77
"exp": 76
},
{
"id": 78,
"exp": 78
"exp": 77
},
{
"id": 79,
"exp": 79
"exp": 78
},
{
"id": 80,
"exp": 80
"exp": 79
},
{
"id": 81,
"exp": 81
"exp": 80
},
{
"id": 82,
"exp": 82
"exp": 81
},
{
"id": 83,
"exp": 83
"exp": 82
},
{
"id": 84,
"exp": 84
"exp": 83
},
{
"id": 85,
"exp": 85
"exp": 84
},
{
"id": 86,
"exp": 86
"exp": 85
},
{
"id": 87,
"exp": 87
"exp": 86
},
{
"id": 88,
"exp": 88
"exp": 87
},
{
"id": 89,
"exp": 89
"exp": 88
},
{
"id": 90,
"exp": 90
"exp": 89
},
{
"id": 91,
"exp": 91
"exp": 90
},
{
"id": 92,
"exp": 92
"exp": 91
},
{
"id": 93,
"exp": 93
"exp": 92
},
{
"id": 94,
"exp": 94
"exp": 93
},
{
"id": 95,
"exp": 95
"exp": 94
},
{
"id": 96,
"exp": 96
"exp": 95
},
{
"id": 97,
"exp": 97
"exp": 96
},
{
"id": 98,
"exp": 98
"exp": 97
},
{
"id": 99,
"exp": 99
"exp": 98
},
{
"id": 100,
"exp": 100
"exp": 99
}
]