Skip to content

Commit

Permalink
Osu - Added more data
Browse files Browse the repository at this point in the history
  • Loading branch information
diogotr7 committed Oct 22, 2023
1 parent 8478071 commit 6b3d791
Show file tree
Hide file tree
Showing 6 changed files with 150 additions and 35 deletions.
44 changes: 44 additions & 0 deletions src/Artemis.Plugins.Games.Osu/DataModels/BeatmapDataModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
using Artemis.Core.Modules;
using OsuMemoryDataProvider.OsuMemoryModels.Direct;

namespace Artemis.Plugins.Games.Osu.DataModels;

public class BeatmapDataModel : DataModel
{
public int Id { get; set; }

public int SetId { get; set; }

public string MapString { get; set; }

public string FolderName { get; set; }

public string OsuFileName { get; set; }

public string Md5 { get; set; }

public float Ar { get; set; }

public float Cs { get; set; }

public float Hp { get; set; }

public float Od { get; set; }

public short Status { get; set; }

public void Apply(CurrentBeatmap beatmap)
{
Id = beatmap.Id;
SetId = beatmap.SetId;
MapString = beatmap.MapString;
FolderName = beatmap.FolderName;
OsuFileName = beatmap.OsuFileName;
Md5 = beatmap.Md5;
Ar = beatmap.Ar;
Cs = beatmap.Cs;
Hp = beatmap.Hp;
Od = beatmap.Od;
Status = beatmap.Status;
}
}
40 changes: 40 additions & 0 deletions src/Artemis.Plugins.Games.Osu/DataModels/GeneralDataModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using Artemis.Core.Modules;
using OsuMemoryDataProvider.OsuMemoryModels.Direct;

namespace Artemis.Plugins.Games.Osu.DataModels;

public class GeneralDataModel : DataModel
{
public int RawStatus { get; set; }

public OsuStatus Status => (OsuStatus) RawStatus;

public int GameMode { get; set; }

public int Retries { get; set; }

public int AudioTime { get; set; }

public double TotalAudioTime { get; set; }

public bool ChatIsExpanded { get; set; }

public int Mods { get; set; }

public bool ShowPlayingInterface { get; set; }

public string OsuVersion { get; set; }

public void Apply(GeneralData generalData)
{
RawStatus = generalData.RawStatus;
GameMode = generalData.GameMode;
Retries = generalData.Retries;
AudioTime = generalData.AudioTime;
TotalAudioTime = generalData.TotalAudioTime;
ChatIsExpanded = generalData.ChatIsExpanded;
Mods = generalData.Mods;
ShowPlayingInterface = generalData.ShowPlayingInterface;
OsuVersion = generalData.OsuVersion;
}
}
37 changes: 2 additions & 35 deletions src/Artemis.Plugins.Games.Osu/DataModels/OsuDataModel.cs
Original file line number Diff line number Diff line change
@@ -1,43 +1,10 @@
using Artemis.Core.Modules;
using OsuMemoryDataProvider.OsuMemoryModels.Direct;

namespace Artemis.Plugins.Games.Osu.DataModels;

public class OsuDataModel : DataModel
{
public GeneralDataModel GeneralData { get; set; } = new();
}

public class GeneralDataModel : DataModel
{
public int RawStatus { get; set; }

public int GameMode { get; set; }

public int Retries { get; set; }

public int AudioTime { get; set; }

public double TotalAudioTime { get; set; }

public bool ChatIsExpanded { get; set; }

public int Mods { get; set; }

public bool ShowPlayingInterface { get; set; }

public string OsuVersion { get; set; }

public void Apply(GeneralData generalData)
{
RawStatus = generalData.RawStatus;
GameMode = generalData.GameMode;
Retries = generalData.Retries;
AudioTime = generalData.AudioTime;
TotalAudioTime = generalData.TotalAudioTime;
ChatIsExpanded = generalData.ChatIsExpanded;
Mods = generalData.Mods;
ShowPlayingInterface = generalData.ShowPlayingInterface;
OsuVersion = generalData.OsuVersion;
}
public PlayerDataModel Player { get; set; } = new();
public BeatmapDataModel Beatmap { get; set; } = new();
}
25 changes: 25 additions & 0 deletions src/Artemis.Plugins.Games.Osu/DataModels/OsuStatus.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
namespace Artemis.Plugins.Games.Osu.DataModels;

public enum OsuStatus
{
Unknown = -2, // 0xFFFFFFFE
NotRunning = -1, // 0xFFFFFFFF
MainMenu = 0,
EditingMap = 1,
Playing = 2,
GameShutdownAnimation = 3,
SongSelectEdit = 4,
SongSelect = 5,
WIP_NoIdeaWhatThisIs = 6,
ResultsScreen = 7,
GameStartupAnimation = 10, // 0x0000000A
MultiplayerRooms = 11, // 0x0000000B
MultiplayerRoom = 12, // 0x0000000C
MultiplayerSongSelect = 13, // 0x0000000D
MultiplayerResultsscreen = 14, // 0x0000000E
OsuDirect = 15, // 0x0000000F
RankingTagCoop = 17, // 0x00000011
RankingTeam = 18, // 0x00000012
ProcessingBeatmaps = 19, // 0x00000013
Tourney = 22, // 0x00000016
}
28 changes: 28 additions & 0 deletions src/Artemis.Plugins.Games.Osu/DataModels/PlayerDataModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using System.Collections.Generic;
using System.Linq;
using Artemis.Core.Modules;
using OsuMemoryDataProvider.OsuMemoryModels.Direct;

namespace Artemis.Plugins.Games.Osu.DataModels;

public class PlayerDataModel : DataModel
{
public double HPSmooth { get; set; }

public double HP { get; set; }

public double Accuracy { get; set; }

public List<int> HitErrors { get; set; }

public bool IsReplay { get; set; }

public void Apply(Player player)
{
HPSmooth = player.HPSmooth;
HP = player.HP;
Accuracy = player.Accuracy;
HitErrors = player.HitErrors.ToList();
IsReplay = player.IsReplay;
}
}
11 changes: 11 additions & 0 deletions src/Artemis.Plugins.Games.Osu/OsuModule.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Data;
using Artemis.Core.Modules;
using Artemis.Plugins.Games.Osu.DataModels;
using Serilog;
Expand Down Expand Up @@ -35,5 +36,15 @@ public override void Update(double deltaTime)
{
DataModel.GeneralData.Apply(reader.OsuMemoryAddresses.GeneralData);
}

if (reader.TryRead(reader.OsuMemoryAddresses.Player))
{
DataModel.Player.Apply(reader.OsuMemoryAddresses.Player);
}

if (reader.TryRead(reader.OsuMemoryAddresses.Beatmap))
{
DataModel.Beatmap.Apply(reader.OsuMemoryAddresses.Beatmap);
}
}
}

0 comments on commit 6b3d791

Please sign in to comment.