fix(go): repair migration wire contracts and runtime lifecycle; document incomplete port
This commit is contained in:
1 parent
e43a310617
commit
32e47014b5
35 files changed
+16826
-438
No files matched your search
@@ -1,33 +1,45 @@
|
||||
package gameserver
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"math"
|
||||
"time"
|
||||
|
||||
"ananta-ps/pkg/protocol"
|
||||
)
|
||||
|
||||
func (s *Server) SetWorldWeather(weatherId uint32) {
|
||||
func (s *Server) SetWorldWeather(weatherId uint32) error {
|
||||
log.Printf("[WEATHER] Setting world weather to %d", weatherId)
|
||||
w := protocol.NewUxWriter()
|
||||
w.U32(weatherId)
|
||||
w.U32(weatherId).U32(weatherId).U32(0)
|
||||
payload := w.Bytes()
|
||||
|
||||
methodID := protocol.MethodGetMethodIDDefault("SyncTimeWeather", 68582910)
|
||||
methodID := protocol.MethodGetMethodIDDefault("SyncPlayerWeather", 68712141)
|
||||
for _, sess := range s.GetActiveSessions() {
|
||||
_ = sess.NotifyData(methodID, payload)
|
||||
if err := sess.NotifyData(methodID, payload); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) SetWorldTimeOfDay(hour float32) {
|
||||
func (s *Server) SetWorldTimeOfDay(hour float32) error {
|
||||
if math.IsNaN(float64(hour)) || math.IsInf(float64(hour), 0) || hour < 0 || hour >= 24 {
|
||||
return fmt.Errorf("hour must be in [0,24)")
|
||||
}
|
||||
log.Printf("[WEATHER] Setting world time of day to %.1f:00", hour)
|
||||
w := protocol.NewUxWriter()
|
||||
w.F32(hour)
|
||||
w.U32(uint32(time.Now().Unix())).U32(uint32(hour * 3600)).Bool(true).Bool(false).U32(0).I32(0).I32(0)
|
||||
payload := w.Bytes()
|
||||
|
||||
methodID := protocol.MethodGetMethodIDDefault("SyncTimeOfDay", 68582911)
|
||||
methodID := protocol.MethodGetMethodIDDefault("SyncPlayerCurrentTime", 68337673)
|
||||
for _, sess := range s.GetActiveSessions() {
|
||||
_ = sess.NotifyData(methodID, payload)
|
||||
if err := sess.NotifyData(methodID, payload); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *Server) handleGmUnlockAllFogMap(sess *Session, pkt *protocol.RpcPacket) error {
|
||||
|
||||
Reference in new issue
Block a user