diff --git a/ACNHMS_Source/Assets/Scenes/MainScene.unity b/ACNHMS_Source/Assets/Scenes/MainScene.unity index 679891a4..7882d30b 100644 --- a/ACNHMS_Source/Assets/Scenes/MainScene.unity +++ b/ACNHMS_Source/Assets/Scenes/MainScene.unity @@ -34838,7 +34838,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 41b314fe2ff09544092d888e73f07217, type: 3} m_Name: m_EditorClassIdentifier: - LastEditorDateTime: 2020/07/03 16:28:46 + LastEditorDateTime: 2020/07/03 20:05:14 TextToSet: {fileID: 1900255556} --- !u!1 &1387983482 GameObject: @@ -41709,7 +41709,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 888191203} m_HandleRect: {fileID: 888191202} m_Direction: 2 - m_Value: 0 + m_Value: 1 m_Size: 1 m_NumberOfSteps: 0 m_OnValueChanged: @@ -43209,6 +43209,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_Children: - {fileID: 1766635570} + - {fileID: 2124842292} m_Father: {fileID: 1743923195} m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -43311,6 +43312,7 @@ MonoBehaviour: m_EditorClassIdentifier: SelectionButton: {fileID: 1763291442} SelectionText: {fileID: 1766635571} + ItemImage: {fileID: 2124842293} RawValue: ProcessedValue: ItemId: 0 @@ -51759,6 +51761,77 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 2115689376} m_CullTransparentMesh: 0 +--- !u!1 &2124842291 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2124842292} + - component: {fileID: 2124842294} + - component: {fileID: 2124842293} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2124842292 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2124842291} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 1763291441} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 1} + m_AnchoredPosition: {x: 61.6, y: -37.830685} + m_SizeDelta: {x: 67.52292, y: 67.52292} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &2124842293 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2124842291} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + m_RaycastTarget: 1 + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Texture: {fileID: 0} + m_UVRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 +--- !u!222 &2124842294 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2124842291} + m_CullTransparentMesh: 0 --- !u!1 &2125503430 GameObject: m_ObjectHideFlags: 0 diff --git a/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_MoneyMiles.cs b/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_MoneyMiles.cs index a85c4e6e..63ef68a1 100644 --- a/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_MoneyMiles.cs +++ b/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_MoneyMiles.cs @@ -7,9 +7,9 @@ public class UI_MoneyMiles : IUI_Additional { public const int ENCRYPTIONSIZE = 0x8; - public static string MoneyValueAddress = "ABA86BC4"; // ABA86BC4 - public static string MilesAddress = "ABA2DD28"; // has miles current then miles total after it :) ABA2DD28 - public static string WalletAddress = "ABA52760"; // has storage a bit after it in ram ABA52760 + public static string MoneyValueAddress = OffsetHelper.BankAddress.ToString("X"); // ABA86BC4 + public static string MilesAddress = OffsetHelper.MilesAddress.ToString("X"); // has miles current then miles total after it :) ABA2DD28 + public static string WalletAddress = OffsetHelper.WalletAddress.ToString("X"); // has storage a bit after it in ram ABA52760 public static uint CurrentMoneyAddress { get { return StringUtil.GetHexValue(MoneyValueAddress); } } public static uint CurrentMilesAddress { get { return StringUtil.GetHexValue(MilesAddress); } } public static uint CurrentWalletAddress { get { return StringUtil.GetHexValue(WalletAddress); } } diff --git a/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_TurnipStonk.cs b/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_TurnipStonk.cs index 173e2830..670b66d8 100644 --- a/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_TurnipStonk.cs +++ b/ACNHMS_Source/Assets/Scripts/ACNHMS/AdditionalPanel/UI_TurnipStonk.cs @@ -7,7 +7,7 @@ public class UI_TurnipStonk : IUI_Additional { - public static string TurnipValuesAddress = "AA890CB0"; + public static string TurnipValuesAddress = OffsetHelper.TurnipAddress.ToString("X"); public static uint CurrentTurnipAddress { get { return StringUtil.GetHexValue(TurnipValuesAddress); } } //info diff --git a/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchItem.cs b/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchItem.cs index 44f0175f..f57cd42c 100644 --- a/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchItem.cs +++ b/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchItem.cs @@ -8,6 +8,8 @@ public class UI_SearchItem : MonoBehaviour public Text SelectionText; + public RawImage ItemImage; + [HideInInspector] public string RawValue; @@ -45,6 +47,12 @@ public void InitialiseFor(string val, string contains, int itemId, ItemFilter ui { SetSelection(); }); + + // Sprite image + Color c; + Texture2D t2d = SpriteBehaviour.ItemToTexture2D((ushort)itemId, 0, out c); + ItemImage.texture = t2d; + ItemImage.color = c; } public void SetSelection() diff --git a/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchWindow.cs b/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchWindow.cs index 740f82de..797d3706 100644 --- a/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchWindow.cs +++ b/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SearchWindow.cs @@ -255,7 +255,7 @@ public void SelectItem(ItemFilter itemF, int id, UI_SearchItem sItem) else { ItemRemakeInfo itemRemakeInfo = ItemRemakeInfoData.List[remakeIndex]; - string bodySummary = itemRemakeInfo.GetBodySummary(GameInfo.Strings, tryGetDescriptor: false); + string bodySummary = itemRemakeInfo.GetBodySummary(GameInfo.Strings, false, false); if (bodySummary.Length != 0) { string[] values = bodySummary.Split(new string[3] @@ -270,7 +270,7 @@ public void SelectItem(ItemFilter itemF, int id, UI_SearchItem sItem) { SetController.CreateBody(new string[0]); } - string fabricSummary = itemRemakeInfo.GetFabricSummary(GameInfo.Strings, tryGetDescriptor: false); + string fabricSummary = itemRemakeInfo.GetFabricSummary(GameInfo.Strings, false, false); if (fabricSummary.Length != 0) { string[] values2 = fabricSummary.Split(new string[3] diff --git a/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SetControl.cs b/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SetControl.cs index 5b5bacd0..95c617e6 100644 --- a/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SetControl.cs +++ b/ACNHMS_Source/Assets/Scripts/ACNHMS/UI_SetControl.cs @@ -1,3 +1,4 @@ +using NHSE.Core; using System; using System.Collections.Generic; using UnityEngine; @@ -141,7 +142,8 @@ public void CreateBody(string[] values) BCount.gameObject.SetActive(false); return; } - FCount.gameObject.SetActive(false); + values = values.TruncateEndInvalidValues(); + FCount.gameObject.SetActive(false); BCount.gameObject.SetActive(true); BCount.ClearOptions(); foreach (string text in values) @@ -149,7 +151,7 @@ public void CreateBody(string[] values) if (text.Length != 0) { Dropdown.OptionData val = new Dropdown.OptionData(); - val.text =text; + val.text = text.ClearInvalidText(); BCount.options.Add(val); } } @@ -161,12 +163,13 @@ public void CreateFabric(string[] values) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown - if (values.Length == 0) + if (values.Length == 0 || values.IsInvalidFabricArray()) { FUses.gameObject.SetActive(true); BUses.gameObject.SetActive(false); return; } + values = values.TruncateEndInvalidValues(); FUses.gameObject.SetActive(false); BUses.gameObject.SetActive(true); BUses.ClearOptions(); @@ -175,7 +178,7 @@ public void CreateFabric(string[] values) if (text.Length != 0) { Dropdown.OptionData val = new Dropdown.OptionData(); - val.text = text; + val.text = text.ClearInvalidText() ; BUses.options.Add(val); } } @@ -196,3 +199,30 @@ public string GetUntilOrEmpty(string text, string stopAt = "=") return string.Empty; } } + +public static class InvalidRemakeStringsUtil +{ + // some string functions to clear out invalids + public static bool IsInvalidFabricArray(this string[] fa) + { + foreach (string f in fa) + if (!(f.EndsWith("=" + ItemRemakeInfo.InvalidCheck) || f == string.Empty)) + return false; + return true; + } + + public static string[] TruncateEndInvalidValues(this string[] sa) + { + List ls = new List(sa); + for (int i = ls.Count-1; i > 0; --i) + { + if (ls[i].EndsWith("=" + ItemRemakeInfo.InvalidCheck) || ls[i] == string.Empty) + ls.RemoveAt(i); + else + break; + } + return ls.ToArray(); + } + + public static string ClearInvalidText(this string s) => s.Replace(string.Format("({0})", ItemRemakeInfo.InvalidCheck), string.Empty); +} diff --git a/ACNHMS_Source/Assets/Scripts/Core/Structures/Item/Remake/ItemRemakeInfo.cs b/ACNHMS_Source/Assets/Scripts/Core/Structures/Item/Remake/ItemRemakeInfo.cs index be12dc24..76ef760c 100644 --- a/ACNHMS_Source/Assets/Scripts/Core/Structures/Item/Remake/ItemRemakeInfo.cs +++ b/ACNHMS_Source/Assets/Scripts/Core/Structures/Item/Remake/ItemRemakeInfo.cs @@ -37,6 +37,7 @@ public ItemRemakeInfo(short index, ushort id, sbyte count, byte[] bc0, byte[] bc } private const string Invalid = nameof(Invalid); + public const string InvalidCheck = Invalid; public bool HasBodyColor(int variant) => ReBodyPatternColors0[variant] != 14 || ReBodyPatternColors1[variant] != 14; public bool HasFabricColor(int variant) => ReFabricPatternColors0[variant] != 14 || ReFabricPatternColors1[variant] != 14; @@ -93,7 +94,7 @@ private static string GetColorText(byte c0, byte c1) private static string GetColorText(byte value) => ((ItemCustomColor)value).ToString(); - public string GetBodySummary(IRemakeString str, bool tryGetDescriptor = true) + public string GetBodySummary(IRemakeString str, bool tryGetDescriptor = true, bool checkValid = true) { var sb = new StringBuilder(); if (tryGetDescriptor) @@ -106,7 +107,7 @@ public string GetBodySummary(IRemakeString str, bool tryGetDescriptor = true) for (int i = 0; i < 8; i++) { var cd = GetBodyDescription(i); - if (cd == Invalid) + if (cd == Invalid && checkValid) continue; sb.Append(i).Append('='); @@ -120,7 +121,7 @@ public string GetBodySummary(IRemakeString str, bool tryGetDescriptor = true) return sb.ToString(); } - public string GetFabricSummary(IRemakeString str, bool tryGetDescriptor = true) + public string GetFabricSummary(IRemakeString str, bool tryGetDescriptor = true, bool checkValid = true) { var sb = new StringBuilder(); if (tryGetDescriptor) @@ -133,7 +134,7 @@ public string GetFabricSummary(IRemakeString str, bool tryGetDescriptor = true) for (int i = 0; i < 8; i++) { var cd = GetFabricDescription(i); - if (cd == Invalid) + if (cd == Invalid && checkValid) continue; var shifted = (i << 5); diff --git a/ACNHMS_Source/Assets/Scripts/Tools/OffsetHelper.cs b/ACNHMS_Source/Assets/Scripts/Tools/OffsetHelper.cs new file mode 100644 index 00000000..bf91234d --- /dev/null +++ b/ACNHMS_Source/Assets/Scripts/Tools/OffsetHelper.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public static class OffsetHelper +{ + public const ulong InventoryOffset = 0xABA526A8; + + public const ulong WalletAddress = InventoryOffset + 0xB8; + public const ulong MilesAddress = InventoryOffset - 0x24980; + public const ulong BankAddress = InventoryOffset + 0x3451C; + + public const ulong TurnipAddress = 0xAA890CB0; +} diff --git a/ACNHMS_Source/Assets/Scripts/Tools/OffsetHelper.cs.meta b/ACNHMS_Source/Assets/Scripts/Tools/OffsetHelper.cs.meta new file mode 100644 index 00000000..6dda8c5e --- /dev/null +++ b/ACNHMS_Source/Assets/Scripts/Tools/OffsetHelper.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 06bfcbd0333c7e94b85df8f9a7c64e12 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ACNHMS_Source/Assets/Scripts/Tools/SysBotController.cs b/ACNHMS_Source/Assets/Scripts/Tools/SysBotController.cs index 1b60cebf..1ebd0093 100644 --- a/ACNHMS_Source/Assets/Scripts/Tools/SysBotController.cs +++ b/ACNHMS_Source/Assets/Scripts/Tools/SysBotController.cs @@ -6,7 +6,7 @@ public class SysBotController { - public static string CurrentOffset = "ABA526A8"; + public static string CurrentOffset = OffsetHelper.InventoryOffset.ToString("X");// "ABA526A8"; public SysBotController(InjectionType type) => Type = type;