diff --git a/bin/json/game_combatlevel.json b/bin/json/game_combatlevel.json
new file mode 100644
index 000000000..5a15e1bbd
--- /dev/null
+++ b/bin/json/game_combatlevel.json
@@ -0,0 +1,317 @@
+[
+ {
+ "id": 10001,
+ "formatList": [
+ 110211,
+ 110212
+ ],
+ "droplist": [
+ 1001,
+ 1002
+ ],
+ "passformatList": [
+ 110211,
+ 110212
+ ],
+ "passdroplist": [
+ 1001,
+ 1002
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 10002,
+ "formatList": [
+ 110212,
+ 110213
+ ],
+ "droplist": [
+ 1002
+ ],
+ "passformatList": [
+ 110212
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 10003,
+ "formatList": [
+ 110213,
+ 110214
+ ],
+ "droplist": [
+ 1003
+ ],
+ "passformatList": [
+ 110213
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 20001,
+ "formatList": [
+ 110214,
+ 110215
+ ],
+ "droplist": [
+ 1004
+ ],
+ "passformatList": [
+ 110214
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 20002,
+ "formatList": [
+ 110215,
+ 110216
+ ],
+ "droplist": [
+ 1005
+ ],
+ "passformatList": [
+ 110215
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 20003,
+ "formatList": [
+ 110216,
+ 120031
+ ],
+ "droplist": [
+ 1006
+ ],
+ "passformatList": [
+ 110216
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 30001,
+ "formatList": [
+ 120031,
+ 120032
+ ],
+ "droplist": [
+ 1007
+ ],
+ "passformatList": [
+ 120031
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 30002,
+ "formatList": [
+ 120032,
+ 120033
+ ],
+ "droplist": [
+ 1008
+ ],
+ "passformatList": [
+ 120032
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 30003,
+ "formatList": [
+ 120033,
+ 120034
+ ],
+ "droplist": [
+ 1009
+ ],
+ "passformatList": [
+ 120033
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 40001,
+ "formatList": [
+ 120034,
+ 120035
+ ],
+ "droplist": [
+ 1010
+ ],
+ "passformatList": [
+ 120034
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 40002,
+ "formatList": [
+ 120035
+ ],
+ "droplist": [
+ 1011
+ ],
+ "passformatList": [
+ 120035
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 40003,
+ "formatList": [
+ 120036
+ ],
+ "droplist": [
+ 1012
+ ],
+ "passformatList": [
+ 120036
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 50001,
+ "formatList": [
+ 130011
+ ],
+ "droplist": [
+ 1013
+ ],
+ "passformatList": [
+ 130011
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 50002,
+ "formatList": [
+ 130012
+ ],
+ "droplist": [
+ 1014
+ ],
+ "passformatList": [
+ 130012
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 50003,
+ "formatList": [
+ 130013
+ ],
+ "droplist": [
+ 1015
+ ],
+ "passformatList": [
+ 130013
+ ],
+ "passdroplist": [],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/bin/json/game_combatmanster.json b/bin/json/game_combatmanster.json
new file mode 100644
index 000000000..58ab438b7
--- /dev/null
+++ b/bin/json/game_combatmanster.json
@@ -0,0 +1,198 @@
+[
+ {
+ "id": 110211,
+ "formatList": [
+ 101072,
+ 101073
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 110212,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 110213,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 110214,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 110215,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 110216,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 120031,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 120032,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 120033,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 120034,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 120035,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 120036,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 130011,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 130012,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ },
+ {
+ "id": 130013,
+ "formatList": [
+ 101072
+ ],
+ "award": [
+ {
+ "a": "attr",
+ "t": "gold",
+ "n": 1650
+ }
+ ]
+ }
+]
\ No newline at end of file
diff --git a/comm/const.go b/comm/const.go
index 0a68df268..b6b990ec2 100644
--- a/comm/const.go
+++ b/comm/const.go
@@ -23,7 +23,7 @@ const (
)
const (
- RDS_SESSION = ""
+ RDS_EMPTY = ""
)
//ERR
@@ -74,6 +74,7 @@ const (
ModuleGrowtask core.M_Modules = "growtask" //成长任务
ModuleWorldtask core.M_Modules = "worldtask" //世界任务
ModuleReddot core.M_Modules = "reddot" //红点
+ ModuleCombat core.M_Modules = "combat" //关卡编辑
)
//数据表名定义处
@@ -199,6 +200,8 @@ const (
TableGrowtask = "growtask"
// 世界任务
TableWorldtask = "worldtask"
+ //关卡编辑
+ TableCombat = "combat"
)
//RPC服务接口定义处
@@ -432,7 +435,7 @@ const (
)
const (
- MaxRankList = 50
+ MaxRankList = 50 // 赛季塔 排行榜人数
)
const (
diff --git a/modules/battle/configure.go b/modules/battle/configure.go
index e9c1d1885..bdf21fec2 100644
--- a/modules/battle/configure.go
+++ b/modules/battle/configure.go
@@ -4,7 +4,6 @@ import (
"fmt"
"go_dreamfactory/lego/core"
"go_dreamfactory/modules"
- "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
"sync"
)
@@ -33,45 +32,45 @@ type configureComp struct {
func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Battle)
- this.LoadConfigure(game_equipsuit, cfg.NewGameEquipSuit)
- this.LoadConfigure(game_monster, cfg.NewGameMonster)
- configure.RegisterConfigure(game_monsterformat, cfg.NewGameMonsterFormat, func() {
- this.mformatlock.Lock()
- if v, err := this.GetConfigure(game_monsterformat); err != nil {
- this.module.Errorf("err:%v", err)
- return
- } else {
- this.mformat = make(map[int32][]*cfg.GameMonsterFormatData)
- for _, v := range v.(*cfg.GameMonsterFormat).GetDataList() {
- if this.mformat[v.Id] == nil {
- this.mformat[v.Id] = make([]*cfg.GameMonsterFormatData, 5)
- }
- if v.Monster != -1 {
- this.mformat[v.Id][v.Pos-1] = v
- }
- }
- }
- this.mformatlock.Unlock()
- })
- configure.RegisterConfigure(game_skillatk, cfg.NewGameSkillAtk, func() {
- this.skillatklock.Lock()
- if v, err := this.GetConfigure(game_skillatk); err != nil {
- this.module.Errorf("err:%v", err)
- return
- } else {
- this.skillatk = make(map[int32]map[int32]*cfg.GameSkillAtkData)
- for _, v := range v.(*cfg.GameSkillAtk).GetDataList() {
- if this.skillatk[v.Id] == nil {
- this.skillatk[v.Id] = make(map[int32]*cfg.GameSkillAtkData)
- }
- this.skillatk[v.Id][v.Level] = v
- }
- }
- this.skillatklock.Unlock()
- })
- this.LoadConfigure(game_skillafteratk, cfg.NewGameSkillAfteratk)
- this.LoadConfigure(game_skillbuff, cfg.NewGameSkillBuff)
- this.LoadConfigure(game_skillpassive, cfg.NewGameSkillPassive)
+ // this.LoadConfigure(game_equipsuit, cfg.NewGameEquipSuit)
+ // this.LoadConfigure(game_monster, cfg.NewGameMonster)
+ // configure.RegisterConfigure(game_monsterformat, cfg.NewGameMonsterFormat, func() {
+ // this.mformatlock.Lock()
+ // if v, err := this.GetConfigure(game_monsterformat); err != nil {
+ // this.module.Errorf("err:%v", err)
+ // return
+ // } else {
+ // this.mformat = make(map[int32][]*cfg.GameMonsterFormatData)
+ // for _, v := range v.(*cfg.GameMonsterFormat).GetDataList() {
+ // if this.mformat[v.Id] == nil {
+ // this.mformat[v.Id] = make([]*cfg.GameMonsterFormatData, 5)
+ // }
+ // if v.Monster != -1 {
+ // this.mformat[v.Id][v.Pos-1] = v
+ // }
+ // }
+ // }
+ // this.mformatlock.Unlock()
+ // })
+ // configure.RegisterConfigure(game_skillatk, cfg.NewGameSkillAtk, func() {
+ // this.skillatklock.Lock()
+ // if v, err := this.GetConfigure(game_skillatk); err != nil {
+ // this.module.Errorf("err:%v", err)
+ // return
+ // } else {
+ // this.skillatk = make(map[int32]map[int32]*cfg.GameSkillAtkData)
+ // for _, v := range v.(*cfg.GameSkillAtk).GetDataList() {
+ // if this.skillatk[v.Id] == nil {
+ // this.skillatk[v.Id] = make(map[int32]*cfg.GameSkillAtkData)
+ // }
+ // this.skillatk[v.Id][v.Level] = v
+ // }
+ // }
+ // this.skillatklock.Unlock()
+ // })
+ // this.LoadConfigure(game_skillafteratk, cfg.NewGameSkillAfteratk)
+ // this.LoadConfigure(game_skillbuff, cfg.NewGameSkillBuff)
+ // this.LoadConfigure(game_skillpassive, cfg.NewGameSkillPassive)
return
}
diff --git a/modules/combat/api.go b/modules/combat/api.go
new file mode 100644
index 000000000..9e48723f6
--- /dev/null
+++ b/modules/combat/api.go
@@ -0,0 +1,29 @@
+package combat
+
+import (
+ "go_dreamfactory/modules"
+
+ "go_dreamfactory/lego/core"
+)
+
+/*
+装备模块 API
+*/
+type apiComp struct {
+ modules.MCompGate
+ service core.IService
+ module *Combat
+}
+
+//组件初始化接口
+func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
+ this.MCompGate.Init(service, module, comp, options)
+ this.module = module.(*Combat)
+ this.service = service
+ return
+}
+
+func (this *apiComp) Start() (err error) {
+ err = this.MCompGate.Start()
+ return
+}
diff --git a/modules/combat/api_challenge.go b/modules/combat/api_challenge.go
new file mode 100644
index 000000000..272fdaf47
--- /dev/null
+++ b/modules/combat/api_challenge.go
@@ -0,0 +1,56 @@
+package combat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+ cfg "go_dreamfactory/sys/configure/structs"
+
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) ChallengeCheck(session comm.IUserSession, req *pb.CombatChallengeReq) (code pb.ErrorCode) {
+
+ return
+}
+
+///挑战
+func (this *apiComp) Challenge(session comm.IUserSession, req *pb.CombatChallengeReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ manster *cfg.GameCombatMansterData
+ record *pb.DBBattleRecord
+ err error
+ cd pb.ErrorCode
+ )
+ defer func() {
+ if cd == pb.ErrorCode_Success {
+ session.SendMsg(string(this.module.GetType()), "challenge", &pb.CombatChallengeResp{Code: cd, Manster: req.Manster, Info: &pb.BattleInfo{
+ Id: record.Id,
+ Title: record.Title,
+ Btype: record.Btype,
+ Ptype: record.Ptype,
+ RedCompId: record.RedCompId,
+ Redflist: record.Redflist,
+ BlueCompId: record.BlueCompId,
+ Buleflist: record.Buleflist,
+ Tasks: nil,
+ }})
+ } else {
+ session.SendMsg(string(this.module.GetType()), "challenge", &pb.AcademyChallengeResp{Code: cd, Info: nil})
+ }
+ }()
+ if cd = this.ChallengeCheck(session, req); cd != pb.ErrorCode_Success {
+ return
+ }
+
+ if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil {
+ cd = pb.ErrorCode_ConfigNoFound
+ return
+ }
+ cd, record = this.module.battle.CreatePveBattle(session, &pb.BattlePVEReq{
+ Ptype: pb.PlayType_combat,
+ Format: req.Battle,
+ Mformat: manster.FormatList,
+ })
+ return
+}
diff --git a/modules/combat/api_challengereceive.go b/modules/combat/api_challengereceive.go
new file mode 100644
index 000000000..2969b19a3
--- /dev/null
+++ b/modules/combat/api_challengereceive.go
@@ -0,0 +1,59 @@
+package combat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+ cfg "go_dreamfactory/sys/configure/structs"
+
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) ChallengeReceiveCheck(session comm.IUserSession, req *pb.CombatChallengeReceiveReq) (code pb.ErrorCode) {
+
+ return
+}
+
+///奖励领取
+func (this *apiComp) ChallengeReceive(session comm.IUserSession, req *pb.CombatChallengeReceiveReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ iswin bool
+ info *pb.DBCombatUser
+ manster *cfg.GameCombatMansterData
+
+ // group []*cfg.GameTeachingData
+ err error
+ )
+ if code = this.ChallengeReceiveCheck(session, req); code != pb.ErrorCode_Success {
+ return
+ }
+ if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success {
+ return
+ }
+ if iswin {
+ if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+ if manster, err = this.module.configure.getGameCombatManster(req.Manster); err != nil {
+ code = pb.ErrorCode_ConfigNoFound
+ return
+ }
+ for _, v := range info.Passmanster {
+ if v == req.Manster {
+ code = pb.ErrorCode_ReqParameterError
+ return
+ }
+ }
+
+ info.Passmanster = append(info.Passmanster, req.Manster)
+ if err = this.module.modelCombat.updateInfo(info); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+
+ this.module.DispenseRes(session, manster.Award, true)
+ }
+ session.SendMsg(string(this.module.GetType()), "challengereceive", &pb.CombatChallengeReceiveResp{Issucc: true})
+ return
+}
diff --git a/modules/combat/api_drop.go b/modules/combat/api_drop.go
new file mode 100644
index 000000000..17fb124c6
--- /dev/null
+++ b/modules/combat/api_drop.go
@@ -0,0 +1,56 @@
+package combat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) DropCheck(session comm.IUserSession, req *pb.CombatDropReq) (code pb.ErrorCode) {
+
+ return
+}
+
+///奖励领取
+func (this *apiComp) Drop(session comm.IUserSession, req *pb.CombatDropReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ info *pb.DBCombatUser
+ atns []*pb.UserAssets
+ err error
+ )
+ if code = this.DropCheck(session, req); code != pb.ErrorCode_Success {
+ return
+ }
+
+ if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+
+ for _, v := range info.Passdrop {
+ if v == req.Drop {
+ code = pb.ErrorCode_ReqParameterError
+ return
+ }
+ }
+
+ info.Passdrop = append(info.Passmanster, req.Drop)
+ if err = this.module.modelCombat.updateInfo(info); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+ reward := this.module.configure.GetDropReward(req.Drop)
+ this.module.DispenseRes(session, reward, true)
+ atns = make([]*pb.UserAssets, len(reward))
+ for i, v := range reward {
+ atns[i] = &pb.UserAssets{
+ A: v.A,
+ T: v.T,
+ N: v.N,
+ }
+ }
+ session.SendMsg(string(this.module.GetType()), "drop", &pb.CombatDropResp{Code: code, Atns: atns})
+ return
+}
diff --git a/modules/combat/api_in.go b/modules/combat/api_in.go
new file mode 100644
index 000000000..267424ede
--- /dev/null
+++ b/modules/combat/api_in.go
@@ -0,0 +1,41 @@
+package combat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) InCheck(session comm.IUserSession, req *pb.CombatInReq) (code pb.ErrorCode) {
+
+ return
+}
+
+///获取自己的排行榜信息
+func (this *apiComp) In(session comm.IUserSession, req *pb.CombatInReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ info *pb.DBCombatUser
+ err error
+ )
+ if code = this.InCheck(session, req); code != pb.ErrorCode_Success {
+ return
+ }
+ if info, err = this.module.modelCombat.queryInfo(session.GetUserId()); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+ if info.Currlevel != 0 {
+ code = pb.ErrorCode_ReqParameterError
+ return
+ }
+ info.Currlevel = req.Id
+ if err = this.module.modelCombat.updateInfo(info); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+
+ session.SendMsg(string(this.module.GetType()), "in", &pb.CombatInReq{Id: req.Id})
+ return
+}
diff --git a/modules/combat/api_out.go b/modules/combat/api_out.go
new file mode 100644
index 000000000..3a66e1516
--- /dev/null
+++ b/modules/combat/api_out.go
@@ -0,0 +1,30 @@
+package combat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) OutCheck(session comm.IUserSession, req *pb.CombatOutReq) (code pb.ErrorCode) {
+
+ return
+}
+
+///获取自己的排行榜信息
+func (this *apiComp) Out(session comm.IUserSession, req *pb.CombatOutReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ err error
+ )
+ if code = this.OutCheck(session, req); code != pb.ErrorCode_Success {
+ return
+ }
+ if err = this.module.modelCombat.delInfo(session.GetUserId()); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+ session.SendMsg(string(this.module.GetType()), "out", &pb.CombatOutResp{Id: req.Id})
+ return
+}
diff --git a/modules/combat/configure.go b/modules/combat/configure.go
new file mode 100644
index 000000000..e33bf4870
--- /dev/null
+++ b/modules/combat/configure.go
@@ -0,0 +1,62 @@
+package combat
+
+import (
+ "fmt"
+ "go_dreamfactory/lego/core"
+ "go_dreamfactory/modules"
+ cfg "go_dreamfactory/sys/configure/structs"
+)
+
+const (
+ game_combatlevel = "game_combatlevel.json"
+ game_combatmanster = "game_combatmanster.json"
+)
+
+///背包配置管理组件
+type configureComp struct {
+ modules.MCompConfigure
+ module *Combat
+}
+
+//组件初始化接口
+func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
+ this.MCompConfigure.Init(service, module, comp, options)
+ this.module = module.(*Combat)
+ this.LoadConfigure(game_combatlevel, cfg.NewGameCombatLevel)
+ this.LoadConfigure(game_combatmanster, cfg.NewGameCombatManster)
+ return
+}
+
+//查询管卡表
+func (this *configureComp) getCombatLevel(id int32) (result *cfg.GameCombatLevelData, err error) {
+ var (
+ v interface{}
+ ok bool
+ )
+ if v, err = this.GetConfigure(game_combatlevel); err != nil {
+ this.module.Errorln(err)
+ } else {
+ if result, ok = v.(*cfg.GameCombatLevel).GetDataMap()[id]; !ok {
+ err = fmt.Errorf("on found GameMonster:%d", id)
+ this.module.Errorln(err)
+ }
+ }
+ return
+}
+
+//查询管卡表
+func (this *configureComp) getGameCombatManster(mid int32) (result *cfg.GameCombatMansterData, err error) {
+ var (
+ v interface{}
+ ok bool
+ )
+ if v, err = this.GetConfigure(game_combatmanster); err != nil {
+ this.module.Errorln(err)
+ } else {
+ if result, ok = v.(*cfg.GameCombatManster).GetDataMap()[mid]; !ok {
+ err = fmt.Errorf("on found GameMonster:%d", mid)
+ this.module.Errorln(err)
+ }
+ }
+ return
+}
diff --git a/modules/combat/modelCombat.go b/modules/combat/modelCombat.go
new file mode 100644
index 000000000..c579bedfb
--- /dev/null
+++ b/modules/combat/modelCombat.go
@@ -0,0 +1,69 @@
+package combat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/lego/core"
+ "go_dreamfactory/lego/sys/mgo"
+ "go_dreamfactory/modules"
+ "go_dreamfactory/pb"
+ "go_dreamfactory/sys/db"
+)
+
+///论坛 数据组件
+type modelCombatComp struct {
+ modules.MCompModel
+ module *Combat
+}
+
+//组件初始化接口
+func (this *modelCombatComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, opt core.IModuleOptions) (err error) {
+ this.TableName = comm.TableCombat
+ this.MCompModel.Init(service, module, comp, opt)
+ this.module = module.(*Combat)
+
+ //创建uid索引
+ // this.DB.CreateIndex(core.SqlTable(this.TableName), mongo.IndexModel{
+ // Keys: bsonx.Doc{{Key: "heroid", Value: bsonx.Int32(1)}},
+ // })
+ return
+}
+
+//查询用户装备数据
+func (this *modelCombatComp) queryInfo(uId string) (result *pb.DBCombatUser, err error) {
+ result = &pb.DBCombatUser{
+ Uid: uId,
+ Currlevel: 0,
+ Passmanster: make([]int32, 0),
+ Passdrop: make([]int32, 0),
+ }
+ if err = this.Get(uId, result, db.SetDBMgoLog(false)); err != nil && err != mgo.MongodbNil {
+ this.module.Errorln(err)
+ return
+ }
+ if err == mgo.MongodbNil {
+ err = nil
+ }
+ return
+}
+
+///保存用户竞技场信息
+func (this *modelCombatComp) updateInfo(info *pb.DBCombatUser) (err error) {
+ if err = this.Change(info.Uid, map[string]interface{}{
+ "currlevel": info.Currlevel,
+ "passmanster": info.Passmanster,
+ "passdrop": info.Passdrop,
+ }, db.SetDBMgoLog(false)); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ return
+}
+
+///保存用户竞技场信息
+func (this *modelCombatComp) delInfo(uid string) (err error) {
+ if err = this.Del(uid, db.SetDBMgoLog(false)); err != nil {
+ this.module.Errorln(err)
+ return
+ }
+ return
+}
diff --git a/modules/combat/module.go b/modules/combat/module.go
new file mode 100644
index 000000000..3a3a98ccc
--- /dev/null
+++ b/modules/combat/module.go
@@ -0,0 +1,64 @@
+package combat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/lego/base"
+ "go_dreamfactory/lego/core"
+ "go_dreamfactory/lego/sys/event"
+ "go_dreamfactory/modules"
+)
+
+/*
+模块名:关卡编辑器
+描述:新手训练营
+开发:李伟
+*/
+func NewModule() core.IModule {
+ m := new(Combat)
+ return m
+}
+
+type Combat struct {
+ modules.ModuleBase
+ service base.IRPCXService
+ battle comm.IBattle
+ api_comp *apiComp
+ configure *configureComp
+ modelCombat *modelCombatComp
+}
+
+//模块名
+func (this *Combat) GetType() core.M_Modules {
+ return comm.ModuleCombat
+}
+
+//模块初始化接口 注册用户创建角色事件
+func (this *Combat) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) {
+ err = this.ModuleBase.Init(service, module, options)
+ this.service = service.(base.IRPCXService)
+ return
+}
+
+func (this *Combat) Start() (err error) {
+ err = this.ModuleBase.Start()
+ var module core.IModule
+ if module, err = this.service.GetModule(comm.ModuleBattle); err != nil {
+ return
+ }
+ this.battle = module.(comm.IBattle)
+ event.RegisterGO(comm.EventUserOffline, this.EventUserOffline)
+ return
+}
+
+//装备组件
+func (this *Combat) OnInstallComp() {
+ this.ModuleBase.OnInstallComp()
+ this.api_comp = this.RegisterComp(new(apiComp)).(*apiComp)
+ this.modelCombat = this.RegisterComp(new(modelCombatComp)).(*modelCombatComp)
+ this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
+}
+
+//Event------------------------------------------------------------------------------------------------------------
+func (this *Combat) EventUserOffline(session comm.IUserSession) {
+ this.modelCombat.delInfo(session.GetUserId())
+}
diff --git a/modules/comp_configure.go b/modules/comp_configure.go
index e8c422640..effe983a8 100644
--- a/modules/comp_configure.go
+++ b/modules/comp_configure.go
@@ -212,8 +212,8 @@ func (this *MCompConfigure) GetMultipleDropReward(count, dropId int32, items []*
resData = append(resData, items...)
return
}
-func (this *MCompConfigure) GetDropReward(dropId int32, Items []*cfg.Gameatn) {
- Items = make([]*cfg.Gameatn, 0)
+func (this *MCompConfigure) GetDropReward(dropId int32) (result []*cfg.Gameatn) {
+ result = make([]*cfg.Gameatn, 0)
data := this.GetDropData(dropId)
szW := make([]int32, 0)
@@ -221,7 +221,7 @@ func (this *MCompConfigure) GetDropReward(dropId int32, Items []*cfg.Gameatn) {
szW = append(szW, value.P)
}
index := comm.GetRandW(szW)
- Items = append(Items, data[index].Prize...)
+ result = append(result, data[index].Prize...)
return
}
diff --git a/modules/friend/api_cross_addblack.go b/modules/friend/api_cross_addblack.go
index 527f201eb..eb7b2b4a6 100644
--- a/modules/friend/api_cross_addblack.go
+++ b/modules/friend/api_cross_addblack.go
@@ -21,12 +21,6 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
return
}
- globalCnf := this.moduleFriend.configure.GetGlobalConf()
- if globalCnf == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
-
var (
err error
self *pb.DBFriend
@@ -76,7 +70,7 @@ func (this *apiComp) Addblack(session comm.IUserSession, req *pb.FriendAddBlackR
}
// 判断是否黑名单人数已满
- if len(self.BlackIds) >= int(globalCnf.FriendBlack) {
+ if len(self.BlackIds) >= int(this.moduleFriend.globalConf.FriendBlack) {
code = pb.ErrorCode_FriendBlackMax
return
}
diff --git a/modules/friend/api_cross_apply.go b/modules/friend/api_cross_apply.go
index 9eabba4bc..540c733a3 100644
--- a/modules/friend/api_cross_apply.go
+++ b/modules/friend/api_cross_apply.go
@@ -22,12 +22,6 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
return
}
- globalCnf := this.moduleFriend.configure.GetGlobalConf()
- if globalCnf == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
-
var (
err error
self *pb.DBFriend
@@ -67,15 +61,15 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.FriendApplyReq) (c
code = pb.ErrorCode_FriendNotSelf
return
}
-
+ globalConf := this.moduleFriend.globalConf
//判断是否超过最大好友数量
- if len(self.FriendIds) >= int(globalCnf.FriendMaxnum) {
+ if len(self.FriendIds) >= int(globalConf.FriendMaxnum) {
code = pb.ErrorCode_FriendSelfMax
return
}
//判断对方是否也超过最大好友数量
- if len(target.FriendIds) >= int(globalCnf.FriendMaxnum) {
+ if len(target.FriendIds) >= int(globalConf.FriendMaxnum) {
code = pb.ErrorCode_FriendTargetMax
return
}
diff --git a/modules/friend/api_cross_getreward.go b/modules/friend/api_cross_getreward.go
index d3d97af05..28fb19eec 100644
--- a/modules/friend/api_cross_getreward.go
+++ b/modules/friend/api_cross_getreward.go
@@ -35,7 +35,7 @@ func (this *apiComp) Getreward(session comm.IUserSession, req *pb.FriendGetrewar
return
}
- code = this.moduleFriend.DispenseRes(session, this.moduleFriend.configure.GetGlobalConf().FriendPeize, true)
+ code = this.moduleFriend.DispenseRes(session, this.moduleFriend.globalConf.FriendPeize, true)
rsp := &pb.FriendGetrewardResp{Received: int32(received)}
diff --git a/modules/friend/api_cross_zan.go b/modules/friend/api_cross_zan.go
index 87dd8835f..330973c9b 100644
--- a/modules/friend/api_cross_zan.go
+++ b/modules/friend/api_cross_zan.go
@@ -27,12 +27,6 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
selfId string
)
- globalCnf := this.moduleFriend.configure.GetGlobalConf()
- if globalCnf == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
-
selfId = session.GetUserId()
// 不能给自己点赞
@@ -76,7 +70,7 @@ func (this *apiComp) Zan(session comm.IUserSession, req *pb.FriendZanReq) (code
}
// 今日送出的友情点是否达到上限
- if ue.FriendPointOD >= globalCnf.FriendMaxsendnum {
+ if ue.FriendPointOD >= this.moduleFriend.globalConf.FriendMaxsendnum {
code = pb.ErrorCode_FriendPointLimit
return
}
diff --git a/modules/friend/api_cross_zanreceive.go b/modules/friend/api_cross_zanreceive.go
index 84a216162..6ec4bd0cc 100644
--- a/modules/friend/api_cross_zanreceive.go
+++ b/modules/friend/api_cross_zanreceive.go
@@ -22,12 +22,6 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
return
}
- globalCnf := this.moduleFriend.configure.GetGlobalConf()
- if globalCnf == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
-
var (
self *pb.DBFriend
err error
@@ -68,7 +62,7 @@ func (this *apiComp) Zanreceive(session comm.IUserSession, req *pb.FriendZanrece
}
// 今日获赠的友情点是否达到上限
- if ue.FriendPointID >= int32(globalCnf.FriendMaxgetnum) {
+ if ue.FriendPointID >= int32(this.moduleFriend.globalConf.FriendMaxgetnum) {
code = pb.ErrorCode_FriendPointLimit
return
}
diff --git a/modules/friend/module.go b/modules/friend/module.go
index 0cda07e02..d888087f7 100644
--- a/modules/friend/module.go
+++ b/modules/friend/module.go
@@ -1,3 +1,6 @@
+// package
+// 好友
+// 赵长远
package friend
import (
@@ -13,6 +16,8 @@ import (
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/log"
+ cfg "go_dreamfactory/sys/configure/structs"
+
"github.com/spf13/cast"
)
@@ -29,6 +34,7 @@ type Friend struct {
modelFriend *ModelFriend
configure *modules.MCompConfigure
service base.IRPCXService
+ globalConf *cfg.GameGlobalData
}
func (this *Friend) GetType() core.M_Modules {
@@ -50,6 +56,10 @@ func (this *Friend) OnInstallComp() {
func (this *Friend) Start() (err error) {
err = this.ModuleBase.Start()
this.service.RegisterFunctionName(string(comm.Rpc_ModuleFriendUseAssitHero), this.RpcUseAssisHero)
+ this.globalConf = this.configure.GetGlobalConf()
+ if this.globalConf == nil {
+ err = errors.New("global config not found")
+ }
return
}
diff --git a/modules/gm/api_cmd.go b/modules/gm/api_cmd.go
index 2c351ca53..8ab578dcf 100644
--- a/modules/gm/api_cmd.go
+++ b/modules/gm/api_cmd.go
@@ -10,14 +10,16 @@ import (
/* GM 在控制台输入的字符串类型
//bingo:item,10001,1
//bingo:attr,gold,1000000
+//bingo:equi,xxx,1 // xxx 装备id
2、修改主线关卡进度:bingo:mapid,102(102代表关卡位置)
3、修改心魔塔进度:bingo:pataid,10(10代表层数)
-4、修改玩家经验值:bingo:exp,1000(1000代表新增的经验值 //
+4、修改玩家经验值:bingo:attr,exp,1000(1000代表新增的经验值 //
5、跳过随机任务 bingo:rtask,1,1001
6、bingo:Iamyoudad
+7、bingo:vip,yueka_1,1 // 月卡类型
*/
//参数校验
func (this *apiComp) CmdCheck(session comm.IUserSession, req *pb.GMCmdReq) (code pb.ErrorCode) {
diff --git a/modules/hunting/api_challengeover.go b/modules/hunting/api_challengeover.go
index 5d41770f7..7b6528ef5 100644
--- a/modules/hunting/api_challengeover.go
+++ b/modules/hunting/api_challengeover.go
@@ -90,7 +90,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.HuntingCha
mapData["challengeCount"] = hunting.ChallengeCount
code = this.module.ModifyHuntingData(session.GetUserId(), mapData)
// 发放通关随机奖励
- this.module.configure.GetDropReward(cfg.Drop, reward) // 获取掉落奖励
+ reward = this.module.configure.GetDropReward(cfg.Drop) // 获取掉落奖励
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
return
}
diff --git a/modules/linestory/module.go b/modules/linestory/module.go
index bf29363ea..b9aa51b17 100644
--- a/modules/linestory/module.go
+++ b/modules/linestory/module.go
@@ -1,3 +1,6 @@
+// package
+// 支线任务
+// 赵长远
package linestory
import (
diff --git a/modules/pagoda/api_activate.go b/modules/pagoda/api_activate.go
index 1bc60ea76..aada19c85 100644
--- a/modules/pagoda/api_activate.go
+++ b/modules/pagoda/api_activate.go
@@ -4,6 +4,7 @@ import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/sys/db"
+ "time"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/bson/primitive"
@@ -38,6 +39,13 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.PagodaActivateR
server := &pb.DBServerData{}
rst.Decode(server)
season.Type = server.SeasonType
+
+ dbModel := db.NewDBModel(comm.TableSeasonRecord, time.Hour, conn)
+ if err = dbModel.Add(session.GetUserId(), season); err != nil {
+ this.module.Errorf("err:%v", err)
+ return
+ }
+
}
this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), season)
}
diff --git a/modules/pagoda/api_ranklist.go b/modules/pagoda/api_ranklist.go
index 4832ce907..fece0562e 100644
--- a/modules/pagoda/api_ranklist.go
+++ b/modules/pagoda/api_ranklist.go
@@ -35,9 +35,9 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListR
pipe *pipe.RedisPipe = conn.Redis.RedisPipe(context.TODO())
)
if req.FloorId == 0 {
- rd = pipe.ZRange("pagodaSeasonRank", 0, 50)
+ rd = pipe.ZRange("pagodaSeasonRank", 0, comm.MaxRankList)
} else {
- rd = pipe.ZRange("pagodaList"+strconv.Itoa(int(req.FloorId)), 0, 50)
+ rd = pipe.ZRange("pagodaList"+strconv.Itoa(int(req.FloorId)), 0, comm.MaxRankList)
}
if _, err = pipe.Exec(); err != nil {
diff --git a/modules/pagoda/model_rank.go b/modules/pagoda/model_rank.go
index b91d952a3..1d8e167a4 100644
--- a/modules/pagoda/model_rank.go
+++ b/modules/pagoda/model_rank.go
@@ -2,10 +2,9 @@ package pagoda
import (
"context"
- "fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
- "go_dreamfactory/lego/sys/log"
+ "strconv"
//"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/lego/sys/redis/pipe"
@@ -13,13 +12,8 @@ import (
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
"go_dreamfactory/sys/db"
- "sort"
"github.com/go-redis/redis/v8"
-
- "go.mongodb.org/mongo-driver/bson"
- "go.mongodb.org/mongo-driver/bson/primitive"
- "go.mongodb.org/mongo-driver/mongo/options"
)
var floorRankKey = "pagoda:floor"
@@ -36,31 +30,6 @@ func (this *ModelRank) Init(service core.IService, module core.IModule, comp cor
return
}
-func (this *ModelRank) AddRank(uId string, data *pb.DBPagodaRecord) (err error) {
- if err = this.Add(uId, data); err != nil {
- //this.Errorf("err:%v", err)
- return
- }
- return nil
-}
-
-//获取用户通过扩展表
-// func (this *ModelRank) GetUserRandData(uid string) (result *pb.DBPagodaRecord, err error) {
-// result = &pb.DBPagodaRecord{}
-// if err = this.Get(uid, result); err != nil && redis.RedisNil != err {
-// return
-// }
-// err = nil
-// return result, err
-// }
-
-func (this *ModelRank) ChangeUserRank(uid string, value map[string]interface{}) (err error) {
- if len(value) == 0 {
- return nil
- }
- return this.Change(uid, value)
-}
-
func (this *ModelRank) GetRankData() (data []*pb.DBPagodaRecord, err error) {
data = make([]*pb.DBPagodaRecord, 0)
if conn, err := db.Cross(); err == nil {
@@ -79,131 +48,6 @@ func (this *ModelRank) getPagodaRankList(uid string) []*pb.DBPagodaRecord {
return pagodaRank
}
-// 插入新的排行数据
-func (this *ModelRank) addPagodaRankList(session comm.IUserSession, data *pb.DBPagoda, Leadpos int32, line []*pb.LineUp, costTime int32) {
- uid := session.GetUserId()
- var (
- dbModel *db.DBModel
- err error
- )
- userinfo := this.modulePagoda.ModuleUser.GetUser(session.GetUserId())
- new := &pb.DBPagodaRecord{
- Id: primitive.NewObjectID().Hex(),
- Uid: session.GetUserId(),
- PagodaId: data.PagodaId,
- Type: data.Type,
- Nickname: userinfo.Name,
- Icon: "", // 暂时没有数据
- Lv: userinfo.Lv,
- Leadpos: Leadpos,
- Line: line,
- CostTime: costTime,
- }
- if this.modulePagoda.IsCross() {
- if dbModel, err = this.modulePagoda.GetDBNoduleByUid(uid, this.TableName, this.Expired); err != nil {
- this.modulePagoda.Errorln(err)
-
- } else {
- if err = dbModel.AddList(session.GetUserId(), new.Id, new); err != nil {
- this.modulePagoda.Errorf("err:%v", err)
- }
- }
- } else {
- if err := this.AddList(session.GetUserId(), new.Id, new); err != nil {
- this.modulePagoda.Errorf("err:%v", err)
- }
- }
-
- // 查询本层是否上榜
- rankData, ilen, err1 := this.GetFloorLastRankData(data.PagodaId, dbModel)
- if err1 != nil {
- if rankData.CostTime < costTime || ilen < comm.MaxRankNum {
- this.ChangeFloorRankList(session, data.PagodaId, new, dbModel)
- }
- }
- return
-}
-
-// 读取某一层排行数据
-func (this *ModelRank) GetFloorRankList(floor int32) (result []*pb.DBPagodaRecord, err error) {
- key := fmt.Sprintf("%s-%d-rank", floorRankKey, floor)
- temp := make([]*pb.DBPagodaRecord, 0)
- if err = this.Redis.LRange(key, 0, -1, &temp); err != nil {
- this.modulePagoda.Errorf("err:%v", err)
- return
- }
-
- result = make([]*pb.DBPagodaRecord, len(temp))
- for n, v := range temp {
- result[n] = v
- //n++
- }
- return
-}
-
-// 获取排行榜最后一个元素
-func (this *ModelRank) GetFloorLastRankData(floor int32, dbModel *db.DBModel) (curData *pb.DBPagodaRecord, len int, err error) {
- key := fmt.Sprintf("%s-%d-rank", floorRankKey, floor)
- len, err = dbModel.Redis.Llen(key)
- curData = &pb.DBPagodaRecord{}
- if dbModel.Redis.Lindex(key, -1, curData); err != nil {
- this.modulePagoda.Errorf("err:%v", err)
- return
- }
- if curData == nil {
- data := make([]interface{}, 0) // options.Find().SetLimit(comm.MaxRankList)
- if _data, err := dbModel.DB.Find(comm.TableSeasonRecord, bson.M{"pagodaId": floor}, options.Find().SetSort(bson.M{"pagodaId": -1}).SetLimit(comm.MaxRankList)); err == nil {
- for _data.Next(context.TODO()) {
- temp := &pb.DBPagodaRecord{}
- if err = _data.Decode(temp); err == nil {
- data = append(data, temp)
- curData = temp
- }
- }
- }
- err := dbModel.Redis.RPush(key, data...)
- if err == nil {
- this.modulePagoda.Errorf("rpush failed :%v", err)
- }
- }
- return
-}
-
-// 修改某一层排行数据
-func (this *ModelRank) ChangeFloorRankList(session comm.IUserSession, floor int32, curData *pb.DBPagodaRecord, dbModel *db.DBModel) (err error) {
- key := fmt.Sprintf("%s-%d-rank", floorRankKey, floor)
- lockkey := fmt.Sprintf("%s-%d-lock", floorRankKey, floor)
-
- dbModel.Redis.Lock(lockkey, configure.Now().Second()*5)
- defer dbModel.Redis.UnLock(lockkey)
- if dbModel.Redis.RPush(key, curData); err != nil {
- this.modulePagoda.Errorf("err:%v", err)
- return
- }
- temp := make([]*pb.DBPagodaRecord, 0)
- if err = dbModel.Redis.LRange(key, 0, -1, &temp); err != nil {
- this.modulePagoda.Errorf("err:%v", err)
- return
- }
- // 排序
- sort.SliceStable(temp, func(i, j int) bool {
- return temp[i].CostTime < temp[j].CostTime
- })
- iLne := len(temp)
- if dbModel.Redis.RPush(key, temp); err != nil {
- this.modulePagoda.Errorf("err:%v", err)
- return
- }
- if iLne > comm.MaxRankNum {
- iLne = comm.MaxRankNum
- }
- err = dbModel.Redis.Ltrim(key, -1*iLne, -1) //对一个列表进行修剪
- if err != nil {
- log.Errorf("delete failed")
- }
- return
-}
-
func (this *ModelRank) getPagodaRankListByFloorid(uid string, floorid int32) *pb.DBPagodaRecord {
pagodaRank := make([]*pb.DBPagodaRecord, 0)
err := this.GetList(uid, &pagodaRank)
@@ -243,12 +87,6 @@ func (this *ModelRank) SetNormalPagodaRankList(tableName string, score int32, ui
}
func (this *ModelRank) seasonSettlement() {
-
- list := this.modulePagoda.configure.GetPagodaSeasonReward()
- if list == nil {
- return
- }
-
rankReward := this.modulePagoda.configure.GetPagodaSeasonReward()
if rankReward == nil {
return
@@ -260,7 +98,7 @@ func (this *ModelRank) seasonSettlement() {
Items []*pb.UserAssets
)
- rd := pipe.ZRange("pagodaSeasonRank", 0, 50)
+ rd := pipe.ZRange("pagodaSeasonRank", 0, comm.MaxRankList)
if _, err = pipe.Exec(); err != nil {
this.modulePagoda.Errorln(err)
@@ -285,6 +123,8 @@ func (this *ModelRank) seasonSettlement() {
this.modulePagoda.mail.SendNewMail(&pb.DBMailData{
CreateTime: uint64(configure.Now().Unix()),
Items: Items,
+ Cid: "SeasonPagodaReward",
+ Param: []string{strconv.Itoa(index)}, // 名次
}, uid)
break
}
diff --git a/modules/rtask/module.go b/modules/rtask/module.go
index bc2285442..9b0af7340 100644
--- a/modules/rtask/module.go
+++ b/modules/rtask/module.go
@@ -1,4 +1,6 @@
// package 随机任务
+// 随机任务
+// 赵长远
package rtask
import (
diff --git a/modules/sociaty/api_cross_apply.go b/modules/sociaty/api_cross_apply.go
index b71e16ab6..681b7eadb 100644
--- a/modules/sociaty/api_cross_apply.go
+++ b/modules/sociaty/api_cross_apply.go
@@ -20,12 +20,6 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
if code = this.ApplyCheck(session, req); code != pb.ErrorCode_Success {
return
}
- // 全局配置
- ggd := this.module.configure.GetGlobalConf()
- if ggd == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
uid := session.GetUserId()
@@ -78,7 +72,7 @@ func (this *apiComp) Apply(session comm.IUserSession, req *pb.SociatyApplyReq) (
}
//判断申请人数是否超出最大允许申请数
- if len(sociaty.ApplyRecord) >= int(ggd.GuildAcceptApplyMax) {
+ if len(sociaty.ApplyRecord) >= int(this.module.globalConf.GuildAcceptApplyMax) {
code = pb.ErrorCode_SociatyApplyMax
return
}
diff --git a/modules/sociaty/api_cross_create.go b/modules/sociaty/api_cross_create.go
index 1c674016a..f62545548 100644
--- a/modules/sociaty/api_cross_create.go
+++ b/modules/sociaty/api_cross_create.go
@@ -1,6 +1,7 @@
package sociaty
import (
+ "errors"
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"go_dreamfactory/utils"
@@ -60,23 +61,21 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.SociatyCreateReq)
}
// 验证公会名是否重复
- if ok, err := this.module.modelSociaty.isNameExist(req.Name); ok {
- if err != nil {
- code = pb.ErrorCode_DBError
- } else {
- code = pb.ErrorCode_SociatyNameExist
+ if err := this.module.modelSociaty.isNameExist(req.Name); err != nil {
+ var customErr = new(comm.CustomError)
+ if errors.As(err, &customErr) {
+ if customErr.Code == pb.ErrorCode_SociatyNameExist {
+ code = pb.ErrorCode_SociatyNameExist
+ return
+ }
}
+ code = pb.ErrorCode_DBError
return
}
//检查钻石
- ggd := this.module.modelSociaty.moduleSociaty.configure.GetGlobalConf()
- if ggd == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
-
- if code = this.module.ConsumeRes(session, []*cfg.Gameatn{ggd.GuildBuildCos}, true); code != pb.ErrorCode_Success {
+ if code = this.module.ConsumeRes(session, []*cfg.Gameatn{
+ this.module.globalConf.GuildBuildCos}, true); code != pb.ErrorCode_Success {
return
}
diff --git a/modules/sociaty/api_cross_dismiss.go b/modules/sociaty/api_cross_dismiss.go
index 4dd9ead8a..0048a6f5a 100644
--- a/modules/sociaty/api_cross_dismiss.go
+++ b/modules/sociaty/api_cross_dismiss.go
@@ -15,12 +15,6 @@ func (this *apiComp) DismissCheck(session comm.IUserSession, req *pb.SociatyDism
}
func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissReq) (code pb.ErrorCode, data proto.Message) {
- // 全局配置
- ggd := this.module.configure.GetGlobalConf()
- if ggd == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
@@ -40,10 +34,10 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
return
}
update := map[string]interface{}{}
-
+ globalCnf := this.module.globalConf
if sociaty.DismissTime == 0 {
//更新解散倒计时
- update["dismissTime"] = utils.AddHour(int(ggd.GuildDissolutionCountDownCd)).Unix()
+ update["dismissTime"] = utils.AddHour(int(globalCnf.GuildDissolutionCountDownCd)).Unix()
} else {
if req.Dismiss == 1 { //取消解散
if utils.IsInCDHour(int64(sociaty.DismissCD)) {
@@ -51,7 +45,7 @@ func (this *apiComp) Dismiss(session comm.IUserSession, req *pb.SociatyDismissRe
return
} else {
// 设置冷区时间
- update["dismissCD"] = utils.AddHour(int(ggd.GuildDissolutionCd)).Unix()
+ update["dismissCD"] = utils.AddHour(int(globalCnf.GuildDissolutionCd)).Unix()
}
//取消倒计时
update["dismissTime"] = 0
diff --git a/modules/sociaty/api_cross_quit.go b/modules/sociaty/api_cross_quit.go
index dd9e70163..d5e1e105c 100644
--- a/modules/sociaty/api_cross_quit.go
+++ b/modules/sociaty/api_cross_quit.go
@@ -16,13 +16,6 @@ func (this *apiComp) QuitCheck(session comm.IUserSession, req *pb.SociatyQuitReq
func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (code pb.ErrorCode, data proto.Message) {
uid := session.GetUserId()
- // 全局配置
- ggd := this.module.configure.GetGlobalConf()
- if ggd == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
-
sociaty := this.module.modelSociaty.getUserSociaty(uid)
if sociaty.Id == "" {
code = pb.ErrorCode_SociatyNoFound
@@ -46,7 +39,7 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (co
//更新玩家sociatyId
update := map[string]interface{}{
"sociatyId": "", //玩家公会ID置空
- "sociatyCd": utils.AddHour(int(ggd.GuildRejoinCd)).Unix(),
+ "sociatyCd": utils.AddHour(int(this.module.globalConf.GuildRejoinCd)).Unix(),
}
if err := this.module.ModuleUser.ChangeRemoteUserExpand(uid, update); err != nil {
diff --git a/modules/sociaty/api_cross_settingjob.go b/modules/sociaty/api_cross_settingjob.go
index 21e126eb4..528f98e88 100644
--- a/modules/sociaty/api_cross_settingjob.go
+++ b/modules/sociaty/api_cross_settingjob.go
@@ -19,12 +19,6 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin
if code = this.SettingJobCheck(session, req); code != pb.ErrorCode_Success {
return
}
- // 全局配置
- ggd := this.module.configure.GetGlobalConf()
- if ggd == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
uid := session.GetUserId()
sociaty := this.module.modelSociaty.getUserSociaty(uid)
@@ -42,9 +36,10 @@ func (this *apiComp) SettingJob(session comm.IUserSession, req *pb.SociatySettin
}
// 判断职位人数
+ globalConf := this.module.globalConf
jobCount := this.module.modelSociaty.getJobCount(req.Job, sociaty)
- if req.Job == pb.SociatyJob_VICEPRESIDENT && jobCount >= int(ggd.GuildViceAllianceLeaderMaxNum) ||
- req.Job == pb.SociatyJob_ADMIN && jobCount >= int(ggd.GuildAdministratorsMaxNum) {
+ if req.Job == pb.SociatyJob_VICEPRESIDENT && jobCount >= int(globalConf.GuildViceAllianceLeaderMaxNum) ||
+ req.Job == pb.SociatyJob_ADMIN && jobCount >= int(globalConf.GuildAdministratorsMaxNum) {
code = pb.ErrorCode_SociatyMemberCountLimit
return
}
diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go
index d5e472734..b36afdc68 100644
--- a/modules/sociaty/model_sociaty.go
+++ b/modules/sociaty/model_sociaty.go
@@ -72,21 +72,21 @@ func (this *ModelSociaty) create(sociaty *pb.DBSociaty) error {
if sociaty.ApplyLv == 0 {
sociaty.ApplyLv = 1 //默认玩家入会等级
}
- return this.AddList("", sociaty.Id, sociaty)
+ return this.AddList(comm.RDS_EMPTY, sociaty.Id, sociaty)
}
// 公会名是否存在
-func (this *ModelSociaty) isNameExist(name string) (bool, error) {
+func (this *ModelSociaty) isNameExist(name string) error {
var sociaties []*pb.DBSociaty
- if err := this.GetList("", &sociaties); err != nil {
- return false, err
+ if err := this.GetList(comm.RDS_EMPTY, &sociaties); err != nil {
+ return err
}
for _, s := range sociaties {
if s.Name == name {
- return true, nil
+ return comm.NewCustomError(pb.ErrorCode_SociatyNameExist)
}
}
- return false, nil
+ return nil
}
// 公会列表
@@ -179,7 +179,7 @@ func (this *ModelSociaty) isDismiss(sociaty *pb.DBSociaty) bool {
if sociaty.DismissTime == 0 {
return false
}
- if utils.IsInCDHour(sociaty.DismissTime) { //
+ if utils.IsInCDHour(sociaty.DismissTime) {
return false
} else {
if err := this.dismiss(sociaty); err != nil {
@@ -576,20 +576,18 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error {
if err != nil {
return err
}
- ggd := this.moduleSociaty.configure.GetGlobalConf()
- if ggd == nil {
- return errors.New("config not found")
- }
+
+ globalCnf := this.moduleSociaty.globalConf
//会长离线时间
now := configure.Now().Unix()
left := now - user.Offlinetime
- if left < int64(ggd.GuildInitiateImpeachmentTime*3600) || user.Offlinetime == 0 {
+ if left < int64(globalCnf.GuildInitiateImpeachmentTime*3600) || user.Offlinetime == 0 {
return errors.New("会长很称职,无需弹劾")
} else {
//更新会长的弹劾倒计时时间
update := map[string]interface{}{
- "accuseTime": utils.AddHour(int(ggd.GuildImpeachmentCountDown)).Unix(),
+ "accuseTime": utils.AddHour(int(globalCnf.GuildImpeachmentCountDown)).Unix(),
}
return this.updateSociaty(sociaty.Id, update)
}
@@ -599,10 +597,6 @@ func (this *ModelSociaty) accuse(sociaty *pb.DBSociaty) error {
// srcMasterId 原会长ID
func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) error {
if sociaty.AccuseTime != 0 {
- ggd := this.moduleSociaty.configure.GetGlobalConf()
- if ggd == nil {
- return errors.New("config not found")
- }
//终止弹劾
now := configure.Now().Unix()
if now < sociaty.AccuseTime {
diff --git a/modules/sociaty/model_sociatytask.go b/modules/sociaty/model_sociatytask.go
index 7c2d9d5f8..b9aebdaf2 100644
--- a/modules/sociaty/model_sociatytask.go
+++ b/modules/sociaty/model_sociatytask.go
@@ -37,15 +37,11 @@ func (this *ModelSociatyTask) initSociatyTask(uid, sociatyId string) error {
var taskList []*pb.SociatyTask
list := ggt.GetDataList()
- ggd := this.moduleSociaty.configure.GetGlobalConf()
- if ggd == nil {
- return errors.New("config not found")
- }
-
+ globalConf := this.moduleSociaty.globalConf
// 大于4条配置
- if len(list) > int(ggd.GuildTaskNum) {
+ if len(list) > int(globalConf.GuildTaskNum) {
//随机4条任务
- randInts := utils.RandomNumbers(0, len(list)-1, int(ggd.GuildTaskNum))
+ randInts := utils.RandomNumbers(0, len(list)-1, int(globalConf.GuildTaskNum))
for _, v := range randInts {
taskList = append(taskList, &pb.SociatyTask{
TaskId: list[v].TypeId,
diff --git a/modules/sociaty/module.go b/modules/sociaty/module.go
index a7712a9fe..81efddd2c 100644
--- a/modules/sociaty/module.go
+++ b/modules/sociaty/module.go
@@ -1,7 +1,11 @@
+// package
+// 公会
+// 赵长远
package sociaty
import (
"context"
+ "errors"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
@@ -9,6 +13,7 @@ import (
"go_dreamfactory/modules"
"go_dreamfactory/pb"
"go_dreamfactory/sys/configure"
+ cfg "go_dreamfactory/sys/configure/structs"
)
var _ comm.ISociaty = (*Sociaty)(nil)
@@ -21,6 +26,7 @@ type Sociaty struct {
modelSociatyTask *ModelSociatyTask
modelSociatyLog *ModelSociatyLog
configure *configureComp
+ globalConf *cfg.GameGlobalData
}
func NewModule() core.IModule {
@@ -49,14 +55,17 @@ func (this *Sociaty) OnInstallComp() {
func (this *Sociaty) Start() (err error) {
err = this.ModuleBase.Start()
this.service.RegisterFunctionName(string(comm.Rpc_ModuleSociaty), this.RpcGetSociaty)
+ this.globalConf = this.configure.GetGlobalConf()
+ if this.globalConf == nil {
+ err = errors.New("global config not found")
+ }
return
}
// 会长弹劾处理
// Deprecated
func (this *Sociaty) ProcessAccuse(uid, sociatyId string) {
- ggd := this.configure.GetGlobalConf()
- t := ggd.GuildImpeachmentCountDown
+ t := this.globalConf.GuildImpeachmentCountDown
if t == 0 {
return
}
diff --git a/modules/task/module.go b/modules/task/module.go
index ead189415..43360c195 100644
--- a/modules/task/module.go
+++ b/modules/task/module.go
@@ -1,3 +1,6 @@
+// package
+// 日/周常成就任务
+// 赵长远
package task
import (
diff --git a/modules/timer/season.go b/modules/timer/season.go
index 21613d2a3..6c7388233 100644
--- a/modules/timer/season.go
+++ b/modules/timer/season.go
@@ -59,7 +59,9 @@ func (this *SeasonPagoda) Start() (err error) {
configure.RegisterConfigure(game_seasonreward, cfg.NewGamePagodaSeasonReward, nil)
cron.AddFunc("0 0 23 L * ?", this.TimerSeasonOver) //每月最后一天23点执行一次
cron.AddFunc("0 0 5 /* * ?", this.TimerSeasonStar) //每月第一天5点执行一次
-
+ if db.IsCross() {
+ return
+ }
conn, err := db.Cross()
if err == nil {
model := db.NewDBModel(comm.TableServerData, 0, conn)
@@ -86,18 +88,7 @@ func (this *SeasonPagoda) Start() (err error) {
return
}
-func (this *SeasonPagoda) CreatTestData(index int) {
- seasonPagoda := &pb.DBPagoda{}
- seasonPagoda.Id = primitive.NewObjectID().Hex()
- seasonPagoda.Uid = "dfmxf_634f8f28609d489230fb40fa"
- seasonPagoda.PagodaId = int32(index) // 初始数据0层
- seasonPagoda.Type = 201 // TODO 新的塔数据根据配置文件获取
- if err := this.Add(seasonPagoda.Uid, seasonPagoda); err != nil {
- this.module.Errorf("err:%v", err)
- return
- }
-}
func (this *SeasonPagoda) GetSeasonReward() []int32 {
sz := make([]int32, 0)
if v, err := this.GetConfigure(game_seasonreward); err != nil {
@@ -173,9 +164,28 @@ func (this *SeasonPagoda) TimerSeasonOver() {
// 赛季塔开始
func (this *SeasonPagoda) TimerSeasonStar() {
this.module.Debugf("TimerSeasonStar:%d", configure.Now().Unix())
-
- // 打印耗时
//star := configure.Now()
- this.DB.DeleteMany(comm.TableSeasonPagoda, bson.M{}, options.Delete())
+
+ if !db.IsCross() { // 删除本服的赛季塔数据
+ conn, err := db.Cross() // 获取跨服的链接对象
+ if err == nil {
+ model := db.NewDBModel(comm.TableServerData, 0, conn)
+ model.DB.DeleteMany(comm.TableSeasonPagoda, bson.M{}, options.Delete())
+ model.DB.DeleteMany(comm.TableSeasonRecord, bson.M{}, options.Delete())
+ for pos := 0; pos < comm.MaxRankNum; pos++ {
+ key1 := fmt.Sprintf("pagodaList%d", pos)
+ if err := model.Redis.Delete(key1); err != nil {
+ log.Errorf("delete failed")
+ }
+ }
+
+ if err := model.Redis.Delete("pagodaSeasonRank"); err != nil {
+ log.Errorf("delete failed")
+ }
+ }
+
+ this.DB.DeleteMany(comm.TableSeasonRecord, bson.M{}, options.Delete())
+
+ }
//this.module.Debugf("=====%d,", time.Since(star).Milliseconds())
}
diff --git a/modules/user/api_create.go b/modules/user/api_create.go
index 654624865..2b0c879af 100644
--- a/modules/user/api_create.go
+++ b/modules/user/api_create.go
@@ -43,12 +43,6 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
return
}
- gConf := this.module.configure.GetGlobalConf()
- if gConf == nil {
- code = pb.ErrorCode_ConfigNoFound
- return
- }
-
update := map[string]interface{}{
"name": req.NickName, //设置昵称
"created": true, //创角标识
@@ -56,12 +50,13 @@ func (this *apiComp) Create(session comm.IUserSession, req *pb.UserCreateReq) (c
"gender": req.Gender, //设置性别
}
+ globalConf := this.module.globalConf
if req.Gender == 0 {
- update["avatar"] = gConf.BoyHeadPortrait
+ update["avatar"] = globalConf.BoyHeadPortrait
} else if req.Gender == 1 {
- update["avatar"] = gConf.GirlHeadPortrait
+ update["avatar"] = globalConf.GirlHeadPortrait
}
-
+
if err := this.module.modelUser.Change(session.GetUserId(), update); err != nil {
code = pb.ErrorCode_DBError
this.module.Errorf("创角失败 uid:%v name:%v err:%v", session.GetUserId(), req.NickName, err)
diff --git a/modules/user/api_modifyname.go b/modules/user/api_modifyname.go
index f02603578..3ccf9143c 100644
--- a/modules/user/api_modifyname.go
+++ b/modules/user/api_modifyname.go
@@ -35,11 +35,11 @@ func (this *apiComp) Modifyname(session comm.IUserSession, req *pb.UserModifynam
//校验名称修改次数
if expand.ModifynameCount <= 0 {
- code = this.module.ConsumeRes(session, this.module.configure.GetGlobalConf().HeroName, true)
+ code = this.module.ConsumeRes(session, this.module.globalConf.HeroName, true)
if code != pb.ErrorCode_Success {
return
}
- this.module.Infof("修改昵称 uid:%v 消耗:%v code:%v", session.GetUserId(), this.module.configure.GetGlobalConf().HeroName, code)
+ this.module.Infof("修改昵称 uid:%v 消耗:%v code:%v", session.GetUserId(), this.module.globalConf.HeroName, code)
}
//修改名称次数
diff --git a/modules/user/api_sign.go b/modules/user/api_sign.go
index 6af680f86..dd8e0d941 100644
--- a/modules/user/api_sign.go
+++ b/modules/user/api_sign.go
@@ -61,7 +61,7 @@ func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code
}
} else {
if bReward {
- this.module.DispenseRes(session, this.module.configure.GetGlobalConf().UnifiedReward, true) // 发放通用奖励
+ this.module.DispenseRes(session, this.module.globalConf.UnifiedReward, true) // 发放通用奖励
}
}
session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{
diff --git a/modules/user/model_session.go b/modules/user/model_session.go
index cf66f02e6..aba4bbab4 100644
--- a/modules/user/model_session.go
+++ b/modules/user/model_session.go
@@ -34,7 +34,7 @@ func (this *ModelSession) Start() (err error) {
//获取用户
func (this *ModelSession) getUserSession(uid string) (user *pb.CacheUser) {
user = &pb.CacheUser{}
- if err := this.GetListObj(comm.RDS_SESSION, uid, user); err != nil {
+ if err := this.GetListObj(comm.RDS_EMPTY, uid, user); err != nil {
if err != mongo.ErrNoDocuments {
this.module.Errorln(err)
}
@@ -45,7 +45,7 @@ func (this *ModelSession) getUserSession(uid string) (user *pb.CacheUser) {
//设置用户session
func (this *ModelSession) addUserSession(uid string, session comm.IUserSession) (err error) {
- if err = this.AddList(comm.RDS_SESSION, uid, map[string]interface{}{
+ if err = this.AddList(comm.RDS_EMPTY, uid, map[string]interface{}{
"uid": uid,
"sessionId": session.GetSessionId(),
"serviceTag": session.GetServiecTag(),
@@ -60,7 +60,7 @@ func (this *ModelSession) addUserSession(uid string, session comm.IUserSession)
// 启动时清理session
func (this *ModelSession) clean(key string) {
- keys, err := this.Redis.Keys(fmt.Sprintf("session:%s-%s_*", comm.RDS_SESSION, key))
+ keys, err := this.Redis.Keys(fmt.Sprintf("session:%s-%s_*", comm.RDS_EMPTY, key))
if err != nil {
log.Errorf("redis keys err:%v", err)
return
diff --git a/modules/user/model_sign.go b/modules/user/model_sign.go
index afcd632f9..80c3a7ff9 100644
--- a/modules/user/model_sign.go
+++ b/modules/user/model_sign.go
@@ -114,7 +114,7 @@ func (this *ModelSign) checkResetSignData(session comm.IUserSession) (code pb.Er
}
} else {
if bReward {
- this.module.DispenseRes(session, this.module.configure.GetGlobalConf().UnifiedReward, true) // 发放通用奖励
+ this.module.DispenseRes(session, this.module.globalConf.UnifiedReward, true) // 发放通用奖励
}
}
session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{
diff --git a/modules/user/module.go b/modules/user/module.go
index e5ae4e739..5de6bf409 100644
--- a/modules/user/module.go
+++ b/modules/user/module.go
@@ -1,3 +1,6 @@
+// package
+// 用户
+// 赵长远
package user
import (
@@ -15,6 +18,8 @@ import (
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/lego/sys/log"
+ cfg "go_dreamfactory/sys/configure/structs"
+
"github.com/pkg/errors"
"go.mongodb.org/mongo-driver/bson"
"go.mongodb.org/mongo-driver/mongo"
@@ -47,6 +52,7 @@ type User struct {
modelExpand *ModelExpand
service base.IRPCXService
configure *configureComp
+ globalConf *cfg.GameGlobalData
modelSign *ModelSign // 签到
}
@@ -67,6 +73,10 @@ func (this *User) Start() (err error) {
this.service.RegisterFunctionName(Rpc_GetCrossUser, this.RpcGetCrossUser)
this.service.RegisterFunctionName(Rpc_GetCrossUserSession, this.RpcGetCrossUserSession)
this.service.RegisterFunctionName(Rpc_QueryUser, this.RpcQueryUser)
+ this.globalConf = this.configure.GetGlobalConf()
+ if this.globalConf == nil {
+ err = errors.New("global config not found")
+ }
return
}
@@ -131,9 +141,9 @@ func (this *User) CleanSession(session comm.IUserSession) {
if !this.IsCross() {
this.modelUser.updateOfflineTime(session.GetUserId())
}
- sId := fmt.Sprintf("%s-%s", comm.RDS_SESSION, session.GetUserId())
+ sId := fmt.Sprintf("%s-%s", comm.RDS_EMPTY, session.GetUserId())
this.modelSession.Del(sId, db.SetDBMgoLog(false))
- this.modelSession.DelListlds(comm.RDS_SESSION, session.GetUserId())
+ this.modelSession.DelListlds(comm.RDS_EMPTY, session.GetUserId())
this.modelUser.DelByUId(session.GetUserId(), db.SetDBMgoLog(false))
this.modelExpand.DelByUId(session.GetUserId(), db.SetDBMgoLog(false))
this.modelSetting.DelByUId(session.GetUserId(), db.SetDBMgoLog(false))
@@ -142,7 +152,7 @@ func (this *User) CleanSession(session comm.IUserSession) {
// 在线玩家列表
func (this *User) UserOnlineList() ([]*pb.CacheUser, error) {
var cache []*pb.CacheUser
- if err := this.modelSession.GetList(comm.RDS_SESSION, &cache); err != nil {
+ if err := this.modelSession.GetList(comm.RDS_EMPTY, &cache); err != nil {
return nil, err
}
return cache, nil
@@ -518,7 +528,7 @@ func (this *User) RpcGetAllOnlineUser(ctx context.Context, args *pb.EmptyReq, re
}
model := db.NewDBModel(comm.TableSession, 0, conn)
var cache []*pb.CacheUser
- if err := model.GetList(comm.RDS_SESSION, &cache); err != nil {
+ if err := model.GetList(comm.RDS_EMPTY, &cache); err != nil {
return err
}
reply.Users = cache
@@ -535,7 +545,7 @@ func (this *User) RpcGetCrossUserSession(ctx context.Context, req *pb.UIdReq, re
return err
}
model := db.NewDBModel(comm.TableSession, 0, conn)
- if err := model.GetListObj(comm.RDS_SESSION, req.Uid, reply); err != nil {
+ if err := model.GetListObj(comm.RDS_EMPTY, req.Uid, reply); err != nil {
if err != mongo.ErrNoDocuments {
return err
}
diff --git a/modules/viking/api_challengeover.go b/modules/viking/api_challengeover.go
index 42d3c48f5..0daa763b2 100644
--- a/modules/viking/api_challengeover.go
+++ b/modules/viking/api_challengeover.go
@@ -114,7 +114,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.VikingChal
})
}
} else {
- this.module.configure.GetDropReward(cfg.Drop, reward) // 获取掉落奖励
+ reward = this.module.configure.GetDropReward(cfg.Drop) // 获取掉落奖励
if code = this.module.DispenseRes(session, reward, true); code != pb.ErrorCode_Success {
return
}
diff --git a/pb/battle_db.pb.go b/pb/battle_db.pb.go
index 0204f64be..1780f35b4 100644
--- a/pb/battle_db.pb.go
+++ b/pb/battle_db.pb.go
@@ -79,31 +79,33 @@ func (BattleType) EnumDescriptor() ([]byte, []int) {
type PlayType int32
const (
- PlayType_null PlayType = 0 //无效类型
- PlayType_mainline PlayType = 1 //主线玩法
- PlayType_pagoda PlayType = 2 //爬塔
- PlayType_rtask PlayType = 3 //随机任务战斗
- PlayType_hunting PlayType = 4 //狩猎
- PlayType_viking PlayType = 5 //维京远征
- PlayType_moonfantasy PlayType = 6 //月之秘境
- PlayType_arena PlayType = 7 //竞技场
- PlayType_academy PlayType = 8 //联盟学院
- PlayType_heroteaching PlayType = 9 //英雄教学
+ PlayType_null PlayType = 0 //无效类型
+ PlayType_mainline PlayType = 1 //主线玩法
+ PlayType_pagoda PlayType = 2 //爬塔
+ PlayType_rtask PlayType = 3 //随机任务战斗
+ PlayType_hunting PlayType = 4 //狩猎
+ PlayType_viking PlayType = 5 //维京远征
+ PlayType_moonfantasy PlayType = 6 //月之秘境
+ PlayType_arena PlayType = 7 //竞技场
+ PlayType_academy PlayType = 8 //联盟学院
+ PlayType_heroteaching PlayType = 9 //英雄教学
+ PlayType_combat PlayType = 10 //新关卡
)
// Enum value maps for PlayType.
var (
PlayType_name = map[int32]string{
- 0: "null",
- 1: "mainline",
- 2: "pagoda",
- 3: "rtask",
- 4: "hunting",
- 5: "viking",
- 6: "moonfantasy",
- 7: "arena",
- 8: "academy",
- 9: "heroteaching",
+ 0: "null",
+ 1: "mainline",
+ 2: "pagoda",
+ 3: "rtask",
+ 4: "hunting",
+ 5: "viking",
+ 6: "moonfantasy",
+ 7: "arena",
+ 8: "academy",
+ 9: "heroteaching",
+ 10: "combat",
}
PlayType_value = map[string]int32{
"null": 0,
@@ -116,6 +118,7 @@ var (
"arena": 7,
"academy": 8,
"heroteaching": 9,
+ "combat": 10,
}
)
@@ -647,7 +650,7 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x39, 0x0a, 0x0a, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a,
0x03, 0x6e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 0x65, 0x10, 0x01, 0x12,
0x07, 0x0a, 0x03, 0x70, 0x76, 0x70, 0x10, 0x02, 0x12, 0x07, 0x0a, 0x03, 0x70, 0x76, 0x62, 0x10,
- 0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x2a, 0x8d, 0x01, 0x0a, 0x08, 0x50,
+ 0x03, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x76, 0x65, 0x10, 0x04, 0x2a, 0x99, 0x01, 0x0a, 0x08, 0x50,
0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x6e, 0x75, 0x6c, 0x6c, 0x10,
0x00, 0x12, 0x0c, 0x0a, 0x08, 0x6d, 0x61, 0x69, 0x6e, 0x6c, 0x69, 0x6e, 0x65, 0x10, 0x01, 0x12,
0x0a, 0x0a, 0x06, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x72,
@@ -656,13 +659,14 @@ var file_battle_battle_db_proto_rawDesc = []byte{
0x0f, 0x0a, 0x0b, 0x6d, 0x6f, 0x6f, 0x6e, 0x66, 0x61, 0x6e, 0x74, 0x61, 0x73, 0x79, 0x10, 0x06,
0x12, 0x09, 0x0a, 0x05, 0x61, 0x72, 0x65, 0x6e, 0x61, 0x10, 0x07, 0x12, 0x0b, 0x0a, 0x07, 0x61,
0x63, 0x61, 0x64, 0x65, 0x6d, 0x79, 0x10, 0x08, 0x12, 0x10, 0x0a, 0x0c, 0x68, 0x65, 0x72, 0x6f,
- 0x74, 0x65, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x09, 0x2a, 0x1f, 0x0a, 0x0c, 0x42, 0x42,
- 0x61, 0x74, 0x74, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69, 0x6e,
- 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c, 0x44,
- 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04, 0x64,
- 0x72, 0x61, 0x77, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08,
- 0x0a, 0x04, 0x62, 0x75, 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62,
- 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x74, 0x65, 0x61, 0x63, 0x68, 0x69, 0x6e, 0x67, 0x10, 0x09, 0x12, 0x0a, 0x0a, 0x06, 0x63, 0x6f,
+ 0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 0x2a, 0x1f, 0x0a, 0x0c, 0x42, 0x42, 0x61, 0x74, 0x74, 0x6c,
+ 0x65, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x06, 0x0a, 0x02, 0x69, 0x6e, 0x10, 0x00, 0x12, 0x07,
+ 0x0a, 0x03, 0x65, 0x6e, 0x64, 0x10, 0x02, 0x2a, 0x2b, 0x0a, 0x0c, 0x44, 0x42, 0x42, 0x61, 0x74,
+ 0x74, 0x6c, 0x65, 0x43, 0x6f, 0x6d, 0x70, 0x12, 0x08, 0x0a, 0x04, 0x64, 0x72, 0x61, 0x77, 0x10,
+ 0x00, 0x12, 0x07, 0x0a, 0x03, 0x72, 0x65, 0x64, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x62, 0x75,
+ 0x6c, 0x65, 0x10, 0x02, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/pb/combat_db.pb.go b/pb/combat_db.pb.go
new file mode 100644
index 000000000..490b48cea
--- /dev/null
+++ b/pb/combat_db.pb.go
@@ -0,0 +1,171 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.0
+// protoc v3.20.0
+// source: combat/combat_db.proto
+
+package pb
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type DBCombatUser struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Uid string `protobuf:"bytes,1,opt,name=uid,proto3" json:"uid"` //uid
+ Currlevel int32 `protobuf:"varint,2,opt,name=currlevel,proto3" json:"currlevel"` //当前所在关卡
+ Passmanster []int32 `protobuf:"varint,3,rep,packed,name=passmanster,proto3" json:"passmanster"` //通关怪物列表
+ Passdrop []int32 `protobuf:"varint,4,rep,packed,name=passdrop,proto3" json:"passdrop"` //通关宝箱列表
+}
+
+func (x *DBCombatUser) Reset() {
+ *x = DBCombatUser{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_db_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *DBCombatUser) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*DBCombatUser) ProtoMessage() {}
+
+func (x *DBCombatUser) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_db_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use DBCombatUser.ProtoReflect.Descriptor instead.
+func (*DBCombatUser) Descriptor() ([]byte, []int) {
+ return file_combat_combat_db_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *DBCombatUser) GetUid() string {
+ if x != nil {
+ return x.Uid
+ }
+ return ""
+}
+
+func (x *DBCombatUser) GetCurrlevel() int32 {
+ if x != nil {
+ return x.Currlevel
+ }
+ return 0
+}
+
+func (x *DBCombatUser) GetPassmanster() []int32 {
+ if x != nil {
+ return x.Passmanster
+ }
+ return nil
+}
+
+func (x *DBCombatUser) GetPassdrop() []int32 {
+ if x != nil {
+ return x.Passdrop
+ }
+ return nil
+}
+
+var File_combat_combat_db_proto protoreflect.FileDescriptor
+
+var file_combat_combat_db_proto_rawDesc = []byte{
+ 0x0a, 0x16, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x5f,
+ 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7c, 0x0a, 0x0c, 0x44, 0x42, 0x43, 0x6f,
+ 0x6d, 0x62, 0x61, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x75,
+ 0x72, 0x72, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63,
+ 0x75, 0x72, 0x72, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x12, 0x20, 0x0a, 0x0b, 0x70, 0x61, 0x73, 0x73,
+ 0x6d, 0x61, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x18, 0x03, 0x20, 0x03, 0x28, 0x05, 0x52, 0x0b, 0x70,
+ 0x61, 0x73, 0x73, 0x6d, 0x61, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61,
+ 0x73, 0x73, 0x64, 0x72, 0x6f, 0x70, 0x18, 0x04, 0x20, 0x03, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61,
+ 0x73, 0x73, 0x64, 0x72, 0x6f, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_combat_combat_db_proto_rawDescOnce sync.Once
+ file_combat_combat_db_proto_rawDescData = file_combat_combat_db_proto_rawDesc
+)
+
+func file_combat_combat_db_proto_rawDescGZIP() []byte {
+ file_combat_combat_db_proto_rawDescOnce.Do(func() {
+ file_combat_combat_db_proto_rawDescData = protoimpl.X.CompressGZIP(file_combat_combat_db_proto_rawDescData)
+ })
+ return file_combat_combat_db_proto_rawDescData
+}
+
+var file_combat_combat_db_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
+var file_combat_combat_db_proto_goTypes = []interface{}{
+ (*DBCombatUser)(nil), // 0: DBCombatUser
+}
+var file_combat_combat_db_proto_depIdxs = []int32{
+ 0, // [0:0] is the sub-list for method output_type
+ 0, // [0:0] is the sub-list for method input_type
+ 0, // [0:0] is the sub-list for extension type_name
+ 0, // [0:0] is the sub-list for extension extendee
+ 0, // [0:0] is the sub-list for field type_name
+}
+
+func init() { file_combat_combat_db_proto_init() }
+func file_combat_combat_db_proto_init() {
+ if File_combat_combat_db_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_combat_combat_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*DBCombatUser); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_combat_combat_db_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 1,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_combat_combat_db_proto_goTypes,
+ DependencyIndexes: file_combat_combat_db_proto_depIdxs,
+ MessageInfos: file_combat_combat_db_proto_msgTypes,
+ }.Build()
+ File_combat_combat_db_proto = out.File
+ file_combat_combat_db_proto_rawDesc = nil
+ file_combat_combat_db_proto_goTypes = nil
+ file_combat_combat_db_proto_depIdxs = nil
+}
diff --git a/pb/combat_msg.pb.go b/pb/combat_msg.pb.go
new file mode 100644
index 000000000..6d7c662d6
--- /dev/null
+++ b/pb/combat_msg.pb.go
@@ -0,0 +1,802 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.0
+// protoc v3.20.0
+// source: combat/combat_msg.proto
+
+package pb
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+//关卡进入请求
+type CombatInReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` //关卡id
+}
+
+func (x *CombatInReq) Reset() {
+ *x = CombatInReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatInReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatInReq) ProtoMessage() {}
+
+func (x *CombatInReq) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatInReq.ProtoReflect.Descriptor instead.
+func (*CombatInReq) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *CombatInReq) GetId() int32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+//关卡进入请求
+type CombatInResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` //关卡id
+}
+
+func (x *CombatInResp) Reset() {
+ *x = CombatInResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatInResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatInResp) ProtoMessage() {}
+
+func (x *CombatInResp) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatInResp.ProtoReflect.Descriptor instead.
+func (*CombatInResp) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *CombatInResp) GetId() int32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+//关卡离开请求
+type CombatOutReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` //关卡id
+}
+
+func (x *CombatOutReq) Reset() {
+ *x = CombatOutReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatOutReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatOutReq) ProtoMessage() {}
+
+func (x *CombatOutReq) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatOutReq.ProtoReflect.Descriptor instead.
+func (*CombatOutReq) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *CombatOutReq) GetId() int32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+//关卡离开请求 回应
+type CombatOutResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` //关卡id
+}
+
+func (x *CombatOutResp) Reset() {
+ *x = CombatOutResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatOutResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatOutResp) ProtoMessage() {}
+
+func (x *CombatOutResp) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatOutResp.ProtoReflect.Descriptor instead.
+func (*CombatOutResp) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *CombatOutResp) GetId() int32 {
+ if x != nil {
+ return x.Id
+ }
+ return 0
+}
+
+//战斗请求
+type CombatChallengeReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Manster int32 `protobuf:"varint,1,opt,name=manster,proto3" json:"manster"` //怪物id
+ Battle *BattleFormation `protobuf:"bytes,2,opt,name=battle,proto3" json:"battle"` //布阵信息
+}
+
+func (x *CombatChallengeReq) Reset() {
+ *x = CombatChallengeReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatChallengeReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatChallengeReq) ProtoMessage() {}
+
+func (x *CombatChallengeReq) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatChallengeReq.ProtoReflect.Descriptor instead.
+func (*CombatChallengeReq) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *CombatChallengeReq) GetManster() int32 {
+ if x != nil {
+ return x.Manster
+ }
+ return 0
+}
+
+func (x *CombatChallengeReq) GetBattle() *BattleFormation {
+ if x != nil {
+ return x.Battle
+ }
+ return nil
+}
+
+//战斗请求 回应
+type CombatChallengeResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"` //是否成功
+ Manster int32 `protobuf:"varint,2,opt,name=manster,proto3" json:"manster"`
+ Info *BattleInfo `protobuf:"bytes,3,opt,name=info,proto3" json:"info"`
+}
+
+func (x *CombatChallengeResp) Reset() {
+ *x = CombatChallengeResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatChallengeResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatChallengeResp) ProtoMessage() {}
+
+func (x *CombatChallengeResp) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatChallengeResp.ProtoReflect.Descriptor instead.
+func (*CombatChallengeResp) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *CombatChallengeResp) GetCode() ErrorCode {
+ if x != nil {
+ return x.Code
+ }
+ return ErrorCode_Success
+}
+
+func (x *CombatChallengeResp) GetManster() int32 {
+ if x != nil {
+ return x.Manster
+ }
+ return 0
+}
+
+func (x *CombatChallengeResp) GetInfo() *BattleInfo {
+ if x != nil {
+ return x.Info
+ }
+ return nil
+}
+
+//战斗奖励领取
+type CombatChallengeReceiveReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Manster int32 `protobuf:"varint,1,opt,name=manster,proto3" json:"manster"`
+ Report *BattleReport `protobuf:"bytes,2,opt,name=report,proto3" json:"report"` //战报
+}
+
+func (x *CombatChallengeReceiveReq) Reset() {
+ *x = CombatChallengeReceiveReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatChallengeReceiveReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatChallengeReceiveReq) ProtoMessage() {}
+
+func (x *CombatChallengeReceiveReq) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatChallengeReceiveReq.ProtoReflect.Descriptor instead.
+func (*CombatChallengeReceiveReq) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *CombatChallengeReceiveReq) GetManster() int32 {
+ if x != nil {
+ return x.Manster
+ }
+ return 0
+}
+
+func (x *CombatChallengeReceiveReq) GetReport() *BattleReport {
+ if x != nil {
+ return x.Report
+ }
+ return nil
+}
+
+//战斗奖励领取
+type CombatChallengeReceiveResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Issucc bool `protobuf:"varint,1,opt,name=issucc,proto3" json:"issucc"`
+ Pass bool `protobuf:"varint,2,opt,name=pass,proto3" json:"pass"` //是否通关
+}
+
+func (x *CombatChallengeReceiveResp) Reset() {
+ *x = CombatChallengeReceiveResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatChallengeReceiveResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatChallengeReceiveResp) ProtoMessage() {}
+
+func (x *CombatChallengeReceiveResp) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatChallengeReceiveResp.ProtoReflect.Descriptor instead.
+func (*CombatChallengeReceiveResp) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *CombatChallengeReceiveResp) GetIssucc() bool {
+ if x != nil {
+ return x.Issucc
+ }
+ return false
+}
+
+func (x *CombatChallengeReceiveResp) GetPass() bool {
+ if x != nil {
+ return x.Pass
+ }
+ return false
+}
+
+//宝箱获取请求
+type CombatDropReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Drop int32 `protobuf:"varint,1,opt,name=drop,proto3" json:"drop"` //宝箱id
+}
+
+func (x *CombatDropReq) Reset() {
+ *x = CombatDropReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatDropReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatDropReq) ProtoMessage() {}
+
+func (x *CombatDropReq) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatDropReq.ProtoReflect.Descriptor instead.
+func (*CombatDropReq) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *CombatDropReq) GetDrop() int32 {
+ if x != nil {
+ return x.Drop
+ }
+ return 0
+}
+
+//宝箱获取请求
+type CombatDropResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Code ErrorCode `protobuf:"varint,1,opt,name=code,proto3,enum=ErrorCode" json:"code"` //是否成功
+ Atns []*UserAssets `protobuf:"bytes,2,rep,name=atns,proto3" json:"atns"` //获取物品
+ Pass bool `protobuf:"varint,3,opt,name=pass,proto3" json:"pass"` //是否通关
+}
+
+func (x *CombatDropResp) Reset() {
+ *x = CombatDropResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_combat_combat_msg_proto_msgTypes[9]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CombatDropResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CombatDropResp) ProtoMessage() {}
+
+func (x *CombatDropResp) ProtoReflect() protoreflect.Message {
+ mi := &file_combat_combat_msg_proto_msgTypes[9]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CombatDropResp.ProtoReflect.Descriptor instead.
+func (*CombatDropResp) Descriptor() ([]byte, []int) {
+ return file_combat_combat_msg_proto_rawDescGZIP(), []int{9}
+}
+
+func (x *CombatDropResp) GetCode() ErrorCode {
+ if x != nil {
+ return x.Code
+ }
+ return ErrorCode_Success
+}
+
+func (x *CombatDropResp) GetAtns() []*UserAssets {
+ if x != nil {
+ return x.Atns
+ }
+ return nil
+}
+
+func (x *CombatDropResp) GetPass() bool {
+ if x != nil {
+ return x.Pass
+ }
+ return false
+}
+
+var File_combat_combat_msg_proto protoreflect.FileDescriptor
+
+var file_combat_combat_msg_proto_rawDesc = []byte{
+ 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x2f, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x5f,
+ 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72,
+ 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x63, 0x6f, 0x6d, 0x6d,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x2f, 0x62,
+ 0x61, 0x74, 0x74, 0x6c, 0x65, 0x5f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22,
+ 0x1d, 0x0a, 0x0b, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x49, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x0e,
+ 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1e,
+ 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x0e,
+ 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1e,
+ 0x0a, 0x0c, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x71, 0x12, 0x0e,
+ 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x1f,
+ 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
+ 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22,
+ 0x58, 0x0a, 0x12, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e,
+ 0x67, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x73, 0x74, 0x65, 0x72,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x12,
+ 0x28, 0x0a, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
+ 0x10, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x52, 0x06, 0x62, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x22, 0x70, 0x0a, 0x13, 0x43, 0x6f, 0x6d,
+ 0x62, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x73, 0x70,
+ 0x12, 0x1e, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a,
+ 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65,
+ 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x05, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x04, 0x69, 0x6e,
+ 0x66, 0x6f, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c,
+ 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x5c, 0x0a, 0x19, 0x43,
+ 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65,
+ 0x63, 0x65, 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x61, 0x6e, 0x73,
+ 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6d, 0x61, 0x6e, 0x73, 0x74,
+ 0x65, 0x72, 0x12, 0x25, 0x0a, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x52, 0x65, 0x70, 0x6f, 0x72,
+ 0x74, 0x52, 0x06, 0x72, 0x65, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x48, 0x0a, 0x1a, 0x43, 0x6f, 0x6d,
+ 0x62, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x52, 0x65, 0x63, 0x65,
+ 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63,
+ 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x12,
+ 0x12, 0x0a, 0x04, 0x70, 0x61, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70,
+ 0x61, 0x73, 0x73, 0x22, 0x23, 0x0a, 0x0d, 0x43, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x44, 0x72, 0x6f,
+ 0x70, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x72, 0x6f, 0x70, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x05, 0x52, 0x04, 0x64, 0x72, 0x6f, 0x70, 0x22, 0x65, 0x0a, 0x0e, 0x43, 0x6f, 0x6d, 0x62,
+ 0x61, 0x74, 0x44, 0x72, 0x6f, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x63, 0x6f,
+ 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0a, 0x2e, 0x45, 0x72, 0x72, 0x6f, 0x72,
+ 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x1f, 0x0a, 0x04, 0x61, 0x74,
+ 0x6e, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x41,
+ 0x73, 0x73, 0x65, 0x74, 0x73, 0x52, 0x04, 0x61, 0x74, 0x6e, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70,
+ 0x61, 0x73, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x04, 0x70, 0x61, 0x73, 0x73, 0x42,
+ 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_combat_combat_msg_proto_rawDescOnce sync.Once
+ file_combat_combat_msg_proto_rawDescData = file_combat_combat_msg_proto_rawDesc
+)
+
+func file_combat_combat_msg_proto_rawDescGZIP() []byte {
+ file_combat_combat_msg_proto_rawDescOnce.Do(func() {
+ file_combat_combat_msg_proto_rawDescData = protoimpl.X.CompressGZIP(file_combat_combat_msg_proto_rawDescData)
+ })
+ return file_combat_combat_msg_proto_rawDescData
+}
+
+var file_combat_combat_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_combat_combat_msg_proto_goTypes = []interface{}{
+ (*CombatInReq)(nil), // 0: CombatInReq
+ (*CombatInResp)(nil), // 1: CombatInResp
+ (*CombatOutReq)(nil), // 2: CombatOutReq
+ (*CombatOutResp)(nil), // 3: CombatOutResp
+ (*CombatChallengeReq)(nil), // 4: CombatChallengeReq
+ (*CombatChallengeResp)(nil), // 5: CombatChallengeResp
+ (*CombatChallengeReceiveReq)(nil), // 6: CombatChallengeReceiveReq
+ (*CombatChallengeReceiveResp)(nil), // 7: CombatChallengeReceiveResp
+ (*CombatDropReq)(nil), // 8: CombatDropReq
+ (*CombatDropResp)(nil), // 9: CombatDropResp
+ (*BattleFormation)(nil), // 10: BattleFormation
+ (ErrorCode)(0), // 11: ErrorCode
+ (*BattleInfo)(nil), // 12: BattleInfo
+ (*BattleReport)(nil), // 13: BattleReport
+ (*UserAssets)(nil), // 14: UserAssets
+}
+var file_combat_combat_msg_proto_depIdxs = []int32{
+ 10, // 0: CombatChallengeReq.battle:type_name -> BattleFormation
+ 11, // 1: CombatChallengeResp.code:type_name -> ErrorCode
+ 12, // 2: CombatChallengeResp.info:type_name -> BattleInfo
+ 13, // 3: CombatChallengeReceiveReq.report:type_name -> BattleReport
+ 11, // 4: CombatDropResp.code:type_name -> ErrorCode
+ 14, // 5: CombatDropResp.atns:type_name -> UserAssets
+ 6, // [6:6] is the sub-list for method output_type
+ 6, // [6:6] is the sub-list for method input_type
+ 6, // [6:6] is the sub-list for extension type_name
+ 6, // [6:6] is the sub-list for extension extendee
+ 0, // [0:6] is the sub-list for field type_name
+}
+
+func init() { file_combat_combat_msg_proto_init() }
+func file_combat_combat_msg_proto_init() {
+ if File_combat_combat_msg_proto != nil {
+ return
+ }
+ file_errorcode_proto_init()
+ file_comm_proto_init()
+ file_battle_battle_msg_proto_init()
+ if !protoimpl.UnsafeEnabled {
+ file_combat_combat_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatInReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatInResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatOutReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatOutResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatChallengeReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatChallengeResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatChallengeReceiveReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatChallengeReceiveResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatDropReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_combat_combat_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CombatDropResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_combat_combat_msg_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 10,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_combat_combat_msg_proto_goTypes,
+ DependencyIndexes: file_combat_combat_msg_proto_depIdxs,
+ MessageInfos: file_combat_combat_msg_proto_msgTypes,
+ }.Build()
+ File_combat_combat_msg_proto = out.File
+ file_combat_combat_msg_proto_rawDesc = nil
+ file_combat_combat_msg_proto_goTypes = nil
+ file_combat_combat_msg_proto_depIdxs = nil
+}
diff --git a/services/comp_gateroute.go b/services/comp_gateroute.go
index d537543f1..ec682eaca 100644
--- a/services/comp_gateroute.go
+++ b/services/comp_gateroute.go
@@ -188,7 +188,7 @@ func (this *SCompGateRoute) NoticeUserLogin(ctx context.Context, args *pb.Notice
return err
}
model := db.NewDBModel(comm.TableSession, 0, conn)
- model.AddList(comm.RDS_SESSION, args.UserId, map[string]interface{}{
+ model.AddList(comm.RDS_EMPTY, args.UserId, map[string]interface{}{
"uid": args.UserId,
"sessionId": args.UserSessionId,
"serviceTag": args.ServiceTag,
diff --git a/services/worker/main.go b/services/worker/main.go
index 0d997ef06..3da7874fd 100644
--- a/services/worker/main.go
+++ b/services/worker/main.go
@@ -7,6 +7,7 @@ import (
"go_dreamfactory/modules/arena"
"go_dreamfactory/modules/battle"
"go_dreamfactory/modules/chat"
+ "go_dreamfactory/modules/combat"
"go_dreamfactory/modules/equipment"
"go_dreamfactory/modules/forum"
"go_dreamfactory/modules/friend"
@@ -104,6 +105,7 @@ func main() {
worldtask.NewModule(),
academy.NewModule(),
reddot.NewModule(),
+ combat.NewModule(),
)
}
diff --git a/sys/configure/structs/Game.CombatLevel.go b/sys/configure/structs/Game.CombatLevel.go
new file mode 100644
index 000000000..421a52cce
--- /dev/null
+++ b/sys/configure/structs/Game.CombatLevel.go
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+type GameCombatLevel struct {
+ _dataMap map[int32]*GameCombatLevelData
+ _dataList []*GameCombatLevelData
+}
+
+func NewGameCombatLevel(_buf []map[string]interface{}) (*GameCombatLevel, error) {
+ _dataList := make([]*GameCombatLevelData, 0, len(_buf))
+ dataMap := make(map[int32]*GameCombatLevelData)
+ for _, _ele_ := range _buf {
+ if _v, err2 := DeserializeGameCombatLevelData(_ele_); err2 != nil {
+ return nil, err2
+ } else {
+ _dataList = append(_dataList, _v)
+ dataMap[_v.Id] = _v
+ }
+ }
+ return &GameCombatLevel{_dataList:_dataList, _dataMap:dataMap}, nil
+}
+
+func (table *GameCombatLevel) GetDataMap() map[int32]*GameCombatLevelData {
+ return table._dataMap
+}
+
+func (table *GameCombatLevel) GetDataList() []*GameCombatLevelData {
+ return table._dataList
+}
+
+func (table *GameCombatLevel) Get(key int32) *GameCombatLevelData {
+ return table._dataMap[key]
+}
+
+
diff --git a/sys/configure/structs/Game.CombatLevelData.go b/sys/configure/structs/Game.CombatLevelData.go
new file mode 100644
index 000000000..532ddd9fd
--- /dev/null
+++ b/sys/configure/structs/Game.CombatLevelData.go
@@ -0,0 +1,110 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+import "errors"
+
+type GameCombatLevelData struct {
+ Id int32
+ FormatList []int32
+ Droplist []int32
+ PassformatList []int32
+ Passdroplist []int32
+ Award []*Gameatn
+}
+
+const TypeId_GameCombatLevelData = 1556955838
+
+func (*GameCombatLevelData) GetTypeId() int32 {
+ return 1556955838
+}
+
+func (_v *GameCombatLevelData)Deserialize(_buf map[string]interface{}) (err error) {
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["formatList"].([]interface{}); !_ok_ { err = errors.New("formatList error"); return }
+
+ _v.FormatList = make([]int32, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ int32
+ { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
+ _v.FormatList = append(_v.FormatList, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["droplist"].([]interface{}); !_ok_ { err = errors.New("droplist error"); return }
+
+ _v.Droplist = make([]int32, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ int32
+ { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
+ _v.Droplist = append(_v.Droplist, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["passformatList"].([]interface{}); !_ok_ { err = errors.New("passformatList error"); return }
+
+ _v.PassformatList = make([]int32, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ int32
+ { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
+ _v.PassformatList = append(_v.PassformatList, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["passdroplist"].([]interface{}); !_ok_ { err = errors.New("passdroplist error"); return }
+
+ _v.Passdroplist = make([]int32, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ int32
+ { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
+ _v.Passdroplist = append(_v.Passdroplist, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["award"].([]interface{}); !_ok_ { err = errors.New("award error"); return }
+
+ _v.Award = make([]*Gameatn, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ *Gameatn
+ { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
+ _v.Award = append(_v.Award, _list_v_)
+ }
+ }
+
+ return
+}
+
+func DeserializeGameCombatLevelData(_buf map[string]interface{}) (*GameCombatLevelData, error) {
+ v := &GameCombatLevelData{}
+ if err := v.Deserialize(_buf); err == nil {
+ return v, nil
+ } else {
+ return nil, err
+ }
+}
diff --git a/sys/configure/structs/Game.CombatManster.go b/sys/configure/structs/Game.CombatManster.go
new file mode 100644
index 000000000..c43408358
--- /dev/null
+++ b/sys/configure/structs/Game.CombatManster.go
@@ -0,0 +1,42 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+type GameCombatManster struct {
+ _dataMap map[int32]*GameCombatMansterData
+ _dataList []*GameCombatMansterData
+}
+
+func NewGameCombatManster(_buf []map[string]interface{}) (*GameCombatManster, error) {
+ _dataList := make([]*GameCombatMansterData, 0, len(_buf))
+ dataMap := make(map[int32]*GameCombatMansterData)
+ for _, _ele_ := range _buf {
+ if _v, err2 := DeserializeGameCombatMansterData(_ele_); err2 != nil {
+ return nil, err2
+ } else {
+ _dataList = append(_dataList, _v)
+ dataMap[_v.Id] = _v
+ }
+ }
+ return &GameCombatManster{_dataList:_dataList, _dataMap:dataMap}, nil
+}
+
+func (table *GameCombatManster) GetDataMap() map[int32]*GameCombatMansterData {
+ return table._dataMap
+}
+
+func (table *GameCombatManster) GetDataList() []*GameCombatMansterData {
+ return table._dataList
+}
+
+func (table *GameCombatManster) Get(key int32) *GameCombatMansterData {
+ return table._dataMap[key]
+}
+
+
diff --git a/sys/configure/structs/Game.CombatMansterData.go b/sys/configure/structs/Game.CombatMansterData.go
new file mode 100644
index 000000000..f059cb9c5
--- /dev/null
+++ b/sys/configure/structs/Game.CombatMansterData.go
@@ -0,0 +1,65 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+package cfg
+
+import "errors"
+
+type GameCombatMansterData struct {
+ Id int32
+ FormatList []int32
+ Award []*Gameatn
+}
+
+const TypeId_GameCombatMansterData = 248449122
+
+func (*GameCombatMansterData) GetTypeId() int32 {
+ return 248449122
+}
+
+func (_v *GameCombatMansterData)Deserialize(_buf map[string]interface{}) (err error) {
+ { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["formatList"].([]interface{}); !_ok_ { err = errors.New("formatList error"); return }
+
+ _v.FormatList = make([]int32, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ int32
+ { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
+ _v.FormatList = append(_v.FormatList, _list_v_)
+ }
+ }
+
+ {
+ var _arr_ []interface{}
+ var _ok_ bool
+ if _arr_, _ok_ = _buf["award"].([]interface{}); !_ok_ { err = errors.New("award error"); return }
+
+ _v.Award = make([]*Gameatn, 0, len(_arr_))
+
+ for _, _e_ := range _arr_ {
+ var _list_v_ *Gameatn
+ { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
+ _v.Award = append(_v.Award, _list_v_)
+ }
+ }
+
+ return
+}
+
+func DeserializeGameCombatMansterData(_buf map[string]interface{}) (*GameCombatMansterData, error) {
+ v := &GameCombatMansterData{}
+ if err := v.Deserialize(_buf); err == nil {
+ return v, nil
+ } else {
+ return nil, err
+ }
+}