This commit is contained in:
aozhiwei 2024-10-12 13:57:22 +08:00
parent ba34ecc95a
commit 4e2973a6c6
2 changed files with 30 additions and 54 deletions

View File

@ -16,12 +16,12 @@ type BattleItem struct {
}
type UserInfo struct {
Activated string `json:"activated"`
RenameCount string `json:"rename_count"`
//Activated string `json:"activated"`
//RenameCount string `json:"rename_count"`
AccountId string `json:"account_id"`
Name string `json:"name"`
HeadId string `json:"head_id"`
HeroId string `json:"hero_id"`
//HeroId string `json:"hero_id"`
HeadFrame string `json:"head_frame"`
TotalLucky interface{} `json:"total_lucky"`
AdmissionItemNum interface{} `json:"admission_item_num"`

View File

@ -52,29 +52,35 @@ func (this *player) SendMsg(rspMsg proto.Message) {
}
}
func (this *player) parseUserInfo(userInfo *common.UserInfo){
this.name = userInfo.Name
this.avatarUrl = userInfo.HeadId
this.headFrame = userInfo.HeadFrame
q5.DuckToSimple(userInfo.TotalLucky, &this.totalLucky)
q5.DuckToSimple(userInfo.AdmissionItemNum, &this.admissionItemNum)
q5.DuckToSimple(userInfo.CircuitScore, &this.circuitScore)
}
func (this *player) parseHeroInfo(heroInfo *common.HeroInfo){
this.hero.heroUniId = heroInfo.HeroUniId
this.hero.heroId = q5.ToInt32(heroInfo.HeroId)
this.hero.quality = q5.ToInt32(heroInfo.Quality)
this.hero.specSkill = q5.ToInt32(heroInfo.SpecSkill)
q5.DuckToSimple(heroInfo.Wealth, &this.hero.wealth)
q5.DuckToSimple(heroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(heroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(heroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(heroInfo.SkinId, &this.hero.skinId)
}
func (this *player) init(req *pendingLoginRequest, rsp *common.LoginRsp){
this.socket = req.hdr.GetSocket()
this.accountId = req.msg.GetAccountId()
this.sessionId = req.msg.GetSessionId()
this.zoneId = req.msg.GetZoneId()
this.nodeId = req.msg.GetNodeId()
this.name = rsp.Info.UserInfo.Name
this.avatarUrl = rsp.Info.UserInfo.HeadId
this.headFrame = rsp.Info.UserInfo.HeadFrame
q5.DuckToSimple(rsp.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
q5.DuckToSimple(rsp.Info.UserInfo.CircuitScore, &this.circuitScore)
q5.DuckToSimple(rsp.Info.UserInfo.TotalLucky, &this.totalLucky)
{
this.hero.heroUniId = rsp.Info.HeroInfo.HeroUniId
this.hero.heroId = q5.ToInt32(rsp.Info.HeroInfo.HeroId)
this.hero.quality = q5.ToInt32(rsp.Info.HeroInfo.Quality)
this.hero.specSkill = q5.ToInt32(rsp.Info.HeroInfo.SpecSkill)
q5.DuckToSimple(rsp.Info.HeroInfo.Wealth, &this.hero.wealth)
q5.DuckToSimple(rsp.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(rsp.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.SkinId, &this.hero.skinId)
}
this.parseUserInfo(&rsp.Info.UserInfo)
this.parseHeroInfo(&rsp.Info.HeroInfo)
}
func (this *player) againInit(req *pendingLoginRequest, rsp *common.LoginRsp){
@ -83,23 +89,8 @@ func (this *player) againInit(req *pendingLoginRequest, rsp *common.LoginRsp){
this.sessionId = req.msg.GetSessionId()
this.zoneId = req.msg.GetZoneId()
this.nodeId = req.msg.GetNodeId()
this.name = rsp.Info.UserInfo.Name
this.avatarUrl = rsp.Info.UserInfo.HeadId
this.headFrame = rsp.Info.UserInfo.HeadFrame
q5.DuckToSimple(rsp.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
q5.DuckToSimple(rsp.Info.UserInfo.CircuitScore, &this.circuitScore)
q5.DuckToSimple(rsp.Info.UserInfo.TotalLucky, &this.totalLucky)
{
this.hero.heroUniId = rsp.Info.HeroInfo.HeroUniId
this.hero.heroId = q5.ToInt32(rsp.Info.HeroInfo.HeroId)
this.hero.quality = q5.ToInt32(rsp.Info.HeroInfo.Quality)
this.hero.specSkill = q5.ToInt32(rsp.Info.HeroInfo.SpecSkill)
q5.DuckToSimple(rsp.Info.HeroInfo.Wealth, &this.hero.wealth)
q5.DuckToSimple(rsp.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(rsp.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(rsp.Info.HeroInfo.SkinId, &this.hero.skinId)
}
this.parseUserInfo(&rsp.Info.UserInfo)
this.parseHeroInfo(&rsp.Info.HeroInfo)
}
func (this *player) GetSocket() f5.WspCliConn {
@ -432,23 +423,8 @@ func (this *player) CMRefreshUser(hdr *f5.MsgHdr, msg *cs.CMRefreshUser) {
func(rsp f5.HttpCliResponse) {
this.SendMsg(rspMsg)
if rsp.GetErr() == nil && rsp.JsonParseOk() {
this.name = rspObj.Info.UserInfo.Name
this.avatarUrl = rspObj.Info.UserInfo.HeadId
this.headFrame = rspObj.Info.UserInfo.HeadFrame
q5.DuckToSimple(rspObj.Info.UserInfo.AdmissionItemNum, &this.admissionItemNum)
q5.DuckToSimple(rspObj.Info.UserInfo.CircuitScore, &this.circuitScore)
q5.DuckToSimple(rspObj.Info.UserInfo.TotalLucky, &this.totalLucky)
{
this.hero.heroUniId = rspObj.Info.HeroInfo.HeroUniId
this.hero.heroId = q5.ToInt32(rspObj.Info.HeroInfo.HeroId)
this.hero.quality = q5.ToInt32(rspObj.Info.HeroInfo.Quality)
this.hero.specSkill = q5.ToInt32(rspObj.Info.HeroInfo.SpecSkill)
q5.DuckToSimple(rspObj.Info.HeroInfo.Wealth, &this.hero.wealth)
q5.DuckToSimple(rspObj.Info.HeroInfo.ValidLefttime, &this.hero.validLeftTime)
q5.DuckToSimple(rspObj.Info.HeroInfo.CurrentTimes, &this.hero.currentTimes)
q5.DuckToSimple(rspObj.Info.HeroInfo.TotalTimes, &this.hero.totalTimes)
q5.DuckToSimple(rspObj.Info.HeroInfo.SkinId, &this.hero.skinId)
}
this.parseUserInfo(&rspObj.Info.UserInfo)
this.parseHeroInfo(&rspObj.Info.HeroInfo)
if this.GetTeam() != nil {
this.GetTeam().SendUpdateNotify()
}