package space

import (
	"blazing/logic/service"
	"blazing/modules/blazing/model"
)

type InInfo struct {
	Head service.TomeeHeader `cmd:"2101" struc:"[0]pad"` //走路包
	// Flag: 0为走，1为飞行模式，@UInt long
	Flag uint32

	// Point: 直接给坐标x，y
	Point model.Pos `fieldDesc:"直接给坐标x，y"`

	// Reverse2: 暂定 占位字符2
	Reverse2 string `struc:"[2]byte"`
}

func (t *InInfo) Broadcast(mapid uint32, o OutInfo) {

	//tt := planetmap
	//g.Dump(GetSpace(mapid).Len())

	GetSpace(mapid).Range(func(playerID uint32, player service.PlayerI) bool {
		t.Head.Result = 0
		tt := t.Head.Pack(&o)
		player.SendPack(tt)
		//player.Cheak(err)
		return true
	})
}

// PeopleWalkOutboundInfo PeopleWalkOutboundInfo类，实现OutboundMessage接口
type OutInfo struct {
	// Flag: 0为走，1为飞行模式
	Flag uint32 `fieldDesc:"0为走，1为飞行模式" codec:"uint"`

	// UserID: 走动的人的米米号
	UserID uint32 `fieldDesc:"走动的人的米米号" codec:"uint"`

	// Point: 直接给坐标x，y
	Point model.Pos `fieldDesc:"直接给坐标x，y"`

	// Reserve2: 这个字段同C2S_People_Walk中的reserve2
	Reserve2 string `struc:"[2]byte"`
}
