Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: site detection #98

Merged
merged 3 commits into from
Jul 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dissect/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func readPlayer(r *Reader) error {
DissectID: id,
}
if p.Operator != Recruit && p.Operator.Role() == Defense {
p.Spawn = "" // We cannot detect the spawn here on defense
p.Spawn = r.Header.Site // We cannot detect the spawn here on defense
}
log.Debug().Str("username", username).
Int("teamIndex", teamIndex).
Expand Down
4 changes: 2 additions & 2 deletions dissect/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ func readSpawn(r *Reader) error {
Int("flag", flag).
Str("site", location).
Msg("site")
if r.Header.Site == "" && flag == 1 || flag == 164 {
if r.Header.Site == "" && (flag == 1 || flag == 164) {
formatted := strings.Replace(location, "<br/>", ", ", 1)
log.Debug().Str("site", formatted).Msg("defense site")
for i, p := range r.Header.Players {
if r.Header.Teams[p.TeamIndex].Role == Defense {
if r.Header.Teams[p.TeamIndex].Role == Defense || (p.Operator != Recruit && p.Operator.Role() == Defense) {
r.Header.Players[i].Spawn = formatted
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"alliance": 4,
"roleImage": 39149215373,
"roleName": "ECHO",
"rolePortrait": 39149215397
"rolePortrait": 39149215397,
"spawn": "1º Salão de reuniões, 1º Cozinha"
},
{
"id": 12246689978983031096,
Expand All @@ -67,7 +68,8 @@
"alliance": 4,
"roleImage": 32822532305,
"roleName": "VALKYRIE",
"rolePortrait": 27880747293
"rolePortrait": 27880747293,
"spawn": "1º Salão de reuniões, 1º Cozinha"
},
{
"id": 15299134193977100767,
Expand All @@ -82,7 +84,8 @@
"alliance": 4,
"roleImage": 104189664208,
"roleName": "MELUSI",
"rolePortrait": 104189664234
"rolePortrait": 104189664234,
"spawn": "1º Salão de reuniões, 1º Cozinha"
},
{
"id": 214508485753035926,
Expand All @@ -97,7 +100,8 @@
"alliance": 4,
"roleImage": 104189664090,
"roleName": "ORYX",
"rolePortrait": 258649622576
"rolePortrait": 258649622576,
"spawn": "1º Salão de reuniões, 1º Cozinha"
},
{
"id": 423059609487334073,
Expand All @@ -112,7 +116,8 @@
"alliance": 4,
"roleImage": 104189664639,
"roleName": "ARUNI",
"rolePortrait": 104189664665
"rolePortrait": 104189664665,
"spawn": "1º Salão de reuniões, 1º Cozinha"
},
{
"id": 8068966686555883115,
Expand Down
3 changes: 2 additions & 1 deletion dissect/test/data/replays/valid/Y8S1/ranked_1.rec.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@
"alliance": 4,
"roleImage": 39149215589,
"roleName": "ELA",
"rolePortrait": 39149215613
"rolePortrait": 39149215613,
"spawn": "2F Master Bedroom, 2F Office"
},
{
"id": 2545135856130398684,
Expand Down
15 changes: 10 additions & 5 deletions dissect/test/data/replays/valid/Y8S1/ranked_2.rec.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"alliance": 4,
"roleImage": 1494825824,
"roleName": "CASTLE",
"rolePortrait": 27880706756
"rolePortrait": 27880706756,
"spawn": "1F Staff Room, 1F Open Area"
},
{
"id": 17668758393748689036,
Expand All @@ -67,7 +68,8 @@
"alliance": 4,
"roleImage": 183220539138,
"roleName": "MOZZIE",
"rolePortrait": 174977498152
"rolePortrait": 174977498152,
"spawn": "1F Staff Room, 1F Open Area"
},
{
"id": 1228046118657654424,
Expand All @@ -82,7 +84,8 @@
"alliance": 4,
"roleImage": 104189664208,
"roleName": "MELUSI",
"rolePortrait": 104189664234
"rolePortrait": 104189664234,
"spawn": "1F Staff Room, 1F Open Area"
},
{
"id": 11184268148855488270,
Expand All @@ -97,7 +100,8 @@
"alliance": 4,
"roleImage": 1494825836,
"roleName": "ROOK",
"rolePortrait": 27880706877
"rolePortrait": 27880706877,
"spawn": "1F Staff Room, 1F Open Area"
},
{
"id": 7237043221017403435,
Expand All @@ -112,7 +116,8 @@
"alliance": 4,
"roleImage": 104189664639,
"roleName": "ARUNI",
"rolePortrait": 104189664665
"rolePortrait": 104189664665,
"spawn": "1F Staff Room, 1F Open Area"
},
{
"id": 17135695547652681161,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"alliance": 4,
"roleImage": 39149215445,
"roleName": "MIRA",
"rolePortrait": 39149215469
"rolePortrait": 39149215469,
"spawn": "B Wine Cellar, B Snowmobile Garage"
},
{
"id": 6515507923820359514,
Expand All @@ -67,7 +68,8 @@
"alliance": 4,
"roleImage": 104189664208,
"roleName": "MELUSI",
"rolePortrait": 104189664234
"rolePortrait": 104189664234,
"spawn": "B Wine Cellar, B Snowmobile Garage"
},
{
"id": 10701406544402263943,
Expand All @@ -82,7 +84,8 @@
"alliance": 4,
"roleImage": 375628889901,
"roleName": "AZAMI",
"rolePortrait": 378305072064
"rolePortrait": 378305072064,
"spawn": "B Wine Cellar, B Snowmobile Garage"
},
{
"id": 4534930452375727316,
Expand All @@ -97,7 +100,8 @@
"alliance": 4,
"roleImage": 104189664639,
"roleName": "ARUNI",
"rolePortrait": 104189664665
"rolePortrait": 104189664665,
"spawn": "B Wine Cellar, B Snowmobile Garage"
},
{
"id": 340082302850986973,
Expand All @@ -112,7 +116,8 @@
"alliance": 4,
"roleImage": 39149215589,
"roleName": "ELA",
"rolePortrait": 39149215613
"rolePortrait": 39149215613,
"spawn": "B Wine Cellar, B Snowmobile Garage"
},
{
"id": 5031908513475985408,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"alliance": 4,
"roleImage": 39149215445,
"roleName": "MIRA",
"rolePortrait": 39149215469
"rolePortrait": 39149215469,
"spawn": "2F Gym, 2F Bedroom"
},
{
"id": 14046042538542621139,
Expand All @@ -67,7 +68,8 @@
"alliance": 4,
"roleImage": 375628889901,
"roleName": "AZAMI",
"rolePortrait": 378305072064
"rolePortrait": 378305072064,
"spawn": "2F Gym, 2F Bedroom"
},
{
"id": 2361232417239798636,
Expand All @@ -82,7 +84,8 @@
"alliance": 4,
"roleImage": 161289666176,
"roleName": "KAID",
"rolePortrait": 161289666206
"rolePortrait": 161289666206,
"spawn": "2F Gym, 2F Bedroom"
},
{
"id": 16099508879547952222,
Expand All @@ -97,7 +100,8 @@
"alliance": 4,
"roleImage": 1494825824,
"roleName": "CASTLE",
"rolePortrait": 27880706756
"rolePortrait": 27880706756,
"spawn": "2F Gym, 2F Bedroom"
},
{
"id": 3628344668562828488,
Expand All @@ -112,7 +116,8 @@
"alliance": 4,
"roleImage": 104189663738,
"roleName": "WAMAI",
"rolePortrait": 104189663764
"rolePortrait": 104189663764,
"spawn": "2F Gym, 2F Bedroom"
},
{
"id": 5031908513475985408,
Expand Down
Loading