diff --git a/bin/json/game_gameid.json b/bin/json/game_gameid.json index 5f284a9eb..e057cabae 100644 --- a/bin/json/game_gameid.json +++ b/bin/json/game_gameid.json @@ -53,7 +53,7 @@ }, { "id": 40002, - "type": 3 + "type": 4 }, { "id": 40003, diff --git a/bin/json/game_global.json b/bin/json/game_global.json index d19fb28fb..885a0a38e 100644 --- a/bin/json/game_global.json +++ b/bin/json/game_global.json @@ -43,18 +43,6 @@ "load_chat": 10, "channel_allocation_max": 2000, "channel_switching_max": 3000, - "draw_toplimit": 9999, - "draw10_star4_max": 8, - "draw10_star5_max": 2, - "draw_floor_star4": 20, - "draw_floor_star5": 100, - "duplicate_removal": 1, - "base_pool_cost": { - "a": "item", - "t": "10000001", - "n": 1 - }, - "replace_pro": 1000, "reward_star4": { "a": "item", "t": "10000101", @@ -65,101 +53,9 @@ "t": "10000101", "n": 30 }, - "exchange_hero": { - "a": "item", - "t": "10000101", - "n": 150 - }, - "camp1_pool_cost": { - "a": "item", - "t": "10000001", - "n": 1 - }, - "camp2_pool_cost": { - "a": "item", - "t": "10000001", - "n": 1 - }, - "camp3_pool_cost": { - "a": "item", - "t": "10000001", - "n": 1 - }, - "camp4_pool_cost": { - "a": "item", - "t": "10000001", - "n": 1 - }, - "base_pool_10cost": { - "a": "item", - "t": "10000001", - "n": 10 - }, - "camp1_pool_10cost": { - "a": "item", - "t": "10000001", - "n": 10 - }, - "camp2_pool_10cost": { - "a": "item", - "t": "10000001", - "n": 10 - }, - "camp3_pool_10cost": { - "a": "item", - "t": "10000001", - "n": 10 - }, - "camp4_pool_10cost": { - "a": "item", - "t": "10000001", - "n": 10 - }, - "camp1_pool1": "camp1_pool", - "camp2_pool1": "camp2_pool", - "camp3_pool1": "camp3_pool", - "camp4_pool1": "camp4_pool", - "base_pool1": { - "s": 1, - "e": 1, - "p": "base_pool1" - }, - "base_pool2": { - "s": 2, - "e": 2, - "p": "base_pool2" - }, - "base_pool3": { - "s": 3, - "e": 3, - "p": "base_pool3" - }, - "base_pool4": { - "s": 4, - "e": 4, - "p": "base_pool4" - }, - "base_pool5": { - "s": 5, - "e": 5, - "p": "base_pool5" - }, - "base_pool6": { - "s": 6, - "e": 6, - "p": "base_pool6" - }, - "base_pool7": { - "s": 7, - "e": 999999999, - "p": "base_pool7" - }, - "base_pool_star3": 333, - "base_pool_star4": 333, - "base_pool_star5": 334, - "camp_pool_star3": 9500, - "camp_pool_star4": 900, - "camp_pool_star5": 100, + "draw_toplimit": 9999, + "draw10_star4_max": 8, + "draw10_star5_max": 2, "gourmet": 36000, "smithy_maxplayer": 20, "smithy_maxtime": 36000, @@ -358,27 +254,6 @@ "skillGetLocation": [ 114 ], - "DrawCard_RechargeReward": [ - 648, - 30 - ], - "DrawCard_RegressionReward": [ - 7, - 10 - ], - "DrawCard_5StarsInRange": [ - 1, - 29, - 5 - ], - "DrawCard_5StarsInRange1": [ - 30, - 49, - 5 - ], - "DrawCard_5StarsInRange1_pool": "base_pool7", - "DrawCard_ContinuousRestriction_Star5": 20, - "DrawCard_ContinuousRestriction_Camp": 2, "EquipmentConsumption": [ 1000, 2000, @@ -387,8 +262,6 @@ 5000, 6000 ], - "DrawCard_supplement1": 1000001, - "DrawCard_supplement10": 1000002, "CGPloatTxt": [ "First_plot1", "First_plot2", diff --git a/bin/json/game_mainstage.json b/bin/json/game_mainstage.json index e04d67217..225e88639 100644 --- a/bin/json/game_mainstage.json +++ b/bin/json/game_mainstage.json @@ -18642,8 +18642,8 @@ "buried_type": 0, "buried": 0, "grouptype": [], - "Episodetype": 1, - "stage_param": 0, + "Episodetype": 5, + "stage_param": 40001, "inherit": 0, "battle_fail": 0, "venturemodelspeed": 0, @@ -18765,8 +18765,8 @@ "buried_type": 0, "buried": 0, "grouptype": [], - "Episodetype": 1, - "stage_param": 0, + "Episodetype": 5, + "stage_param": 40002, "inherit": 0, "battle_fail": 0, "venturemodelspeed": 12, diff --git a/bin/json/game_tdmonster.json b/bin/json/game_tdmonster.json index 6c5dc852e..1e708efe1 100644 --- a/bin/json/game_tdmonster.json +++ b/bin/json/game_tdmonster.json @@ -7,10 +7,10 @@ }, "monster_skillid": 0, "monster_type": 0, - "model": "Spine/dalong.prefab", + "model": "Spine/TD/1001.prefab", "multiple": 1, - "width": 1, - "height": 1, + "width": 2, + "height": 3, "hp": 20, "dis": 2, "atk": 1, @@ -26,10 +26,10 @@ }, "monster_skillid": 0, "monster_type": 0, - "model": "Spine/dalong.prefab", + "model": "Spine/TD/1001.prefab", "multiple": 1, - "width": 1, - "height": 1, + "width": 2, + "height": 3, "hp": 30, "dis": 3, "atk": 3, @@ -45,10 +45,10 @@ }, "monster_skillid": 2011, "monster_type": 0, - "model": "Spine/dalong.prefab", + "model": "Spine/TD/1001.prefab", "multiple": 1, - "width": 1, - "height": 1.5, + "width": 2, + "height": 3, "hp": 20, "dis": 4, "atk": 1, @@ -64,10 +64,10 @@ }, "monster_skillid": 2021, "monster_type": 0, - "model": "Spine/dalong.prefab", + "model": "Spine/TD/1001.prefab", "multiple": 1, - "width": 1, - "height": 1.5, + "width": 2, + "height": 3, "hp": 30, "dis": 5, "atk": 1, @@ -83,10 +83,10 @@ }, "monster_skillid": 2022, "monster_type": 0, - "model": "Spine/dalong.prefab", + "model": "Spine/TD/1001.prefab", "multiple": 1, - "width": 1, - "height": 2, + "width": 2, + "height": 3, "hp": 50, "dis": 6, "atk": 1, @@ -102,10 +102,10 @@ }, "monster_skillid": 2031, "monster_type": 0, - "model": "Spine/dalong.prefab", + "model": "Spine/TD/1001.prefab", "multiple": 1, - "width": 1, - "height": 2, + "width": 2, + "height": 3, "hp": 100, "dis": 7, "atk": 1, @@ -121,9 +121,9 @@ }, "monster_skillid": 3011, "monster_type": 1, - "model": "Spine/dalong.prefab", + "model": "Spine/TD/1001.prefab", "multiple": 1, - "width": 3, + "width": 2, "height": 3, "hp": 100, "dis": 8, diff --git a/bin/json/game_unblanking.json b/bin/json/game_unblanking.json index 2cf8d8924..8762de3b9 100644 --- a/bin/json/game_unblanking.json +++ b/bin/json/game_unblanking.json @@ -1,6 +1,6 @@ [ { - "id": 40001, + "id": 40002, "key": 1001, "type": 0, "pic": "", @@ -28,7 +28,7 @@ "time": 120 }, { - "id": 40002, + "id": 40001, "key": 1001, "type": 1, "pic": "", diff --git a/comm/imodule.go b/comm/imodule.go index fc0460bee..fc9ef5624 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -120,9 +120,6 @@ type ( // 推送属性变化 PushHeroProperty(session IUserSession, heros []*pb.DBHero) (err error) - // 充值了多少钱 - RechargeMoney(uid string, money int32) - // 拥有N个X级英雄 CheckLvNum(uid string, lv int32) int32 diff --git a/modules/caravan/module.go b/modules/caravan/module.go index 9f2926236..749ef8b9e 100644 --- a/modules/caravan/module.go +++ b/modules/caravan/module.go @@ -41,6 +41,7 @@ func (this *Caravan) Init(service core.IService, module core.IModule, options co if err = this.ModuleBase.Init(service, module, options); err != nil { return } + this.service = service.(base.IRPCXService) return } diff --git a/modules/entertainment/model.go b/modules/entertainment/model.go index 6202a74ae..f78b800f6 100644 --- a/modules/entertainment/model.go +++ b/modules/entertainment/model.go @@ -57,7 +57,7 @@ func (this *modelComp) getEntertainmList(uid string) (result *pb.DBXXLData, err result.Id = primitive.NewObjectID().Hex() result.Uid = uid result.Reward = make(map[int32]int32) - result.Card = make(map[string]int32, 0) + result.Card = make(map[string]int32) } // 初始化默认获得类型为1的卡片 for _, v := range this.module.configure.GetInitGameConsumeHero() { diff --git a/modules/entertainment/room.go b/modules/entertainment/room.go index 062136fdc..3dc8522ba 100644 --- a/modules/entertainment/room.go +++ b/modules/entertainment/room.go @@ -175,7 +175,8 @@ func (this *Room) AiOperator() { } this.curPower = this.NexPower if this.RoomType == 2 && this.curPower == this.player2.Userinfo.Uid { - this.AiOperator() + //this.AiOperator() + this.AutoOperator(this.player2) } } @@ -204,85 +205,8 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr color = 2 } if req.Itype == 1 { //释放技能 - // 能量校验 - if color == 1 { // 玩家1 放技能 - conf, err := this.module.configure.GetGameConsumeHero(this.player1.Cardid) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_EntertainNoHeroSkill, - Title: pb.ErrorCode_EntertainNoHeroSkill.ToString(), - } - return - } - if this.player1.Energy >= conf.Skillload { - this.player1.Energy = 0 // 清零 - if _, m := this.chessboard.SkillUp(req.Curid, color, conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 { - szMap = append(szMap, m...) - } else { - szMap = append(szMap, &pb.MapData{ - Data: this.chessboard.GetPalatData(), - }) - } - for _, v := range szMap { - curScore += v.CurSocre - this.player1.Score += v.CurSocre - v.CurSocre = this.player1.Score - } - - } else { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_EntertainNoEnergy, - Title: pb.ErrorCode_EntertainNoEnergy.ToString(), - } - return - } - this.NexPower = this.curPower - } else { - conf, err := this.module.configure.GetGameConsumeHero(this.player2.Cardid) - if err != nil { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_EntertainNoHeroSkill, - Title: pb.ErrorCode_EntertainNoHeroSkill.ToString(), - } - return - } - if this.player2.Energy >= conf.Skillload { - this.player2.Energy = 0 // 清零 - if _, m := this.chessboard.SkillUp(0, color, conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 { - szMap = append(szMap, m...) - } else { - szMap = append(szMap, &pb.MapData{ - Data: this.chessboard.GetPalatData(), - }) - } - for _, v := range szMap { - curScore += v.CurSocre - this.player2.Score += v.CurSocre - v.CurSocre = this.player2.Score - } - - } else { - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_EntertainNoEnergy, - Title: pb.ErrorCode_EntertainNoEnergy.ToString(), - } - return - } - this.NexPower = this.curPower - } - if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ - Mpadata: szMap, - Power: this.NexPower, - Curpower: this.curPower, - Score: curScore, - Round: this.round, - User1: this.player1, - User2: this.player2, - Itype: req.Itype, - Curid: oid1, - Targetid: oid2, - }, this.szSession...); err != nil { - this.module.Errorln(err) + if errdata = this.UserSkillUp(color, req.Curid); errdata != nil { + return } return } @@ -519,7 +443,8 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr this.module.Errorln(err) } if this.curPower == this.player2.Userinfo.Uid { - this.AiOperator() + //this.AiOperator() + this.AutoOperator(this.player2) } } else { @@ -538,6 +463,7 @@ func (this *Room) ReceiveMessage(session comm.IUserSession, stype string, msg pr case "offline": req := msg.(*pb.RPCGeneralReqA2) fmt.Printf("useroffline: %v\n", req) + if this.RoomType == 2 { // AI 对战直接结束 this.Status = 2 // 解散 this.ModifyUserRoomInfoData() @@ -742,14 +668,7 @@ func (this *Room) AutoOperator(p *pb.PlayerData) { szMap, oid1, oid2, bAddPs = this.chessboard.AiSwapGirde() p.Ps-- if p.Ps <= 0 { // 权限给下一个人 - if p == this.player2 { - this.NexPower = this.player1.Userinfo.Uid - this.player1.Ps = MaxPs - } else { - this.NexPower = this.player2.Userinfo.Uid - this.player2.Ps = MaxPs - } - + this.ChangePower() this.round++ } if bAddPs { @@ -799,7 +718,112 @@ func (this *Room) AutoOperator(p *pb.PlayerData) { return } this.curPower = this.NexPower - if this.RoomType == 2 && this.curPower == this.player2.Userinfo.Uid { - this.AutoOperator(this.player2) + if this.RoomType == 2 && this.curPower == p.Userinfo.Uid { + this.AutoOperator(p) + } +} + +// 玩家释放技能 +func (this *Room) UserSkillUp(color int32, curid int32) (errdata *pb.ErrorData) { + var ( + curScore int32 // 该次操作的得分 + oid1 int32 // 唯一id + oid2 int32 + ) + var szMap []*pb.MapData + // 能量校验 + if color == 1 { // 玩家1 放技能 + conf, err := this.module.configure.GetGameConsumeHero(this.player1.Cardid) + if err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_EntertainNoHeroSkill, + Title: pb.ErrorCode_EntertainNoHeroSkill.ToString(), + } + return + } + if this.player1.Energy >= conf.Skillload { + this.player1.Energy = 0 // 清零 + if _, m := this.chessboard.SkillUp(curid, color, conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 { + szMap = append(szMap, m...) + } else { + szMap = append(szMap, &pb.MapData{ + Data: this.chessboard.GetPalatData(), + }) + } + for _, v := range szMap { + curScore += v.CurSocre + this.player1.Score += v.CurSocre + v.CurSocre = this.player1.Score + } + + } else { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_EntertainNoEnergy, + Title: pb.ErrorCode_EntertainNoEnergy.ToString(), + } + return + } + this.NexPower = this.curPower + } else { + conf, err := this.module.configure.GetGameConsumeHero(this.player2.Cardid) + if err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_EntertainNoHeroSkill, + Title: pb.ErrorCode_EntertainNoHeroSkill.ToString(), + } + return + } + if this.player2.Energy >= conf.Skillload { + this.player2.Energy = 0 // 清零 + if _, m := this.chessboard.SkillUp(curid, color, conf.Skilleffect, conf.Skillvalue, true); len(m) > 0 { + szMap = append(szMap, m...) + } else { + szMap = append(szMap, &pb.MapData{ + Data: this.chessboard.GetPalatData(), + }) + } + for _, v := range szMap { + curScore += v.CurSocre + this.player2.Score += v.CurSocre + v.CurSocre = this.player2.Score + } + + } else { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_EntertainNoEnergy, + Title: pb.ErrorCode_EntertainNoEnergy.ToString(), + } + return + } + this.NexPower = this.curPower + } + if err := this.module.SendMsgSyncToSession(string(this.module.GetType()), "operatorrst", &pb.EntertainOperatorRstPush{ + Mpadata: szMap, + Power: this.NexPower, + Curpower: this.curPower, + Score: curScore, + Round: this.round, + User1: this.player1, + User2: this.player2, + Itype: 1, + Curid: oid1, + Targetid: oid2, + }, this.szSession...); err != nil { + this.module.Errorln(err) + } + return +} + +// 交换玩家权限 +func (this *Room) ChangePower() { + if this.curPower == this.player1.Userinfo.Uid { + this.NexPower = this.player2.Userinfo.Uid + this.player2.Ps = MaxPs + this.player1.Ps = 0 + } + if this.curPower == this.player2.Userinfo.Uid { + this.NexPower = this.player1.Userinfo.Uid + this.player1.Ps = MaxPs + this.player2.Ps = 0 } } diff --git a/modules/entertainment/xxlPlat.go b/modules/entertainment/xxlPlat.go index 9e0ecd301..87010a403 100644 --- a/modules/entertainment/xxlPlat.go +++ b/modules/entertainment/xxlPlat.go @@ -65,8 +65,7 @@ func (this *MapData) CreateGride(count int) (girdes []*pb.GirdeData) { Special: 0, } id = this.GetRandType() - conf, err = this.module.configure.GetGameBlockByKey(id) - if err == nil { + if conf, err = this.module.configure.GetGameBlockByKey(id); err == nil { girde.Color = conf.Color girde.Cid = conf.Key girde.Special = conf.Type @@ -124,19 +123,20 @@ func (this *MapData) InitMap(module *Entertainment, iType int32) { var mp map[int32]struct{} mp = make(map[int32]struct{}, 0) for { - n1, _ := rand.Int(rand.Reader, big.NewInt(Total-1)) + n1, _ := rand.Int(rand.Reader, big.NewInt(Total)) mp[int32(n1.Int64())] = struct{}{} if len(mp) >= 2 { break } } - if iType == 3 { - sp = 4 - } else if iType == 4 { - n1, _ := rand.Int(rand.Reader, big.NewInt(4)) // 随机一个消除类型 - sp = int32(n1.Int64()) + 5 - } + for key := range mp { + if iType == 3 { + sp = 4 + } else if iType == 4 { + n1, _ := rand.Int(rand.Reader, big.NewInt(4)) // 随机一个消除类型 + sp = int32(n1.Int64()) + 5 + } if conf, err := this.module.configure.GetGameBlock(this.Plat[key].Color, sp); err == nil { this.Plat[key].Cid = conf.Key this.Plat[key].Special = conf.Type @@ -548,6 +548,9 @@ func (this *MapData) DropGirde() bool { } } } + if len(fill) == 0 { + return bDrop + } sz := this.CreateGride(len(fill)) for pos, id := range fill { this.Plat[id] = sz[pos] @@ -586,13 +589,14 @@ func (this *MapData) DropGirde() bool { mp[fill[n1.Int64()]] = struct{}{} } - if this.iType == 3 { - sp = 4 - } else if this.iType == 4 { - n1, _ := rand.Int(rand.Reader, big.NewInt(4)) // 随机一个消除类型 - sp = int32(n1.Int64()) + 5 - } + for key := range mp { + if this.iType == 3 { + sp = 4 + } else if this.iType == 4 { + n1, _ := rand.Int(rand.Reader, big.NewInt(4)) // 随机一个消除类型 + sp = int32(n1.Int64()) + 5 + } if conf, err := this.module.configure.GetGameBlock(this.Plat[key].Color, sp); err == nil { this.Plat[key].Cid = conf.Key this.Plat[key].Special = conf.Type diff --git a/modules/entertainment/xxl_test.go b/modules/entertainment/xxl_test.go index c9ff15af2..1fe4c8552 100644 --- a/modules/entertainment/xxl_test.go +++ b/modules/entertainment/xxl_test.go @@ -1,6 +1,7 @@ package entertainment_test import ( + "context" "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego" @@ -67,7 +68,33 @@ func NewService(ops ...rpcx.Option) core.IService { s.Configure(ops...) return s } +func t() { + ch := make(chan struct{}) + //ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second) + ctx, cancel := context.WithCancel(context.Background()) + go func(ctx context.Context) { + for { + select { + case <-ctx.Done(): + ch <- struct{}{} + return + default: + fmt.Println("x...") + } + + time.Sleep(500 * time.Millisecond) + } + }(ctx) + + go func() { + time.Sleep(3 * time.Second) + cancel() + }() + + <-ch + fmt.Println("结束") +} func Test_Main(t *testing.T) { flag.Parse() diff --git a/modules/hero/module.go b/modules/hero/module.go index 0ffa30668..4d29eeb8f 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -2,7 +2,6 @@ package hero import ( "context" - "crypto/rand" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/event" @@ -13,7 +12,6 @@ import ( cfg "go_dreamfactory/sys/configure/structs" "go_dreamfactory/sys/db" "go_dreamfactory/utils" - "math/big" "go.mongodb.org/mongo-driver/bson" ) @@ -380,154 +378,6 @@ func (this *Hero) PushHeroProperty(session comm.IUserSession, heros []*pb.DBHero return } -// 充值了多少钱 -func (this *Hero) RechargeMoney(uid string, money int32) { - conf := this.ModuleTools.GetGlobalConf() - if conf != nil { - if len(conf.DrawCardRechargeReward) != 2 { - return - } - if money != conf.DrawCardRechargeReward[0] { - return - } - } - if record, err := this.modelRecord.GetHeroRecord(uid); err != nil { - update := map[string]interface{}{} - - if v, ok := record.Condition["recharge"]; !ok { - record.Condition["recharge"] = 0 - } else { - if conf.DrawCardRechargeReward[1] < v { - record.Condition["recharge"] = 0 - } - } - // 同步数据 - update["condition"] = record.Condition - if err := this.modelRecord.ChangeHeroRecord(uid, update); err != nil { - this.Errorf("ChangeHeroRecord error: %v", err) - } - } -} - -// 多少天没登录 -func (this *Hero) NoLoginDay(uid string, day int32) { - conf := this.ModuleTools.GetGlobalConf() - if conf != nil { - if len(conf.DrawCardRegressionReward) != 2 { - return - } - if day != conf.DrawCardRegressionReward[0] { - return - } - } - if record, err := this.modelRecord.GetHeroRecord(uid); err != nil { - update := map[string]interface{}{} - - if v, ok := record.Condition["login"]; !ok { - record.Condition["login"] = 0 - } else { - if conf.DrawCardRegressionReward[1] < v { - record.Condition["login"] = 0 - } - } - // 同步数据 - update["condition"] = record.Condition - if err := this.modelRecord.ChangeHeroRecord(uid, update); err != nil { - this.Errorf("ChangeHeroRecord error: %v", err) - } - } -} - -// 连续抽卡最多连续出A个相同阵营的英雄(普通卡池) -/* -heroCid 抽到的5星英雄ID -drawCount 当前抽卡次数 -poll 当前卡池 -返回值 newCid不满足抽卡要求替换其他5星英雄 -*/ -func (this *Hero) ContinuousRestriction(uid string, heroCid string, drawCount int32, pool string) (newCid string) { - var ( - update map[string]interface{} - ) - record, err := this.modelRecord.GetHeroRecord(uid) - if err != nil { - return heroCid - } - for heroid, index := range record.Star5Hero { - if heroid == heroCid { - conf := this.ModuleTools.GetGlobalConf() //. - iMaxCOunt := conf.DrawCardContinuousRestrictionStar5 - if drawCount-index <= iMaxCOunt { // 连续n次还获得该英雄 直接替换其他英雄 - for i := 0; i < 99; i++ { - if newCid, err := this.configure.GetHeroByPool(pool); err != nil { - if newCid != heroCid { - return newCid - } - } - } - record.Star5Hero[heroid] = drawCount - update["star5Hero"] = record.Star5Hero - this.modelRecord.ChangeHeroRecord(uid, update) // 更新信息 - return heroCid - - } - } - } - return heroCid -} - -// 检查充值和未登录天数之内抽卡是否抽中 -func (this *Hero) CheckCondition(uid string) bool { - var ( - curCount int32 - update map[string]interface{} - ) - update = make(map[string]interface{}, 0) - defer this.modelRecord.ChangeHeroRecord(uid, update) - record, _ := this.modelRecord.GetHeroRecord(uid) - if v, ok := record.Condition["recharge"]; ok { - conf := this.ModuleTools.GetGlobalConf() //. - if len(conf.DrawCardRechargeReward) == 2 { - curCount = conf.DrawCardRechargeReward[1] - } - if v >= curCount { // 触发保底 直接给5星 - delete(record.Condition, "recharge") - update["condition"] = record.Condition - return true - } else { // 1/curCount概率 - n, _ := rand.Int(rand.Reader, big.NewInt(int64(curCount))) - if n.Int64() < 1 { - - delete(record.Condition, "recharge") - update["condition"] = record.Condition - return true - } - record.Condition["recharge"] += 1 - } - } - if v, ok := record.Condition["login"]; ok { - conf := this.ModuleTools.GetGlobalConf() //. - if len(conf.DrawCardRegressionReward) == 2 { - curCount = conf.DrawCardRegressionReward[1] - } - if v >= curCount { // 触发保底 直接给5星 - delete(record.Condition, "login") - update["login"] = record.Condition - return true - } else { // 1/curCount概率 - n, _ := rand.Int(rand.Reader, big.NewInt(int64(curCount))) - - if n.Int64() < 1 { - delete(record.Condition, "login") - update["login"] = record.Condition - return true - } - record.Condition["login"] += 1 - } - } - return false -} - // 检查大于lv等级英雄的数量 func (this *Hero) CheckLvNum(uid string, lv int32) int32 { diff --git a/modules/jielong/api_reward.go b/modules/jielong/api_reward.go index 2d239a0aa..d5adf9fa6 100644 --- a/modules/jielong/api_reward.go +++ b/modules/jielong/api_reward.go @@ -24,7 +24,6 @@ func (this *apiComp) Reward(session comm.IUserSession, req *pb.JielongRewardReq) if errdata = this.RewardCheck(session, req); errdata != nil { return } - // TODO 等策划配置来再做数据校验 list, err = this.module.modelJielong.getUserJielongData(session.GetUserId()) if err != nil { errdata = &pb.ErrorData{ diff --git a/modules/pay/module.go b/modules/pay/module.go index 109fdd1af..5d2e3a67e 100644 --- a/modules/pay/module.go +++ b/modules/pay/module.go @@ -206,7 +206,6 @@ func (this *Pay) Rpc_ModulePayDelivery(ctx context.Context, args *pb.PayDelivery } go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { - this.ModuleHero.RechargeMoney(args.Uid, args.Price) this.ModuleBuried.TriggerBuried(session, comm.GetBuriedParam(comm.Rtype229, 1, conf.Pid)) this.WriteUserLog(session.GetUserId(), 0, "Rpc_ModulePayDelivery", res) }) @@ -317,7 +316,6 @@ func (this *Pay) ModulePayDelivery(session comm.IUserSession, Productid string, } go this.AsynHandleSession(session.Clone(), func(session comm.IUserSession) { this.WriteUserLog(session.GetUserId(), 0, "ModulePayDelivery", res) - this.ModuleHero.RechargeMoney(session.GetUserId(), conf.Amount) }) return } diff --git a/modules/web/api_activitynotify.go b/modules/web/api_activitynotify.go index df2a706eb..6f0a4dbac 100644 --- a/modules/web/api_activitynotify.go +++ b/modules/web/api_activitynotify.go @@ -13,7 +13,6 @@ type ActivityNotifyReq struct { Id string `json:"_id"` // oid } -//创建邮件 func (this *Api_Comp) ActivityNotify(c *engine.Context) { req := &ActivityNotifyReq{} 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 ) diff --git a/sys/configure/structs/game.globalData.go b/sys/configure/structs/game.globalData.go index 87d0bfac7..d2fbeb907 100644 --- a/sys/configure/structs/game.globalData.go +++ b/sys/configure/structs/game.globalData.go @@ -36,43 +36,11 @@ type GameGlobalData struct { LoadChat int32 ChannelAllocationMax int32 ChannelSwitchingMax int32 + RewardStar4 *Gameatn + RewardStar5 *Gameatn DrawToplimit int32 Draw10Star4Max int32 Draw10Star5Max int32 - DrawFloorStar4 int32 - DrawFloorStar5 int32 - DuplicateRemoval int32 - BasePoolCost *Gameatn - ReplacePro int32 - RewardStar4 *Gameatn - RewardStar5 *Gameatn - ExchangeHero *Gameatn - Camp1PoolCost *Gameatn - Camp2PoolCost *Gameatn - Camp3PoolCost *Gameatn - Camp4PoolCost *Gameatn - BasePool10cost *Gameatn - Camp1Pool10cost *Gameatn - Camp2Pool10cost *Gameatn - Camp3Pool10cost *Gameatn - Camp4Pool10cost *Gameatn - Camp1Pool1 string - Camp2Pool1 string - Camp3Pool1 string - Camp4Pool1 string - BasePool1 *Gamebasepool - BasePool2 *Gamebasepool - BasePool3 *Gamebasepool - BasePool4 *Gamebasepool - BasePool5 *Gamebasepool - BasePool6 *Gamebasepool - BasePool7 *Gamebasepool - BasePoolStar3 int32 - BasePoolStar4 int32 - BasePoolStar5 int32 - CampPoolStar3 int32 - CampPoolStar4 int32 - CampPoolStar5 int32 Gourmet int32 SmithyMaxplayer int32 SmithyMaxtime int32 @@ -145,16 +113,7 @@ type GameGlobalData struct { GirlHeadPortrait string Namecolor string SkillGetLocation []int32 - DrawCardRechargeReward []int32 - DrawCardRegressionReward []int32 - DrawCard5StarsInRange []int32 - DrawCard5StarsInRange1 []int32 - DrawCard5StarsInRange1Pool string - DrawCardContinuousRestrictionStar5 int32 - DrawCardContinuousRestrictionCamp int32 EquipmentConsumption []int32 - DrawCardSupplement1 int32 - DrawCardSupplement10 int32 CGPloatTxt []string VIPDaysSent int32 MonthlyCardDaysSent int32 @@ -391,43 +350,11 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["load_chat"].(float64); !_ok_ { err = errors.New("load_chat error"); return }; _v.LoadChat = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["channel_allocation_max"].(float64); !_ok_ { err = errors.New("channel_allocation_max error"); return }; _v.ChannelAllocationMax = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["channel_switching_max"].(float64); !_ok_ { err = errors.New("channel_switching_max error"); return }; _v.ChannelSwitchingMax = int32(_tempNum_) } + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["reward_star4"].(map[string]interface{}); !_ok_ { err = errors.New("reward_star4 error"); return }; if _v.RewardStar4, err = DeserializeGameatn(_x_); err != nil { return } } + { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["reward_star5"].(map[string]interface{}); !_ok_ { err = errors.New("reward_star5 error"); return }; if _v.RewardStar5, err = DeserializeGameatn(_x_); err != nil { return } } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["draw_toplimit"].(float64); !_ok_ { err = errors.New("draw_toplimit error"); return }; _v.DrawToplimit = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["draw10_star4_max"].(float64); !_ok_ { err = errors.New("draw10_star4_max error"); return }; _v.Draw10Star4Max = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["draw10_star5_max"].(float64); !_ok_ { err = errors.New("draw10_star5_max error"); return }; _v.Draw10Star5Max = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["draw_floor_star4"].(float64); !_ok_ { err = errors.New("draw_floor_star4 error"); return }; _v.DrawFloorStar4 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["draw_floor_star5"].(float64); !_ok_ { err = errors.New("draw_floor_star5 error"); return }; _v.DrawFloorStar5 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["duplicate_removal"].(float64); !_ok_ { err = errors.New("duplicate_removal error"); return }; _v.DuplicateRemoval = int32(_tempNum_) } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool_cost error"); return }; if _v.BasePoolCost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["replace_pro"].(float64); !_ok_ { err = errors.New("replace_pro error"); return }; _v.ReplacePro = int32(_tempNum_) } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["reward_star4"].(map[string]interface{}); !_ok_ { err = errors.New("reward_star4 error"); return }; if _v.RewardStar4, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["reward_star5"].(map[string]interface{}); !_ok_ { err = errors.New("reward_star5 error"); return }; if _v.RewardStar5, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["exchange_hero"].(map[string]interface{}); !_ok_ { err = errors.New("exchange_hero error"); return }; if _v.ExchangeHero, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp1_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp1_pool_cost error"); return }; if _v.Camp1PoolCost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp2_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp2_pool_cost error"); return }; if _v.Camp2PoolCost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp3_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp3_pool_cost error"); return }; if _v.Camp3PoolCost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp4_pool_cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp4_pool_cost error"); return }; if _v.Camp4PoolCost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool_10cost error"); return }; if _v.BasePool10cost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp1_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp1_pool_10cost error"); return }; if _v.Camp1Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp2_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp2_pool_10cost error"); return }; if _v.Camp2Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp3_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp3_pool_10cost error"); return }; if _v.Camp3Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["camp4_pool_10cost"].(map[string]interface{}); !_ok_ { err = errors.New("camp4_pool_10cost error"); return }; if _v.Camp4Pool10cost, err = DeserializeGameatn(_x_); err != nil { return } } - { var _ok_ bool; if _v.Camp1Pool1, _ok_ = _buf["camp1_pool1"].(string); !_ok_ { err = errors.New("camp1_pool1 error"); return } } - { var _ok_ bool; if _v.Camp2Pool1, _ok_ = _buf["camp2_pool1"].(string); !_ok_ { err = errors.New("camp2_pool1 error"); return } } - { var _ok_ bool; if _v.Camp3Pool1, _ok_ = _buf["camp3_pool1"].(string); !_ok_ { err = errors.New("camp3_pool1 error"); return } } - { var _ok_ bool; if _v.Camp4Pool1, _ok_ = _buf["camp4_pool1"].(string); !_ok_ { err = errors.New("camp4_pool1 error"); return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool1"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool1 error"); return }; if _v.BasePool1, err = DeserializeGamebasepool(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool2"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool2 error"); return }; if _v.BasePool2, err = DeserializeGamebasepool(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool3"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool3 error"); return }; if _v.BasePool3, err = DeserializeGamebasepool(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool4"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool4 error"); return }; if _v.BasePool4, err = DeserializeGamebasepool(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool5"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool5 error"); return }; if _v.BasePool5, err = DeserializeGamebasepool(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool6"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool6 error"); return }; if _v.BasePool6, err = DeserializeGamebasepool(_x_); err != nil { return } } - { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _buf["base_pool7"].(map[string]interface{}); !_ok_ { err = errors.New("base_pool7 error"); return }; if _v.BasePool7, err = DeserializeGamebasepool(_x_); err != nil { return } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["base_pool_star3"].(float64); !_ok_ { err = errors.New("base_pool_star3 error"); return }; _v.BasePoolStar3 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["base_pool_star4"].(float64); !_ok_ { err = errors.New("base_pool_star4 error"); return }; _v.BasePoolStar4 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["base_pool_star5"].(float64); !_ok_ { err = errors.New("base_pool_star5 error"); return }; _v.BasePoolStar5 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["camp_pool_star3"].(float64); !_ok_ { err = errors.New("camp_pool_star3 error"); return }; _v.CampPoolStar3 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["camp_pool_star4"].(float64); !_ok_ { err = errors.New("camp_pool_star4 error"); return }; _v.CampPoolStar4 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["camp_pool_star5"].(float64); !_ok_ { err = errors.New("camp_pool_star5 error"); return }; _v.CampPoolStar5 = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["gourmet"].(float64); !_ok_ { err = errors.New("gourmet error"); return }; _v.Gourmet = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxplayer"].(float64); !_ok_ { err = errors.New("smithy_maxplayer error"); return }; _v.SmithyMaxplayer = int32(_tempNum_) } { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["smithy_maxtime"].(float64); !_ok_ { err = errors.New("smithy_maxtime error"); return }; _v.SmithyMaxtime = int32(_tempNum_) } @@ -708,65 +635,6 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { } } - { - var _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["DrawCard_RechargeReward"].([]interface{}); !_ok_ { err = errors.New("DrawCard_RechargeReward error"); return } - - _v.DrawCardRechargeReward = make([]int32, 0, len(_arr_)) - - for _, _e_ := range _arr_ { - var _list_v_ int32 - { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } - _v.DrawCardRechargeReward = append(_v.DrawCardRechargeReward, _list_v_) - } - } - - { - var _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["DrawCard_RegressionReward"].([]interface{}); !_ok_ { err = errors.New("DrawCard_RegressionReward error"); return } - - _v.DrawCardRegressionReward = make([]int32, 0, len(_arr_)) - - for _, _e_ := range _arr_ { - var _list_v_ int32 - { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } - _v.DrawCardRegressionReward = append(_v.DrawCardRegressionReward, _list_v_) - } - } - - { - var _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["DrawCard_5StarsInRange"].([]interface{}); !_ok_ { err = errors.New("DrawCard_5StarsInRange error"); return } - - _v.DrawCard5StarsInRange = make([]int32, 0, len(_arr_)) - - for _, _e_ := range _arr_ { - var _list_v_ int32 - { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } - _v.DrawCard5StarsInRange = append(_v.DrawCard5StarsInRange, _list_v_) - } - } - - { - var _arr_ []interface{} - var _ok_ bool - if _arr_, _ok_ = _buf["DrawCard_5StarsInRange1"].([]interface{}); !_ok_ { err = errors.New("DrawCard_5StarsInRange1 error"); return } - - _v.DrawCard5StarsInRange1 = make([]int32, 0, len(_arr_)) - - for _, _e_ := range _arr_ { - var _list_v_ int32 - { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) } - _v.DrawCard5StarsInRange1 = append(_v.DrawCard5StarsInRange1, _list_v_) - } - } - - { var _ok_ bool; if _v.DrawCard5StarsInRange1Pool, _ok_ = _buf["DrawCard_5StarsInRange1_pool"].(string); !_ok_ { err = errors.New("DrawCard_5StarsInRange1_pool error"); return } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_ContinuousRestriction_Star5"].(float64); !_ok_ { err = errors.New("DrawCard_ContinuousRestriction_Star5 error"); return }; _v.DrawCardContinuousRestrictionStar5 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_ContinuousRestriction_Camp"].(float64); !_ok_ { err = errors.New("DrawCard_ContinuousRestriction_Camp error"); return }; _v.DrawCardContinuousRestrictionCamp = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool @@ -781,8 +649,6 @@ func (_v *GameGlobalData)Deserialize(_buf map[string]interface{}) (err error) { } } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_supplement1"].(float64); !_ok_ { err = errors.New("DrawCard_supplement1 error"); return }; _v.DrawCardSupplement1 = int32(_tempNum_) } - { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["DrawCard_supplement10"].(float64); !_ok_ { err = errors.New("DrawCard_supplement10 error"); return }; _v.DrawCardSupplement10 = int32(_tempNum_) } { var _arr_ []interface{} var _ok_ bool