Skip to content

Commit

Permalink
Merge pull request #104 from redraskal/fix/defense-site-again
Browse files Browse the repository at this point in the history
fix: defense site detection after atk/def swap
  • Loading branch information
redraskal authored Aug 18, 2024
2 parents b54d339 + ed4c34d commit 9c0844d
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 1,474 deletions.
12 changes: 7 additions & 5 deletions dissect/site.go
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
package dissect

import (
"bytes"
"strings"

"github.com/rs/zerolog/log"
)

var currentSitePattern = []byte{0xFC, 0xC6, 0xA8, 0x60, 0x01}

func readSpawn(r *Reader) error {
location, err := r.String()
if err != nil {
return err
}
if err = r.Skip(37); err != nil {
if err = r.Skip(150); err != nil {
return err
}
flag, err := r.Int()
pattern, err := r.Bytes(5)
if err != nil {
return err
}
if !strings.Contains(location, "<br/>") {
return nil
}
log.Debug().
Int("flag", flag).
Str("site", location).
Msg("site")
if r.Header.Site == "" && (flag == 1 || flag == 164) {
Send()
if r.Header.Site == "" || bytes.Equal(pattern, currentSitePattern) {
formatted := strings.Replace(location, "<br/>", ", ", 1)
log.Debug().Str("site", formatted).Msg("defense site")
for i, p := range r.Header.Players {
Expand Down
Binary file not shown.
Loading

0 comments on commit 9c0844d

Please sign in to comment.