mirror of
https://gitee.com/wxd-gaming/wxdgaming.spring.boot.git
synced 2026-05-07 01:00:44 +08:00
【新增】基础游戏模块代码迁入
This commit is contained in:
15
.run/GameServiceApplication.run.xml
Normal file
15
.run/GameServiceApplication.run.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="GameServiceApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="wxdgaming.game.server" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="wxdgaming.game.server.GameServiceApplication" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="wxdgaming.game.server.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
15
.run/GatewayApplication.run.xml
Normal file
15
.run/GatewayApplication.run.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="GatewayApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="wxdgaming.game.gateway" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="wxdgaming.game.gateway.GatewayApplication" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="wxdgaming.game.gateway.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
15
.run/LoginApplication.run.xml
Normal file
15
.run/LoginApplication.run.xml
Normal file
@@ -0,0 +1,15 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="LoginApplication" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" nameIsGenerated="true">
|
||||
<module name="wxdgaming.game.login" />
|
||||
<option name="SPRING_BOOT_MAIN_CLASS" value="wxdgaming.game.login.LoginApplication" />
|
||||
<extension name="coverage">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="wxdgaming.game.login.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<method v="2">
|
||||
<option name="Make" enabled="true" />
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
21
cfg_json/q_achieve.json
Normal file
21
cfg_json/q_achieve.json
Normal file
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{"id":1,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":1,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":10,"cfgId":5}]},
|
||||
{"id":2,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":2,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":11,"cfgId":5}]},
|
||||
{"id":3,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":3,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":12,"cfgId":5}]},
|
||||
{"id":4,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":4,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":13,"cfgId":5}]},
|
||||
{"id":5,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":5,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":14,"cfgId":5}]},
|
||||
{"id":6,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":6,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":15,"cfgId":5}]},
|
||||
{"id":7,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":7,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":16,"cfgId":5}]},
|
||||
{"id":8,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":8,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":17,"cfgId":5}]},
|
||||
{"id":9,"type":1,"name":"升级","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"condition":{"k1":"Lv","k2":"0","k3":"0","target":9,"update":"Max"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":18,"cfgId":5}]},
|
||||
{"id":10,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":200,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":19,"cfgId":5}]},
|
||||
{"id":11,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":500,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":20,"cfgId":5}]},
|
||||
{"id":12,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":800,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":21,"cfgId":5}]},
|
||||
{"id":13,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":1100,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":22,"cfgId":5}]},
|
||||
{"id":14,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":1400,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":23,"cfgId":5}]},
|
||||
{"id":15,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":1700,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":24,"cfgId":5}]},
|
||||
{"id":16,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":2000,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":25,"cfgId":5}]},
|
||||
{"id":17,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":2300,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":26,"cfgId":5}]},
|
||||
{"id":18,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":2600,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":27,"cfgId":5}]},
|
||||
{"id":19,"type":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"condition":{"k1":"KillMonster","k2":"0","k3":"0","target":2900,"update":"Add"},"rewards":[{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":28,"cfgId":5}]}
|
||||
]
|
||||
9
cfg_json/q_activity.json
Normal file
9
cfg_json/q_activity.json
Normal file
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{"id":1001,"type":1,"name":"活动1","openTime":{"cron":"0 0 8 ? * ? ?","timeUnit":"MINUTES","duration":800}},
|
||||
{"id":1002,"type":1,"name":"活动2","openTime":{"cron":"0 0 8 ? * ? ?","timeUnit":"MINUTES","duration":800}},
|
||||
{"id":1003,"type":1,"name":"活动3","openTime":{"cron":"0 0 8 ? * ? ?","timeUnit":"MINUTES","duration":800}},
|
||||
{"id":1004,"type":1,"name":"活动4","openTime":{"cron":"0 0 8 ? * ? ?","timeUnit":"MINUTES","duration":800}},
|
||||
{"id":1005,"type":1,"name":"活动5","openTime":{"cron":"0 0 8 ? * ? ?","timeUnit":"MINUTES","duration":800}},
|
||||
{"id":1006,"type":1,"name":"活动6","openTime":{"cron":"0 0 8 ? * ? ?","timeUnit":"MINUTES","duration":800}},
|
||||
{"id":1007,"type":1,"name":"活动7","openTime":{"cron":"0 0 8 ? * ? ?","timeUnit":"MINUTES","duration":800}}
|
||||
]
|
||||
6
cfg_json/q_buff.json
Normal file
6
cfg_json/q_buff.json
Normal file
@@ -0,0 +1,6 @@
|
||||
[
|
||||
{"id":"1-1","buffGroup":1,"buffId":1,"lv":1,"type":1,"addType":0,"addExecutor":false,"addStatusList":[],"clearType":0,"checkGroup":{"$ref":"$.addStatusList"},"clearBuffIdList":{"$ref":"$.addStatusList"},"clearGroupList":{"$ref":"$.addStatusList"},"duration":30000,"interval":100,"paramInt1":0,"paramInt2":0,"paramInt3":0,"paramString1":{"value":"{\"MP\":10,\"HP\":10}"}},
|
||||
{"id":"2-1","buffGroup":1,"buffId":2,"lv":1,"type":1,"addType":0,"addExecutor":false,"addStatusList":[],"clearType":0,"checkGroup":{"$ref":"$.addStatusList"},"clearBuffIdList":{"$ref":"$.addStatusList"},"clearGroupList":{"$ref":"$.addStatusList"},"duration":30000,"interval":1000,"paramInt1":1,"paramInt2":0,"paramInt3":0,"paramString1":{"value":"{\"MP\":1000,\"HP\":1000}"}},
|
||||
{"id":"3-1","buffGroup":1,"buffId":3,"lv":1,"type":1,"addType":0,"addExecutor":false,"addStatusList":[],"clearType":0,"checkGroup":{"$ref":"$.addStatusList"},"clearBuffIdList":{"$ref":"$.addStatusList"},"clearGroupList":{"$ref":"$.addStatusList"},"duration":30000,"interval":1000,"paramInt1":0,"paramInt2":0,"paramInt3":0,"paramString1":{"value":"{\"MP\":-40,\"HP\":-40}"}},
|
||||
{"id":"4-1","buffGroup":1,"buffId":4,"lv":1,"type":2,"addType":0,"addExecutor":false,"clearType":0,"duration":30000,"interval":1000,"paramInt1":0,"paramInt2":0,"paramInt3":0,"paramString1":{"value":"{\"体力\":100,\"MAXHP\":1000,\"MAXMP\":1000,\"攻击\":100,\"防御\":100}"}}
|
||||
]
|
||||
15
cfg_json/q_item.json
Normal file
15
cfg_json/q_item.json
Normal file
@@ -0,0 +1,15 @@
|
||||
[
|
||||
{"id":1,"itemType":1,"itemSubType":1,"name":"钻石","description":"钻石","lv":0,"maxCount":0,"param1":0,"param2":0,"param3":0,"param4":0},
|
||||
{"id":2,"itemType":1,"itemSubType":2,"name":"绑定钻石","description":"绑定钻石","lv":0,"maxCount":0,"param1":0,"param2":0,"param3":0,"param4":0},
|
||||
{"id":3,"itemType":1,"itemSubType":3,"name":"金币","description":"金币","lv":0,"maxCount":0,"param1":0,"param2":0,"param3":0,"param4":0},
|
||||
{"id":4,"itemType":1,"itemSubType":4,"name":"绑定金币","description":"绑定金币","lv":0,"maxCount":0,"param1":0,"param2":0,"param3":0,"param4":0},
|
||||
{"id":5,"itemType":1,"itemSubType":5,"name":"经验值","description":"经验值","lv":0,"maxCount":0,"param1":0,"param2":0,"param3":0,"param4":0},
|
||||
{"id":10001,"itemType":2,"itemSubType":0,"name":"武器","description":"武器","lv":1,"maxCount":1,"param1":0,"param2":0,"param3":0,"param4":1,"attr":{"MAXHP":106,"体力":100,"攻击":100,"防御":100}},
|
||||
{"id":10002,"itemType":2,"itemSubType":0,"name":"武器","description":"武器","lv":2,"maxCount":1,"param1":0,"param2":0,"param3":0,"param4":1,"attr":{"MAXHP":106,"体力":100,"攻击":100,"防御":101}},
|
||||
{"id":10003,"itemType":2,"itemSubType":0,"name":"武器","description":"武器","lv":3,"maxCount":1,"param1":0,"param2":0,"param3":0,"param4":1,"attr":{"MAXHP":106,"体力":100,"攻击":100,"防御":102}},
|
||||
{"id":10004,"itemType":2,"itemSubType":0,"name":"武器","description":"武器","lv":4,"maxCount":1,"param1":0,"param2":0,"param3":0,"param4":1,"attr":{"MAXHP":106,"体力":100,"攻击":100,"防御":103}},
|
||||
{"id":10005,"itemType":2,"itemSubType":0,"name":"武器","description":"武器","lv":5,"maxCount":1,"param1":0,"param2":0,"param3":0,"param4":1,"attr":{"MAXHP":106,"体力":100,"攻击":100,"防御":104}},
|
||||
{"id":10006,"itemType":2,"itemSubType":0,"name":"武器","description":"武器","lv":6,"maxCount":1,"param1":0,"param2":0,"param3":0,"param4":1,"attr":{"MAXHP":106,"体力":100,"攻击":100,"防御":105}},
|
||||
{"id":10007,"itemType":2,"itemSubType":0,"name":"武器","description":"武器","lv":7,"maxCount":1,"param1":0,"param2":0,"param3":0,"param4":1,"attr":{"MAXHP":106,"体力":100,"攻击":10609,"防御":10666}},
|
||||
{"id":100001,"itemType":10,"itemSubType":0,"name":"强化石","description":"强化石","lv":0,"maxCount":99,"param1":0,"param2":0,"param3":0,"param4":0}
|
||||
]
|
||||
9
cfg_json/q_map.json
Normal file
9
cfg_json/q_map.json
Normal file
@@ -0,0 +1,9 @@
|
||||
[
|
||||
{"id":1001,"crossType":1,"type":1,"name":"新手村","min_lv":1,"max_lv":10,"buffIds":[1,2]},
|
||||
{"id":1002,"crossType":1,"type":1,"name":"城镇中心","min_lv":11,"max_lv":20,"buffIds":[1,2]},
|
||||
{"id":1003,"crossType":1,"type":1,"name":"魔幻森林","min_lv":21,"max_lv":30,"buffIds":[1,2]},
|
||||
{"id":1004,"crossType":1,"type":1,"name":"宠物天堂","min_lv":31,"max_lv":40,"buffIds":[1,2]},
|
||||
{"id":1005,"crossType":1,"type":1,"name":"永恒大陆","min_lv":41,"max_lv":50,"buffIds":[1,2]},
|
||||
{"id":1006,"crossType":1,"type":1,"name":"暗之神殿","min_lv":51,"max_lv":60,"buffIds":[1,2]},
|
||||
{"id":1007,"crossType":1,"type":1,"name":"神魔大殿","min_lv":61,"max_lv":70,"buffIds":[1,2]}
|
||||
]
|
||||
21
cfg_json/q_monster.json
Normal file
21
cfg_json/q_monster.json
Normal file
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{"id":1,"name":"蚂蚁","mapId":1001,"lv":1,"exp":2,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":100},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":100},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":1},{"cfg":10001,"num":1}]},
|
||||
{"id":2,"name":"蜜蜂","mapId":1001,"lv":2,"exp":3,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":101},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":101},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":2},{"cfg":10002,"num":1}]},
|
||||
{"id":3,"name":"蟑螂","mapId":1001,"lv":3,"exp":4,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":102},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":102},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":3},{"cfg":10003,"num":1}]},
|
||||
{"id":4,"name":"黄雀","mapId":1001,"lv":4,"exp":5,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":103},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":103},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":4},{"cfg":10004,"num":1}]},
|
||||
{"id":5,"name":"兔子","mapId":1002,"lv":5,"exp":6,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":104},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":104},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":5},{"cfg":10005,"num":1}]},
|
||||
{"id":6,"name":"公鸡","mapId":1002,"lv":6,"exp":7,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":105},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":105},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":6},{"cfg":10006,"num":1}]},
|
||||
{"id":7,"name":"野狗","mapId":1002,"lv":7,"exp":8,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":106},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":106},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":7},{"cfg":10007,"num":1}]},
|
||||
{"id":8,"name":"小软","mapId":1003,"lv":8,"exp":9,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":107},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":107},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":8},{"cfg":10001,"num":1}]},
|
||||
{"id":9,"name":"猎豹","mapId":1003,"lv":9,"exp":10,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":108},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":108},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":9},{"cfg":10001,"num":1}]},
|
||||
{"id":10,"name":"老虎","mapId":1003,"lv":10,"exp":11,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":109},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":109},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":10},{"cfg":10001,"num":1}]},
|
||||
{"id":11,"name":"蟒蛇","mapId":1004,"lv":11,"exp":12,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":110},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":110},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":11},{"cfg":10006,"num":1}]},
|
||||
{"id":12,"name":"河马","mapId":1004,"lv":12,"exp":13,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":111},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":111},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":12},{"cfg":10007,"num":1}]},
|
||||
{"id":13,"name":"鳄鱼","mapId":1004,"lv":13,"exp":14,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":112},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":112},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":13},{"cfg":10001,"num":1}]},
|
||||
{"id":14,"name":"猛犸象","mapId":1005,"lv":14,"exp":15,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":113},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":113},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":14},{"cfg":10006,"num":1}]},
|
||||
{"id":15,"name":"骷髅头","mapId":1005,"lv":15,"exp":16,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":114},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":114},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":15},{"cfg":10001,"num":1}]},
|
||||
{"id":16,"name":"术士","mapId":1006,"lv":16,"exp":17,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":115},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":115},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":16},{"cfg":10004,"num":1}]},
|
||||
{"id":17,"name":"猎人","mapId":1006,"lv":17,"exp":18,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":116},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":116},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":17},{"cfg":10001,"num":1}]},
|
||||
{"id":18,"name":"刺客","mapId":1007,"lv":18,"exp":19,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":117},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":117},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":18},{"cfg":10004,"num":1}]},
|
||||
{"id":19,"name":"呆呆贼","mapId":1007,"lv":19,"exp":20,"attr":{"MAXHP":10000,"体力":100,"攻击":100,"防御":118},"attrPro":{"MAXHP":100,"体力":100,"攻击":100,"防御":118},"rewards":[{"cfg":1,"num":1},{"cfg":3,"num":19},{"cfg":10001,"num":1}]}
|
||||
]
|
||||
44
cfg_json/q_player.json
Normal file
44
cfg_json/q_player.json
Normal file
@@ -0,0 +1,44 @@
|
||||
[
|
||||
{"id":1,"exp":10,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":100},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":100}},
|
||||
{"id":2,"exp":10,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":101},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":101}},
|
||||
{"id":3,"exp":10,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":102},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":102}},
|
||||
{"id":4,"exp":30,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":103},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":103}},
|
||||
{"id":5,"exp":50,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":104},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":104}},
|
||||
{"id":6,"exp":70,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":105},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":105}},
|
||||
{"id":7,"exp":90,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":106},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":106}},
|
||||
{"id":8,"exp":110,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":107},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":107}},
|
||||
{"id":9,"exp":130,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":108},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":108}},
|
||||
{"id":10,"exp":150,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":109},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":109}},
|
||||
{"id":11,"exp":170,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":110},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":110}},
|
||||
{"id":12,"exp":190,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":111},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":111}},
|
||||
{"id":13,"exp":210,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":112},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":112}},
|
||||
{"id":14,"exp":230,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":113},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":113}},
|
||||
{"id":15,"exp":250,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":114},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":114}},
|
||||
{"id":16,"exp":270,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":115},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":115}},
|
||||
{"id":17,"exp":290,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":116},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":116}},
|
||||
{"id":18,"exp":310,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":117},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":117}},
|
||||
{"id":19,"exp":330,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":118},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":118}},
|
||||
{"id":20,"exp":350,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":119},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":119}},
|
||||
{"id":21,"exp":370,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":120},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":120}},
|
||||
{"id":22,"exp":390,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":121},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":121}},
|
||||
{"id":23,"exp":410,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":122},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":122}},
|
||||
{"id":24,"exp":430,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":123},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":123}},
|
||||
{"id":25,"exp":450,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":124},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":124}},
|
||||
{"id":26,"exp":470,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":125},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":125}},
|
||||
{"id":27,"exp":490,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":126},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":126}},
|
||||
{"id":28,"exp":510,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":127},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":127}},
|
||||
{"id":29,"exp":530,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":128},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":128}},
|
||||
{"id":30,"exp":550,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":129},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":129}},
|
||||
{"id":31,"exp":570,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":130},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":130}},
|
||||
{"id":32,"exp":590,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":131},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":131}},
|
||||
{"id":33,"exp":610,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":132},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":132}},
|
||||
{"id":34,"exp":630,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":133},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":133}},
|
||||
{"id":35,"exp":650,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":134},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":134}},
|
||||
{"id":36,"exp":670,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":135},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":135}},
|
||||
{"id":37,"exp":690,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":136},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":136}},
|
||||
{"id":38,"exp":710,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":137},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":137}},
|
||||
{"id":39,"exp":730,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":138},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":138}},
|
||||
{"id":40,"exp":750,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":139},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":139}},
|
||||
{"id":41,"exp":770,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":140},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":140}},
|
||||
{"id":42,"exp":790,"attr":{"MAXHP":10000,"体力":100,"MAXMP":10000,"攻击":100,"防御":141},"attrPro":{"MAXHP":106,"体力":100,"攻击":100,"防御":141}}
|
||||
]
|
||||
21
cfg_json/q_task.json
Normal file
21
cfg_json/q_task.json
Normal file
@@ -0,0 +1,21 @@
|
||||
[
|
||||
{"id":1,"taskType":"Main","before":0,"after":2,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":10}],"acceptCost":[{"num":1,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":10,"cfgId":5}],"submitCost":[{"num":1,"cfgId":1}]},
|
||||
{"id":2,"taskType":"Main","before":1,"after":3,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":20}],"acceptCost":[{"num":2,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":11,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":2,"cfgId":1}]},
|
||||
{"id":3,"taskType":"Main","before":2,"after":4,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":30}],"acceptCost":[{"num":3,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":12,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":3,"cfgId":1}]},
|
||||
{"id":4,"taskType":"Main","before":3,"after":5,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":40}],"acceptCost":[{"num":4,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":13,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":4,"cfgId":1}]},
|
||||
{"id":5,"taskType":"Main","before":4,"after":6,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":50}],"acceptCost":[{"num":5,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":14,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":5,"cfgId":1}]},
|
||||
{"id":6,"taskType":"Main","before":5,"after":7,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":60}],"acceptCost":[{"num":6,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":15,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":6,"cfgId":1}]},
|
||||
{"id":7,"taskType":"Main","before":6,"after":8,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":70}],"acceptCost":[{"num":7,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":16,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":7,"cfgId":1}]},
|
||||
{"id":8,"taskType":"Main","before":7,"after":9,"name":"等级提升","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"conditionList":[{"k1":"Lv","update":"Replace","target":5}],"acceptCost":[{"num":8,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":17,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":8,"cfgId":1}]},
|
||||
{"id":9,"taskType":"Main","before":8,"after":10,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":100}],"acceptCost":[{"num":9,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":18,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":9,"cfgId":1}]},
|
||||
{"id":10,"taskType":"Main","before":9,"after":11,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":150}],"acceptCost":[{"num":10,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":19,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":10,"cfgId":1}]},
|
||||
{"id":11,"taskType":"Main","before":10,"after":12,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":200}],"acceptCost":[{"num":11,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":20,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":11,"cfgId":1}]},
|
||||
{"id":12,"taskType":"Main","before":11,"after":13,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":250}],"acceptCost":[{"num":12,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":21,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":12,"cfgId":1}]},
|
||||
{"id":13,"taskType":"Main","before":12,"after":14,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":300}],"acceptCost":[{"num":13,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":22,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":13,"cfgId":1}]},
|
||||
{"id":14,"taskType":"Main","before":13,"after":15,"name":"等级提升","description":"等级提升至 {} 级","min_lv":1,"max_lv":100,"conditionList":[{"k1":"Lv","update":"Replace","target":10}],"acceptCost":[{"num":14,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":23,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":14,"cfgId":1}]},
|
||||
{"id":15,"taskType":"Main","before":14,"after":16,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":500}],"acceptCost":[{"num":15,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":24,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":15,"cfgId":1}]},
|
||||
{"id":16,"taskType":"Main","before":15,"after":17,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":800}],"acceptCost":[{"num":16,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":25,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":16,"cfgId":1}]},
|
||||
{"id":17,"taskType":"Main","before":16,"after":18,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":1100}],"acceptCost":[{"num":17,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":26,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":17,"cfgId":1}]},
|
||||
{"id":18,"taskType":"Main","before":17,"after":19,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":1400}],"acceptCost":[{"num":18,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":27,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":18,"cfgId":1}]},
|
||||
{"id":19,"taskType":"Main","before":18,"after":0,"name":"杀怪","description":"击杀 {} 只怪物","min_lv":1,"max_lv":100,"conditionList":[{"k1":"KillMonster","update":"Add","target":1700}],"acceptCost":[{"num":19,"cfgId":1}],"rewards":[{"num":10,"cfgId":10003},{"num":10,"cfgId":1},{"num":10,"cfgId":3},{"num":50,"cfgId":100001},{"num":28,"cfgId":5}],"submitCost":[{"num":2,"cfgId":100001},{"num":2,"cfgId":10003},{"num":19,"cfgId":1}]}
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -47,4 +47,7 @@ public abstract class ItemTypeConst {
|
||||
this.cfgId = cfgId;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return "ItemTypeConst{type=%d, subType=%d, cfgId=%d}".formatted(type, subType, cfgId);
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ import wxdgaming.spring.boot.excel.store.DataKey;
|
||||
import wxdgaming.spring.boot.excel.store.DataMapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* excel 构建 成就集合, src/main/cfg/任务成就.xlsx, q_achieve,
|
||||
|
||||
@@ -8,6 +8,7 @@ import wxdgaming.spring.boot.excel.store.DataKey;
|
||||
import wxdgaming.spring.boot.excel.store.DataMapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* excel 构建 活动, src/main/cfg/活动.xlsx, q_activity,
|
||||
|
||||
@@ -8,7 +8,7 @@ import wxdgaming.spring.boot.excel.store.DataKey;
|
||||
import wxdgaming.spring.boot.excel.store.DataMapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* excel 构建 怪物表, src/main/cfg/地图信息.xlsx, q_map,
|
||||
|
||||
@@ -8,8 +8,7 @@ import wxdgaming.spring.boot.excel.store.DataKey;
|
||||
import wxdgaming.spring.boot.excel.store.DataMapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* excel 构建 任务集合, src/main/cfg/任务成就.xlsx, q_task,
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package wxdgaming.game.login;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import wxdgaming.spring.boot.core.lang.ObjectBase;
|
||||
|
||||
/**
|
||||
* 链接登录服务器配置
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2025-06-07 18:08
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
public class LoginConfig extends ObjectBase {
|
||||
|
||||
private String url;
|
||||
private String jwtKey;
|
||||
private int maxOnlineSize = 1000;
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package wxdgaming.game.login;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* 驱动配置
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2025-06-07 18:09
|
||||
**/
|
||||
@Configuration
|
||||
public class LoginServiceConfiguration {
|
||||
|
||||
|
||||
@Bean
|
||||
public LoginConfig loginConfig(@Value("${login}") LoginConfig login) {
|
||||
return login;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package wxdgaming.game.chat;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import wxdgaming.spring.boot.core.CoreConfiguration;
|
||||
import wxdgaming.spring.boot.core.MainApplicationContextProvider;
|
||||
@@ -12,6 +13,7 @@ import wxdgaming.spring.boot.scheduled.ScheduledConfiguration;
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2025-05-27 20:56
|
||||
**/
|
||||
@ConfigurationPropertiesScan(basePackageClasses = {ChatBootstrapConfig.class})
|
||||
@SpringBootApplication(
|
||||
scanBasePackageClasses = {
|
||||
CoreConfiguration.class,
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package wxdgaming.game.chat;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import wxdgaming.spring.boot.core.BootstrapConfig;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 14:14
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "boot")
|
||||
public class ChatBootstrapConfig extends BootstrapConfig {
|
||||
|
||||
private String loginUrl;
|
||||
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package wxdgaming.game.gateway;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import wxdgaming.game.login.LoginServiceConfiguration;
|
||||
import wxdgaming.spring.boot.core.CoreConfiguration;
|
||||
import wxdgaming.spring.boot.core.MainApplicationContextProvider;
|
||||
import wxdgaming.spring.boot.net.SocketConfiguration;
|
||||
@@ -14,22 +16,28 @@ import wxdgaming.spring.boot.scheduled.ScheduledConfiguration;
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2025-05-27 20:56
|
||||
**/
|
||||
@Slf4j
|
||||
@ConfigurationPropertiesScan(basePackageClasses = {GatewayBootstrapConfig.class})
|
||||
@SpringBootApplication(
|
||||
scanBasePackageClasses = {
|
||||
CoreConfiguration.class,
|
||||
SocketConfiguration.class,
|
||||
HttpClientConfiguration.class,
|
||||
ScheduledConfiguration.class,
|
||||
LoginServiceConfiguration.class,
|
||||
GatewayApplication.class
|
||||
}
|
||||
)
|
||||
public class GatewayApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext run = new SpringApplication(GatewayApplication.class).run(args);
|
||||
MainApplicationContextProvider applicationContextProvider = run.getBean(MainApplicationContextProvider.class);
|
||||
applicationContextProvider.start();
|
||||
try {
|
||||
ConfigurableApplicationContext run = new SpringApplication(GatewayApplication.class).run(args);
|
||||
MainApplicationContextProvider applicationContextProvider = run.getBean(MainApplicationContextProvider.class);
|
||||
applicationContextProvider.start();
|
||||
} catch (BeansException e) {
|
||||
log.error("启动异常...", e);
|
||||
System.exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package wxdgaming.game.gateway;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 14:14
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "boot")
|
||||
public class GatewayBootstrapConfig extends wxdgaming.spring.boot.core.BootstrapConfig {
|
||||
|
||||
private int maxOnline = 2000;
|
||||
private String loginUrl;
|
||||
|
||||
}
|
||||
@@ -5,9 +5,8 @@ import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.login.LoginConfig;
|
||||
import wxdgaming.game.gateway.GatewayBootstrapConfig;
|
||||
import wxdgaming.game.login.bean.info.InnerServerInfoBean;
|
||||
import wxdgaming.game.message.inner.InnerRegisterServer;
|
||||
import wxdgaming.game.message.inner.ServiceType;
|
||||
@@ -43,23 +42,15 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Service
|
||||
public class Gateway2GameSessionService extends HoldRunApplication {
|
||||
|
||||
private final int sid;
|
||||
private final String sname;
|
||||
private final SocketClientConfig socketClientConfig;
|
||||
final LoginConfig loginConfig;
|
||||
final GatewayBootstrapConfig gatewayBootstrapConfig;
|
||||
final SocketServer socketServer;
|
||||
final ConcurrentHashMap<Integer, Gateway2GameSocketClientImpl> gameSessionMap = new ConcurrentHashMap<>();
|
||||
|
||||
private final ProtoListenerFactory protoListenerFactory;
|
||||
|
||||
public Gateway2GameSessionService(@Value("${sid}") int sid, @Value("${sname}") String sname,
|
||||
@Value("${socket.client-forward}") SocketClientConfig socketClientConfig,
|
||||
LoginConfig loginConfig, SocketServer socketServer,
|
||||
public Gateway2GameSessionService(GatewayBootstrapConfig gatewayBootstrapConfig, SocketServer socketServer,
|
||||
ProtoListenerFactory protoListenerFactory) {
|
||||
this.sid = sid;
|
||||
this.sname = sname;
|
||||
this.socketClientConfig = socketClientConfig;
|
||||
this.loginConfig = loginConfig;
|
||||
this.gatewayBootstrapConfig = gatewayBootstrapConfig;
|
||||
this.socketServer = socketServer;
|
||||
this.protoListenerFactory = protoListenerFactory;
|
||||
}
|
||||
@@ -75,25 +66,26 @@ public class Gateway2GameSessionService extends HoldRunApplication {
|
||||
public void registerLoginServer() {
|
||||
|
||||
InnerServerInfoBean serverInfoBean = new InnerServerInfoBean();
|
||||
serverInfoBean.setServerId(sid);
|
||||
serverInfoBean.setMainId(sid);
|
||||
serverInfoBean.setName(sname);
|
||||
serverInfoBean.setGid(gatewayBootstrapConfig.getGid());
|
||||
serverInfoBean.setServerId(gatewayBootstrapConfig.getSid());
|
||||
serverInfoBean.setMainId(gatewayBootstrapConfig.getSid());
|
||||
serverInfoBean.setName(gatewayBootstrapConfig.getName());
|
||||
serverInfoBean.setPort(socketServer.getConfig().getPort());
|
||||
serverInfoBean.setHttpPort(socketServer.getConfig().getPort());
|
||||
|
||||
serverInfoBean.setMaxOnlineSize(loginConfig.getMaxOnlineSize());
|
||||
serverInfoBean.setMaxOnlineSize(gatewayBootstrapConfig.getMaxOnline());
|
||||
serverInfoBean.setOnlineSize(socketServer.getSessionGroup().size());
|
||||
|
||||
JSONObject jsonObject = MapOf.newJSONObject();
|
||||
jsonObject.put("sid", sid);
|
||||
jsonObject.put("sid", gatewayBootstrapConfig.getSid());
|
||||
jsonObject.put("serverBean", serverInfoBean.toJSONString());
|
||||
|
||||
String json = jsonObject.toString(SerializerFeature.MapSortField, SerializerFeature.SortField);
|
||||
String md5DigestEncode = Md5Util.md5DigestEncode0("#", json, loginConfig.getJwtKey());
|
||||
String md5DigestEncode = Md5Util.md5DigestEncode0("#", json, gatewayBootstrapConfig.getJwtKey());
|
||||
jsonObject.put("sign", md5DigestEncode);
|
||||
|
||||
String string = jsonObject.toString();
|
||||
HttpResponse httpResponse = HttpRequestPost.ofJson(loginConfig.getUrl() + "/inner/registerGateway", string).execute();
|
||||
HttpResponse httpResponse = HttpRequestPost.ofJson(gatewayBootstrapConfig.getLoginUrl() + "/inner/registerGateway", string).execute();
|
||||
if (!httpResponse.isSuccess()) {
|
||||
log.error("访问登陆服务器失败{}", Throw.ofString(httpResponse.getException(), false));
|
||||
return;
|
||||
@@ -104,7 +96,7 @@ public class Gateway2GameSessionService extends HoldRunApplication {
|
||||
|
||||
InnerRegisterServer registerServer = new InnerRegisterServer();
|
||||
registerServer.setServiceType(ServiceType.GATEWAY);
|
||||
registerServer.setMainSid(sid);
|
||||
registerServer.setMainSid(gatewayBootstrapConfig.getSid());
|
||||
|
||||
List<InnerServerInfoBean> data = runResult.getObject("data", new TypeReference<List<InnerServerInfoBean>>() {});
|
||||
HashSet<Integer> hasServerIdSet = new HashSet<>();
|
||||
|
||||
@@ -1,20 +1,26 @@
|
||||
debug: true
|
||||
gid: 1
|
||||
sid: 1
|
||||
sname: "网关"
|
||||
executor:
|
||||
basic:
|
||||
coreSize: 2 #默认线程池的核心线程数
|
||||
maxQueueSize: 10000 #队列超过就会打印异常
|
||||
logic:
|
||||
coreSize: 32 #逻辑线程池
|
||||
maxQueueSize: 50000 #队列超过就会打印异常
|
||||
virtual:
|
||||
coreSize: 100 #虚拟线程池
|
||||
maxQueueSize: 1500000 #队列超过就会打印异常
|
||||
scheduled:
|
||||
coreSize: 1
|
||||
maxQueueSize: 50000
|
||||
boot:
|
||||
debug: true
|
||||
gid: 1
|
||||
sid: 1
|
||||
name: "网关"
|
||||
login-url: "http://127.0.0.1:19800"
|
||||
jwtKey: "123456789012345678901234567890123456789012345678901234567890"
|
||||
|
||||
core:
|
||||
executor:
|
||||
basic:
|
||||
coreSize: 2 #默认线程池的核心线程数
|
||||
maxQueueSize: 10000 #队列超过就会打印异常
|
||||
logic:
|
||||
coreSize: 32 #逻辑线程池
|
||||
maxQueueSize: 50000 #队列超过就会打印异常
|
||||
virtual:
|
||||
coreSize: 100 #虚拟线程池
|
||||
maxQueueSize: 1500000 #队列超过就会打印异常
|
||||
scheduled:
|
||||
coreSize: 1
|
||||
maxQueueSize: 50000
|
||||
|
||||
http:
|
||||
client:
|
||||
routeMaxSize: 500 #连接池的核心连接数
|
||||
@@ -25,11 +31,11 @@ http:
|
||||
connectionRequestTimeout: 1000 #从连接池获取连接超时
|
||||
keepAliveTimeout: 30000 #连接有效时间
|
||||
readTimeout: 3000 #读取超时时间
|
||||
|
||||
socket:
|
||||
server:
|
||||
debug: false
|
||||
port: 18800
|
||||
enabledHttp: true #是否启用http
|
||||
enabledTcp: true #是否启用tcp
|
||||
enabledScheduledFlush: true # 开启定时器flush
|
||||
scheduledFlushMs: 10 #定时调用flush的频率单位是ms
|
||||
@@ -46,9 +52,6 @@ socket:
|
||||
readTimeout: 0
|
||||
recvByteBufM: 12 #接收缓冲区大小 单位MB
|
||||
writeByteBufM: 12 #发送缓冲区大小 单位MB
|
||||
http:
|
||||
showRequest: true
|
||||
showResponse: true
|
||||
|
||||
client-forward:
|
||||
debug: false
|
||||
@@ -72,8 +75,4 @@ socket:
|
||||
writeTimeout: 0
|
||||
readTimeout: 0
|
||||
recvByteBufM: 12 #接收缓冲区大小 单位MB
|
||||
writeByteBufM: 12 #发送缓冲区大小 单位MB
|
||||
|
||||
login:
|
||||
url: http://127.0.0.1:19800
|
||||
jwtKey: "123456789012345678901234567890123456789012345678901234567890"
|
||||
writeByteBufM: 12 #发送缓冲区大小 单位MB
|
||||
@@ -58,10 +58,15 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="io.netty" level="info" additivity="false"/>
|
||||
<logger name="org.apache.hc" level="info" additivity="false"/>
|
||||
<logger name="com.zaxxer.hikari" level="info" additivity="false"/>
|
||||
<logger name="org.mongodb.driver" level="info" additivity="false"/>
|
||||
<logger name="com.zaxxer.hikari" level="INFO" additivity="true"/>
|
||||
<logger name="io.netty" level="INFO" additivity="true"/>
|
||||
<logger name="io.lettuce" level="INFO" additivity="true"/>
|
||||
<logger name="reactor.util" level="INFO" additivity="true"/>
|
||||
<logger name="org.jboss" level="INFO" additivity="true"/>
|
||||
<logger name="org.hibernate" level="INFO" additivity="true"/>
|
||||
<logger name="org.xnio" level="info" additivity="true"/>
|
||||
<logger name="org.springframework" level="info" additivity="true"/>
|
||||
<logger name="org.apache.hc" level="info" additivity="true"/>
|
||||
|
||||
<!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
|
||||
<root level="debug"> <!-- ERROR, WARN, INFO, DEBUG -->
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
package wxdgaming.game.login;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlConfiguration;
|
||||
import wxdgaming.spring.boot.core.CoreConfiguration;
|
||||
import wxdgaming.spring.boot.core.MainApplicationContextProvider;
|
||||
import wxdgaming.spring.boot.net.SocketConfiguration;
|
||||
@@ -14,21 +18,29 @@ import wxdgaming.spring.boot.scheduled.ScheduledConfiguration;
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2025-05-27 20:56
|
||||
**/
|
||||
@Slf4j
|
||||
@ConfigurationPropertiesScan(basePackageClasses = {LoginBootstrapConfig.class})
|
||||
@SpringBootApplication(
|
||||
scanBasePackageClasses = {
|
||||
CoreConfiguration.class,
|
||||
HttpClientConfiguration.class,
|
||||
SocketConfiguration.class,
|
||||
ScheduledConfiguration.class,
|
||||
MysqlConfiguration.class,
|
||||
LoginApplication.class
|
||||
}
|
||||
)
|
||||
public class LoginApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
ConfigurableApplicationContext run = new SpringApplication(LoginApplication.class).run(args);
|
||||
MainApplicationContextProvider applicationContextProvider = run.getBean(MainApplicationContextProvider.class);
|
||||
applicationContextProvider.start();
|
||||
try {
|
||||
ConfigurableApplicationContext run = new SpringApplication(LoginApplication.class).run(args);
|
||||
MainApplicationContextProvider applicationContextProvider = run.getBean(MainApplicationContextProvider.class);
|
||||
applicationContextProvider.start();
|
||||
} catch (BeansException e) {
|
||||
log.error("启动异常...", e);
|
||||
System.exit(99);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package wxdgaming.game.login;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import wxdgaming.spring.boot.core.BootstrapConfig;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 14:14
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "boot")
|
||||
public class LoginBootstrapConfig extends BootstrapConfig {
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.login.bean.info.InnerServerInfoBean;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlDataHelper;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.ann.Shutdown;
|
||||
import wxdgaming.spring.boot.core.timer.MyClock;
|
||||
|
||||
@@ -27,8 +28,8 @@ public class InnerService {
|
||||
final ConcurrentHashMap<Integer, InnerServerInfoBean> innerGameServerInfoMap = new ConcurrentHashMap<>();
|
||||
final ConcurrentHashMap<Integer, InnerServerInfoBean> innerGatewayServerInfoMap = new ConcurrentHashMap<>();
|
||||
|
||||
public InnerService(SqlDataHelper sqlDataHelper) {
|
||||
this.sqlDataHelper = sqlDataHelper;
|
||||
public InnerService(MysqlDataHelper mysqlDataHelper) {
|
||||
this.sqlDataHelper = mysqlDataHelper;
|
||||
this.sqlDataHelper.checkTable(InnerServerInfoBean.class);
|
||||
|
||||
sqlDataHelper.findList(InnerServerInfoBean.class).forEach(bean -> {
|
||||
|
||||
@@ -7,6 +7,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import wxdgaming.game.login.bean.info.InnerServerInfoBean;
|
||||
import wxdgaming.game.login.inner.InnerService;
|
||||
import wxdgaming.spring.boot.core.HoldRunApplication;
|
||||
@@ -25,7 +26,7 @@ import java.util.List;
|
||||
* @version: 2025-06-07 18:41
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
@RestController
|
||||
@RequestMapping(path = "/inner")
|
||||
public class InnerController extends HoldRunApplication {
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package wxdgaming.game.login.inner.filter;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import wxdgaming.game.login.LoginConfig;
|
||||
import wxdgaming.game.login.LoginBootstrapConfig;
|
||||
import wxdgaming.spring.boot.core.SpringUtil;
|
||||
import wxdgaming.spring.boot.core.WebFilter;
|
||||
import wxdgaming.spring.boot.core.io.Objects;
|
||||
import wxdgaming.spring.boot.core.lang.AssertException;
|
||||
import wxdgaming.spring.boot.core.util.Md5Util;
|
||||
|
||||
/**
|
||||
* 拦截器
|
||||
@@ -16,41 +21,27 @@ import wxdgaming.game.login.LoginConfig;
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class InnerFilter implements HandlerInterceptor {
|
||||
public class InnerFilter implements WebFilter {
|
||||
|
||||
final LoginConfig loginConfig;
|
||||
final LoginBootstrapConfig loginBootstrapConfig;
|
||||
|
||||
public InnerFilter(LoginConfig loginConfig) {
|
||||
this.loginConfig = loginConfig;
|
||||
public InnerFilter(LoginBootstrapConfig loginBootstrapConfig) {
|
||||
this.loginBootstrapConfig = loginBootstrapConfig;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
// 请求处理之前调用
|
||||
return true; // 返回 true 继续执行,false 中断执行
|
||||
@Override public String filterPath() {
|
||||
return "/inner/**";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
// 请求处理之后,视图渲染之前调用
|
||||
@Override public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
JSONObject parameter = SpringUtil.convertParameter(request);
|
||||
Object sign = parameter.remove("sign");
|
||||
String json = parameter.toString(SerializerFeature.MapSortField, SerializerFeature.SortField);
|
||||
String md5DigestEncode = Md5Util.md5DigestEncode0("#", json, loginBootstrapConfig.getJwtKey());
|
||||
if (!Objects.equals(sign, md5DigestEncode)) {
|
||||
throw new AssertException("签名错误");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
// 整个请求完成之后调用
|
||||
}
|
||||
|
||||
// @Override public Object doFilter(HttpRequest httpRequest, Method method, HttpContext httpContext) {
|
||||
// if (httpContext.getRequest().getUriPath().startsWith("/inner")) {
|
||||
// JSONObject reqParams = httpContext.getRequest().getReqParams();
|
||||
// Object sign = reqParams.remove("sign");
|
||||
// String json = reqParams.toString(SerializerFeature.MapSortField, SerializerFeature.SortField);
|
||||
// String md5DigestEncode = Md5Util.md5DigestEncode0("#", json, loginConfig.getJwtKey());
|
||||
// if (!Objects.equals(sign, md5DigestEncode)) {
|
||||
// return RunResult.fail("签名错误");
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,12 @@ package wxdgaming.game.login.sdk;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import wxdgaming.game.login.AppPlatformParams;
|
||||
import wxdgaming.game.login.LoginConfig;
|
||||
import wxdgaming.game.login.LoginBootstrapConfig;
|
||||
import wxdgaming.game.login.bean.UserData;
|
||||
import wxdgaming.game.login.bean.info.InnerServerInfoBean;
|
||||
import wxdgaming.game.login.inner.InnerService;
|
||||
import wxdgaming.game.login.service.LoginService;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlDataHelper;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.lang.RunResult;
|
||||
import wxdgaming.spring.boot.core.token.JsonTokenBuilder;
|
||||
import wxdgaming.spring.boot.core.util.SingletonLockUtil;
|
||||
@@ -25,8 +25,8 @@ import java.util.function.Supplier;
|
||||
public abstract class AbstractSdkLoginApi {
|
||||
|
||||
@Autowired protected LoginService loginService;
|
||||
@Autowired protected SqlDataHelper sqlDataHelper;
|
||||
@Autowired protected LoginConfig loginConfig;
|
||||
@Autowired protected MysqlDataHelper mysqlDataHelper;
|
||||
@Autowired protected LoginBootstrapConfig loginBootstrapConfig;
|
||||
@Autowired protected InnerService innerService;
|
||||
|
||||
/** 平台 */
|
||||
@@ -50,7 +50,7 @@ public abstract class AbstractSdkLoginApi {
|
||||
UserData userData = loginService.userData(account);
|
||||
if (userData == null) {
|
||||
userData = supplier.get();
|
||||
sqlDataHelper.getCacheService().cache(UserData.class).put(userData.getAccount(), userData);
|
||||
mysqlDataHelper.getCacheService().cache(UserData.class).put(userData.getAccount(), userData);
|
||||
}
|
||||
return userData;
|
||||
} finally {
|
||||
@@ -59,7 +59,7 @@ public abstract class AbstractSdkLoginApi {
|
||||
}
|
||||
|
||||
public RunResult buildResult(UserData userData) {
|
||||
JsonTokenBuilder jwtBuilder = JsonTokenBuilder.of(loginConfig.getJwtKey(), TimeUnit.MINUTES, 5);
|
||||
JsonTokenBuilder jwtBuilder = JsonTokenBuilder.of(loginBootstrapConfig.getJwtKey(), TimeUnit.MINUTES, 5);
|
||||
jwtBuilder.put("appId", userData.getAppId());
|
||||
jwtBuilder.put("platform", userData.getPlatform());
|
||||
jwtBuilder.put("account", userData.getAccount());
|
||||
|
||||
@@ -2,12 +2,12 @@ package wxdgaming.game.login.service;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.login.LoginBootstrapConfig;
|
||||
import wxdgaming.game.login.bean.UserData;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlDataCache;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.ann.Start;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.format.HexId;
|
||||
|
||||
/**
|
||||
@@ -21,16 +21,12 @@ import wxdgaming.spring.boot.core.format.HexId;
|
||||
@Service
|
||||
public class LoginService {
|
||||
|
||||
HexId userHexId;
|
||||
final HexId userHexId;
|
||||
final SqlDataHelper sqlDataHelper;
|
||||
|
||||
public LoginService(SqlDataHelper sqlDataHelper) {
|
||||
this.sqlDataHelper = sqlDataHelper;
|
||||
}
|
||||
|
||||
@Start
|
||||
public void start(@Value("${sid}") int sid) {
|
||||
userHexId = new HexId(sid);
|
||||
public LoginService(LoginBootstrapConfig loginBootstrapConfig, MysqlDataHelper mysqlDataHelper) {
|
||||
this.userHexId = new HexId(loginBootstrapConfig.getSid());
|
||||
this.sqlDataHelper = mysqlDataHelper;
|
||||
}
|
||||
|
||||
public UserData userData(String userName) {
|
||||
|
||||
15
wxdgaming.game.login/src/main/resources/application-db.yml
Normal file
15
wxdgaming.game.login/src/main/resources/application-db.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
db:
|
||||
sql:
|
||||
mysql:
|
||||
debug: false #调试模式将会显示sql语句
|
||||
driverClassName: "com.mysql.cj.jdbc.Driver"
|
||||
url: "jdbc:mysql://10.28.0.26:3306/test_login"
|
||||
username: "root"
|
||||
password: "test"
|
||||
scanPackage: "wxdgaming.game.login.bean" #扫描路径
|
||||
connectionTimeoutMs: 2000 #链接超时单位毫秒
|
||||
idleTimeoutM: 10 #空闲超时单位分钟
|
||||
minPoolSize: 5 #最小连接数
|
||||
maxPoolSize: 20 #最大连接数
|
||||
batchSubmitSize: 500 #批量提交数量
|
||||
batchThreadSize: 1 #批量提交线程数
|
||||
27
wxdgaming.game.login/src/main/resources/application.yml
Normal file
27
wxdgaming.game.login/src/main/resources/application.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
core:
|
||||
executor:
|
||||
basic:
|
||||
coreSize: 2 #默认线程池的核心线程数
|
||||
maxQueueSize: 10000 #队列超过就会打印异常
|
||||
logic:
|
||||
coreSize: 32 #逻辑线程池
|
||||
maxQueueSize: 50000 #队列超过就会打印异常
|
||||
virtual:
|
||||
coreSize: 100 #虚拟线程池
|
||||
maxQueueSize: 1500000 #队列超过就会打印异常
|
||||
scheduled:
|
||||
coreSize: 1
|
||||
maxQueueSize: 50000
|
||||
|
||||
boot:
|
||||
debug: true
|
||||
gid: 1
|
||||
sid: 1
|
||||
jwtKey: "123456789012345678901234567890123456789012345678901234567890"
|
||||
|
||||
server:
|
||||
port: 19800
|
||||
|
||||
spring:
|
||||
profiles:
|
||||
active: db,httpclient
|
||||
@@ -1,14 +0,0 @@
|
||||
db:
|
||||
mysql:
|
||||
debug: false #调试模式将会显示sql语句
|
||||
driverClassName: "com.mysql.cj.jdbc.Driver"
|
||||
url: "jdbc:mysql://127.0.0.1:3306/test_login"
|
||||
username: "root"
|
||||
password: "test"
|
||||
scanPackage: "wxdgaming.game.login.bean" #扫描路径
|
||||
connectionTimeoutMs: 2000 #链接超时单位毫秒
|
||||
idleTimeoutM: 10 #空闲超时单位分钟
|
||||
minPoolSize: 5 #最小连接数
|
||||
maxPoolSize: 20 #最大连接数
|
||||
batchSubmitSize: 500 #批量提交数量
|
||||
batchThreadSize: 1 #批量提交线程数
|
||||
@@ -1,24 +0,0 @@
|
||||
socket:
|
||||
server:
|
||||
debug: false
|
||||
port: 19800
|
||||
enabledHttp: true #是否启用http
|
||||
enabledTcp: false #是否启用tcp
|
||||
enabledScheduledFlush: true # 开启定时器flush
|
||||
scheduledFlushMs: 10 #定时调用flush的频率单位是ms
|
||||
enabledWebSocket: false #是否启用websocket
|
||||
webSocketPrefix: "/ws" #websocket前缀
|
||||
maxAggregatorLength: 64 #聚合器最大长度
|
||||
maxFrameBytes: -1 #单个消息最大长度
|
||||
maxFrameLength: -1 #一秒钟接收消息最大数量
|
||||
sslProtocolType: TLS #ssll类型
|
||||
sslKeyStorePath: "jks/wxdtest-1.8.jks" #jks证书路径
|
||||
sslPasswordPath: "jks/wxdtest-1.8.jks.pwd" #jks证书密码路径
|
||||
idleTimeout: 0
|
||||
writeTimeout: 0
|
||||
readTimeout: 0
|
||||
recvByteBufM: 12 #接收缓冲区大小 单位MB
|
||||
writeByteBufM: 12 #发送缓冲区大小 单位MB
|
||||
http:
|
||||
showRequest: true
|
||||
showResponse: true
|
||||
@@ -1,21 +0,0 @@
|
||||
debug: true
|
||||
gid: 1
|
||||
sid: 1
|
||||
profiles:
|
||||
active: [ socket, db, httpclient ]
|
||||
executor:
|
||||
basic:
|
||||
coreSize: 2 #默认线程池的核心线程数
|
||||
maxQueueSize: 10000 #队列超过就会打印异常
|
||||
logic:
|
||||
coreSize: 32 #逻辑线程池
|
||||
maxQueueSize: 50000 #队列超过就会打印异常
|
||||
virtual:
|
||||
coreSize: 100 #虚拟线程池
|
||||
maxQueueSize: 1500000 #队列超过就会打印异常
|
||||
scheduled:
|
||||
coreSize: 1
|
||||
maxQueueSize: 50000
|
||||
|
||||
login:
|
||||
jwtKey: "123456789012345678901234567890123456789012345678901234567890"
|
||||
@@ -58,9 +58,16 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="io.netty" level="info" additivity="false"/>
|
||||
<logger name="com.zaxxer.hikari" level="info" additivity="false"/>
|
||||
<logger name="org.mongodb.driver" level="info" additivity="false"/>
|
||||
<logger name="com.zaxxer.hikari" level="INFO" additivity="true"/>
|
||||
<logger name="io.netty" level="INFO" additivity="true"/>
|
||||
<logger name="io.lettuce" level="INFO" additivity="true"/>
|
||||
<logger name="reactor.util" level="INFO" additivity="true"/>
|
||||
<logger name="org.jboss" level="INFO" additivity="true"/>
|
||||
<logger name="org.hibernate" level="INFO" additivity="true"/>
|
||||
<logger name="org.xnio" level="info" additivity="true"/>
|
||||
<logger name="org.springframework" level="info" additivity="true"/>
|
||||
<logger name="org.apache.hc" level="info" additivity="true"/>
|
||||
|
||||
|
||||
<!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
|
||||
<root level="debug"> <!-- ERROR, WARN, INFO, DEBUG -->
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package wxdgaming.game.robot;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 14:14
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "boot")
|
||||
public class BootstrapConfig {
|
||||
|
||||
private boolean debug = true;
|
||||
private int gid = 1;
|
||||
private int sid = 1;
|
||||
private String name;
|
||||
private String jwtKey;
|
||||
private String loginUrl;
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package wxdgaming.game.robot;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import wxdgaming.game.login.LoginServiceConfiguration;
|
||||
import wxdgaming.spring.boot.core.CoreConfiguration;
|
||||
import wxdgaming.spring.boot.core.MainApplicationContextProvider;
|
||||
import wxdgaming.spring.boot.excel.DataConfiguration;
|
||||
@@ -16,13 +16,13 @@ import wxdgaming.spring.boot.scheduled.ScheduledConfiguration;
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2025-04-27 11:27
|
||||
**/
|
||||
@ConfigurationPropertiesScan(basePackageClasses = {BootstrapConfig.class})
|
||||
@SpringBootApplication(
|
||||
scanBasePackageClasses = {
|
||||
CoreConfiguration.class,
|
||||
SocketConfiguration.class,
|
||||
DataConfiguration.class,
|
||||
ScheduledConfiguration.class,
|
||||
LoginServiceConfiguration.class,
|
||||
RobotApplication.class
|
||||
}
|
||||
)
|
||||
|
||||
@@ -6,7 +6,6 @@ import io.netty.channel.ChannelFutureListener;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.login.LoginConfig;
|
||||
import wxdgaming.game.message.chat.ChatType;
|
||||
import wxdgaming.game.message.chat.ReqChatMessage;
|
||||
import wxdgaming.game.message.role.ReqHeartbeat;
|
||||
@@ -15,6 +14,7 @@ import wxdgaming.game.message.task.ReqAcceptTask;
|
||||
import wxdgaming.game.message.task.ReqSubmitTask;
|
||||
import wxdgaming.game.message.task.TaskBean;
|
||||
import wxdgaming.game.message.task.TaskType;
|
||||
import wxdgaming.game.robot.BootstrapConfig;
|
||||
import wxdgaming.game.robot.bean.Robot;
|
||||
import wxdgaming.spring.boot.core.ann.Start;
|
||||
import wxdgaming.spring.boot.core.chatset.StringUtils;
|
||||
@@ -40,12 +40,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Service
|
||||
public class RobotMainService {
|
||||
|
||||
final LoginConfig loginConfig;
|
||||
final BootstrapConfig bootstrapConfig;
|
||||
final SocketClient socketClient;
|
||||
final ConcurrentHashMap<String, Robot> robotMap = new ConcurrentHashMap<>();
|
||||
|
||||
public RobotMainService(LoginConfig loginConfig, SocketClient socketClient) {
|
||||
this.loginConfig = loginConfig;
|
||||
public RobotMainService(BootstrapConfig bootstrapConfig, SocketClient socketClient) {
|
||||
this.bootstrapConfig = bootstrapConfig;
|
||||
this.socketClient = socketClient;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ public class RobotMainService {
|
||||
jsonObject.put("account", robot.getAccount());
|
||||
jsonObject.put("token", robot.getAccount());
|
||||
|
||||
String uriPath = getLoginConfig().getUrl() + "/login/check";
|
||||
String uriPath = bootstrapConfig.getLoginUrl() + "/login/check";
|
||||
HttpResponse httpResponse = HttpRequestPost.ofJson(uriPath, jsonObject.toJSONString()).execute();
|
||||
RunResult runResult = httpResponse.bodyRunResult();
|
||||
if (runResult.isFail()) {
|
||||
|
||||
@@ -18,7 +18,7 @@ import wxdgaming.game.server.script.attribute.CalculatorType;
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class BaseCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
public class MonsterBaseCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
|
||||
@Override public MapObject.MapObjectType mapObjectType() {
|
||||
return MapObject.MapObjectType.Monster;
|
||||
@@ -16,7 +16,7 @@ import wxdgaming.game.server.script.attribute.CalculatorType;
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class GMCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
public class MonsterGMCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
|
||||
@Override public MapObject.MapObjectType mapObjectType() {
|
||||
return MapObject.MapObjectType.Monster;
|
||||
@@ -18,7 +18,7 @@ import wxdgaming.game.server.script.attribute.CalculatorType;
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class BaseCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
public class PlayerBaseCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
|
||||
@Override public MapObject.MapObjectType mapObjectType() {
|
||||
return MapObject.MapObjectType.Player;
|
||||
@@ -16,7 +16,7 @@ import wxdgaming.game.server.script.attribute.CalculatorType;
|
||||
**/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class GMCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
public class PlayerGMCalculatorActionImpl extends AbstractCalculatorAction {
|
||||
|
||||
@Override public MapObject.MapObjectType mapObjectType() {
|
||||
return MapObject.MapObjectType.Player;
|
||||
@@ -18,7 +18,7 @@ import wxdgaming.game.server.script.bag.use.UseItemAction;
|
||||
public class LvUpUseItemActionImpl extends UseItemAction {
|
||||
|
||||
@Override public ItemTypeConst type() {
|
||||
return ItemTypeConst.HPADD;
|
||||
return ItemTypeConst.LVUP;
|
||||
}
|
||||
|
||||
@Override public boolean canUse(Player player, BagChangesContext bagChangesContext, Item item) {
|
||||
|
||||
@@ -10,7 +10,7 @@ import wxdgaming.game.bean.goods.ItemCfg;
|
||||
import wxdgaming.game.core.Reason;
|
||||
import wxdgaming.game.core.ReasonArgs;
|
||||
import wxdgaming.game.message.cdkey.ResUseCdKey;
|
||||
import wxdgaming.game.server.bean.BackendConfig;
|
||||
import wxdgaming.game.server.GameServiceBootstrapConfig;
|
||||
import wxdgaming.game.server.bean.role.Player;
|
||||
import wxdgaming.game.server.module.data.DataCenterService;
|
||||
import wxdgaming.game.server.script.bag.BagService;
|
||||
@@ -36,27 +36,27 @@ import java.util.List;
|
||||
@Service
|
||||
public class CDKeyService {
|
||||
|
||||
final GameServiceBootstrapConfig gameServiceBootstrapConfig;
|
||||
private final DataCenterService dataCenterService;
|
||||
private final TipsService tipsService;
|
||||
private final BagService bagService;
|
||||
private final BackendConfig backendConfig;
|
||||
|
||||
|
||||
public CDKeyService(DataCenterService dataCenterService, BackendConfig backendConfig, TipsService tipsService, BagService bagService) {
|
||||
public CDKeyService(GameServiceBootstrapConfig gameServiceBootstrapConfig, DataCenterService dataCenterService, TipsService tipsService, BagService bagService) {
|
||||
this.gameServiceBootstrapConfig = gameServiceBootstrapConfig;
|
||||
this.dataCenterService = dataCenterService;
|
||||
this.backendConfig = backendConfig;
|
||||
this.tipsService = tipsService;
|
||||
this.bagService = bagService;
|
||||
}
|
||||
|
||||
public void use(Player player, String cdKey) {
|
||||
|
||||
String url = backendConfig.getUrl();
|
||||
String url = gameServiceBootstrapConfig.getBackends().getUrl();
|
||||
url = url + "/cdkey/use";
|
||||
|
||||
HashMap<String, Object> params = new HashMap<>();
|
||||
params.put("gameId", backendConfig.getGameId());
|
||||
params.put("appToken", backendConfig.getAppToken());
|
||||
params.put("gameId", gameServiceBootstrapConfig.getBackends().getGameId());
|
||||
params.put("appToken", gameServiceBootstrapConfig.getBackends().getAppToken());
|
||||
params.put("key", cdKey);
|
||||
params.put("account", player.getAccount());
|
||||
params.put("rid", player.getUid());
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package wxdgaming.game.server.script.chat.handler;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import wxdgaming.game.message.chat.ReqChatMessage;
|
||||
import wxdgaming.game.server.GameServiceBootstrapConfig;
|
||||
import wxdgaming.game.server.bean.global.GlobalDataType;
|
||||
import wxdgaming.game.server.bean.global.impl.YunyingData;
|
||||
import wxdgaming.game.server.bean.role.Player;
|
||||
@@ -26,19 +26,19 @@ import wxdgaming.spring.boot.net.ann.ProtoRequest;
|
||||
@Component
|
||||
public class ReqChatMessageHandler {
|
||||
|
||||
private final boolean debug;
|
||||
private final GameServiceBootstrapConfig gameServiceBootstrapConfig;
|
||||
private final GlobalDataService globalDataService;
|
||||
private final DataCenterService dataCenterService;
|
||||
private final ChatService chatService;
|
||||
private final TipsService tipsService;
|
||||
private final GmService gmService;
|
||||
|
||||
public ReqChatMessageHandler(@Value("${debug}") boolean debug, GlobalDataService globalDataService,
|
||||
public ReqChatMessageHandler(GameServiceBootstrapConfig gameServiceBootstrapConfig, GlobalDataService globalDataService,
|
||||
DataCenterService dataCenterService,
|
||||
ChatService chatService,
|
||||
TipsService tipsService,
|
||||
GmService gmService) {
|
||||
this.debug = debug;
|
||||
this.gameServiceBootstrapConfig = gameServiceBootstrapConfig;
|
||||
this.globalDataService = globalDataService;
|
||||
this.dataCenterService = dataCenterService;
|
||||
this.chatService = chatService;
|
||||
@@ -54,7 +54,7 @@ public class ReqChatMessageHandler {
|
||||
log.info("{} 聊天消息 {}", player, req);
|
||||
if (content.startsWith("@gm")) {
|
||||
YunyingData yunyingData = globalDataService.get(GlobalDataType.YUNYINGDATA);
|
||||
if (debug
|
||||
if (gameServiceBootstrapConfig.isDebug()
|
||||
|| yunyingData.getGmAccountSet().contains(player.getAccount())
|
||||
|| yunyingData.getGmPlayerIdSet().contains(player.getUid())) {
|
||||
gmService.doGm(player, content.substring(3).trim().split(" "));
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package wxdgaming.game.server.script.inner.handler;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import wxdgaming.game.message.inner.InnerRegisterServer;
|
||||
import wxdgaming.game.message.inner.ServiceType;
|
||||
import wxdgaming.game.server.GameServiceBootstrapConfig;
|
||||
import wxdgaming.game.server.module.data.ClientSessionService;
|
||||
import wxdgaming.spring.boot.net.SocketSession;
|
||||
import wxdgaming.spring.boot.net.ann.ProtoRequest;
|
||||
@@ -23,15 +23,13 @@ import java.util.Objects;
|
||||
@Component
|
||||
public class InnerRegisterServerHandler {
|
||||
|
||||
private final int gid;
|
||||
private final int sid;
|
||||
private final ProtoListenerFactory protoListenerFactory;
|
||||
private final ClientSessionService clientSessionService;
|
||||
final GameServiceBootstrapConfig gameServiceBootstrapConfig;
|
||||
final ProtoListenerFactory protoListenerFactory;
|
||||
final ClientSessionService clientSessionService;
|
||||
|
||||
public InnerRegisterServerHandler(@Value("${gid}") int gid, @Value("${sid}") int sid,
|
||||
ProtoListenerFactory protoListenerFactory, ClientSessionService clientSessionService) {
|
||||
this.gid = gid;
|
||||
this.sid = sid;
|
||||
public InnerRegisterServerHandler(
|
||||
GameServiceBootstrapConfig gameServiceBootstrapConfig, ProtoListenerFactory protoListenerFactory, ClientSessionService clientSessionService) {
|
||||
this.gameServiceBootstrapConfig = gameServiceBootstrapConfig;
|
||||
this.protoListenerFactory = protoListenerFactory;
|
||||
this.clientSessionService = clientSessionService;
|
||||
}
|
||||
@@ -54,10 +52,10 @@ public class InnerRegisterServerHandler {
|
||||
/*反向注册,告诉网关我是游戏服,并且告诉网关的基本信息*/
|
||||
InnerRegisterServer registerServer = new InnerRegisterServer();
|
||||
registerServer.setServiceType(ServiceType.GAME);
|
||||
registerServer.setGameId(gid);
|
||||
registerServer.setMainSid(sid);
|
||||
registerServer.setGameId(gameServiceBootstrapConfig.getSid());
|
||||
registerServer.setMainSid(gameServiceBootstrapConfig.getSid());
|
||||
/*当前进程监听的服务器有哪些*/
|
||||
registerServer.getServerIds().add(sid);
|
||||
registerServer.getServerIds().add(gameServiceBootstrapConfig.getSid());
|
||||
/*当前监听的消息id集合*/
|
||||
Collection<Integer> values = protoListenerFactory.getProtoListenerContent().getMessage2MappingMap().values();
|
||||
registerServer.getMessageIds().addAll(values);
|
||||
|
||||
@@ -2,8 +2,8 @@ package wxdgaming.game.server.script.role.handler;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import wxdgaming.game.login.LoginConfig;
|
||||
import wxdgaming.game.message.role.ReqLogin;
|
||||
import wxdgaming.game.server.GameServiceBootstrapConfig;
|
||||
import wxdgaming.game.server.bean.ClientSessionMapping;
|
||||
import wxdgaming.game.server.module.data.ClientSessionService;
|
||||
import wxdgaming.game.server.module.data.DataCenterService;
|
||||
@@ -24,22 +24,22 @@ import wxdgaming.spring.boot.net.ann.ProtoRequest;
|
||||
@Component
|
||||
public class ReqLoginHandler extends HoldRunApplication {
|
||||
|
||||
private final GameServiceBootstrapConfig gameServiceBootstrapConfig;
|
||||
private final DataCenterService dataCenterService;
|
||||
private final ClientSessionService clientSessionService;
|
||||
private final PlayerService playerService;
|
||||
private final TipsService tipsService;
|
||||
private final LoginConfig loginConfig;
|
||||
|
||||
public ReqLoginHandler(DataCenterService dataCenterService,
|
||||
ClientSessionService clientSessionService,
|
||||
PlayerService playerService,
|
||||
TipsService tipsService,
|
||||
LoginConfig loginConfig) {
|
||||
GameServiceBootstrapConfig gameServiceBootstrapConfig) {
|
||||
this.dataCenterService = dataCenterService;
|
||||
this.clientSessionService = clientSessionService;
|
||||
this.playerService = playerService;
|
||||
this.tipsService = tipsService;
|
||||
this.loginConfig = loginConfig;
|
||||
this.gameServiceBootstrapConfig = gameServiceBootstrapConfig;
|
||||
}
|
||||
|
||||
@ProtoRequest
|
||||
@@ -49,7 +49,7 @@ public class ReqLoginHandler extends HoldRunApplication {
|
||||
try {
|
||||
int sid = req.getSid();
|
||||
String token = req.getToken();
|
||||
JsonToken jsonToken = JsonTokenParse.parse(loginConfig.getJwtKey(), token);
|
||||
JsonToken jsonToken = JsonTokenParse.parse(gameServiceBootstrapConfig.getJwtKey(), token);
|
||||
int appId = jsonToken.getIntValue("appId");
|
||||
String account = jsonToken.getString("account");
|
||||
String platform = jsonToken.getString("platform");
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</descriptorRefs>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>wxdgaming.game.server.ServerApplication</mainClass> <!-- 替换为你的主类 -->
|
||||
<mainClass>wxdgaming.game.server.GameServiceApplication</mainClass> <!-- 替换为你的主类 -->
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
||||
@@ -3,11 +3,11 @@ package wxdgaming.game.server;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.ConfigurationPropertiesScan;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import wxdgaming.game.cfg.QPlayerTable;
|
||||
import wxdgaming.game.cfg.bean.QPlayer;
|
||||
import wxdgaming.game.login.LoginServiceConfiguration;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlConfiguration;
|
||||
import wxdgaming.spring.boot.core.CoreConfiguration;
|
||||
import wxdgaming.spring.boot.core.MainApplicationContextProvider;
|
||||
@@ -25,20 +25,20 @@ import java.io.File;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Slf4j
|
||||
@ConfigurationPropertiesScan(basePackageClasses = {GameServiceBootstrapConfig.class})
|
||||
@SpringBootApplication(scanBasePackageClasses = {
|
||||
CoreConfiguration.class,
|
||||
DataConfiguration.class,
|
||||
SocketConfiguration.class,
|
||||
MysqlConfiguration.class,
|
||||
ScheduledConfiguration.class,
|
||||
LoginServiceConfiguration.class,
|
||||
ServerApplication.class
|
||||
GameServiceApplication.class
|
||||
})
|
||||
public class ServerApplication {
|
||||
public class GameServiceApplication {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
try {
|
||||
ConfigurableApplicationContext run = new SpringApplication(ServerApplication.class).run(args);
|
||||
ConfigurableApplicationContext run = new SpringApplication(GameServiceApplication.class).run(args);
|
||||
MainApplicationContextProvider runApplication = run.getBean(MainApplicationContextProvider.class);
|
||||
loadScript();
|
||||
runApplication.start();
|
||||
@@ -118,7 +118,7 @@ public class ServerApplication {
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
new JavaCoderCompile().parentClassLoader(ServerApplication.class.getClassLoader())
|
||||
new JavaCoderCompile().parentClassLoader(GameServiceApplication.class.getClassLoader())
|
||||
.compilerJava("wxdgaming.game.server-script/src/main/java")
|
||||
.outPutFile("target/bin", true);
|
||||
classDirLoader = new ClassDirLoader("target/bin");
|
||||
@@ -0,0 +1,24 @@
|
||||
package wxdgaming.game.server;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import wxdgaming.game.server.bean.BackendConfig;
|
||||
import wxdgaming.spring.boot.core.BootstrapConfig;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 14:14
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "boot")
|
||||
public class GameServiceBootstrapConfig extends BootstrapConfig {
|
||||
|
||||
private int serverType = 1;
|
||||
private int maxOnline = 2000;
|
||||
private String loginUrl;
|
||||
private BackendConfig backends;
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package wxdgaming.game.server;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import wxdgaming.game.server.bean.BackendConfig;
|
||||
|
||||
/**
|
||||
* 驱动配置
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2025-06-07 18:09
|
||||
**/
|
||||
@Configuration
|
||||
public class GameServiceConfiguration {
|
||||
|
||||
|
||||
@Bean public int serverType(@Value("${serverType}") int serverType) throws Throwable {
|
||||
return serverType;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BackendConfig backendConfig(@Value("${backends}") BackendConfig backendConfig) {
|
||||
return backendConfig;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package wxdgaming.game.server.api;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -12,9 +11,6 @@ import wxdgaming.spring.boot.core.executor.ThreadContext;
|
||||
import wxdgaming.spring.boot.net.ann.RpcRequest;
|
||||
import wxdgaming.spring.boot.scheduled.ann.Scheduled;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
@@ -44,28 +40,8 @@ public class TestApi extends HoldRunApplication {
|
||||
@Scheduled("0 0")
|
||||
public void timer() {
|
||||
log.debug("{}", "timer()");
|
||||
runApplication.executorWithMethodAnnotated(RunTest.class, 1, 2);
|
||||
}
|
||||
|
||||
@Documented
|
||||
@Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
@Target({java.lang.annotation.ElementType.METHOD})
|
||||
@interface RunTest {
|
||||
|
||||
}
|
||||
|
||||
@RunTest
|
||||
public void runTestParam(@Value("${sid}") int sid, int a, int b) {
|
||||
log.info("{} sid={}, a={}, b={}", "runTest()", sid, a, b);
|
||||
}
|
||||
|
||||
// @Scheduled("*/30")
|
||||
// @ExecutorWith(useVirtualThread = true)
|
||||
// public void timerAsync() {
|
||||
// log.info("{}", "timerAsync()");
|
||||
// }
|
||||
|
||||
|
||||
public void print() {
|
||||
log.info("{} {}", "print()", FastJsonUtil.toJSONString(strMap));
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.server.GameServiceBootstrapConfig;
|
||||
import wxdgaming.game.server.api.role.GetPlayerStrategy;
|
||||
import wxdgaming.game.server.api.role.GetPlayerStrategyFactory;
|
||||
import wxdgaming.game.server.api.role.impl.DatabaseGetPlayerStrategy;
|
||||
@@ -12,8 +13,8 @@ import wxdgaming.game.server.bean.role.Player;
|
||||
import wxdgaming.game.server.bean.role.RoleEntity;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlDataHelper;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlQueryResult;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.HoldRunApplication;
|
||||
import wxdgaming.spring.boot.core.ann.Named;
|
||||
import wxdgaming.spring.boot.core.ann.Start;
|
||||
import wxdgaming.spring.boot.core.collection.concurrent.ConcurrentTable;
|
||||
import wxdgaming.spring.boot.core.format.HexId;
|
||||
@@ -34,10 +35,12 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@Service
|
||||
public class DataCenterService extends HoldRunApplication implements GetPlayerStrategy {
|
||||
|
||||
HexId hexid;
|
||||
HexId itemHexid;
|
||||
HexId mailHexid;
|
||||
HexId buffHexid;
|
||||
private final GameServiceBootstrapConfig serverBootstrapConfig;
|
||||
private final MysqlDataHelper mysqlDataHelper;
|
||||
final HexId hexid;
|
||||
final HexId itemHexid;
|
||||
final HexId mailHexid;
|
||||
final HexId buffHexid;
|
||||
/** key:serverID, key:account, value: 角色id列表 */
|
||||
final ConcurrentTable<Integer, String, HashSet<Long>> account2RidsMap = new ConcurrentTable<>();
|
||||
/** 角色名字和id的映射 key:name, value:roleId */
|
||||
@@ -50,20 +53,21 @@ public class DataCenterService extends HoldRunApplication implements GetPlayerSt
|
||||
|
||||
GetPlayerStrategyFactory getPlayerStrategyFactory;
|
||||
|
||||
public DataCenterService() {
|
||||
public DataCenterService(GameServiceBootstrapConfig serverBootstrapConfig, MysqlDataHelper mysqlDataHelper) {
|
||||
this.serverBootstrapConfig = serverBootstrapConfig;
|
||||
this.mysqlDataHelper = mysqlDataHelper;
|
||||
this.hexid = new HexId(this.serverBootstrapConfig.getSid());
|
||||
this.itemHexid = new HexId(this.serverBootstrapConfig.getSid());
|
||||
this.mailHexid = new HexId(this.serverBootstrapConfig.getSid());
|
||||
this.buffHexid = new HexId(this.serverBootstrapConfig.getSid());
|
||||
}
|
||||
|
||||
@Start
|
||||
public void start(@Named("sid") int sid, @Named("serverType") int serverType) {
|
||||
hexid = new HexId(sid);
|
||||
itemHexid = new HexId(sid);
|
||||
mailHexid = new HexId(sid);
|
||||
buffHexid = new HexId(sid);
|
||||
if (serverType <= 1) {
|
||||
SqlDataHelper sqlDataHelper = runApplication.getApplicationContext().getBean(SqlDataHelper.class);
|
||||
getPlayerStrategyFactory = new GetPlayerStrategyFactory(new DatabaseGetPlayerStrategy(sqlDataHelper));
|
||||
public void start() {
|
||||
if (this.serverBootstrapConfig.getServerType() <= 1) {
|
||||
getPlayerStrategyFactory = new GetPlayerStrategyFactory(new DatabaseGetPlayerStrategy(mysqlDataHelper));
|
||||
String sql = "SELECT uid,sid,name,account FROM role where del=?";
|
||||
try (SqlQueryResult sqlQueryResult = sqlDataHelper.queryResultSet(sql, false)) {
|
||||
try (SqlQueryResult sqlQueryResult = mysqlDataHelper.queryResultSet(sql, false)) {
|
||||
while (sqlQueryResult.hasNext()) {
|
||||
JSONObject row = sqlQueryResult.row();
|
||||
String account = row.getString("account");
|
||||
|
||||
@@ -4,6 +4,7 @@ import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.server.GameServiceBootstrapConfig;
|
||||
import wxdgaming.game.server.bean.BackendConfig;
|
||||
import wxdgaming.game.server.bean.global.DataBase;
|
||||
import wxdgaming.game.server.bean.global.GlobalDataEntity;
|
||||
@@ -11,7 +12,6 @@ import wxdgaming.game.server.bean.global.GlobalDataType;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlDataHelper;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.HoldRunApplication;
|
||||
import wxdgaming.spring.boot.core.ann.Named;
|
||||
import wxdgaming.spring.boot.core.ann.Shutdown;
|
||||
import wxdgaming.spring.boot.core.ann.Start;
|
||||
import wxdgaming.spring.boot.core.collection.concurrent.ConcurrentTable;
|
||||
@@ -29,20 +29,18 @@ import java.util.List;
|
||||
@Service
|
||||
public class GlobalDataService extends HoldRunApplication {
|
||||
|
||||
private final int sid;
|
||||
private final GameServiceBootstrapConfig gameServiceBootstrapConfig;
|
||||
private final SqlDataHelper sqlDataHelper;
|
||||
private final BackendConfig backendConfig;
|
||||
/** key: sid, key: type, value: 数据 */
|
||||
private final ConcurrentTable<Integer, GlobalDataType, GlobalDataEntity> globalDataTable = new ConcurrentTable<>();
|
||||
|
||||
public GlobalDataService(@Named("sid") int sid, MysqlDataHelper mysqlDataHelper, BackendConfig backendConfig) {
|
||||
this.sid = sid;
|
||||
public GlobalDataService(GameServiceBootstrapConfig gameServiceBootstrapConfig, MysqlDataHelper mysqlDataHelper) {
|
||||
this.gameServiceBootstrapConfig = gameServiceBootstrapConfig;
|
||||
this.sqlDataHelper = mysqlDataHelper;
|
||||
this.backendConfig = backendConfig;
|
||||
}
|
||||
|
||||
@Start
|
||||
public void start(@Named("serverType") int serverType) {
|
||||
public void start() {
|
||||
List<GlobalDataEntity> list = this.sqlDataHelper.findListByWhere(GlobalDataEntity.class, "merge = ?", false);
|
||||
for (GlobalDataEntity entity : list) {
|
||||
GlobalDataType globalDataType = GlobalDataType.ofOrException(entity.getId());
|
||||
@@ -61,12 +59,12 @@ public class GlobalDataService extends HoldRunApplication {
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T extends DataBase> T get(GlobalDataType type) {
|
||||
DataBase data = globalDataTable.computeIfAbsent(
|
||||
sid,
|
||||
gameServiceBootstrapConfig.getSid(),
|
||||
type,
|
||||
l ->
|
||||
new GlobalDataEntity()
|
||||
.setId(type.getCode())
|
||||
.setSid(sid)
|
||||
.setSid(gameServiceBootstrapConfig.getSid())
|
||||
.setData(type.getFactory().get())
|
||||
).getData();
|
||||
return (T) data;
|
||||
|
||||
@@ -2,13 +2,12 @@ package wxdgaming.game.server.module.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.global.bean.role.PlayerSnap;
|
||||
import wxdgaming.game.server.bean.role.Player;
|
||||
import wxdgaming.spring.boot.batis.sql.SqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.ann.Named;
|
||||
import wxdgaming.spring.boot.core.ann.Start;
|
||||
import wxdgaming.spring.boot.batis.sql.mysql.MysqlDataHelper;
|
||||
import wxdgaming.spring.boot.core.util.SingletonLockUtil;
|
||||
|
||||
/**
|
||||
@@ -25,16 +24,11 @@ public class GlobalDbDataCenterService {
|
||||
final SqlDataHelper globalDbHelper;
|
||||
final DataCenterService dataCenterService;
|
||||
|
||||
public GlobalDbDataCenterService(@Named("db.mysql-second") SqlDataHelper globalDbHelper, DataCenterService dataCenterService) {
|
||||
public GlobalDbDataCenterService(@Qualifier("db.sql.mysql-second") MysqlDataHelper globalDbHelper, DataCenterService dataCenterService) {
|
||||
this.globalDbHelper = globalDbHelper;
|
||||
this.dataCenterService = dataCenterService;
|
||||
}
|
||||
|
||||
@Start
|
||||
public void start(@Value("${sid}") int sid) {
|
||||
|
||||
}
|
||||
|
||||
public PlayerSnap playerSnap(long uid) {
|
||||
SingletonLockUtil.lock(uid);
|
||||
try {
|
||||
|
||||
@@ -3,10 +3,9 @@ package wxdgaming.game.server.module.timer;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
import wxdgaming.game.login.LoginConfig;
|
||||
import wxdgaming.game.login.bean.info.InnerServerInfoBean;
|
||||
import wxdgaming.game.server.GameServiceBootstrapConfig;
|
||||
import wxdgaming.game.server.module.drive.PlayerDriveService;
|
||||
import wxdgaming.spring.boot.core.collection.MapOf;
|
||||
import wxdgaming.spring.boot.core.executor.ExecutorWith;
|
||||
@@ -28,20 +27,14 @@ import java.util.List;
|
||||
@Service
|
||||
public class GameTimerService {
|
||||
|
||||
private final int sid;
|
||||
private final int gid;
|
||||
private final String sname;
|
||||
final GameServiceBootstrapConfig gameServiceBootstrapConfig;
|
||||
final SocketServer socketServer;
|
||||
final LoginConfig loginConfig;
|
||||
final PlayerDriveService playerDriveService;
|
||||
|
||||
public GameTimerService(@Value("${sid}") int sid, @Value("${gid}") int gid,@Value("${sname}") String sname,
|
||||
SocketServer socketServer, LoginConfig loginConfig, PlayerDriveService playerDriveService) {
|
||||
this.sid = sid;
|
||||
this.gid = gid;
|
||||
this.sname = sname;
|
||||
public GameTimerService(
|
||||
GameServiceBootstrapConfig gameServiceBootstrapConfig, SocketServer socketServer, PlayerDriveService playerDriveService) {
|
||||
this.socketServer = socketServer;
|
||||
this.loginConfig = loginConfig;
|
||||
this.gameServiceBootstrapConfig = gameServiceBootstrapConfig;
|
||||
this.playerDriveService = playerDriveService;
|
||||
}
|
||||
|
||||
@@ -52,27 +45,26 @@ public class GameTimerService {
|
||||
public void registerLoginServer() {
|
||||
|
||||
InnerServerInfoBean serverInfoBean = new InnerServerInfoBean();
|
||||
serverInfoBean.setServerId(sid);
|
||||
serverInfoBean.setMainId(sid);
|
||||
serverInfoBean.setGid(gid);
|
||||
serverInfoBean.setName(sname);
|
||||
serverInfoBean.setServerId(gameServiceBootstrapConfig.getSid());
|
||||
serverInfoBean.setMainId(gameServiceBootstrapConfig.getSid());
|
||||
serverInfoBean.setGid(gameServiceBootstrapConfig.getGid());
|
||||
serverInfoBean.setName(gameServiceBootstrapConfig.getName());
|
||||
serverInfoBean.setPort(socketServer.getConfig().getPort());
|
||||
serverInfoBean.setHttpPort(socketServer.getConfig().getPort());
|
||||
|
||||
serverInfoBean.setMaxOnlineSize(loginConfig.getMaxOnlineSize());
|
||||
serverInfoBean.setMaxOnlineSize(gameServiceBootstrapConfig.getMaxOnline());
|
||||
serverInfoBean.setOnlineSize(playerDriveService.onlineSize());
|
||||
|
||||
|
||||
JSONObject jsonObject = MapOf.newJSONObject();
|
||||
jsonObject.put("sidList", List.of(sid));
|
||||
jsonObject.put("sid", sid);
|
||||
jsonObject.put("sidList", List.of(gameServiceBootstrapConfig.getSid()));
|
||||
jsonObject.put("sid", gameServiceBootstrapConfig.getSid());
|
||||
jsonObject.put("serverBean", serverInfoBean.toJSONString());
|
||||
|
||||
String json = jsonObject.toString(SerializerFeature.MapSortField, SerializerFeature.SortField);
|
||||
String md5DigestEncode = Md5Util.md5DigestEncode0("#", json, loginConfig.getJwtKey());
|
||||
String md5DigestEncode = Md5Util.md5DigestEncode0("#", json, gameServiceBootstrapConfig.getJwtKey());
|
||||
jsonObject.put("sign", md5DigestEncode);
|
||||
|
||||
HttpResponse execute = HttpRequestPost.ofJson(loginConfig.getUrl() + "/inner/registerGame", jsonObject.toString()).execute();
|
||||
HttpResponse execute = HttpRequestPost.ofJson(gameServiceBootstrapConfig.getLoginUrl() + "/inner/registerGame", jsonObject.toString()).execute();
|
||||
log.info("向登陆服务器注册: {}", execute.bodyString());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,32 @@
|
||||
debug: true
|
||||
gid: 1
|
||||
sid: 1
|
||||
sname: "游戏一服"
|
||||
serverType: 1
|
||||
executor:
|
||||
basic:
|
||||
coreSize: 2 #默认线程池的核心线程数
|
||||
maxQueueSize: 10000 #队列超过就会打印异常
|
||||
logic:
|
||||
coreSize: 32 #逻辑线程池
|
||||
maxQueueSize: 50000 #队列超过就会打印异常
|
||||
virtual:
|
||||
coreSize: 100 #虚拟线程池
|
||||
maxQueueSize: 1500000 #队列超过就会打印异常
|
||||
scheduled:
|
||||
coreSize: 1
|
||||
maxQueueSize: 500
|
||||
boot:
|
||||
debug: true
|
||||
gid: 1
|
||||
sid: 1
|
||||
name: "游戏一服"
|
||||
serverType: 1
|
||||
loginUrl: "http://127.0.0.1:19800"
|
||||
jwtKey: "123456789012345678901234567890123456789012345678901234567890"
|
||||
backends:
|
||||
url: "http://127.0.0.1:8000"
|
||||
gameId: 1
|
||||
appToken: "123456"
|
||||
logToken: "123456"
|
||||
|
||||
core:
|
||||
executor:
|
||||
basic:
|
||||
coreSize: 2 #默认线程池的核心线程数
|
||||
maxQueueSize: 10000 #队列超过就会打印异常
|
||||
logic:
|
||||
coreSize: 32 #逻辑线程池
|
||||
maxQueueSize: 50000 #队列超过就会打印异常
|
||||
virtual:
|
||||
coreSize: 100 #虚拟线程池
|
||||
maxQueueSize: 1500000 #队列超过就会打印异常
|
||||
scheduled:
|
||||
coreSize: 1
|
||||
maxQueueSize: 500
|
||||
|
||||
http:
|
||||
client:
|
||||
routeMaxSize: 20 #连接池的核心连接数
|
||||
@@ -26,6 +37,7 @@ http:
|
||||
connectionRequestTimeout: 1000 #从连接池获取连接超时
|
||||
keepAliveTimeout: 30000 #连接有效时间
|
||||
readTimeout: 3000 #读取超时时间
|
||||
|
||||
socket:
|
||||
server:
|
||||
debug: false
|
||||
@@ -47,41 +59,40 @@ socket:
|
||||
readTimeout: 0
|
||||
recvByteBufM: 12 #接收缓冲区大小 单位MB
|
||||
writeByteBufM: 12 #发送缓冲区大小 单位MB
|
||||
http:
|
||||
showRequest: true
|
||||
showResponse: true
|
||||
|
||||
data:
|
||||
json:
|
||||
path: "cfg_json"
|
||||
scan: "wxdgaming.game.cfg"
|
||||
|
||||
db:
|
||||
mysql:
|
||||
debug: false #调试模式将会显示sql语句
|
||||
driverClassName: "com.mysql.cj.jdbc.Driver"
|
||||
url: "jdbc:mysql://127.0.0.1:3306/test_game"
|
||||
username: "root"
|
||||
password: "test"
|
||||
scanPackage: "wxdgaming.game.server.bean" #扫描路径
|
||||
connectionTimeoutMs: 2000 #链接超时单位毫秒
|
||||
idleTimeoutM: 10 #空闲超时单位分钟
|
||||
minPoolSize: 5 #最小连接数
|
||||
maxPoolSize: 20 #最大连接数
|
||||
batchSubmitSize: 500 #批量提交数量
|
||||
batchThreadSize: 1 #批量提交线程数
|
||||
mysql-second:
|
||||
debug: false #调试模式将会显示sql语句
|
||||
driverClassName: "com.mysql.cj.jdbc.Driver"
|
||||
url: "jdbc:mysql://127.0.0.1:3306/test_game_global"
|
||||
username: "root"
|
||||
password: "test"
|
||||
scanPackage: "wxdgaming.game.global.bean" #扫描路径
|
||||
connectionTimeoutMs: 2000 #链接超时单位毫秒
|
||||
idleTimeoutM: 10 #空闲超时单位分钟
|
||||
minPoolSize: 5 #最小连接数
|
||||
maxPoolSize: 20 #最大连接数
|
||||
batchSubmitSize: 500 #批量提交数量
|
||||
batchThreadSize: 1 #批量提交线程数
|
||||
sql:
|
||||
mysql:
|
||||
debug: false #调试模式将会显示sql语句
|
||||
driverClassName: "com.mysql.cj.jdbc.Driver"
|
||||
url: "jdbc:mysql://10.28.0.26:3306/test_game"
|
||||
username: "root"
|
||||
password: "test"
|
||||
scanPackage: "wxdgaming.game.server.bean" #扫描路径
|
||||
connectionTimeoutMs: 2000 #链接超时单位毫秒
|
||||
idleTimeoutM: 10 #空闲超时单位分钟
|
||||
minPoolSize: 5 #最小连接数
|
||||
maxPoolSize: 20 #最大连接数
|
||||
batchSubmitSize: 500 #批量提交数量
|
||||
batchThreadSize: 1 #批量提交线程数
|
||||
mysql-second:
|
||||
debug: false #调试模式将会显示sql语句
|
||||
driverClassName: "com.mysql.cj.jdbc.Driver"
|
||||
url: "jdbc:mysql://10.28.0.26:3306/test_game_global"
|
||||
username: "root"
|
||||
password: "test"
|
||||
scanPackage: "wxdgaming.game.global.bean" #扫描路径
|
||||
connectionTimeoutMs: 2000 #链接超时单位毫秒
|
||||
idleTimeoutM: 10 #空闲超时单位分钟
|
||||
minPoolSize: 5 #最小连接数
|
||||
maxPoolSize: 20 #最大连接数
|
||||
batchSubmitSize: 500 #批量提交数量
|
||||
batchThreadSize: 1 #批量提交线程数
|
||||
# pgsql:
|
||||
# debug: false #调试模式将会显示sql语句
|
||||
# driverClassName: "org.postgresql.Driver"
|
||||
@@ -96,16 +107,6 @@ db:
|
||||
# batchSubmitSize: 500 #批量提交数量
|
||||
# batchThreadSize: 1 #批量提交线程数
|
||||
|
||||
backends:
|
||||
url: "http://127.0.0.1:8000"
|
||||
gameId: 1
|
||||
appToken: "123456"
|
||||
logToken: "123456"
|
||||
|
||||
login:
|
||||
url: http://127.0.0.1:19800
|
||||
jwtKey: "123456789012345678901234567890123456789012345678901234567890"
|
||||
|
||||
chat:
|
||||
host: 127.0.0.1
|
||||
port: 19800
|
||||
@@ -58,10 +58,15 @@
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<logger name="io.netty" level="info" additivity="false"/>
|
||||
<logger name="org.apache.hc" level="info" additivity="false"/>
|
||||
<logger name="com.zaxxer.hikari" level="info" additivity="false"/>
|
||||
<logger name="org.mongodb.driver" level="info" additivity="false"/>
|
||||
<logger name="com.zaxxer.hikari" level="INFO" additivity="true"/>
|
||||
<logger name="io.netty" level="INFO" additivity="true"/>
|
||||
<logger name="io.lettuce" level="INFO" additivity="true"/>
|
||||
<logger name="reactor.util" level="INFO" additivity="true"/>
|
||||
<logger name="org.jboss" level="INFO" additivity="true"/>
|
||||
<logger name="org.hibernate" level="INFO" additivity="true"/>
|
||||
<logger name="org.xnio" level="info" additivity="true"/>
|
||||
<logger name="org.springframework" level="info" additivity="true"/>
|
||||
<logger name="org.apache.hc" level="info" additivity="true"/>
|
||||
|
||||
<!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
|
||||
<root level="debug"> <!-- ERROR, WARN, INFO, DEBUG -->
|
||||
|
||||
@@ -46,7 +46,7 @@ public class MysqlConfiguration implements InitPrint {
|
||||
return new MysqlDataHelper(mysql);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Bean("db.sql.mysql-second")
|
||||
@ConditionalOnProperty(name = "db.sql.mysql-second.url")
|
||||
public MysqlDataHelper mysqlSecond() {
|
||||
return new MysqlDataHelper(mysql);
|
||||
|
||||
@@ -144,6 +144,7 @@ public class ApplicationContextProvider implements InitPrint, ApplicationContext
|
||||
if (predicate != null) {
|
||||
methodStream = methodStream.filter(predicate);
|
||||
}
|
||||
methodStream = methodStream.sorted();
|
||||
return methodStream;
|
||||
}
|
||||
|
||||
@@ -327,12 +328,15 @@ public class ApplicationContextProvider implements InitPrint, ApplicationContext
|
||||
public Object configValue(String valueKey, Type parameterizedType) {
|
||||
Object o;
|
||||
if (valueKey.startsWith("${")) {
|
||||
String v2 = applicationContext.getEnvironment().resolvePlaceholders(valueKey);
|
||||
o = FastJsonUtil.parse(v2, parameterizedType);
|
||||
o = applicationContext.getEnvironment().resolvePlaceholders(valueKey);
|
||||
|
||||
} else {
|
||||
String property = applicationContext.getEnvironment().getProperty(valueKey);
|
||||
o = FastJsonUtil.parse(property, parameterizedType);
|
||||
o = applicationContext.getEnvironment().getProperty(valueKey);
|
||||
}
|
||||
if (parameterizedType.equals(String.class)) {
|
||||
return o;
|
||||
} else {
|
||||
return FastJsonUtil.parse(String.valueOf(o), parameterizedType);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package wxdgaming.spring.boot.core;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
/**
|
||||
* 配置
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 14:14
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@ConfigurationProperties(prefix = "boot")
|
||||
public class BootstrapConfig {
|
||||
|
||||
private boolean debug = true;
|
||||
private int gid = 1;
|
||||
private int sid = 1;
|
||||
private String name;
|
||||
private String jwtKey;
|
||||
private String rpcToken;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package wxdgaming.spring.boot.core;
|
||||
|
||||
import jakarta.servlet.FilterChain;
|
||||
import jakarta.servlet.ServletException;
|
||||
import jakarta.servlet.ServletRequest;
|
||||
import jakarta.servlet.ServletResponse;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.boot.web.servlet.filter.OrderedFilter;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* 拦截器传递
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 16:19
|
||||
*/
|
||||
@Component
|
||||
public class ContentCachingRequestWrapperFilter implements OrderedFilter {
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
//顺序控制要看你自己的代码
|
||||
//尽量小,比如说我这里是OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER-106
|
||||
//REQUEST_WRAPPER_FILTER_MAX_ORDER变量是spring 官方推荐的顺序
|
||||
//但是直接使用可能也会有坑,你可以自己查一下。
|
||||
//因为有一个spring boot 默认扩展的过滤OrderedRequestContextFilter
|
||||
//它使用的是REQUEST_WRAPPER_FILTER_MAX_ORDER - 105
|
||||
//所以为了尽可能早一点,你自己根据你的情况调整顺序
|
||||
return OrderedFilter.REQUEST_WRAPPER_FILTER_MAX_ORDER - 106;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
//传递包装类下去。这样后面的servlet等可以拿到这个包装后的request
|
||||
ContentCachingRequestWrapperNew requestWrapperNew = new ContentCachingRequestWrapperNew((HttpServletRequest) request);
|
||||
/*TODO 这个代码不能删除,必须强制读取一次才行*/
|
||||
String string = requestWrapperNew.getReader().readLine();
|
||||
chain.doFilter(requestWrapperNew, response);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package wxdgaming.spring.boot.core;
|
||||
|
||||
import jakarta.servlet.ReadListener;
|
||||
import jakarta.servlet.ServletInputStream;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.web.util.ContentCachingRequestWrapper;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* 阅读器内容包装
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2025-08-12 16:16
|
||||
**/
|
||||
public class ContentCachingRequestWrapperNew extends ContentCachingRequestWrapper {
|
||||
|
||||
//原子变量,用来区分首次读取还是非首次
|
||||
private final AtomicBoolean isFirst = new AtomicBoolean(true);
|
||||
|
||||
public ContentCachingRequestWrapperNew(HttpServletRequest request) {
|
||||
super(request);
|
||||
}
|
||||
|
||||
public ContentCachingRequestWrapperNew(HttpServletRequest request, int contentCacheLimit) {
|
||||
super(request, contentCacheLimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
|
||||
if (isFirst.get()) {
|
||||
//首次读取直接调父类的方法,这一次执行完之后 缓存流中有数据了
|
||||
//后续读取就读缓存流里的。
|
||||
isFirst.set(false);
|
||||
return super.getInputStream();
|
||||
}
|
||||
|
||||
//用缓存流构建一个新的输入流
|
||||
return new ServletInputStreamNew(super.getContentAsByteArray());
|
||||
}
|
||||
|
||||
//参考自 DelegatingServletInputStream
|
||||
static class ServletInputStreamNew extends ServletInputStream {
|
||||
|
||||
private final InputStream sourceStream;
|
||||
|
||||
private boolean finished = false;
|
||||
|
||||
|
||||
public ServletInputStreamNew(byte[] bytes) {
|
||||
//构建一个普通的输入流
|
||||
this.sourceStream = new ByteArrayInputStream(bytes);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
int data = this.sourceStream.read();
|
||||
if (data == -1) {
|
||||
this.finished = true;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int available() throws IOException {
|
||||
return this.sourceStream.available();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
super.close();
|
||||
this.sourceStream.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return this.finished;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package wxdgaming.spring.boot.core;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.core.Ordered;
|
||||
@@ -19,10 +18,10 @@ import wxdgaming.spring.boot.core.executor.ExecutorFactory;
|
||||
@Getter
|
||||
@Order(Ordered.HIGHEST_PRECEDENCE)
|
||||
@Component
|
||||
@EnableConfigurationProperties(CoreProperties.class)
|
||||
@EnableConfigurationProperties({CoreProperties.class})
|
||||
public class CoreConfiguration implements InitPrint {
|
||||
|
||||
private final CoreProperties coreProperties;
|
||||
final CoreProperties coreProperties;
|
||||
|
||||
@Autowired
|
||||
public CoreConfiguration(CoreProperties coreProperties) {
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package wxdgaming.spring.boot.core;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.ErrorResponse;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import wxdgaming.spring.boot.core.lang.AssertException;
|
||||
|
||||
@Slf4j
|
||||
@RestControllerAdvice
|
||||
public class RestGlobalExceptionHandler {
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public ErrorResponse handleException(Exception ex) {
|
||||
if (ex instanceof AssertException) {
|
||||
return ErrorResponse.create(ex, HttpStatus.OK, ex.getMessage());
|
||||
}
|
||||
log.error("系统异常", ex);
|
||||
return ErrorResponse.create(ex, HttpStatus.INTERNAL_SERVER_ERROR, "系统异常");
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public ErrorResponse handleRuntimeException(RuntimeException ex) {
|
||||
if (ex instanceof AssertException) {
|
||||
return ErrorResponse.create(ex, HttpStatus.OK, ex.getMessage());
|
||||
}
|
||||
log.error("运行时异常", ex);
|
||||
return ErrorResponse.create(ex, HttpStatus.INTERNAL_SERVER_ERROR, "系统异常");
|
||||
}
|
||||
|
||||
@ExceptionHandler(IllegalArgumentException.class)
|
||||
public ErrorResponse handleIllegalArgumentException(IllegalArgumentException ex) {
|
||||
log.warn("参数异常", ex);
|
||||
return ErrorResponse.create(ex, HttpStatus.INTERNAL_SERVER_ERROR, "系统异常");
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package wxdgaming.spring.boot.core;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import jakarta.servlet.ServletContext;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -22,12 +23,15 @@ import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||
import org.springframework.web.util.ContentCachingRequestWrapper;
|
||||
import wxdgaming.spring.boot.core.loader.ClassDirLoader;
|
||||
import wxdgaming.spring.boot.core.loader.JavaCoderCompile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collection;
|
||||
import java.util.Enumeration;
|
||||
|
||||
/**
|
||||
* spring 工具
|
||||
@@ -81,6 +85,25 @@ public class SpringUtil implements InitPrint {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static JSONObject convertParameter(HttpServletRequest request) throws IOException {
|
||||
Enumeration<String> parameterNames = request.getParameterNames();
|
||||
JSONObject reqParams = new JSONObject();
|
||||
while (parameterNames.hasMoreElements()) {
|
||||
String name = parameterNames.nextElement();
|
||||
reqParams.put(name, request.getParameter(name));
|
||||
}
|
||||
|
||||
// 处理 POST JSON 请求体
|
||||
if ("POST".equalsIgnoreCase(request.getMethod()) && request.getContentType().contains("application/json")) {
|
||||
ContentCachingRequestWrapper wrapper = (ContentCachingRequestWrapper) request;
|
||||
String body = new String(wrapper.getContentAsByteArray(), wrapper.getCharacterEncoding());
|
||||
JSONObject bodyParams = JSONObject.parseObject(body);
|
||||
reqParams.putAll(bodyParams);
|
||||
}
|
||||
|
||||
return reqParams;
|
||||
}
|
||||
|
||||
public static String getCurrentUrl(HttpServletRequest request) {
|
||||
String scheme = request.getScheme(); // http
|
||||
String serverName = request.getServerName(); // hostname.com
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
package wxdgaming.spring.boot.core.ann;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
|
||||
@Documented
|
||||
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
|
||||
@java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, ElementType.PARAMETER, ElementType.FIELD})
|
||||
public @interface Named {
|
||||
|
||||
String value() default "";
|
||||
|
||||
boolean required() default true;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package wxdgaming.spring.boot.core.executor;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONCreator;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -29,6 +28,6 @@ public class ExecutorConfig extends ObjectBase {
|
||||
@JSONField(ordinal = 2)
|
||||
private int maxQueueSize;
|
||||
@JSONField(ordinal = 3)
|
||||
private QueuePolicyConst queuePolicy;
|
||||
private QueuePolicyConst queuePolicy = QueuePolicyConst.AbortPolicy;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ import java.util.function.Function;
|
||||
/**
|
||||
* 配置字符串
|
||||
*
|
||||
* @author wxd-gaming(無心道, 15388152619)
|
||||
* @version 2024-10-08 20:44
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: 2024-10-08 20:44
|
||||
**/
|
||||
public class ConfigString {
|
||||
|
||||
|
||||
@@ -47,8 +47,8 @@ public class DataRepository {
|
||||
|
||||
@Start
|
||||
@Order(1)
|
||||
public void start(@Value("data.json.path") String jsonPath,
|
||||
@Value("data.json.scan") String scanPackageName) {
|
||||
public void start(@Value("${data.json.path:}") String jsonPath,
|
||||
@Value("${data.json.scan:}") String scanPackageName) {
|
||||
this.jsonPath = jsonPath;
|
||||
this.scanPackageName = scanPackageName;
|
||||
loadAll();
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package ${packageName}.bean;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import wxdgaming.spring.boot.excel.store.DataChecked;
|
||||
import wxdgaming.spring.boot.excel.store.DataTable;
|
||||
import ${packageName}.bean.mapping.${codeClassName}Mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* excel 构建 ${tableComment}, ${filePath}, ${tableName},
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: ${.now?string("yyyy-MM-dd HH:mm:ss")}
|
||||
**/
|
||||
@Getter
|
||||
public class ${codeClassName} extends ${codeClassName}Mapping implements Serializable, DataChecked {
|
||||
|
||||
@Override public void initAndCheck(Map<Class<?>, DataTable<?>> store) throws Exception {
|
||||
/*todo 实现数据检测和初始化*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package ${packageName}.bean.mapping;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import wxdgaming.spring.boot.core.lang.ObjectBase;
|
||||
import wxdgaming.spring.boot.excel.store.DataKey;
|
||||
import wxdgaming.spring.boot.excel.store.DataMapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* excel 构建 ${tableComment}, ${filePath}, ${tableName},
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@DataMapping(name = "${tableName}", comment = "${tableComment}", excelPath = "${filePath}", sheetName = "${tableName}")
|
||||
public abstract class ${codeClassName}Mapping extends ObjectBase implements Serializable, DataKey {
|
||||
|
||||
<#list columns as column>
|
||||
/** ${column.columnComment} */
|
||||
<#if column.fieldTypeString?starts_with("List<")>
|
||||
protected final ${column.fieldTypeString} ${column.fieldNameLower} = new ArrayList<>();
|
||||
<#elseif column.fieldTypeString?starts_with("Map<")>
|
||||
protected final ${column.fieldTypeString} ${column.fieldNameLower} = new LinkedHashMap<>();
|
||||
<#else>
|
||||
protected ${column.fieldTypeString} ${column.fieldNameLower};
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
public Object key() {
|
||||
return ${keyColumn};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package ${packageName};
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import wxdgaming.spring.boot.excel.store.DataTable;
|
||||
import ${packageName}.bean.${codeClassName};
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* excel 构建 ${tableComment}, ${filePath}, ${tableName},
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: ${.now?string("yyyy-MM-dd HH:mm:ss")}
|
||||
**/
|
||||
@Getter
|
||||
public class ${codeClassName}Table extends DataTable<${codeClassName}> implements Serializable {
|
||||
|
||||
@Override public void initDb() {
|
||||
/*todo 实现一些数据分组*/
|
||||
|
||||
}
|
||||
|
||||
@Override public void checkData(Map<Class<?>, DataTable<?>> store) {
|
||||
/*todo 实现数据校验 */
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package ${packageName}.bean;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import wxdgaming.spring.boot.excel.store.DataChecked;
|
||||
import ${packageName}.bean.mapping.${codeClassName}Mapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* excel 构建 ${tableComment}, ${filePath}, ${tableName},
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: ${.now?string("yyyy-MM-dd HH:mm:ss")}
|
||||
**/
|
||||
@Getter
|
||||
public class ${codeClassName} extends ${codeClassName}Mapping implements Serializable, DataChecked {
|
||||
|
||||
@Override public void initAndCheck() throws Exception {
|
||||
/*todo 实现数据检测和初始化*/
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package ${packageName}.bean.mapping;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import wxdgaming.spring.boot.core.lang.ObjectBase;
|
||||
import wxdgaming.spring.boot.excel.store.DataKey;
|
||||
import wxdgaming.spring.boot.excel.store.DataMapping;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* excel 构建 ${tableComment}, ${filePath}, ${tableName},
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
**/
|
||||
@Getter
|
||||
@Setter
|
||||
@DataMapping(name = "${tableName}", comment = "${tableComment}", excelPath = "${filePath}", sheetName = "${tableName}")
|
||||
public abstract class ${codeClassName}Mapping extends ObjectBase implements Serializable, DataKey {
|
||||
|
||||
<#list columns as column>
|
||||
/** ${column.columnComment} */
|
||||
<#if column.fieldTypeString?starts_with("List<")>
|
||||
protected final ${column.fieldTypeString} ${column.fieldNameLower} = new ArrayList<>();
|
||||
<#elseif column.fieldTypeString?starts_with("Map<")>
|
||||
protected final ${column.fieldTypeString} ${column.fieldNameLower} = new LinkedHashMap<>();
|
||||
<#else>
|
||||
protected ${column.fieldTypeString} ${column.fieldNameLower};
|
||||
</#if>
|
||||
</#list>
|
||||
|
||||
public Object key() {
|
||||
return ${keyColumn};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package ${packageName};
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
import wxdgaming.spring.boot.excel.store.DataTable;
|
||||
import ${packageName}.bean.${codeClassName};
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* excel 构建 ${tableComment}, ${filePath}, ${tableName},
|
||||
*
|
||||
* @author: wxd-gaming(無心道, 15388152619)
|
||||
* @version: ${.now?string("yyyy-MM-dd HH:mm:ss")}
|
||||
**/
|
||||
@Getter
|
||||
public class ${codeClassName}Table extends DataTable<${codeClassName}> implements Serializable {
|
||||
|
||||
@Override public void initDb() {
|
||||
/*todo 实现一些数据分组*/
|
||||
|
||||
}
|
||||
|
||||
@Override public void checkData(Map<Class<?>, DataTable<?>> store) {
|
||||
/*todo 实现数据校验 */
|
||||
}
|
||||
|
||||
}
|
||||
BIN
wxdgaming.spring.boot.excel/src/main/resources/范例.xlsx
Normal file
BIN
wxdgaming.spring.boot.excel/src/main/resources/范例.xlsx
Normal file
Binary file not shown.
BIN
wxdgaming.spring.boot.excel/src/main/resources/说明文件.xlsx
Normal file
BIN
wxdgaming.spring.boot.excel/src/main/resources/说明文件.xlsx
Normal file
Binary file not shown.
@@ -3,7 +3,6 @@ package wxdgaming.spring.boot.net;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -22,14 +21,17 @@ import wxdgaming.spring.boot.net.server.SocketServer;
|
||||
* @version 2025-02-13 09:45
|
||||
**/
|
||||
@Getter
|
||||
@ComponentScan
|
||||
@Component
|
||||
@EnableConfigurationProperties(SocketProperties.class)
|
||||
public class SocketConfiguration implements InitPrint {
|
||||
|
||||
private final CoreConfiguration coreConfiguration;
|
||||
private final SocketProperties socketProperties;
|
||||
|
||||
@Autowired
|
||||
public SocketConfiguration(CoreConfiguration coreConfiguration, SocketProperties socketProperties) {
|
||||
this.coreConfiguration = coreConfiguration;
|
||||
this.socketProperties = socketProperties;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,13 +3,9 @@ package wxdgaming.spring.boot.net.module.inner;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.stereotype.Component;
|
||||
import reactor.core.publisher.Mono;
|
||||
import wxdgaming.spring.boot.core.CoreConfiguration;
|
||||
import wxdgaming.spring.boot.core.BootstrapConfig;
|
||||
import wxdgaming.spring.boot.core.cache2.CASCache;
|
||||
import wxdgaming.spring.boot.core.cache2.Cache;
|
||||
import wxdgaming.spring.boot.core.format.HexId;
|
||||
@@ -30,21 +26,18 @@ import java.util.concurrent.TimeUnit;
|
||||
**/
|
||||
@Slf4j
|
||||
@Getter
|
||||
@ComponentScan(basePackageClasses = {CoreConfiguration.class})
|
||||
@AutoConfigureAfter(CoreConfiguration.class)
|
||||
@Component
|
||||
public class RpcService {
|
||||
|
||||
final BootstrapConfig bootstrapConfig;
|
||||
final HexId hexId;
|
||||
final RpcListenerFactory rpcListenerFactory;
|
||||
final Cache<Long, CompletableFuture<JSONObject>> rpcCache;
|
||||
|
||||
String rpcToken = null;
|
||||
|
||||
@Autowired
|
||||
public RpcService(@Value("${sid}") int sid, @Value("${rpc.token}") String rpcToken, RpcListenerFactory rpcListenerFactory) {
|
||||
this.hexId = new HexId(sid);
|
||||
this.rpcToken = rpcToken;
|
||||
public RpcService(BootstrapConfig bootstrapConfig, RpcListenerFactory rpcListenerFactory) {
|
||||
this.hexId = new HexId(bootstrapConfig.getSid());
|
||||
this.bootstrapConfig = bootstrapConfig;
|
||||
this.rpcListenerFactory = rpcListenerFactory;
|
||||
this.rpcCache = CASCache.<Long, CompletableFuture<JSONObject>>builder()
|
||||
.cacheName("rpc-server")
|
||||
@@ -60,7 +53,7 @@ public class RpcService {
|
||||
}
|
||||
|
||||
public String sign(long rpcId) {
|
||||
return Md5Util.md5DigestEncode0("#", String.valueOf(rpcId), rpcToken);
|
||||
return Md5Util.md5DigestEncode0("#", String.valueOf(rpcId), bootstrapConfig.getRpcToken());
|
||||
}
|
||||
|
||||
public CompletableFuture<JSONObject> responseFuture(long rpcId) {
|
||||
|
||||
Reference in New Issue
Block a user