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(), ) }