Merge branch 'develop' into sdk
This commit is contained in:
commit
6ba72333d2
@ -693,6 +693,19 @@ func (p *Player) HandleItem(itemList []*item.Item, Label string) error {
|
||||
Effect := itemCfg.GetItemEffect(v.Id)
|
||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||
PlayroomMod.AddDress(Effect)
|
||||
case item.ITEM_TYPE_PLAYROOM_DECORATION_SET: // playroom装饰套装
|
||||
Effect := itemCfg.GetItemEffectList(v.Id)
|
||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||
for _, v := range Effect {
|
||||
if v == 0 {
|
||||
continue
|
||||
}
|
||||
PlayroomMod.AddCollect(v)
|
||||
}
|
||||
p.TeLog("playroom_decoration_set", map[string]interface{}{
|
||||
"decoration_set_id": Effect,
|
||||
"income_from": Label,
|
||||
})
|
||||
default:
|
||||
err := ItemMod.AddItem(v.Id, v.Num)
|
||||
p.TeLog("item_change", map[string]interface{}{
|
||||
@ -709,7 +722,7 @@ func (p *Player) HandleItem(itemList []*item.Item, Label string) error {
|
||||
}
|
||||
ResItemPopId := 0
|
||||
if v, ok := p.args["ResItemPopId"]; ok {
|
||||
ResItemPopId = v.(int)
|
||||
ResItemPopId = GoUtil.Int(v)
|
||||
}
|
||||
if len(ResItem) != 0 || len(ResCard) != 0 {
|
||||
p.PushClientRes(&msg.ResItemPop{
|
||||
@ -722,9 +735,17 @@ func (p *Player) HandleItem(itemList []*item.Item, Label string) error {
|
||||
for k := range BackDataType {
|
||||
switch k {
|
||||
case item.ITEM_TYPE_AVATAR:
|
||||
BackUserInfo(p)
|
||||
case item.ITEM_TYPE_EMOJI:
|
||||
BackUserInfo(p)
|
||||
case item.ITEM_TYPE_FACE:
|
||||
BackUserInfo(p)
|
||||
case item.ITEM_TYPE_PLAYROOM_DECORATION:
|
||||
PlayroomBackData(p)
|
||||
case item.ITEM_TYPE_PLAYROOM_DRESS:
|
||||
PlayroomBackData(p)
|
||||
case item.ITEM_TYPE_PLAYROOM_DECORATION_SET:
|
||||
PlayroomBackData(p)
|
||||
}
|
||||
}
|
||||
CardMod := p.PlayMod.getCardMod()
|
||||
|
||||
@ -656,21 +656,30 @@ func GetVisitorPlayer(p *Player) int {
|
||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||
VisitorList := PlayroomMod.GetVisitor()
|
||||
HasVisit := PlayroomMod.GetHasVisit()
|
||||
TodayVisitedUsers := PlayroomMod.GetTodayVisitedUsers()
|
||||
FriendMod := p.PlayMod.getFriendMod()
|
||||
type sortData struct {
|
||||
Uid int
|
||||
Time int64
|
||||
}
|
||||
PlayerList := make([]sortData, 0)
|
||||
|
||||
PlayerList2 := make([]sortData, 0)
|
||||
Now := GoUtil.Now()
|
||||
for k, v := range VisitorList {
|
||||
if _, ok := HasVisit[k]; ok {
|
||||
continue
|
||||
}
|
||||
if GoUtil.InArray(k, TodayVisitedUsers) {
|
||||
continue
|
||||
}
|
||||
if v.Time < Now-86400 {
|
||||
continue
|
||||
}
|
||||
PlayerList = append(PlayerList, sortData{k, v.Time})
|
||||
if FriendMod.CheckFriend(k) {
|
||||
PlayerList = append(PlayerList, sortData{k, v.Time})
|
||||
} else {
|
||||
PlayerList2 = append(PlayerList, sortData{k, v.Time})
|
||||
}
|
||||
}
|
||||
if len(PlayerList) != 0 {
|
||||
sort.Slice(PlayerList, func(i, j int) bool {
|
||||
@ -678,20 +687,58 @@ func GetVisitorPlayer(p *Player) int {
|
||||
})
|
||||
return PlayerList[0].Uid
|
||||
}
|
||||
FriendMod := p.PlayMod.getFriendMod()
|
||||
PlayerList2 := make([]sortData, 0)
|
||||
for _, v := range PlayerList {
|
||||
if FriendMod.CheckFriend(v.Uid) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
if len(PlayerList2) != 0 {
|
||||
sort.Slice(PlayerList2, func(i, j int) bool {
|
||||
return PlayerList2[i].Time < PlayerList2[j].Time
|
||||
})
|
||||
return PlayerList2[0].Uid
|
||||
}
|
||||
L := GetRecommendPlayer(p, 1)
|
||||
// 若不存在符合条件的用户,则选择24小时内登入过游戏且上次登入时间与当前时间最近的好友
|
||||
var recentFriendUid int
|
||||
var recentLoginTime int64 = 0
|
||||
for uid := range FriendMod.GetFriendList() {
|
||||
if uid == int(p.M_DwUin) {
|
||||
continue
|
||||
}
|
||||
if GoUtil.InArray(uid, TodayVisitedUsers) {
|
||||
continue
|
||||
}
|
||||
ps := G_GameLogicPtr.GetSimplePlayerByUid(uid)
|
||||
if ps == nil {
|
||||
continue
|
||||
}
|
||||
if GoUtil.Now()-ps.Loginout <= 86400 { // 24小时内登录过
|
||||
if ps.Loginout > recentLoginTime {
|
||||
recentLoginTime = ps.Loginout
|
||||
recentFriendUid = uid
|
||||
}
|
||||
}
|
||||
}
|
||||
if recentFriendUid != 0 {
|
||||
return recentFriendUid
|
||||
}
|
||||
PlayerList3 := G_GameLogicPtr.RankMgr.getAllRank(RANK_TYPE_USER)
|
||||
PlayerList4 := make([]int, 0)
|
||||
for _, v := range PlayerList3 {
|
||||
if v.Score < 15 {
|
||||
continue
|
||||
}
|
||||
if v.Uid == int(p.M_DwUin) {
|
||||
continue
|
||||
}
|
||||
PlayerSimpleData := G_GameLogicPtr.GetSimplePlayerByUid(v.Uid)
|
||||
if GoUtil.Now()-PlayerSimpleData.Loginout > 86400 {
|
||||
continue
|
||||
}
|
||||
if PlayerSimpleData.Level < 6 {
|
||||
continue
|
||||
}
|
||||
PlayerList4 = append(PlayerList4, v.Uid)
|
||||
}
|
||||
L := GoUtil.RandSliceNum(PlayerList4, 1)
|
||||
if len(L) == 0 {
|
||||
return 0
|
||||
}
|
||||
return L[0]
|
||||
}
|
||||
|
||||
|
||||
@ -298,7 +298,7 @@ func ReqRewardOrder(player *Player, buf []byte) error {
|
||||
|
||||
if LimitedTimeEventMod.CheckExist(limitedTimeEvent.EVENT_TYPE_CHEST_RAIN) { //宝箱雨活动
|
||||
ChestRainItems := LimitedTimeEventMod.GetChestReward(mergeList)
|
||||
player.args["ResItemPopId"] = 0
|
||||
player.args["ResItemPopId"] = req.OrderId
|
||||
err = player.HandleItem(ChestRainItems, msg.ITEM_POP_LABEL_LimitEventChestRain.String())
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResRewardOrder{
|
||||
@ -3220,7 +3220,7 @@ func ReqPlayroomSetRoom(player *Player, buf []byte) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// 玩游戏 Desprecated
|
||||
// 玩游戏
|
||||
func ReqPlayroomGame(player *Player, buf []byte) error {
|
||||
req := &msg.ReqPlayroomGame{}
|
||||
proto.Unmarshal(buf, req)
|
||||
|
||||
@ -30,21 +30,22 @@ const (
|
||||
ITEM_TYPE_DIAMOND = 3
|
||||
|
||||
// 物品类型
|
||||
ITEM_TYPE_CARD = 98 // 卡牌
|
||||
ITEM_TYPE_BAG = 99 // 背包
|
||||
ITEM_TYPE_CHESS = 100 // 棋子
|
||||
ITEM_TYPE_CARD_PACK = 101 // 卡包
|
||||
ITEM_TYPE_LIMIED_TIME_EVENT = 102 //限时事件
|
||||
ITEM_TYPE_PIGGY_BANK = 103 // 猪猪银行
|
||||
ITEM_TYPE_MASTER_CARD = 104 // 万能卡
|
||||
ITEM_TYPE_AVATAR = 105 // 头像框
|
||||
ITEM_TYPE_ACTIVITY = 106 // 活动道具
|
||||
ITEM_TYPE_ACTIVITY_RACE = 107 // 竞赛活动道具
|
||||
ITEM_TYPE_PLAYROOM_VISIT = 108 // playroom拜访道具
|
||||
ITEM_TYPE_EMOJI = 109 // 表情
|
||||
ITEM_TYPE_FACE = 110 // 头像
|
||||
ITEM_TYPE_PLAYROOM_DECORATION = 111 // playroom装饰
|
||||
ITEM_TYPE_PLAYROOM_DRESS = 112 // playroom服饰
|
||||
ITEM_TYPE_CARD = 98 // 卡牌
|
||||
ITEM_TYPE_BAG = 99 // 背包
|
||||
ITEM_TYPE_CHESS = 100 // 棋子
|
||||
ITEM_TYPE_CARD_PACK = 101 // 卡包
|
||||
ITEM_TYPE_LIMIED_TIME_EVENT = 102 //限时事件
|
||||
ITEM_TYPE_PIGGY_BANK = 103 // 猪猪银行
|
||||
ITEM_TYPE_MASTER_CARD = 104 // 万能卡
|
||||
ITEM_TYPE_AVATAR = 105 // 头像框
|
||||
ITEM_TYPE_ACTIVITY = 106 // 活动道具
|
||||
ITEM_TYPE_ACTIVITY_RACE = 107 // 竞赛活动道具
|
||||
ITEM_TYPE_PLAYROOM_VISIT = 108 // playroom拜访道具
|
||||
ITEM_TYPE_EMOJI = 109 // 表情
|
||||
ITEM_TYPE_FACE = 110 // 头像
|
||||
ITEM_TYPE_PLAYROOM_DECORATION = 111 // playroom装饰
|
||||
ITEM_TYPE_PLAYROOM_DRESS = 112 // playroom服饰
|
||||
ITEM_TYPE_PLAYROOM_DECORATION_SET = 113 // playroom装饰套装
|
||||
)
|
||||
|
||||
func (i *ItemMod) InitData() {
|
||||
|
||||
@ -37,7 +37,7 @@ type Order struct {
|
||||
|
||||
const (
|
||||
Common_type = 1 // 普通订单
|
||||
Extra_type = 2 // 额外订单
|
||||
Extra_type = 2 // 额外订单 弃用
|
||||
Super_type = 3 // 超级订单
|
||||
Preheat_type = 4 // 预热订单
|
||||
Trigger_type = 5 // 触发订单
|
||||
@ -389,7 +389,7 @@ func (o *OrderMod) addOrder(ChessList []int, Diff int, Type int) int {
|
||||
o.Auto_id++
|
||||
Star := GetOrderStar(ChessList)
|
||||
Items := make([]*item.Item, 0)
|
||||
if Type != Common_type {
|
||||
if Type != Common_type && Type != Super_type {
|
||||
Items = []*item.Item{item.NewItem(item.ITEM_STAR_ID, Star)}
|
||||
}
|
||||
Order := Order{
|
||||
|
||||
@ -12,48 +12,50 @@ import (
|
||||
)
|
||||
|
||||
type PlayroomMod struct {
|
||||
Collect map[int]int // 装饰
|
||||
Room map[int]int // 房间
|
||||
Dress map[int][]int // 服装仓库
|
||||
DressSet map[int]int // 服装穿戴
|
||||
PetAir []int // 宠物空气背包
|
||||
PetAirSet int // 宠物空气背包穿戴
|
||||
Status int // 0: 未拜访 1: 拜访
|
||||
Endtime int64 // 结束时间
|
||||
Starttime int64 // 开始时间
|
||||
WorkStatus int // 0: 未开始 1: 进行中 2: 结束
|
||||
Visitor map[int]*Info // 访客
|
||||
MoodInfo map[int]*Mood // 心情
|
||||
AllMood int // 总心情
|
||||
Reward []*item.Item // 奖励
|
||||
DayFirstT int // 每日未首次触发次数
|
||||
Trigger int // 未触发次数
|
||||
TriggerTime int64 // 触发时间
|
||||
HasVisit map[int]int64 // 今日已拜访的玩家
|
||||
Target int // 拜访的目标
|
||||
GameId int // 游戏ID
|
||||
GameReward map[int]*item.Item // 游戏奖励
|
||||
GameStatus int // 游戏状态
|
||||
GameInfo map[int]interface{} // 游戏信息
|
||||
Exclude bool // 是否排除
|
||||
LoseItem []*item.Item // 失去的物品
|
||||
ChipList []*ChipInfo // 碎片列表
|
||||
Flip map[int]int // 翻牌
|
||||
FlipReward []*item.Item // 翻牌奖励
|
||||
WorkOutline int // 是否离线
|
||||
LastFlip int // 上次翻牌奖励档次
|
||||
NoFlip int // 连续未获取最高翻牌奖励次数
|
||||
TodayFlip bool // 今日是否已获得最高档奖励
|
||||
JackpotNum int // 每日转盘数量
|
||||
Upvote int // 收到点赞次数
|
||||
UpvoteList []int // 点赞列表
|
||||
RoomPoint int // 房间点数
|
||||
UnlockList map[int]int64 // 解锁
|
||||
DailyTask map[int]*DailyTask // 每日任务
|
||||
DailyTaskReward []int // 每日任务奖励
|
||||
Physiology map[int]*Physiology
|
||||
InteractNum int // 互动次数
|
||||
RevengeUid int64 // 复仇Uid
|
||||
Collect map[int]int // 装饰
|
||||
Room map[int]int // 房间
|
||||
Dress map[int][]int // 服装仓库
|
||||
DressSet map[int]int // 服装穿戴
|
||||
PetAir []int // 宠物空气背包
|
||||
PetAirSet int // 宠物空气背包穿戴
|
||||
Status int // 0: 未拜访 1: 拜访
|
||||
Endtime int64 // 结束时间
|
||||
Starttime int64 // 开始时间
|
||||
WorkStatus int // 0: 未开始 1: 进行中 2: 结束
|
||||
Visitor map[int]*Info // 访客
|
||||
MoodInfo map[int]*Mood // 心情
|
||||
AllMood int // 总心情
|
||||
Reward []*item.Item // 奖励
|
||||
DayFirstT int // 每日未首次触发次数
|
||||
Trigger int // 未触发次数
|
||||
TriggerTime int64 // 触发时间
|
||||
HasVisit map[int]int64 // 今日已拜访的玩家
|
||||
Target int // 拜访的目标
|
||||
GameId int // 游戏ID
|
||||
GameReward map[int]*item.Item // 游戏奖励
|
||||
GameStatus int // 游戏状态
|
||||
GameInfo map[int]interface{} // 游戏信息
|
||||
Exclude bool // 是否排除
|
||||
LoseItem []*item.Item // 失去的物品
|
||||
ChipList []*ChipInfo // 碎片列表
|
||||
Flip map[int]int // 翻牌
|
||||
FlipReward []*item.Item // 翻牌奖励
|
||||
WorkOutline int // 是否离线
|
||||
LastFlip int // 上次翻牌奖励档次
|
||||
NoFlip int // 连续未获取最高翻牌奖励次数
|
||||
TodayFlip bool // 今日是否已获得最高档奖励
|
||||
JackpotNum int // 每日转盘数量
|
||||
Upvote int // 收到点赞次数
|
||||
UpvoteList []int // 点赞列表
|
||||
RoomPoint int // 房间点数
|
||||
UnlockList map[int]int64 // 解锁
|
||||
DailyTask map[int]*DailyTask // 每日任务
|
||||
DailyTaskReward []int // 每日任务奖励
|
||||
Physiology map[int]*Physiology
|
||||
InteractNum int // 互动次数
|
||||
RevengeUid int64 // 复仇Uid
|
||||
FilterVisitor bool // 是否过滤访客
|
||||
TodayVisitedUsers []int // 今日已拜访过的用户
|
||||
}
|
||||
|
||||
type DailyTask struct {
|
||||
@ -189,6 +191,7 @@ func (p *PlayroomMod) ZeroUpdate() {
|
||||
p.JackpotNum = playroomCfg.GetJackpotNum()
|
||||
p.UpvoteList = make([]int, 0)
|
||||
p.DailyTaskReward = make([]int, 0)
|
||||
p.TodayVisitedUsers = make([]int, 0)
|
||||
p.InitDailyTask()
|
||||
}
|
||||
|
||||
@ -280,6 +283,10 @@ func (p *PlayroomMod) GetHasVisit() map[int]int64 {
|
||||
return p.HasVisit
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) GetTodayVisitedUsers() []int {
|
||||
return p.TodayVisitedUsers
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) GetMood() map[int]int {
|
||||
Mood := make(map[int]int)
|
||||
for k, v := range p.MoodInfo {
|
||||
@ -459,6 +466,7 @@ func (p *PlayroomMod) AddDress(Id int) {
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) ResetGame() {
|
||||
p.TodayVisitedUsers = append(p.TodayVisitedUsers, p.Target)
|
||||
p.Target = 0
|
||||
p.Status = STATUS_IDLE
|
||||
p.GameId = 0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user