diff --git a/source/ArtemisIntegration.hx b/source/ArtemisIntegration.hx index d9395ea4b59..b5737799704 100644 --- a/source/ArtemisIntegration.hx +++ b/source/ArtemisIntegration.hx @@ -111,6 +111,22 @@ class ArtemisIntegration { request.request (true); } } + + public static function setAccentColor3 (hexCode:String) { + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetAccent3Hex"); + request.setPostData (hexCode); + request.request (true); + } + } + + public static function setAccentColor4 (hexCode:String) { + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetAccent4Hex"); + request.setPostData (hexCode); + request.request (true); + } + } public static function setBlammedLights (hexCode:String) { if (artemisAvailable) { @@ -128,9 +144,17 @@ class ArtemisIntegration { } } - public static function fadeToBlack (enable:Bool) { + public static function setFadeColor (hexCode:String) { + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetFadeHex"); + request.setPostData (hexCode); + request.request (true); + } + } + + public static function toggleFade (enable:Bool) { if (artemisAvailable) { - var request = new haxe.Http (fnfEndpoints + "FadeToBlack"); + var request = new haxe.Http (fnfEndpoints + "ToggleFade"); request.setPostData (Std.string (enable)); request.request (true); } @@ -160,38 +184,64 @@ class ArtemisIntegration { } public static function setBeat (beat:Int) { - var request = new haxe.Http (fnfEndpoints + "SetBeat"); - request.setPostData (Std.string (beat)); - request.request (true); + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetBeat"); + request.setPostData (Std.string (beat)); + request.request (true); + } } public static function setCombo (combo:Int) { - var request = new haxe.Http (fnfEndpoints + "SetCombo"); - request.setPostData (Std.string (combo)); - request.request (true); + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetCombo"); + request.setPostData (Std.string (combo)); + request.request (true); + } } - public static function setFullCombo (fullCombo:Bool) { - var request = new haxe.Http (fnfEndpoints + "SetFullCombo"); - request.setPostData (Std.string (fullCombo)); - request.request (true); + public static function breakCombo () { + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "BreakCombo"); + request.request (true); + } + } + + public static function startSong () { + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "StartSong"); + request.request (true); + } } public static function setGameState (gameState:String) { - var request = new haxe.Http (fnfEndpoints + "SetGameState"); - request.setPostData (gameState); - request.request (true); + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetGameState"); + request.setPostData (gameState); + request.request (true); + } } public static function setModName (modName:String) { - var request = new haxe.Http (fnfEndpoints + "SetModName"); - request.setPostData (modName); - request.request (true); + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetModName"); + request.setPostData (modName); + request.request (true); + } } public static function setStageName (stageName:String) { - var request = new haxe.Http (fnfEndpoints + "SetStageName"); - request.setPostData (stageName); - request.request (true); + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetStageName"); + request.setPostData (stageName); + request.request (true); + } + } + + public static function setIsPixelStage (isPixelStage:Bool) { + if (artemisAvailable) { + var request = new haxe.Http (fnfEndpoints + "SetIsPixelStage"); + request.setPostData (Std.string (isPixelStage)); + request.request (true); + } } } \ No newline at end of file diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx index 9544774c06d..a47fa46a5e9 100644 --- a/source/MusicBeatState.hx +++ b/source/MusicBeatState.hx @@ -91,17 +91,17 @@ class MusicBeatState extends FlxUIState var curState:Dynamic = FlxG.state; var leState:MusicBeatState = curState; if(!FlxTransitionableState.skipNextTransIn) { - ArtemisIntegration.fadeToBlack (true); + ArtemisIntegration.toggleFade (true); leState.openSubState(new CustomFadeTransition(0.7, false)); if(nextState == FlxG.state) { CustomFadeTransition.finishCallback = function() { - ArtemisIntegration.fadeToBlack (false); + ArtemisIntegration.toggleFade (false); FlxG.resetState(); }; //trace('resetted'); } else { CustomFadeTransition.finishCallback = function() { - ArtemisIntegration.fadeToBlack (false); + ArtemisIntegration.toggleFade (false); FlxG.switchState(nextState); }; //trace('changed state'); diff --git a/source/PlayState.hx b/source/PlayState.hx index 7521baa7429..13549ee4dcf 100644 --- a/source/PlayState.hx +++ b/source/PlayState.hx @@ -325,13 +325,6 @@ class PlayState extends MusicBeatState Conductor.mapBPMChanges(SONG); Conductor.changeBPM(SONG.bpm); - // tell artemis that the game has in fact started and give it bf's default health (usually 1 but like what if it isn't) - if (isStoryMode) ArtemisIntegration.setGameState ("in-game story"); - else ArtemisIntegration.setGameState ("in-game freeplay"); - ArtemisIntegration.sendBoyfriendHealth (health); - ArtemisIntegration.setCombo (0); - ArtemisIntegration.setBackgroundColor ("#00000000"); // in case there's no set background in the artemis profile, hide the background and just show the overlays over the user's default artemis layout - #if desktop storyDifficultyText = CoolUtil.difficulties[storyDifficulty]; @@ -403,7 +396,14 @@ class PlayState extends MusicBeatState dadGroup = new FlxSpriteGroup(DAD_X, DAD_Y); gfGroup = new FlxSpriteGroup(GF_X, GF_Y); + // tell artemis all the things it needs to know ArtemisIntegration.setStageName (curStage); + if (isStoryMode) ArtemisIntegration.setGameState ("in-game story"); + else ArtemisIntegration.setGameState ("in-game freeplay"); + ArtemisIntegration.sendBoyfriendHealth (health); + ArtemisIntegration.setIsPixelStage (isPixelStage); + ArtemisIntegration.setBackgroundColor ("#00000000"); // in case there's no set background in the artemis profile, hide the background and just show the overlays over the user's default artemis layout + ArtemisIntegration.startSong (); switch (curStage) { @@ -2609,6 +2609,7 @@ class PlayState extends MusicBeatState #if desktop // Game Over doesn't get his own variable because it's only used here DiscordClient.changePresence("Game Over - " + detailsText, SONG.song + " (" + storyDifficultyText + ")", iconP2.getCharacter()); + ArtemisIntegration.setGameState ("dead"); #end isDead = true; return true; @@ -3664,7 +3665,7 @@ class PlayState extends MusicBeatState } }); combo = 0; - ArtemisIntegration.setCombo (combo); + ArtemisIntegration.breakCombo (); health -= daNote.missHealth * healthLoss; ArtemisIntegration.sendBoyfriendHealth (health); @@ -3719,7 +3720,7 @@ class PlayState extends MusicBeatState gf.playAnim('sad'); } combo = 0; - ArtemisIntegration.setCombo (combo); + ArtemisIntegration.breakCombo (); if(!practiceMode) songScore -= 10; if(!endingSong) { @@ -4048,7 +4049,7 @@ class PlayState extends MusicBeatState } if(ClientPrefs.flashing) { - ArtemisIntegration.setFlashColor ("#FFFFFFBF"); + ArtemisIntegration.setFlashColor ("#FFFFFFEF"); halloweenWhite.alpha = 0.4; FlxTween.tween(halloweenWhite, {alpha: 0.5}, 0.075); FlxTween.tween(halloweenWhite, {alpha: 0}, 0.25, {startDelay: 0.15}); @@ -4157,7 +4158,6 @@ class PlayState extends MusicBeatState } ArtemisIntegration.setBeat (curBeat); - if (curBeat % 4 == 0) ArtemisIntegration.setMeasure (Std.int (curBeat / 4)); if (generatedMusic) { @@ -4376,9 +4376,6 @@ class PlayState extends MusicBeatState if (bads > 0 || shits > 0) ratingFC = "FC"; if (songMisses > 0 && songMisses < 10) ratingFC = "SDCB"; else if (songMisses >= 10) ratingFC = "Clear"; - - if (songMisses > 0) ArtemisIntegration.setFullCombo (false); - else ArtemisIntegration.setFullCombo (true); } setOnLuas('rating', ratingPercent); setOnLuas('ratingName', ratingName); diff --git a/source/TitleState.hx b/source/TitleState.hx index 6219ba7af99..66b11d9ccec 100644 --- a/source/TitleState.hx +++ b/source/TitleState.hx @@ -191,6 +191,8 @@ class TitleState extends MusicBeatState #if sys ArtemisIntegration.initialize(); ArtemisIntegration.setGameState ("title"); + ArtemisIntegration.setModName ("vanilla"); + ArtemisIntegration.setFadeColor ("#FF000000"); #end DiscordClient.initialize(); Application.current.onExit.add (function (exitCode) { diff --git a/source/editors/EditorPlayState.hx b/source/editors/EditorPlayState.hx index 1530448aaa3..392b64b812e 100644 --- a/source/editors/EditorPlayState.hx +++ b/source/editors/EditorPlayState.hx @@ -756,7 +756,7 @@ class EditorPlayState extends MusicBeatState function noteMiss(direction:Int = 1):Void { combo = 0; - ArtemisIntegration.setCombo (combo); + ArtemisIntegration.breakCombo (); //songScore -= 10; songMisses++; diff --git a/source/options/VisualsUISubState.hx b/source/options/VisualsUISubState.hx index a40c9c1f563..64e7a93b422 100644 --- a/source/options/VisualsUISubState.hx +++ b/source/options/VisualsUISubState.hx @@ -118,6 +118,7 @@ class VisualsUISubState extends BaseOptionsMenu if (ClientPrefs.enableArtemis) { ArtemisIntegration.initialize(); ArtemisIntegration.setBackgroundColor ("#FFEA71FD"); + ArtemisIntegration.setFadeColor ("#FF000000"); ArtemisIntegration.setGameState ("menu"); } else { ArtemisIntegration.setBackgroundColor ("#00000000");