Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auga 1.3.0 #215

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
13f4947
Merge branch 'main' into vapok
Vapok Sep 17, 2023
a5b05d1
Release 1.2.17
Vapok Sep 18, 2023
8e116d3
Initial changes
Vapok Sep 19, 2023
2bc6b97
More Updates for Epic Loot and Supporting Auga
Vapok Sep 20, 2023
67552d5
More updates for PTB - still not working.
Vapok Sep 25, 2023
15e223b
local references for 0.217.20 - do not pick
Vapok Sep 25, 2023
94813cf
References to 0.217.24 - do not pick
Vapok Oct 10, 2023
223ad99
More Changes.. making progress.
Vapok Oct 10, 2023
4dd3e45
More changes
Vapok Oct 10, 2023
8af454e
Additional changes
Vapok Oct 15, 2023
f9b00dd
Additional Auga Changes
Vapok Oct 16, 2023
afa91e7
more changes....
Vapok Oct 16, 2023
7ebcb1e
Working Runes
Vapok Oct 16, 2023
f610609
Settings and Compendium Scrolling Working Now
Vapok Oct 17, 2023
0cdad1a
More Changes to support 0.217.24
Vapok Oct 17, 2023
40c309f
Additional Changes, fixing up inventory, dialog
Vapok Oct 18, 2023
c13d22e
Release 1.3.0
Vapok Oct 18, 2023
78b1fbc
Adding TMP Text to Sleep Texts
Vapok Oct 18, 2023
33b0fc3
Adjusting Portals, Signs, and Tames Text Inputs, fixing Shop Label.
Vapok Oct 18, 2023
a11af3b
Release 1.3.2
Vapok Oct 18, 2023
71ee02b
Bug Fix - Compendium Weakness Updates Wrong
Vapok Oct 18, 2023
67b5c1a
SkillsDialog Adjustments for EpicLoot
Vapok Oct 18, 2023
59e0bc4
Vegetation Setting Fix
Vapok Oct 18, 2023
ca6787d
Barber Station
Vapok Oct 19, 2023
3fe32e7
Release 1.3.3
Vapok Oct 19, 2023
49b3832
Improved Barber UI
Vapok Oct 20, 2023
025f3bf
Release 1.3.4
Vapok Oct 20, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Auga/API.Common.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using UnityEngine;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

namespace Auga
Expand All @@ -13,15 +14,15 @@ public enum RequirementWireState
public class PlayerPanelTabData
{
public int Index;
public Text TabTitle;
public TMP_Text TabTitle;
public GameObject TabButtonGO;
public GameObject ContentGO;
}

