playroom bug修复
This commit is contained in:
parent
0634aaabcb
commit
34999b3ec3
@ -37,7 +37,7 @@ func Init() {
|
||||
server.Start()
|
||||
}
|
||||
|
||||
if conf.Server.CenterAddr != "" {
|
||||
if conf.Server.CenterAddr != "" && conf.Server.ServerType != "center" {
|
||||
connectRemote(conf.Server.CenterAddr, ClusterCenterId, "center")
|
||||
}
|
||||
|
||||
|
||||
@ -27,14 +27,14 @@ func HandShake(a *Agent) {
|
||||
log.Debug("HandShake GobMarshal err %v", err)
|
||||
return
|
||||
}
|
||||
log.Debug("握手 server id :%d", conf.Server.ServerID)
|
||||
// log.Debug("握手 server id :%d", conf.Server.ServerID)
|
||||
a.WriteMsg(data)
|
||||
}
|
||||
|
||||
// 握手回调
|
||||
func HandShakeRecv(a *Agent, m *msg.Msg) error {
|
||||
ServerId := m.From
|
||||
log.Debug("收到握手回复 ServerId %v", ServerId)
|
||||
// log.Debug("收到握手回复 ServerId %v", ServerId)
|
||||
a.ServerId = ServerId
|
||||
serverAgent.Store(ServerId, a)
|
||||
|
||||
@ -54,13 +54,13 @@ func HandShakeRecv(a *Agent, m *msg.Msg) error {
|
||||
To: ServerId,
|
||||
}
|
||||
sendGameMsg(syncMsg)
|
||||
fmt.Print("现有区服连接:")
|
||||
serverAgent.Range(func(key, value interface{}) bool {
|
||||
fmt.Print(key)
|
||||
fmt.Print(",")
|
||||
return true
|
||||
})
|
||||
fmt.Println()
|
||||
// fmt.Print("现有区服连接:")
|
||||
// serverAgent.Range(func(key, value interface{}) bool {
|
||||
// fmt.Print(key)
|
||||
// fmt.Print(",")
|
||||
// return true
|
||||
// })
|
||||
// fmt.Println()
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,6 @@ func ClusterMgrInit() {
|
||||
}
|
||||
|
||||
func clusterHandlerProcess(m *msg.Msg) {
|
||||
log.Debug("clusterHandlerProcess m %v", m)
|
||||
if fun, ok := clusterHandler[m.Type]; ok {
|
||||
fun(m)
|
||||
} else {
|
||||
|
||||
@ -797,6 +797,9 @@ func (ad *GameLogic) RegisterNetWorkFunc() {
|
||||
RegisterMsgProcessFunc("ReqPlayroomRest", ReqPlayroomRest) // 宠物休息
|
||||
RegisterMsgProcessFunc("ReqPlayroomDraw", ReqPlayroomDraw) // 转盘
|
||||
RegisterMsgProcessFunc("ReqPlayroomChip", ReqPlayroomChip) // 消除碎片
|
||||
RegisterMsgProcessFunc("ReqPlayroomOutline", ReqPlayroomOutline) // 打工离线
|
||||
RegisterMsgProcessFunc("ReqPlayroomWrokOutline", ReqPlayroomWrokOutline) // 打工离线完成
|
||||
|
||||
}
|
||||
|
||||
func (ad *GameLogic) CreateHttpManager() {
|
||||
|
||||
@ -162,6 +162,10 @@ func ReqGmCommand(args []interface{}) error {
|
||||
player.PushClientRes(PlayroomMod.NotifyLose())
|
||||
case "save":
|
||||
player.PlayMod.ClearData(player)
|
||||
case "outline":
|
||||
a := player.GetAgent()
|
||||
a.Close()
|
||||
player.ClearData()
|
||||
}
|
||||
player.PlayMod.save()
|
||||
return nil
|
||||
|
||||
@ -349,9 +349,16 @@ func (p *Player) Login() {
|
||||
p.PlayMod.getCardMod().Login(G_GameLogicPtr.SeverInfo.OpenTime)
|
||||
}
|
||||
|
||||
func (p *Player) Outline() {
|
||||
PlayroomMod := p.PlayMod.getPlayroomMod()
|
||||
PlayroomMod.Outline()
|
||||
p.PlayMod.save()
|
||||
}
|
||||
|
||||
// 离线 保存数据
|
||||
func (p *Player) ClearData() {
|
||||
log.Release("uid: %d, outline save data", p.M_DwUin)
|
||||
p.Outline()
|
||||
ctx := context.Background()
|
||||
txOptions := &sql.TxOptions{}
|
||||
tx, err := db.SqlDb.BeginTx(ctx, txOptions)
|
||||
|
||||
@ -99,9 +99,6 @@ func (p *PlayerChessData) UpdateChessData(MChessData map[string]int32) error {
|
||||
return fmt.Errorf("棋子数据不一致")
|
||||
}
|
||||
p.M_Player.PlayMod.getChessMod().ChessMap = MChessData
|
||||
if p.M_Player.M_DwUin == 200042 {
|
||||
log.Debug("棋子数据一致, %v---%v", p.Data.MChessData, p.M_Player.PlayMod.getChessMod().GetChessList())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -2924,7 +2924,7 @@ func ReqPlayroomWork(args []interface{}) error {
|
||||
LimitedTimePlayroomWorkTrigger(player)
|
||||
player.UpdateUserInfo()
|
||||
}
|
||||
err = player.HandleItem(Items, "playroomWork")
|
||||
err = player.HandleLoseItem(Items, "playroomWork")
|
||||
if err != nil {
|
||||
player.SendErrClienRes(&msg.ResPlayroomWork{
|
||||
Code: msg.RES_CODE_FAIL,
|
||||
@ -3120,6 +3120,7 @@ func ReqPlayroomOutline(args []interface{}) error {
|
||||
})
|
||||
return err
|
||||
}
|
||||
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(ChessMod.BackData())
|
||||
player.PushClientRes(&msg.ResPlayroomOutline{
|
||||
@ -3127,3 +3128,15 @@ func ReqPlayroomOutline(args []interface{}) error {
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
func ReqPlayroomWrokOutline(args []interface{}) error {
|
||||
_, player, _ := ParseArgs(args)
|
||||
PlayroomMod := player.PlayMod.getPlayroomMod()
|
||||
PlayroomMod.SetWorkOutline(0)
|
||||
player.PlayMod.save()
|
||||
player.PushClientRes(PlayroomMod.NotifyStatus())
|
||||
player.PushClientRes(&msg.ResPlayroomWrokOutline{
|
||||
Code: msg.RES_CODE_SUCCESS,
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ func (h *Handbook) InitData() {
|
||||
|
||||
// 解锁图鉴
|
||||
func (h *Handbook) SetHandbook(Id int) bool {
|
||||
if Id <= 0 {
|
||||
return false
|
||||
}
|
||||
_, ok := h.BookList[Id]
|
||||
if ok {
|
||||
return false
|
||||
|
||||
@ -11,27 +11,28 @@ import (
|
||||
)
|
||||
|
||||
type PlayroomMod struct {
|
||||
Collect map[int]int // 装饰
|
||||
Room map[int]int // 房间
|
||||
Status int // 0: 未开始 1: 进行中 2: 结束
|
||||
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 // 未触发次数
|
||||
HasVisit map[int]int64 // 今日已拜访的玩家
|
||||
Target int // 拜访的目标
|
||||
GameId int // 游戏ID
|
||||
GameReward map[int]*item.Item // 游戏奖励
|
||||
GameStatus int // 游戏状态
|
||||
Exclude bool // 是否排除
|
||||
LoseItem []*item.Item // 失去的物品
|
||||
Chip int // 碎片
|
||||
Flip map[int]int // 翻牌
|
||||
Collect map[int]int // 装饰
|
||||
Room map[int]int // 房间
|
||||
Status int // 0: 未开始 1: 进行中 2: 结束
|
||||
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 // 未触发次数
|
||||
HasVisit map[int]int64 // 今日已拜访的玩家
|
||||
Target int // 拜访的目标
|
||||
GameId int // 游戏ID
|
||||
GameReward map[int]*item.Item // 游戏奖励
|
||||
GameStatus int // 游戏状态
|
||||
Exclude bool // 是否排除
|
||||
LoseItem []*item.Item // 失去的物品
|
||||
Chip int // 碎片
|
||||
Flip map[int]int // 翻牌
|
||||
WorkOutline int // 是否离线
|
||||
}
|
||||
|
||||
const (
|
||||
@ -302,12 +303,19 @@ func (p *PlayroomMod) Rest() {
|
||||
p.WorkStatus = 2
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) SetWorkOutline(Status int) {
|
||||
p.WorkOutline = Status
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) ResetWork() {
|
||||
p.WorkStatus = 0
|
||||
p.Starttime = 0
|
||||
p.Endtime = 0
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) Outline() {
|
||||
p.WorkOutline = 1
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) GetVisitorInfo(Id int) (int, int64) {
|
||||
v, ok := p.Visitor[Id]
|
||||
if !ok {
|
||||
@ -339,6 +347,12 @@ func (p *PlayroomMod) NotifyLose() *msg.NotifyPlayroomLose {
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) NotifyStatus() *msg.NofiPlayroomStatus {
|
||||
return &msg.NofiPlayroomStatus{
|
||||
WorkOutline: int32(p.WorkOutline),
|
||||
}
|
||||
}
|
||||
|
||||
func (p *PlayroomMod) NotifyMood() *msg.NotifyPlayroomMood {
|
||||
Mood := make(map[int32]int32, 0)
|
||||
for k, v := range p.MoodInfo {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user