This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
|
"os"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -98,10 +99,10 @@ func (s *Server) OnClose(c gnet.Conn, err error) (action gnet.Action) {
|
|||||||
}
|
}
|
||||||
func (s *Server) OnTick() (delay time.Duration, action gnet.Action) {
|
func (s *Server) OnTick() (delay time.Duration, action gnet.Action) {
|
||||||
g.Log().Async().Info(context.Background(), gtime.Now().ISO8601(), "服务器ID", cool.Config.ServerInfo.OnlineID, "链接数", atomic.LoadInt64(&cool.Connected))
|
g.Log().Async().Info(context.Background(), gtime.Now().ISO8601(), "服务器ID", cool.Config.ServerInfo.OnlineID, "链接数", atomic.LoadInt64(&cool.Connected))
|
||||||
// if s.quit && atomic.LoadInt64(&s.connected) == 0 {
|
if s.quit && atomic.LoadInt64(&cool.Connected) == 0 {
|
||||||
// //执行正常退出逻辑
|
//执行正常退出逻辑
|
||||||
// os.Exit(0)
|
os.Exit(0)
|
||||||
// }
|
}
|
||||||
return 30 * time.Second, gnet.None
|
return 30 * time.Second, gnet.None
|
||||||
}
|
}
|
||||||
func (s *Server) OnBoot(eng gnet.Engine) gnet.Action {
|
func (s *Server) OnBoot(eng gnet.Engine) gnet.Action {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ type Server struct {
|
|||||||
codec codec.SocketCodec
|
codec codec.SocketCodec
|
||||||
handler Handler
|
handler Handler
|
||||||
discorse bool
|
discorse bool
|
||||||
//quit bool
|
quit bool
|
||||||
// batchRead int
|
// batchRead int
|
||||||
serverid uint16
|
serverid uint16
|
||||||
port uint16
|
port uint16
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ func (s *Server) QuitSelf(a int) error {
|
|||||||
//TODO 这里待退出
|
//TODO 这里待退出
|
||||||
fmt.Println("检测到退出请求")
|
fmt.Println("检测到退出请求")
|
||||||
|
|
||||||
//s.quit = true
|
s.quit = true
|
||||||
if a != 0 {
|
if a != 0 {
|
||||||
player.Mainplayer.Range(func(key uint32, value *player.Player) bool {
|
player.Mainplayer.Range(func(key uint32, value *player.Player) bool {
|
||||||
if value != nil {
|
if value != nil {
|
||||||
|
|||||||
@@ -200,9 +200,9 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
|
|||||||
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
|
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
|
||||||
|
|
||||||
exp := uint32(xmlres.PetMAP[int(monster.ID)].YieldingExp) * monster.Level / 7
|
exp := uint32(xmlres.PetMAP[int(monster.ID)].YieldingExp) * monster.Level / 7
|
||||||
addlevel, pookevel := p.CanGetExp()
|
addlevel, poolevel := p.CanGetExp()
|
||||||
addexp := uint32(addlevel) * (exp)
|
addexp := uint32(addlevel) * (exp)
|
||||||
poolexp := uint32(pookevel) * (exp)
|
poolexp := uint32(poolevel) * (exp)
|
||||||
items := &info.S2C_GET_BOSS_MONSTER{
|
items := &info.S2C_GET_BOSS_MONSTER{
|
||||||
//EV: 45,
|
//EV: 45,
|
||||||
EXP: poolexp,
|
EXP: poolexp,
|
||||||
|
|||||||
Reference in New Issue
Block a user