From 64e18214e4bb316ba57c231e48700221b516ab80 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Tue, 8 Nov 2022 10:02:08 +0800 Subject: [PATCH 1/8] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8D=8F=E8=AE=AE?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/sociaty/api_cross_mine.go | 2 +- modules/sociaty/api_cross_quit.go | 2 +- modules/sociaty/model_sociaty.go | 16 ++++++++++------ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/modules/sociaty/api_cross_mine.go b/modules/sociaty/api_cross_mine.go index 1ea9ef6ec..a147fdf91 100644 --- a/modules/sociaty/api_cross_mine.go +++ b/modules/sociaty/api_cross_mine.go @@ -55,7 +55,7 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (co if master != nil { //判断当前玩家是否是会长 if master.Uid == uid { //会长 - this.module.modelSociaty.extendJob(uid, sociaty) + this.module.modelSociaty.extendJob(master.Uid, sociaty) } } rsp.Sociaty = sociaty diff --git a/modules/sociaty/api_cross_quit.go b/modules/sociaty/api_cross_quit.go index c44860ba5..dd9e70163 100644 --- a/modules/sociaty/api_cross_quit.go +++ b/modules/sociaty/api_cross_quit.go @@ -63,7 +63,7 @@ func (this *apiComp) Quit(session comm.IUserSession, req *pb.SociatyQuitReq) (co Uid: uid, SociatyId: sociaty.Id, } - if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeDismiss, rsp); err != nil { + if err := session.SendMsg(string(this.module.GetType()), SociatySubTypeQuit, rsp); err != nil { code = pb.ErrorCode_SystemError } return diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index 63de1cdf3..1d1b6e2a9 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -569,22 +569,26 @@ 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 := time.Now().Unix() //48小时内终止弹劾 - if now-sociaty.AccuseTime < 48*3600 { + if now-sociaty.AccuseTime < int64(ggd.GuildImpeachmentCountDown*3600) { update := map[string]interface{}{ "accuseTime": 0, } return this.updateSociaty(sociaty.Id, update) } else { - //会长降为普通成员 - if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil { - return err - } //选举新会长 if err := this.electNewMaster(srcMasterId, sociaty); err != nil { return err } + //会长降为普通成员 + if err := this.settingJob(srcMasterId, pb.SociatyJob_MEMBER, sociaty); err != nil { + return err + } } } return nil @@ -602,7 +606,7 @@ func (this *ModelSociaty) electNewMaster(srcMasterId string, sociaty *pb.DBSocia vpIds = append(vpIds, m) } else if m.Job == pb.SociatyJob_ADMIN { aIds = append(aIds, m) - } else { + } else if m.Job == pb.SociatyJob_MEMBER { mIds = append(mIds, m) } } From 802a322f2a13ca7349b2d4126470371002278ed5 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 8 Nov 2022 10:26:59 +0800 Subject: [PATCH 2/8] =?UTF-8?q?=E8=B5=9B=E5=AD=A3=E5=A1=94=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=89=8B=E5=8A=A8=E6=BF=80=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_challengeover.go | 51 +++++++---------------------- 1 file changed, 12 insertions(+), 39 deletions(-) diff --git a/modules/pagoda/api_challengeover.go b/modules/pagoda/api_challengeover.go index 9c0d5d066..8902afa99 100644 --- a/modules/pagoda/api_challengeover.go +++ b/modules/pagoda/api_challengeover.go @@ -7,7 +7,6 @@ import ( "strconv" "time" - "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" ) @@ -24,10 +23,9 @@ func (this *apiComp) ChallengeOverCheck(session comm.IUserSession, req *pb.Pagod ///挑战主线关卡 func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChallengeOverReq) (code pb.ErrorCode, data proto.Message) { var ( - mapData map[string]interface{} - pagoda *pb.DBPagoda - seasonPagoda *pb.DBSeasonPagoda - costTime int32 // 本次战斗消耗的时间 + mapData map[string]interface{} + pagoda *pb.DBPagoda + costTime int32 // 本次战斗消耗的时间 ) mapData = make(map[string]interface{}, 0) code = this.ChallengeOverCheck(session, req) @@ -58,12 +56,12 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal } } else { // 塔数据校验 - seasonPagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) + pagoda, err = this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) if err != nil { code = pb.ErrorCode_PagodaNotFound return } - if seasonPagoda.Type != req.PagodaType || conf.LayerNum-1 != seasonPagoda.PagodaId { + if pagoda.Type != req.PagodaType || conf.LayerNum-1 != pagoda.PagodaId { code = pb.ErrorCode_PagodaLevlErr // 挑战关卡数据不匹配 return } @@ -119,32 +117,15 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal } // 普通塔通关了 Nomalcfg := this.module.configure.GetPagodaConfigData(comm.PagodaType, pagoda.PagodaId+1) - if Nomalcfg == nil { // 创建赛季塔数据 + if Nomalcfg == nil { // 修改expand 数据 update := map[string]interface{}{ "completePagoda": true, } this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), update) - seasonPagoda := &pb.DBSeasonPagoda{} - seasonPagoda.Id = primitive.NewObjectID().Hex() - - seasonPagoda.Uid = session.GetUserId() - seasonPagoda.PagodaId = 0 // 初始数据0层 - - if conn, err := db.Cross(); err == nil { - rst := conn.Mgo.FindOne(comm.TableServerData, bson.M{}) - server := &pb.DBServerData{} - rst.Decode(server) - seasonPagoda.Type = server.SeasonType // 动态获取塔数据 - } - this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), seasonPagoda) - // 推送新的 - pagoda.PagodaId = seasonPagoda.PagodaId - pagoda.Type = seasonPagoda.Type - session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: pagoda}) } } else { - seasonPagoda.PagodaId = conf.LayerNum + pagoda.PagodaId = conf.LayerNum mapData["pagodaId"] = conf.LayerNum // 记录爬塔明细数据 if req.Report != nil && req.Report.Info != nil && len(req.Report.Info.Redflist) > 0 { @@ -164,8 +145,8 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal newData := &pb.DBPagodaRecord{ Id: primitive.NewObjectID().Hex(), Uid: session.GetUserId(), - PagodaId: seasonPagoda.PagodaId, - Type: seasonPagoda.Type, + PagodaId: pagoda.PagodaId, + Type: pagoda.Type, Nickname: userinfo.Name, Icon: "", // icon 暂无 Lv: userinfo.Lv, @@ -175,24 +156,16 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PagodaChal // 数据写到跨服中 conn_, err := db.Cross() dbModel := db.NewDBModel(comm.TableSeasonRecord, time.Hour, conn_) - //if err = dbModel.GetList(uid, newData); err == nil { dbModel.AddList(uid, newData.Id, newData) this.module.SetPagodaRankList("pagodaList"+strconv.Itoa(int(newData.PagodaId)), newData.CostTime, newData.Id) - //} dbModelTable := db.NewDBModel(comm.TableSeasonPagoda, time.Hour, conn_) - if err = dbModelTable.Get(session.GetUserId(), seasonPagoda); err == nil { + if err = dbModelTable.Get(session.GetUserId(), pagoda); err == nil { dbModelTable.Change(session.GetUserId(), mapData) // 修改跨服数据 - this.module.SetPagodaRankList("pagodaSeasonRank", seasonPagoda.PagodaId<<8+costTime, session.GetUserId()) + this.module.SetPagodaRankList("pagodaSeasonRank", pagoda.PagodaId<<8+costTime, session.GetUserId()) } } code = this.module.ModifySeasonPagodaData(session.GetUserId(), mapData) - pagoda = &pb.DBPagoda{ - Id: seasonPagoda.Id, - Uid: seasonPagoda.Uid, - PagodaId: seasonPagoda.PagodaId, - Reward: seasonPagoda.Reward, - Type: seasonPagoda.Type, - } + session.SendMsg(string(this.module.GetType()), PagodaChallengeOverResp, &pb.PagodaChallengeOverResp{Data: pagoda}) } From faea3b1549c12ea501deaa0a6b86fe0a49c4dd2c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 8 Nov 2022 10:27:40 +0800 Subject: [PATCH 3/8] =?UTF-8?q?=E8=B5=9B=E5=AD=A3=E5=A1=94=E9=9C=80?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E6=BF=80=E6=B4=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_activate.go | 56 ++++++++ modules/pagoda/api_getlist.go | 21 +-- modules/pagoda/model_rank.go | 2 +- modules/pagoda/model_seasonpagoda.go | 6 +- modules/timer/season.go | 48 +------ modules/troll/api_getlist.go | 3 +- pb/pagoda_db.pb.go | 185 +++++++-------------------- 7 files changed, 107 insertions(+), 214 deletions(-) create mode 100644 modules/pagoda/api_activate.go diff --git a/modules/pagoda/api_activate.go b/modules/pagoda/api_activate.go new file mode 100644 index 000000000..3dcced3c2 --- /dev/null +++ b/modules/pagoda/api_activate.go @@ -0,0 +1,56 @@ +package pagoda + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" + "go_dreamfactory/sys/db" + + "go.mongodb.org/mongo-driver/bson" + "go.mongodb.org/mongo-driver/bson/primitive" + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) ActivateCheck(session comm.IUserSession, req *pb.PagodaActivateReq) (code pb.ErrorCode) { + + return +} + +///获取主线关卡信息 +func (this *apiComp) Activate(session comm.IUserSession, req *pb.PagodaActivateReq) (code pb.ErrorCode, data proto.Message) { + var ( + list *pb.DBPagoda + ) + this.ActivateCheck(session, req) + expand, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()) + if err != nil { + code = pb.ErrorCode_DBError + return + } + if expand.CompletePagoda { // 普通塔 + season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) + if season.Id == "" { + season.Id = primitive.NewObjectID().Hex() + season.Uid = session.GetUserId() + season.PagodaId = 0 // 初始数据0层 + if conn, err := db.Cross(); err == nil { + rst := conn.Mgo.FindOne(comm.TableServerData, bson.M{}) + server := &pb.DBServerData{} + rst.Decode(server) + season.Type = server.SeasonType + } + this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), season) + } + + list = &pb.DBPagoda{ + Id: season.Id, + Uid: season.Uid, + PagodaId: season.PagodaId, + Reward: season.Reward, + Type: season.Type, + } + } + + session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list}) + return +} diff --git a/modules/pagoda/api_getlist.go b/modules/pagoda/api_getlist.go index 569cbf36f..c4accec01 100644 --- a/modules/pagoda/api_getlist.go +++ b/modules/pagoda/api_getlist.go @@ -3,9 +3,7 @@ package pagoda import ( "go_dreamfactory/comm" "go_dreamfactory/pb" - "go_dreamfactory/sys/db" - "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "google.golang.org/protobuf/proto" ) @@ -41,24 +39,7 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq } else { season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) if season.Id == "" { - season.Id = primitive.NewObjectID().Hex() - season.Uid = session.GetUserId() - season.PagodaId = 0 // 初始数据0层 - if conn, err := db.Cross(); err == nil { - rst := conn.Mgo.FindOne(comm.TableServerData, bson.M{}) - server := &pb.DBServerData{} - rst.Decode(server) - season.Type = server.SeasonType - } - this.module.modelSeasonPagoda.addNewSeasonPagoda(session.GetUserId(), season) - } - - list = &pb.DBPagoda{ - Id: season.Id, - Uid: season.Uid, - PagodaId: season.PagodaId, - Reward: season.Reward, - Type: season.Type, + list.Complete = true } } diff --git a/modules/pagoda/model_rank.go b/modules/pagoda/model_rank.go index 421afef6b..759ebf9bc 100644 --- a/modules/pagoda/model_rank.go +++ b/modules/pagoda/model_rank.go @@ -80,7 +80,7 @@ func (this *ModelRank) getPagodaRankList(uid string) []*pb.DBPagodaRecord { } // 插入新的排行数据 -func (this *ModelRank) addPagodaRankList(session comm.IUserSession, data *pb.DBSeasonPagoda, Leadpos int32, line []*pb.LineUp, costTime int32) { +func (this *ModelRank) addPagodaRankList(session comm.IUserSession, data *pb.DBPagoda, Leadpos int32, line []*pb.LineUp, costTime int32) { uid := session.GetUserId() var ( dbModel *db.DBModel diff --git a/modules/pagoda/model_seasonpagoda.go b/modules/pagoda/model_seasonpagoda.go index 460c2d7ad..dd83c0d83 100644 --- a/modules/pagoda/model_seasonpagoda.go +++ b/modules/pagoda/model_seasonpagoda.go @@ -32,8 +32,8 @@ func (this *ModelSeasonPagoda) Init(service core.IService, module core.IModule, } // 获取爬塔信息 -func (this *ModelSeasonPagoda) getSeasonPagodaList(uid string) (result *pb.DBSeasonPagoda, err error) { - result = &pb.DBSeasonPagoda{} +func (this *ModelSeasonPagoda) getSeasonPagodaList(uid string) (result *pb.DBPagoda, err error) { + result = &pb.DBPagoda{} if err = this.Get(uid, result); err != nil { return @@ -48,7 +48,7 @@ func (this *ModelSeasonPagoda) modifySeasonPagodaDataByObjId(uid string, data ma } // 创建一个新的赛季塔数据 -func (this *ModelSeasonPagoda) addNewSeasonPagoda(uId string, data *pb.DBSeasonPagoda) (err error) { +func (this *ModelSeasonPagoda) addNewSeasonPagoda(uId string, data *pb.DBPagoda) (err error) { //err = this.InsertModelLogs(this.TableName, uId, []interface{}{data}) // 不需要经过redis if err = this.Add(uId, data); err != nil { this.module.Errorf("err:%v", err) diff --git a/modules/timer/season.go b/modules/timer/season.go index 903db58c8..76367e63e 100644 --- a/modules/timer/season.go +++ b/modules/timer/season.go @@ -62,7 +62,7 @@ func (this *SeasonPagoda) Start() (err error) { return } func (this *SeasonPagoda) CreatTestData(index int) { - seasonPagoda := &pb.DBSeasonPagoda{} + seasonPagoda := &pb.DBPagoda{} seasonPagoda.Id = primitive.NewObjectID().Hex() seasonPagoda.Uid = "dfmxf_634f8f28609d489230fb40fa" @@ -166,49 +166,3 @@ func (this *SeasonPagoda) TimerSeasonOver() { func (this *SeasonPagoda) TimerSeasonStar() { this.module.Debugf("TimerSeasonStar:%d", time.Now().Unix()) } - -// 测试用 后面删 -func (this *SeasonPagoda) TestFunc() { - // newData1 := &pb.DBSeasonPagoda{ - // Id: primitive.NewObjectID().Hex(), - // Uid: "sdsdassd", - // PagodaId: 1, - // Reward: map[int32]bool{}, - // Type: 201, - // } - // if conn, err := db.Cross(); err == nil { - // rst, err := conn.Mgo.InsertOne(comm.TableSeasonPagoda, newData) - - // fmt.Printf("%v,%v", rst, err) - // } - // _data := this.GetSeasonLoop(2) - // this.module.Debugf("%v", _data) - // for i := 0; i < 10000; i++ { - // this.CreatTestData(i) - // } - - // if conn, err := db.Cross(); err == nil { - // rst := conn.Mgo.FindOne(comm.TableServerData, bson.M{}) - // server := &pb.DBServerData{} - // rst.Decode(server) - // fmt.Printf("%v", server) - // } - - // newData := &pb.DBPagodaRecord{ - // Id: primitive.NewObjectID().Hex(), - // Uid: "sdsd", - // PagodaId: 1, - // Type: 2, - // Nickname: "userinfo.Name", - // Icon: "", // icon 暂无 - // Lv: 12, - // CostTime: 12000, - // } - // // 数据写到跨服中 - // if !db.IsCross() { - // if conn, err := db.Cross(); err == nil { - // conn.Mgo.InsertOne(comm.TableSeasonRecord, newData) - // } - // } - //this.TimerSeasonOver() -} diff --git a/modules/troll/api_getlist.go b/modules/troll/api_getlist.go index f4864b4c9..c14423e32 100644 --- a/modules/troll/api_getlist.go +++ b/modules/troll/api_getlist.go @@ -79,7 +79,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq) if trolltrain.Circle != c { trolltrain.SurpriseID = make(map[int32]int32, 0) n, _ := rand.Int(rand.Reader, big.NewInt(int64(trainNum))) - n2, _ := rand.Int(rand.Reader, big.NewInt(int64(maxCoefficient-1))) //算的是下标所以-1 + goods := this.configure.GetTrollAllGoods() + n2, _ := rand.Int(rand.Reader, big.NewInt(int64(len(goods)-1))) //算的是下标所以-1 trolltrain.SurpriseID[int32(n.Int64())+1] = int32(n2.Int64()) + 1 update["surpriseID"] = trolltrain.SurpriseID trolltrain.Circle = c diff --git a/pb/pagoda_db.pb.go b/pb/pagoda_db.pb.go index 527473ceb..6a808b331 100644 --- a/pb/pagoda_db.pb.go +++ b/pb/pagoda_db.pb.go @@ -31,6 +31,7 @@ type DBPagoda struct { PagodaId int32 `protobuf:"varint,3,opt,name=pagodaId,proto3" json:"pagodaId" bson:"pagodaId"` //塔层 Reward map[int32]bool `protobuf:"bytes,4,rep,name=reward,proto3" json:"reward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 是否领奖 Type int32 `protobuf:"varint,5,opt,name=type,proto3" json:"type"` + Complete bool `protobuf:"varint,6,opt,name=complete,proto3" json:"complete"` // 是否通关 } func (x *DBPagoda) Reset() { @@ -100,84 +101,11 @@ func (x *DBPagoda) GetType() int32 { return 0 } -// 赛季塔 赛季结束会清理 -type DBSeasonPagoda struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID - Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID - PagodaId int32 `protobuf:"varint,3,opt,name=pagodaId,proto3" json:"pagodaId" bson:"pagodaId"` //塔层 - Reward map[int32]bool `protobuf:"bytes,4,rep,name=reward,proto3" json:"reward" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 是否领奖 - Type int32 `protobuf:"varint,5,opt,name=type,proto3" json:"type"` -} - -func (x *DBSeasonPagoda) Reset() { - *x = DBSeasonPagoda{} - if protoimpl.UnsafeEnabled { - mi := &file_pagoda_pagoda_db_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DBSeasonPagoda) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DBSeasonPagoda) ProtoMessage() {} - -func (x *DBSeasonPagoda) ProtoReflect() protoreflect.Message { - mi := &file_pagoda_pagoda_db_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 DBSeasonPagoda.ProtoReflect.Descriptor instead. -func (*DBSeasonPagoda) Descriptor() ([]byte, []int) { - return file_pagoda_pagoda_db_proto_rawDescGZIP(), []int{1} -} - -func (x *DBSeasonPagoda) GetId() string { +func (x *DBPagoda) GetComplete() bool { if x != nil { - return x.Id + return x.Complete } - return "" -} - -func (x *DBSeasonPagoda) GetUid() string { - if x != nil { - return x.Uid - } - return "" -} - -func (x *DBSeasonPagoda) GetPagodaId() int32 { - if x != nil { - return x.PagodaId - } - return 0 -} - -func (x *DBSeasonPagoda) GetReward() map[int32]bool { - if x != nil { - return x.Reward - } - return nil -} - -func (x *DBSeasonPagoda) GetType() int32 { - if x != nil { - return x.Type - } - return 0 + return false } // 爬塔数据明细 @@ -201,7 +129,7 @@ type DBPagodaRecord struct { func (x *DBPagodaRecord) Reset() { *x = DBPagodaRecord{} if protoimpl.UnsafeEnabled { - mi := &file_pagoda_pagoda_db_proto_msgTypes[2] + mi := &file_pagoda_pagoda_db_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -214,7 +142,7 @@ func (x *DBPagodaRecord) String() string { func (*DBPagodaRecord) ProtoMessage() {} func (x *DBPagodaRecord) ProtoReflect() protoreflect.Message { - mi := &file_pagoda_pagoda_db_proto_msgTypes[2] + mi := &file_pagoda_pagoda_db_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -227,7 +155,7 @@ func (x *DBPagodaRecord) ProtoReflect() protoreflect.Message { // Deprecated: Use DBPagodaRecord.ProtoReflect.Descriptor instead. func (*DBPagodaRecord) Descriptor() ([]byte, []int) { - return file_pagoda_pagoda_db_proto_rawDescGZIP(), []int{2} + return file_pagoda_pagoda_db_proto_rawDescGZIP(), []int{1} } func (x *DBPagodaRecord) GetId() string { @@ -306,7 +234,7 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{ 0x0a, 0x16, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x2f, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x5f, 0x64, 0x62, 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, 0xc6, 0x01, 0x0a, 0x08, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x12, 0x0e, + 0x6f, 0x22, 0xe2, 0x01, 0x0a, 0x08, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, @@ -314,41 +242,29 @@ var file_pagoda_pagoda_db_proto_rawDesc = []byte{ 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x2e, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x1a, - 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, - 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, - 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xd2, 0x01, 0x0a, 0x0e, 0x44, - 0x42, 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x12, 0x0e, 0x0a, - 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, - 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, - 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, 0x12, 0x33, 0x0a, 0x06, 0x72, - 0x65, 0x77, 0x61, 0x72, 0x64, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x44, 0x42, - 0x53, 0x65, 0x61, 0x73, 0x6f, 0x6e, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x2e, 0x52, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, - 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, - 0xf5, 0x01, 0x0a, 0x0e, 0x44, 0x42, 0x50, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x52, 0x65, 0x63, 0x6f, - 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, - 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, - 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, - 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x1b, - 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x4c, - 0x69, 0x6e, 0x65, 0x55, 0x70, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, - 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, - 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, + 0x08, 0x52, 0x08, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x1a, 0x39, 0x0a, 0x0b, 0x52, + 0x65, 0x77, 0x61, 0x72, 0x64, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, + 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x61, 0x6c, + 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0xf5, 0x01, 0x0a, 0x0e, 0x44, 0x42, 0x50, 0x61, 0x67, + 0x6f, 0x64, 0x61, 0x52, 0x65, 0x63, 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, + 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, + 0x61, 0x67, 0x6f, 0x64, 0x61, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6e, + 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, + 0x69, 0x63, 0x6b, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x69, 0x63, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x6c, + 0x76, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x18, 0x0a, 0x07, 0x6c, + 0x65, 0x61, 0x64, 0x70, 0x6f, 0x73, 0x18, 0x08, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x6c, 0x65, + 0x61, 0x64, 0x70, 0x6f, 0x73, 0x12, 0x1b, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x09, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x4c, 0x69, 0x6e, 0x65, 0x55, 0x70, 0x52, 0x04, 0x6c, 0x69, + 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x18, 0x0a, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x63, 0x6f, 0x73, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -363,24 +279,21 @@ func file_pagoda_pagoda_db_proto_rawDescGZIP() []byte { return file_pagoda_pagoda_db_proto_rawDescData } -var file_pagoda_pagoda_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_pagoda_pagoda_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_pagoda_pagoda_db_proto_goTypes = []interface{}{ (*DBPagoda)(nil), // 0: DBPagoda - (*DBSeasonPagoda)(nil), // 1: DBSeasonPagoda - (*DBPagodaRecord)(nil), // 2: DBPagodaRecord - nil, // 3: DBPagoda.RewardEntry - nil, // 4: DBSeasonPagoda.RewardEntry - (*LineUp)(nil), // 5: LineUp + (*DBPagodaRecord)(nil), // 1: DBPagodaRecord + nil, // 2: DBPagoda.RewardEntry + (*LineUp)(nil), // 3: LineUp } var file_pagoda_pagoda_db_proto_depIdxs = []int32{ - 3, // 0: DBPagoda.reward:type_name -> DBPagoda.RewardEntry - 4, // 1: DBSeasonPagoda.reward:type_name -> DBSeasonPagoda.RewardEntry - 5, // 2: DBPagodaRecord.line:type_name -> LineUp - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 2, // 0: DBPagoda.reward:type_name -> DBPagoda.RewardEntry + 3, // 1: DBPagodaRecord.line:type_name -> LineUp + 2, // [2:2] is the sub-list for method output_type + 2, // [2:2] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_pagoda_pagoda_db_proto_init() } @@ -403,18 +316,6 @@ func file_pagoda_pagoda_db_proto_init() { } } file_pagoda_pagoda_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DBSeasonPagoda); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_pagoda_pagoda_db_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DBPagodaRecord); i { case 0: return &v.state @@ -433,7 +334,7 @@ func file_pagoda_pagoda_db_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pagoda_pagoda_db_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 3, NumExtensions: 0, NumServices: 0, }, From 5129f9de68cff90baa88ea3fe0f2c0efac37deb5 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Tue, 8 Nov 2022 10:59:36 +0800 Subject: [PATCH 4/8] =?UTF-8?q?=E4=B8=96=E7=95=8C=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_taskcond.json | 65 ++ bin/json/game_tasktype.json | 659 ++++++++++++++++++++ bin/json/game_worldtask.json | 325 ++++++++++ comm/const.go | 5 +- modules/worldtask/api.go | 19 + modules/worldtask/configure.go | 23 + modules/worldtask/model_worldtask.go | 19 + modules/worldtask/module.go | 26 + sys/configure/structs/Game.TaskCond.go | 42 ++ sys/configure/structs/Game.TaskCondData.go | 47 ++ sys/configure/structs/Game.TaskType.go | 42 ++ sys/configure/structs/Game.TaskTypeData.go | 47 ++ sys/configure/structs/Game.WorldTask.go | 42 ++ sys/configure/structs/Game.WorldTaskData.go | 87 +++ 14 files changed, 1447 insertions(+), 1 deletion(-) create mode 100644 bin/json/game_taskcond.json create mode 100644 bin/json/game_tasktype.json create mode 100644 bin/json/game_worldtask.json create mode 100644 modules/worldtask/api.go create mode 100644 modules/worldtask/configure.go create mode 100644 modules/worldtask/model_worldtask.go create mode 100644 modules/worldtask/module.go create mode 100644 sys/configure/structs/Game.TaskCond.go create mode 100644 sys/configure/structs/Game.TaskCondData.go create mode 100644 sys/configure/structs/Game.TaskType.go create mode 100644 sys/configure/structs/Game.TaskTypeData.go create mode 100644 sys/configure/structs/Game.WorldTask.go create mode 100644 sys/configure/structs/Game.WorldTaskData.go diff --git a/bin/json/game_taskcond.json b/bin/json/game_taskcond.json new file mode 100644 index 000000000..7cd5be3ab --- /dev/null +++ b/bin/json/game_taskcond.json @@ -0,0 +1,65 @@ +[ + { + "id": 101, + "type": 1, + "data1": 25001, + "data2": 40, + "data3": 5, + "data4": 0, + "data5": 0 + }, + { + "id": 102, + "type": 2, + "data1": 3, + "data2": 0, + "data3": 0, + "data4": 0, + "data5": 0 + }, + { + "id": 103, + "type": 3, + "data1": 2, + "data2": 0, + "data3": 0, + "data4": 0, + "data5": 0 + }, + { + "id": 104, + "type": 4, + "data1": 14007, + "data2": 10, + "data3": 0, + "data4": 0, + "data5": 0 + }, + { + "id": 105, + "type": 5, + "data1": 25001, + "data2": 2, + "data3": 0, + "data4": 0, + "data5": 0 + }, + { + "id": 106, + "type": 6, + "data1": 25004, + "data2": 5, + "data3": 0, + "data4": 0, + "data5": 0 + }, + { + "id": 107, + "type": 7, + "data1": 1, + "data2": 0, + "data3": 0, + "data4": 0, + "data5": 0 + } +] \ No newline at end of file diff --git a/bin/json/game_tasktype.json b/bin/json/game_tasktype.json new file mode 100644 index 000000000..4287ebcbf --- /dev/null +++ b/bin/json/game_tasktype.json @@ -0,0 +1,659 @@ +[ + { + "id": 1, + "datatype": 0, + "desc": "英雄指定", + "data1": "英雄ID", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 2, + "datatype": 0, + "desc": "主线之内触发了剧情Id", + "data1": "剧情ID", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 3, + "datatype": 0, + "desc": "每日任务", + "data1": "任务ID", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 4, + "datatype": 0, + "desc": "指定英雄的等级限制", + "data1": "英雄ID", + "data2": "填写英雄需要的等级", + "data3": "", + "data4": "" + }, + { + "id": 5, + "datatype": 0, + "desc": "指定英雄的装备数量", + "data1": "英雄ID", + "data2": "填写装备数量", + "data3": "", + "data4": "" + }, + { + "id": 6, + "datatype": 0, + "desc": "指定英雄的星级", + "data1": "英雄ID", + "data2": "填写星级", + "data3": "", + "data4": "" + }, + { + "id": 7, + "datatype": 0, + "desc": "日常登录一次", + "data1": "日常登录次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 8, + "datatype": 0, + "desc": "累计登陆xx天", + "data1": "登录天数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 9, + "datatype": 0, + "desc": "连续登陆xx天", + "data1": "登录天数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 10, + "datatype": 0, + "desc": "拥有xx个好友", + "data1": "拥有的好友数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 11, + "datatype": 0, + "desc": "赠送X次友情点", + "data1": "赠送次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 12, + "datatype": 0, + "desc": "使用好友助战英雄xx次", + "data1": "使用好友助战英雄次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 13, + "datatype": 0, + "desc": "更换X次助战英雄", + "data1": "更换次数数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 14, + "datatype": 0, + "desc": "累计xx次普通招募", + "data1": "累计招募次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 15, + "datatype": 0, + "desc": "累计xx次阵营招募", + "data1": "累计招募次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 16, + "datatype": 0, + "desc": "招募获得xx品质英雄xx个", + "data1": "获得英雄数量", + "data2": "品质", + "data3": "", + "data4": "" + }, + { + "id": 17, + "datatype": 0, + "desc": "普通招募十连,获得xx个以上xx星英雄", + "data1": "获得个数", + "data2": "星级", + "data3": "", + "data4": "" + }, + { + "id": 18, + "datatype": 0, + "desc": "xx次普通招募", + "data1": "招募次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 19, + "datatype": 0, + "desc": "xx次阵营招募", + "data1": "招募次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 20, + "datatype": 0, + "desc": "用户等级达到xx级", + "data1": "等级", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 21, + "datatype": 0, + "desc": "英雄合成xx次", + "data1": "合成次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 22, + "datatype": 0, + "desc": "合成xx英雄", + "data1": "英雄ID", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 23, + "datatype": 0, + "desc": "拥有xx个xx星级的xx等级英雄", + "data1": "拥有数量", + "data2": "", + "data3": "等级", + "data4": "" + }, + { + "id": 24, + "datatype": 0, + "desc": "为任意英雄提升xx次等级", + "data1": "提升等级次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 25, + "datatype": 0, + "desc": "xx名xx英雄升至xx星", + "data1": "共计要升几名英雄", + "data2": "英雄ID", + "data3": "星级", + "data4": "" + }, + { + "id": 26, + "datatype": 0, + "desc": "xx名英雄从三星升四星", + "data1": "升星的英雄数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 27, + "datatype": 0, + "desc": "xx名英雄从四星升五星", + "data1": "升星的英雄数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 28, + "datatype": 0, + "desc": "xx名英雄从五星升六星", + "data1": "升星的英雄数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 29, + "datatype": 0, + "desc": "拥有xx个xx级及以上的【xx】英雄", + "data1": "拥有数量", + "data2": "等级", + "data3": "英雄ID", + "data4": "" + }, + { + "id": 30, + "datatype": 0, + "desc": "获得xx个品质为xx的英雄", + "data1": "获得数量", + "data2": "品质", + "data3": "", + "data4": "" + }, + { + "id": 31, + "datatype": 0, + "desc": "获得xx个品质为xx以上的英雄", + "data1": "获得数量", + "data2": "品质", + "data3": "", + "data4": "" + }, + { + "id": 32, + "datatype": 0, + "desc": "xx个品质为xx的英雄升到xx级", + "data1": "满足条件的英雄数量", + "data2": "满足条件的英雄品质", + "data3": "需要升到的等级", + "data4": "" + }, + { + "id": 33, + "datatype": 0, + "desc": "xx个品质为xx以及以上英雄升到xx级", + "data1": "满足条件的英雄数量", + "data2": "满足条件的英雄品质", + "data3": "需要升到的等级", + "data4": "" + }, + { + "id": 34, + "datatype": 0, + "desc": "xx个英雄觉醒达到xx阶段", + "data1": "英雄数量", + "data2": "觉醒阶段", + "data3": "", + "data4": "" + }, + { + "id": 35, + "datatype": 0, + "desc": "xx英雄觉醒达到xx阶段", + "data1": "觉醒阶段", + "data2": "英雄ID", + "data3": "", + "data4": "" + }, + { + "id": 36, + "datatype": 0, + "desc": "xx位xx品质xx职业英雄(xx阵营)觉醒达到xx阶段", + "data1": "数量", + "data2": "英雄品质", + "data3": "指定职业", + "data4": "指定阵营" + }, + { + "id": 37, + "datatype": 0, + "desc": "xx名xx品质英雄满共鸣、等级、觉醒", + "data1": "数量", + "data2": "英雄品质", + "data3": "", + "data4": "" + }, + { + "id": 38, + "datatype": 0, + "desc": "xx英雄满级、共鸣、觉醒至最高状态", + "data1": "数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 39, + "datatype": 0, + "desc": "累计英雄共鸣xx次", + "data1": "共鸣次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 40, + "datatype": 0, + "desc": "xx个英雄共鸣满xx次", + "data1": "英雄数量", + "data2": "共鸣次数", + "data3": "", + "data4": "" + }, + { + "id": 41, + "datatype": 0, + "desc": "xx名英雄穿戴xx件xx星级的装备", + "data1": "英雄数量", + "data2": "装备数量", + "data3": "指定星级", + "data4": "" + }, + { + "id": 42, + "datatype": 0, + "desc": "xx名英雄穿戴xx件xx等级的装备", + "data1": "英雄数量", + "data2": "装备数量", + "data3": "指定等级", + "data4": "" + }, + { + "id": 43, + "datatype": 0, + "desc": "将xx件装备强化至xx级", + "data1": "数量", + "data2": "等级", + "data3": "", + "data4": "" + }, + { + "id": 44, + "datatype": 0, + "desc": "任意装备强化到xx级", + "data1": "强化等级", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 45, + "datatype": 0, + "desc": "将xx件xx星【xx】套装装备强化至xx级", + "data1": "数量", + "data2": "指定装备星级", + "data3": "指定套装", + "data4": "强化等级" + }, + { + "id": 46, + "datatype": 0, + "desc": "为xx名英雄穿戴完整xx星【xx】套装装备", + "data1": "数量", + "data2": "指定装备星级", + "data3": "指定套装", + "data4": "" + }, + { + "id": 47, + "datatype": 0, + "desc": "累计强化装备成功xx次", + "data1": "数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 48, + "datatype": 0, + "desc": "xx次xx星的二件套装备强化至xx并穿戴", + "data1": "次数", + "data2": "指定装备星级", + "data3": "强化等级", + "data4": "" + }, + { + "id": 49, + "datatype": 0, + "desc": "xx次xx星的四件套装备强化至xx并穿戴", + "data1": "次数", + "data2": "指定装备星级", + "data3": "强化等级", + "data4": "" + }, + { + "id": 50, + "datatype": 0, + "desc": "获得xx星以上装备xx件", + "data1": "数量", + "data2": "指定装备星级", + "data3": "", + "data4": "" + }, + { + "id": 51, + "datatype": 0, + "desc": "在铁匠铺中获得xx件xx星装备", + "data1": "数量", + "data2": "指定装备品质", + "data3": "", + "data4": "" + }, + { + "id": 52, + "datatype": 0, + "desc": "xx英雄提升xx次技能等级", + "data1": "提升技能次数", + "data2": "指定英雄", + "data3": "", + "data4": "" + }, + { + "id": 53, + "datatype": 0, + "desc": "技能升级累计xx次", + "data1": "累计提升次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 54, + "datatype": 0, + "desc": "x名卡牌角色技能全满级", + "data1": "满技能卡片角色数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 55, + "datatype": 0, + "desc": "xx品质英雄提升xx次技能等级", + "data1": "次数", + "data2": "指定品质", + "data3": "", + "data4": "" + }, + { + "id": 56, + "datatype": 0, + "desc": "拥有xx名技能升级xx次的xx职业英雄", + "data1": "数量", + "data2": "技能升级次数", + "data3": "指定职业", + "data4": "" + }, + { + "id": 57, + "datatype": 0, + "desc": "xx名英雄技能满级", + "data1": "数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 58, + "datatype": 0, + "desc": "通关任意普通爬塔层数", + "data1": "次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 59, + "datatype": 0, + "desc": "通关普通爬塔xx层", + "data1": "层数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 60, + "datatype": 0, + "desc": "任意主线副本通关X次", + "data1": "次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 61, + "datatype": 0, + "desc": "通关主线关卡xx", + "data1": "关卡ID", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 62, + "datatype": 0, + "desc": "世界聊天发言xx次", + "data1": "次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 63, + "datatype": 0, + "desc": "日常任务活跃度达到xx", + "data1": "活跃值", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 64, + "datatype": 0, + "desc": "任意商品购买xx次", + "data1": "次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 65, + "datatype": 0, + "desc": "在商店购买xx商品xx件", + "data1": "数量", + "data2": "道具ID", + "data3": "", + "data4": "" + }, + { + "id": 66, + "datatype": 0, + "desc": "xx商店购买任意商品xx次", + "data1": "数量", + "data2": "商店ID", + "data3": "", + "data4": "" + }, + { + "id": 67, + "datatype": 0, + "desc": "商店购物消耗xx货币xx个", + "data1": "数量", + "data2": "货币ID", + "data3": "", + "data4": "" + }, + { + "id": 68, + "datatype": 0, + "desc": "任意渠道消耗xx金币", + "data1": "金币消耗的数量", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 69, + "datatype": 0, + "desc": "与其他玩家切磋xx次", + "data1": "切磋次数", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 70, + "datatype": 0, + "desc": "通关随机任务XX关卡", + "data1": "通关的关卡ID", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 71, + "datatype": 0, + "desc": "主角等级达到X级", + "data1": "等级", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 72, + "datatype": 0, + "desc": "完成一次创角", + "data1": "", + "data2": "", + "data3": "", + "data4": "" + }, + { + "id": 73, + "datatype": 0, + "desc": "完成一段剧情表内的对话", + "data1": "", + "data2": "", + "data3": "", + "data4": "" + } +] \ No newline at end of file diff --git a/bin/json/game_worldtask.json b/bin/json/game_worldtask.json new file mode 100644 index 000000000..de94e6994 --- /dev/null +++ b/bin/json/game_worldtask.json @@ -0,0 +1,325 @@ +[ + { + "key": 10100, + "lock": 1, + "ontxe": 0, + "id_after": 10101, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "阿宝组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 0, + "overtips": 1, + "reword": [] + }, + { + "key": 10101, + "lock": 1, + "ontxe": 10100, + "id_after": 10102, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "邦尼兔组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10102, + "lock": 1, + "ontxe": 10101, + "id_after": 10103, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "波比组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10103, + "lock": 1, + "ontxe": 10102, + "id_after": 10104, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "阿宝组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10104, + "lock": 1, + "ontxe": 10103, + "id_after": 10105, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "阿宝组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10106, + "lock": 1, + "ontxe": 10105, + "id_after": 10107, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "邦尼兔组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10107, + "lock": 1, + "ontxe": 10106, + "id_after": 10108, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "阿宝组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10108, + "lock": 1, + "ontxe": 10107, + "id_after": 10109, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "", + "getafter_event": [ + "6", + "跳转铁匠铺3D场景" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10109, + "lock": 1, + "ontxe": 10108, + "id_after": 10110, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "阿宝组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10110, + "lock": 1, + "ontxe": 10109, + "id_after": 10111, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "", + "getafter_event": [ + "6", + "跳转美食馆外面的3D场景" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10111, + "lock": 1, + "ontxe": 10110, + "id_after": 10112, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "瓜哥组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10112, + "lock": 1, + "ontxe": 10111, + "id_after": 10113, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "瓜哥组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10113, + "lock": 1, + "ontxe": 10112, + "id_after": 10114, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "", + "getafter_event": [ + "6", + "跳转美食馆内3D场景" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10114, + "lock": 1, + "ontxe": 10113, + "id_after": 10115, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "", + "getafter_event": [ + "3", + "播放timeline" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10115, + "lock": 1, + "ontxe": 10114, + "id_after": 10116, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "阿宝组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10116, + "lock": 1, + "ontxe": 10115, + "id_after": 10117, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "", + "getafter_event": [ + "6", + "开启书籍玩法" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + }, + { + "key": 10117, + "lock": 1, + "ontxe": 10116, + "id_after": 10118, + "des": 2, + "icon": "", + "task_name": "", + "task_display": "", + "npc": "阿宝组件名", + "getafter_event": [ + "2", + "20" + ], + "completetask": 0, + "auto_accept": 1, + "overtips": 1, + "reword": [] + } +] \ No newline at end of file diff --git a/comm/const.go b/comm/const.go index e0c85cc35..c6a66f8b2 100644 --- a/comm/const.go +++ b/comm/const.go @@ -72,7 +72,8 @@ const ( ModulePay core.M_Modules = "pay" //支付 ModuleAlliance core.M_Modules = "alliance" //联盟学院 ModulePrivilege core.M_Modules = "privilege" //特权 - ModuleGrowtask core.M_Modules = "growtask" //成长任务 + ModuleGrowtask core.M_Modules = "growtask" //成长任务 + ModuleWorldtask core.M_Modules = "worldtask" //世界任务 ) //数据表名定义处 @@ -196,6 +197,8 @@ const ( TableSign = "sign" // 成长任务 TableGrowtask = "growtask" + // 世界任务 + TableWorldtask = "worldtask" ) //RPC服务接口定义处 diff --git a/modules/worldtask/api.go b/modules/worldtask/api.go new file mode 100644 index 000000000..81927be14 --- /dev/null +++ b/modules/worldtask/api.go @@ -0,0 +1,19 @@ +package worldtask + +import ( + "go_dreamfactory/lego/base" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type apiComp struct { + modules.MCompGate + service base.IRPCXService + module *Worldtask +} + +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.(*Worldtask) + return +} diff --git a/modules/worldtask/configure.go b/modules/worldtask/configure.go new file mode 100644 index 000000000..130ef9a61 --- /dev/null +++ b/modules/worldtask/configure.go @@ -0,0 +1,23 @@ +package worldtask + +import ( + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +const ( + gameWorldTask = "game_worldtask.json" +) + +type configureComp struct { + modules.MCompConfigure +} + +func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompConfigure.Init(service, module, comp, options) + err = this.LoadMultiConfigure(map[string]interface{}{ + // gameGrowreward: cfg.NewGameGrowReward, + // gameGrowTask: cfg.NewGameGrowTask, + }) + return +} diff --git a/modules/worldtask/model_worldtask.go b/modules/worldtask/model_worldtask.go new file mode 100644 index 000000000..15456ec1b --- /dev/null +++ b/modules/worldtask/model_worldtask.go @@ -0,0 +1,19 @@ +package worldtask + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type ModelWorldtask struct { + modules.MCompModel + moduleWorldtask *Worldtask +} + +func (this *ModelWorldtask) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { + err = this.MCompModel.Init(service, module, comp, options) + this.TableName = comm.TableWorldtask + this.moduleWorldtask = module.(*Worldtask) + return +} diff --git a/modules/worldtask/module.go b/modules/worldtask/module.go new file mode 100644 index 000000000..0fc23e088 --- /dev/null +++ b/modules/worldtask/module.go @@ -0,0 +1,26 @@ +package worldtask + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/base" + "go_dreamfactory/lego/core" + "go_dreamfactory/modules" +) + +type Worldtask struct { + modules.ModuleBase + api *apiComp + service base.IRPCXService + configure *configureComp +} + +func NewModule() core.IModule { + return &Worldtask{} +} +func (this *Worldtask) Init(service core.IService, module core.IModule, options core.IModuleOptions) (err error) { + err = this.ModuleBase.Init(service, module, options) + return +} +func (this *Worldtask) GetType() core.M_Modules { + return comm.ModuleWorldtask +} diff --git a/sys/configure/structs/Game.TaskCond.go b/sys/configure/structs/Game.TaskCond.go new file mode 100644 index 000000000..0185feed8 --- /dev/null +++ b/sys/configure/structs/Game.TaskCond.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 GameTaskCond struct { + _dataMap map[int32]*GameTaskCondData + _dataList []*GameTaskCondData +} + +func NewGameTaskCond(_buf []map[string]interface{}) (*GameTaskCond, error) { + _dataList := make([]*GameTaskCondData, 0, len(_buf)) + dataMap := make(map[int32]*GameTaskCondData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameTaskCondData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &GameTaskCond{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameTaskCond) GetDataMap() map[int32]*GameTaskCondData { + return table._dataMap +} + +func (table *GameTaskCond) GetDataList() []*GameTaskCondData { + return table._dataList +} + +func (table *GameTaskCond) Get(key int32) *GameTaskCondData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.TaskCondData.go b/sys/configure/structs/Game.TaskCondData.go new file mode 100644 index 000000000..fcea43388 --- /dev/null +++ b/sys/configure/structs/Game.TaskCondData.go @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// +// 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 GameTaskCondData struct { + Id int32 + Type int32 + Data1 int32 + Data2 int32 + Data3 int32 + Data4 int32 + Data5 int32 +} + +const TypeId_GameTaskCondData = -1719868659 + +func (*GameTaskCondData) GetTypeId() int32 { + return -1719868659 +} + +func (_v *GameTaskCondData)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 _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data1"].(float64); !_ok_ { err = errors.New("data1 error"); return }; _v.Data1 = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data2"].(float64); !_ok_ { err = errors.New("data2 error"); return }; _v.Data2 = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data3"].(float64); !_ok_ { err = errors.New("data3 error"); return }; _v.Data3 = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data4"].(float64); !_ok_ { err = errors.New("data4 error"); return }; _v.Data4 = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data5"].(float64); !_ok_ { err = errors.New("data5 error"); return }; _v.Data5 = int32(_tempNum_) } + return +} + +func DeserializeGameTaskCondData(_buf map[string]interface{}) (*GameTaskCondData, error) { + v := &GameTaskCondData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.TaskType.go b/sys/configure/structs/Game.TaskType.go new file mode 100644 index 000000000..b6325cb52 --- /dev/null +++ b/sys/configure/structs/Game.TaskType.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 GameTaskType struct { + _dataMap map[int32]*GameTaskTypeData + _dataList []*GameTaskTypeData +} + +func NewGameTaskType(_buf []map[string]interface{}) (*GameTaskType, error) { + _dataList := make([]*GameTaskTypeData, 0, len(_buf)) + dataMap := make(map[int32]*GameTaskTypeData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameTaskTypeData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Id] = _v + } + } + return &GameTaskType{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameTaskType) GetDataMap() map[int32]*GameTaskTypeData { + return table._dataMap +} + +func (table *GameTaskType) GetDataList() []*GameTaskTypeData { + return table._dataList +} + +func (table *GameTaskType) Get(key int32) *GameTaskTypeData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.TaskTypeData.go b/sys/configure/structs/Game.TaskTypeData.go new file mode 100644 index 000000000..9294b950d --- /dev/null +++ b/sys/configure/structs/Game.TaskTypeData.go @@ -0,0 +1,47 @@ +//------------------------------------------------------------------------------ +// +// 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 GameTaskTypeData struct { + Id int32 + Datatype int32 + Desc string + Data1 string + Data2 string + Data3 string + Data4 string +} + +const TypeId_GameTaskTypeData = -1813579995 + +func (*GameTaskTypeData) GetTypeId() int32 { + return -1813579995 +} + +func (_v *GameTaskTypeData)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 _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["datatype"].(float64); !_ok_ { err = errors.New("datatype error"); return }; _v.Datatype = int32(_tempNum_) } + { var _ok_ bool; if _v.Desc, _ok_ = _buf["desc"].(string); !_ok_ { err = errors.New("desc error"); return } } + { var _ok_ bool; if _v.Data1, _ok_ = _buf["data1"].(string); !_ok_ { err = errors.New("data1 error"); return } } + { var _ok_ bool; if _v.Data2, _ok_ = _buf["data2"].(string); !_ok_ { err = errors.New("data2 error"); return } } + { var _ok_ bool; if _v.Data3, _ok_ = _buf["data3"].(string); !_ok_ { err = errors.New("data3 error"); return } } + { var _ok_ bool; if _v.Data4, _ok_ = _buf["data4"].(string); !_ok_ { err = errors.New("data4 error"); return } } + return +} + +func DeserializeGameTaskTypeData(_buf map[string]interface{}) (*GameTaskTypeData, error) { + v := &GameTaskTypeData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} diff --git a/sys/configure/structs/Game.WorldTask.go b/sys/configure/structs/Game.WorldTask.go new file mode 100644 index 000000000..cdd9c0f01 --- /dev/null +++ b/sys/configure/structs/Game.WorldTask.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 GameWorldTask struct { + _dataMap map[int32]*GameWorldTaskData + _dataList []*GameWorldTaskData +} + +func NewGameWorldTask(_buf []map[string]interface{}) (*GameWorldTask, error) { + _dataList := make([]*GameWorldTaskData, 0, len(_buf)) + dataMap := make(map[int32]*GameWorldTaskData) + for _, _ele_ := range _buf { + if _v, err2 := DeserializeGameWorldTaskData(_ele_); err2 != nil { + return nil, err2 + } else { + _dataList = append(_dataList, _v) + dataMap[_v.Key] = _v + } + } + return &GameWorldTask{_dataList:_dataList, _dataMap:dataMap}, nil +} + +func (table *GameWorldTask) GetDataMap() map[int32]*GameWorldTaskData { + return table._dataMap +} + +func (table *GameWorldTask) GetDataList() []*GameWorldTaskData { + return table._dataList +} + +func (table *GameWorldTask) Get(key int32) *GameWorldTaskData { + return table._dataMap[key] +} + + diff --git a/sys/configure/structs/Game.WorldTaskData.go b/sys/configure/structs/Game.WorldTaskData.go new file mode 100644 index 000000000..88aae3974 --- /dev/null +++ b/sys/configure/structs/Game.WorldTaskData.go @@ -0,0 +1,87 @@ +//------------------------------------------------------------------------------ +// +// 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 GameWorldTaskData struct { + Key int32 + Lock int32 + Ontxe int32 + IdAfter int32 + Des int32 + Icon string + TaskName string + TaskDisplay string + Npc string + GetafterEvent []string + Completetask int32 + AutoAccept int32 + Overtips int32 + Reword []*Gameatn +} + +const TypeId_GameWorldTaskData = -1059668091 + +func (*GameWorldTaskData) GetTypeId() int32 { + return -1059668091 +} + +func (_v *GameWorldTaskData)Deserialize(_buf map[string]interface{}) (err error) { + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["lock"].(float64); !_ok_ { err = errors.New("lock error"); return }; _v.Lock = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ontxe"].(float64); !_ok_ { err = errors.New("ontxe error"); return }; _v.Ontxe = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id_after"].(float64); !_ok_ { err = errors.New("id_after error"); return }; _v.IdAfter = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["des"].(float64); !_ok_ { err = errors.New("des error"); return }; _v.Des = int32(_tempNum_) } + { var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } } + { var _ok_ bool; if _v.TaskName, _ok_ = _buf["task_name"].(string); !_ok_ { err = errors.New("task_name error"); return } } + { var _ok_ bool; if _v.TaskDisplay, _ok_ = _buf["task_display"].(string); !_ok_ { err = errors.New("task_display error"); return } } + { var _ok_ bool; if _v.Npc, _ok_ = _buf["npc"].(string); !_ok_ { err = errors.New("npc error"); return } } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["getafter_event"].([]interface{}); !_ok_ { err = errors.New("getafter_event error"); return } + + _v.GetafterEvent = make([]string, 0, len(_arr_)) + + for _, _e_ := range _arr_ { + var _list_v_ string + { if _list_v_, _ok_ = _e_.(string); !_ok_ { err = errors.New("_list_v_ error"); return } } + _v.GetafterEvent = append(_v.GetafterEvent, _list_v_) + } + } + + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["completetask"].(float64); !_ok_ { err = errors.New("completetask error"); return }; _v.Completetask = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["auto_accept"].(float64); !_ok_ { err = errors.New("auto_accept error"); return }; _v.AutoAccept = int32(_tempNum_) } + { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["overtips"].(float64); !_ok_ { err = errors.New("overtips error"); return }; _v.Overtips = int32(_tempNum_) } + { + var _arr_ []interface{} + var _ok_ bool + if _arr_, _ok_ = _buf["reword"].([]interface{}); !_ok_ { err = errors.New("reword error"); return } + + _v.Reword = 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.Reword = append(_v.Reword, _list_v_) + } + } + + return +} + +func DeserializeGameWorldTaskData(_buf map[string]interface{}) (*GameWorldTaskData, error) { + v := &GameWorldTaskData{} + if err := v.Deserialize(_buf); err == nil { + return v, nil + } else { + return nil, err + } +} From 5d5733d04d9aad72ffed6b20bf906a4d7be90c04 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 8 Nov 2022 12:06:08 +0800 Subject: [PATCH 5/8] =?UTF-8?q?=E5=A4=A7=E4=BA=8E=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E7=AD=BE=E5=88=B0=E5=A4=A9=E6=95=B0=E6=97=B6=E8=AF=BB=E5=8F=96?= =?UTF-8?q?=E9=80=9A=E7=94=A8=E5=A5=96=E5=8A=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/json/game_comatn.json | 10 ++++++++++ modules/pagoda/api_getlist.go | 4 +++- modules/troll/api_getlist.go | 7 +++++-- modules/troll/module.go | 4 +++- modules/user/api_login.go | 1 + modules/user/api_sign.go | 3 ++- modules/user/model_sign.go | 18 +++++++++++++++--- 7 files changed, 39 insertions(+), 8 deletions(-) diff --git a/bin/json/game_comatn.json b/bin/json/game_comatn.json index 74ddb5d36..73f5c7c13 100644 --- a/bin/json/game_comatn.json +++ b/bin/json/game_comatn.json @@ -48,5 +48,15 @@ "n": 20000 } ] + }, + { + "index": "unified_reward", + "var": [ + { + "a": "attr", + "t": "gold", + "n": 20000 + } + ] } ] \ No newline at end of file diff --git a/modules/pagoda/api_getlist.go b/modules/pagoda/api_getlist.go index c4accec01..6b7521fb3 100644 --- a/modules/pagoda/api_getlist.go +++ b/modules/pagoda/api_getlist.go @@ -25,8 +25,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq code = pb.ErrorCode_DBError return } + list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId()) if !expand.CompletePagoda { // 普通塔 - list, _ = this.module.modelPagoda.getPagodaList(session.GetUserId()) if list == nil { // redis没有数据 list = &pb.DBPagoda{} list.Id = primitive.NewObjectID().Hex() @@ -40,6 +40,8 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.PagodaGetListReq season, _ := this.module.modelSeasonPagoda.getSeasonPagodaList(session.GetUserId()) if season.Id == "" { list.Complete = true + } else { + list = season } } diff --git a/modules/troll/api_getlist.go b/modules/troll/api_getlist.go index c14423e32..ff028f810 100644 --- a/modules/troll/api_getlist.go +++ b/modules/troll/api_getlist.go @@ -87,9 +87,12 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.TrollGetListReq) update["circle"] = trolltrain.Circle } leftTime = (int32(t) % circletime) - // 循环次数 + index += circleCount * trainNum // 计算火车的位置信息 - for _, v := range sz { + for pos, v := range sz { + if pos < int(trolltrain.TarinPos-1) { // 起始位置 + continue + } if leftTime <= v { trolltrain.RefreshTime = time.Now().Unix() trolltrain.TarinPos += index diff --git a/modules/troll/module.go b/modules/troll/module.go index bd016bb00..172b888e1 100644 --- a/modules/troll/module.go +++ b/modules/troll/module.go @@ -87,7 +87,9 @@ func (this *Troll) TrollAI(session comm.IUserSession, troll *pb.DBTrollTrain) (c } iCount := this.configure.GetTrollRule(comm.TrollAIBuyCount) for index = 0; ; index++ { - + if index < troll.TarinPos-1 { // 起始位置 + continue + } index := int32(index) % trainNum troll.RefreshTime += int64(sz[index]) diff --git a/modules/user/api_login.go b/modules/user/api_login.go index d189e838c..7abfd0d59 100644 --- a/modules/user/api_login.go +++ b/modules/user/api_login.go @@ -145,6 +145,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod // 每日签到检测 this.module.modelSign.checkResetSignData(session) + this.Sign(session, &pb.UserSignReq{}) //推送登录公告 this.chat.SendSysChatToUser(session, comm.UserLoginNotice, 0) mail := &pb.DBMailData{ diff --git a/modules/user/api_sign.go b/modules/user/api_sign.go index 79d9f515d..a422ac90b 100644 --- a/modules/user/api_sign.go +++ b/modules/user/api_sign.go @@ -15,6 +15,7 @@ func (this *apiComp) SignCheck(session comm.IUserSession, req *pb.UserSignReq) ( //登录 func (this *apiComp) Sign(session comm.IUserSession, req *pb.UserSignReq) (code pb.ErrorCode, data proto.Message) { - this.module.modelSign.checkResetSignData(session) + + code = this.module.modelSign.checkResetSignData(session) return } diff --git a/modules/user/model_sign.go b/modules/user/model_sign.go index 94ad0e6f0..2dcdfa933 100644 --- a/modules/user/model_sign.go +++ b/modules/user/model_sign.go @@ -78,11 +78,12 @@ func (this *ModelSign) updateSignData(uid string, sign *pb.DBSign) (err error) { } // 检测是否达到重置日期 -func (this *ModelSign) checkResetSignData(session comm.IUserSession) { +func (this *ModelSign) checkResetSignData(session comm.IUserSession) (code pb.ErrorCode) { var ( update map[string]interface{} bReward bool ) + update = make(map[string]interface{}, 0) if sign, err := this.module.modelSign.GetUserSign(session.GetUserId()); err == nil { start, _ := utils.GetMonthStartEnd() @@ -114,8 +115,19 @@ func (this *ModelSign) checkResetSignData(session comm.IUserSession) { } } _data := this.module.configure.GetSignConf(sign.Cid, sign.Group) - if bReward && _data != nil { // 发奖 - this.module.DispenseRes(session, _data.Loopgift, true) + if _data != nil { // 发奖 + if bReward { + this.module.DispenseRes(session, _data.Loopgift, true) + } + } else { + globalCnf := this.module.configure.GetGlobalAtnConf("unified_reward") // 获取重置消耗 + if globalCnf == nil { + code = pb.ErrorCode_ConfigNoFound + return + } + if bReward { + this.module.DispenseRes(session, globalCnf.Var, true) // 发放通用奖励 + } } session.SendMsg(string(this.module.GetType()), "sign", &pb.UserSignResp{ Data: sign, From a9f8dc8bce6416eb35d26574fc118924edf1869a Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Tue, 8 Nov 2022 12:08:38 +0800 Subject: [PATCH 6/8] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/rtask/config.go | 6 +++--- modules/sociaty/api_cross_mine.go | 6 +++--- modules/sociaty/model_sociaty.go | 4 ++-- modules/worldtask/configure.go | 21 +++++++++++++++++++-- services/worker/main.go | 2 ++ 5 files changed, 29 insertions(+), 10 deletions(-) diff --git a/modules/rtask/config.go b/modules/rtask/config.go index 5fccc26a0..0fa8566be 100644 --- a/modules/rtask/config.go +++ b/modules/rtask/config.go @@ -10,7 +10,7 @@ import ( const ( gameRtask = "game_rdtask.json" gameRtaskChoose = "game_rdtaskchoose.json" - gameRtaskCondi = "game_rdtaskcondi.json" + gameTaskCond = "game_taskcond.json" gameRtaskSide = "game_rdtaskside.json" gameRtaskBattle = "game_rdtaskbattle.json" ) @@ -24,7 +24,7 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp err = this.LoadMultiConfigure(map[string]interface{}{ gameRtask: cfg.NewGameRdtask, gameRtaskChoose: cfg.NewGameRdtaskChoose, - gameRtaskCondi: cfg.NewGameRdtaskCondi, + gameTaskCond: cfg.NewGameTaskCond, gameRtaskSide: cfg.NewGameRdtaskSide, gameRtaskBattle: cfg.NewGameRdtaskBattle, }) @@ -52,7 +52,7 @@ func (this *configureComp) getRtaskCondiCfg() (data *cfg.GameRdtaskCondi, err er v interface{} ok bool ) - if v, err = this.GetConfigure(gameRtaskCondi); err != nil { + if v, err = this.GetConfigure(gameTaskCond); err != nil { return } else { if data, ok = v.(*cfg.GameRdtaskCondi); !ok { diff --git a/modules/sociaty/api_cross_mine.go b/modules/sociaty/api_cross_mine.go index a147fdf91..04a0d8437 100644 --- a/modules/sociaty/api_cross_mine.go +++ b/modules/sociaty/api_cross_mine.go @@ -53,9 +53,9 @@ func (this *apiComp) Mine(session comm.IUserSession, req *pb.SociatyMineReq) (co // 获取会长 master := this.module.modelSociaty.getMasterInfo(sociaty) if master != nil { - //判断当前玩家是否是会长 - if master.Uid == uid { //会长 - this.module.modelSociaty.extendJob(master.Uid, sociaty) + if err := this.module.modelSociaty.extendJob(master.Uid, sociaty); err == nil { + // 获取新的会长 + master = this.module.modelSociaty.getMasterInfo(sociaty) } } rsp.Sociaty = sociaty diff --git a/modules/sociaty/model_sociaty.go b/modules/sociaty/model_sociaty.go index 1d1b6e2a9..584e6350d 100644 --- a/modules/sociaty/model_sociaty.go +++ b/modules/sociaty/model_sociaty.go @@ -574,7 +574,7 @@ func (this *ModelSociaty) extendJob(srcMasterId string, sociaty *pb.DBSociaty) e return errors.New("config not found") } now := time.Now().Unix() - //48小时内终止弹劾 + //终止弹劾 if now-sociaty.AccuseTime < int64(ggd.GuildImpeachmentCountDown*3600) { update := map[string]interface{}{ "accuseTime": 0, @@ -653,7 +653,7 @@ func (this *ModelSociaty) electNewMaster(srcMasterId string, sociaty *pb.DBSocia } if len(mIds) > 0 { - return elect(aIds) + return elect(mIds) } return nil } diff --git a/modules/worldtask/configure.go b/modules/worldtask/configure.go index 130ef9a61..6ab05faad 100644 --- a/modules/worldtask/configure.go +++ b/modules/worldtask/configure.go @@ -1,8 +1,10 @@ package worldtask import ( + "fmt" "go_dreamfactory/lego/core" "go_dreamfactory/modules" + cfg "go_dreamfactory/sys/configure/structs" ) const ( @@ -16,8 +18,23 @@ type configureComp struct { func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.MCompConfigure.Init(service, module, comp, options) err = this.LoadMultiConfigure(map[string]interface{}{ - // gameGrowreward: cfg.NewGameGrowReward, - // gameGrowTask: cfg.NewGameGrowTask, + gameWorldTask: cfg.NewGameWorldTask, }) return } + +func (this *configureComp) getWorldtaskCfg() (data *cfg.GameWorldTask, err error) { + var ( + v interface{} + ok bool + ) + if v, err = this.GetConfigure(gameWorldTask); err != nil { + return + } else { + if data, ok = v.(*cfg.GameWorldTask); !ok { + err = fmt.Errorf("%T is *cfg.GameWorldTask", v) + return + } + } + return +} diff --git a/services/worker/main.go b/services/worker/main.go index 737aa9dc6..af8752fc1 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -35,6 +35,7 @@ import ( "go_dreamfactory/modules/troll" "go_dreamfactory/modules/user" "go_dreamfactory/modules/viking" + "go_dreamfactory/modules/worldtask" "go_dreamfactory/pb" "go_dreamfactory/services" "go_dreamfactory/sys/db" @@ -101,6 +102,7 @@ func main() { pay.NewModule(), //privilege.NewModule(), growtask.NewModule(), + worldtask.NewModule(), ) } From 70e4d847fe6fe3abeacc7b52316e53e4107a8242 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 8 Nov 2022 13:36:40 +0800 Subject: [PATCH 7/8] =?UTF-8?q?=E6=BF=80=E6=B4=BB=E8=B5=9B=E5=AD=A3?= =?UTF-8?q?=E5=A1=94=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api_activate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/pagoda/api_activate.go b/modules/pagoda/api_activate.go index 3dcced3c2..1bc60ea76 100644 --- a/modules/pagoda/api_activate.go +++ b/modules/pagoda/api_activate.go @@ -51,6 +51,6 @@ func (this *apiComp) Activate(session comm.IUserSession, req *pb.PagodaActivateR } } - session.SendMsg(string(this.module.GetType()), PagodaGetListResp, &pb.PagodaGetListResp{Data: list}) + session.SendMsg(string(this.module.GetType()), PagodaActivateResp, &pb.PagodaActivateResp{Data: list}) return } From d745a797d197cbecda9b77fc5b45fe4f8e924bd9 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 8 Nov 2022 13:36:52 +0800 Subject: [PATCH 8/8] =?UTF-8?q?=E6=BF=80=E6=B4=BB=E8=B5=9B=E5=AD=A3?= =?UTF-8?q?=E5=A1=94=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/pagoda/api.go | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/pagoda/api.go b/modules/pagoda/api.go index 0f052bbee..ead17d995 100644 --- a/modules/pagoda/api.go +++ b/modules/pagoda/api.go @@ -13,6 +13,7 @@ const ( PagodaChallengeOverResp = "challengeover" PagodaGetRewardResp = "getreward" PagodaRankListResp = "ranklist" + PagodaActivateResp = "activate" ) type apiComp struct {