Add some more game message structs

This commit is contained in:
ChillerDragon 2024-06-24 14:56:04 +08:00
parent 098341aad5
commit fc4a3becde
18 changed files with 872 additions and 58 deletions

View file

@ -1,43 +0,0 @@
package messages7
import (
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type ReadyToEnter struct {
ChunkHeader *chunk7.ChunkHeader
}
func (msg *ReadyToEnter) MsgId() int {
return network7.MsgGameReadyToEnter
}
func (msg *ReadyToEnter) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *ReadyToEnter) System() bool {
return false
}
func (msg *ReadyToEnter) Vital() bool {
return true
}
func (msg *ReadyToEnter) Pack() []byte {
return []byte{}
}
func (msg *ReadyToEnter) Unpack(u *packer.Unpacker) error {
return nil
}
func (msg *ReadyToEnter) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *ReadyToEnter) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

51
messages7/sv_emoticon.go Normal file
View file

@ -0,0 +1,51 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvEmoticon struct {
ChunkHeader *chunk7.ChunkHeader
Emoticon network7.Emote
}
func (msg *SvEmoticon) MsgId() int {
return network7.MsgGameSvEmoticon
}
func (msg *SvEmoticon) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvEmoticon) System() bool {
return false
}
func (msg *SvEmoticon) Vital() bool {
return true
}
func (msg *SvEmoticon) Pack() []byte {
return slices.Concat(
packer.PackInt(int(msg.Emoticon)),
)
}
func (msg *SvEmoticon) Unpack(u *packer.Unpacker) error {
msg.Emoticon = network7.Emote(u.GetInt())
return nil
}
func (msg *SvEmoticon) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvEmoticon) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,44 @@
package messages7
import (
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
// this message is unused in the official 0.7.5 implementation
type SvExtraProjectile struct {
ChunkHeader *chunk7.ChunkHeader
}
func (msg *SvExtraProjectile) MsgId() int {
return network7.MsgGameSvExtraProjectile
}
func (msg *SvExtraProjectile) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvExtraProjectile) System() bool {
return false
}
func (msg *SvExtraProjectile) Vital() bool {
return true
}
func (msg *SvExtraProjectile) Pack() []byte {
return []byte{}
}
func (msg *SvExtraProjectile) Unpack(u *packer.Unpacker) error {
return nil
}
func (msg *SvExtraProjectile) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvExtraProjectile) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

81
messages7/sv_kill_msg.go Normal file
View file

