This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -133,7 +133,7 @@ func StartClient(id, port uint32, callback any) *struct {
|
||||
|
||||
MatchCancel func(context.Context, uint32) error
|
||||
} {
|
||||
//cool.Config.File.Domain = "127.0.0.1"
|
||||
cool.Config.File.Domain = "127.0.0.1"
|
||||
u := url.URL{
|
||||
Scheme: "ws",
|
||||
Host: cool.Config.File.Domain + gconv.String(cool.Config.Address),
|
||||
|
||||
@@ -13,8 +13,7 @@ type NewSel53 struct {
|
||||
}
|
||||
|
||||
func (e *NewSel53) TurnStart(fattack *action.SelectSkillAction, sattack *action.SelectSkillAction) {
|
||||
//魂印特性有不在场的情况,绑定时候将精灵和特性绑定
|
||||
if e.ID().GetCatchTime() != e.Ctx().Our.CurPet[0].Info.CatchTime {
|
||||
if !e.IsOwner() || e.Ctx().Our.CurPet[0] == nil || e.Ctx().Opp.CurPet[0] == nil {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -23,12 +22,12 @@ func (e *NewSel53) TurnStart(fattack *action.SelectSkillAction, sattack *action.
|
||||
healAmount := maxHP.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
|
||||
|
||||
// 恢复我方HP
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, nil, healAmount)
|
||||
e.Ctx().Our.Heal(e.Ctx().Our, &action.SelectSkillAction{}, healAmount)
|
||||
|
||||
// 恢复敌方HP
|
||||
oppMaxHP := e.Ctx().Opp.CurPet[0].GetMaxHP()
|
||||
oppHealAmount := oppMaxHP.Mul(e.Args()[0]).Div(alpacadecimal.NewFromInt(100))
|
||||
e.Ctx().Opp.Heal(e.Ctx().Opp, nil, oppHealAmount)
|
||||
e.Ctx().Opp.Heal(e.Ctx().Opp, &action.SelectSkillAction{}, oppHealAmount)
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
||||
@@ -325,10 +325,7 @@ func (p *ClientData) GetPlayer(userid uint32) *Player { //TODO 这里待优化,
|
||||
if p.Player == nil {
|
||||
p.Player = NewPlayer(p.Conn)
|
||||
}
|
||||
_, ok := Mainplayer.LoadOrStore(userid, p)
|
||||
if !ok {
|
||||
p.Player = NewPlayer(p.Conn)
|
||||
}
|
||||
Mainplayer.Store(userid, p)
|
||||
|
||||
return p.Player
|
||||
// return nil
|
||||
|
||||
@@ -482,8 +482,8 @@ func (player1 *Player) Kick(isquit bool) {
|
||||
case <-time.After(kickTimeout):
|
||||
timeout = true
|
||||
}
|
||||
player1.SaveOnDisconnect()
|
||||
if timeout {
|
||||
player1.SaveOnDisconnect()
|
||||
service.NewBaseSysLogService().RecordKick(uint32(player1.Info.UserID), fmt.Sprintf("踢人操作超时(超时时间:%v)", kickTimeout))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,9 +19,10 @@ func (p *Player) Save() {
|
||||
return
|
||||
|
||||
}
|
||||
userID := p.Info.UserID
|
||||
cacheCtx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
|
||||
defer cancel()
|
||||
cool.CacheManager.Remove(cacheCtx, fmt.Sprintf("player:%d", p.Info.UserID))
|
||||
cool.CacheManager.Remove(cacheCtx, fmt.Sprintf("player:%d", userID))
|
||||
newtime := time.Now().Unix()
|
||||
if p.Logintime > 0 {
|
||||
onlineSeconds := newtime - int64(p.Logintime)
|
||||
@@ -51,7 +52,7 @@ func (p *Player) Save() {
|
||||
select {
|
||||
case <-p.FightC.GetOverChan(): //等待结束
|
||||
case <-time.After(time.Second * 5): //等待5秒
|
||||
cool.Logger.Error(context.TODO(), "战斗崩溃", p.Info.UserID)
|
||||
cool.Logger.Error(context.TODO(), "战斗崩溃", userID)
|
||||
|
||||
}
|
||||
|
||||
@@ -60,14 +61,20 @@ func (p *Player) Save() {
|
||||
if p.Service != nil && p.Service.Info != nil {
|
||||
p.Service.Info.SaveUntilSuccess(*p.Info)
|
||||
} else {
|
||||
cool.Logger.Error(context.TODO(), "player save skipped: service not ready", p.Info.UserID)
|
||||
cool.Logger.Error(context.TODO(), "player save skipped: service not ready", userID)
|
||||
}
|
||||
space.GetSpace(p.Info.MapID).LeaveMap(p)
|
||||
|
||||
p.MapNPC.Stop() //停止刷怪
|
||||
|
||||
Mainplayer.Delete(p.Info.UserID)
|
||||
share.ShareManager.DeleteUserOnline(p.Info.UserID) //设置用户登录服务器
|
||||
shouldClearOnline := true
|
||||
if currentClient, ok := Mainplayer.Load(userID); ok && currentClient != nil && currentClient.Player != p {
|
||||
shouldClearOnline = false
|
||||
}
|
||||
if shouldClearOnline {
|
||||
Mainplayer.Delete(userID)
|
||||
share.ShareManager.DeleteUserOnline(userID) //设置用户登录服务器
|
||||
}
|
||||
p.Logintime = 0
|
||||
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
E:/newcode/flash/out/resource/json/moves_flash.json
|
||||
E:/newcode/sun-miaco/frontend/public/resource/json/moves_flash.json
|
||||
Reference in New Issue
Block a user