Skip to content

Commit

Permalink
Merge pull request #9 from skedgyedgy/fnf
Browse files Browse the repository at this point in the history
funky a la frontal lobe
  • Loading branch information
skedgyedgy authored Jan 8, 2022
2 parents 06327b5 + 1001da0 commit e44ade0
Show file tree
Hide file tree
Showing 6 changed files with 92 additions and 17 deletions.
File renamed without changes.
82 changes: 70 additions & 12 deletions Artemis.Plugins.Module.FNF/DataModels/FnfSongData.cs
Original file line number Diff line number Diff line change
@@ -1,37 +1,80 @@
using Artemis.Core;
using Artemis.Core.Modules;
using SkiaSharp;

namespace Artemis.Plugins.Module.FNF.DataModels {
public class FNFSongData {
[DataModelProperty (Name = "Song name", Description = "The name of the currently playing song")]
public string SongName { get; set; } = "fresh";
[DataModelProperty (Name = "Difficulty name", Description = "The currently selected difficulty")]
public string Difficulty { get; set; } = "normal";

[DataModelProperty (Name = "Opponent name", Description = "The name of the current opponent character")]
public string DadName { get; set; } = "dad";
[DataModelProperty (Name = "Boyfriend name", Description = "The name of the current player character")]
public string BfName { get; set; } = "bf";
[DataModelProperty (Name = "Girlfriend name", Description = "The name of the current girlfriend character")]
public string GfName { get; set; } = "gf";

[DataModelProperty (Name = "Stage name", Description = "The name of the current song's stage")]
public string StageName { get; set; } = "stage";
[DataModelProperty (Name = "Is pixel stage", Description = "Whether the stage is a pixel stage or not")]
public bool IsPixelStage { get; set; } = false;

[DataModelProperty (Name = "Beat number", Description = "The current beat of the song.")]
public int BeatNumber { get; set; }
[DataModelProperty (Name = "Measure number", Description = "The current measure of the song (assuming it is 4/4 time).")]
[DataModelProperty (Name = "Beat number", Description = "The current beat of the song")]
public int BeatNumber { get; set; } = 0;
[DataModelProperty (Name = "Measure number", Description = "The current measure of the song (assuming it is 4/4 time)")]
public int MeasureNumber => BeatNumber / 4;
[DataModelProperty (Name = "Song progress", Description = "The percentage of the song that has passed")]
public float SongProgress { get; set; } = 0;

[DataModelProperty (Name = "Player health", Description = "How much health boyfriend has")]
public float BoyfriendHealth { get; set; }
public float BoyfriendHealth { get; set; } = 1;
[DataModelProperty (Name = "Current combo", Description = "How big your current combo is")]
public int CurrentCombo { get; set; }
public int CurrentCombo { get; set; } = 0;
[DataModelProperty (Name = "Rating", Description = "Your rating percentage")]
public float RatingPercentage { get; set; }
public float RatingPercentage { get; set; } = 75;
[DataModelProperty (Name = "Combo type", Description = "The type of combo you're currently in")]
public string ComboType { get; set; } = "Clear";
[DataModelProperty (Name = "Full combo", Description = "Whether you are currently in a full combo")]
public bool FullCombo { get; set; }
public bool FullCombo { get; set; } = false;
// public bool FullCombo { get => ComboType == "FC" || ComboType == "GFC" || ComboType == "SFC" || ComboType == "MFC"; }
// public bool FullCombo { get => ComboType == ComboType.FullCombo || ComboType == ComboType.GoodFullCombo || ComboType == ComboType.MasterFullCombo; }


[DataModelProperty (Name = "On beat")]
[DataModelProperty (Name = "On beat", Description = "Called every beat")]
public DataModelEvent OnBeat { get; } = new DataModelEvent ();
[DataModelProperty (Name = "On measure")]
[DataModelProperty (Name = "On measure", Description = "Called every measure")]
public DataModelEvent OnMeasure { get; } = new DataModelEvent ();
[DataModelProperty (Name = "On combo broken")]

[DataModelProperty (Name = "On note hit", Description = "Called when a note is hit")]
public DataModelEvent<NoteHitEventArgs> OnNoteHit { get; } = new DataModelEvent<NoteHitEventArgs> ();
[DataModelProperty (Name = "On note miss", Description = "Called when a note is missed")]
public DataModelEvent<NoteMissEventArgs> OnNoteMiss { get; } = new DataModelEvent<NoteMissEventArgs> ();
[DataModelProperty (Name = "On combo broken", Description = "Called when a combo is broken")]
public DataModelEvent<ComboBreakEventArgs> OnComboBroken { get; } = new DataModelEvent<ComboBreakEventArgs> ();
}

public class NoteHitEventArgs : DataModelEventArgs {
public int NoteDirection { get; set; }
public string NoteType { get; set; }
public string NoteHitAccuracy { get; set; }

public NoteHitEventArgs (int noteDirection, string noteType, string noteHitAccuracy) {
NoteDirection = noteDirection;
NoteType = noteType;
NoteHitAccuracy = noteHitAccuracy;
}
}

public class NoteMissEventArgs : DataModelEventArgs {
public int NoteDirection { get; set; }
public string NoteType { get; set; }

public NoteMissEventArgs (int noteDirection, string noteType) {
NoteDirection = noteDirection;
NoteType = noteType;
}
}

public class ComboBreakEventArgs : DataModelEventArgs {
public int BrokenComboValue { get; set; }
public bool WasFullCombo { get; set; }
Expand All @@ -41,4 +84,19 @@ public ComboBreakEventArgs (int brokenComboValue, bool wasFullCombo) {
WasFullCombo = wasFullCombo;
}
}

/*public enum NoteHitAccuracy {
Sick,
Good,
Bad,
Shit
}*/

/*public enum ComboType {
MasterFullCombo,
GoodFullCombo,
FullCombo,
SingleDigitComboBreak,
Clear
}*/
}
2 changes: 1 addition & 1 deletion Artemis.Plugins.Module.FNF/FnfControlsBrushProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Collections.Generic;