@ -0,0 +1,81 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvKillMsg struct {
ChunkHeader *chunk7.ChunkHeader
// Client ID of the killer.
// Can be the same as the Victim.
// For example on a selfkill with grenade but also when a tee dies in a spike (death tile) or falls out of the world.
KillerId int
// Client ID of the killed.
VictimId int
// Weapon the tee was killed with. Can be one of those:
//
// -3 network7.WeaponGame (team switching etc)
// -2 network7.WeaponSelf (console kill command)
// -1 network7.WeaponWorld (death tiles etc)
// 0 network7.WeaponHammer
// 1 network7.WeaponGun
// 2 network7.WeaponShotgun
// 3 network7.WeaponGrenade
// 4 network7.WeaponLase
// 5 network7.WeaponNinja
Weapon network7.Weapon
// For CTF, if the guy is carrying a flag for example.
// Only when the sv_gametype is ctf this mode is non zero.
// It is set in ctf.cpp when a flag is involved on death.
ModeSpecial int
}
func (msg *SvKillMsg) MsgId() int {
return network7.MsgGameSvKillMsg
}
func (msg *SvKillMsg) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvKillMsg) System() bool {
return false
}
func (msg *SvKillMsg) Vital() bool {
return true
}
func (msg *SvKillMsg) Pack() []byte {
return slices.Concat(
packer.PackInt(msg.KillerId),
packer.PackInt(msg.VictimId),
packer.PackInt(int(msg.Weapon)),
packer.PackInt(msg.ModeSpecial),
)
}
func (msg *SvKillMsg) Unpack(u *packer.Unpacker) error {
msg.KillerId = u.GetInt()
msg.VictimId = u.GetInt()
msg.Weapon = network7.Weapon(u.GetInt())
msg.ModeSpecial = u.GetInt()
return nil
}
func (msg *SvKillMsg) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvKillMsg) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,43 @@
package messages7
import (
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvReadyToEnter struct {
ChunkHeader *chunk7.ChunkHeader
}
func (msg *SvReadyToEnter) MsgId() int {
return network7.MsgGameSvReadyToEnter
}
func (msg *SvReadyToEnter) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvReadyToEnter) System() bool {
return false
}
func (msg *SvReadyToEnter) Vital() bool {
return true
}
func (msg *SvReadyToEnter) Pack() []byte {
return []byte{}
}
func (msg *SvReadyToEnter) Unpack(u *packer.Unpacker) error {
return nil
}
func (msg *SvReadyToEnter) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvReadyToEnter) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,66 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvServerSettings struct {
ChunkHeader *chunk7.ChunkHeader
KickVote bool
KickMin int
SpecVote bool
TeamLock bool
TeamBalance bool
PlayerSlots int
}
func (msg *SvServerSettings) MsgId() int {
return network7.MsgGameSvServerSettings
}
func (msg *SvServerSettings) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvServerSettings) System() bool {
return false
}
func (msg *SvServerSettings) Vital() bool {
return true
}
func (msg *SvServerSettings) Pack() []byte {
return slices.Concat(
packer.PackBool(msg.KickVote),
packer.PackInt(msg.KickMin),
packer.PackBool(msg.SpecVote),
packer.PackBool(msg.TeamLock),
packer.PackBool(msg.TeamBalance),
packer.PackInt(msg.PlayerSlots),
)
}
func (msg *SvServerSettings) Unpack(u *packer.Unpacker) error {
msg.KickVote = u.GetInt() != 0
msg.KickMin = u.GetInt()
msg.SpecVote = u.GetInt() != 0
msg.TeamLock = u.GetInt() != 0
msg.TeamBalance = u.GetInt() != 0
msg.PlayerSlots = u.GetInt()
return nil
}
func (msg *SvServerSettings) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvServerSettings) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

144
messages7/sv_tune_params.go Normal file
View file

