refactor(.woodpecker): 移除全局配置变量并优化SSH连接设置 移除了全局配置变量,改用YAML锚点引用方式统一管理SSH连接参数, 提高配置的可维护性并减少重复代码
This commit is contained in:
53
logic/controller/action_扭蛋.go
Normal file
53
logic/controller/action_扭蛋.go
Normal file
@@ -0,0 +1,53 @@
|
||||
package controller
|
||||
|
||||
import (
|
||||
"blazing/common/data"
|
||||
"blazing/common/socket/errorcode"
|
||||
"blazing/logic/service/egg"
|
||||
"blazing/logic/service/player"
|
||||
"blazing/modules/config/service"
|
||||
"blazing/modules/player/model"
|
||||
|
||||
"github.com/gogf/gf/v2/util/grand"
|
||||
)
|
||||
|
||||
func (h Controller) EggGamePlay(data1 *egg.C2S_EGG_GAME_PLAY, c *player.Player) (result *egg.S2C_EGG_GAME_PLAY, err errorcode.ErrorCode) {
|
||||
|
||||
switch data1.EggNum {
|
||||
case 2:
|
||||
data1.EggNum = 5
|
||||
|
||||
case 3:
|
||||
data1.EggNum = 10
|
||||
}
|
||||
r := c.Service.Item.CheakItem(400501)
|
||||
if r < uint32(data1.EggNum) {
|
||||
return nil, errorcode.ErrorCode(errorcode.ErrorCodes.ErrSystemError)
|
||||
|
||||
}
|
||||
result = &egg.S2C_EGG_GAME_PLAY{ListInfo: []data.ItemInfo{}}
|
||||
if grand.Meet(int(data1.EggNum), 100) {
|
||||
r := service.NewPetRewardService().GetEgg()
|
||||
newPet := model.GenPetInfo(int(r.MonID), int(r.DV), int(r.Nature), int(r.Effect), int(r.Lv), nil)
|
||||
if grand.Meet(int(data1.EggNum), 100) {
|
||||
newPet.RandShiny()
|
||||
}
|
||||
c.Service.Pet.PetAdd(newPet)
|
||||
|
||||
result.HadTime = newPet.CatchTime
|
||||
result.PetID = newPet.ID
|
||||
}
|
||||
|
||||
items := service.NewItemService().GetEgg(data1.EggNum)
|
||||
for _, item := range items {
|
||||
if item.ItemId == 0 {
|
||||
continue
|
||||
}
|
||||
c.ItemAdd(item.ItemId, item.ItemCnt)
|
||||
result.ListInfo = append(result.ListInfo, data.ItemInfo{ItemId: item.ItemId, ItemCnt: item.ItemCnt})
|
||||
}
|
||||
|
||||
c.Service.Item.UPDATE(400501, int(-data1.EggNum))
|
||||
return
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user