Compare commits

...

3 Commits

Author SHA1 Message Date
sk 81417088fd Merge branch 'develop' of git.pogorockgames.com:mango-games/server/game into develop 2024-09-27 15:34:02 +08:00
sk b1298fe25f 添加非首次登录标记 2024-09-27 15:27:16 +08:00
sk 93134b7f57 no message 2024-09-27 14:31:16 +08:00
7 changed files with 112 additions and 29 deletions

View File

@ -6,6 +6,10 @@ import (
"mongo.games.com/goserver/core/module" "mongo.games.com/goserver/core/module"
) )
func init() {
module.RegisteModule(ClockMgrSingleton, time.Millisecond*500, 0)
}
var ClockMgrSingleton = &ClockMgr{ var ClockMgrSingleton = &ClockMgr{
LastHour: -1, LastHour: -1,
LastDay: -1, LastDay: -1,
@ -99,9 +103,9 @@ func (this *ClockMgr) Update() {
this.LastSec = sec this.LastSec = sec
this.fireSecondEvent() this.fireSecondEvent()
min := tNow.Minute() minute := tNow.Minute()
if min != this.LastMini { if minute != this.LastMini {
this.LastMini = min this.LastMini = minute
this.fireMinuteEvent() this.fireMinuteEvent()
hour := tNow.Hour() hour := tNow.Hour()
@ -182,6 +186,87 @@ func (this *ClockMgr) GetLast() (int, int, int, int, int, int) {
return this.LastSec, this.LastMini, this.LastHour, this.LastDay, this.LastWeek, int(this.LastMonth) return this.LastSec, this.LastMini, this.LastHour, this.LastDay, this.LastWeek, int(this.LastMonth)
} }
func init() { type ClockFunc struct {
module.RegisteModule(ClockMgrSingleton, time.Millisecond*500, 0) event int
OnSecTimerFunc func()
OnMiniTimerFunc func()
OnHourTimerFunc func()
OnDayTimerFunc func()
OnWeekTimerFunc func()
OnMonthTimerFunc func()
OnShutdownFunc func()
}
func (s *ClockFunc) InterestClockEvent() int { return s.event }
func (s *ClockFunc) OnSecTimer() {
if s.OnSecTimerFunc != nil {
s.OnSecTimerFunc()
}
}
func (s *ClockFunc) OnMiniTimer() {
if s.OnMiniTimerFunc != nil {
s.OnMiniTimerFunc()
}
}
func (s *ClockFunc) OnHourTimer() {
if s.OnHourTimerFunc != nil {
s.OnHourTimerFunc()
}
}
func (s *ClockFunc) OnDayTimer() {
if s.OnDayTimerFunc != nil {
s.OnDayTimerFunc()
}
}
func (s *ClockFunc) OnWeekTimer() {
if s.OnWeekTimerFunc != nil {
s.OnWeekTimerFunc()
}
}
func (s *ClockFunc) OnMonthTimer() {
if s.OnMonthTimerFunc != nil {
s.OnMonthTimerFunc()
}
}
func (s *ClockFunc) OnShutdown() {
if s.OnShutdownFunc != nil {
s.OnShutdownFunc()
}
}
// RegisterClockFunc 注册时钟事件
func RegisterClockFunc(fs *ClockFunc) {
if fs == nil {
return
}
if fs.OnSecTimerFunc != nil {
fs.event = fs.event ^ ClockEventSecond
}
if fs.OnMiniTimerFunc != nil {
fs.event = fs.event ^ ClockEventMinute
}
if fs.OnHourTimerFunc != nil {
fs.event = fs.event ^ ClockEventHour
}
if fs.OnDayTimerFunc != nil {
fs.event = fs.event ^ ClockEventDay
}
if fs.OnWeekTimerFunc != nil {
fs.event = fs.event ^ ClockEventWeek
}
if fs.OnMonthTimerFunc != nil {
fs.event = fs.event ^ ClockEventMonth
}
if fs.OnShutdownFunc != nil {
fs.event = fs.event ^ ClockEventShutdown
}
ClockMgrSingleton.RegisterSinker(fs)
} }

View File

@ -807,9 +807,10 @@ var (
) )
const ( const (
AttributeGuideStep = 1 // 引导步骤 AttributeGuideStep = 1 // 引导步骤
AttributeGuideSkip = 2 // 跳过引导 AttributeGuideSkip = 2 // 跳过引导
AttributeGuideTest = 3 // 测试引导 AttributeGuideTest = 3 // 测试引导
AttributeGuideCustom = 4 // 竞技馆引导页
) )
const ( const (
@ -861,3 +862,8 @@ const (
PlayerChangeTypeCoin = 0 // 金币 PlayerChangeTypeCoin = 0 // 金币
PlayerChangeTypeNum = 1 // 积分 PlayerChangeTypeNum = 1 // 积分
) )
// 玩家状态标记
const (
PlayerFlagsGuideCustom = 1 << iota // 竞技馆引导页关闭状态
)

View File

@ -29,13 +29,6 @@ const (
VER_PLAYER_MAX VER_PLAYER_MAX
) )
const (
PLAYER_FLAGS_PRIVILEGE int64 = 1 << iota
PLAYER_FLAGS_FIRSTGAME //首次游戏
PLAYER_FLAGS_FIRSTBINDTEL //首次绑定账号
PLAYER_FLAGS_CANREBATE //是否能够返利
)
const ( const (
DEFAULT_PLAYER_SAFEBOX_PWD = "" //保险箱默认密码 DEFAULT_PLAYER_SAFEBOX_PWD = "" //保险箱默认密码
) )
@ -402,7 +395,7 @@ type PlayerData struct {
InviterHead int32 //邀请人头像 InviterHead int32 //邀请人头像
BeUnderAgentCode string //隶属经销商(推广人) BeUnderAgentCode string //隶属经销商(推广人)
SubBeUnderAgentCode string //经销商子id SubBeUnderAgentCode string //经销商子id
Flags int64 //标记 Flags int //标记
GameCoinTs int64 //游服金币对账时间戳 GameCoinTs int64 //游服金币对账时间戳
Ver int32 //数据版本号 Ver int32 //数据版本号
CheckSum uint32 //校验码(预防暴库修改数据) CheckSum uint32 //校验码(预防暴库修改数据)
@ -501,7 +494,7 @@ type PlayerData struct {
DiamondLotteryScore int64 //钻石抽奖幸运值 DiamondLotteryScore int64 //钻石抽奖幸运值
VCardCost int64 // 消耗v卡数量 VCardCost int64 // 消耗v卡数量
MoneyTotal int64 // 现金总充值金额,不包含api加币时的现金 MoneyTotal int64 // 现金总充值金额,不包含api加币时的现金
GuideStep int32 // 引导步骤;跳过引导后,该值会置为-1 GuideStep int32 // tienlen游戏引导步骤;跳过引导后,该值会置为-1
} }
// 七日签到数据 // 七日签到数据
@ -802,15 +795,15 @@ func ConvertPlayerDataToWebData(param *WebPlayerDataParam) *webapi.PlayerData {
return pdfw return pdfw
} }
func (this *PlayerData) IsMarkFlag(flag int) bool { func (this *PlayerData) IsMarkFlag(flag int) bool {
return this.Flags&(1<<flag) != 0 return this.Flags&flag != 0
} }
func (this *PlayerData) MarkFlag(flag int) { func (this *PlayerData) MarkFlag(flag int) {
this.Flags |= (1 << flag) this.Flags |= flag
} }
func (this *PlayerData) UnmarkFlag(flag int) { func (this *PlayerData) UnmarkFlag(flag int) {
this.Flags &= ^(1 << flag) this.Flags &= ^flag
} }
func (this *PlayerData) GetSnId() int32 { func (this *PlayerData) GetSnId() int32 {

View File

@ -10746,7 +10746,7 @@ type CSUpdateAttribute struct {
sizeCache protoimpl.SizeCache sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields unknownFields protoimpl.UnknownFields
Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 1.更新新手引导阶段 2.跳过新手引导 3.更新新手引导状态(测试用) Tp int32 `protobuf:"varint,1,opt,name=Tp,proto3" json:"Tp,omitempty"` // 1.更新新手引导阶段 2.跳过新手引导 3.更新新手引导状态(测试用) 4.竞技馆引导结束
Param []int64 `protobuf:"varint,2,rep,packed,name=Param,proto3" json:"Param,omitempty"` Param []int64 `protobuf:"varint,2,rep,packed,name=Param,proto3" json:"Param,omitempty"`
} }

View File

@ -1337,7 +1337,7 @@ message WindowsInfo{
//PACKET_CSUpdateAttribute //PACKET_CSUpdateAttribute
message CSUpdateAttribute{ message CSUpdateAttribute{
int32 Tp = 1; // 1. 2. 3.() int32 Tp = 1; // 1. 2. 3.() 4.
repeated int64 Param = 2; repeated int64 Param = 2;
} }
//PACKET_SCUpdateAttribute //PACKET_SCUpdateAttribute

View File

@ -3159,6 +3159,11 @@ func CSUpdateAttribute(s *netlib.Session, packetId int, data interface{}, sid in
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
send() send()
return nil return nil
case common.AttributeGuideCustom:
p.MarkFlag(common.PlayerFlagsGuideCustom)
pack.OpRetCode = player_proto.OpResultCode_OPRC_Sucess
send()
return nil
} }
return nil return nil
} }

View File

@ -615,13 +615,7 @@ func (this *CSPMCmdHandler) Process(s *netlib.Session, packetid int, data interf
} }
} }
case common.PMCmd_Privilege: case common.PMCmd_Privilege:
if p.GMLevel >= 3 {
if p.Flags&model.PLAYER_FLAGS_PRIVILEGE == 0 {
p.Flags |= model.PLAYER_FLAGS_PRIVILEGE
} else {
p.Flags &= ^model.PLAYER_FLAGS_PRIVILEGE
}
}
} }
} }
} }