From c0e2da676248038aa59aa279dc4a29a01388a0a6 Mon Sep 17 00:00:00 2001 From: 0auBSQ <58159635+0auBSQ@users.noreply.github.com> Date: Fri, 18 Aug 2023 17:57:13 +0900 Subject: [PATCH] Temporary dbsongunlockables file --- TJAPlayer3/Databases/DBSongUnlockables.cs | 71 +++++++++++++++++++++++ TJAPlayer3/Databases/Databases.cs | 2 + 2 files changed, 73 insertions(+) create mode 100644 TJAPlayer3/Databases/DBSongUnlockables.cs diff --git a/TJAPlayer3/Databases/DBSongUnlockables.cs b/TJAPlayer3/Databases/DBSongUnlockables.cs new file mode 100644 index 00000000..fc4e5d80 --- /dev/null +++ b/TJAPlayer3/Databases/DBSongUnlockables.cs @@ -0,0 +1,71 @@ +using System.Collections.Generic; +using Newtonsoft.Json; +using static TJAPlayer3.DBSongUnlockables; + +namespace TJAPlayer3 +{ + internal class DBSongUnlockables : CSavableT> + { + /* DISPLAYED : Song displayed in song select, only a lock appearing on the side, audio preview plays + * GRAYED : Box grayed, song preview does not play + * HIDDEN : Song not appears on the song select list until being unlocked + */ + public enum EHiddenIndex + { + DISPLAYED = 0, + GRAYED = 1, + HIDDEN = 2 + } + + public DBSongUnlockables() + { + _fn = @".\Databases\SongUnlockables.json"; + base.tDBInitSavable(); + } + public class SongUnlockable + { + [JsonProperty("HiddenIndex")] + public EHiddenIndex hiddenIndex; + + [JsonProperty("Rarity")] + public string rarity; + + [JsonProperty("UnlockCondition")] + public DBUnlockables.CUnlockConditions unlockConditions; + } + + public void tGetUnlockedItems(int _player, ModalQueue mq) + { + int player = TJAPlayer3.GetActualPlayer(_player); + var _sf = TJAPlayer3.SaveFileInstances[player].data.NamePlateTitles; + bool _edited = false; + + foreach (KeyValuePair item in data) + { + var _npvKey = item.Key; + if (!_sf.ContainsKey(_npvKey)) + { + var _fulfilled = item.Value.unlockConditions.tConditionMetWrapper(player, DBUnlockables.CUnlockConditions.EScreen.Internal).Item1; + + if (_fulfilled) + { + /* + _sf.Add(_npvKey, item.Value.nameplateInfo); + _edited = true; + mq.tAddModal( + new Modal( + Modal.EModalType.Title, + HRarity.tRarityToModalInt(item.Value.rarity), + item.Value.nameplateInfo.cld.GetString(item.Key) + ), + _player); + */ + } + } + } + + if (_edited) + TJAPlayer3.SaveFileInstances[player].tApplyHeyaChanges(); + } + } +} diff --git a/TJAPlayer3/Databases/Databases.cs b/TJAPlayer3/Databases/Databases.cs index 879309ba..1dd45e64 100644 --- a/TJAPlayer3/Databases/Databases.cs +++ b/TJAPlayer3/Databases/Databases.cs @@ -10,10 +10,12 @@ namespace TJAPlayer3 DBCDN = new DBCDN(); DBEncyclopediaMenus = new DBEncyclopediaMenus(); DBNameplateUnlockables = new DBNameplateUnlockables(); + DBSongUnlockables = new DBSongUnlockables(); } public DBCDN DBCDN; public DBEncyclopediaMenus DBEncyclopediaMenus; public DBNameplateUnlockables DBNameplateUnlockables; + public DBSongUnlockables DBSongUnlockables; } } \ No newline at end of file