public class WorkbenchTabData
{
public int Index;
public Text TabTitle;
public TMP_Text TabTitle;
public GameObject TabButtonGO;
public GameObject RequirementsPanelGO;
public GameObject ItemInfoGO;
Expand Down
3 changes: 2 additions & 1 deletion Auga/API.External.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Reflection.Emit;
using HarmonyLib;
using JetBrains.Annotations;
using TMPro;
using UnityEngine;
using UnityEngine.UI;

Expand Down Expand Up @@ -141,7 +142,7 @@ public static void ComplexTooltip_SetSkill(GameObject complexTooltipGO, Skills.S
public static GameObject[] RequirementsPanel_RequirementList(GameObject requirementsPanelGO) => null;
public static void RequirementsPanel_SetWires(GameObject requirementsPanelGO, RequirementWireState[] wireStates, bool canCraft) { }

public static Text CustomVariantPanel_Enable(string buttonLabel, Action<bool> onShow) => null;
public static TMP_Text CustomVariantPanel_Enable(string buttonLabel, Action<bool> onShow) => null;
public static void CustomVariantPanel_SetButtonLabel(string buttonLabel) { }
public static void CustomVariantPanel_Disable() { }
}
Expand Down
15 changes: 8 additions & 7 deletions Auga/API.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Linq;
using AugaUnity;
using JetBrains.Annotations;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
using Object = UnityEngine.Object;
Expand Down Expand Up @@ -65,7 +66,7 @@ public static Button SmallButton_Create(Transform parent, string name, string la
{
var button = Object.Instantiate(Auga.Assets.ButtonSmall, parent);
button.name = name;
var text = button.GetComponentInChildren<Text>();
var text = button.GetComponentInChildren<TMP_Text>();
if (text != null)
{
text.text = Localization.instance.Localize(labelText);
Expand All @@ -79,7 +80,7 @@ public static Button MediumButton_Create(Transform parent, string name, string l
{
var button = Object.Instantiate(Auga.Assets.ButtonMedium, parent);
button.name = name;
var text = button.GetComponentInChildren<Text>();
var text = button.GetComponentInChildren<TMP_Text>();
if (text != null)
{
text.text = Localization.instance.Localize(labelText);
Expand All @@ -93,7 +94,7 @@ public static Button FancyButton_Create(Transform parent, string name, string la
{
var button = Object.Instantiate(Auga.Assets.ButtonFancy, parent);
button.name = name;
var text = button.GetComponentInChildren<Text>();
var text = button.GetComponentInChildren<TMP_Text>();
if (text != null)
{
text.text = Localization.instance.Localize(labelText);
Expand All @@ -107,7 +108,7 @@ public static Button SettingsButton_Create(Transform parent, string name, string
{
var button = Object.Instantiate(Auga.Assets.ButtonSettings, parent);
button.name = name;
var text = button.GetComponentInChildren<Text>();
var text = button.GetComponentInChildren<TMP_Text>();
if (text != null)
{
text.text = Localization.instance.Localize(labelText);
Expand Down Expand Up @@ -187,7 +188,7 @@ public static void Button_SetTextColors(Button button, Color normal, Color highl
colorValues.TextColors.disabledColor = disabled;
}

var text = button.GetComponentInChildren<Text>();
var text = button.GetComponentInChildren<TMP_Text>();
if (text != null)
{
text.color = baseTextColor;
Expand All @@ -203,7 +204,7 @@ public static void Button_OverrideTextColor(Button button, Color color)
Object.Destroy(colorValues);
}

var text = button.GetComponentInChildren<Text>();
var text = button.GetComponentInChildren<TMP_Text>();
if (text != null)
{
text.color = color;
Expand Down Expand Up @@ -799,7 +800,7 @@ public static void RequirementsPanel_SetWires(GameObject requirementsPanelGO, Re
// Custom Variant Panel
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
[UsedImplicitly]
public static Text CustomVariantPanel_Enable(string buttonLabel, Action<bool> onShow)
public static TMP_Text CustomVariantPanel_Enable(string buttonLabel, Action<bool> onShow)
{
if (WorkbenchPanelController.instance == null)
{
Expand Down
9 changes: 6 additions & 3 deletions Auga/Auga.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public class AugaAssets
public GameObject SettingsPrefab;
public GameObject MessageHud;
public GameObject TextInput;
public GameObject AugaBarber;
public GameObject AugaChat;
public GameObject DamageText;
public GameObject EnemyHud;
Expand Down Expand Up @@ -77,11 +78,13 @@ public class AugaColors
[BepInPlugin(PluginID, "Project Auga", Version)]
[BepInDependency("Menthus.bepinex.plugins.BetterTrader", BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency("maximods.valheim.multicraft", BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency("redseiko.valheim.chatter", BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency("redseiko.valheim.searscatalog", BepInDependency.DependencyFlags.SoftDependency)]
[BepInDependency("com.github.abearcodes.valheim.simplerecycling", BepInDependency.DependencyFlags.SoftDependency)]
public class Auga : BaseUnityPlugin
{
public const string PluginID = "randyknapp.mods.auga";
public const string Version = "1.2.15";
public const string Version = "1.3.4";

public enum StatBarTextDisplayMode { JustValue, ValueAndMax, ValueMaxPercent, JustPercent }
public enum StatBarTextPosition { Off = -1, Above, Below, Center, Start, End };
Expand Down Expand Up @@ -157,8 +160,7 @@ public void Awake()
}
}
}



LoadDependencies();
LoadTranslations();
LoadConfig();
Expand Down Expand Up @@ -374,6 +376,7 @@ private static void LoadAssets()
Assets.SettingsPrefab = assetBundle.LoadAsset<GameObject>("AugaSettings");
Assets.MessageHud = assetBundle.LoadAsset<GameObject>("AugaMessageHud");
Assets.TextInput = assetBundle.LoadAsset<GameObject>("AugaTextInput");
Assets.AugaBarber = assetBundle.LoadAsset<GameObject>("AugaBarber");
Assets.AugaChat = assetBundle.LoadAsset<GameObject>("AugaChat");
Assets.DamageText = assetBundle.LoadAsset<GameObject>("AugaDamageText");
Assets.EnemyHud = assetBundle.LoadAsset<GameObject>("AugaEnemyHud");
Expand Down
5 changes: 4 additions & 1 deletion Auga/Auga.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' == 'API|AnyCPU' ">
<Compile Include="API.External.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(Configuration)|$(Platform)' != 'API|AnyCPU' ">
<Compile Include="API.cs" />
Expand Down Expand Up @@ -186,6 +187,8 @@
</ItemGroup>
<ItemGroup>
<Compile Include="API.Common.cs" />
<Compile Include="Barber_Setup.cs" />
<Compile Include="SkillsDialog_Patch.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="..\CHANGELOG.md">
Expand All @@ -200,7 +203,7 @@
)

if $(ConfigurationName) == API (
xcopy "$(TargetDir)$(TargetFileName)" "C:\Users\rknapp\Documents\GitHub\ValheimMods\Libs\" /q /y /i
xcopy "$(TargetDir)$(TargetFileName)" "M:\Code\VapokModBase\References\AugaAPI\" /q /y /i
) else (
xcopy "$(TargetDir)$(TargetFileName)" "C:\Program Files (x86)\Steam\steamapps\common\Valheim\BepInEx\plugins\$(ProjectName)\" /q /y /i
xcopy "$(TargetDir)$(TargetFileName).mdb" "C:\Program Files (x86)\Steam\steamapps\common\Valheim\BepInEx\plugins\$(ProjectName)\" /q /y /i
Expand Down
17 changes: 17 additions & 0 deletions Auga/Barber_Setup.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using HarmonyLib;
using UnityEngine;

namespace Auga;

[HarmonyPatch]
public static class Barber_Setup
{
[HarmonyPatch(typeof(PlayerCustomizaton), nameof(PlayerCustomizaton.OnEnable))]
public static class PlayerCustomization_Awake_Patch
{
public static bool Prefix(PlayerCustomizaton __instance)
{
return !SetupHelper.DirectObjectReplace(__instance.transform, Auga.Assets.AugaBarber, "BarberGui");
}
}
}
15 changes: 12 additions & 3 deletions Auga/Chat_Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ public static class Chat_Awake_Patch
{
public static bool Prefix(Chat __instance)
{
if (!Auga.AugaChatShow.Value || Auga.HasChatter)
if (Auga.HasChatter)
return true;

if (!Auga.AugaChatShow.Value )
return true;

return !SetupHelper.IndirectTwoObjectReplace(__instance.transform, Auga.Assets.AugaChat, "Chat", "Chat_box", "AugaChat");
}

public static void Postfix(Chat __instance)
{
if (!Auga.AugaChatShow.Value || Auga.HasChatter)
if (Auga.HasChatter)
return;

if (!Auga.AugaChatShow.Value )
return;

if (__instance.m_input != null)
Expand All @@ -33,7 +39,10 @@ public static class Chat_SetNpcText_Patch
{
public static void Postfix(Chat __instance)
{
if (!Auga.AugaChatShow.Value || Auga.HasChatter)
if (Auga.HasChatter)
return;

if (!Auga.AugaChatShow.Value)
return;

var latestChatMessage = __instance.m_npcTexts.LastOrDefault();
Expand Down
54 changes: 35 additions & 19 deletions Auga/Hud_Setup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Reflection.Emit;
using AugaUnity;
using BepInEx;
using HarmonyLib;
using JetBrains.Annotations;
using TMPro;
Expand All @@ -17,37 +18,42 @@ namespace Auga
public static class Hud_Setup
{
[HarmonyPatch(nameof(Hud.Awake))]
[HarmonyPriority(Priority.First)]
[HarmonyPostfix]
public static void Hud_Awake_Postfix(Hud __instance)
{

var hotkeyBar = __instance.Replace("hudroot/HotKeyBar", Auga.Assets.Hud, "hudroot/HotKeyBar");
hotkeyBar.gameObject.AddComponent<MovableHudElement>().Init(TextAnchor.UpperLeft, 55, -44);

__instance.m_statusEffectListRoot = null;
__instance.m_statusEffectTemplate = new GameObject("DummyStatusEffectTemplate", typeof(RectTransform)).RectTransform();

var newStatusEffects = __instance.Replace("hudroot/StatusEffects", Auga.Assets.Hud);
newStatusEffects.gameObject.AddComponent<MovableHudElement>().Init(TextAnchor.UpperRight, -40, -330);
var newTemplate = newStatusEffects.Find("StatusEffectsExt/SE_Template");
var newExternalRoot = newStatusEffects.Find("StatusEffectsExt");
var newInternalRoot = newStatusEffects.Find("StatusEffectsInt");

newInternalRoot.gameObject.AddComponent<MovableHudElement>().Init("Status Effect List",TextAnchor.UpperRight, -40, 0);
newExternalRoot.gameObject.AddComponent<MovableHudElement>().Init("Abilities and Other Statuses",TextAnchor.UpperRight, -160, 0);
__instance.m_statusEffectTemplate = newTemplate.RectTransform();
__instance.m_statusEffectListRoot = newExternalRoot.RectTransform();


__instance.m_saveIcon = __instance.Replace("hudroot/SaveIcon", Auga.Assets.Hud).gameObject;
__instance.m_saveIconImage = __instance.m_saveIcon.GetComponent<Image>();
__instance.m_badConnectionIcon = __instance.Replace("hudroot/BadConnectionIcon", Auga.Assets.Hud).gameObject;



var originalDreamTexts = __instance.m_sleepingProgress.GetComponent<SleepText>().m_dreamTexts;
var loadingScreen = __instance.Replace("LoadingBlack", Auga.Assets.Hud);
__instance.m_loadingScreen = loadingScreen.GetComponent<CanvasGroup>();
__instance.m_loadingProgress = loadingScreen.Find("Loading").gameObject;
__instance.m_sleepingProgress = loadingScreen.Find("Sleeping").gameObject;
__instance.m_teleportingProgress = loadingScreen.Find("Teleporting").gameObject;
__instance.m_loadingImage = loadingScreen.Find("Loading/Image").GetComponent<Image>();
__instance.m_loadingTip = loadingScreen.Find("Loading/Tip").GetComponent<Text>();
__instance.m_loadingTip = loadingScreen.Find("Loading/Tip").GetComponent<TMP_Text>();
__instance.m_sleepingProgress.GetComponent<SleepText>().m_dreamTexts = originalDreamTexts;


__instance.m_eventBar = __instance.Replace("hudroot/EventBar", Auga.Assets.Hud).gameObject;
__instance.m_eventName = __instance.m_eventBar.GetComponentInChildren<Text>();
__instance.m_eventName = __instance.m_eventBar.GetComponentInChildren<TMP_Text>();
__instance.m_eventBar.gameObject.AddComponent<MovableHudElement>().Init(TextAnchor.UpperCenter, 0, -90);

__instance.m_damageScreen = __instance.Replace("hudroot/Damaged", Auga.Assets.Hud).GetComponent<Image>();
Expand All @@ -68,14 +74,15 @@ public static void Hud_Awake_Postfix(Hud __instance)


var originalGuardianPowerMaterial = __instance.m_gpIcon.material;

__instance.m_gpRoot = (RectTransform)__instance.Replace("hudroot/GuardianPower", Auga.Assets.Hud);
__instance.m_gpName = __instance.m_gpRoot.Find("Name").GetComponent<Text>();
__instance.m_gpName = __instance.m_gpRoot.Find("Name").GetComponent<TMP_Text>();
__instance.m_gpIcon = __instance.m_gpRoot.Find("Icon").GetComponent<Image>();
__instance.m_gpIcon.material = originalGuardianPowerMaterial;
__instance.m_gpCooldown = __instance.m_gpRoot.Find("TimeText").GetComponent<Text>();
__instance.m_gpCooldown = __instance.m_gpRoot.Find("GPTimeText").GetComponent<TMP_Text>();

__instance.m_gpRoot.gameObject.AddComponent<MovableHudElement>().Init(TextAnchor.LowerLeft, 60, 70);

foreach (Transform child in __instance.m_healthPanel)
{
Object.Destroy(child.gameObject);
Expand Down Expand Up @@ -120,7 +127,7 @@ public static void Hud_Awake_Postfix(Hud __instance)
__instance.m_eitrText = null;

__instance.m_actionBarRoot = __instance.Replace("hudroot/action_progress", Auga.Assets.Hud).gameObject;
__instance.m_actionName = __instance.m_actionBarRoot.GetComponentInChildren<Text>();
__instance.m_actionName = __instance.m_actionBarRoot.GetComponentInChildren<TMP_Text>();
__instance.m_actionProgress = __instance.m_actionBarRoot.GetComponent<GuiBar>();
__instance.m_actionBarRoot.gameObject.AddComponent<MovableHudElement>().Init("ActionProgress", TextAnchor.LowerCenter, 0, 226);

Expand Down Expand Up @@ -165,8 +172,8 @@ public static void Hud_Awake_Postfix(Hud __instance)
__instance.m_pieceSelectionWindow.AddComponent<MovableHudElement>().Init(TextAnchor.MiddleCenter, 0, 0);

var selectedPiece = __instance.m_buildHud.transform.Find("SelectedPiece");
__instance.m_buildSelection = selectedPiece.Find("Name").GetComponent<Text>();
__instance.m_pieceDescription = selectedPiece.Find("Info").GetComponent<Text>();
__instance.m_buildSelection = selectedPiece.Find("Name").GetComponent<TMP_Text>();
__instance.m_pieceDescription = selectedPiece.Find("Info").GetComponent<TMP_Text>();
__instance.m_buildIcon = selectedPiece.Find("Darken/IconBG/PieceIcon").GetComponent<Image>();
selectedPiece.gameObject.AddComponent<MovableHudElement>().Init(TextAnchor.LowerCenter, 0, 15);

Expand Down Expand Up @@ -373,8 +380,8 @@ public static void SetupPieceInfo(Hud instance, Piece piece)
GameObject requirementItem = instance.m_requirementItems[piece.m_resources.Length];
requirementItem.SetActive(true);
Image component1 = requirementItem.transform.Find("res_icon").GetComponent<Image>();
Text component2 = requirementItem.transform.Find("res_name").GetComponent<Text>();
Text component3 = requirementItem.transform.Find("res_amount").GetComponent<Text>();
TMP_Text component2 = requirementItem.transform.Find("res_name").GetComponent<TMP_Text>();
TMP_Text component3 = requirementItem.transform.Find("res_amount").GetComponent<TMP_Text>();
UITooltip component4 = requirementItem.GetComponent<UITooltip>();
component1.sprite = piece.m_craftingStation.m_icon;
component2.text = Localization.instance.Localize(piece.m_craftingStation.m_name);
Expand Down Expand Up @@ -617,7 +624,10 @@ public static class Hud_UpdatePieceList_Patch
{
public static bool Prefix(Hud __instance, Player player, Vector2Int selectedNr, Piece.PieceCategory category, bool updateAllBuildStatuses)
{
if (!Auga.BuildMenuShow.Value || Auga.HasSearsCatalog)
if (Auga.HasSearsCatalog)
return true;

if (!Auga.BuildMenuShow.Value )
return true;

var buildPieces = player.GetBuildPieces();
Expand Down Expand Up @@ -691,7 +701,10 @@ public static class PieceTable_PrevCategory_Patch
{
public static bool Prefix(ref PieceTable __instance)
{
if (!Auga.BuildMenuShow.Value || Auga.HasSearsCatalog)
if (Auga.HasSearsCatalog)
return true;

if (!Auga.BuildMenuShow.Value )
return true;

return Input.GetAxis("Mouse ScrollWheel") == 0;
Expand Down Expand Up @@ -720,7 +733,10 @@ public static class PieceTable_NextCategory_Patch
{
public static bool Prefix(ref PieceTable __instance)
{
if (!Auga.BuildMenuShow.Value || Auga.HasSearsCatalog)
if (Auga.HasSearsCatalog)
return true;

if (!Auga.BuildMenuShow.Value )
return true;

return Input.GetAxis("Mouse ScrollWheel") == 0;
Expand Down
Loading