From cd1b08a9a885dfcdaa7f7db05ced366a1d5f82b6 Mon Sep 17 00:00:00 2001 From: Kurochi51 Date: Thu, 25 Jul 2024 14:58:17 +0300 Subject: [PATCH] Fix custom size slider getting stuck at 4 --- PetScale/PetScale.cs | 20 ++++++++++---------- PetScale/Windows/ConfigWindow.cs | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/PetScale/PetScale.cs b/PetScale/PetScale.cs index 9c31c06..8e66de3 100644 --- a/PetScale/PetScale.cs +++ b/PetScale/PetScale.cs @@ -286,16 +286,16 @@ private unsafe void PopulateDictionary() { continue; } - if (chara.Value->Character.GameObject.ObjectKind is not ObjectKind.BattleNpc || chara.Value->Character.GameObject.OwnerId is 0xE0000000) + if (chara.Value->ObjectKind is not ObjectKind.BattleNpc || chara.Value->OwnerId is 0xE0000000) { continue; } #if DEBUG - var petName = chara.Value->Character.NameString; + var petName = chara.Value->NameString; if (!petModelDic.ContainsKey(petName)) { - PetModel? petModel = petModelSet.Contains((PetModel)chara.Value->ModelCharaId) ? (PetModel)chara.Value->Character.CharacterData.ModelCharaId : null; - petModelDic.Add(petName, (petModel, chara.Value->Character.CharacterData.ModelCharaId, Vector3.Zero, Vector3.Zero)); + PetModel? petModel = petModelSet.Contains((PetModel)chara.Value->ModelCharaId) ? (PetModel)chara.Value->ModelCharaId : null; + petModelDic.Add(petName, (petModel, chara.Value->ModelCharaId, Vector3.Zero, Vector3.Zero)); } #endif if (!petModelSet.Contains((PetModel)chara.Value->ModelCharaId)) @@ -313,9 +313,9 @@ private unsafe void PopulateDictionary() { continue; } - if (chara.Value->Character.GameObject.ObjectKind is ObjectKind.Pc && chara.Value->Character.GameObject.EntityId is not 0xE0000000) + if (chara.Value->ObjectKind is ObjectKind.Pc && chara.Value->EntityId is not 0xE0000000) { - foreach (var possiblePair in activePetDictionary.Keys.Where(pet => pet.Value->Character.GameObject.OwnerId == chara.Value->Character.GameObject.EntityId)) + foreach (var possiblePair in activePetDictionary.Keys.Where(pet => pet.Value->OwnerId == chara.Value->EntityId)) { activePetDictionary[possiblePair] = ((Pointer)(&chara.Value->Character), false); } @@ -353,7 +353,7 @@ private unsafe void ParseDictionary(uint playerEntityId) if (drawModel is not null && petModelDic.TryGetValue(pet->NameString, out var current)) { current.scale = drawModel->Scale; - current.scale2 = new Vector3(pet->Character.Scale, pet->Character.ModelScale, pet->Character.VfxScale); + current.scale2 = new Vector3(pet->Scale, pet->ModelScale, pet->VfxScale); petModelDic[pet->NameString] = current; } #endif @@ -366,8 +366,8 @@ private unsafe void ParseDictionary(uint playerEntityId) { switch (config.FairyState) { - case PetState.Self when character->GameObject.EntityId == playerEntityId: - case PetState.Others when character->GameObject.EntityId != playerEntityId: + case PetState.Self when character->EntityId == playerEntityId: + case PetState.Others when character->EntityId != playerEntityId: case PetState.All: { utilities.SetScale(pet, 1.5f); @@ -390,7 +390,7 @@ private unsafe void ParseDictionary(uint playerEntityId) break; } } - if (ParseStruct(pet, character, pet->Character.CharacterData.ModelCharaId, character->GameObject.EntityId == playerEntityId, allPets)) + if (ParseStruct(pet, character, pet->ModelCharaId, character->EntityId == playerEntityId, allPets)) { activePetDictionary[pair.Key] = (pair.Value.character, true); } diff --git a/PetScale/Windows/ConfigWindow.cs b/PetScale/Windows/ConfigWindow.cs index 8053f5a..b14977b 100644 --- a/PetScale/Windows/ConfigWindow.cs +++ b/PetScale/Windows/ConfigWindow.cs @@ -816,7 +816,7 @@ private void CustomSizeInput(float size, ref float petSize) } if (!otherPetSelection.Equals(DefaultPetSelection, StringComparison.Ordinal)) { - if (petSize > Utilities.GetDefaultScale(customPetMap[otherPetSelection], PetSize.Custom) * 4f) + if (petSize > Utilities.GetDefaultScale(customPetMap[otherPetSelection], PetSize.Custom) * 4f && petSize > 4f) { petSize = Math.Max(Utilities.GetDefaultScale(customPetMap[otherPetSelection], PetSize.Custom) * 4f, 4f); }