feat: 增加宠物蛋结果计算和金币检查逻辑
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful

This commit is contained in:
xinian
2026-03-18 11:14:55 +08:00
committed by cnb
parent e7098e3777
commit e2ac5a6325
4 changed files with 14 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ func (s *EggService) GetData(p1 uint32) []int32 {
return petIDs
}
func (s *EggService) GetResult(m, f uint32) (uint32, bool) {
func (s *EggService) GetResult(m, f, level uint32) (uint32, bool) {
//cacheKey := strings.Join([]string{fmt.Sprintf("%d", p1), fmt.Sprintf("%d", p2)}, ":")
md := dbm_enable(s.Model)
@@ -43,7 +43,7 @@ func (s *EggService) GetResult(m, f uint32) (uint32, bool) {
md.Wheref(`male_pet_ids @> ARRAY[?]::integer[]`, m).
Wheref(`female_pet_ids @> ARRAY[?]::integer[]`, f).Scan(&pet)
if pet != nil {
pet.OutputMons[len(pet.OutputMons)-1] += int32(level)
t, _ := utils.RandomByWeight(pet.OutputMons, pet.Probs)
if pet.OutputMons[len(pet.OutputMons)-1] == int32(t) {
return uint32(t), true