@ -0,0 +1,144 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvTuneParams struct {
ChunkHeader *chunk7.ChunkHeader
GroundControlSpeed float32
GroundControlAccel float32
GroundFriction float32
GroundJumpImpulse float32
AirJumpImpulse float32
AirControlSpeed float32
AirControlAccel float32
AirFriction float32
HookLength float32
HookFireSpeed float32
HookDragAccel float32
HookDragSpeed float32
Gravity float32
VelrampStart float32
VelrampRange float32
VelrampCurvature float32
GunCurvature float32
GunSpeed float32
GunLifetime float32
ShotgunCurvature float32
ShotgunSpeed float32
ShotgunSpeeddiff float32
ShotgunLifetime float32
GrenadeCurvature float32
GrenadeSpeed float32
GrenadeLifetime float32
LaserReach float32
LaserBounceDelay float32
LaserBounceNum float32
LaserBounceCost float32
PlayerCollision float32
PlayerHooking float32
}
func (msg *SvTuneParams) MsgId() int {
return network7.MsgGameSvTuneParams
}
func (msg *SvTuneParams) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvTuneParams) System() bool {
return false
}
func (msg *SvTuneParams) Vital() bool {
return true
}
func (msg *SvTuneParams) Pack() []byte {
return slices.Concat(
packer.PackInt(int(msg.GroundControlSpeed*100)),
packer.PackInt(int(msg.GroundControlAccel*100)),
packer.PackInt(int(msg.GroundFriction*100)),
packer.PackInt(int(msg.GroundJumpImpulse*100)),
packer.PackInt(int(msg.AirJumpImpulse*100)),
packer.PackInt(int(msg.AirControlSpeed*100)),
packer.PackInt(int(msg.AirControlAccel*100)),
packer.PackInt(int(msg.AirFriction*100)),
packer.PackInt(int(msg.HookLength*100)),
packer.PackInt(int(msg.HookFireSpeed*100)),
packer.PackInt(int(msg.HookDragAccel*100)),
packer.PackInt(int(msg.HookDragSpeed*100)),
packer.PackInt(int(msg.Gravity*100)),
packer.PackInt(int(msg.VelrampStart*100)),
packer.PackInt(int(msg.VelrampRange*100)),
packer.PackInt(int(msg.VelrampCurvature*100)),
packer.PackInt(int(msg.GunCurvature*100)),
packer.PackInt(int(msg.GunSpeed*100)),
packer.PackInt(int(msg.GunLifetime*100)),
packer.PackInt(int(msg.ShotgunCurvature*100)),
packer.PackInt(int(msg.ShotgunSpeed*100)),
packer.PackInt(int(msg.ShotgunSpeeddiff*100)),
packer.PackInt(int(msg.ShotgunLifetime*100)),
packer.PackInt(int(msg.GrenadeCurvature*100)),
packer.PackInt(int(msg.GrenadeSpeed*100)),
packer.PackInt(int(msg.GrenadeLifetime*100)),
packer.PackInt(int(msg.LaserReach*100)),
packer.PackInt(int(msg.LaserBounceDelay*100)),
packer.PackInt(int(msg.LaserBounceNum*100)),
packer.PackInt(int(msg.LaserBounceCost*100)),
packer.PackInt(int(msg.PlayerCollision*100)),
packer.PackInt(int(msg.PlayerHooking*100)),
)
}
func (msg *SvTuneParams) Unpack(u *packer.Unpacker) error {
msg.GroundControlSpeed = float32(u.GetInt()) / 100
msg.GroundControlAccel = float32(u.GetInt()) / 100
msg.GroundFriction = float32(u.GetInt()) / 100
msg.GroundJumpImpulse = float32(u.GetInt()) / 100
msg.AirJumpImpulse = float32(u.GetInt()) / 100
msg.AirControlSpeed = float32(u.GetInt()) / 100
msg.AirControlAccel = float32(u.GetInt()) / 100
msg.AirFriction = float32(u.GetInt()) / 100
msg.HookLength = float32(u.GetInt()) / 100
msg.HookFireSpeed = float32(u.GetInt()) / 100
msg.HookDragAccel = float32(u.GetInt()) / 100
msg.HookDragSpeed = float32(u.GetInt()) / 100
msg.Gravity = float32(u.GetInt()) / 100
msg.VelrampStart = float32(u.GetInt()) / 100
msg.VelrampRange = float32(u.GetInt()) / 100
msg.VelrampCurvature = float32(u.GetInt()) / 100
msg.GunCurvature = float32(u.GetInt()) / 100
msg.GunSpeed = float32(u.GetInt()) / 100
msg.GunLifetime = float32(u.GetInt()) / 100
msg.ShotgunCurvature = float32(u.GetInt()) / 100
msg.ShotgunSpeed = float32(u.GetInt()) / 100
msg.ShotgunSpeeddiff = float32(u.GetInt()) / 100
msg.ShotgunLifetime = float32(u.GetInt()) / 100
msg.GrenadeCurvature = float32(u.GetInt()) / 100
msg.GrenadeSpeed = float32(u.GetInt()) / 100
msg.GrenadeLifetime = float32(u.GetInt()) / 100
msg.LaserReach = float32(u.GetInt()) / 100
msg.LaserBounceDelay = float32(u.GetInt()) / 100
msg.LaserBounceNum = float32(u.GetInt()) / 100
msg.LaserBounceCost = float32(u.GetInt()) / 100
msg.PlayerCollision = float32(u.GetInt()) / 100
msg.PlayerHooking = float32(u.GetInt()) / 100
return nil
}
func (msg *SvTuneParams) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvTuneParams) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,44 @@
package messages7
import (
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
// This message is used by the server to empty all vote entries in the client menu.
type SvVoteClearOptions struct {
ChunkHeader *chunk7.ChunkHeader
}
func (msg *SvVoteClearOptions) MsgId() int {
return network7.MsgGameSvVoteClearOptions
}
func (msg *SvVoteClearOptions) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvVoteClearOptions) System() bool {
return false
}
func (msg *SvVoteClearOptions) Vital() bool {
return true
}
func (msg *SvVoteClearOptions) Pack() []byte {
return []byte{}
}
func (msg *SvVoteClearOptions) Unpack(u *packer.Unpacker) error {
return nil
}
func (msg *SvVoteClearOptions) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvVoteClearOptions) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,50 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvVoteOptionAdd struct {
ChunkHeader *chunk7.ChunkHeader
Description string
}
func (msg *SvVoteOptionAdd) MsgId() int {
return network7.MsgGameSvVoteOptionAdd
}
func (msg *SvVoteOptionAdd) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvVoteOptionAdd) System() bool {
return false
}
func (msg *SvVoteOptionAdd) Vital() bool {
return true
}
func (msg *SvVoteOptionAdd) Pack() []byte {
return slices.Concat(
packer.PackStr(msg.Description),
)
}
func (msg *SvVoteOptionAdd) Unpack(u *packer.Unpacker) error {
msg.Description = u.GetString()
return nil
}
func (msg *SvVoteOptionAdd) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvVoteOptionAdd) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,67 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
// You have to manually set NumOptions to be the amount of Descriptions
// For example:
//
// options := []string{"foo", "bar", "baz"}
// voteAdd := SvVoteOptionListAdd{NumOptions: len(options), Descriptions: options}
type SvVoteOptionListAdd struct {
ChunkHeader *chunk7.ChunkHeader
NumOptions int
Descriptions []string
}
func (msg *SvVoteOptionListAdd) MsgId() int {
return network7.MsgGameSvVoteOptionListAdd
}
func (msg *SvVoteOptionListAdd) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvVoteOptionListAdd) System() bool {
return false
}
func (msg *SvVoteOptionListAdd) Vital() bool {
return true
}
func (msg *SvVoteOptionListAdd) Pack() []byte {
options := []byte{}
for _, option := range msg.Descriptions {
options = append(options, packer.PackStr(option)...)
}
return slices.Concat(
packer.PackInt(msg.NumOptions),
options,
)
}
func (msg *SvVoteOptionListAdd) Unpack(u *packer.Unpacker) error {
msg.NumOptions = u.GetInt()
msg.Descriptions = make([]string, msg.NumOptions)
for i := 0; i < msg.NumOptions; i++ {
msg.Descriptions[i] = u.GetString()
}
return nil
}
func (msg *SvVoteOptionListAdd) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvVoteOptionListAdd) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,50 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvVoteOptionRemove struct {
ChunkHeader *chunk7.ChunkHeader
Description string
}
func (msg *SvVoteOptionRemove) MsgId() int {
return network7.MsgGameSvVoteOptionRemove
}
func (msg *SvVoteOptionRemove) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvVoteOptionRemove) System() bool {
return false
}
func (msg *SvVoteOptionRemove) Vital() bool {
return true
}
func (msg *SvVoteOptionRemove) Pack() []byte {
return slices.Concat(
packer.PackStr(msg.Description),
)
}
func (msg *SvVoteOptionRemove) Unpack(u *packer.Unpacker) error {
msg.Description = u.GetString()
return nil
}
func (msg *SvVoteOptionRemove) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvVoteOptionRemove) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

