Skip to content

Commit

Permalink
Updated for 1.13.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ReadieFur committed Mar 11, 2021
1 parent adea5a7 commit bb3af57
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 46 deletions.
6 changes: 3 additions & 3 deletions beatmods.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
DataPuller

## Mod Version
2.0.2
2.0.3

## Game Version
1.13.2
1.13.4

## Dependencies
BSIPA@4.1.4,BeatSaverSharp@2.0.1,websocket-sharp@1.0.4,SongCore@3.0.3,SongDataCore@1.3.6,SiraUtil@2.4.0
BSIPA@4.1.4,BeatSaverSharp@2.0.1,websocket-sharp@1.0.4,SongCore@3.2.0,SongDataCore@1.3.7,SiraUtil@2.5.2

## Category
Tweaks/Tools
Expand Down
68 changes: 32 additions & 36 deletions src/Client/MapEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using HarmonyLib;
using TMPro;
using IPA.Utilities;
using DataPuller.Controllers;

namespace DataPuller.Client
{
Expand All @@ -21,7 +22,6 @@ class MapEvents : IInitializable, IDisposable
private static BeatSaver beatSaver = new BeatSaver(new HttpOptions("BSDataPuller", Assembly.GetExecutingAssembly().GetName().Version));
internal static MapData.JsonData previousStaticData = new MapData.JsonData();
private Timer timer = new Timer { Interval = 250 };
private Dictionary<int, NoteCutInfo> noteCutInfo = new Dictionary<int, NoteCutInfo>();
private int NoteCount = 0;

//Required objects - Made [InjectOptional] and checked at Initialize()
Expand Down Expand Up @@ -231,27 +231,33 @@ void getBeatsaverMap()

if (MapData.Hash != previousStaticData.Hash) { MapData.PreviousBSR = previousStaticData.BSRKey; }

MapData.Modifiers.Add("instaFail", gameplayCoreSceneSetupData.gameplayModifiers.instaFail);
MapData.Modifiers.Add("batteryEnergy", gameplayCoreSceneSetupData.gameplayModifiers.energyType == GameplayModifiers.EnergyType.Battery);
MapData.Modifiers.Add("disappearingArrows", gameplayCoreSceneSetupData.gameplayModifiers.disappearingArrows);
MapData.Modifiers.Add("ghostNotes", gameplayCoreSceneSetupData.gameplayModifiers.ghostNotes);
MapData.Modifiers.Add("fasterSong", gameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul == 1.2f ? true : false);
MapData.Modifiers.Add("noFail", gameplayCoreSceneSetupData.gameplayModifiers.noFailOn0Energy);
MapData.Modifiers.Add("noObstacles", gameplayCoreSceneSetupData.gameplayModifiers.enabledObstacleType == GameplayModifiers.EnabledObstacleType.NoObstacles);
MapData.Modifiers.Add("noFailOn0Energy", gameplayCoreSceneSetupData.gameplayModifiers.noFailOn0Energy);
MapData.Modifiers.Add("oneLife", gameplayCoreSceneSetupData.gameplayModifiers.instaFail);
MapData.Modifiers.Add("fourLives", gameplayCoreSceneSetupData.gameplayModifiers.energyType == GameplayModifiers.EnergyType.Battery);
MapData.Modifiers.Add("noBombs", gameplayCoreSceneSetupData.gameplayModifiers.noBombs);
MapData.Modifiers.Add("slowerSong", gameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul == 0.85f ? true : false);
MapData.Modifiers.Add("noWalls", gameplayCoreSceneSetupData.gameplayModifiers.enabledObstacleType == GameplayModifiers.EnabledObstacleType.NoObstacles);
MapData.Modifiers.Add("noArrows", gameplayCoreSceneSetupData.gameplayModifiers.noArrows);
MapData.Modifiers.Add("ghostNotes", gameplayCoreSceneSetupData.gameplayModifiers.ghostNotes);
MapData.Modifiers.Add("disappearingArrows", gameplayCoreSceneSetupData.gameplayModifiers.disappearingArrows);
MapData.Modifiers.Add("smallNotes", gameplayCoreSceneSetupData.gameplayModifiers.smallCubes);
MapData.Modifiers.Add("proMode", gameplayCoreSceneSetupData.gameplayModifiers.proMode);
MapData.Modifiers.Add("strictAngles", gameplayCoreSceneSetupData.gameplayModifiers.strictAngles);
MapData.Modifiers.Add("zenMode", gameplayCoreSceneSetupData.gameplayModifiers.zenMode);
MapData.Modifiers.Add("slowerSong", gameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul == 0.85f ? true : false);
MapData.Modifiers.Add("fasterSong", gameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul == 1.2f ? true : false);
MapData.Modifiers.Add("superFastSong", gameplayCoreSceneSetupData.gameplayModifiers.songSpeedMul == 1.5f ? true : false);
foreach (KeyValuePair<string, bool> keyValue in MapData.Modifiers)
{
if (MapData.Modifiers[keyValue.Key])
if (MapData.Modifiers[keyValue.Key] && Enum.IsDefined(typeof(Modifiers), keyValue.Key))
{
MapData.ModifiersMultiplier += (int)(Modifiers)Enum.Parse(typeof(Modifiers), keyValue.Key) / 100f;
}
}
MapData.PracticeMode = gameplayCoreSceneSetupData.practiceSettings != null ? true : false;
MapData.PracticeModeModifiers.Add("songSpeedMul", MapData.PracticeMode ? gameplayCoreSceneSetupData.practiceSettings.songSpeedMul : 1);
MapData.PracticeModeModifiers.Add("startInAdvanceAndClearNotes", MapData.PracticeMode ? gameplayCoreSceneSetupData.practiceSettings.startInAdvanceAndClearNotes ? 1 : 0 : 0);
MapData.PracticeModeModifiers.Add("startSongTime", MapData.PracticeMode ? gameplayCoreSceneSetupData.practiceSettings.startSongTime : 0);

LiveData.PlayerHealth = MapData.Modifiers["noFail"] ? 100 : 50; //Not static data but it relies on static data to be set the first time
MapData.InLevel = true;
timer.Start();

Expand Down Expand Up @@ -294,7 +300,13 @@ private void MultiplayerController_stateChangedEvent(MultiplayerController.State
private void EnergyDidChangeEvent(float health)
{
health *= 100;
if (health < LiveData.PlayerHealth) { LiveData.Combo = 0; } //I could impliment a check to see if NF is enabled and active but I will leave that out for now as I do not want to change the dat sent right now.
if (MapData.Modifiers["noFailOn0Energy"] && health <= 0)
{
MapData.LevelFailed = true;
MapData.ModifiersMultiplier += -50 / 100f;
MapData.Send();
}
if (health < LiveData.PlayerHealth) { LiveData.Combo = 0; }
LiveData.PlayerHealth = health;
LiveData.Send();
}
Expand Down Expand Up @@ -347,14 +359,13 @@ private void SetRankAndAccuracy()
LiveData.Send();
}

private void NoteWasCutEvent(NoteController arg1, NoteCutInfo _noteCutInfo)
private void NoteWasCutEvent(NoteController arg1, in NoteCutInfo _noteCutInfo)
{
if (_noteCutInfo.allIsOK)
{
noteCutInfo.Add(_noteCutInfo.swingRatingCounter.GetHashCode(), _noteCutInfo);
LiveData.Combo++;
NoteCount++;
_noteCutInfo.swingRatingCounter.didFinishEvent += SwingRatingCounter_didFinishEvent;
_noteCutInfo.swingRatingCounter.RegisterDidFinishReceiver(new SwingRatingCounterDidFinishController(_noteCutInfo));
}
else
{
Expand All @@ -366,19 +377,6 @@ private void NoteWasCutEvent(NoteController arg1, NoteCutInfo _noteCutInfo)
//LiveData.Send(); //Sent by SetRankAndAccuracy()
}

private void SwingRatingCounter_didFinishEvent(ISaberSwingRatingCounter saberSwingRatingCounter)
{
int hashCode = saberSwingRatingCounter.GetHashCode();
NoteCutInfo _noteCutInfo = noteCutInfo[hashCode];
noteCutInfo.Remove(hashCode);
_noteCutInfo.swingRatingCounter.didFinishEvent -= SwingRatingCounter_didFinishEvent;
ScoreModel.RawScoreWithoutMultiplier(_noteCutInfo, out var _beforeCutRawScore, out var _afterCutRawScore, out var _cutDistanceRawScore);

LiveData.BlockHitScore = new int[] { _beforeCutRawScore, _afterCutRawScore, _cutDistanceRawScore };

//LiveData.Send(); //Sent by SetRankAndAccuracy()
}

private static string GetBase64CoverImage(CustomPreviewBeatmapLevel level) //Thanks UnskilledFreak
{
if (level == null) { return null; }
Expand All @@ -404,16 +402,14 @@ private class SongDataCoreCurrent

enum Modifiers
{
instaFail = 0,
batteryEnergy = 0,
disappearingArrows = 7,
ghostNotes = 11,
fasterSong = 8,
noFail = -50,
noObstacles = -05,
//noFail = -50,
noBombs = -10,
noWalls = -5,
noArrows = -30,
ghostNotes = 11,
zenMode = -100,
slowerSong = -30,
noArrows = 0,
superFastSong = 10
}
}
}
21 changes: 21 additions & 0 deletions src/Controllers/SwingRatingCounterDidFinishController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using DataPuller.Client;

namespace DataPuller.Controllers
{
class SwingRatingCounterDidFinishController : ISaberSwingRatingCounterDidFinishReceiver
{
private NoteCutInfo noteCutInfo;

public SwingRatingCounterDidFinishController(NoteCutInfo _noteCutInfo)
{
noteCutInfo = _noteCutInfo;
}

public void HandleSaberSwingRatingCounterDidFinish(ISaberSwingRatingCounter saberSwingRatingCounter)
{
ScoreModel.RawScoreWithoutMultiplier(saberSwingRatingCounter, noteCutInfo.cutDistanceToCenter, out int beforeCutRawScore, out int afterCutRawScore, out int cutDistanceRawScore);
LiveData.BlockHitScore = new int[] { beforeCutRawScore, afterCutRawScore, cutDistanceRawScore };
noteCutInfo.swingRatingCounter.UnregisterDidFinishReceiver(this);
}
}
}
1 change: 1 addition & 0 deletions src/DataPuller.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@
<ItemGroup>
<Compile Include="Client\LiveData.cs" />
<Compile Include="Client\MapData.cs" />
<Compile Include="Controllers\SwingRatingCounterDidFinishController.cs" />
<Compile Include="Installers\ClientInstaller.cs" />
<Compile Include="Server\Server.cs" />
<Compile Include="Client\MapEvents.cs" />
Expand Down
4 changes: 2 additions & 2 deletions src/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2")]
[assembly: AssemblyFileVersion("2.0.2")]
[assembly: AssemblyVersion("2.0.3")]
[assembly: AssemblyFileVersion("2.0.3")]
10 changes: 5 additions & 5 deletions src/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
"id": "DataPuller",
"name": "DataPuller",
"author": "kOF.Readie",
"version": "2.0.2",
"version": "2.0.3",
"description": "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!",
"gameVersion": "1.13.2",
"gameVersion": "1.13.4",
"dependsOn": {
"BSIPA": "^4.1.4",
"BeatSaverSharp": "^2.0.1",
"websocket-sharp": "^1.0.4",
"SongCore": "^3.0.3",
"SongDataCore": "^1.3.6",
"SiraUtil": "^2.4.0"
"SongCore": "^3.2.0",
"SongDataCore": "^1.3.7",
"SiraUtil": "^2.5.2"
},
"links": {
"project-home": "https://u-readie.global-gaming.co/bsdp-overlay/",
Expand Down

0 comments on commit bb3af57

Please sign in to comment.