mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 10:16:14 +00:00
锻造升级
This commit is contained in:
@@ -21,6 +21,7 @@ public final class TbGRole extends AbstractBean {
|
||||
spine = _buf.get("spine").getAsInt();
|
||||
{ com.google.gson.JsonArray _json0_ = _buf.get("roleSkillIds").getAsJsonArray(); int __n0 = _json0_.size(); roleSkillIds = new int[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { int __v0; __v0 = __e0.getAsInt(); roleSkillIds[__index0++] = __v0; } }
|
||||
roleAttackRange = _buf.get("roleAttackRange").getAsInt();
|
||||
roleHight = _buf.get("roleHight").getAsInt();
|
||||
}
|
||||
|
||||
public static TbGRole deserialize(JsonObject _buf) {
|
||||
@@ -47,6 +48,10 @@ public final class TbGRole extends AbstractBean {
|
||||
* 角色攻击范围
|
||||
*/
|
||||
public final int roleAttackRange;
|
||||
/**
|
||||
* 角色高度
|
||||
*/
|
||||
public final int roleHight;
|
||||
|
||||
public static final int __ID__ = 319398927;
|
||||
|
||||
@@ -61,6 +66,7 @@ public final class TbGRole extends AbstractBean {
|
||||
+ "(format_field_name __code_style field.name):" + spine + ","
|
||||
+ "(format_field_name __code_style field.name):" + roleSkillIds + ","
|
||||
+ "(format_field_name __code_style field.name):" + roleAttackRange + ","
|
||||
+ "(format_field_name __code_style field.name):" + roleHight + ","
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@ public final class TbGRoleEquipQuality extends AbstractBean {
|
||||
id = _buf.get("id").getAsInt();
|
||||
{ com.google.gson.JsonArray _json0_ = _buf.get("odds").getAsJsonArray(); int __n0 = _json0_.size(); odds = new int[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { int __v0; __v0 = __e0.getAsInt(); odds[__index0++] = __v0; } }
|
||||
total = _buf.get("total").getAsInt();
|
||||
{ com.google.gson.JsonArray _json0_ = _buf.get("materials").getAsJsonArray(); int __n0 = _json0_.size(); materials = new cfg.TbGEntity.TResource[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { cfg.TbGEntity.TResource __v0; __v0 = cfg.TbGEntity.TResource.deserialize(__e0.getAsJsonObject()); materials[__index0++] = __v0; } }
|
||||
upTime = _buf.get("upTime").getAsInt();
|
||||
}
|
||||
|
||||
public static TbGRoleEquipQuality deserialize(JsonObject _buf) {
|
||||
@@ -37,6 +39,14 @@ public final class TbGRoleEquipQuality extends AbstractBean {
|
||||
* 总概率
|
||||
*/
|
||||
public final int total;
|
||||
/**
|
||||
* 升级消耗的材料
|
||||
*/
|
||||
public final cfg.TbGEntity.TResource[] materials;
|
||||
/**
|
||||
* 升级所需时间(s)
|
||||
*/
|
||||
public final int upTime;
|
||||
|
||||
public static final int __ID__ = -177949602;
|
||||
|
||||
@@ -49,6 +59,8 @@ public final class TbGRoleEquipQuality extends AbstractBean {
|
||||
+ "(format_field_name __code_style field.name):" + id + ","
|
||||
+ "(format_field_name __code_style field.name):" + odds + ","
|
||||
+ "(format_field_name __code_style field.name):" + total + ","
|
||||
+ "(format_field_name __code_style field.name):" + materials + ","
|
||||
+ "(format_field_name __code_style field.name):" + upTime + ","
|
||||
+ "}";
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ import cn.jisol.game.service.PetEquipService;
|
||||
import cn.jisol.game.service.PlayerPetService;
|
||||
import cn.jisol.game.service.ResourceService;
|
||||
import cn.jisol.game.util.GRandomUtil;
|
||||
import cn.jisol.game.vo.pet.equip.EquipForgingBenchOV;
|
||||
import cn.jisol.ngame.util.NewsContext;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -60,7 +61,7 @@ public class GPlayerEquipController {
|
||||
resourceService.addResourceValue(player.getPlayerId(), ResourceId.ForgedStones.id, -1L);
|
||||
|
||||
//获取锻造台
|
||||
EquipForgingBench forgingInfo = this.forgingInfo(player).data;
|
||||
EquipForgingBenchOV forgingInfo = this.forgingInfo(player).data;
|
||||
|
||||
//随机取一个部位
|
||||
TbGRoleEquipType position = GRandomUtil.randomArray(TD.DATA.getTbGRoleEquipType().getDataList());
|
||||
@@ -127,7 +128,7 @@ public class GPlayerEquipController {
|
||||
@ApiImplicitParams({})
|
||||
@ApiOperation(value = "获取锻造台")
|
||||
@GetMapping("/forging/info")
|
||||
public NewsContext<EquipForgingBench> forgingInfo(@CurrentPlayer Player player){
|
||||
public NewsContext<EquipForgingBenchOV> forgingInfo(@CurrentPlayer Player player){
|
||||
|
||||
EquipForgingBench info = equipForgingBenchService.getOne(Wrappers.lambdaQuery(EquipForgingBench.class).eq(EquipForgingBench::getPlayerId,player.getPlayerId()));
|
||||
|
||||
@@ -143,7 +144,7 @@ public class GPlayerEquipController {
|
||||
info = equipForgingBenchService.getOne(Wrappers.lambdaQuery(EquipForgingBench.class).eq(EquipForgingBench::getPlayerId,player.getPlayerId()));
|
||||
}
|
||||
|
||||
return NewsContext.onSuccess("获取成功",info);
|
||||
return NewsContext.onSuccess("获取成功",EquipForgingBenchOV.create(info));
|
||||
|
||||
}
|
||||
|
||||
@@ -151,7 +152,7 @@ public class GPlayerEquipController {
|
||||
@ApiImplicitParams({})
|
||||
@ApiOperation(value = "设置锻造宠")
|
||||
@PostMapping("/forging/petId/{petId}")
|
||||
public NewsContext<EquipForgingBench> setForgingPetId(@CurrentPlayer Player player, @PathVariable Integer petId){
|
||||
public NewsContext<EquipForgingBenchOV> setForgingPetId(@CurrentPlayer Player player, @PathVariable Integer petId){
|
||||
|
||||
EquipForgingBench info = equipForgingBenchService.getOne(Wrappers.lambdaQuery(EquipForgingBench.class).eq(EquipForgingBench::getPlayerId,player.getPlayerId()));
|
||||
|
||||
@@ -162,7 +163,7 @@ public class GPlayerEquipController {
|
||||
info.setForgingPetId(petId);
|
||||
equipForgingBenchService.saveOrUpdate(info);
|
||||
|
||||
return NewsContext.onSuccess("设置成功",info);
|
||||
return NewsContext.onSuccess("设置成功",EquipForgingBenchOV.create(info));
|
||||
|
||||
}
|
||||
|
||||
@@ -201,5 +202,13 @@ public class GPlayerEquipController {
|
||||
return NewsContext.onSuccess("穿戴成功",info);
|
||||
}
|
||||
|
||||
//升级锻造台
|
||||
@ApiImplicitParams({})
|
||||
@ApiOperation(value = "锻造台升级")
|
||||
@PostMapping("/forging/up")
|
||||
public NewsContext<EquipForgingBenchOV> wear(@CurrentPlayer Player player){
|
||||
return NewsContext.onFail("升级成功");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -5,13 +5,19 @@ 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.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Builder
|
||||
@SuperBuilder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Data
|
||||
@TableName("`equip_forging_bench`")
|
||||
public class EquipForgingBench {
|
||||
@@ -22,6 +28,7 @@ public class EquipForgingBench {
|
||||
private Integer forgingExp; //锻造等级经验
|
||||
private Integer forgingQuality; //锻造品质等级
|
||||
private Integer forgingPetId; //当前占用宠物Id
|
||||
private Long forgingUpTime; //升级结束时间(服务器)
|
||||
|
||||
//获取锻造等级
|
||||
public Integer getForgingLevel() {
|
||||
|
@@ -9,7 +9,7 @@ public interface ResourceService extends IService<Resource> {
|
||||
public Resource addResourceValue(Long playerId, int type, Long value);
|
||||
|
||||
//初始化某个资源
|
||||
public Resource initResource(Long playerId, int type);
|
||||
public Resource initResource(Long playerId, int type, Long value);
|
||||
public Resource initResource(Resource resource);
|
||||
|
||||
}
|
||||
|
@@ -56,8 +56,11 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
//并且重试
|
||||
if(value > 0){
|
||||
//没有资源信息 创建初始资源
|
||||
res = this.initResource(playerId,type);
|
||||
this.addResourceValue(playerId,type,value);
|
||||
try{
|
||||
res = this.initResource(playerId,type,value);
|
||||
}catch (Exception e){
|
||||
return this.addResourceValue(playerId,type,value);
|
||||
}
|
||||
}else{
|
||||
throw new ResourceNotException("资源不够");
|
||||
}
|
||||
@@ -77,8 +80,8 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
|
||||
|
||||
//初始化某个资源
|
||||
@Override
|
||||
public Resource initResource(Long playerId, int type) {
|
||||
Resource resource = Resource.builder().playerId(playerId).resourceTbId(type).resourceValue(0L).build();
|
||||
public Resource initResource(Long playerId, int type, Long value) {
|
||||
Resource resource = Resource.builder().playerId(playerId).resourceTbId(type).resourceValue(value).build();
|
||||
this.initResource(resource);
|
||||
return resource;
|
||||
}
|
||||
|
@@ -0,0 +1,29 @@
|
||||
package cn.jisol.game.vo.pet.equip;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.jisol.game.entity.table.EquipForgingBench;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class EquipForgingBenchOV extends EquipForgingBench {
|
||||
|
||||
//获取当前品质等级
|
||||
@Override
|
||||
public Integer getForgingQuality() {
|
||||
if(this.getForgingUpTimeExcess() > 0){
|
||||
return super.getForgingQuality() - 1;
|
||||
}else{
|
||||
return super.getForgingQuality();
|
||||
}
|
||||
}
|
||||
|
||||
//获取升级剩余时间
|
||||
public Long getForgingUpTimeExcess(){
|
||||
return Math.max(this.getForgingUpTime() - (new Date()).getTime(),0);
|
||||
}
|
||||
|
||||
public static EquipForgingBenchOV create(EquipForgingBench info){
|
||||
return JSONUtil.toBean(JSONUtil.toJsonStr(info),EquipForgingBenchOV.class);
|
||||
}
|
||||
|
||||
}
|
@@ -4,8 +4,8 @@ spring:
|
||||
datasource:
|
||||
username: pet_jisol_cn
|
||||
password: sThsBwjfDcaw2wJR
|
||||
# url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
url: jdbc:mysql://kyu.jisol.cn:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
# url: jdbc:mysql://localhost:3306/pet_jisol_cn?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
jackson:
|
||||
serialization:
|
||||
|
@@ -4,14 +4,16 @@
|
||||
"roleName": "小石头",
|
||||
"spine": 130001,
|
||||
"roleSkillIds": [],
|
||||
"roleAttackRange": 100
|
||||
"roleAttackRange": 100,
|
||||
"roleHight": 140
|
||||
},
|
||||
{
|
||||
"id": 10002,
|
||||
"roleName": "坚强小石",
|
||||
"spine": 130002,
|
||||
"roleSkillIds": [],
|
||||
"roleAttackRange": 100
|
||||
"roleAttackRange": 100,
|
||||
"roleHight": 140
|
||||
},
|
||||
{
|
||||
"id": 10003,
|
||||
@@ -20,7 +22,8 @@
|
||||
"roleSkillIds": [
|
||||
40001
|
||||
],
|
||||
"roleAttackRange": 500
|
||||
"roleAttackRange": 500,
|
||||
"roleHight": 140
|
||||
},
|
||||
{
|
||||
"id": 10004,
|
||||
@@ -29,21 +32,24 @@
|
||||
"roleSkillIds": [
|
||||
40002
|
||||
],
|
||||
"roleAttackRange": 350
|
||||
"roleAttackRange": 350,
|
||||
"roleHight": 140
|
||||
},
|
||||
{
|
||||
"id": 10005,
|
||||
"roleName": "雷吉艾斯",
|
||||
"spine": 130005,
|
||||
"roleSkillIds": [],
|
||||
"roleAttackRange": 350
|
||||
"roleAttackRange": 350,
|
||||
"roleHight": 140
|
||||
},
|
||||
{
|
||||
"id": 10006,
|
||||
"roleName": "星球杯",
|
||||
"spine": 130006,
|
||||
"roleSkillIds": [],
|
||||
"roleAttackRange": 500
|
||||
"roleAttackRange": 500,
|
||||
"roleHight": 140
|
||||
},
|
||||
{
|
||||
"id": 10007,
|
||||
@@ -52,6 +58,7 @@
|
||||
"roleSkillIds": [
|
||||
40003
|
||||
],
|
||||
"roleAttackRange": 100
|
||||
"roleAttackRange": 100,
|
||||
"roleHight": 140
|
||||
}
|
||||
]
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user