每日消耗体力转换成活动道具
This commit is contained in:
parent
8040b0df25
commit
e82c67e8cd
@ -4,6 +4,9 @@ import (
|
|||||||
"go_dreamfactory/comm"
|
"go_dreamfactory/comm"
|
||||||
"go_dreamfactory/lego/base"
|
"go_dreamfactory/lego/base"
|
||||||
"go_dreamfactory/lego/core"
|
"go_dreamfactory/lego/core"
|
||||||
|
"go_dreamfactory/pb"
|
||||||
|
"go_dreamfactory/sys/configure"
|
||||||
|
cfg "go_dreamfactory/sys/configure/structs"
|
||||||
|
|
||||||
"go_dreamfactory/modules"
|
"go_dreamfactory/modules"
|
||||||
)
|
)
|
||||||
@ -44,3 +47,48 @@ func (this *UiGame) Start() (err error) {
|
|||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
func (this *UiGame) HDPSTodayConsum(uid string, ps int32) {
|
||||||
|
activity := this.ModuleActivity.GetAllHdInfo()
|
||||||
|
curTime := configure.Now().Unix()
|
||||||
|
if v, ok := activity[pb.HdType_HdPuzzle]; ok { // 拼图小游戏
|
||||||
|
if v.Stime >= curTime && curTime <= v.Etime { // 活动时间范围内
|
||||||
|
if rst, err := this.modelPuzzle.getPuzzleList(uid, v.Id); err == nil {
|
||||||
|
if conf, err := this.configure.GetPuzzleConsumConf(); err != nil {
|
||||||
|
if conf.Getmax > rst.Val { // 超过今日上限
|
||||||
|
tmp := ps / conf.Usepawer
|
||||||
|
if tmp > rst.Val {
|
||||||
|
l := rst.Val
|
||||||
|
rst.Val = tmp
|
||||||
|
if conf.Getmax < rst.Val { // 超过今日上限
|
||||||
|
rst.Val = conf.Getmax
|
||||||
|
}
|
||||||
|
sub := rst.Val - l // 增长的
|
||||||
|
s, ok := this.GetUserSession(uid)
|
||||||
|
if sub > 0 {
|
||||||
|
var res *cfg.Gameatn
|
||||||
|
res = &cfg.Gameatn{
|
||||||
|
A: conf.Itemget.A,
|
||||||
|
T: conf.Itemget.T,
|
||||||
|
N: conf.Itemget.N * sub,
|
||||||
|
}
|
||||||
|
this.DispenseRes(s, []*cfg.Gameatn{res}, true)
|
||||||
|
}
|
||||||
|
|
||||||
|
update := make(map[string]interface{})
|
||||||
|
update["val"] = rst.Val
|
||||||
|
|
||||||
|
this.modelPuzzle.modifyPuzzleListByObjId(uid, update)
|
||||||
|
// 推送活动数据进度变化
|
||||||
|
if ok {
|
||||||
|
s.SendMsg(string(this.GetType()), "puzzlechange", &pb.UiGamePuzzleChangePush{
|
||||||
|
Data: rst,
|
||||||
|
})
|
||||||
|
s.Push()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user