Skip to content

Commit

Permalink
fix: more broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
redraskal committed Jul 21, 2024
1 parent 9fe6de5 commit 7322f40
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 27 deletions.
8 changes: 2 additions & 6 deletions 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 All @@ -141,11 +141,7 @@ func readPlayer(r *Reader) error {
r.Header.Players[i].ProfileID = p.ProfileID
r.Header.Players[i].Username = p.Username
r.Header.Players[i].Operator = p.Operator

if p.Operator == Recruit || p.Operator.Role() != Defense {
r.Header.Players[i].Spawn = p.Spawn
}

r.Header.Players[i].Spawn = p.Spawn
r.Header.Players[i].DissectID = p.DissectID
found = true
break
Expand Down
2 changes: 1 addition & 1 deletion dissect/site.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func readSpawn(r *Reader) error {
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
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

0 comments on commit 7322f40

Please sign in to comment.