--story=1000624 --user=李海亮 记牌器优化二版 https://www.tapd.cn/31044302/s/1011235
This commit is contained in:
parent
075900766d
commit
c4161a6b39
|
|
@ -6,7 +6,6 @@ import (
|
|||
"math"
|
||||
"math/rand"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
|
|
@ -2024,7 +2023,7 @@ func (this *TienLenSceneData) SystemCoinOut() int64 {
|
|||
return systemGain
|
||||
}
|
||||
|
||||
func (this *TienLenSceneData) IsPlayerFirst(p *base.Player) bool {
|
||||
func (this *TienLenSceneData) IsTienlenPlayerFirst(p *base.Player) bool {
|
||||
if p == nil {
|
||||
return false
|
||||
}
|
||||
|
|
@ -2033,33 +2032,41 @@ func (this *TienLenSceneData) IsPlayerFirst(p *base.Player) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if p.GDatas != nil {
|
||||
for _, vv := range common.GetTienlenGameID() {
|
||||
if data, ok := p.GDatas[strconv.Itoa(int(vv))]; ok {
|
||||
if data.Statics.GameTimes <= 1 {
|
||||
return true
|
||||
}
|
||||
} else {
|
||||
if common.InSliceInt32(common.GetTienlenGameID(), int32(this.GameId)) {
|
||||
if data, ok := p.GDatas[this.KeyGameId]; ok {
|
||||
if data.Statics.GameTimes < 1 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func (this *TienLenSceneData) SendFirstGiveTimeItem(p *base.Player) {
|
||||
if this.IsPlayerFirst(p) {
|
||||
if p.IsRobot() {
|
||||
return
|
||||
}
|
||||
|
||||
if this.IsTienlenPlayerFirst(p) && !p.PlayerData.IsTakeExpireItem {
|
||||
itemID := int32(60001)
|
||||
itemData := srvdata.PBDB_GameItemMgr.GetData(itemID)
|
||||
if itemData == nil {
|
||||
return
|
||||
}
|
||||
|
||||
p.PlayerData.IsTakeExpireItem = true
|
||||
|
||||
if p.ItemRecExpireTime <= 0 {
|
||||
p.ItemRecExpireTime = time.Now().Unix() + int64(itemData.Time)*3600*1
|
||||
} else {
|
||||
p.ItemRecExpireTime += int64(itemData.Time) * 3600 * 1
|
||||
if p.ItemRecExpireTime >= time.Now().Unix() {
|
||||
p.ItemRecExpireTime += int64(itemData.Time) * 3600 * 1
|
||||
} else {
|
||||
p.ItemRecExpireTime = time.Now().Unix() + int64(itemData.Time)*3600*1
|
||||
}
|
||||
}
|
||||
|
||||
pack := &tienlen.SCTienLenPlayerFirstGiveItemItem{}
|
||||
|
|
|
|||
|
|
@ -1077,10 +1077,6 @@ func (this *ScenePlayerOpStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player,
|
|||
}
|
||||
|
||||
sceneEx, _ := s.GetExtraData().(*TienLenSceneData)
|
||||
if sceneEx.IsPlayerFirst(p) {
|
||||
logger.Logger.Tracef("(this *ScenePlayerOpStateTienLen) OnPlayerOp, sceneid=%v", s.GetSceneId())
|
||||
}
|
||||
|
||||
if sceneEx != nil {
|
||||
playerEx, _ := p.GetExtraData().(*TienLenPlayerData)
|
||||
if playerEx != nil {
|
||||
|
|
|
|||
|
|
@ -457,7 +457,7 @@ type PlayerData struct {
|
|||
WeekCardAward map[int32]bool // 周卡奖励领取状态false-未领取,true已领取
|
||||
ItemRecExpireTime int64 // 记牌器到期时间
|
||||
RequestAddFriend map[int32]int64 // 玩家申请好友记录
|
||||
bTakeExpireItem bool // 是否领取
|
||||
IsTakeExpireItem bool // 是否领取
|
||||
}
|
||||
|
||||
// 七日签到数据
|
||||
|
|
|
|||
|
|
@ -1721,6 +1721,7 @@ func (this *Player) UnmarshalData(data []byte, scene *Scene) {
|
|||
this.WelfData.PigBank.DayBuyTimes = pd.WelfData.PigBank.DayBuyTimes
|
||||
}
|
||||
this.ItemRecExpireTime = pd.ItemRecExpireTime
|
||||
this.IsTakeExpireItem = pd.IsTakeExpireItem
|
||||
|
||||
this.dirty = true
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue