This repository has been archived on 2026-10-31. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Ananta-ps/internal/gameserver/weather.go
T

49 lines
1.4 KiB
Go
Raw Normal View History

package gameserver
import (
"log"
"ananta-ps/pkg/protocol"
)
func (s *Server) SetWorldWeather(weatherId uint32) {
log.Printf("[WEATHER] Setting world weather to %d", weatherId)
w := protocol.NewUxWriter()
w.U32(weatherId)
payload := w.Bytes()
methodID := protocol.MethodGetMethodIDDefault("SyncTimeWeather", 68582910)
for _, sess := range s.GetActiveSessions() {
_ = sess.NotifyData(methodID, payload)
}
}
func (s *Server) SetWorldTimeOfDay(hour float32) {
log.Printf("[WEATHER] Setting world time of day to %.1f:00", hour)
w := protocol.NewUxWriter()
w.F32(hour)
payload := w.Bytes()
methodID := protocol.MethodGetMethodIDDefault("SyncTimeOfDay", 68582911)
for _, sess := range s.GetActiveSessions() {
_ = sess.NotifyData(methodID, payload)
}
}
func (s *Server) handleGmUnlockAllFogMap(sess *Session, pkt *protocol.RpcPacket) error {
log.Printf("[FOG] GmUnlockAllFogMap requested")
if err := sess.ReturnEmptyOk(pkt.InvokeID, pkt.MethodID); err != nil {
return err
}
wFog := protocol.NewUxWriter()
wFog.U32(uint32(sess.activeScene)).Bool(true)
return sess.NotifyData(protocol.MethodSyncSceneFogMapAllUnlock, wFog.Bytes())
}
func (s *Server) handleGmSetAmbianceEnabled(sess *Session, pkt *protocol.RpcPacket) error {
r := protocol.NewUxReader(pkt.Body)
enabled, _ := r.Bool()
log.Printf("[AMBIENCE] SetAmbianceEnabled = %v", enabled)
return sess.ReturnEmptyOk(pkt.InvokeID, pkt.MethodID)
}