ecs/servers/game/logic/player_login_reward.go
2025-06-04 18:17:39 +08:00

52 lines
1.8 KiB
Go

package logic
//type PlayerLoginReward struct {
// StatusList []uint32 `bson:"status_list"`
//}
//
//func (this *Player) checkLoginReward() (changed bool) {
// var days = this.manager.tables.LoginRewardExtend.Days()
// if days == 0 {
// return false
// }
//
// if this.LoginReward == nil || len(this.LoginReward.StatusList) != days {
// this.LoginReward = &PlayerLoginReward{StatusList: make([]uint32, days)}
// this.LoginReward.StatusList[0] = uint32(proto.RewardStatusCanGet)
// this.SaveField("login_reward", this.LoginReward)
//
// _ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck())
// return true
// } else {
// var index = int(this.Role.LoginDays-1) % days
// if index == 0 {
// for i := range this.LoginReward.StatusList {
// this.LoginReward.StatusList[i] = uint32(proto.RewardStatusUnable)
// }
//
// this.LoginReward.StatusList[0] = uint32(proto.RewardStatusCanGet)
// this.SaveField("login_reward.status_list", this.LoginReward.StatusList)
//
// _ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck())
// return true
// } else {
// if proto.RewardStatus(this.LoginReward.StatusList[index]) == proto.RewardStatusUnable {
// this.LoginReward.StatusList[index] = uint32(proto.RewardStatusCanGet)
// this.SaveArray("login_reward.status_list", index, this.LoginReward.StatusList[index])
//
// _ = this.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, this.BuildMsgLoginRewardInfoAck())
// return true
// }
// }
// }
// return false
//}
//
//func (this *Player) BuildMsgLoginRewardInfoAck() *proto.MsgLoginRewardInfoAck {
// if this.LoginReward == nil {
// return &proto.MsgLoginRewardInfoAck{}
// } else {
// return &proto.MsgLoginRewardInfoAck{LoginDays: this.Role.LoginDays, StatusList: this.LoginReward.StatusList}
// }
//}