Skip to content

Commit

Permalink
woag lots of updates
Browse files Browse the repository at this point in the history
  • Loading branch information
skedgyedgy committed Dec 31, 2021
1 parent acf844d commit 122dbea
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 39 deletions.
92 changes: 71 additions & 21 deletions source/ArtemisIntegration.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
}
}
6 changes: 3 additions & 3 deletions source/MusicBeatState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
25 changes: 11 additions & 14 deletions source/PlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -3664,7 +3665,7 @@ class PlayState extends MusicBeatState
}
});
combo = 0;
ArtemisIntegration.setCombo (combo);
ArtemisIntegration.breakCombo ();

health -= daNote.missHealth * healthLoss;
ArtemisIntegration.sendBoyfriendHealth (health);
Expand Down Expand Up @@ -3719,7 +3720,7 @@ class PlayState extends MusicBeatState
gf.playAnim('sad');
}
combo = 0;
ArtemisIntegration.setCombo (combo);
ArtemisIntegration.breakCombo ();

if(!practiceMode) songScore -= 10;
if(!endingSong) {
Expand Down Expand Up @@ -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});
Expand Down Expand Up @@ -4157,7 +4158,6 @@ class PlayState extends MusicBeatState
}

ArtemisIntegration.setBeat (curBeat);
if (curBeat % 4 == 0) ArtemisIntegration.setMeasure (Std.int (curBeat / 4));

if (generatedMusic)
{
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions source/TitleState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion source/editors/EditorPlayState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,7 @@ class EditorPlayState extends MusicBeatState
function noteMiss(direction:Int = 1):Void
{
combo = 0;
ArtemisIntegration.setCombo (combo);
ArtemisIntegration.breakCombo ();

//songScore -= 10;
songMisses++;
Expand Down
1 change: 1 addition & 0 deletions source/options/VisualsUISubState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 122dbea

Please sign in to comment.