62
messages7/sv_vote_set.go Normal file
View file

@ -0,0 +1,62 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvVoteSet struct {
ChunkHeader *chunk7.ChunkHeader
ClientId int
Type network7.Vote
Timeout int
Description string
Reason string
}
func (msg *SvVoteSet) MsgId() int {
return network7.MsgGameSvVoteSet
}
func (msg *SvVoteSet) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvVoteSet) System() bool {
return false
}
func (msg *SvVoteSet) Vital() bool {
return true
}
func (msg *SvVoteSet) Pack() []byte {
return slices.Concat(
packer.PackInt(msg.ClientId),
packer.PackInt(int(msg.Type)),
packer.PackInt(msg.Timeout),
packer.PackStr(msg.Description),
packer.PackStr(msg.Reason),
)
}
func (msg *SvVoteSet) Unpack(u *packer.Unpacker) error {
msg.ClientId = u.GetInt()
msg.Type = network7.Vote(u.GetInt())
msg.Timeout = u.GetInt()
msg.Description = u.GetString()
msg.Reason = u.GetString()
return nil
}
func (msg *SvVoteSet) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvVoteSet) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,60 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvVoteStatus struct {
ChunkHeader *chunk7.ChunkHeader
Yes int
No int
Pass int
Total int
}
func (msg *SvVoteStatus) MsgId() int {
return network7.MsgGameSvVoteStatus
}
func (msg *SvVoteStatus) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvVoteStatus) System() bool {
return false
}
func (msg *SvVoteStatus) Vital() bool {
return true
}
func (msg *SvVoteStatus) Pack() []byte {
return slices.Concat(
packer.PackInt(msg.Yes),
packer.PackInt(msg.No),
packer.PackInt(msg.Pass),
packer.PackInt(msg.Total),
)
}
func (msg *SvVoteStatus) Unpack(u *packer.Unpacker) error {
msg.Yes = u.GetInt()
msg.No = u.GetInt()
msg.Pass = u.GetInt()
msg.Total = u.GetInt()
return nil
}
func (msg *SvVoteStatus) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvVoteStatus) StatusHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -0,0 +1,51 @@
package messages7
import (
"slices"
"github.com/teeworlds-go/go-teeworlds-protocol/chunk7"
"github.com/teeworlds-go/go-teeworlds-protocol/network7"
"github.com/teeworlds-go/go-teeworlds-protocol/packer"
)
type SvWeaponPickup struct {
ChunkHeader *chunk7.ChunkHeader
Weapon network7.Weapon
}
func (msg *SvWeaponPickup) MsgId() int {
return network7.MsgGameSvWeaponPickup
}
func (msg *SvWeaponPickup) MsgType() network7.MsgType {
return network7.TypeNet
}
func (msg *SvWeaponPickup) System() bool {
return false
}
func (msg *SvWeaponPickup) Vital() bool {
return true
}
func (msg *SvWeaponPickup) Pack() []byte {
return slices.Concat(
packer.PackInt(int(msg.Weapon)),
)
}
func (msg *SvWeaponPickup) Unpack(u *packer.Unpacker) error {
msg.Weapon = network7.Weapon(u.GetInt())
return nil
}
func (msg *SvWeaponPickup) Header() *chunk7.ChunkHeader {
return msg.ChunkHeader
}
func (msg *SvWeaponPickup) SetHeader(header *chunk7.ChunkHeader) {
msg.ChunkHeader = header
}

