49 lines
1.4 KiB
Go
49 lines
1.4 KiB
Go
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)
|
||
|
|
}
|