猜颜色
This commit is contained in:
parent
a9e52dc1e6
commit
de271d25ef
@ -56,34 +56,55 @@ func GetActivityItemId(Id int) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetRewardItem(Id int, Type int) []*item.Item {
|
func GetRewardItem(Id int, Type int) []*item.Item {
|
||||||
data, err := gamedata.GetDataByIntKey(CFG_GUESS_COLOR_REWARD, Id)
|
data, err := gamedata.GetData(CFG_GUESS_COLOR_REWARD)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if Type == 1 {
|
for k, v := range data {
|
||||||
return gamedata.GetItemList(data, "Items1")
|
min := GoUtil.Int(k)
|
||||||
|
max := gamedata.GetIntValue(v, "Max")
|
||||||
|
if Id >= min && Id <= max {
|
||||||
|
if Type == 1 {
|
||||||
|
return gamedata.GetItemList(v, "Items1")
|
||||||
|
}
|
||||||
|
return gamedata.GetItemList(v, "Items2")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return gamedata.GetItemList(data, "Items2")
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetPassNum(Pass int) int {
|
func GetPassNum(Id int) int {
|
||||||
data, err := gamedata.GetDataByIntKey(CFG_GUESS_COLOR_REWARD, Pass)
|
data, err := gamedata.GetData(CFG_GUESS_COLOR_REWARD)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return gamedata.GetIntValue(data, "Num")
|
for k, v := range data {
|
||||||
|
min := GoUtil.Int(k)
|
||||||
|
max := gamedata.GetIntValue(v, "Max")
|
||||||
|
if Id >= min && Id <= max {
|
||||||
|
return gamedata.GetIntValue(v, "Num")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetWinTime(Pass int) int {
|
func GetWinTime(Id int) int {
|
||||||
data, err := gamedata.GetDataByIntKey(CFG_GUESS_COLOR_REWARD, Pass)
|
data, err := gamedata.GetData(CFG_GUESS_COLOR_REWARD)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
Type := gamedata.GetIntValue(data, "Type")
|
for k, v := range data {
|
||||||
if Type == 1 {
|
min := GoUtil.Int(k)
|
||||||
return gamedata.GetIntValue(data, "Win")
|
max := gamedata.GetIntValue(v, "Max")
|
||||||
|
if Id >= min && Id <= max {
|
||||||
|
Type := gamedata.GetIntValue(v, "Type")
|
||||||
|
if Type == 1 {
|
||||||
|
return gamedata.GetIntValue(v, "Win")
|
||||||
|
}
|
||||||
|
str := gamedata.GetStringValue(v, "Win")
|
||||||
|
arr := strings.Split(str, "|")
|
||||||
|
return GoUtil.RandNum(GoUtil.Int(arr[0]), GoUtil.Int(arr[1]))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
str := gamedata.GetStringValue(data, "Win")
|
return 0
|
||||||
arr := strings.Split(str, "|")
|
|
||||||
return GoUtil.RandNum(GoUtil.Int(arr[0]), GoUtil.Int(arr[1]))
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -38,7 +38,7 @@ func (g *GuessColorMod) InitData() {
|
|||||||
if g.OMap == nil {
|
if g.OMap == nil {
|
||||||
g.OMap = make(map[int32]int32)
|
g.OMap = make(map[int32]int32)
|
||||||
}
|
}
|
||||||
if g.Pass == 0 {
|
if g.Pass == 0 || g.WinTime == 0 {
|
||||||
g.Pass = 1
|
g.Pass = 1
|
||||||
g.WinTime = guesscolorCfg.GetWinTime(g.Pass)
|
g.WinTime = guesscolorCfg.GetWinTime(g.Pass)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user