playroom优化
This commit is contained in:
parent
9c9c19c9a6
commit
5341353003
@ -505,3 +505,7 @@ func GetPhysiologyList(MoodType int) []int {
|
||||
}
|
||||
return r
|
||||
}
|
||||
|
||||
func GetInteractIdBath() []int {
|
||||
return []int{11, 12, 13}
|
||||
}
|
||||
|
||||
@ -74,6 +74,7 @@ func (f *FriendMgr) Init() {
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_CHAMPSHIP_RESULT, f.sendToPlayer)
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_TREASURE_RESULT, f.sendToPlayer)
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_FACEBOOK_UNBIND, f.sendToPlayer)
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_PLAYROOM_KISS, f.sendToPlayerOnline)
|
||||
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_VAR_USER_GET, f.GetVarUserData)
|
||||
f.RegisterHandler(msg.HANDLE_TYPE_VAR_USER_SET, f.SetVarUserData)
|
||||
@ -113,6 +114,14 @@ func (f *FriendMgr) sendToPlayer(m *msg.Msg) (interface{}, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// 通知玩家
|
||||
func (f *FriendMgr) sendToPlayerOnline(m *msg.Msg) (interface{}, error) {
|
||||
f.getData().Id++
|
||||
m.Id = f.getData().Id
|
||||
sendToPlayerOnline(m)
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// 同步信息
|
||||
func (f *FriendMgr) sync(m *msg.Msg) (interface{}, error) {
|
||||
data := f.getData().List[m.From]
|
||||
@ -139,6 +148,8 @@ func (f *FriendMgr) SetVarUserData(m *msg.Msg) (interface{}, error) {
|
||||
data.Upvote++
|
||||
case VAR_OP_CHIP:
|
||||
data.Chip += VarOp.Data.(int)
|
||||
case VAR_OP_KISS:
|
||||
data.Kiss = VarOp.Data.(int)
|
||||
}
|
||||
return &VarOpration{
|
||||
Data: data,
|
||||
@ -156,6 +167,15 @@ func sendToPlayer(m *msg.Msg) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func sendToPlayerOnline(m *msg.Msg) error {
|
||||
p := G_GameLogicPtr.GetPlayer(int64(m.To))
|
||||
if p == nil || p.stop {
|
||||
return fmt.Errorf("player %d not online", m.To)
|
||||
}
|
||||
p.Send(m.Clone())
|
||||
return nil
|
||||
}
|
||||
|
||||
func FriendMgrSend(m1 *msg.Msg) error {
|
||||
m := m1.Clone()
|
||||
ToServer := GoUtil.GetServerIdByUid(m.To)
|
||||
|
||||
@ -75,6 +75,8 @@ func PlayroomBackData(p *Player) {
|
||||
Uid: int64(v.Uid),
|
||||
})
|
||||
}
|
||||
data := G_GameLogicPtr.GetUserData(int(p.M_DwUin))
|
||||
|
||||
r.Dress = Dress
|
||||
r.DressSet = GoUtil.MapIntToInt32(PlayroomMod.GetDressSet())
|
||||
r.PetAir = GoUtil.IntToInt32(PlayroomMod.GetPetAir())
|
||||
@ -92,6 +94,7 @@ func PlayroomBackData(p *Player) {
|
||||
r.Unlock = PlayroomMod.GetUnlockIds()
|
||||
r.DailyTaskReward = GoUtil.IntToInt32(PlayroomMod.DailyTaskReward)
|
||||
r.DailyTask = PlayroomMod.BackDataTask()
|
||||
r.Kiss = int32(data.Kiss)
|
||||
p.PushClientRes(r)
|
||||
}
|
||||
|
||||
@ -129,7 +132,16 @@ func PlayroomVisit(p *Player, Uid int) {
|
||||
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)
|
||||
}
|
||||
|
||||
@ -272,6 +272,8 @@ func handle(p *Player, m *msg.Msg) error {
|
||||
ChargeMod.AddWishCount()
|
||||
p.AddLog(m.From, friend.LOG_TYPE_WISH, "")
|
||||
p.PushClientRes(ChargeMod.BackData())
|
||||
case msg.HANDLE_TYPE_PLAYROOM_KISS: // playroom亲吻
|
||||
p.NotifyPlayroomKiss()
|
||||
default:
|
||||
log.Debug("uid : %d, handle msg type : %d not exist", p.M_DwUin, m.Type)
|
||||
}
|
||||
|
||||
@ -3149,9 +3149,14 @@ func ReqPlayroomInteract(player *Player, buf []byte) error {
|
||||
})
|
||||
return err
|
||||
}
|
||||
if GoUtil.InArray(int(req.Id), playroomCfg.GetInteractIdBath()) {
|
||||
G_GameLogicPtr.SetUserData(int(req.Id), VAR_OP_KISS, 0)
|
||||
}
|
||||
player.QuestTrigger(&quest.Trigger{Label: quest.TRIGGER_LABEL_INTERACT, A: []interface{}{int(req.Id)}})
|
||||
player.PlayMod.save()
|
||||
G_GameLogicPtr.SetUserData(int(req.Id), VAR_OP_KISS, 0)
|
||||
LimitedTimePlayroomTrigger(player)
|
||||
player.NotifyPlayroomKiss()
|
||||
player.PushClientRes(&msg.ResPlayroomInteract{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
@ -3514,8 +3519,14 @@ func ReqPlayroomUpvote(player *Player, buf []byte) error {
|
||||
Type: MsqMod.HANDLE_TYPE_PLAYROOM_UPVOTE,
|
||||
SendT: GoUtil.Now(),
|
||||
})
|
||||
FriendMgrSend(&MsqMod.Msg{
|
||||
From: int(player.M_DwUin),
|
||||
To: int(req.Id),
|
||||
Type: MsqMod.HANDLE_TYPE_PLAYROOM_KISS,
|
||||
SendT: GoUtil.Now(),
|
||||
})
|
||||
G_GameLogicPtr.SetUserData(int(req.Id), VAR_OP_UPVOTE, 1)
|
||||
|
||||
G_GameLogicPtr.SetUserData(int(req.Id), VAR_OP_KISS, 1)
|
||||
player.TeLog("playroom_upvote", map[string]interface{}{
|
||||
"player_id": req.Id,
|
||||
})
|
||||
|
||||
@ -44,6 +44,7 @@ type VarOpration struct {
|
||||
type VarUserData struct {
|
||||
Upvote int
|
||||
Chip int
|
||||
Kiss int
|
||||
}
|
||||
|
||||
const (
|
||||
|
||||
@ -27,6 +27,7 @@ const (
|
||||
const (
|
||||
VAR_OP_UPVOTE = 1
|
||||
VAR_OP_CHIP = 2
|
||||
VAR_OP_KISS = 3
|
||||
)
|
||||
|
||||
func (f *VarMgr) Init() {
|
||||
|
||||
@ -90,6 +90,8 @@ const (
|
||||
|
||||
HANDLE_TYPE_VAR_USER_SET // 设置玩家数据
|
||||
HANDLE_TYPE_VAR_USER_GET // 获取玩家数据
|
||||
|
||||
HANDLE_TYPE_PLAYROOM_KISS // playroom亲吻
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user