diff --git a/DataTables/Datas/__tables__.xlsx b/DataTables/Datas/__tables__.xlsx index e696bca0..d883e132 100644 Binary files a/DataTables/Datas/__tables__.xlsx and b/DataTables/Datas/__tables__.xlsx differ diff --git a/DataTables/Datas/战斗/属性.xlsx b/DataTables/Datas/战斗/属性.xlsx new file mode 100644 index 00000000..6473cb89 Binary files /dev/null and b/DataTables/Datas/战斗/属性.xlsx differ diff --git a/DataTables/Datas/战斗/角色/角色初始属性.xlsx b/DataTables/Datas/战斗/角色/角色初始属性.xlsx new file mode 100644 index 00000000..e7456072 Binary files /dev/null and b/DataTables/Datas/战斗/角色/角色初始属性.xlsx differ diff --git a/JisolGameCocos/assets/resources/config/data/schema.ts b/JisolGameCocos/assets/resources/config/data/schema.ts index 7ec0df3d..ce50efc3 100644 --- a/JisolGameCocos/assets/resources/config/data/schema.ts +++ b/JisolGameCocos/assets/resources/config/data/schema.ts @@ -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 + private _dataList: TB.TbGAttribute[] + constructor(_json_: any) { + this._dataMap = new Map() + 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 { 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 + private _dataList: TB.TbGRoleBaseAttribute[] + constructor(_json_: any) { + this._dataMap = new Map() + 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 { 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) } } diff --git a/JisolGameCocos/assets/resources/config/json/tbgattribute.json b/JisolGameCocos/assets/resources/config/json/tbgattribute.json new file mode 100644 index 00000000..4ece033b --- /dev/null +++ b/JisolGameCocos/assets/resources/config/json/tbgattribute.json @@ -0,0 +1,12 @@ +[ + { + "id": 110001, + "name": "攻击", + "sign": "Attack" + }, + { + "id": 110002, + "name": "防御", + "sign": "Defend" + } +] \ No newline at end of file diff --git a/JisolGameCocos/assets/resources/config/json/tbgattribute.json.meta b/JisolGameCocos/assets/resources/config/json/tbgattribute.json.meta new file mode 100644 index 00000000..7bbc5504 --- /dev/null +++ b/JisolGameCocos/assets/resources/config/json/tbgattribute.json.meta @@ -0,0 +1,11 @@ +{ + "ver": "2.0.1", + "importer": "json", + "imported": true, + "uuid": "9f49c5b6-38df-450b-8700-3172b090f838", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameCocos/assets/resources/config/json/tbgrolebaseattribute.json b/JisolGameCocos/assets/resources/config/json/tbgrolebaseattribute.json new file mode 100644 index 00000000..a5e7765b --- /dev/null +++ b/JisolGameCocos/assets/resources/config/json/tbgrolebaseattribute.json @@ -0,0 +1,7 @@ +[ + { + "id": 0, + "Attack": 10, + "Defend": 5 + } +] \ No newline at end of file diff --git a/JisolGameCocos/assets/resources/config/json/tbgrolebaseattribute.json.meta b/JisolGameCocos/assets/resources/config/json/tbgrolebaseattribute.json.meta new file mode 100644 index 00000000..43431ef3 --- /dev/null +++ b/JisolGameCocos/assets/resources/config/json/tbgrolebaseattribute.json.meta @@ -0,0 +1,11 @@ +{ + "ver": "2.0.1", + "importer": "json", + "imported": true, + "uuid": "588bcee5-9782-46ce-9cee-5b9de08327cd", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/JisolGameServer/JNGame b/JisolGameServer/JNGame index 0795f18e..cd18e8d3 160000 --- a/JisolGameServer/JNGame +++ b/JisolGameServer/JNGame @@ -1 +1 @@ -Subproject commit 0795f18e7e61b8f8f5bcef1b11fe388e290d031a +Subproject commit cd18e8d3444e584393b0dca23a1c11e0ab3c691f diff --git a/JisolGameServer/Main/src/main/java/cfg/TB/TbGAttribute.java b/JisolGameServer/Main/src/main/java/cfg/TB/TbGAttribute.java new file mode 100644 index 00000000..9850b756 --- /dev/null +++ b/JisolGameServer/Main/src/main/java/cfg/TB/TbGAttribute.java @@ -0,0 +1,55 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +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 + "," + + "}"; + } +} + diff --git a/JisolGameServer/Main/src/main/java/cfg/TB/TbGRoleBaseAttribute.java b/JisolGameServer/Main/src/main/java/cfg/TB/TbGRoleBaseAttribute.java new file mode 100644 index 00000000..6e9b3b13 --- /dev/null +++ b/JisolGameServer/Main/src/main/java/cfg/TB/TbGRoleBaseAttribute.java @@ -0,0 +1,55 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +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 + "," + + "}"; + } +} + diff --git a/JisolGameServer/Main/src/main/java/cfg/Tables.java b/JisolGameServer/Main/src/main/java/cfg/Tables.java index e5e0bb64..2c4769fa 100644 --- a/JisolGameServer/Main/src/main/java/cfg/Tables.java +++ b/JisolGameServer/Main/src/main/java/cfg/Tables.java @@ -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")); } } diff --git a/JisolGameServer/Main/src/main/java/cfg/TbGAttribute.java b/JisolGameServer/Main/src/main/java/cfg/TbGAttribute.java new file mode 100644 index 00000000..36bfb628 --- /dev/null +++ b/JisolGameServer/Main/src/main/java/cfg/TbGAttribute.java @@ -0,0 +1,37 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg; + +import luban.*; +import com.google.gson.JsonElement; + + +public final class TbGAttribute { + private final java.util.HashMap _dataMap; + private final java.util.ArrayList _dataList; + + public TbGAttribute(JsonElement _buf) { + _dataMap = new java.util.HashMap(); + _dataList = new java.util.ArrayList(); + + 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 getDataMap() { return _dataMap; } + public java.util.ArrayList getDataList() { return _dataList; } + + public cfg.TB.TbGAttribute get(int key) { return _dataMap.get(key); } + +} diff --git a/JisolGameServer/Main/src/main/java/cfg/TbGRoleBaseAttribute.java b/JisolGameServer/Main/src/main/java/cfg/TbGRoleBaseAttribute.java new file mode 100644 index 00000000..5adad843 --- /dev/null +++ b/JisolGameServer/Main/src/main/java/cfg/TbGRoleBaseAttribute.java @@ -0,0 +1,37 @@ + +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +package cfg; + +import luban.*; +import com.google.gson.JsonElement; + + +public final class TbGRoleBaseAttribute { + private final java.util.HashMap _dataMap; + private final java.util.ArrayList _dataList; + + public TbGRoleBaseAttribute(JsonElement _buf) { + _dataMap = new java.util.HashMap(); + _dataList = new java.util.ArrayList(); + + 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 getDataMap() { return _dataMap; } + public java.util.ArrayList getDataList() { return _dataList; } + + public cfg.TB.TbGRoleBaseAttribute get(int key) { return _dataMap.get(key); } + +} diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java index 3c4c8e14..7444354f 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/GPlayerPetController.java @@ -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 onUpStar(@RequestBody PetUpStarOV info, @CurrentPlayer Player player){ //判断参数 @@ -116,4 +118,20 @@ public class GPlayerPetController { } + //提升宠物等级 + @ApiImplicitParams({}) + @ApiOperation(value = "提升宠物等级") + @PostMapping("/up/level/{petId}") + public NewsResource 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("升级成功"); + + } + } diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java index d09c8bd2..40b86022 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/controller/game/mode/GOnHookController.java @@ -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 onSellCreeps(@PathVariable String creepId, @CurrentPlayer Player player){ //玩家的野怪 diff --git a/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java b/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java index b00baa07..aab47630 100644 --- a/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java +++ b/JisolGameServer/Main/src/main/java/cn/jisol/game/service/impl/ResourceServiceImpl.java @@ -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 i * @return */ @Override + @Transactional public Resource addResourceValue(Long playerId, ResourceId type, Long value) { //获取玩家资源 @@ -28,6 +30,7 @@ public class ResourceServiceImpl extends ServiceImpl i Wrappers.lambdaQuery(Resource.class) .eq(Resource::getPlayerId, playerId) //玩家 .eq(Resource::getResourceTbId, type.id) //资源 + .last(" for update") //加锁 ); //如果没有资源则默认给一个0的资源 diff --git a/JisolGameServer/Main/src/main/resources/json/tbgattribute.json b/JisolGameServer/Main/src/main/resources/json/tbgattribute.json new file mode 100644 index 00000000..4ece033b --- /dev/null +++ b/JisolGameServer/Main/src/main/resources/json/tbgattribute.json @@ -0,0 +1,12 @@ +[ + { + "id": 110001, + "name": "攻击", + "sign": "Attack" + }, + { + "id": 110002, + "name": "防御", + "sign": "Defend" + } +] \ No newline at end of file diff --git a/JisolGameServer/Main/src/main/resources/json/tbgrolebaseattribute.json b/JisolGameServer/Main/src/main/resources/json/tbgrolebaseattribute.json new file mode 100644 index 00000000..a5e7765b --- /dev/null +++ b/JisolGameServer/Main/src/main/resources/json/tbgrolebaseattribute.json @@ -0,0 +1,7 @@ +[ + { + "id": 0, + "Attack": 10, + "Defend": 5 + } +] \ No newline at end of file