fix: 修复空提交问题
This commit is contained in:
@@ -94,7 +94,7 @@ func (h Controller) PlayerFightBoss(data *fight.ChallengeBossInboundInfo, c *pla
|
||||
}
|
||||
|
||||
}
|
||||
c.PVPinfo = &info.PVPinfo{
|
||||
c.Fightinfo = &info.Fightinfo{
|
||||
|
||||
Status: info.BattleStatus.FIGHT_WITH_BOSS,
|
||||
Mode: info.BattleMode.MULTI_MODE,
|
||||
@@ -134,7 +134,7 @@ func (h Controller) OnPlayerFightNpcMonster(data *fight.FightNpcMonsterInboundIn
|
||||
moinfo.Nick = xmlres.PetMAP[int(mo.ID)].DefName
|
||||
moinfo.PetList = append(moinfo.PetList, *mo)
|
||||
ai := player.NewAI_player(moinfo)
|
||||
c.PVPinfo = &info.PVPinfo{
|
||||
c.Fightinfo = &info.Fightinfo{
|
||||
Mode: info.BattleMode.MULTI_MODE,
|
||||
Status: info.BattleStatus.FIGHT_WITH_NPC,
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package controller
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
|
||||
"blazing/logic/service/common"
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/fight/info"
|
||||
"blazing/logic/service/player"
|
||||
@@ -33,17 +34,21 @@ func (h Controller) ARENA_FIGHT_OWENR(data *fight.ARENA_FIGHT_OWENR, c *player.P
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotEligible
|
||||
}
|
||||
|
||||
t := space.GetSpace(c.Info.MapID).Can_ARENA(c)
|
||||
if t != nil {
|
||||
t.(*player.Player).PVPinfo = &info.PVPinfo{
|
||||
space.GetSpace(c.Info.MapID).Can_ARENA(func(ownerID common.PlayerI) common.PlayerI {
|
||||
c.Fightinfo = &info.Fightinfo{
|
||||
Mode: info.BattleMode.SINGLE_MODE,
|
||||
Status: info.BattleStatus.FIGHT_WITH_PLAYER,
|
||||
}
|
||||
fight.NewFight(t, c, func(foi *info.FightOverInfo) {
|
||||
_, fighterr := fight.NewFight(c, ownerID, func(foi *info.FightOverInfo) { //我方邀请擂主挑战,我方先手
|
||||
|
||||
}) ///开始对战,房主方以及被邀请方
|
||||
|
||||
}
|
||||
if fighterr != nil {
|
||||
return nil
|
||||
}
|
||||
return c
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ func (h Controller) PET_MELEE(data *fight.StartPetWarInboundInfo, c *player.Play
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotEligible
|
||||
}
|
||||
|
||||
c.PVPinfo = &info.PVPinfo{
|
||||
c.Fightinfo = &info.Fightinfo{
|
||||
Mode: info.BattleMode.PET_MELEE,
|
||||
Status: info.BattleStatus.FIGHT_WITH_PLAYER}
|
||||
g := c.Pet_joinFight()
|
||||
@@ -33,15 +33,15 @@ func (h Controller) PET_King(data *fight.PetKingJoinInboundInfo, c *player.Playe
|
||||
return nil, errorcode.ErrorCodes.ErrPokemonNotEligible
|
||||
}
|
||||
|
||||
c.PVPinfo = &info.PVPinfo{
|
||||
c.Fightinfo = &info.Fightinfo{
|
||||
|
||||
Status: info.BattleStatus.FIGHT_WITH_PLAYER}
|
||||
|
||||
switch data.Type {
|
||||
case 5:
|
||||
c.PVPinfo.Mode = info.BattleMode.SINGLE_MODE
|
||||
c.Fightinfo.Mode = info.BattleMode.SINGLE_MODE
|
||||
case 6:
|
||||
c.PVPinfo.Mode = info.BattleMode.MULTI_MODE
|
||||
c.Fightinfo.Mode = info.BattleMode.MULTI_MODE
|
||||
}
|
||||
g := c.Pet_joinFight()
|
||||
if g != nil {
|
||||
|
||||
@@ -2,6 +2,8 @@ package controller
|
||||
|
||||
import (
|
||||
"blazing/common/socket/errorcode"
|
||||
"sync/atomic"
|
||||
"unsafe"
|
||||
|
||||
"blazing/logic/service/fight"
|
||||
"blazing/logic/service/fight/info"
|
||||
@@ -31,7 +33,7 @@ func (h Controller) OnPlayerInviteOtherFight(data *fight.InviteToFightInboundInf
|
||||
|
||||
//进入邀请,以及确认对战模式
|
||||
|
||||
c.PVPinfo = &info.PVPinfo{PlayerID: data.UserID,
|
||||
c.Fightinfo = &info.Fightinfo{PlayerID: data.UserID,
|
||||
Mode: data.Mode,
|
||||
Status: info.BattleStatus.FIGHT_WITH_PLAYER}
|
||||
|
||||
@@ -42,7 +44,7 @@ func (h Controller) OnPlayerInviteOtherFight(data *fight.InviteToFightInboundInf
|
||||
|
||||
// 取消和他人战斗
|
||||
func (h Controller) OnPlayerCanceledOtherInviteFight(data *fight.InviteFightCancelInboundInfo, c *player.Player) (result *fight.NullOutboundInfo, err errorcode.ErrorCode) {
|
||||
c.PVPinfo = nil
|
||||
|
||||
atomic.StorePointer(unsafe.Pointer(c.Fightinfo), nil)
|
||||
return nil, 0
|
||||
}
|
||||
|
||||
@@ -10,11 +10,8 @@ import (
|
||||
"blazing/logic/service/space"
|
||||
|
||||
"github.com/jinzhu/copier"
|
||||
"github.com/panjf2000/ants/v2"
|
||||
)
|
||||
|
||||
var mappool, _ = ants.NewPool(-1)
|
||||
|
||||
func (h *Controller) MapEnter(data *maps.InInfo, c *player.Player) (result *info.OutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
||||
|
||||
c.Info.MapID = data.MapId //登录地图
|
||||
@@ -23,10 +20,8 @@ func (h *Controller) MapEnter(data *maps.InInfo, c *player.Player) (result *info
|
||||
result = info.NewOutInfo()
|
||||
c.Info.Pos = data.Point
|
||||
copier.Copy(result, c.Info)
|
||||
mappool.Submit(func() {
|
||||
c.GetSpace().EnterMap(c)
|
||||
})
|
||||
|
||||
defer c.GetSpace().EnterMap(c)
|
||||
return result, 0
|
||||
}
|
||||
func (h Controller) MapHot(data *maphot.InInfo, c *player.Player) (result *maphot.OutInfo, err errorcode.ErrorCode) {
|
||||
@@ -43,9 +38,8 @@ func (h *Controller) MapLeave(data *maps.LeaveMapInboundInfo, c *player.Player)
|
||||
c.Canmon = false
|
||||
c.Changemap = true //可以刷怪
|
||||
//data.Broadcast(c.Info.MapID, info.LeaveMapOutboundInfo{UserID: c.Info.UserID}) //同步广播
|
||||
mappool.Submit(func() {
|
||||
c.GetSpace().LeaveMap(c) //玩家离开地图
|
||||
})
|
||||
|
||||
defer c.GetSpace().LeaveMap(c) //玩家离开地图
|
||||
|
||||
// 如果有正在运行的刷怪协程,发送停止信号
|
||||
|
||||
|
||||
Reference in New Issue
Block a user