summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHimbeerserverDE <himbeerserverde@gmail.com>2023-06-08 18:17:03 +0200
committerHimbeerserverDE <himbeerserverde@gmail.com>2023-06-08 18:17:50 +0200
commit969e5ea5c77e977e2a3c5b34fbd409a2bff3f44a (patch)
treeca9ffac7a960f0574607c3bde4f5657182b05e2a
parente2af7673321ecf00909a22bd3eb17eae438aef83 (diff)
5.6.x support: new HP packet format
-rw-r--r--serialize.go31
-rw-r--r--tocltcmds.go3
2 files changed, 31 insertions, 3 deletions
diff --git a/serialize.go b/serialize.go
index 820b166..b619923 100644
--- a/serialize.go
+++ b/serialize.go
@@ -2920,19 +2920,46 @@ func (obj *ToCltAOMsgs) deserialize(r io.Reader) {
func (obj *ToCltHP) serialize(w io.Writer) {
{
x := (*(*(struct {
- HP uint16
+ HP uint16
+ DamageEffect bool
}))(obj)).HP
write16(w, uint16(x))
}
+ {
+ x := (*(*(struct {
+ HP uint16
+ DamageEffect bool
+ }))(obj)).DamageEffect
+ if x {
+ write8(w, 1)
+ } else {
+ write8(w, 0)
+ }
+ }
}
func (obj *ToCltHP) deserialize(r io.Reader) {
{
p := &(*(*(struct {
- HP uint16
+ HP uint16
+ DamageEffect bool
}))(obj)).HP
*p = read16(r)
}
+ {
+ p := &(*(*(struct {
+ HP uint16
+ DamageEffect bool
+ }))(obj)).DamageEffect
+ switch n := read8(r); n {
+ case 0:
+ *p = false
+ case 1:
+ *p = true
+ default:
+ chk(fmt.Errorf("invalid bool: %d", n))
+ }
+ }
}
func (obj *ToCltMovePlayer) serialize(w io.Writer) {
diff --git a/tocltcmds.go b/tocltcmds.go
index a3ffec3..b662f6a 100644
--- a/tocltcmds.go
+++ b/tocltcmds.go
@@ -234,7 +234,8 @@ type ToCltAOMsgs struct {
// ToCltHP updates the player's HP on the client.
type ToCltHP struct {
- HP uint16
+ HP uint16
+ DamageEffect bool
}
// ToCltMovePlayer tells the client that the player has been moved server-side.