using System; using System.Collections.Generic; using System.Linq; public class VoiceDictionary { private const string DESTROY_COMVO_VOICE_CHECK = "_4_"; private const string ENEMY_COMVO_VOICE_CHECK = "_7_"; private const string ALLY_COMVO_VOICE_CHECK = "_8_"; private const string ENHANCE_VOICE_CHECK = "_enh"; private const string UNION_BURST_VOICE_CHECK = "_ub"; private const string UNION_BURST_VOICE_CHECK_PLAY = "_ubp"; private const string UNION_BURST_VOICE_CHECK_30 = "_ubs"; private const string UNION_BURST_VOICE_CHECK_60 = "_ubl"; private const string UNION_BURST_VOICE_CHECK_SHORT_30 = "_ubks"; private const string UNION_BURST_VOICE_CHECK_SHORT_60 = "_ubkl"; private const string UNION_BURST_VOICE_CHECK_DIRECTLY_30 = "_ubds"; private const string UNION_BURST_VOICE_CHECK_DIRECTLY_60 = "_ubdl"; private const string UNION_BURST_VOICE_CHECK_DIRECTLY_SHORT_30 = "_ubdks"; private const string UNION_BURST_VOICE_CHECK_DIRECTLY_SHORT_60 = "_ubdkl"; private const string SKYBOUND_ART_VOICE_CHECK = "_sb"; private const string SKYBOUND_ART_VOICE_CHECK_PLAY = "_sbp"; private const string SKYBOUND_ART_VOICE_CHECK_30 = "_sbs"; private const string SKYBOUND_ART_VOICE_CHECK_60 = "_sbl"; private const string SKYBOUND_ART_VOICE_CHECK_SHORT_30 = "_sbks"; private const string SKYBOUND_ART_VOICE_CHECK_SHORT_60 = "_sbkl"; private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_30 = "_sbds"; private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_60 = "_sbdl"; private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_30 = "_sbdks"; private const string SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_60 = "_sbdkl"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK = "_ssb"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_PLAY = "_ssbp"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_30 = "_ssbs"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_60 = "_ssbl"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_SHORT_30 = "_ssbks"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_SHORT_60 = "_ssbkl"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_30 = "_ssbds"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_60 = "_ssbdl"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_30 = "_ssbdks"; private const string SUPER_SKYBOUND_ART_VOICE_CHECK_DIRECTLY_SHORT_60 = "_ssbdkl"; private const string EARTH_RITE_VOICE_CHECK = "_ear"; private const string SUMMON_TOKEN_VOICE = "_11"; public const int CONVE_ID_INDEX = 2; private VoiceAndWaitTime[] _parsedVoice; private string[] _allVoiceID; private VoiceAndWaitTime _normalVoice; private List _fixedUseCostVoice = new List(); private List _unionBurstVoice = new List(); private List _skyboundArtVoice = new List(); private List _superSkyboundArtVoice = new List(); private VoiceAndWaitTime _earthRiteVoice; private VoiceAndWaitTime _summonTokenVoice; public List EnemyComvoList { get; private set; } public List AllyComvoList { get; private set; } public bool HasFixedUseCost { get { if (_fixedUseCostVoice != null) { return _fixedUseCostVoice.Count > 0; } return false; } } public bool HasUnionBurstVoice { get { if (_unionBurstVoice != null) { return _unionBurstVoice.Count > 0; } return false; } } public bool HasSkyboundArtVoice { get { if (_skyboundArtVoice != null) { return _skyboundArtVoice.Count > 0; } return false; } } public bool HasSuperSkyboundArtVoice { get { if (_superSkyboundArtVoice != null) { return _superSkyboundArtVoice.Count > 0; } return false; } } public bool HasEarthRite => _earthRiteVoice != null; public bool HasSummonTokenVoice => _summonTokenVoice != null; public VoiceDictionary(string voice) { EnemyComvoList = new List(); AllyComvoList = new List(); _parsedVoice = new VoiceAndWaitTime[0]; _allVoiceID = new string[0]; Initialize(voice); } private void Initialize(string voiceStr) { if (string.IsNullOrEmpty(voiceStr)) { return; } string[] array = voiceStr.Split(new string[1] { "," }, StringSplitOptions.None); _parsedVoice = new VoiceAndWaitTime[array.Count()]; _allVoiceID = new string[array.Count()]; string text = ""; int i = 0; for (int num = array.Length; i < num; i++) { text = array[i]; _parsedVoice[i] = ExtractionVoice(text); _allVoiceID[i] = _parsedVoice[i].Voice; if (IsConvVoice(text)) { string[] array2 = text.Split(new string[1] { "_" }, StringSplitOptions.None); int num2 = array2.Length - 1; int item = int.Parse(array2[num2]); if (text.Contains("_4_") || text.Contains("_7_")) { EnemyComvoList.Add(item); } else { AllyComvoList.Add(item); } } if (_normalVoice == null && IsNormalVoice(text)) { _normalVoice = _parsedVoice[i]; } if (_unionBurstVoice != null && IsUnionBurstVoice(text)) { _unionBurstVoice.Add(_parsedVoice[i]); } if (_skyboundArtVoice != null && IsSkyboundArtVoice(text)) { _skyboundArtVoice.Add(_parsedVoice[i]); } if (_superSkyboundArtVoice != null && IsSuperSkyboundArtVoice(text)) { _superSkyboundArtVoice.Add(_parsedVoice[i]); } if (IsFixedUseCostVoice(text)) { _fixedUseCostVoice.Add(_parsedVoice[i]); } if (_earthRiteVoice == null && IsEarthRiteVoice(text)) { _earthRiteVoice = _parsedVoice[i]; } if (_summonTokenVoice == null && IsSummonTokenVoice(text)) { _summonTokenVoice = _parsedVoice[i]; } } } public static void SettingVoiceData(ref VoiceDictionary normal, ref VoiceDictionary evolution, string voice) { List list = voice.Split(new string[1] { "//" }, StringSplitOptions.None).ToList(); if (list.Count > 1) { normal = new VoiceDictionary(list[0]); evolution = new VoiceDictionary(list[1]); } else if (list.Count == 1 && list[0] != "") { normal = new VoiceDictionary(list[0]); evolution = new VoiceDictionary(string.Empty); } else { normal = new VoiceDictionary(string.Empty); evolution = new VoiceDictionary(string.Empty); } } public static void SettingVoiceDataList(out List normal, out List evolution, string voice) { if (voice.IndexOf("//") == 0) { voice.Insert(0, "none"); } List list = voice.Split(new string[1] { "//" }, StringSplitOptions.None).ToList(); if (list.Count > 1) { normal = CreateVoiceDataList(list[0]); evolution = CreateVoiceDataList(list[1]); } else if (list.Count == 1 && list[0] != "") { normal = CreateVoiceDataList(list[0]); evolution = CreateVoiceDataList(string.Empty); } else { normal = CreateVoiceDataList(string.Empty); evolution = CreateVoiceDataList(string.Empty); } } private static List CreateVoiceDataList(string voice) { if (voice == string.Empty) { return null; } List list = voice.Split(new string[1] { "," }, StringSplitOptions.None).ToList(); List list2 = null; if (list.Count > 0) { list2 = new List(); for (int i = 0; i < list.Count; i++) { list2.Add(new VoiceDictionary(list[i])); } } return list2; } public static void SettingVoiceData(ref VoiceDictionary normal, string voice) { List list = voice.Split(new string[1] { "//" }, StringSplitOptions.None).ToList(); if (list.Count >= 1 && list[0] != "") { normal = new VoiceDictionary(list[0]); } else { normal = new VoiceDictionary(string.Empty); } } public string[] GetAllVoiceList() { return _allVoiceID; } public VoiceAndWaitTime GetNormalVoice() { if (_normalVoice == null) { return VoiceAndWaitTime._nullVoice; } return _normalVoice; } private bool IsNormalVoice(string voiceName) { if (!IsConvVoice(voiceName) && !IsFixedUseCostVoice(voiceName) && !IsUnionBurstVoice(voiceName) && !IsSkyboundArtVoice(voiceName) && !IsSuperSkyboundArtVoice(voiceName) && !IsEarthRiteVoice(voiceName)) { return !IsSummonTokenVoice(voiceName); } return false; } public VoiceAndWaitTime GetAllyConvVoice(int cardId) { string cardIDStr = cardId.ToString(); int i = 0; while (i < AllyComvoList.Count) { if (IsConvMatch(AllyComvoList[i].ToString(), cardIDStr)) { return _parsedVoice.FirstOrDefault((VoiceAndWaitTime c) => c.Voice.Contains(AllyComvoList[i].ToString()) && c.Voice.Contains("_8_")); } int num = i + 1; i = num; } return VoiceAndWaitTime._nullVoice; } public VoiceAndWaitTime GetEnemyConvVoice(int cardId) { string cardIDStr = cardId.ToString(); int i = 0; while (i < EnemyComvoList.Count) { if (IsConvMatch(EnemyComvoList[i].ToString(), cardIDStr)) { return _parsedVoice.FirstOrDefault((VoiceAndWaitTime c) => c.Voice.Contains(EnemyComvoList[i].ToString()) && c.Voice.Contains("_7_")); } int num = i + 1; i = num; } return VoiceAndWaitTime._nullVoice; } private bool IsConvVoice(string voiceName) { if (voiceName.Contains("_4_")) { string[] array = voiceName.Split(new string[1] { "_" }, StringSplitOptions.None); int result = 0; int num = array.Length - 1; if (array.Length > 2 && array[num].Length == 9) { return int.TryParse(array[num], out result); } return false; } if (!voiceName.Contains("_8_")) { return voiceName.Contains("_7_"); } return true; } private bool IsConvMatch(string voiceName, string cardIDStr) { return voiceName.Contains(cardIDStr); } public VoiceAndWaitTime GetEnhanceVoice(int index) { if (_fixedUseCostVoice.Count <= 0) { return VoiceAndWaitTime._nullVoice; } return _fixedUseCostVoice[index]; } private bool IsFixedUseCostVoice(string voiceName) { return voiceName.Contains("_enh"); } public VoiceAndWaitTime GetUnionBurstVoice(int skillVoiceIndex) { int count = _unionBurstVoice.Count; if (count <= 0) { return VoiceAndWaitTime._nullVoice; } if (count == 1) { return _unionBurstVoice[0]; } if (skillVoiceIndex == 9) { foreach (VoiceAndWaitTime item in _unionBurstVoice) { if (item.Voice.Contains("_ubp")) { return item; } } return VoiceAndWaitTime._nullVoice; } string text = ""; text = skillVoiceIndex switch { 1 => "_ubs", 3 => "_ubl", 2 => "_ubks", 4 => "_ubkl", 5 => "_ubds", 7 => "_ubdl", 6 => "_ubdks", 8 => "_ubdkl", _ => "_ubs", }; foreach (VoiceAndWaitTime item2 in _unionBurstVoice) { if (item2.Voice.Contains(text)) { return new VoiceAndWaitTime(item2.Voice.Replace(text, "_ub"), item2.WaitTime); } } return VoiceAndWaitTime._nullVoice; } public VoiceAndWaitTime GetSkyboundArtVoice(int skillVoiceIndex) { int count = _skyboundArtVoice.Count; if (count <= 0) { return VoiceAndWaitTime._nullVoice; } if (count == 1) { return _skyboundArtVoice[0]; } if (skillVoiceIndex == 19) { foreach (VoiceAndWaitTime item in _skyboundArtVoice) { if (item.Voice.Contains("_sbp")) { return item; } } return VoiceAndWaitTime._nullVoice; } string text = ""; text = skillVoiceIndex switch { 11 => "_sbs", 13 => "_sbl", 12 => "_sbks", 14 => "_sbkl", 15 => "_sbds", 17 => "_sbdl", 16 => "_sbdks", 18 => "_sbdkl", _ => "_sbs", }; foreach (VoiceAndWaitTime item2 in _skyboundArtVoice) { if (item2.Voice.Contains(text)) { return new VoiceAndWaitTime(item2.Voice.Replace(text, "_sb"), item2.WaitTime); } } return VoiceAndWaitTime._nullVoice; } public VoiceAndWaitTime GetSuperSkyboundArtVoice(int skillVoiceIndex) { int count = _superSkyboundArtVoice.Count; if (count <= 0) { return VoiceAndWaitTime._nullVoice; } if (count == 1) { return _superSkyboundArtVoice[0]; } if (skillVoiceIndex == 29) { foreach (VoiceAndWaitTime item in _superSkyboundArtVoice) { if (item.Voice.Contains("_ssbp")) { return item; } } return VoiceAndWaitTime._nullVoice; } string text = ""; text = skillVoiceIndex switch { 21 => "_ssbs", 23 => "_ssbl", 22 => "_ssbks", 24 => "_ssbkl", 25 => "_ssbds", 27 => "_ssbdl", 26 => "_ssbdks", 28 => "_ssbdkl", _ => "_ssbs", }; foreach (VoiceAndWaitTime item2 in _superSkyboundArtVoice) { if (item2.Voice.Contains(text)) { return new VoiceAndWaitTime(item2.Voice.Replace(text, "_ssb"), item2.WaitTime); } } return VoiceAndWaitTime._nullVoice; } private bool IsUnionBurstVoice(string voiceName) { return voiceName.Contains("_ub"); } private bool IsSkyboundArtVoice(string voiceName) { return voiceName.Contains("_sb"); } private bool IsSuperSkyboundArtVoice(string voiceName) { return voiceName.Contains("_ssb"); } public VoiceAndWaitTime GetEarthRiteVoice() { if (_earthRiteVoice == null) { return VoiceAndWaitTime._nullVoice; } return _earthRiteVoice; } private bool IsEarthRiteVoice(string voiceName) { return voiceName.Contains("_ear"); } public VoiceAndWaitTime GetSummonTokenVoice() { if (_summonTokenVoice == null) { return VoiceAndWaitTime._nullVoice; } return _summonTokenVoice; } private bool IsSummonTokenVoice(string voiceName) { return voiceName.EndsWith("_11"); } private VoiceAndWaitTime ExtractionVoice(string order) { string text = order; float waitTime = 0f; if (text.Contains("{")) { List list = text.Split(new string[1] { "{" }, StringSplitOptions.None).ToList(); waitTime = float.Parse(list[1].Replace("}", "")); text = list[0]; } return new VoiceAndWaitTime(text, waitTime); } }