-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
098341a
commit fc4a3be
Showing
18 changed files
with
872 additions
and
58 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |
Oops, something went wrong.