namespace Artemis.Plugins.Module.FNF {
[PluginFeature (Name = "FNF Controls Layer", Icon = "Music")]
[PluginFeature (Name = "FNF Controls Layer", Icon = "Controller")]
class FnfControlsBrushProvider : LayerBrushProvider {
private readonly IWebServerService webServerService;

Expand Down
16 changes: 16 additions & 0 deletions Artemis.Plugins.Module.FNF/FnfModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ public override void Enable () {
});
webServerService.AddStringEndPoint (this, "SetModName", h => DataModel.GameState.ModName = h);

webServerService.AddStringEndPoint (this, "SetSongName", h => DataModel.SongData.SongName = h);
webServerService.AddStringEndPoint (this, "SetDifficlutyName", h => DataModel.SongData.Difficulty = h);

webServerService.AddStringEndPoint (this, "SetDadName", h => DataModel.SongData.DadName = h);
webServerService.AddStringEndPoint (this, "SetBfName", h => DataModel.SongData.BfName = h);
webServerService.AddStringEndPoint (this, "SetGfName", h => DataModel.SongData.GfName = h);

webServerService.AddStringEndPoint (this, "SetStageName", h => DataModel.SongData.StageName = h);
webServerService.AddStringEndPoint (this, "SetIsPixelStage", h => DataModel.SongData.IsPixelStage = bool.Parse (h));

Expand All @@ -36,20 +43,29 @@ public override void Enable () {

DataModel.SongData.BeatNumber = val;
});
webServerService.AddStringEndPoint (this, "SetSongProgress", h => DataModel.SongData.SongProgress = float.Parse (h));
webServerService.AddStringEndPoint (this, "SetHealth", h => DataModel.SongData.BoyfriendHealth = float.Parse (h));
webServerService.AddStringEndPoint (this, "SetRating", h => DataModel.SongData.RatingPercentage = float.Parse (h));
webServerService.AddStringEndPoint (this, "SetCombo", h => DataModel.SongData.CurrentCombo = int.Parse (h));
webServerService.AddStringEndPoint (this, "StartSong", h => {
DataModel.SongData.ComboType = "SFC";
DataModel.SongData.FullCombo = true;
DataModel.SongData.CurrentCombo = 0;
DataModel.GameState.OnSongStarted.Trigger ();
// DataModel.GameState.OnSongStarted.Trigger (new SongStartedEventArguments ());
});
webServerService.AddJsonEndPoint<NoteHitEventArgs> (this, "NoteHit", h => DataModel.SongData.OnNoteHit.Trigger (h));
webServerService.AddJsonEndPoint<NoteMissEventArgs> (this, "NoteMiss", h => DataModel.SongData.OnNoteMiss.Trigger (h));
webServerService.AddStringEndPoint (this, "BreakCombo", h => {
DataModel.SongData.OnComboBroken.Trigger (new ComboBreakEventArgs (DataModel.SongData.CurrentCombo, DataModel.SongData.FullCombo));
if (DataModel.SongData.FullCombo) DataModel.SongData.ComboType = "SDCB";
DataModel.SongData.FullCombo = false;
DataModel.SongData.CurrentCombo = 0;
});
webServerService.AddStringEndPoint (this, "SetComboType", h => {
DataModel.SongData.ComboType = h;
// DataModel.SongData.ComboType = Enum.Parse<ComboType> (h);
});

webServerService.AddStringEndPoint (this, "SetDadHex", h => DataModel.Colors.DadHealthColor = SKColor.Parse (h));
webServerService.AddStringEndPoint (this, "SetBFHex", h => DataModel.Colors.BfHealthColor = SKColor.Parse (h));
Expand Down
2 changes: 1 addition & 1 deletion Artemis.Plugins.Module.FNF/FnfProfileManagerModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using Newtonsoft.Json;

namespace Artemis.Plugins.Module.FNF {
[PluginFeature (Name = "FNF Profile Manager", Icon = "Music")]
[PluginFeature (Name = "FNF Profile Manager", Icon = "PersonAdd")]
public class FnfProfileManagerModule : PluginFeature {
private readonly IWebServerService webServerService;
private readonly IProfileService profileService;
Expand Down
7 changes: 4 additions & 3 deletions Artemis.Plugins.Module.FNF/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
"Name": "Friday Night Funkin' Integration",
"Description": "pretty lights for beep boop game",
"Author": "skedgyedgy",
"Website": null,
"Website": "https://gamebanana.com/mods/347063",
"Repository": "https://github.com/skedgyedgy/Artemis.Plugins.FNF",
"Version": "1.2.1",
"Main": "Artemis.Plugins.Module.FNF.dll"
"Version": "1.3",
"Main": "Artemis.Plugins.Module.FNF.dll",
"Icon": "Music"
}

0 comments on commit e44ade0

Please sign in to comment.