package player

import (
	"github.com/mhaya/game/game_cluster/internal/code"
	"github.com/mhaya/game/game_cluster/internal/mdb/models"
	"github.com/mhaya/game/game_cluster/internal/param"
)

func (p *actorPlayer) signIn() (*param.ChangeData, int32) {
	if !p.isOnline {
		return nil, code.PlayerNotLogin
	}

	// todo 测试代码
	resp := p.Player.SignIn()
	p.dirty = true

	p.itemStat(resp.AddItem)

	return resp, code.OK

	//// 正式代码
	//if !mhayaTime.CreateFromTimestamp(p.Player.SinIn.SignDailyTime).IsToday() {
	//	resp := p.Player.SignIn()
	//	p.dirty = true
	//
	//	p.itemStat(resp.AddItem)
	//
	//	return resp, code.OK
	//} else {
	//	return nil, code.PlayerSignInError
	//}
}

func (p *actorPlayer) signInList() (*models.SignIn, int32) {
	if !p.isOnline {
		return nil, code.PlayerNotLogin
	}
	return &p.Player.SinIn, code.OK
}
