diff --git a/modules/entertainment/xxlPlat.go b/modules/entertainment/xxlPlat.go index 21690429d..6c9321e9e 100644 --- a/modules/entertainment/xxlPlat.go +++ b/modules/entertainment/xxlPlat.go @@ -80,9 +80,9 @@ func (this *MapData) CreateGride(count int) (girdes []*pb.GirdeData) { func (this *MapData) SetMap() { sz2 := []int32{ 3, 1, 2, 2, 1, 3, 1, - 5, 1, 2, 3, 1, 2, 2, + 5, 1, 2, 4, 1, 2, 2, 2, 4, 3, 4, 3, 1, 6, - 1, 3, 3, 4, 2, 3, 6, + 1, 3, 4, 4, 4, 3, 6, 1, 5, 2, 5, 6, 1, 4, 6, 6, 3, 26, 3, 1, 3, 3, 3, 1, 3, 3, 2, 5, @@ -1385,17 +1385,89 @@ func (this *MapData) HitCrossElem(color int32, curid int32) (szMap []*pb.MapData } // 检测一个元素 -func (this *MapData) CheckElem(pos int32) { +func (this *MapData) CheckElem(pos int) (xc []int) { var ( color int32 - x int32 - y int32 + x int + y int + tmp []int ) color = this.Plat[pos].Color x = pos / Width y = pos % Height this.module.Debugf("color:%d, x:%d, y:%d", color, x, y) - for i := 0; i < Height; i++ { + for i := 1; i < Height; i++ { + if y+i < Height { + tagPos := x*Width + (y + i) + tagColor := this.Plat[tagPos].Color + if tagColor == color { + tmp = append(tmp, tagPos) + } else { + break + } + } else { + break + } } + + if len(tmp) >= 2 { + xc = append(xc, tmp...) + } + tmp = []int{} + for i := 1; i < Height; i++ { + if y-i >= 0 { + tagPos := x*Width + (y - i) + tagColor := this.Plat[tagPos].Color + if tagColor == color { + tmp = append(tmp, tagPos) + } else { + break + } + } else { + break + } + } + if len(tmp) >= 2 { + xc = append(xc, tmp...) + } + tmp = []int{} + for i := 1; i < Width; i++ { + if x-i >= 0 { + tagPos := (x-i)*Width + (y) + tagColor := this.Plat[tagPos].Color + if tagColor == color { + tmp = append(tmp, tagPos) + } else { + break + } + } else { + break + } + } + if len(tmp) >= 2 { + xc = append(xc, tmp...) + } + tmp = []int{} + for i := 1; i < Width; i++ { + if x+i < Width { + tagPos := (x+i)*Width + (y) + tagColor := this.Plat[tagPos].Color + if tagColor == color { + tmp = append(tmp, tagPos) + } else { + break + } + } else { + break + } + } + if len(tmp) >= 2 { + xc = append(xc, tmp...) + } + + if len(xc) > 0 { + xc = append(xc, pos) + } + return } diff --git a/modules/hunting/model_rank.go b/modules/hunting/model_rank.go index e5939766b..726979749 100644 --- a/modules/hunting/model_rank.go +++ b/modules/hunting/model_rank.go @@ -2,6 +2,7 @@ package hunting import ( "context" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/mgo" @@ -54,10 +55,10 @@ func (this *ModelRank) getHuntingRank(uid string) *pb.DBHuntingRecord { // 获取排行榜前50的用户名单 func (this *ModelRank) querySRankUser(bossid int) (ranks []string, err error) { var ( - result []string + result []string + tableName string ) - - tableName := this.TableName + strconv.Itoa(int(bossid)) + tableName = fmt.Sprintf("%s-%s", db.CrossTag(), this.TableName+strconv.Itoa(int(bossid))) if result, err = this.Redis.ZRevRange(tableName, 0, comm.MinRankList).Result(); err != nil { //this.module.Errorln(err) return @@ -172,7 +173,7 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin score int32 ) score = difficulty*10000 + (10000 - costTime) - tableName = this.TableName + strconv.Itoa(int(boosID)) + tableName = fmt.Sprintf("%s-%s", db.CrossTag(), this.TableName+strconv.Itoa(int(boosID))) menbers = &redis.Z{Score: float64(score), Member: uid} if cmd := pipe.ZAdd(tableName, menbers); cmd != nil { diff --git a/modules/viking/model_rank.go b/modules/viking/model_rank.go index 70d4d56e8..e6c46df65 100644 --- a/modules/viking/model_rank.go +++ b/modules/viking/model_rank.go @@ -2,6 +2,7 @@ package viking import ( "context" + "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/lego/sys/mgo" @@ -56,8 +57,8 @@ func (this *ModelRank) querySRankUser(bossid int) (ranks []string, err error) { var ( result []string ) - - tableName := this.TableName + strconv.Itoa(int(bossid)) + tableName := fmt.Sprintf("%s-%s", db.CrossTag(), this.TableName+strconv.Itoa(int(bossid))) + //tableName := this.TableName + strconv.Itoa(int(bossid)) if result, err = this.Redis.ZRevRange(tableName, 0, comm.MinRankList).Result(); err != nil { //this.module.Errorln(err) return @@ -172,7 +173,7 @@ func (this *ModelRank) CheckRank(uid string, boosID int32, difficulty int32, lin score int32 ) score = difficulty*10000 + (10000 - costTime) - tableName = this.TableName + strconv.Itoa(int(boosID)) + tableName = fmt.Sprintf("%s-%s", db.CrossTag(), this.TableName+strconv.Itoa(int(boosID))) menbers = &redis.Z{Score: float64(score), Member: uid} if cmd := pipe.ZAdd(tableName, menbers); cmd != nil { diff --git a/modules/viking/model_srank.go b/modules/viking/model_srank.go index 45f38ba5f..f6fb76f00 100644 --- a/modules/viking/model_srank.go +++ b/modules/viking/model_srank.go @@ -206,7 +206,8 @@ func (this *ModelSRank) CheckSeasonRank(uid string, boosID int32, difficulty int score int32 ) score = difficulty*10000 + (10000 - huihe) - tableName = this.TableName + strconv.Itoa(int(boosID)) + //tableName = this.TableName + strconv.Itoa(int(boosID)) + tableName = fmt.Sprintf("%s-%s", db.CrossTag(), this.TableName+strconv.Itoa(int(boosID))) menbers = &redis.Z{Score: float64(score), Member: uid} if cmd := pipe.ZAdd(tableName, menbers); cmd != nil { @@ -252,10 +253,10 @@ func (this *ModelSRank) raceSettlement() { for iBossType := 1; iBossType <= 3; iBossType++ { mailCid = fmt.Sprintf("SeasonViking%dReward", iBossType) - tableName := this.TableName + strconv.Itoa(int(iBossType)) + //tableName := this.TableName + strconv.Itoa(int(iBossType)) szReward = this.moduleViking.configure.GetVikingRewardConf() - - if result, err = this.DBModel.Redis.ZRevRange(fmt.Sprintf("%s-%s", this.DBModel, tableName), 0, comm.MaxRankList).Result(); err != nil { + tableName := fmt.Sprintf("%s-%s", db.CrossTag(), this.TableName+strconv.Itoa(int(iBossType))) + if result, err = this.DBModel.Redis.ZRevRange(tableName, 0, comm.MaxRankList).Result(); err != nil { this.moduleViking.Errorln(err) return }