playroom优化

This commit is contained in:
hahwu 2025-02-06 11:43:55 +08:00
parent 331a46e5ce
commit 3c31586879
2 changed files with 41 additions and 3 deletions

View File

@ -7,9 +7,11 @@ import (
)
const (
CFG_PLAYROOM_CONST = "PlayroomConst"
CFG_PLAYROOM_DECORATE = "PlayroomDecorate"
CFG_PLAYROOM_MOOD = "PlayroomMood"
CFG_PLAYROOM_CONST = "PlayroomConst"
CFG_PLAYROOM_DECORATE = "PlayroomDecorate"
CFG_PLAYROOM_MOOD = "PlayroomMood"
CFG_PLAYROOM_PHYSIOLOGY = "PlayroomPhysiology"
CFG_PLAYROOM_PHYSIOLOGY_TYPE = "PlayroomPhysiologyType"
)
func init() {
@ -141,3 +143,11 @@ func GetBuyItem(Id int) ([]*item.Item, []*item.Item) {
}
return gamedata.GetItemList(data, "Cost2"), gamedata.GetItemList(data, "Buy")
}
func GetPhysiologyMax(Id int) int {
data, err := gamedata.GetDataByIntKey(CFG_PLAYROOM_PHYSIOLOGY_TYPE, Id)
if err != nil {
return 0
}
return gamedata.GetIntValue(data, "Max")
}

View File

@ -38,6 +38,7 @@ type PlayroomMod struct {
NoFlip int // 连续未获取最高翻牌奖励次数
TodayFlip bool // 今日是否已获得最高档奖励
JackpotNum int // 每日转盘数量
Physiology map[int]*Physiology
}
const (
@ -55,6 +56,12 @@ const (
FLIP_TYPE_COPPER = 1 // 铜
FLIP_TYPE_SILVER = 2 // 银
FLIP_TYPE_GOLD = 3 // 金
PHYSIOLOGY_TYPE_STROKE = 1 // 抚摸
PHYSIOLOGY_TYPE_PLAY = 2 // 玩耍
PHYSIOLOGY_TYPE_FEED = 3 // 进食
PHYSIOLOGY_TYPE_CLEAN = 4 // 清洁
PHYSIOLOGY_TYPE_TOLIET = 5 // 上厕所
)
type Mood struct {
@ -63,6 +70,12 @@ type Mood struct {
Time int64
}
type Physiology struct {
Id int
Num int
Time int64
}
type Info struct {
Time int64
Times int
@ -466,3 +479,18 @@ func (p *PlayroomMod) GetFlipReward() ([]*item.Item, error) {
func (p *PlayroomMod) BuyItem(Id int) ([]*item.Item, []*item.Item) {
return playroomCfg.GetBuyItem(Id)
}
func (p *PlayroomMod) UnLock(Lv int) {
UnlockLv := playroomCfg.GetUnLockLv()
if Lv < UnlockLv {
return
}
if p.Physiology == nil {
Now := GoUtil.Now()
p.Physiology = make(map[int]*Physiology)
for k := 1; k <= 5; k++ {
Max := playroomCfg.GetPhysiologyMax(k)
p.Physiology[k] = &Physiology{Id: k, Num: Max, Time: Now}
}
}
}