This commit is contained in:
PC-20230316NUNE\Administrator
2023-11-27 19:00:51 +08:00
parent 0da4b5e8d8
commit 62959f80e4
19 changed files with 412 additions and 1 deletions

View File

@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
// <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 TbGAttribute extends AbstractBean {
public TbGAttribute(JsonObject _buf) {
id = _buf.get("id").getAsInt();
name = _buf.get("name").getAsString();
sign = _buf.get("sign").getAsString();
}
public static TbGAttribute deserialize(JsonObject _buf) {
return new cfg.TB.TbGAttribute(_buf);
}
/**
* id
*/
public final int id;
/**
* 属性名称
*/
public final String name;
/**
* 属性标识
*/
public final String sign;
public static final int __ID__ = 1361501859;
@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 + ","
+ "(format_field_name __code_style field.name):" + sign + ","
+ "}";
}
}

View File

@@ -0,0 +1,55 @@
//------------------------------------------------------------------------------
// <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 TbGRoleBaseAttribute extends AbstractBean {
public TbGRoleBaseAttribute(JsonObject _buf) {
id = _buf.get("id").getAsInt();
Attack = _buf.get("Attack").getAsInt();
Defend = _buf.get("Defend").getAsInt();
}
public static TbGRoleBaseAttribute deserialize(JsonObject _buf) {
return new cfg.TB.TbGRoleBaseAttribute(_buf);
}
/**
* 角色Id (0 则默认)
*/
public final int id;
/**
* 默认攻击属性
*/
public final int Attack;
/**
* 默认防御属性
*/
public final int Defend;
public static final int __ID__ = 1489419004;
@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):" + Attack + ","
+ "(format_field_name __code_style field.name):" + Defend + ","
+ "}";
}
}

View File

@@ -41,6 +41,10 @@ public final class Tables
public cfg.TbGRoleUpStar getTbGRoleUpStar() { return _tbgroleupstar; }
private final cfg.TbSServerInfo _tbsserverinfo;
public cfg.TbSServerInfo getTbSServerInfo() { return _tbsserverinfo; }
private final cfg.TbGAttribute _tbgattribute;
public cfg.TbGAttribute getTbGAttribute() { return _tbgattribute; }
private final cfg.TbGRoleBaseAttribute _tbgrolebaseattribute;
public cfg.TbGRoleBaseAttribute getTbGRoleBaseAttribute() { return _tbgrolebaseattribute; }
public Tables(IJsonLoader loader) throws java.io.IOException {
_tbgglobal = new cfg.TbGGlobal(loader.load("tbgglobal"));
@@ -54,6 +58,8 @@ public final class Tables
_tbgroleuplevel = new cfg.TbGRoleUpLevel(loader.load("tbgroleuplevel"));
_tbgroleupstar = new cfg.TbGRoleUpStar(loader.load("tbgroleupstar"));
_tbsserverinfo = new cfg.TbSServerInfo(loader.load("tbsserverinfo"));
_tbgattribute = new cfg.TbGAttribute(loader.load("tbgattribute"));
_tbgrolebaseattribute = new cfg.TbGRoleBaseAttribute(loader.load("tbgrolebaseattribute"));
}
}

View 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 TbGAttribute {
private final java.util.HashMap<Integer, cfg.TB.TbGAttribute> _dataMap;
private final java.util.ArrayList<cfg.TB.TbGAttribute> _dataList;
public TbGAttribute(JsonElement _buf) {
_dataMap = new java.util.HashMap<Integer, cfg.TB.TbGAttribute>();
_dataList = new java.util.ArrayList<cfg.TB.TbGAttribute>();
for (com.google.gson.JsonElement _e_ : _buf.getAsJsonArray()) {
cfg.TB.TbGAttribute _v;
_v = cfg.TB.TbGAttribute.deserialize(_e_.getAsJsonObject());
_dataList.add(_v);
_dataMap.put(_v.id, _v);
}
}
public java.util.HashMap<Integer, cfg.TB.TbGAttribute> getDataMap() { return _dataMap; }
public java.util.ArrayList<cfg.TB.TbGAttribute> getDataList() { return _dataList; }
public cfg.TB.TbGAttribute get(int key) { return _dataMap.get(key); }
}

