shobhit-pathak / MatchZy

MatchZy is a plugin for CS2 (Counter Strike 2) for running and managing practice/pugs/scrims/matches with easy configuration and Get5 (G5API/G5V) support as well!
https://shobhit-pathak.github.io/MatchZy/
MIT License
268 stars 78 forks source link

Fix Side enum in the event docs #214

Open dasnixon opened 3 months ago

dasnixon commented 3 months ago

The side value in the JSON payload mismatches the docs. Update to have side be '1', '2', or '3'.

However, is '3' the right value for spec?

{
  winner: { side: '2', team: 'team1' },
  team1: {
    series_score: 1,
    score: 13,
    score_ct: 0,
    score_t: 0,
    players: [],
    id: '',
    name: 'Team Blue'
  },
  team2: {
    series_score: 0,
    score: 9,
    score_ct: 0,
    score_t: 0,
    players: [],
    id: '',
    name: 'Team Red'
  },
  map_number: 0,
  matchid: 18,
  event: 'map_result'
}
shobhit-pathak commented 3 months ago

Hey!

I think there is some confusion here.

For round end, we set the Winner like this:

int ctTeamNum = reverseTeamSides["CT"] == matchzyTeam1 ? 1 : 2;
int tTeamNum = reverseTeamSides["TERRORIST"] == matchzyTeam1 ? 1 : 2;
Winner winner = new(@event.Winner == 3 ? ctTeamNum.ToString() : tTeamNum.ToString(), t1score > t2score ? "team1" : "team2");

But for map/series end, we set the Winner like this:

var mapResultEvent = new MapResultEvent
{
    MatchId = liveMatchId,
    MapNumber = currentMapNumber,
    Winner = new Winner(t1score > t2score && reverseTeamSides["CT"] == matchzyTeam1 ? "3" : "2", team1SeriesScore > team2SeriesScore ? "team1" : "team2"),
    StatsTeam1 = new MatchZyStatsTeam(matchzyTeam1.id, matchzyTeam1.teamName, team1SeriesScore, t1score, 0, 0, new List<StatsPlayer>()),
    StatsTeam2 = new MatchZyStatsTeam(matchzyTeam2.id, matchzyTeam2.teamName, team2SeriesScore, t2score, 0, 0, new List<StatsPlayer>())
};

So for map/series end 3 is CT, 2 is T But for round-end, 1 is CT and 2 is T

dasnixon commented 3 months ago

That is not lining up with what I'm seeing with respect to the round_end events. For example here is what I saw with a friend. This is round 12 he was T side (team2) and I was CT (team1). Note, winner: { side: '2', team: 'team2' } and the score is 7-5 my buddy is winning on Team Red.

{
  reason: 9,
  winner: { side: '2', team: 'team2' },
  team1: {
    series_score: 0,
    score: 5,
    score_ct: 0,
    score_t: 0,
    players: [ [Object] ],
    id: '',
    name: 'Team Blue'
  },
  team2: {
    series_score: 0,
    score: 7,
    score_ct: 0,
    score_t: 0,
    players: [ [Object] ],
    id: '',
    name: 'Team Red'
  },
  round_time: 0,
  round_number: 12,
  map_number: 0,
  matchid: 18,
  event: 'round_end'
}

Then sides switch so my buddy (team2) is now on CT side. He wins round 13 (score goes 8-5) but winner: { side: '2', team: 'team2' }. Based on what you said side should be '1' which would mean CT. I think it's pointing to which team won (team1 vs team2) instead of (CT vs T)

{
  reason: 8,
  winner: { side: '2', team: 'team2' },
  team1: {
    series_score: 0,
    score: 5,
    score_ct: 0,
    score_t: 0,
    players: [ [Object] ],
    id: '',
    name: 'Team Blue'
  },
  team2: {
    series_score: 0,
    score: 8,
    score_ct: 0,
    score_t: 0,
    players: [ [Object] ],
    id: '',
    name: 'Team Red'
  },
  round_time: 0,
  round_number: 13,
  map_number: 0,
  matchid: 18,
  event: 'round_end'
}