From 638d4871817ab85cd01dac9ae8f146a6c6a5cac5 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 20 Dec 2022 19:59:24 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=90=8C=E6=AD=A5pb=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pb/battle_db.pb.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/pb/battle_db.pb.go b/pb/battle_db.pb.go index 71ae306ca..2b7a6f648 100644 --- a/pb/battle_db.pb.go +++ b/pb/battle_db.pb.go @@ -90,6 +90,7 @@ const ( PlayType_academy PlayType = 8 //联盟学院 PlayType_heroteaching PlayType = 9 //英雄教学 PlayType_combat PlayType = 10 //新关卡 + PlayType_enchant PlayType = 11 // 附魔副本 ) // Enum value maps for PlayType. @@ -106,6 +107,7 @@ var ( 8: "academy", 9: "heroteaching", 10: "combat", + 11: "enchant", } PlayType_value = map[string]int32{ "null": 0, @@ -119,6 +121,7 @@ var ( "academy": 8, "heroteaching": 9, "combat": 10, + "enchant": 11, } ) @@ -672,7 +675,7 @@ var file_battle_battle_db_proto_rawDesc = []byte{ 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, - 0x99, 0x01, 0x0a, 0x08, 0x50, 0x6c, 0x61, 0x79, 0x54, 0x79, 0x70, 0x65, 0x12, 0x08, 0x0a, 0x04, + 0xa6, 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, 0x74, 0x61, 0x73, 0x6b, 0x10, 0x03, 0x12, 0x0b, 0x0a, 0x07, 0x68, @@ -681,13 +684,14 @@ var file_battle_battle_db_proto_rawDesc = []byte{ 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, 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, + 0x0a, 0x0a, 0x06, 0x63, 0x6f, 0x6d, 0x62, 0x61, 0x74, 0x10, 0x0a, 0x12, 0x0b, 0x0a, 0x07, 0x65, + 0x6e, 0x63, 0x68, 0x61, 0x6e, 0x74, 0x10, 0x0b, 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 ( From 4bcd7562faea4346578a99aca957d85acb0a3175 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 20 Dec 2022 20:01:47 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=99=84=E9=AD=94=E5=85=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_item.json | 38 ++++++++++++++++++++++++++++++++ modules/enchant/api_getlist.go | 32 ++++++++++++++++++++++++++- modules/enchant/model_enchant.go | 14 ++---------- services/worker/main.go | 2 ++ 4 files changed, 73 insertions(+), 13 deletions(-) diff --git a/bin/json/game_item.json b/bin/json/game_item.json index 35ffb9aa1..56dca458e 100644 --- a/bin/json/game_item.json +++ b/bin/json/game_item.json @@ -2839,6 +2839,44 @@ "text": "竞技场挑战券不足" } }, + { + "id": "100005", + "name": { + "key": "itemname_100005", + "text": "阵营挑战券" + }, + "usetype": 10, + "color": 3, + "bagtype": 0, + "index": 1, + "special_type": 0, + "time": 0, + "effects": "", + "box_id": 0, + "synthetize_num": 0, + "access": [ + 107 + ], + "use_skip": 107, + "upper_limit": -1, + "uselv": 0, + "isani": 0, + "star": 0, + "race": 0, + "img": "wp_icon_jjcq", + "ico": "wp_icon_jjcq", + "intr": { + "key": "itemdesc_100005", + "text": "进入阵营BOSS的凭证" + }, + "sale": [], + "synthetize_deplete": [], + "decompose_deplete": [], + "tipstxt": { + "key": "itemtipstxt_100005", + "text": "阵营挑战券不足" + } + }, { "id": "110001", "name": { diff --git a/modules/enchant/api_getlist.go b/modules/enchant/api_getlist.go index 44dac3bdf..0aab71377 100644 --- a/modules/enchant/api_getlist.go +++ b/modules/enchant/api_getlist.go @@ -2,11 +2,13 @@ package enchant import ( "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/pb" "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/utils" + "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" ) @@ -28,7 +30,35 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.EnchantGetListRe } list, err := this.module.modelEnchant.getEnchantList(session.GetUserId()) - if err != nil { + if mgo.MongodbNil == err { + + list.Id = primitive.NewObjectID().Hex() + list.Uid = session.GetUserId() + list.Boss = make(map[int32]int64) + list.BossTime = make(map[int32]int32) + + _cfg := this.module.configure.GetEnchantBossTypeConfigData() + for k := range _cfg { + list.BossTime[k] = 0 + } + + this.module.modelEnchant.Add(session.GetUserId(), list) + conf := this.module.configure.GetGlobalConf() + if conf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + iContt := conf.EnchantbossInitial + atn := conf.EnchantbossCos + if iContt > 0 { + + this.module.DispenseRes(session, []*cfg.Gameatn{&cfg.Gameatn{ + A: atn.A, + T: atn.T, + N: iContt, + }}, true) + } + } else if err != nil { code = pb.ErrorCode_DBError return } diff --git a/modules/enchant/model_enchant.go b/modules/enchant/model_enchant.go index fd90439a3..5530710ac 100644 --- a/modules/enchant/model_enchant.go +++ b/modules/enchant/model_enchant.go @@ -3,7 +3,6 @@ package enchant import ( "go_dreamfactory/comm" "go_dreamfactory/lego/core" - "go_dreamfactory/lego/sys/mgo" "go_dreamfactory/modules" "go_dreamfactory/pb" @@ -40,19 +39,10 @@ func (this *modelEnchant) getEnchantList(uid string) (result *pb.DBEnchant, err Boss: make(map[int32]int64), BossTime: make(map[int32]int32), } - if err = this.Get(uid, result); err != nil && mgo.MongodbNil != err { - + if err = this.Get(uid, result); err != nil { return } - if mgo.MongodbNil == err { - if len(result.Boss) == 0 { - _cfg := this.module.configure.GetEnchantBossTypeConfigData() - for k := range _cfg { - result.BossTime[k] = 0 - } - } - this.Add(uid, result) - } + err = nil return result, err } diff --git a/services/worker/main.go b/services/worker/main.go index 3da7874fd..9c4cd6aeb 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -8,6 +8,7 @@ import ( "go_dreamfactory/modules/battle" "go_dreamfactory/modules/chat" "go_dreamfactory/modules/combat" + "go_dreamfactory/modules/enchant" "go_dreamfactory/modules/equipment" "go_dreamfactory/modules/forum" "go_dreamfactory/modules/friend" @@ -106,6 +107,7 @@ func main() { academy.NewModule(), reddot.NewModule(), combat.NewModule(), + enchant.NewModule(), ) } From 649432c30529a4916f0dcb498bfdc6469f3c6589 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 20 Dec 2022 20:33:12 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=BB=E7=BA=BF=20?= =?UTF-8?q?=E6=8B=9B=E5=8B=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/worldtask/api_finish.go | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/modules/worldtask/api_finish.go b/modules/worldtask/api_finish.go index debb8ab60..d07ea6e7d 100644 --- a/modules/worldtask/api_finish.go +++ b/modules/worldtask/api_finish.go @@ -108,6 +108,21 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe ) }() + for _, v := range curTaskConf.Reword { + if v.A == comm.HeroType { + hero = append(hero, v.T) + } + } + if len(hero) > 0 { + ishave := this.module.ModuleUser.CheckTujianHero(session, hero) + for i, v := range ishave { + if v { + newhero = append(newhero, hero[i]) + } + } + } + rsp.Newheros = newhero + // 完成任务 if err := this.module.modelWorldtask.finishTask(req.GroupId, req.TaskId, userTask); err != nil { code = pb.ErrorCode_WorldtaskFinish @@ -131,21 +146,6 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WorldtaskFinishRe ) } - for _, v := range curTaskConf.Reword { - if v.A == comm.HeroType { - hero = append(hero, v.T) - } - } - if len(hero) > 0 { - ishave := this.module.ModuleUser.CheckTujianHero(session, hero) - for i, v := range ishave { - if v { - newhero = append(newhero, hero[i]) - } - } - } - rsp.Newheros = newhero - } //判断任务是否已完成