View 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 TbGRoleBaseAttribute {
private final java.util.HashMap<Integer, cfg.TB.TbGRoleBaseAttribute> _dataMap;
private final java.util.ArrayList<cfg.TB.TbGRoleBaseAttribute> _dataList;
public TbGRoleBaseAttribute(JsonElement _buf) {
_dataMap = new java.util.HashMap<Integer, cfg.TB.TbGRoleBaseAttribute>();
_dataList = new java.util.ArrayList<cfg.TB.TbGRoleBaseAttribute>();
for (com.google.gson.JsonElement _e_ : _buf.getAsJsonArray()) {
cfg.TB.TbGRoleBaseAttribute _v;
_v = cfg.TB.TbGRoleBaseAttribute.deserialize(_e_.getAsJsonObject());
_dataList.add(_v);
_dataMap.put(_v.id, _v);
}
}
public java.util.HashMap<Integer, cfg.TB.TbGRoleBaseAttribute> getDataMap() { return _dataMap; }
public java.util.ArrayList<cfg.TB.TbGRoleBaseAttribute> getDataList() { return _dataList; }
public cfg.TB.TbGRoleBaseAttribute get(int key) { return _dataMap.get(key); }
}

View File

@@ -15,6 +15,7 @@ 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.*;
import java.util.ArrayList;
@@ -52,6 +53,7 @@ public class GPlayerPetController {
@ApiImplicitParams({})
@ApiOperation(value = "提升宠物星")
@PostMapping("/up/star")
@Transactional
public NewsResource<PlayerPet> onUpStar(@RequestBody PetUpStarOV info, @CurrentPlayer Player player){
//判断参数
@@ -116,4 +118,20 @@ public class GPlayerPetController {
}
//提升宠物等级
@ApiImplicitParams({})
@ApiOperation(value = "提升宠物等级")
@PostMapping("/up/level/{petId}")
public NewsResource<PlayerPet> onUpLevel(@PathVariable Integer petId, @CurrentPlayer Player player){
//获取需要升级的宠物
PlayerPet pet = playerPetService.getById(petId);
if(Objects.isNull(pet) || !Objects.equals(pet.getPetPlayerId(), player.getPlayerId())){
return NewsResource.onFail("你未拥有这个宠物");
}
return NewsResource.onFail("升级成功");
}
}

View File

@@ -21,6 +21,7 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
@@ -89,6 +90,7 @@ public class GOnHookController {
@ApiImplicitParams({})
@ApiOperation(value = "出售野怪")
@PostMapping("/onSellCreeps/{creepId}")
@Transactional
public NewsResource<Boolean> onSellCreeps(@PathVariable String creepId, @CurrentPlayer Player player){
//玩家的野怪

View File

@@ -8,6 +8,7 @@ import cn.jisol.game.service.ResourceService;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
@@ -21,6 +22,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
* @return
*/
@Override
@Transactional
public Resource addResourceValue(Long playerId, ResourceId type, Long value) {
//获取玩家资源
@@ -28,6 +30,7 @@ public class ResourceServiceImpl extends ServiceImpl<ResourceMapper, Resource> i
Wrappers.lambdaQuery(Resource.class)
.eq(Resource::getPlayerId, playerId) //玩家
.eq(Resource::getResourceTbId, type.id) //资源
.last(" for update") //加锁
);
//如果没有资源则默认给一个0的资源

View File

@@ -0,0 +1,12 @@
[
{
"id": 110001,
"name": "攻击",
"sign": "Attack"
},
{
"id": 110002,
"name": "防御",
"sign": "Defend"
}
]

View File

@@ -0,0 +1,7 @@
[
{
"id": 0,
"Attack": 10,
"Defend": 5
}
]