ReadieFur / BSDataPuller

Gathers data about the current map you are playing to then be sent out over a websocket for other software to use, e.g. A web overlay like BSDP-Overlay. This mod works with multi PC setups!
https://github.com/ReadieFur/BeatSaber-Overlay
GNU General Public License v3.0
39 stars 10 forks source link

[2.1.0] LiveData.Combo is doubled #26

Open ChrisJAllan opened 1 year ago

ChrisJAllan commented 1 year ago

Game version 1.24.1

Example data (ingame combo is 50):

{
  "Score": 37083,
  "ScoreWithMultipliers": 37083,
  "MaxScore": 38755,
  "MaxScoreWithMultipliers": 38755,
  "Rank": "SS",
  "FullCombo": true,
  "NotesSpawned": 50,
  "Combo": 100,
  "Misses": 0,
  "Accuracy": 95.58081030845642,
  "BlockHitScore": {
    "PreSwing": 70,
    "PostSwing": 30,
    "CenterSwing": 15
  },
  "PlayerHealth": 99.99995422363281,
  "ColorType": 1,
  "TimeElapsed": 18,
  "EventTrigger": 4,
  "UnixTimestamp": 1665697934181
}

Note that Combo is 100 while NotesSpawned is 50

ReadieFur commented 1 year ago

Interesting, in your game was your combo 100 or 50?
If the NotesSpawned is wrong, it was a rushed feature, but the combo could also be off. Just aasking if you know which is the incorrect value so it know where to look when I next work on it.
Thanks

ChrisJAllan commented 1 year ago

Combo is doubled, NotesSpawned is correct. Noticed this because I use the Combo value for sound alerts and they were firing very early.

Edit: Screenshot mpv-shot0035

ChrisJAllan commented 1 year ago

Just tried a minimal environment and this problem didn't happen, so another mod is at fault. Time to find out which!

ChrisJAllan commented 1 year ago

I'm stupid and forgot that I already put in a workaround, the issue is still present with minimal mods.

live_ws.addEventListener("message", function(event) {
        let data = JSON.parse(event.data);
        let combo = data.Combo / 2;

        while (last_combo < combo) {
            ++last_combo;
            if (SOUNDS[last_combo] !== undefined) {
                q('#sound').src = SOUNDS[last_combo];
                q('#sound').play();
            }
        }
        last_combo = combo ?? 0;
    });
ChrisJAllan commented 1 year ago

Found it: https://github.com/ReadieFur/BSDataPuller/blob/f6b5dbfa434a7c2096d8e3d2400db83eaee91f2d/src/Core/MapEvents.cs#L421 https://github.com/ReadieFur/BSDataPuller/blob/fb2498d1641daffb1d9223a6e8a4c15b8684cdec/src/Harmony/BeatmapObjectExecutionRatingsRecorder.cs#L17

ReadieFur commented 1 year ago

Found it:

https://github.com/ReadieFur/BSDataPuller/blob/f6b5dbfa434a7c2096d8e3d2400db83eaee91f2d/src/Core/MapEvents.cs#L421

https://github.com/ReadieFur/BSDataPuller/blob/fb2498d1641daffb1d9223a6e8a4c15b8684cdec/src/Harmony/BeatmapObjectExecutionRatingsRecorder.cs#L17

Thank you for doing that for me, I’ll possibly update it later today, that makes sense that this issue exists now as the harmony patch prior to the recent release wasn’t working, and now that it is, it makes sense the score is off. I change it and run some tests later. Thanks.