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..b2826810c 100644 --- a/comm/const.go +++ b/comm/const.go @@ -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" //关卡编辑 ) //数据表名定义处 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..eb87595c1 --- /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_academy, + 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..e8a4c47ae --- /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()), "receive", &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..35e1571bd --- /dev/null +++ b/modules/combat/api_drop.go @@ -0,0 +1,48 @@ +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 + 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) + + session.SendMsg(string(this.module.GetType()), "drop", &pb.CombatDropResp{Code: code}) + return +} diff --git a/modules/combat/api_in.go b/modules/combat/api_in.go new file mode 100644 index 000000000..7a6207963 --- /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()), "info", &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..6e1877bed --- /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.TableAcademy + 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); 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, + }); 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/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/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/combat_msg.pb.go b/pb/combat_msg.pb.go index 89a8ec2db..30294c095 100644 --- a/pb/combat_msg.pb.go +++ b/pb/combat_msg.pb.go @@ -332,6 +332,110 @@ func (x *CombatChallengeResp) GetInfo() *BattleInfo { 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"` +} + +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 +} + //宝箱获取请求 type CombatDropReq struct { state protoimpl.MessageState @@ -344,7 +448,7 @@ type CombatDropReq struct { func (x *CombatDropReq) Reset() { *x = CombatDropReq{} if protoimpl.UnsafeEnabled { - mi := &file_combat_combat_msg_proto_msgTypes[6] + mi := &file_combat_combat_msg_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -357,7 +461,7 @@ func (x *CombatDropReq) String() string { func (*CombatDropReq) ProtoMessage() {} func (x *CombatDropReq) ProtoReflect() protoreflect.Message { - mi := &file_combat_combat_msg_proto_msgTypes[6] + mi := &file_combat_combat_msg_proto_msgTypes[8] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -370,7 +474,7 @@ func (x *CombatDropReq) ProtoReflect() protoreflect.Message { // Deprecated: Use CombatDropReq.ProtoReflect.Descriptor instead. func (*CombatDropReq) Descriptor() ([]byte, []int) { - return file_combat_combat_msg_proto_rawDescGZIP(), []int{6} + return file_combat_combat_msg_proto_rawDescGZIP(), []int{8} } func (x *CombatDropReq) GetDrop() int32 { @@ -393,7 +497,7 @@ type CombatDropResp struct { func (x *CombatDropResp) Reset() { *x = CombatDropResp{} if protoimpl.UnsafeEnabled { - mi := &file_combat_combat_msg_proto_msgTypes[7] + mi := &file_combat_combat_msg_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -406,7 +510,7 @@ func (x *CombatDropResp) String() string { func (*CombatDropResp) ProtoMessage() {} func (x *CombatDropResp) ProtoReflect() protoreflect.Message { - mi := &file_combat_combat_msg_proto_msgTypes[7] + mi := &file_combat_combat_msg_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -419,7 +523,7 @@ func (x *CombatDropResp) ProtoReflect() protoreflect.Message { // Deprecated: Use CombatDropResp.ProtoReflect.Descriptor instead. func (*CombatDropResp) Descriptor() ([]byte, []int) { - return file_combat_combat_msg_proto_rawDescGZIP(), []int{7} + return file_combat_combat_msg_proto_rawDescGZIP(), []int{9} } func (x *CombatDropResp) GetCode() ErrorCode { @@ -464,16 +568,25 @@ var file_combat_combat_msg_proto_rawDesc = []byte{ 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, 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, 0x51, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 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, 0x34, 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, 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, 0x51, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -488,32 +601,36 @@ func file_combat_combat_msg_proto_rawDescGZIP() []byte { return file_combat_combat_msg_proto_rawDescData } -var file_combat_combat_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +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 - (*CombatDropReq)(nil), // 6: CombatDropReq - (*CombatDropResp)(nil), // 7: CombatDropResp - (*BattleFormation)(nil), // 8: BattleFormation - (ErrorCode)(0), // 9: ErrorCode - (*BattleInfo)(nil), // 10: BattleInfo - (*UserAssets)(nil), // 11: UserAssets + (*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{ - 8, // 0: CombatChallengeReq.battle:type_name -> BattleFormation - 9, // 1: CombatChallengeResp.code:type_name -> ErrorCode - 10, // 2: CombatChallengeResp.info:type_name -> BattleInfo - 9, // 3: CombatDropResp.code:type_name -> ErrorCode - 11, // 4: CombatDropResp.atns:type_name -> UserAssets - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 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() } @@ -598,7 +715,7 @@ func file_combat_combat_msg_proto_init() { } } file_combat_combat_msg_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CombatDropReq); i { + switch v := v.(*CombatChallengeReceiveReq); i { case 0: return &v.state case 1: @@ -610,6 +727,30 @@ func file_combat_combat_msg_proto_init() { } } 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 @@ -628,7 +769,7 @@ func file_combat_combat_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_combat_combat_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 8, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/worldtask_msg.pb.go b/pb/worldtask_msg.pb.go index ce40485c2..a60416c96 100644 --- a/pb/worldtask_msg.pb.go +++ b/pb/worldtask_msg.pb.go @@ -488,65 +488,18 @@ func (x *WorldtaskBattleFinishResp) GetTaskId() int32 { } // 当前完成的任务列表推送 -type WorldtaskList struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - TaskId []int32 `protobuf:"varint,1,rep,packed,name=taskId,proto3" json:"taskId"` //任务ID -} - -func (x *WorldtaskList) Reset() { - *x = WorldtaskList{} - if protoimpl.UnsafeEnabled { - mi := &file_worldtask_worldtask_msg_proto_msgTypes[9] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *WorldtaskList) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*WorldtaskList) ProtoMessage() {} - -func (x *WorldtaskList) ProtoReflect() protoreflect.Message { - mi := &file_worldtask_worldtask_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 WorldtaskList.ProtoReflect.Descriptor instead. -func (*WorldtaskList) Descriptor() ([]byte, []int) { - return file_worldtask_worldtask_msg_proto_rawDescGZIP(), []int{9} -} - -func (x *WorldtaskList) GetTaskId() []int32 { - if x != nil { - return x.TaskId - } - return nil -} - type WorldtaskFinishIdsPush struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Tasks map[int32]*WorldtaskList `protobuf:"bytes,1,rep,name=tasks,proto3" json:"tasks" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` //完成的任务 key:groupId val:任务ID + TaskList []*Worldtask `protobuf:"bytes,1,rep,name=taskList,proto3" json:"taskList"` //完成的任务 key:groupId val:任务ID } func (x *WorldtaskFinishIdsPush) Reset() { *x = WorldtaskFinishIdsPush{} if protoimpl.UnsafeEnabled { - mi := &file_worldtask_worldtask_msg_proto_msgTypes[10] + mi := &file_worldtask_worldtask_msg_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -559,7 +512,7 @@ func (x *WorldtaskFinishIdsPush) String() string { func (*WorldtaskFinishIdsPush) ProtoMessage() {} func (x *WorldtaskFinishIdsPush) ProtoReflect() protoreflect.Message { - mi := &file_worldtask_worldtask_msg_proto_msgTypes[10] + mi := &file_worldtask_worldtask_msg_proto_msgTypes[9] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -572,12 +525,12 @@ func (x *WorldtaskFinishIdsPush) ProtoReflect() protoreflect.Message { // Deprecated: Use WorldtaskFinishIdsPush.ProtoReflect.Descriptor instead. func (*WorldtaskFinishIdsPush) Descriptor() ([]byte, []int) { - return file_worldtask_worldtask_msg_proto_rawDescGZIP(), []int{10} + return file_worldtask_worldtask_msg_proto_rawDescGZIP(), []int{9} } -func (x *WorldtaskFinishIdsPush) GetTasks() map[int32]*WorldtaskList { +func (x *WorldtaskFinishIdsPush) GetTaskList() []*Worldtask { if x != nil { - return x.Tasks + return x.TaskList } return nil } @@ -630,20 +583,12 @@ var file_worldtask_worldtask_msg_proto_rawDesc = []byte{ 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x42, 0x61, 0x74, 0x74, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, - 0x27, 0x0a, 0x0d, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, - 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, - 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x9c, 0x01, 0x0a, 0x16, 0x57, 0x6f, 0x72, - 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x49, 0x64, 0x73, 0x50, - 0x75, 0x73, 0x68, 0x12, 0x38, 0x0a, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x18, 0x01, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, - 0x6e, 0x69, 0x73, 0x68, 0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x2e, 0x54, 0x61, 0x73, 0x6b, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x05, 0x74, 0x61, 0x73, 0x6b, 0x73, 0x1a, 0x48, 0x0a, - 0x0a, 0x54, 0x61, 0x73, 0x6b, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x24, 0x0a, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x57, - 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x05, 0x76, 0x61, - 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x40, 0x0a, 0x16, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x46, 0x69, 0x6e, 0x69, + 0x73, 0x68, 0x49, 0x64, 0x73, 0x50, 0x75, 0x73, 0x68, 0x12, 0x26, 0x0a, 0x08, 0x74, 0x61, 0x73, + 0x6b, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x57, 0x6f, + 0x72, 0x6c, 0x64, 0x74, 0x61, 0x73, 0x6b, 0x52, 0x08, 0x74, 0x61, 0x73, 0x6b, 0x4c, 0x69, 0x73, + 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -658,7 +603,7 @@ func file_worldtask_worldtask_msg_proto_rawDescGZIP() []byte { return file_worldtask_worldtask_msg_proto_rawDescData } -var file_worldtask_worldtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_worldtask_worldtask_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_worldtask_worldtask_msg_proto_goTypes = []interface{}{ (*WorldtaskMineReq)(nil), // 0: WorldtaskMineReq (*WorldtaskMineResp)(nil), // 1: WorldtaskMineResp @@ -669,24 +614,22 @@ var file_worldtask_worldtask_msg_proto_goTypes = []interface{}{ (*WorldtaskBattleStartResp)(nil), // 6: WorldtaskBattleStartResp (*WorldtaskBattleFinishReq)(nil), // 7: WorldtaskBattleFinishReq (*WorldtaskBattleFinishResp)(nil), // 8: WorldtaskBattleFinishResp - (*WorldtaskList)(nil), // 9: WorldtaskList - (*WorldtaskFinishIdsPush)(nil), // 10: WorldtaskFinishIdsPush - nil, // 11: WorldtaskFinishIdsPush.TasksEntry - (*DBWorldtask)(nil), // 12: DBWorldtask - (*BattleInfo)(nil), // 13: BattleInfo - (*BattleReport)(nil), // 14: BattleReport + (*WorldtaskFinishIdsPush)(nil), // 9: WorldtaskFinishIdsPush + (*DBWorldtask)(nil), // 10: DBWorldtask + (*BattleInfo)(nil), // 11: BattleInfo + (*BattleReport)(nil), // 12: BattleReport + (*Worldtask)(nil), // 13: Worldtask } var file_worldtask_worldtask_msg_proto_depIdxs = []int32{ - 12, // 0: WorldtaskMineResp.task:type_name -> DBWorldtask - 13, // 1: WorldtaskBattleStartResp.info:type_name -> BattleInfo - 14, // 2: WorldtaskBattleFinishReq.report:type_name -> BattleReport - 11, // 3: WorldtaskFinishIdsPush.tasks:type_name -> WorldtaskFinishIdsPush.TasksEntry - 9, // 4: WorldtaskFinishIdsPush.TasksEntry.value:type_name -> WorldtaskList - 5, // [5:5] is the sub-list for method output_type - 5, // [5:5] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 10, // 0: WorldtaskMineResp.task:type_name -> DBWorldtask + 11, // 1: WorldtaskBattleStartResp.info:type_name -> BattleInfo + 12, // 2: WorldtaskBattleFinishReq.report:type_name -> BattleReport + 13, // 3: WorldtaskFinishIdsPush.taskList:type_name -> Worldtask + 4, // [4:4] is the sub-list for method output_type + 4, // [4:4] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_worldtask_worldtask_msg_proto_init() } @@ -806,18 +749,6 @@ func file_worldtask_worldtask_msg_proto_init() { } } file_worldtask_worldtask_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*WorldtaskList); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_worldtask_worldtask_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WorldtaskFinishIdsPush); i { case 0: return &v.state @@ -836,7 +767,7 @@ func file_worldtask_worldtask_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_worldtask_worldtask_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 12, + NumMessages: 10, NumExtensions: 0, NumServices: 0, }, 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(), ) }