diff --git a/bin/json/game_buriedtype.json b/bin/json/game_buriedtype.json index 082460fb9..3386b65cf 100644 --- a/bin/json/game_buriedtype.json +++ b/bin/json/game_buriedtype.json @@ -1419,27 +1419,5 @@ "filter": [ "eq" ] - }, - { - "id": 245, - "insert": 2, - "filter": [ - "eq", - "eq" - ] - }, - { - "id": 246, - "insert": 1, - "filter": [ - "eq" - ] - }, - { - "id": 247, - "insert": 2, - "filter": [ - "eq" - ] } ] \ No newline at end of file diff --git a/bin/json/game_mainstage.json b/bin/json/game_mainstage.json index 4445b643d..88e477640 100644 --- a/bin/json/game_mainstage.json +++ b/bin/json/game_mainstage.json @@ -9536,6 +9536,83 @@ "star_value": [], "challengeward": 0 }, + { + "id": 1101096, + "chapterid": 11001, + "group_id": 100133, + "previous_group_id": [], + "previoustage": 0, + "buried_type": 0, + "buried": 0, + "grouptype": [], + "Episodetype": 9, + "stage_param": 0, + "inherit": 0, + "battle_fail": 0, + "venturemodelspeed": 0, + "venturemodelscale": 0, + "move_type": 0, + "venturemodel": "", + "bubbletalk": { + "key": "", + "text": "" + }, + "venturetype": 0, + "ventureavatar": [], + "scene_effect": [], + "scene_effectfilter": "", + "is_near": 0, + "openlevel": 1, + "EditorStage": 0, + "herocolor": 2, + "heroimg": "zxgq_qp_icon_zd", + "bubbletext": { + "key": "", + "text": "" + }, + "animation": [], + "prewarbubbletext": { + "key": "", + "text": "" + }, + "hide": 0, + "destroy": 0, + "progress": 0, + "stroyshow": 0, + "frontstoryid": 0, + "afterstoryid": 0, + "maingroupName": { + "key": "", + "text": "" + }, + "mainlineName": { + "key": "", + "text": "" + }, + "title": { + "key": "", + "text": "" + }, + "desc": { + "key": "", + "text": "" + }, + "exp": 0, + "hero_exp": 0, + "ps_consume": [], + "ps_mg": [], + "firstaward": [], + "lotteryward": 0, + "commonaward": [], + "BattleReadyID": 0, + "FormatList": [], + "helphero": [], + "banhero": [], + "star": [], + "star_type": [], + "star_value": [], + "challengeward": 0 + }, { "id": 1102000, "chapterid": 11002, diff --git a/bin/json/game_playerinfor_barrage.json b/bin/json/game_playerinfor_barrage.json index 15e94eda2..b2213f9ca 100644 --- a/bin/json/game_playerinfor_barrage.json +++ b/bin/json/game_playerinfor_barrage.json @@ -9,7 +9,11 @@ "text": "这好像不是熊猫?" }, "time": 90, +<<<<<<< HEAD "speed": 7443 +======= + "speed": 12722 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "2", @@ -20,8 +24,13 @@ "key": "playerinfor_barrage_2", "text": "看起来像个画家。" }, +<<<<<<< HEAD "time": 227, "speed": 8235 +======= + "time": 190, + "speed": 12237 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "3", @@ -32,8 +41,13 @@ "key": "playerinfor_barrage_3", "text": "为什么会觉得是熊猫啊?" }, +<<<<<<< HEAD "time": 329, "speed": 12333 +======= + "time": 292, + "speed": 10498 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "4", @@ -44,8 +58,13 @@ "key": "playerinfor_barrage_4", "text": "从石头里蹦出来的人?怎么感觉有点熟悉……" }, +<<<<<<< HEAD "time": 512, "speed": 10906 +======= + "time": 529, + "speed": 12429 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "5", @@ -56,8 +75,13 @@ "key": "playerinfor_barrage_5", "text": "你可能是听说过从石头里蹦出来的猴子。" }, +<<<<<<< HEAD "time": 649, "speed": 8359 +======= + "time": 688, + "speed": 10088 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "6", @@ -68,8 +92,13 @@ "key": "playerinfor_barrage_6", "text": "你是从石头里蹦出来的?!" }, +<<<<<<< HEAD "time": 833, "speed": 12133 +======= + "time": 909, + "speed": 12947 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "7", @@ -80,8 +109,13 @@ "key": "playerinfor_barrage_7", "text": "不!那不是我!" }, +<<<<<<< HEAD "time": 996, "speed": 10803 +======= + "time": 1059, + "speed": 12696 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "8", @@ -92,8 +126,13 @@ "key": "playerinfor_barrage_8", "text": "哦,传承之人……" }, +<<<<<<< HEAD "time": 1217, "speed": 10424 +======= + "time": 1225, + "speed": 9592 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "9", @@ -104,8 +143,13 @@ "key": "playerinfor_barrage_9", "text": "月光能量都汇集在他身上了!" }, +<<<<<<< HEAD "time": 1445, "speed": 7151 +======= + "time": 1385, + "speed": 11311 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "10", @@ -116,8 +160,13 @@ "key": "playerinfor_barrage_10", "text": "那应该不会爆炸吧?" }, +<<<<<<< HEAD "time": 1575, "speed": 12447 +======= + "time": 1606, + "speed": 10931 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "11", @@ -128,8 +177,13 @@ "key": "playerinfor_barrage_11", "text": "阿宝,你为什么站那么远?" }, +<<<<<<< HEAD "time": 1714, "speed": 7131 +======= + "time": 1802, + "speed": 12145 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "312", @@ -141,7 +195,11 @@ "text": "哦!那是什么?" }, "time": 90, +<<<<<<< HEAD "speed": 11318 +======= + "speed": 7982 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "313", @@ -152,8 +210,13 @@ "key": "playerinfor_barrage_313", "text": "我有种被她注视的感觉……" }, +<<<<<<< HEAD "time": 209, "speed": 11012 +======= + "time": 266, + "speed": 7864 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "314", @@ -164,8 +227,13 @@ "key": "playerinfor_barrage_314", "text": "好像是一种叫做“照相”的魔法……" }, +<<<<<<< HEAD "time": 309, "speed": 8982 +======= + "time": 468, + "speed": 9856 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "315", @@ -176,8 +244,13 @@ "key": "playerinfor_barrage_315", "text": "我看这魔法不是很疼。" }, +<<<<<<< HEAD "time": 432, "speed": 7914 +======= + "time": 652, + "speed": 11970 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "316", @@ -188,8 +261,13 @@ "key": "playerinfor_barrage_316", "text": "据说它的作用是封印灵魂?" }, +<<<<<<< HEAD "time": 626, "speed": 11866 +======= + "time": 816, + "speed": 8057 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "317", @@ -200,8 +278,13 @@ "key": "playerinfor_barrage_317", "text": "月中人的传承居然这么可怕?!" }, +<<<<<<< HEAD "time": 813, "speed": 12580 +======= + "time": 928, + "speed": 9966 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "318", @@ -212,8 +295,13 @@ "key": "playerinfor_barrage_318", "text": "哦!你们真是够了!" }, +<<<<<<< HEAD "time": 973, "speed": 9024 +======= + "time": 1028, + "speed": 8227 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "319", @@ -224,8 +312,13 @@ "key": "playerinfor_barrage_319", "text": "照相不是魔法!也不能封印灵魂!" }, +<<<<<<< HEAD "time": 1203, "speed": 11977 +======= + "time": 1260, + "speed": 11801 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "320", @@ -236,8 +329,13 @@ "key": "playerinfor_barrage_320", "text": "那她是在干什么?" }, +<<<<<<< HEAD "time": 1371, "speed": 9562 +======= + "time": 1485, + "speed": 11645 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "321", @@ -248,8 +346,13 @@ "key": "playerinfor_barrage_321", "text": "……别问。" }, +<<<<<<< HEAD "time": 1554, "speed": 11969 +======= + "time": 1587, + "speed": 11333 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "322", @@ -260,8 +363,13 @@ "key": "playerinfor_barrage_322", "text": "那可以教我吗?" }, +<<<<<<< HEAD "time": 1666, "speed": 11148 +======= + "time": 1746, + "speed": 8330 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "323", @@ -272,8 +380,13 @@ "key": "playerinfor_barrage_323", "text": "我也想学。" }, +<<<<<<< HEAD "time": 1792, "speed": 10475 +======= + "time": 1970, + "speed": 12972 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 }, { "id": "324", @@ -284,7 +397,12 @@ "key": "playerinfor_barrage_324", "text": "要不你们问问这个传承者?" }, +<<<<<<< HEAD "time": 1922, "speed": 11895 +======= + "time": 2136, + "speed": 12942 +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 } ] \ No newline at end of file diff --git a/bin/json/game_playerinfor_overview.json b/bin/json/game_playerinfor_overview.json index 0225952e6..97756b1be 100644 --- a/bin/json/game_playerinfor_overview.json +++ b/bin/json/game_playerinfor_overview.json @@ -78,7 +78,11 @@ 107 ], "url": "", +<<<<<<< HEAD "tips": 10001, +======= + "tips": 10000, +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 "resources": "Person/10000/10000M.prefab", "pvpAnimator": "Person/10000/10000_MPvp.controller", "mainq": "Person/10000/10000M_q.prefab", @@ -101,7 +105,11 @@ 107 ], "url": "", +<<<<<<< HEAD "tips": 10001, +======= + "tips": 10000, +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 "resources": "Person/10000/10000W.prefab", "pvpAnimator": "Person/10000/10000_WPvp.controller", "mainq": "Person/10000/10000W_q.prefab", @@ -124,7 +132,11 @@ 107 ], "url": "", +<<<<<<< HEAD "tips": 10002, +======= + "tips": 10000, +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 "resources": "Person/10000/10000M.prefab", "pvpAnimator": "Person/10000/10000_MPvp.controller", "mainq": "Person/10000/10000M_q.prefab", @@ -147,7 +159,11 @@ 107 ], "url": "", +<<<<<<< HEAD "tips": 10002, +======= + "tips": 10000, +>>>>>>> 7e1c0cdb51b0b179779164cc6afa596bd529fc46 "resources": "Person/10000/10000W.prefab", "pvpAnimator": "Person/10000/10000_WPvp.controller", "mainq": "Person/10000/10000W_q.prefab", diff --git a/comm/const.go b/comm/const.go index a89deefce..94b0e5e8a 100644 --- a/comm/const.go +++ b/comm/const.go @@ -518,8 +518,8 @@ const ( //Rpc Rpc_Activity core.Rpc_Key = "Rpc_Activity" - Rpc_ActivityOver core.Rpc_Key = "Rpc_ActivityOver" //活动结束 - Rpc_ActivityStar core.Rpc_Key = "Rpc_ActivityStar" //活动开启 + Rpc_ActivityOver core.Rpc_Key = "Rpc_ActivityOver" //活动结束 + Rpc_ActivityStart core.Rpc_Key = "Rpc_ActivityStart" //活动开启 RPC_XXLOffLine core.Rpc_Key = "RPC_XXLOffLine" //三消离线 @@ -979,7 +979,9 @@ const ( Rtype242 TaskType = 242 //辉月等级达到x级 Rtype243 TaskType = 243 //指定英雄满级且共鸣和觉醒升至最高状态 - + Rtype245 TaskType = 245 //招募到X品质X阵营的守护者X个 + Rtype246 TaskType = 246 //在一次十连内获得X个以上的Y品质的守护者 (紫色以上) + Rtype247 TaskType = 247 //完成X品质的武馆派遣Y个 ) const ( MailLineEasy int32 = 1 // 简单 diff --git a/comm/imodule.go b/comm/imodule.go index 5f79e2a25..8acd93581 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -586,10 +586,8 @@ type ( } IActivity interface { - GetHdInfoByHdId(oid string) (result *pb.DBHuodong, err error) // 通过活动id 获取活动信息 GetAllHdInfo() (hdList map[pb.HdType]*pb.DBHuodong) // 获取所有活动信息 GetHdInfoByItype(itype pb.HdType) (result *pb.DBHuodong, err error) // - // 庆典活动 HDCelebration(session IUserSession, systemtype int32, bosstype int32) bool } @@ -636,6 +634,7 @@ type ( } IUiGame interface { HDPSTodayConsum(uid string, ps int32) // 今日消耗的体力 + IActivityNotice } IStonehenge interface { diff --git a/modules/activity/api_gethddata.go b/modules/activity/api_gethddata.go index 63a1c77ff..13ad6cd93 100644 --- a/modules/activity/api_gethddata.go +++ b/modules/activity/api_gethddata.go @@ -14,7 +14,7 @@ func (this *apiComp) GetHdDataCheck(session comm.IUserSession, req *pb.ActivityG // 活动活动 func (this *apiComp) GetHdData(session comm.IUserSession, req *pb.ActivityGetHdDataReq) (errdata *pb.ErrorData) { - result := this.module.GetHdData(session, req.Oid) + result := this.module.GetHdData(session, req.Oid) // 不用 session.SendMsg(string(this.module.GetType()), "gethddata", &pb.ActivityGetHdDataResp{ Data: result, }) diff --git a/modules/activity/api_getreward.go b/modules/activity/api_getreward.go index 1d3e62a86..c4d0a530a 100644 --- a/modules/activity/api_getreward.go +++ b/modules/activity/api_getreward.go @@ -38,6 +38,7 @@ func (this *apiComp) GetReward(session comm.IUserSession, req *pb.ActivityGetRew } return } + // 接口需要修改 if activity, err = this.module.modelhdList.getHdListByHdId(req.Oid); err == nil { curTime := configure.Now().Unix() if activity.Stime > curTime || curTime > activity.Etime { //不在活动时间范围内 diff --git a/modules/activity/module.go b/modules/activity/module.go index 2dc12bdd4..bd8e9f137 100644 --- a/modules/activity/module.go +++ b/modules/activity/module.go @@ -31,6 +31,7 @@ type Activity struct { shopcenter comm.IShopcenter // 活动中心 addrecharge comm.IAddrecharge // 活动中心 kftask comm.IActivityNotice // 开服任务 + uigame comm.IUiGame // ui小游戏 } func NewModule() core.IModule { @@ -91,7 +92,10 @@ func (this *Activity) Start() (err error) { return } this.kftask = module.(comm.IActivityNotice) - + if module, err = this.service.GetModule(comm.ModulePuzzle); err != nil { + return + } + this.uigame = module.(comm.IUiGame) if !db.IsCross() { this.modelhdList.LoadActivityData() for k, v := range this.modelhdList.activity { @@ -111,11 +115,14 @@ func (this *Activity) Start() (err error) { case pb.HdType_KFSevenTask: this.kftask.ActivityOpenNotice(v) break + case pb.HdType_HdPuzzle, pb.HdType_HdLattice, pb.HdType_HdMiner: + this.uigame.ActivityOpenNotice(v) + break } } } this.service.RegisterFunctionName(string(comm.Rpc_ActivityOver), this.Rpc_ActivityOver) - this.service.RegisterFunctionName(string(comm.Rpc_ActivityStar), this.Rpc_ActivityStar) + this.service.RegisterFunctionName(string(comm.Rpc_ActivityStart), this.Rpc_ActivityStart) return } @@ -190,12 +197,6 @@ func (this *Activity) GetHdInfoByItype(itype pb.HdType) (result *pb.DBHuodong, e return } -// 通过活动ID查找 -func (this *Activity) GetHdInfoByHdId(oid string) (result *pb.DBHuodong, err error) { - result, err = this.modelhdList.getHdListByHdId(oid) - return -} - // 统计庆典活动完成情况 func (this *Activity) HDCelebration(session comm.IUserSession, systemtype int32, bosstype int32) bool { bDouble := false // 是否开启双倍奖励 @@ -289,6 +290,7 @@ func (this *Activity) HDCelebration(session comm.IUserSession, systemtype int32, return bDouble } +// 接口废弃 func (this *Activity) GetHdData(session comm.IUserSession, oids []string) (result []*pb.DBActivityData) { var ( activity *pb.DBHuodong @@ -348,9 +350,9 @@ func (this *Activity) GetHdData(session comm.IUserSession, oids []string) (resul return } -func (this *Activity) Rpc_Activity(ctx context.Context, args string, reply *pb.EmptyResp) (err error) { - this.Debug("Rpc_ActivityOver", - log.Field{Key: "args", Value: args}, +func (this *Activity) Rpc_Activity(ctx context.Context, req *pb.RPCGeneralReqA1, reply *pb.RPCGeneralReqA1) (err error) { + this.Debug("Rpc_Activity", + log.Field{Key: "args", Value: req.Param1}, ) this.modelhdList.LoadActivityData() return @@ -361,12 +363,8 @@ func (this *Activity) Rpc_ActivityOver(ctx context.Context, args *pb.RPCGeneralR this.Debug("Rpc_ActivityOver", log.Field{Key: "args", Value: args.String()}, ) - var ( - szOverActivity []string - ) - szOverActivity = args.Param2 - for _, v := range szOverActivity { + for _, v := range args.Param2 { hd := &pb.DBHuodong{} if err := this.modelhdList.DB.FindOne(core.SqlTable(this.modelhdList.TableName), bson.M{"_id": v}).Decode(hd); err != nil { switch hd.Itype { @@ -385,28 +383,27 @@ func (this *Activity) Rpc_ActivityOver(ctx context.Context, args *pb.RPCGeneralR case pb.HdType_KFSevenTask: this.kftask.ActivityCloseNotice(hd) break + case pb.HdType_HdPuzzle, pb.HdType_HdLattice, pb.HdType_HdMiner: + this.uigame.ActivityCloseNotice(hd) + break } } } - this.Debug("szOverActivity", log.Field{Key: "args", Value: szOverActivity}) + this.Debug("szOverActivity", log.Field{Key: "args", Value: args.Param2}) return } // 活动开启通知 -func (this *Activity) Rpc_ActivityStar(ctx context.Context, args *pb.RPCGeneralReqB1, reply *pb.EmptyResp) (err error) { - this.Debug("Rpc_ActivityStar", +func (this *Activity) Rpc_ActivityStart(ctx context.Context, args *pb.RPCGeneralReqB1, reply *pb.EmptyResp) (err error) { + this.Debug("Rpc_ActivityStart", log.Field{Key: "args", Value: args.String()}, ) - var ( - szOverActivity []string - ) - szOverActivity = args.Param2 - for _, v := range szOverActivity { + for _, v := range args.Param2 { hd := &pb.DBHuodong{} - if err := this.modelhdList.DB.FindOne(core.SqlTable(this.modelhdList.TableName), bson.M{"_id": v}).Decode(hd); err != nil { + if err := this.modelhdList.DB.FindOne(core.SqlTable(this.modelhdList.TableName), bson.M{"_id": v}).Decode(hd); err == nil { switch hd.Itype { case pb.HdType_HdTypeWarorder, pb.HdType_SupplyWarOrder, pb.HdType_MoondreamWarOrder: this.warorder.ActivityOpenNotice(hd) @@ -423,10 +420,73 @@ func (this *Activity) Rpc_ActivityStar(ctx context.Context, args *pb.RPCGeneralR case pb.HdType_KFSevenTask: this.kftask.ActivityOpenNotice(hd) break + case pb.HdType_HdPuzzle, pb.HdType_HdLattice, pb.HdType_HdMiner: + this.uigame.ActivityOpenNotice(hd) + break } } } - this.Debug("szOverActivity", log.Field{Key: "args", Value: szOverActivity}) + this.Debug("szOverActivity", log.Field{Key: "args", Value: args.Param2}) + return +} + +// 通过活动类型获取活动信息 +func (this *Activity) GetHdDataByHdType(session comm.IUserSession, itype pb.HdType) (result []*pb.DBActivityData) { + var ( + activity *pb.DBHuodong + err error + list *pb.DBActivityData + ) + curTime := configure.Now().Unix() + + if activity, err = this.GetHdInfoByItype(itype); err != nil { + this.Errorln(err) + return + } + if activity.Stime > curTime || curTime > activity.Etime { // 不在活动范围内数据不给活动记录数据 + return + } + id := activity.Id + list, _ = this.modelhdData.getHddataByOid(session.GetUserId(), id) + // 获取开服庆典活动 + if activity.Itype == pb.HdType_HdCelebration { + if list, err = this.modelhdData.getHddataByOid(session.GetUserId(), id); err == nil { + if list.Lasttime < configure.Now().Unix() || list.Val == 0 { // 不是今天重置 + list.Gotarr = make(map[int32]int32) + update := make(map[string]interface{}) + + update["gotarr"] = list.Gotarr + var maxday int32 + _days := this.configure.GetHDCelebrationData() + for _, v := range _days { // 开启循环 + maxday += v + } + var pos int32 + _sub := int32((configure.Now().Unix() - activity.Stime) / (24 * 3600)) + + for index, v := range _days { + find := false + for i := 0; i < int(v); i++ { + pos++ + if _sub%maxday+1 == pos { + list.Val = int32(index) + 1 // 计算val 值 + update["val"] = list.Val + find = true + break + } + } + if find { // 找到剩余的天数 + list.Lasttime = activity.Stime + int64(_sub+pos%v+1)*24*3600 + update["lasttime"] = list.Lasttime + break + } + } + this.modelhdData.ModifyActivityList(session.GetUserId(), list.Id, update) + } + } + } + + result = append(result, list) return } diff --git a/modules/buried/module.go b/modules/buried/module.go index 0e83358b4..eb35ecc91 100644 --- a/modules/buried/module.go +++ b/modules/buried/module.go @@ -731,6 +731,7 @@ func (this *Buried) updateAndCheckBuried(bconf *cfg.GameBuriedTypeData, bdata *p if cond.Ctype == ctype_daily { //日常 if !utils.IsToday(bitem.Timestamp) { //不是同一天 可以重置数据 + bitem.State = pb.BuriedItemState_Activated bitem.Value = 0 bitem.Finish = pb.BuriedItemFinishState_buried_unfinish diff --git a/modules/dispatch/api_do.go b/modules/dispatch/api_do.go index 3686d02ed..319f69c61 100644 --- a/modules/dispatch/api_do.go +++ b/modules/dispatch/api_do.go @@ -32,6 +32,9 @@ func (a *apiComp) DoCheck(session comm.IUserSession, req *pb.DispatchDoReq) (err } func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (errdata *pb.ErrorData) { + var ( + tasks []*pb.BuriedParam + ) if errdata = this.DoCheck(session, req); errdata != nil { return } @@ -112,7 +115,13 @@ func (this *apiComp) Do(session comm.IUserSession, req *pb.DispatchDoReq) (errda }) go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.module.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype186, 1)) + for _, v := range req.HeroIds { + if c, e := this.module.configure.GetHeroConfig(v); e == nil { + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype247, c.Color, 1)) + } + } + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype186, 1)) + this.module.ModuleBuried.TriggerBuried(session, tasks...) this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "DispatchDoReq", ticketAtn) // 消耗资源 }) return diff --git a/modules/hero/api_drawCard.go b/modules/hero/api_drawCard.go index c54d85afe..d0c1b64ec 100644 --- a/modules/hero/api_drawCard.go +++ b/modules/hero/api_drawCard.go @@ -328,7 +328,7 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq if req.DrawType != 1 { // 任务统计 - this.module.SendTaskMsg(session, szStar, req.DrawCount, req.DrawType) + this.module.SendTaskMsg(session, szStar, req.DrawCount, req.DrawType, szCards) go this.module.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.module.WriteUserLog(session.GetUserId(), comm.GMResAddType, "HeroDrawCardReq", atno) this.module.WriteUserLog(session.GetUserId(), comm.GMResDelType, "HeroDrawCardReq", costRes) diff --git a/modules/hero/module.go b/modules/hero/module.go index 59858ed4c..0fecb1e95 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -506,10 +506,11 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat return } -func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCount int32, drawtype int32) { +func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCount int32, drawtype int32, szCards []string) { // 任务统计 var ( - tasks []*pb.BuriedParam + tasks []*pb.BuriedParam + colorCount int32 ) if drawtype == comm.DrawCardType0 { //普通招募 @@ -521,6 +522,7 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou for k := range sz { tasks = append(tasks, comm.GetBuriedParam(comm.Rtype17, 1, k)) } + } tasks = append(tasks, comm.GetBuriedParam(comm.Rtype14, drawCount)) tasks = append(tasks, comm.GetBuriedParam(comm.Rtype18, drawCount)) @@ -543,7 +545,17 @@ func (this *Hero) SendTaskMsg(session comm.IUserSession, szStar []int32, drawCou if drawCount == 10 { tasks = append(tasks, comm.GetBuriedParam(comm.Rtype90, 1)) } - + for _, v := range szCards { + if conf, e := this.configure.GetHeroConfig(v); e != nil { + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype245, conf.Color, conf.Race, 1)) + if conf.Color >= 3 { // 紫色以上 + colorCount++ + } + } + } + if colorCount > 0 { + tasks = append(tasks, comm.GetBuriedParam(comm.Rtype246, colorCount)) + } tasks = append(tasks, comm.GetBuriedParam(comm.Rtype89, drawCount)) go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.ModuleBuried.TriggerBuried(session, tasks...) diff --git a/modules/integral/module.go b/modules/integral/module.go index e6899a24c..36116d445 100644 --- a/modules/integral/module.go +++ b/modules/integral/module.go @@ -58,7 +58,7 @@ func (this *Integral) OnInstallComp() { // 任务条件达成通知 func (this *Integral) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIProgress) { var bChange bool - this.Debug("积分bossm条件达成通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds}) + this.Debug("积分boss条件达成通知", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "conds", Value: conds}) dt, err := this.modelIntegral.getIntegralList(session.GetUserId()) if dt.Itype != 2 { // 只有事件模式才有debuff @@ -95,7 +95,6 @@ func (this *Integral) BuriedsNotify(session comm.IUserSession, conds []*pb.ConIP if dt.Buff[k] != 1 && v.State == pb.BuriedItemFinishState_buried_finish { dt.Buff[k] = 1 bChange = true - } } if bChange { diff --git a/modules/timer/activity.go b/modules/timer/activity.go index 4cfc6d78a..b50fffa9a 100644 --- a/modules/timer/activity.go +++ b/modules/timer/activity.go @@ -21,12 +21,14 @@ import ( type Activity struct { cbase.ModuleBase modules.MCompModel - service base.IRPCXService - module *Timer - cTimerObj *timewheel.Task - closeSignal chan struct{} - hlock sync.RWMutex - activity map[pb.HdType]*pb.DBHuodong + service base.IRPCXService + module *Timer + cTimerObj *timewheel.Task + closeSignal chan struct{} + hlock sync.RWMutex + curActivity map[pb.HdType]*pb.DBHuodong // 正在进行的活动 + delActivity map[pb.HdType]*pb.DBHuodong // 已经过期的活动 + futureActivity map[pb.HdType]*pb.DBHuodong // 即将要开启的活动过期的活动 } //组件初始化接口 @@ -71,105 +73,125 @@ func (this *Activity) Start() (err error) { func (this *Activity) LoadActivityData(id string) { if id == "" { // 查所有的 - if c, err := this.DB.Find(core.SqlTable(this.TableName), bson.M{}); err != nil { - return - } else { + if c, err := this.DB.Find(core.SqlTable(this.TableName), bson.M{}); err == nil { + var ( + szEnd []string // 活动结束 + szStart []string // 有活动开启 + ) this.hlock.Lock() + this.curActivity = make(map[pb.HdType]*pb.DBHuodong) + this.delActivity = make(map[pb.HdType]*pb.DBHuodong) + this.futureActivity = make(map[pb.HdType]*pb.DBHuodong) defer this.hlock.Unlock() - this.activity = make(map[pb.HdType]*pb.DBHuodong) for c.Next(context.Background()) { hd := &pb.DBHuodong{} if err = c.Decode(hd); err != nil { this.module.Errorf("err:%v", err) continue } - this.activity[hd.Itype] = hd + if hd.Etime <= configure.Now().Unix() { + this.delActivity[hd.Itype] = hd + szEnd = append(szEnd, hd.Id) + } else if hd.Etime > configure.Now().Unix() && hd.Stime < configure.Now().Unix() { + this.curActivity[hd.Itype] = hd + szStart = append(szStart, hd.Id) + } else { + this.futureActivity[hd.Itype] = hd + } + } + if len(szEnd) > 0 { + this.NotifyActivityOver(szEnd) + } + if len(szStart) > 0 { + this.NotifyActivityStart(szStart) } } } else { var hd *pb.DBHuodong - this.DB.FindOne(core.SqlTable(this.TableName), bson.M{"_id": id}).Decode(&hd) - + if err := this.DB.FindOne(core.SqlTable(this.TableName), bson.M{"_id": id}).Decode(&hd); err != nil { + return + } + if hd.Etime <= configure.Now().Unix() { // 活动结束 + this.NotifyActivityOver([]string{hd.Id}) + } else if hd.Etime > configure.Now().Unix() && hd.Stime < configure.Now().Unix() { + this.NotifyActivityStart([]string{hd.Id}) + } this.hlock.Lock() - if this.activity == nil { - this.activity = make(map[pb.HdType]*pb.DBHuodong) + // 删除内存中 + if _, ok := this.curActivity[hd.Itype]; ok { + delete(this.curActivity, hd.Itype) } - this.activity[hd.Itype] = hd - this.hlock.Unlock() - // rpc 通知 - if configure.Now().Unix() <= hd.Etime && configure.Now().Unix() >= hd.Stime { - if err := this.service.RpcCall( - context.Background(), - comm.Service_Worker, - string(comm.Rpc_ActivityStar), - pb.RPCGeneralReqB1{ - Param1: "starActivity", - Param2: []string{hd.Id}, - }, - nil, - ); err != nil { - this.module.Errorln(err) - } + if _, ok := this.delActivity[hd.Itype]; ok { + delete(this.delActivity, hd.Itype) } - if configure.Now().Unix() > hd.Etime { - if err := this.service.RpcCall( - context.Background(), - comm.Service_Worker, - string(comm.Rpc_ActivityOver), - pb.RPCGeneralReqB1{ - Param1: "endActivity", - Param2: []string{hd.Id}, - }, - nil, - ); err != nil { - this.module.Errorln(err) - } + if _, ok := this.futureActivity[hd.Itype]; ok { + delete(this.futureActivity, hd.Itype) } + if hd.Etime <= configure.Now().Unix() { // 活动结束 + this.delActivity[hd.Itype] = hd + } else if hd.Etime > configure.Now().Unix() && hd.Stime < configure.Now().Unix() { + this.curActivity[hd.Itype] = hd + } else { + this.futureActivity[hd.Itype] = hd + } + defer this.hlock.Unlock() } - } +func (this *Activity) NotifyActivityOver(szEnd []string) { + if err := this.service.RpcCall( + context.Background(), + comm.Service_Worker, + string(comm.Rpc_ActivityOver), + pb.RPCGeneralReqB1{ + Param1: "endActivity", + Param2: szEnd, + }, + nil, + ); err != nil { + this.module.Errorln(err) + } +} + +func (this *Activity) NotifyActivityStart(szStart []string) { + if err := this.service.RpcCall( + context.Background(), + comm.Service_Worker, + string(comm.Rpc_ActivityStart), + pb.RPCGeneralReqB1{ + Param1: "startActivity", + Param2: szStart, + }, + nil, + ); err != nil { + this.module.Errorln(err) + } +} func (this *Activity) CheckActivityData() { var ( - szEnd []string // 活动结束 - szStar []string // 有活动开启 + szEnd []string // 活动结束 + szStart []string // 有活动开启 ) - this.hlock.RLock() - for _, v := range this.activity { + this.hlock.Lock() + defer this.hlock.Unlock() + for _, v := range this.curActivity { if v.Etime == configure.Now().Unix() { // 有活动结束 szEnd = append(szEnd, v.Id) - } - if v.Stime == configure.Now().Unix() { // 有活动结束 - szStar = append(szStar, v.Id) + delete(this.curActivity, v.Itype) + this.delActivity[v.Itype] = v + } + } + for _, v := range this.futureActivity { + if v.Stime >= configure.Now().Unix() { // 有活动结束 + szStart = append(szStart, v.Id) + delete(this.futureActivity, v.Itype) + this.curActivity[v.Itype] = v } } - this.hlock.RUnlock() if len(szEnd) > 0 { - if err := this.service.RpcCall( - context.Background(), - comm.Service_Worker, - string(comm.Rpc_ActivityOver), - pb.RPCGeneralReqB1{ - Param1: "endActivity", - Param2: szEnd, - }, - nil, - ); err != nil { - this.module.Errorln(err) - } + this.NotifyActivityOver(szEnd) } - if len(szStar) > 0 { - if err := this.service.RpcCall( - context.Background(), - comm.Service_Worker, - string(comm.Rpc_ActivityStar), - pb.RPCGeneralReqB1{ - Param1: "starActivity", - Param2: szStar, - }, - nil, - ); err != nil { - this.module.Errorln(err) - } + if len(szStart) > 0 { + this.NotifyActivityStart(szStart) } } diff --git a/modules/uigame/api_getlattice.go b/modules/uigame/api_getlattice.go index 36e143ffc..e077b3a45 100644 --- a/modules/uigame/api_getlattice.go +++ b/modules/uigame/api_getlattice.go @@ -25,10 +25,11 @@ func (this *apiComp) GetLattice(session comm.IUserSession, req *pb.UiGameGetLatt ) update = make(map[string]interface{}) curTime := configure.Now().Unix() - if activity, err = this.module.ModuleActivity.GetHdInfoByHdId(req.Hdid); err != nil { // 活动不存在 + if activity, err = this.module.GetActivityData(pb.HdType_HdLattice); err != nil { // 活动不存在 errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ActivityInvalid, - Title: pb.ErrorCode_ActivityInvalid.ToString(), + Code: pb.ErrorCode_ActivityInvalid, + Title: pb.ErrorCode_ActivityInvalid.ToString(), + Message: err.Error(), } return } diff --git a/modules/uigame/api_getminer.go b/modules/uigame/api_getminer.go index 24b0554ba..e433ed9ab 100644 --- a/modules/uigame/api_getminer.go +++ b/modules/uigame/api_getminer.go @@ -25,7 +25,7 @@ func (this *apiComp) GetMiner(session comm.IUserSession, req *pb.UiGameGetMinerR ) update = make(map[string]interface{}) curTime := configure.Now().Unix() - if activity, err = this.module.ModuleActivity.GetHdInfoByHdId(req.Hdid); err != nil { // 活动不存在 + if activity, err = this.module.GetActivityData(pb.HdType_HdMiner); err != nil { // 活动不存在 errdata = &pb.ErrorData{ Code: pb.ErrorCode_ActivityInvalid, Title: pb.ErrorCode_ActivityInvalid.ToString(), diff --git a/modules/uigame/api_getpuzzle.go b/modules/uigame/api_getpuzzle.go index 34466a019..29c01de9c 100644 --- a/modules/uigame/api_getpuzzle.go +++ b/modules/uigame/api_getpuzzle.go @@ -25,7 +25,7 @@ func (this *apiComp) GetPuzzle(session comm.IUserSession, req *pb.UiGameGetPuzzl ) update = make(map[string]interface{}) curTime := configure.Now().Unix() - if activity, err = this.module.ModuleActivity.GetHdInfoByHdId(req.Hdid); err != nil { // 活动不存在 + if activity, err = this.module.GetActivityData(pb.HdType_HdPuzzle); err != nil { // 活动不存在 errdata = &pb.ErrorData{ Code: pb.ErrorCode_ActivityInvalid, Title: pb.ErrorCode_ActivityInvalid.ToString(), diff --git a/modules/uigame/model_lattice.go b/modules/uigame/model_lattice.go index e7386fa9e..34f51c254 100644 --- a/modules/uigame/model_lattice.go +++ b/modules/uigame/model_lattice.go @@ -15,6 +15,7 @@ import ( type modelLattice struct { modules.MCompModel module *UiGame + open bool // 游戏是否开启 } func (this *modelLattice) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { diff --git a/modules/uigame/module.go b/modules/uigame/module.go index 2ce3baa57..eaedc3573 100644 --- a/modules/uigame/module.go +++ b/modules/uigame/module.go @@ -1,6 +1,7 @@ package uigame import ( + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/base" "go_dreamfactory/lego/core" @@ -8,6 +9,7 @@ import ( "go_dreamfactory/sys/configure" cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/utils" + "sync" "go_dreamfactory/modules" ) @@ -20,6 +22,8 @@ type UiGame struct { service base.IRPCXService modelLattice *modelLattice modelMiner *modelMiner + lock sync.RWMutex + hdlist map[pb.HdType]*pb.DBHuodong } func NewModule() core.IModule { @@ -35,6 +39,7 @@ func (this *UiGame) Init(service core.IService, module core.IModule, options cor return } this.service = service.(base.IRPCXService) + this.hdlist = make(map[pb.HdType]*pb.DBHuodong) return } @@ -212,3 +217,32 @@ func (this *UiGame) HDPSTodayConsum(uid string, ps int32) { } } } + +func (this *UiGame) ActivityOpenNotice(hd *pb.DBHuodong) { + this.lock.Lock() + defer this.lock.Unlock() + this.hdlist[hd.Itype] = hd +} + +// 活动关闭通知 +func (this *UiGame) ActivityCloseNotice(hd *pb.DBHuodong) { + this.lock.Lock() + defer this.lock.Unlock() + if _, ok := this.hdlist[hd.Itype]; ok { + delete(this.hdlist, hd.Itype) + } +} + +func (this *UiGame) GetActivityData(itype pb.HdType) (hd *pb.DBHuodong, err error) { + var ( + ok bool + ) + this.lock.RLock() + hd, ok = this.hdlist[itype] + this.lock.RUnlock() + if !ok { + err = fmt.Errorf("not found hditype:%d", itype) + return + } + return +} diff --git a/modules/web/api_activitynotify.go b/modules/web/api_activitynotify.go index 6f0a4dbac..25f61827d 100644 --- a/modules/web/api_activitynotify.go +++ b/modules/web/api_activitynotify.go @@ -27,18 +27,19 @@ func (this *Api_Comp) ActivityNotify(c *engine.Context) { c.JSON(http.StatusOK, &Respond{Code: errdata.Code, Message: errdata.Message, Data: data}) }() - if _, err = this.module.service.RpcGo( + _, err = this.module.service.RpcGo( context.Background(), comm.Service_Worker, string(comm.Rpc_Activity), - req.Id, nil); err != nil { + pb.RPCGeneralReqA1{ + Param1: req.Id, + }, + nil) + if err != nil { this.module.Errorln(err) - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_RpcFuncExecutionError, - Title: pb.ErrorCode_RpcFuncExecutionError.ToString(), - } return } + errdata = &pb.ErrorData{ Code: pb.ErrorCode_Success, Title: pb.ErrorCode_Success.ToString(), diff --git a/sys/configure/structs/Game.OpencondType.go b/sys/configure/structs/Game.OpencondType.go index a7be337cb..c95fe8fc4 100644 --- a/sys/configure/structs/Game.OpencondType.go +++ b/sys/configure/structs/Game.OpencondType.go @@ -14,4 +14,5 @@ const ( GameOpencondType_Maxmapid = 2 GameOpencondType_Worldtaskid = 3 GameOpencondType_Friend = 4 + GameOpencondType_MoonLevel = 5 )