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

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -459,6 +459,72 @@ export class TbSServerInfo {
}
export namespace TB {
export class TbGAttribute {
constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id
if (_json_.name === undefined) { throw new Error() }
this.name = _json_.name
if (_json_.sign === undefined) { throw new Error() }
this.sign = _json_.sign
}
/**
* id
*/
readonly id: number
/**
*
*/
readonly name: string
/**
*
*/
readonly sign: string
resolve(tables:Tables)
{
}
}
}
export namespace TB {
export class TbGRoleBaseAttribute {
constructor(_json_: any) {
if (_json_.id === undefined) { throw new Error() }
this.id = _json_.id
if (_json_.Attack === undefined) { throw new Error() }
this.Attack = _json_.Attack
if (_json_.Defend === undefined) { throw new Error() }
this.Defend = _json_.Defend
}
/**
* Id (0 )
*/
readonly id: number
/**
*
*/
readonly Attack: number
/**
*
*/
readonly Defend: number
resolve(tables:Tables)
{
}
}
}
export class TbGGlobal{
@ -813,6 +879,70 @@ export class TbSServerInfo{
export class TbGAttribute{
private _dataMap: Map<number, TB.TbGAttribute>
private _dataList: TB.TbGAttribute[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGAttribute>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbGAttribute
_v = new TB.TbGAttribute(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.id, _v)
}
}
getDataMap(): Map<number, TB.TbGAttribute> { return this._dataMap; }
getDataList(): TB.TbGAttribute[] { return this._dataList; }
get(key: number): TB.TbGAttribute | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
for(let data of this._dataList)
{
data.resolve(tables)
}
}
}
export class TbGRoleBaseAttribute{
private _dataMap: Map<number, TB.TbGRoleBaseAttribute>
private _dataList: TB.TbGRoleBaseAttribute[]
constructor(_json_: any) {
this._dataMap = new Map<number, TB.TbGRoleBaseAttribute>()
this._dataList = []
for(var _json2_ of _json_) {
let _v: TB.TbGRoleBaseAttribute
_v = new TB.TbGRoleBaseAttribute(_json2_)
this._dataList.push(_v)
this._dataMap.set(_v.id, _v)
}
}
getDataMap(): Map<number, TB.TbGRoleBaseAttribute> { return this._dataMap; }
getDataList(): TB.TbGRoleBaseAttribute[] { return this._dataList; }
get(key: number): TB.TbGRoleBaseAttribute | undefined { return this._dataMap.get(key); }
resolve(tables:Tables)
{
for(let data of this._dataList)
{
data.resolve(tables)
}
}
}
type JsonLoader = (file: string) => any
export class Tables {
@ -838,6 +968,10 @@ export class Tables {
get TbGRoleUpStar(): TbGRoleUpStar { return this._TbGRoleUpStar;}
private _TbSServerInfo: TbSServerInfo
get TbSServerInfo(): TbSServerInfo { return this._TbSServerInfo;}
private _TbGAttribute: TbGAttribute
get TbGAttribute(): TbGAttribute { return this._TbGAttribute;}
private _TbGRoleBaseAttribute: TbGRoleBaseAttribute
get TbGRoleBaseAttribute(): TbGRoleBaseAttribute { return this._TbGRoleBaseAttribute;}
constructor(loader: JsonLoader) {
this._TbGGlobal = new TbGGlobal(loader('tbgglobal'))
@ -851,6 +985,8 @@ export class Tables {
this._TbGRoleUpLevel = new TbGRoleUpLevel(loader('tbgroleuplevel'))
this._TbGRoleUpStar = new TbGRoleUpStar(loader('tbgroleupstar'))
this._TbSServerInfo = new TbSServerInfo(loader('tbsserverinfo'))
this._TbGAttribute = new TbGAttribute(loader('tbgattribute'))
this._TbGRoleBaseAttribute = new TbGRoleBaseAttribute(loader('tbgrolebaseattribute'))
this._TbGGlobal.resolve(this)
this._TbGRole.resolve(this)
@ -863,5 +999,7 @@ export class Tables {
this._TbGRoleUpLevel.resolve(this)
this._TbGRoleUpStar.resolve(this)
this._TbSServerInfo.resolve(this)
this._TbGAttribute.resolve(this)
this._TbGRoleBaseAttribute.resolve(this)
}
}

View File

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

View File

@ -0,0 +1,11 @@
{
"ver": "2.0.1",
"importer": "json",
"imported": true,
"uuid": "9f49c5b6-38df-450b-8700-3172b090f838",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

View File

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

View File

@ -0,0 +1,11 @@
{
"ver": "2.0.1",
"importer": "json",
"imported": true,
"uuid": "588bcee5-9782-46ce-9cee-5b9de08327cd",
"files": [
".json"
],
"subMetas": {},
"userData": {}
}

@ -1 +1 @@
Subproject commit 0795f18e7e61b8f8f5bcef1b11fe388e290d031a
Subproject commit cd18e8d3444e584393b0dca23a1c11e0ab3c691f

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
}
]