58 lines
2.6 KiB
Go
58 lines
2.6 KiB
Go
package handler
|
|
|
|
//func (this *PlayerHandler) LoginRewardGet(player *logic.Player, msg *net.Message) {
|
|
// var req = new(proto.MsgLoginGetRewardReq)
|
|
// var err = msg.Read(req)
|
|
// if err != nil {
|
|
// this.logger.Error("Read message failed, ", err)
|
|
// _ = player.TipNotice(proto.ErrMessageError)
|
|
// return
|
|
// }
|
|
//
|
|
// if player.LoginReward == nil {
|
|
// this.logger.Error("Login reward unable, player.ActivityLogin == nil")
|
|
// _ = player.TipNotice(proto.ErrRewardUnable)
|
|
// return
|
|
// }
|
|
//
|
|
// var loginRewardTable = this.tables.LoginReward.Get(int(req.Id))
|
|
// if loginRewardTable == nil {
|
|
// this.logger.Error("Parameter or data tables error, Table 'LoginReward' was not found, Id: ", req.Id)
|
|
// _ = player.TipNotice(proto.ErrDataTablesError)
|
|
// return
|
|
// }
|
|
//
|
|
// var rewardIndex, dayIndex = this.tables.LoginRewardExtend.Calc(int(player.Role.LoginDays))
|
|
// if loginRewardTable.RewardIndex != rewardIndex || loginRewardTable.DayIndex > dayIndex {
|
|
// this.logger.Errorf("Parameter error, loginRewardTable.RewardIndex != rewardIndex, Id: %d, loginDays: %d, rewardIndex: %d, dayIndex: %d", req.Id, player.Role.LoginDays, rewardIndex, dayIndex)
|
|
// _ = player.TipNotice(proto.ErrParameterError)
|
|
// return
|
|
// }
|
|
//
|
|
// var index = loginRewardTable.DayIndex - 1
|
|
// if proto.RewardStatus(player.LoginReward.StatusList[index]) == proto.RewardStatusUnable {
|
|
// this.logger.Errorf("Login reward unable, loginDays: %d, index: %d, status: %d", player.Role.LoginDays, index, player.LoginReward.StatusList[index])
|
|
// _ = player.TipNotice(proto.ErrRewardUnable)
|
|
// return
|
|
// }
|
|
//
|
|
// if proto.RewardStatus(player.LoginReward.StatusList[index]) == proto.RewardStatusHasGot {
|
|
// this.logger.Errorf("Login reward has got, loginDays: %d, index: %d, status: %d", player.Role.LoginDays, index, player.LoginReward.StatusList[index])
|
|
// _ = player.TipNotice(proto.ErrRewardHasGot)
|
|
// return
|
|
// }
|
|
//
|
|
// var rewardList []*proto.ItemPair
|
|
// for i := range loginRewardTable.ItemId {
|
|
// _ = player.AddItem(uint32(loginRewardTable.ItemId[i]), uint32(loginRewardTable.ItemNum[i]), logic.LogTypeItemObtainByLoginReward)
|
|
// rewardList = append(rewardList, &proto.ItemPair{ItemId: uint32(loginRewardTable.ItemId[i]), ItemNum: uint32(loginRewardTable.ItemNum[i])})
|
|
// }
|
|
//
|
|
// _ = player.Send(proto.ModIdActivity, proto.MsgIdLoginRewardGet, &proto.MsgLoginGetRewardAck{MsgRewardListAck: &proto.MsgRewardListAck{RewardList: rewardList}})
|
|
//
|
|
// player.LoginReward.StatusList[index] = uint32(proto.RewardStatusHasGot)
|
|
// player.SaveArray("login_reward.status_list", index, player.LoginReward.StatusList[index])
|
|
//
|
|
// _ = player.Send(proto.ModIdActivity, proto.MsgIdLoginRewardInfo, player.BuildMsgLoginRewardInfoAck())
|
|
//}
|