mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-26 10:16:14 +00:00
锻造接口
This commit is contained in:
Binary file not shown.
Binary file not shown.
BIN
DataTables/Datas/宠物系统/宠物装备/装备类型表.xlsx
Normal file
BIN
DataTables/Datas/宠物系统/宠物装备/装备类型表.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"ver": "2.0.1",
|
||||||
|
"importer": "json",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "c3a1d93f-a395-478a-bc8f-75e8b9732892",
|
||||||
|
"files": [
|
||||||
|
".json"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"ver": "2.0.1",
|
||||||
|
"importer": "json",
|
||||||
|
"imported": true,
|
||||||
|
"uuid": "fb023687-d8aa-40ea-9f76-813580daf63c",
|
||||||
|
"files": [
|
||||||
|
".json"
|
||||||
|
],
|
||||||
|
"subMetas": {},
|
||||||
|
"userData": {}
|
||||||
|
}
|
@@ -28,14 +28,14 @@ import AppAction from "./AppAction";
|
|||||||
import { Asset } from "cc";
|
import { Asset } from "cc";
|
||||||
import { Component } from "cc";
|
import { Component } from "cc";
|
||||||
|
|
||||||
// let APIPath = `http://localhost:8080`
|
let APIPath = `http://localhost:8080`
|
||||||
// let WsPath = `ws://localhost:8080/websocket`
|
let WsPath = `ws://localhost:8080/websocket`
|
||||||
// let APIPath = `http://192.168.1.23:8080`
|
// let APIPath = `http://192.168.1.23:8080`
|
||||||
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
// let WsPath = `ws://192.168.1.23:8080/websocket`
|
||||||
// let APIPath = `http://192.168.0.121:8080`
|
// let APIPath = `http://192.168.0.121:8080`
|
||||||
// let WsPath = `ws://192.168.0.121:8080/websocket`
|
// let WsPath = `ws://192.168.0.121:8080/websocket`
|
||||||
let APIPath = `https://api.pet.jisol.cn`
|
// let APIPath = `https://api.pet.jisol.cn`
|
||||||
let WsPath = `wss://api.pet.jisol.cn/websocket`
|
// let WsPath = `wss://api.pet.jisol.cn/websocket`
|
||||||
|
|
||||||
//重写UI
|
//重写UI
|
||||||
class JNGLayer extends JNLayer{
|
class JNGLayer extends JNLayer{
|
||||||
|
@@ -18,7 +18,7 @@ public final class TbGRoleEquip extends AbstractBean {
|
|||||||
public TbGRoleEquip(JsonObject _buf) {
|
public TbGRoleEquip(JsonObject _buf) {
|
||||||
id = _buf.get("id").getAsInt();
|
id = _buf.get("id").getAsInt();
|
||||||
name = _buf.get("name").getAsString();
|
name = _buf.get("name").getAsString();
|
||||||
type = _buf.get("type").getAsInt();
|
position = _buf.get("position").getAsInt();
|
||||||
quality = _buf.get("quality").getAsInt();
|
quality = _buf.get("quality").getAsInt();
|
||||||
icon = _buf.get("icon").getAsString();
|
icon = _buf.get("icon").getAsString();
|
||||||
{ com.google.gson.JsonArray _json0_ = _buf.get("levelBaseAttributesFactors").getAsJsonArray(); int __n0 = _json0_.size(); levelBaseAttributesFactors = new int[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { int __v0; __v0 = __e0.getAsInt(); levelBaseAttributesFactors[__index0++] = __v0; } }
|
{ com.google.gson.JsonArray _json0_ = _buf.get("levelBaseAttributesFactors").getAsJsonArray(); int __n0 = _json0_.size(); levelBaseAttributesFactors = new int[__n0]; int __index0=0; for(JsonElement __e0 : _json0_) { int __v0; __v0 = __e0.getAsInt(); levelBaseAttributesFactors[__index0++] = __v0; } }
|
||||||
@@ -43,7 +43,7 @@ public final class TbGRoleEquip extends AbstractBean {
|
|||||||
/**
|
/**
|
||||||
* 装备类别(1=武器/2=帽子/3=项链/4=护肩/5=衣服/6=腰带/7=手套/8=戒指/9=裤子/10=鞋子)
|
* 装备类别(1=武器/2=帽子/3=项链/4=护肩/5=衣服/6=腰带/7=手套/8=戒指/9=裤子/10=鞋子)
|
||||||
*/
|
*/
|
||||||
public final int type;
|
public final int position;
|
||||||
/**
|
/**
|
||||||
* 品质信息
|
* 品质信息
|
||||||
*/
|
*/
|
||||||
@@ -83,7 +83,7 @@ public final class TbGRoleEquip extends AbstractBean {
|
|||||||
return "{ "
|
return "{ "
|
||||||
+ "(format_field_name __code_style field.name):" + id + ","
|
+ "(format_field_name __code_style field.name):" + id + ","
|
||||||
+ "(format_field_name __code_style field.name):" + name + ","
|
+ "(format_field_name __code_style field.name):" + name + ","
|
||||||
+ "(format_field_name __code_style field.name):" + type + ","
|
+ "(format_field_name __code_style field.name):" + position + ","
|
||||||
+ "(format_field_name __code_style field.name):" + quality + ","
|
+ "(format_field_name __code_style field.name):" + quality + ","
|
||||||
+ "(format_field_name __code_style field.name):" + icon + ","
|
+ "(format_field_name __code_style field.name):" + icon + ","
|
||||||
+ "(format_field_name __code_style field.name):" + levelBaseAttributesFactors + ","
|
+ "(format_field_name __code_style field.name):" + levelBaseAttributesFactors + ","
|
||||||
|
@@ -0,0 +1,49 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
package cfg.TB;
|
||||||
|
|
||||||
|
import luban.*;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
|
||||||
|
public final class TbGRoleEquipType extends AbstractBean {
|
||||||
|
public TbGRoleEquipType(JsonObject _buf) {
|
||||||
|
id = _buf.get("id").getAsInt();
|
||||||
|
name = _buf.get("name").getAsString();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static TbGRoleEquipType deserialize(JsonObject _buf) {
|
||||||
|
return new cfg.TB.TbGRoleEquipType(_buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型Id
|
||||||
|
*/
|
||||||
|
public final int id;
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
public final String name;
|
||||||
|
|
||||||
|
public static final int __ID__ = 1533767739;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getTypeId() { return __ID__; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{ "
|
||||||
|
+ "(format_field_name __code_style field.name):" + id + ","
|
||||||
|
+ "(format_field_name __code_style field.name):" + name + ","
|
||||||
|
+ "}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@@ -57,6 +57,8 @@ public final class Tables
|
|||||||
public cfg.TbGRoleEquipLevel getTbGRoleEquipLevel() { return _tbgroleequiplevel; }
|
public cfg.TbGRoleEquipLevel getTbGRoleEquipLevel() { return _tbgroleequiplevel; }
|
||||||
private final cfg.TbGRoleEquipQuality _tbgroleequipquality;
|
private final cfg.TbGRoleEquipQuality _tbgroleequipquality;
|
||||||
public cfg.TbGRoleEquipQuality getTbGRoleEquipQuality() { return _tbgroleequipquality; }
|
public cfg.TbGRoleEquipQuality getTbGRoleEquipQuality() { return _tbgroleequipquality; }
|
||||||
|
private final cfg.TbGRoleEquipType _tbgroleequiptype;
|
||||||
|
public cfg.TbGRoleEquipType getTbGRoleEquipType() { return _tbgroleequiptype; }
|
||||||
private final cfg.TbGSysFuben _tbgsysfuben;
|
private final cfg.TbGSysFuben _tbgsysfuben;
|
||||||
public cfg.TbGSysFuben getTbGSysFuben() { return _tbgsysfuben; }
|
public cfg.TbGSysFuben getTbGSysFuben() { return _tbgsysfuben; }
|
||||||
|
|
||||||
@@ -80,6 +82,7 @@ public final class Tables
|
|||||||
_tbgroleequip = new cfg.TbGRoleEquip(loader.load("tbgroleequip"));
|
_tbgroleequip = new cfg.TbGRoleEquip(loader.load("tbgroleequip"));
|
||||||
_tbgroleequiplevel = new cfg.TbGRoleEquipLevel(loader.load("tbgroleequiplevel"));
|
_tbgroleequiplevel = new cfg.TbGRoleEquipLevel(loader.load("tbgroleequiplevel"));
|
||||||
_tbgroleequipquality = new cfg.TbGRoleEquipQuality(loader.load("tbgroleequipquality"));
|
_tbgroleequipquality = new cfg.TbGRoleEquipQuality(loader.load("tbgroleequipquality"));
|
||||||
|
_tbgroleequiptype = new cfg.TbGRoleEquipType(loader.load("tbgroleequiptype"));
|
||||||
_tbgsysfuben = new cfg.TbGSysFuben(loader.load("tbgsysfuben"));
|
_tbgsysfuben = new cfg.TbGSysFuben(loader.load("tbgsysfuben"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
37
JisolGameServer/Main/src/main/java/cfg/TbGRoleEquipType.java
Normal file
37
JisolGameServer/Main/src/main/java/cfg/TbGRoleEquipType.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by a tool.
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
package cfg;
|
||||||
|
|
||||||
|
import luban.*;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
|
||||||
|
|
||||||
|
public final class TbGRoleEquipType {
|
||||||
|
private final java.util.HashMap<Integer, cfg.TB.TbGRoleEquipType> _dataMap;
|
||||||
|
private final java.util.ArrayList<cfg.TB.TbGRoleEquipType> _dataList;
|
||||||
|
|
||||||
|
public TbGRoleEquipType(JsonElement _buf) {
|
||||||
|
_dataMap = new java.util.HashMap<Integer, cfg.TB.TbGRoleEquipType>();
|
||||||
|
_dataList = new java.util.ArrayList<cfg.TB.TbGRoleEquipType>();
|
||||||
|
|
||||||
|
for (com.google.gson.JsonElement _e_ : _buf.getAsJsonArray()) {
|
||||||
|
cfg.TB.TbGRoleEquipType _v;
|
||||||
|
_v = cfg.TB.TbGRoleEquipType.deserialize(_e_.getAsJsonObject());
|
||||||
|
_dataList.add(_v);
|
||||||
|
_dataMap.put(_v.id, _v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public java.util.HashMap<Integer, cfg.TB.TbGRoleEquipType> getDataMap() { return _dataMap; }
|
||||||
|
public java.util.ArrayList<cfg.TB.TbGRoleEquipType> getDataList() { return _dataList; }
|
||||||
|
|
||||||
|
public cfg.TB.TbGRoleEquipType get(int key) { return _dataMap.get(key); }
|
||||||
|
|
||||||
|
}
|
@@ -1,13 +1,10 @@
|
|||||||
package cn.jisol.game.controller.argsresolver;
|
package cn.jisol.game.controller.argsresolver;
|
||||||
|
|
||||||
import cn.jisol.game.controller.exception.PlayerException;
|
|
||||||
import cn.jisol.game.controller.exception.TokenException;
|
import cn.jisol.game.controller.exception.TokenException;
|
||||||
import cn.jisol.game.controller.game.GPlayerController;
|
import cn.jisol.game.controller.game.GPlayerController;
|
||||||
import cn.jisol.game.data.Cache;
|
import cn.jisol.game.data.Cache;
|
||||||
import cn.jisol.game.entity.User;
|
import cn.jisol.game.entity.User;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.service.impl.PlayerServiceImpl;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.core.MethodParameter;
|
import org.springframework.core.MethodParameter;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.support.WebDataBinderFactory;
|
import org.springframework.web.bind.support.WebDataBinderFactory;
|
||||||
|
@@ -5,8 +5,8 @@ import cn.hutool.json.JSONUtil;
|
|||||||
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
||||||
import cn.jisol.game.data.GlobalId;
|
import cn.jisol.game.data.GlobalId;
|
||||||
import cn.jisol.game.data.TD;
|
import cn.jisol.game.data.TD;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
import cn.jisol.game.service.PlayerPetService;
|
import cn.jisol.game.service.PlayerPetService;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
@@ -3,8 +3,7 @@ package cn.jisol.game.controller.game;
|
|||||||
import cn.jisol.game.controller.HttpCode;
|
import cn.jisol.game.controller.HttpCode;
|
||||||
import cn.jisol.game.controller.argsresolver.CurrentUser;
|
import cn.jisol.game.controller.argsresolver.CurrentUser;
|
||||||
import cn.jisol.game.entity.User;
|
import cn.jisol.game.entity.User;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.service.PlayerService;
|
|
||||||
import cn.jisol.game.service.impl.PlayerServiceImpl;
|
import cn.jisol.game.service.impl.PlayerServiceImpl;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@@ -12,7 +11,6 @@ import io.swagger.annotations.Api;
|
|||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@@ -1,19 +1,136 @@
|
|||||||
package cn.jisol.game.controller.game;
|
package cn.jisol.game.controller.game;
|
||||||
|
|
||||||
|
import cfg.TB.TbGRoleEquip;
|
||||||
|
import cfg.TB.TbGRoleEquipQuality;
|
||||||
|
import cfg.TB.TbGRoleEquipType;
|
||||||
|
import cfg.TbGEntity.TAttributeValue;
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
||||||
|
import cn.jisol.game.data.ResourceId;
|
||||||
|
import cn.jisol.game.data.TD;
|
||||||
|
import cn.jisol.game.entity.data.GAttribute;
|
||||||
|
import cn.jisol.game.entity.table.*;
|
||||||
|
import cn.jisol.game.service.EquipForgingBenchService;
|
||||||
|
import cn.jisol.game.service.PetEquipService;
|
||||||
|
import cn.jisol.game.service.ResourceService;
|
||||||
|
import cn.jisol.game.util.GRandomUtil;
|
||||||
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
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.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 玩家宠物装备
|
* 玩家宠物装备
|
||||||
*/
|
*/
|
||||||
@Api(value = "JNGameDemo - API", tags = {"PET - API"})
|
@Api(value = "JNGameDemo - API", tags = {"玩家宠物装备 - API"})
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/game/equip")
|
@RequestMapping("/game/equip")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public class GPlayerEquipController {
|
public class GPlayerEquipController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
PetEquipService petEquipService;
|
||||||
|
@Autowired
|
||||||
|
EquipForgingBenchService equipForgingBenchService;
|
||||||
|
@Autowired
|
||||||
|
ResourceService resourceService;
|
||||||
|
|
||||||
|
//获取玩家宠物列表
|
||||||
|
@ApiImplicitParams({})
|
||||||
|
@ApiOperation(value = "锻造装备(扣除玩家锻造石 打造一件装备)")
|
||||||
|
@GetMapping("/forging")
|
||||||
|
@Transactional
|
||||||
|
public NewsContext<PetEquip> forging(@CurrentPlayer Player player){
|
||||||
|
|
||||||
|
//扣除一个锻造石
|
||||||
|
resourceService.addResourceValue(player.getPlayerId(), ResourceId.ForgedStones.id, -1L);
|
||||||
|
|
||||||
|
//获取锻造台
|
||||||
|
EquipForgingBench forgingInfo = this.forgingInfo(player).data;
|
||||||
|
|
||||||
|
//随机取一个部位
|
||||||
|
TbGRoleEquipType position = GRandomUtil.randomArray(TD.DATA.getTbGRoleEquipType().getDataList());
|
||||||
|
|
||||||
|
//获取品质
|
||||||
|
TbGRoleEquipQuality qualityInfo = TD.DATA.getTbGRoleEquipQuality().get(forgingInfo.getForgingQuality());
|
||||||
|
//根据品质概率随机品质
|
||||||
|
int quality = GRandomUtil.odds(qualityInfo.odds) + 1;
|
||||||
|
|
||||||
|
//筛选装备
|
||||||
|
List<TbGRoleEquip> equips = TD.DATA.getTbGRoleEquip().getDataList().stream().filter(info -> (info.quality == quality && info.position == position.id)).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//随机取一个装备
|
||||||
|
TbGRoleEquip equipInfo = GRandomUtil.randomArray(equips);
|
||||||
|
|
||||||
|
PetEquip equip = new PetEquip();
|
||||||
|
equip.setEquipCfgId(equipInfo.id);
|
||||||
|
equip.setEquipPlayerId(player.getPlayerId());
|
||||||
|
equip.setEquipLevel(forgingInfo.getForgingLevel());
|
||||||
|
equip.setEquipPosition(equipInfo.position);
|
||||||
|
equip.setEquipBaseAttributes(
|
||||||
|
Arrays.stream(equipInfo.baseAttributes).map(ranges ->
|
||||||
|
GAttribute.builder()
|
||||||
|
.id(ranges[0].id)
|
||||||
|
.value(RandomUtil.randomInt(ranges[0].value, ranges[1].value))
|
||||||
|
.build())
|
||||||
|
.collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
if (equipInfo.highAttributeSize[0] != equipInfo.highAttributeSize[1]){
|
||||||
|
equip.setEquipHighAttributes(
|
||||||
|
Arrays.stream(new Object[RandomUtil.randomInt(equipInfo.highAttributeSize[0],equipInfo.highAttributeSize[1] + 1)]).map(item -> {
|
||||||
|
//随机取一个高级属性
|
||||||
|
TAttributeValue[] ranges = GRandomUtil.randomArray(Arrays.asList(equipInfo.highAttributes));
|
||||||
|
return GAttribute.builder()
|
||||||
|
.id(ranges[0].id)
|
||||||
|
.value(RandomUtil.randomInt(ranges[0].value, ranges[1].value + 1))
|
||||||
|
.build();
|
||||||
|
}).collect(Collectors.toList())
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
equip.setEquipHighAttributes(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
petEquipService.save(equip);
|
||||||
|
|
||||||
|
return NewsContext.onSuccess("锻造成功",petEquipService.getById(equip.getEquipId()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取锻造台等级
|
||||||
|
@ApiImplicitParams({})
|
||||||
|
@ApiOperation(value = "获取锻造台")
|
||||||
|
@GetMapping("/forging/info")
|
||||||
|
public NewsContext<EquipForgingBench> forgingInfo(@CurrentPlayer Player player){
|
||||||
|
|
||||||
|
EquipForgingBench info = equipForgingBenchService.getOne(Wrappers.lambdaQuery(EquipForgingBench.class).eq(EquipForgingBench::getPlayerId,player.getPlayerId()));
|
||||||
|
|
||||||
|
//如果没有阵法则创建一个
|
||||||
|
if(Objects.isNull(info)){
|
||||||
|
try{
|
||||||
|
info = EquipForgingBench.builder().playerId(player.getPlayerId())
|
||||||
|
.forgingQuality(TD.DATA.getTbGRoleEquipQuality().getDataList().get(0).id)
|
||||||
|
.forgingLevel(TD.DATA.getTbGRoleEquipLevel().getDataList().get(0).id).build();
|
||||||
|
equipForgingBenchService.saveOrUpdate(info);
|
||||||
|
}catch (Exception ignored){}
|
||||||
|
assert equipForgingBenchService != null;
|
||||||
|
info = equipForgingBenchService.getById(player.getPlayerId());
|
||||||
|
}
|
||||||
|
|
||||||
|
return NewsContext.onSuccess("获取成功",info);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4,9 +4,9 @@ import cfg.TB.TbGRoleUpLevel;
|
|||||||
import cfg.TbGEntity.TResource;
|
import cfg.TbGEntity.TResource;
|
||||||
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
||||||
import cn.jisol.game.data.TD;
|
import cn.jisol.game.data.TD;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
import cn.jisol.game.entity.game.Resource;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.service.PlayerPetService;
|
import cn.jisol.game.service.PlayerPetService;
|
||||||
import cn.jisol.game.service.ResourceService;
|
import cn.jisol.game.service.ResourceService;
|
||||||
import cn.jisol.game.vo.news.NewsResource;
|
import cn.jisol.game.vo.news.NewsResource;
|
||||||
|
@@ -1,20 +1,16 @@
|
|||||||
package cn.jisol.game.controller.game;
|
package cn.jisol.game.controller.game;
|
||||||
|
|
||||||
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerTactical;
|
||||||
import cn.jisol.game.entity.game.PlayerTactical;
|
|
||||||
import cn.jisol.game.service.PlayerPetService;
|
|
||||||
import cn.jisol.game.service.PlayerTacticalService;
|
import cn.jisol.game.service.PlayerTacticalService;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
package cn.jisol.game.controller.game;
|
package cn.jisol.game.controller.game;
|
||||||
|
|
||||||
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.game.PlayerTactical;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.entity.game.Resource;
|
|
||||||
import cn.jisol.game.service.ResourceService;
|
import cn.jisol.game.service.ResourceService;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
@@ -16,7 +15,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.sql.Wrapper;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -7,9 +7,9 @@ import cn.jisol.game.controller.argsresolver.CurrentPlayer;
|
|||||||
import cn.jisol.game.data.GlobalId;
|
import cn.jisol.game.data.GlobalId;
|
||||||
import cn.jisol.game.data.ResourceId;
|
import cn.jisol.game.data.ResourceId;
|
||||||
import cn.jisol.game.data.TD;
|
import cn.jisol.game.data.TD;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
import cn.jisol.game.entity.game.Resource;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.entity.mode.ModeOnHook;
|
import cn.jisol.game.entity.mode.ModeOnHook;
|
||||||
import cn.jisol.game.entity.mode.ModeOnHookInfo;
|
import cn.jisol.game.entity.mode.ModeOnHookInfo;
|
||||||
import cn.jisol.game.mapper.ModeOnHookMapper;
|
import cn.jisol.game.mapper.ModeOnHookMapper;
|
||||||
@@ -22,7 +22,6 @@ import cn.jisol.game.vo.mode.ModeOnHookRankingOV;
|
|||||||
import cn.jisol.game.vo.news.NewsResource;
|
import cn.jisol.game.vo.news.NewsResource;
|
||||||
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package cn.jisol.game.data;
|
package cn.jisol.game.data;
|
||||||
|
|
||||||
import cn.jisol.game.entity.User;
|
import cn.jisol.game.entity.User;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@@ -4,6 +4,8 @@ public enum ResourceId {
|
|||||||
|
|
||||||
//金币资源
|
//金币资源
|
||||||
Gold(90001),
|
Gold(90001),
|
||||||
|
//锻造石
|
||||||
|
ForgedStones(90002),
|
||||||
;
|
;
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
|
@@ -0,0 +1,19 @@
|
|||||||
|
package cn.jisol.game.entity.data;
|
||||||
|
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
//游戏属性类
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@Builder
|
||||||
|
public class GAttribute {
|
||||||
|
|
||||||
|
//属性Id
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
//属性值
|
||||||
|
private int value;
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,20 @@
|
|||||||
|
package cn.jisol.game.entity.table;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Builder
|
||||||
|
@Data
|
||||||
|
@TableName("`equip_forging_bench`")
|
||||||
|
public class EquipForgingBench {
|
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Integer forgingId; //锻造台Id
|
||||||
|
private Long playerId; //锻造台所属的玩家Id
|
||||||
|
private Integer forgingLevel; //锻造等级
|
||||||
|
private Integer forgingQuality; //锻造品质等级
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,32 @@
|
|||||||
|
package cn.jisol.game.entity.table;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.data.GAttribute;
|
||||||
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//宠物装备
|
||||||
|
@Data
|
||||||
|
@TableName(value = "`pet_equip`",autoResultMap = true)
|
||||||
|
public class PetEquip {
|
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO)
|
||||||
|
private Integer equipId; //装备唯一Id
|
||||||
|
private Integer equipCfgId; //装备配置表Id
|
||||||
|
private Long equipPlayerId; //装备的所属玩家Id
|
||||||
|
private Integer equipLevel; //装备等级
|
||||||
|
private Integer equipWear; //当前装备穿戴的宠物Id
|
||||||
|
private Integer equipPosition; //装备部位
|
||||||
|
|
||||||
|
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||||
|
private List<GAttribute> equipBaseAttributes; //装备基础属性列表 JSON
|
||||||
|
@TableField(typeHandler = FastjsonTypeHandler.class)
|
||||||
|
private List<GAttribute> equipHighAttributes; //装备高级属性列表 JSON
|
||||||
|
}
|
@@ -1,4 +1,4 @@
|
|||||||
package cn.jisol.game.entity.game;
|
package cn.jisol.game.entity.table;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
@@ -1,4 +1,4 @@
|
|||||||
package cn.jisol.game.entity.game;
|
package cn.jisol.game.entity.table;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
@@ -1,4 +1,4 @@
|
|||||||
package cn.jisol.game.entity.game;
|
package cn.jisol.game.entity.table;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
@@ -1,4 +1,4 @@
|
|||||||
package cn.jisol.game.entity.game;
|
package cn.jisol.game.entity.table;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.jisol.game.mapper;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.table.EquipForgingBench;
|
||||||
|
import cn.jisol.game.entity.table.PetEquip;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public interface EquipForgingBenchMapper extends BaseMapper<EquipForgingBench> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -1,6 +1,5 @@
|
|||||||
package cn.jisol.game.mapper;
|
package cn.jisol.game.mapper;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.Player;
|
|
||||||
import cn.jisol.game.entity.mode.ModeOnHook;
|
import cn.jisol.game.entity.mode.ModeOnHook;
|
||||||
import cn.jisol.game.vo.mode.ModeOnHookRankingOV;
|
import cn.jisol.game.vo.mode.ModeOnHookRankingOV;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
@@ -0,0 +1,11 @@
|
|||||||
|
package cn.jisol.game.mapper;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.table.PetEquip;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public interface PetEquipMapper extends BaseMapper<PetEquip> {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
package cn.jisol.game.mapper;
|
package cn.jisol.game.mapper;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
package cn.jisol.game.mapper;
|
package cn.jisol.game.mapper;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package cn.jisol.game.mapper;
|
package cn.jisol.game.mapper;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerTactical;
|
||||||
import cn.jisol.game.entity.game.PlayerTactical;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package cn.jisol.game.mapper;
|
package cn.jisol.game.mapper;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.entity.game.Resource;
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@@ -2,10 +2,9 @@ package cn.jisol.game.network.client;
|
|||||||
|
|
||||||
import cn.jisol.game.data.Cache;
|
import cn.jisol.game.data.Cache;
|
||||||
import cn.jisol.game.entity.User;
|
import cn.jisol.game.entity.User;
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.ngame.client.QueueNClient;
|
import cn.jisol.ngame.client.QueueNClient;
|
||||||
|
|
||||||
import javax.websocket.EncodeException;
|
|
||||||
import javax.websocket.Session;
|
import javax.websocket.Session;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@@ -0,0 +1,9 @@
|
|||||||
|
package cn.jisol.game.service;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.table.EquipForgingBench;
|
||||||
|
import cn.jisol.game.entity.table.PetEquip;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface EquipForgingBenchService extends IService<EquipForgingBench> {
|
||||||
|
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
package cn.jisol.game.service;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.table.PetEquip;
|
||||||
|
import cn.jisol.game.entity.table.PlayerTactical;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
public interface PetEquipService extends IService<PetEquip> {
|
||||||
|
|
||||||
|
}
|
@@ -1,6 +1,6 @@
|
|||||||
package cn.jisol.game.service;
|
package cn.jisol.game.service;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
public interface PlayerPetService extends IService<PlayerPet> {
|
public interface PlayerPetService extends IService<PlayerPet> {
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package cn.jisol.game.service;
|
package cn.jisol.game.service;
|
||||||
|
|
||||||
import cn.jisol.game.entity.User;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.game.Player;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
public interface PlayerService extends IService<Player> {
|
public interface PlayerService extends IService<Player> {
|
||||||
|
@@ -1,7 +1,6 @@
|
|||||||
package cn.jisol.game.service;
|
package cn.jisol.game.service;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerTactical;
|
||||||
import cn.jisol.game.entity.game.PlayerTactical;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
public interface PlayerTacticalService extends IService<PlayerTactical> {
|
public interface PlayerTacticalService extends IService<PlayerTactical> {
|
||||||
|
@@ -1,8 +1,6 @@
|
|||||||
package cn.jisol.game.service;
|
package cn.jisol.game.service;
|
||||||
|
|
||||||
import cn.jisol.game.data.ResourceId;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
|
||||||
import cn.jisol.game.entity.game.Resource;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
public interface ResourceService extends IService<Resource> {
|
public interface ResourceService extends IService<Resource> {
|
||||||
|
@@ -0,0 +1,14 @@
|
|||||||
|
package cn.jisol.game.service.impl;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.table.EquipForgingBench;
|
||||||
|
import cn.jisol.game.entity.table.PetEquip;
|
||||||
|
import cn.jisol.game.mapper.EquipForgingBenchMapper;
|
||||||
|
import cn.jisol.game.mapper.PetEquipMapper;
|
||||||
|
import cn.jisol.game.service.EquipForgingBenchService;
|
||||||
|
import cn.jisol.game.service.PetEquipService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class EquipForgingBenchServiceImpl extends ServiceImpl<EquipForgingBenchMapper, EquipForgingBench> implements EquipForgingBenchService {
|
||||||
|
}
|
@@ -0,0 +1,12 @@
|
|||||||
|
package cn.jisol.game.service.impl;
|
||||||
|
|
||||||
|
import cn.jisol.game.entity.table.PetEquip;
|
||||||
|
import cn.jisol.game.mapper.ModeOnHookMapper;
|
||||||
|
import cn.jisol.game.mapper.PetEquipMapper;
|
||||||
|
import cn.jisol.game.service.PetEquipService;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PetEquipServiceImpl extends ServiceImpl<PetEquipMapper, PetEquip> implements PetEquipService {
|
||||||
|
}
|
@@ -1,11 +1,8 @@
|
|||||||
package cn.jisol.game.service.impl;
|
package cn.jisol.game.service.impl;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.Player;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
|
||||||
import cn.jisol.game.mapper.PlayerMapper;
|
|
||||||
import cn.jisol.game.mapper.PlayerPetMapper;
|
import cn.jisol.game.mapper.PlayerPetMapper;
|
||||||
import cn.jisol.game.service.PlayerPetService;
|
import cn.jisol.game.service.PlayerPetService;
|
||||||
import cn.jisol.game.service.PlayerService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@@ -1,11 +1,8 @@
|
|||||||
package cn.jisol.game.service.impl;
|
package cn.jisol.game.service.impl;
|
||||||
|
|
||||||
import cn.jisol.game.entity.User;
|
import cn.jisol.game.entity.table.Player;
|
||||||
import cn.jisol.game.entity.game.Player;
|
|
||||||
import cn.jisol.game.mapper.PlayerMapper;
|
import cn.jisol.game.mapper.PlayerMapper;
|
||||||
import cn.jisol.game.mapper.UserMapper;
|
|
||||||
import cn.jisol.game.service.PlayerService;
|
import cn.jisol.game.service.PlayerService;
|
||||||
import cn.jisol.game.service.UserService;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@@ -1,10 +1,7 @@
|
|||||||
package cn.jisol.game.service.impl;
|
package cn.jisol.game.service.impl;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerTactical;
|
||||||
import cn.jisol.game.entity.game.PlayerTactical;
|
|
||||||
import cn.jisol.game.mapper.PlayerPetMapper;
|
|
||||||
import cn.jisol.game.mapper.PlayerTacticalMapper;
|
import cn.jisol.game.mapper.PlayerTacticalMapper;
|
||||||
import cn.jisol.game.service.PlayerPetService;
|
|
||||||
import cn.jisol.game.service.PlayerTacticalService;
|
import cn.jisol.game.service.PlayerTacticalService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
@@ -1,9 +1,7 @@
|
|||||||
package cn.jisol.game.service.impl;
|
package cn.jisol.game.service.impl;
|
||||||
|
|
||||||
import cn.jisol.game.controller.exception.ResourceNotException;
|
import cn.jisol.game.controller.exception.ResourceNotException;
|
||||||
import cn.jisol.game.data.ResourceId;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.entity.game.Player;
|
|
||||||
import cn.jisol.game.entity.game.Resource;
|
|
||||||
import cn.jisol.game.mapper.ResourceMapper;
|
import cn.jisol.game.mapper.ResourceMapper;
|
||||||
import cn.jisol.game.service.ResourceService;
|
import cn.jisol.game.service.ResourceService;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
@@ -12,7 +10,6 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||||||
import org.springframework.retry.RetryException;
|
import org.springframework.retry.RetryException;
|
||||||
import org.springframework.retry.annotation.Retryable;
|
import org.springframework.retry.annotation.Retryable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@@ -0,0 +1,30 @@
|
|||||||
|
package cn.jisol.game.util;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
public class GRandomUtil {
|
||||||
|
|
||||||
|
//随机数值中任意一个对象
|
||||||
|
public static <T> T randomArray(List<T> list){
|
||||||
|
return list.get(RandomUtil.randomInt(0, list.size()));
|
||||||
|
}
|
||||||
|
|
||||||
|
//概率随机 (通过概率 返回 中奖下标)
|
||||||
|
public static int odds(int[] odds){
|
||||||
|
|
||||||
|
int sum = IntStream.of(odds).sum();
|
||||||
|
int random = RandomUtil.randomInt(0, sum);
|
||||||
|
|
||||||
|
for (int i = 0; i < odds.length; i++) {
|
||||||
|
if((random-=odds[i]) <= 0) return i;
|
||||||
|
}
|
||||||
|
return odds.length - 1;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@@ -1,11 +1,10 @@
|
|||||||
package cn.jisol.game.vo.news;
|
package cn.jisol.game.vo.news;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.Resource;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
import cn.jisol.game.vo.news.ov.ResourceUpdateOV;
|
||||||
import cn.jisol.ngame.util.NewsContext;
|
import cn.jisol.ngame.util.NewsContext;
|
||||||
import io.swagger.annotations.ApiResponse;
|
import io.swagger.annotations.ApiResponse;
|
||||||
import io.swagger.annotations.ApiResponses;
|
import io.swagger.annotations.ApiResponses;
|
||||||
import lombok.Builder;
|
|
||||||
import lombok.experimental.SuperBuilder;
|
import lombok.experimental.SuperBuilder;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
package cn.jisol.game.vo.news.ov;
|
package cn.jisol.game.vo.news.ov;
|
||||||
|
|
||||||
import cn.jisol.game.entity.game.PlayerPet;
|
import cn.jisol.game.entity.table.PlayerPet;
|
||||||
import cn.jisol.game.entity.game.Resource;
|
import cn.jisol.game.entity.table.Resource;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
@@ -3,5 +3,10 @@
|
|||||||
"id": 90001,
|
"id": 90001,
|
||||||
"name": "金币",
|
"name": "金币",
|
||||||
"tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物"
|
"tig": "金币 (目前叫做金币 名称还没有定) 游戏的基础资源 用于升级宠物"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 90002,
|
||||||
|
"name": "锻造石",
|
||||||
|
"tig": "锻造石 可以锻造装备的石头"
|
||||||
}
|
}
|
||||||
]
|
]
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,42 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"name": "武器"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"name": "帽子"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"name": "项链"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"name": "护肩"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"name": "衣服"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"name": "腰带"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"name": "手套"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"name": "戒指"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"name": "裤子"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"name": "鞋子"
|
||||||
|
}
|
||||||
|
]
|
113
pet_jisol_cn.sql
Normal file
113
pet_jisol_cn.sql
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
Navicat Premium Data Transfer
|
||||||
|
|
||||||
|
Source Server : pet_jisol_cn
|
||||||
|
Source Server Type : MySQL
|
||||||
|
Source Server Version : 50734 (5.7.34-log)
|
||||||
|
Source Host : kyu.jisol.cn:3306
|
||||||
|
Source Schema : pet_jisol_cn
|
||||||
|
|
||||||
|
Target Server Type : MySQL
|
||||||
|
Target Server Version : 50734 (5.7.34-log)
|
||||||
|
File Encoding : 65001
|
||||||
|
|
||||||
|
Date: 07/01/2024 17:51:44
|
||||||
|
*/
|
||||||
|
|
||||||
|
SET NAMES utf8mb4;
|
||||||
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for mode_on_hook
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `mode_on_hook`;
|
||||||
|
CREATE TABLE `mode_on_hook` (
|
||||||
|
`player_id` bigint(32) UNSIGNED NOT NULL COMMENT '玩家Id',
|
||||||
|
`on_hook_map` bigint(32) UNSIGNED NOT NULL COMMENT '当前玩家所在地图的配置表Id',
|
||||||
|
`on_hook_info` json NULL COMMENT '玩家地图信息',
|
||||||
|
PRIMARY KEY (`player_id`) USING BTREE,
|
||||||
|
UNIQUE INDEX `player_id`(`player_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for player
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `player`;
|
||||||
|
CREATE TABLE `player` (
|
||||||
|
`player_id` bigint(32) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '服务器玩家Id',
|
||||||
|
`user_id` bigint(32) NOT NULL COMMENT '玩家Id',
|
||||||
|
`player_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '玩家名称',
|
||||||
|
`player_create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '玩家创建时间',
|
||||||
|
`is_novice` tinyint(1) NOT NULL DEFAULT 0 COMMENT '玩家是否过了新手引导',
|
||||||
|
PRIMARY KEY (`player_id`) USING BTREE,
|
||||||
|
UNIQUE INDEX `user_id`(`user_id`) USING BTREE,
|
||||||
|
UNIQUE INDEX `player_id`(`player_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 412 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for player_equip
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `player_equip`;
|
||||||
|
CREATE TABLE `player_equip` (
|
||||||
|
`equip_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '装备唯一Id',
|
||||||
|
`equip_cfg_id` bigint(20) NOT NULL COMMENT '装备配置表Id',
|
||||||
|
`equip_level` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '装备等级',
|
||||||
|
`equip_wear` bigint(20) NULL DEFAULT NULL COMMENT '当前装备穿戴的宠物Id',
|
||||||
|
`equip_position` bigint(20) NOT NULL COMMENT '装备部位',
|
||||||
|
`equip_base_attributes` json NULL COMMENT '装备基础属性',
|
||||||
|
`equip_high_attributes` json NULL COMMENT '装备高级属性',
|
||||||
|
PRIMARY KEY (`equip_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for player_pet
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `player_pet`;
|
||||||
|
CREATE TABLE `player_pet` (
|
||||||
|
`pet_id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '宠物唯一Id',
|
||||||
|
`pet_player_id` bigint(32) NOT NULL COMMENT '宠物所属的玩家Id',
|
||||||
|
`pet_tb_id` bigint(20) UNSIGNED NOT NULL COMMENT '宠物配置表Id',
|
||||||
|
`pet_level` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '宠物等级',
|
||||||
|
`pet_star` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '宠物星级',
|
||||||
|
`pet_star_exp` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '宠物星级经验',
|
||||||
|
`version` bigint(20) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新版本号',
|
||||||
|
PRIMARY KEY (`pet_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 1677 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for player_tactical
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `player_tactical`;
|
||||||
|
CREATE TABLE `player_tactical` (
|
||||||
|
`player_id` bigint(32) UNSIGNED NOT NULL COMMENT '服务器玩家Id',
|
||||||
|
`tactical_data` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '阵法数据',
|
||||||
|
PRIMARY KEY (`player_id`) USING BTREE,
|
||||||
|
UNIQUE INDEX `player_id`(`player_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for resource
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `resource`;
|
||||||
|
CREATE TABLE `resource` (
|
||||||
|
`resource_id` bigint(32) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '玩家资源Id',
|
||||||
|
`player_id` bigint(32) NOT NULL COMMENT '玩家Id',
|
||||||
|
`resource_tb_id` bigint(32) NOT NULL COMMENT '玩家资源配置表Id',
|
||||||
|
`resource_value` bigint(32) UNSIGNED NOT NULL COMMENT '玩家资源数量',
|
||||||
|
`version` bigint(32) UNSIGNED NOT NULL DEFAULT 0 COMMENT '版本号',
|
||||||
|
PRIMARY KEY (`resource_id`) USING BTREE,
|
||||||
|
UNIQUE INDEX `playerid_resourcetbid`(`player_id`, `resource_tb_id`) USING BTREE COMMENT '玩家的同一个资源是唯一的'
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 71 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
-- ----------------------------
|
||||||
|
-- Table structure for user
|
||||||
|
-- ----------------------------
|
||||||
|
DROP TABLE IF EXISTS `user`;
|
||||||
|
CREATE TABLE `user` (
|
||||||
|
`user_id` bigint(32) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '玩家Id',
|
||||||
|
`user_pass` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '玩家密码',
|
||||||
|
`user_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '玩家名称',
|
||||||
|
PRIMARY KEY (`user_id`) USING BTREE
|
||||||
|
) ENGINE = InnoDB AUTO_INCREMENT = 101220 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = Dynamic;
|
||||||
|
|
||||||
|
SET FOREIGN_KEY_CHECKS = 1;
|
Reference in New Issue
Block a user