--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"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -2024,7 +2023,7 @@ func (this *TienLenSceneData) SystemCoinOut() int64 {
|
||||||
return systemGain
|
return systemGain
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TienLenSceneData) IsPlayerFirst(p *base.Player) bool {
|
func (this *TienLenSceneData) IsTienlenPlayerFirst(p *base.Player) bool {
|
||||||
if p == nil {
|
if p == nil {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
@ -2033,33 +2032,41 @@ func (this *TienLenSceneData) IsPlayerFirst(p *base.Player) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.GDatas != nil {
|
if common.InSliceInt32(common.GetTienlenGameID(), int32(this.GameId)) {
|
||||||
for _, vv := range common.GetTienlenGameID() {
|
if data, ok := p.GDatas[this.KeyGameId]; ok {
|
||||||
if data, ok := p.GDatas[strconv.Itoa(int(vv))]; ok {
|
if data.Statics.GameTimes < 1 {
|
||||||
if data.Statics.GameTimes <= 1 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *TienLenSceneData) SendFirstGiveTimeItem(p *base.Player) {
|
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)
|
itemID := int32(60001)
|
||||||
itemData := srvdata.PBDB_GameItemMgr.GetData(itemID)
|
itemData := srvdata.PBDB_GameItemMgr.GetData(itemID)
|
||||||
if itemData == nil {
|
if itemData == nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.PlayerData.IsTakeExpireItem = true
|
||||||
|
|
||||||
if p.ItemRecExpireTime <= 0 {
|
if p.ItemRecExpireTime <= 0 {
|
||||||
p.ItemRecExpireTime = time.Now().Unix() + int64(itemData.Time)*3600*1
|
p.ItemRecExpireTime = time.Now().Unix() + int64(itemData.Time)*3600*1
|
||||||
} else {
|
} 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{}
|
pack := &tienlen.SCTienLenPlayerFirstGiveItemItem{}
|
||||||
|
|
|
||||||
|
|
@ -1077,10 +1077,6 @@ func (this *ScenePlayerOpStateTienLen) OnPlayerOp(s *base.Scene, p *base.Player,
|
||||||
}
|
}
|
||||||
|
|
||||||
sceneEx, _ := s.GetExtraData().(*TienLenSceneData)
|
sceneEx, _ := s.GetExtraData().(*TienLenSceneData)
|
||||||
if sceneEx.IsPlayerFirst(p) {
|
|
||||||
logger.Logger.Tracef("(this *ScenePlayerOpStateTienLen) OnPlayerOp, sceneid=%v", s.GetSceneId())
|
|
||||||
}
|
|
||||||
|
|
||||||
if sceneEx != nil {
|
if sceneEx != nil {
|
||||||
playerEx, _ := p.GetExtraData().(*TienLenPlayerData)
|
playerEx, _ := p.GetExtraData().(*TienLenPlayerData)
|
||||||
if playerEx != nil {
|
if playerEx != nil {
|
||||||
|
|
|
||||||
|
|
@ -457,7 +457,7 @@ type PlayerData struct {
|
||||||
WeekCardAward map[int32]bool // 周卡奖励领取状态false-未领取,true已领取
|
WeekCardAward map[int32]bool // 周卡奖励领取状态false-未领取,true已领取
|
||||||
ItemRecExpireTime int64 // 记牌器到期时间
|
ItemRecExpireTime int64 // 记牌器到期时间
|
||||||
RequestAddFriend map[int32]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.WelfData.PigBank.DayBuyTimes = pd.WelfData.PigBank.DayBuyTimes
|
||||||
}
|
}
|
||||||
this.ItemRecExpireTime = pd.ItemRecExpireTime
|
this.ItemRecExpireTime = pd.ItemRecExpireTime
|
||||||
|
this.IsTakeExpireItem = pd.IsTakeExpireItem
|
||||||
|
|
||||||
this.dirty = true
|
this.dirty = true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue