Commit 3f9282e6377803fba778293a0761cd87fe6b4645
1 parent
eecade34
Exists in
master
提交
Showing
2 changed files
with
44 additions
and
20 deletions
Show diff stats
src/HttpServer/logic/function.go
| @@ -792,8 +792,8 @@ func DoAutoMergeRedCat(uinfo *UserData, uuid int) { | @@ -792,8 +792,8 @@ func DoAutoMergeRedCat(uinfo *UserData, uuid int) { | ||
| 792 | } | 792 | } |
| 793 | 793 | ||
| 794 | //合成红包猫 返回红包猫等级 等级为red_catconfig的id+100 | 794 | //合成红包猫 返回红包猫等级 等级为red_catconfig的id+100 |
| 795 | -func MergeRedBagCat(uinfo *UserData, pos int) int { | ||
| 796 | - rtpos := 0 | 795 | +func MergeRedBagCat(uinfo *UserData, pos int) float32 { |
| 796 | + rtpos := float32(0) | ||
| 797 | 797 | ||
| 798 | //走随机合成逻辑 | 798 | //走随机合成逻辑 |
| 799 | sumrate := float32(0) | 799 | sumrate := float32(0) |
| @@ -815,23 +815,30 @@ func MergeRedBagCat(uinfo *UserData, pos int) int { | @@ -815,23 +815,30 @@ func MergeRedBagCat(uinfo *UserData, pos int) int { | ||
| 815 | for k, v := range reallist { | 815 | for k, v := range reallist { |
| 816 | tmprate += int(v.Rate * 100 / sumrate) | 816 | tmprate += int(v.Rate * 100 / sumrate) |
| 817 | if tmprate >= randnum { | 817 | if tmprate >= randnum { |
| 818 | - index = k | ||
| 819 | - uinfo.PosInfo[pos].Position = pos | ||
| 820 | - uinfo.PosInfo[pos].Cat = REDCATIDEXTRA + v.Id | ||
| 821 | - if v.Id == 13 { | ||
| 822 | - uinfo.PosInfo[pos].Time = 10 * 60 | ||
| 823 | - uinfo.PosInfo[pos].StartTime = int(time.Now().Unix()) | ||
| 824 | - } | ||
| 825 | - if v.Id == 14 { | ||
| 826 | - uinfo.PosInfo[pos].Time = 15 * 60 | ||
| 827 | - uinfo.PosInfo[pos].StartTime = int(time.Now().Unix()) | ||
| 828 | - } | ||
| 829 | - if v.Id == 2 { | ||
| 830 | - uinfo.PosInfo[pos].Time = 24 * 60 * 60 | ||
| 831 | - uinfo.PosInfo[pos].StartTime = int(time.Now().Unix()) | 818 | + if v.Id != 10 { |
| 819 | + index = k | ||
| 820 | + uinfo.PosInfo[pos].Position = pos | ||
| 821 | + uinfo.PosInfo[pos].Cat = REDCATIDEXTRA + v.Id | ||
| 822 | + if v.Id == 13 { | ||
| 823 | + uinfo.PosInfo[pos].Time = 10 * 60 | ||
| 824 | + uinfo.PosInfo[pos].StartTime = int(time.Now().Unix()) | ||
| 825 | + } | ||
| 826 | + if v.Id == 14 { | ||
| 827 | + uinfo.PosInfo[pos].Time = 15 * 60 | ||
| 828 | + uinfo.PosInfo[pos].StartTime = int(time.Now().Unix()) | ||
| 829 | + } | ||
| 830 | + if v.Id == 2 { | ||
| 831 | + uinfo.PosInfo[pos].Time = 24 * 60 * 60 | ||
| 832 | + uinfo.PosInfo[pos].StartTime = int(time.Now().Unix()) | ||
| 833 | + } | ||
| 834 | + uinfo.PosInfo[pos].RedPacket = v.Money | ||
| 835 | + rtpos = 0 | ||
| 836 | + } else { | ||
| 837 | + //红包猫 | ||
| 838 | + index = k | ||
| 839 | + rtpos = v.Money | ||
| 832 | } | 840 | } |
| 833 | - uinfo.PosInfo[pos].RedPacket = v.Money | ||
| 834 | - rtpos = pos | 841 | + |
| 835 | break | 842 | break |
| 836 | } | 843 | } |
| 837 | } | 844 | } |
| @@ -841,7 +848,7 @@ func MergeRedBagCat(uinfo *UserData, pos int) int { | @@ -841,7 +848,7 @@ func MergeRedBagCat(uinfo *UserData, pos int) int { | ||
| 841 | uinfo.PosInfo[pos].Cat = reallist[0].Id + REDCATIDEXTRA | 848 | uinfo.PosInfo[pos].Cat = reallist[0].Id + REDCATIDEXTRA |
| 842 | uinfo.PosInfo[pos].RedPacket = reallist[0].Money | 849 | uinfo.PosInfo[pos].RedPacket = reallist[0].Money |
| 843 | uinfo.PosInfo[pos].Position = pos | 850 | uinfo.PosInfo[pos].Position = pos |
| 844 | - rtpos = pos | 851 | + rtpos = reallist[0].Money |
| 845 | } | 852 | } |
| 846 | 853 | ||
| 847 | //翻拍次数+ | 854 | //翻拍次数+ |
src/HttpServer/logic/logic.go
| @@ -345,6 +345,16 @@ func HandlerTestaddCat(w http.ResponseWriter, data string, uuid int) { | @@ -345,6 +345,16 @@ func HandlerTestaddCat(w http.ResponseWriter, data string, uuid int) { | ||
| 345 | } | 345 | } |
| 346 | 346 | ||
| 347 | catid, _ := strconv.Atoi(rdata.CatId) | 347 | catid, _ := strconv.Atoi(rdata.CatId) |
| 348 | + if catid == 47 { | ||
| 349 | + //红包猫 | ||
| 350 | + logger.Error("HandlerTestaddCat Position failed=%v", err) | ||
| 351 | + resp.Code = 1 | ||
| 352 | + resp.Message = "参数错误" | ||
| 353 | + break | ||
| 354 | + } else if catid == 48 { | ||
| 355 | + //赌博猫 | ||
| 356 | + uinfo.SetDuboCatPos(catid) | ||
| 357 | + } | ||
| 348 | uinfo.PosInfo[rdata.Position].Cat = catid | 358 | uinfo.PosInfo[rdata.Position].Cat = catid |
| 349 | uinfo.CalcGoldRate() | 359 | uinfo.CalcGoldRate() |
| 350 | SaveUserInfo(uinfo, strconv.Itoa(uuid)) | 360 | SaveUserInfo(uinfo, strconv.Itoa(uuid)) |
| @@ -2158,7 +2168,7 @@ func HandlerExchangePos(w http.ResponseWriter, data string, uuid int) { | @@ -2158,7 +2168,7 @@ func HandlerExchangePos(w http.ResponseWriter, data string, uuid int) { | ||
| 2158 | //首先判断是否是顶级猫了 | 2168 | //首先判断是否是顶级猫了 |
| 2159 | if uinfo.PosInfo[rdata.From].Cat == 36 { | 2169 | if uinfo.PosInfo[rdata.From].Cat == 36 { |
| 2160 | //todo 走红包猫的逻辑 | 2170 | //todo 走红包猫的逻辑 |
| 2161 | - MergeRedBagCat(uinfo, rdata.To) | 2171 | + idx := MergeRedBagCat(uinfo, rdata.To) |
| 2162 | uinfo.CleadPos(rdata.From) | 2172 | uinfo.CleadPos(rdata.From) |
| 2163 | //DoAutoMergeRedCat(uinfo, uuid) | 2173 | //DoAutoMergeRedCat(uinfo, uuid) |
| 2164 | //此处处理一下红包猫的自动合成逻辑 | 2174 | //此处处理一下红包猫的自动合成逻辑 |
| @@ -2167,6 +2177,13 @@ func HandlerExchangePos(w http.ResponseWriter, data string, uuid int) { | @@ -2167,6 +2177,13 @@ func HandlerExchangePos(w http.ResponseWriter, data string, uuid int) { | ||
| 2167 | uinfo.Highestlv = 37 | 2177 | uinfo.Highestlv = 37 |
| 2168 | uinfo.CheckBuyCatSHop() | 2178 | uinfo.CheckBuyCatSHop() |
| 2169 | } | 2179 | } |
| 2180 | + if idx > 0 { | ||
| 2181 | + //红包猫 | ||
| 2182 | + uinfo.CleadPos(rdata.To) | ||
| 2183 | + resp.Data.Reward = idx | ||
| 2184 | + //加钱 | ||
| 2185 | + uinfo.AddRedPackect(idx, 100) | ||
| 2186 | + } | ||
| 2170 | 2187 | ||
| 2171 | } else { | 2188 | } else { |
| 2172 | // | 2189 | // |