package game import ( "server/GoUtil" playroomCfg "server/conf/playroom" "server/game/mod/item" proto "server/msg" ) func (p *Player) NotifyPlayroomTask() { PlayroomMod := p.PlayMod.getPlayroomMod() m := &proto.NotifyPlayroomTask{ DailyTask: PlayroomMod.BackDataTask(), DailyTaskReward: GoUtil.IntToInt32(PlayroomMod.DailyTaskReward), } p.PushClientRes(m) } func PlayroomBackData(p *Player) { r := &proto.ResPlayroom{} PlayroomMod := p.PlayMod.getPlayroomMod() FriendMod := p.PlayMod.getFriendMod() r.Status = int32(PlayroomMod.Status) r.Items = item.ItemToMsg(PlayroomMod.Reward) Opponent := make([]*proto.RoomOpponent, 0) FriendList := make([]*proto.FriendRoom, 0) if PlayroomMod.Target == 0 { PlayroomMod.Target = GetVisitorPlayer(p) } TargerRoom := &proto.FriendRoom{} if PlayroomMod.Target != 0 { PlayerData := G_GameLogicPtr.GetSimplePlayerByUid(PlayroomMod.Target) if PlayerData != nil { TargerRoom.Uid = int64(PlayerData.Uid) TargerRoom.Name = PlayerData.Name TargerRoom.Face = int32(PlayerData.Face) TargerRoom.Avatar = int32(PlayerData.Avatar) } else { PlayroomMod.Target = 0 } } for k, v := range PlayroomMod.Visitor { ps := G_GameLogicPtr.GetSimplePlayerByUid(k) if ps == nil { continue } if !FriendMod.CheckFriend(k) { Opponent = append(Opponent, &proto.RoomOpponent{ Uid: int64(k), Name: ps.Name, Face: int32(ps.Face), Avatar: int32(ps.Avatar), LastTime: int32(v.Time), }) } } Friend := FriendMod.GetFriendList() for k := range Friend { ps := G_GameLogicPtr.GetSimplePlayerByUid(k) if ps == nil { continue } Times, _ := PlayroomMod.GetVisitorInfo(k) FriendList = append(FriendList, &proto.FriendRoom{ Uid: int64(k), Name: ps.Name, Face: int32(ps.Face), Avatar: int32(ps.Avatar), Times: int32(Times), }) } r.Opponent = Opponent r.Friend = FriendList r.Target = TargerRoom Collect := make([]*proto.PlayroomCollectInfo, 0) for _, v := range PlayroomMod.GetCollect() { Collect = append(Collect, &proto.PlayroomCollectInfo{ Id: int32(v.Id), AddTime: v.AddTime, EndTime: v.EndTime, Label: v.Label, }) } r.Collect = Collect Dress := make(map[int32]*proto.PlayroomDress) for _, v := range PlayroomMod.GetDress() { PlayroomDress, ok := Dress[int32(v.Part)] if !ok { PlayroomDress = &proto.PlayroomDress{} } PlayroomDress.List = append(PlayroomDress.List, &proto.PlayroomDressInfo{ Id: int32(v.Id), AddTime: int64(v.AddTime), EndTime: int64(v.EndTime), Label: v.Label, }) Dress[int32(v.Part)] = PlayroomDress } ChipMessage := make([]*proto.ChipInfo, 0) for _, v := range PlayroomMod.ChipList { ChipMessage = append(ChipMessage, &proto.ChipInfo{ Uid: int64(v.Uid), EmojiId: int32(v.Emoji), }) } AdWatch := make([]*proto.AdItem, 0) for k, v := range PlayroomMod.ADItem { AdWatch = append(AdWatch, &proto.AdItem{ Watch: int32(v.Watch), LastWatch: int32(v.LastTime), ItemId: int32(k), }) } data := G_GameLogicPtr.GetUserData(int(p.M_DwUin)) r.Dress = Dress r.DressSet = GoUtil.MapIntToInt32(PlayroomMod.GetDressSet()) PetAir := make([]*proto.PlayroomAirInfo, 0) for _, v := range PlayroomMod.GetPetAir() { PetAir = append(PetAir, &proto.PlayroomAirInfo{ Id: int32(v.Id), AddTime: int64(v.AddTime), Label: v.Label, }) } weeklyDiscount := make(map[int32]*proto.WeeklyDiscountInfo) ChargeMod := p.PlayMod.getChargeMod() if ChargeMod.IsWeeklyDiscountDay() { w1 := playroomCfg.GetShopWeeklyLimit() for k, v := range w1 { limitNum := PlayroomMod.WeeklyDiscount[k] weeklyDiscount[int32(k)] = &proto.WeeklyDiscountInfo{ Id: int32(k), Discount: int32(v.Discount), Count: int32(v.WeeklyLimit - limitNum), } } } r.WeeklyDiscount = weeklyDiscount r.PetAir = PetAir r.PetAirSet = int32(PlayroomMod.GetPetAirSet()) r.Chip = ChipMessage r.StartTime = int32(PlayroomMod.Starttime) r.WorkStatus = int32(PlayroomMod.WorkStatus) r.Playroom = GoUtil.MapIntToInt32(PlayroomMod.GetRoom()) r.Mood = GoUtil.MapIntToInt32(PlayroomMod.GetMood()) r.Physiology = GoUtil.MapIntToInt32(PlayroomMod.GetPhysiologyList()) r.AllMood = int32(PlayroomMod.AllMood) r.Jackpot = int32(PlayroomMod.JackpotNum) r.Upvote = int32(PlayroomMod.Upvote) r.RoomPoint = int32(PlayroomMod.RoomPoint) r.Unlock = PlayroomMod.GetUnlockIds() r.DailyTaskReward = GoUtil.IntToInt32(PlayroomMod.DailyTaskReward) r.DailyTask = PlayroomMod.BackDataTask() r.Kiss = int32(data.Kiss) r.Revenge = PlayroomMod.RevengeUid r.InteractNum = int32(PlayroomMod.InteractNum) r.AdItem = AdWatch p.PushClientRes(r) } func PlayroomVisit(p *Player, Uid int) { if Uid == 0 { p.PushClientRes(&proto.ResPlayroomInfo{}) return } PlayroomMod := p.PlayMod.getPlayroomMod() r := &proto.ResPlayroomInfo{} PlayerData := G_GameLogicPtr.GetSimplePlayerByUid(Uid) Now := GoUtil.Now() Work := false if PlayerData.WorkStart > 0 && PlayerData.WorkStart+86400 > Now { Work = true } r.Uid = int64(Uid) r.Name = PlayerData.Name r.Face = int32(PlayerData.Face) r.Avatar = int32(PlayerData.Avatar) r.Playroom = GoUtil.MapIntToInt32(PlayerData.Playroom) r.GameId = int32(PlayroomMod.GameId) r.Defense = Work r.Emoji = GoUtil.MapIntToInt32(PlayerData.Emoji) r.PetName = PlayerData.PetName Items := make(map[int32]*proto.ItemInfo, 0) for k, v := range PlayroomMod.GameReward { Items[int32(k)] = &proto.ItemInfo{ Id: int32(v.Id), Num: int32(v.Num), } } r.Upvote = GoUtil.InArray(Uid, PlayroomMod.UpvoteList) r.Items = Items r.Status = int32(PlayroomMod.GameStatus) data := G_GameLogicPtr.GetUserData(Uid) r.UpvoteCount = int32(data.Upvote) r.Chip = int32(data.Chip) r.Kiss = int32(data.Kiss) r.DressSet = GoUtil.MapIntToInt32(PlayerData.DressSet) p.PushClientRes(r) } func (p *Player) NotifyPlayroomKiss() { data := G_GameLogicPtr.GetUserData(int(p.M_DwUin)) m := &proto.NotifyPlayroomKiss{ Kiss: int32(data.Kiss), } p.PushClientRes(m) } func BackUserInfo(p *Player) { BaseMod := p.PlayMod.getBaseMod() FaceMod := p.PlayMod.getFaceMod() AvatarMod := p.PlayMod.getAvatarMod() DecorateMod := p.PlayMod.getDecorateMod() p.PushClientRes(&proto.UserInfo{ Uid: p.M_DwUin, Nickname: BaseMod.NickName, Avatar: int32(AvatarMod.SetId), Face: int32(FaceMod.SetId), DecorateCnt: int32(DecorateMod.DecorateNum), AvatarList: AvatarMod.BackData(), FaceList: FaceMod.BackData(), EmojiList: p.PlayMod.getEmojiMod().BackData(), SetEmoji: p.PlayMod.getEmojiMod().GetEmojiSet(), Login: int32(BaseMod.GetLoginTime()), PetName: BaseMod.PetName, IdNum: BaseMod.IdCardNum, AddCode: BaseMod.AddCode, }) }