View file

@ -13,6 +13,40 @@ const (
TeamRed GameTeam = 0 TeamRed GameTeam = 0
TeamBlue GameTeam = 1 TeamBlue GameTeam = 1
VoteUnknown Vote = 0
VoteStartOp Vote = 1
VoteStartKick Vote = 2
VoteStartSpec Vote = 3
VoteEndAbort Vote = 4
VoteEndPass Vote = 5
VoteEndFail Vote = 6
// oop!
EmoteOop Emote = 0
// !
EmoteExclamation Emote = 1
EmoteHearts Emote = 2
// tear
EmoteDrop Emote = 3
// ...
EmoteDotdot Emote = 4
EmoteMusic Emote = 5
EmoteSorry Emote = 6
EmoteGhost Emote = 7
// annoyed
EmoteSushi Emote = 8
// angry
EmoteSplattee Emote = 9
EmoteDeviltee Emote = 10
// swearing
EmoteZomg Emote = 11
EmoteZzz Emote = 12
EmoteWtf Emote = 13
// happy
EmoteEyes Emote = 14
// ??
EmoteQuestion Emote = 15
MsgCtrlKeepAlive = 0x00 MsgCtrlKeepAlive = 0x00
MsgCtrlConnect = 0x01 MsgCtrlConnect = 0x01
MsgCtrlAccept = 0x02 MsgCtrlAccept = 0x02
@ -59,14 +93,14 @@ const (
MsgGameSvTeam = 4 MsgGameSvTeam = 4
MsgGameSvKillMsg = 5 MsgGameSvKillMsg = 5
MsgGameSvTuneParams = 6 MsgGameSvTuneParams = 6
MsgGameSvExtraProjectile = 7 MsgGameSvExtraProjectile = 7 // unused
MsgGameReadyToEnter = 8 MsgGameSvReadyToEnter = 8
MsgGameWeaponPickup = 9 MsgGameSvWeaponPickup = 9
MsgGameEmoticon = 10 MsgGameSvEmoticon = 10
MsgGameSvVoteClearoptions = 11 MsgGameSvVoteClearOptions = 11
MsgGameSvVoteOptionlistadd = 12 MsgGameSvVoteOptionListAdd = 12
MsgGameSvVotePptionadd = 13 MsgGameSvVoteOptionAdd = 13
MsgGameSvVoteOptionremove = 14 MsgGameSvVoteOptionRemove = 14
MsgGameSvVoteSet = 15 MsgGameSvVoteSet = 15
MsgGameSvVoteStatus = 16 MsgGameSvVoteStatus = 16
MsgGameSvServerSettings = 17 MsgGameSvServerSettings = 17
@ -97,6 +131,13 @@ const (
TypeNet MsgType = 2 TypeNet MsgType = 2
TypeConnless MsgType = 3 TypeConnless MsgType = 3
// can be sent by the server in kill messages
WeaponGame Weapon = -3
WeaponSelf Weapon = -2
WeaponWorld Weapon = -1
// can be sent by the client when requesting weapon switch
// or by the server in kill messages
WeaponHammer Weapon = 0 WeaponHammer Weapon = 0
WeaponGun Weapon = 1 WeaponGun Weapon = 1
WeaponShotgun Weapon = 2 WeaponShotgun Weapon = 2
@ -106,7 +147,10 @@ const (
NumWeapons Weapon = 6 NumWeapons Weapon = 6
) )
type Vote int
type Emote int
type ChatMode int type ChatMode int
type GameTeam int type GameTeam int
type MsgType int
type Weapon int type Weapon int
type MsgType int

View file

@ -171,8 +171,8 @@ func (packet *Packet) unpackGame(msgId int, chunk chunk7.Chunk, u *packer.Unpack
var msg messages7.NetMessage var msg messages7.NetMessage
switch msgId { switch msgId {
case network7.MsgGameReadyToEnter: case network7.MsgGameSvReadyToEnter:
msg = &messages7.ReadyToEnter{} msg = &messages7.SvReadyToEnter{}
case network7.MsgGameSvMotd: case network7.MsgGameSvMotd:
msg = &messages7.SvMotd{} msg = &messages7.SvMotd{}
case network7.MsgGameSvChat: case network7.MsgGameSvChat:

View file

@ -64,9 +64,9 @@ type UserMsgCallbacks struct {
// GameSvKillMsg func(*messages7.SvKillMsg, DefaultAction) // GameSvKillMsg func(*messages7.SvKillMsg, DefaultAction)
// GameSvTuneParams func(*messages7.SvTuneParams, DefaultAction) // GameSvTuneParams func(*messages7.SvTuneParams, DefaultAction)
// GameSvExtraProjectile func(*messages7.SvExtraProjectile, DefaultAction) // GameSvExtraProjectile func(*messages7.SvExtraProjectile, DefaultAction)
GameReadyToEnter func(*messages7.ReadyToEnter, DefaultAction) GameReadyToEnter func(*messages7.SvReadyToEnter, DefaultAction)
// GameWeaponPickup func(*messages7.WeaponPickup, DefaultAction) // GameWeaponPickup func(*messages7.SvWeaponPickup, DefaultAction)
// GameEmoticon func(*messages7.Emoticon, DefaultAction) // GameEmoticon func(*messages7.SvEmoticon, DefaultAction)
// GameSvVoteClearoptions func(*messages7.SvVoteClearoptions, DefaultAction) // GameSvVoteClearoptions func(*messages7.SvVoteClearoptions, DefaultAction)
// GameSvVoteOptionlistadd func(*messages7.SvVoteOptionlistadd, DefaultAction) // GameSvVoteOptionlistadd func(*messages7.SvVoteOptionlistadd, DefaultAction)
// GameSvVotePptionadd func(*messages7.SvVotePptionadd, DefaultAction) // GameSvVotePptionadd func(*messages7.SvVotePptionadd, DefaultAction)

View file

@ -54,7 +54,7 @@ func (client *Client) processGame(netMsg messages7.NetMessage, response *protoco
} else { } else {
client.Callbacks.GameSvClientInfo(msg, defaultAction) client.Callbacks.GameSvClientInfo(msg, defaultAction)
} }
case *messages7.ReadyToEnter: case *messages7.SvReadyToEnter:
defaultAction := func() { defaultAction := func() {
fmt.Println("got ready to enter") fmt.Println("got ready to enter")
response.Messages = append(response.Messages, &messages7.EnterGame{}) response.Messages = append(response.Messages, &messages7.EnterGame{})