Skip to content

Commit

Permalink
Update to Muse Dash v4.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DeamonHunter committed Jul 26, 2024
1 parent c15f109 commit 423c97a
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 22 deletions.
48 changes: 35 additions & 13 deletions ArchipelagoMuseDash/AlbumDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,9 @@
namespace ArchipelagoMuseDash;

/// <summary>
/// Contains information about the game's songs, in a way that is easier to access for us.
/// Contains information about the game's songs, in a way that is easier to access for us.
/// </summary>
public class AlbumDatabase {
private Dictionary<string, MusicInfo> _songsByItemName = new();
private Dictionary<string, List<MusicInfo>> _songsByAlbum = new();

private Dictionary<string, MusicInfo> _songsByUid = new();
private readonly Dictionary<long, string> _songIDToUid = new();
private readonly Dictionary<long, string> _albumIDToAlbumString = new(); //Not Used yet

public const int CHINESE_LOC_INDEX = 0;
public const int ENGLISH_LOC_INDEX = 1;
Expand All @@ -24,6 +18,17 @@ public class AlbumDatabase {
{ "Tsukuyomi Ni Naru", "Territory Battles" }
};

public static readonly Dictionary<string, string> UidOverrides = new() {
{ "74-2", "74-6" }
};

private Dictionary<string, MusicInfo> _songsByItemName = new();
private Dictionary<string, List<MusicInfo>> _songsByAlbum = new();

private Dictionary<string, MusicInfo> _songsByUid = new();
private readonly Dictionary<long, string> _songIDToUid = new();
private readonly Dictionary<long, string> _albumIDToAlbumString = new(); //Not Used yet

public void Setup() {
_songsByAlbum.Clear();
_songsByItemName.Clear();
Expand All @@ -49,7 +54,11 @@ public void Setup() {
var albumLocal = albumLocalisation.GetLocalTitleByIndex(albumConfig.GetAlbumInfoByAlbumJsonIndex(musicInfo.albumJsonIndex).listIndex);

var songName = GetItemNameFromMusicInfo(musicInfo);
_songsByItemName.Add(songName, musicInfo);
if (!_songsByItemName.TryAdd(songName, musicInfo)) {
ArchipelagoStatic.ArchLogger.Warning("[Album Database]", $"Duplicate Song Name found. Id: {musicInfo.uid}");
continue;
}

_songsByUid.Add(musicInfo.uid, musicInfo);

if (_currentNamesToOldNames.TryGetValue(songName, out var oldName))
Expand Down Expand Up @@ -92,13 +101,23 @@ public void LoadMusicList(Stream dataTextStream) {
}
}

public bool TryGetOldName(string newName, out string oldName) => _currentNamesToOldNames.TryGetValue(newName, out oldName);
public bool TryGetMusicInfo(string itemName, out MusicInfo info) => _songsByItemName.TryGetValue(itemName, out info);
public MusicInfo GetMusicInfo(string itemName) => _songsByItemName[itemName];
public bool TryGetOldName(string newName, out string oldName) {
return _currentNamesToOldNames.TryGetValue(newName, out oldName);
}
public bool TryGetMusicInfo(string itemName, out MusicInfo info) {
return _songsByItemName.TryGetValue(itemName, out info);
}
public MusicInfo GetMusicInfo(string itemName) {
return _songsByItemName[itemName];
}

public bool TryGetAlbum(string itemName, out List<MusicInfo> infos) => _songsByAlbum.TryGetValue(itemName, out infos);
public bool TryGetAlbum(string itemName, out List<MusicInfo> infos) {
return _songsByAlbum.TryGetValue(itemName, out infos);
}

public List<MusicInfo> GetAlbum(string itemName) => _songsByAlbum[itemName];
public List<MusicInfo> GetAlbum(string itemName) {
return _songsByAlbum[itemName];
}

public string GetItemNameFromMusicInfo(MusicInfo musicInfo) {
var localisedSongName = ArchipelagoStatic.SongNameChanger.GetSongName(musicInfo);
Expand All @@ -117,6 +136,9 @@ public bool TryGetSongFromItemId(long itemId, out MusicInfo info) {
if (!_songIDToUid.TryGetValue(itemId, out var uid))
return false;

if (UidOverrides.TryGetValue(uid, out var replacementUid))
uid = replacementUid;

return _songsByUid.TryGetValue(uid, out info);
}

Expand Down
4 changes: 2 additions & 2 deletions ArchipelagoMuseDash/Archipelago/HintHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public void HintSong(MusicInfo song) {

//There is no specific packet or function to send for costed hints. So we need to send a chat message for the player
if (song.uid == ArchipelagoStatic.SessionHandler.ItemHandler.GoalSong.uid)
_currentSession.Socket.SendPacketAsync(new SayPacket { Text = $"!hint Music Sheet" });
_currentSession.Socket.SendPacketAsync(new SayPacket { Text = "!hint Music Sheet" });
else
_currentSession.Socket.SendPacketAsync(new SayPacket { Text = $"!hint {ArchipelagoStatic.AlbumDatabase.GetItemNameFromMusicInfo(song)}" });
}
Expand Down Expand Up @@ -240,7 +240,7 @@ private void GetHintFromItemName(string itemName, StringBuilder sb) {
sb.Append($"To be found by {_currentSession.Players.GetPlayerAlias(locatedHint.FindingPlayer)} at {locationName}");
}

bool addedItemHint = false;
var addedItemHint = false;

if (_locationHints.TryGetValue(itemName + "-0", out var itemHint1)) {
var item = _currentSession.Items.GetItemName(itemHint1.ItemId);
Expand Down
2 changes: 1 addition & 1 deletion ArchipelagoMuseDash/ArchipelagoMuseDash.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Archipelago.MultiClient.Net" Version="6.1.1" />
<PackageReference Include="Archipelago.MultiClient.Net" Version="6.2.0"/>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion ArchipelagoMuseDash/ArchipelagoMuseDashMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using ArchipelagoMuseDash.Helpers;
using ArchipelagoMuseDash.Logging;
using MelonLoader;
[assembly: MelonInfo(typeof(ArchipelagoMuseDashMod), "Archipelago Muse Dash", "1.5.0", "DeamonHunter")]
[assembly: MelonInfo(typeof(ArchipelagoMuseDashMod), "Archipelago Muse Dash", "1.5.2", "DeamonHunter")]
[assembly: MelonGame("PeroPeroGames", "MuseDash")]
[assembly: MelonPriority(100)]

Expand Down
13 changes: 10 additions & 3 deletions ArchipelagoMuseDash/Assets/MuseDashData.txt
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@ NOVA|73-4|Happy Otaku Pack Vol.19|True|6|8|10|
Heaven's Gradius|73-5|Happy Otaku Pack Vol.19|True|6|8|10|
Ray Tuning|74-0|CHUNITHM COURSE MUSE|True|6|8|10|
World Vanquisher|74-1|CHUNITHM COURSE MUSE|True|6|8|10|11
Tsukuyomi Ni Naru|74-2|CHUNITHM COURSE MUSE|True|5|7|9|
Tsukuyomi Ni Naru Replaced|74-2|CHUNITHM COURSE MUSE|True|5|7|9|
The wheel to the right|74-3|CHUNITHM COURSE MUSE|True|5|7|9|11
Climax|74-4|CHUNITHM COURSE MUSE|True|4|8|11|11
Spider's Thread|74-5|CHUNITHM COURSE MUSE|True|5|8|10|12
Expand All @@ -562,8 +562,15 @@ Test Me feat. Uyeon|43-55|MD Plus Project|True|3|5|9|
Assault TAXI|43-56|MD Plus Project|True|4|7|10|
No|43-57|MD Plus Project|False|4|6|9|
Pop it|43-58|MD Plus Project|True|1|3|6|
HEARTBEAT!キュンキュン!iKz feat.Warma|43-59|MD Plus Project|True|4|6|9|
HEARTBEAT! KyunKyun!|43-59|MD Plus Project|False|4|6|9|
SUPERHERO|75-0|Novice Rider Pack|False|2|4|7|
Highway_Summer|75-1|Novice Rider Pack|True|2|4|6|
Mx. Black Box|75-2|Novice Rider Pack|True|5|7|9|
Sweet Encounter|75-3|Novice Rider Pack|True|2|4|7|
Sweet Encounter|75-3|Novice Rider Pack|True|2|4|7|
Echo over you... Secret|0-55|Default Music|False|6|8|10|
Echo over you...|0-56|Default Music|False|1|4|0|
Tsukuyomi Ni Naru|74-6|CHUNITHM COURSE MUSE|False|5|8|10|
disco light|76-0|MUSE RADIO FM105|False|5|7|9|
room light feat.chancylemon|76-1|MUSE RADIO FM105|False|3|5|7|
Invisible|76-2|MUSE RADIO FM105|False|3|5|8|
Christmas Season-LLABB|76-3|MUSE RADIO FM105|False|1|4|7|
16 changes: 15 additions & 1 deletion ArchipelagoMuseDash/Assets/SongNameReplacements.json
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,14 @@
"43-59": "HEARTBEAT! KyunKyun!",
//HEARTBEAT!キュンキュン!iKz feat.Warma

//Official Press release. (Interesting that the game doesn't translate it.)
"74-6": "Tsukuyomi Ni Naru",
//月詠に鳴る

//Google Translate
"76-3": "Christmas Season-LLABB",
//圣诞季-LLABB

///
/// Song Cleanup Section
///
Expand Down Expand Up @@ -457,6 +465,12 @@
"73-3": "Ops Limone",
//Ops:Limone

"74-2": "Tsukuyomi Ni Naru"
"74-2": "Tsukuyomi Ni Naru",
//Territory Battles

"0-55": "Echo over you... Secret",
//Echo over you...

"0-56": "Echo over you..."
//Echo over you...
}
2 changes: 1 addition & 1 deletion ArchipelagoMuseDash/Patches/ArchipelagoPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ private static void Postfix() {
return;
}
}

if (GlobalDataBase.dbBattleStage.IsSelectElfin(BETA_DOG_ELFIN_ID)) {
if (GlobalDataBase.dbSkill.betaDogSkillInvoke) {
var reason = "No Items Given:\nDied with BetaGo.";
Expand Down

0 comments on commit 423c97a

Please sign in to comment.