Skip to content

Commit

Permalink
Merge pull request #92 from InfernoDragon0/main
Browse files Browse the repository at this point in the history
initial update to Unholy Alliance
  • Loading branch information
xhayper authored Aug 14, 2024
2 parents 51db3ac + bb13fe7 commit 87f6561
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 27 deletions.
2 changes: 1 addition & 1 deletion COTL_API/COTL_API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Import Project="../COTL_API.Common.props"/>

<ItemGroup>
<PackageReference Include="CultOfTheLamb.GameLibs" Version="1.3.3.344-r.0"/>
<PackageReference Include="CultOfTheLamb.GameLibs" Version="1.4.3.588-r.0"/>
<Reference Include="UnifyLibrary">
<HintPath>..\lib\UnifyLibrary.dll</HintPath>
</Reference>
Expand Down
2 changes: 1 addition & 1 deletion COTL_API/CustomInventory/Patches/CustomItemSpawnPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private static bool Prefix(InventoryItem.ITEM_TYPE type, int quantity, Vector3 p
}

[HarmonyPatch(typeof(ObjectPool), nameof(ObjectPool.Spawn), typeof(string), typeof(Vector3), typeof(Quaternion),
typeof(Transform), typeof(Action<GameObject>))]
typeof(Transform), typeof(Action<GameObject>), typeof(bool))]
private static class ObjectPoolSpawnStringPatches
{
[HarmonyPrefix]
Expand Down
4 changes: 3 additions & 1 deletion COTL_API/CustomLocalization/CustomLocalizationPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ private static bool GameSettings_OnLanguageChanged(GameSettings __instance, int
SettingsManager.Settings.Game.Language = text;
LocalizationManager.CurrentLanguage = text;
__instance._cachedLanguage = text;
if (TwitchAuthentication.IsAuthenticated) TwitchRequest.SendEBSData();

if (TwitchAuthentication.IsAuthenticated)
TwitchManager.SetLanguage(LocalizationManager.CurrentLanguageCode);

UnityEngine.Debug.Log("GameSettings - Change Language to " + text);
LocalizationManager.LocalizeAll(true);
Expand Down
7 changes: 5 additions & 2 deletions COTL_API/CustomRelics/CustomRelicData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using I2.Loc;
using I2.Loc;
using UnityEngine;

namespace COTL_API.CustomRelics;

Expand All @@ -10,10 +11,12 @@ public CustomRelicData()
{
UISprite = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
UISpriteOutline = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
WorldSprite = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
CleansedSprite = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
CleansedSpriteOutline = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
InteractionType = RelicInteractionType.Charging;
}


public abstract string InternalName { get; }

public virtual bool CanBeBlessed => false;
Expand Down
14 changes: 10 additions & 4 deletions COTL_API/CustomSkins/CustomSkinPatches.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using HarmonyLib;
using HarmonyLib;
using Lamb.UI;
using LeTai.Asset.TranslucentImage;
using Spine;
Expand Down Expand Up @@ -114,17 +114,22 @@ private static bool PlayerFarming_SetSkin(ref Skin __result, PlayerFarming __ins

if (PlayerSkinOverride == null) return true;

__instance.IsGoat = DataManager.Instance.PlayerVisualFleece == 1003;
__instance.PlayerSkin = new Skin("Player Skin");

var skin = PlayerSkinOverride[0] ??
(!__instance.isLamb || __instance.IsGoat ? __instance.Spine.Skeleton.Data.FindSkin("Goat") :
__instance.Spine.Skeleton.Data.FindSkin("Lamb_" + DataManager.Instance.PlayerFleece +
(BlackAndWhite ? "_BW" : ""));
(BlackAndWhite ? "_BW" : "")));
__instance.PlayerSkin.AddSkin(skin);
var text = WeaponData.Skins.Normal.ToString();
if (DataManager.Instance.CurrentWeapon != EquipmentType.None)
text = EquipmentManager.GetWeaponData(DataManager.Instance.CurrentWeapon).Skin.ToString();

if (__instance.currentWeapon != EquipmentType.None)
text = EquipmentManager.GetWeaponData(__instance.currentWeapon).Skin.ToString();

var skin2 = __instance.Spine.Skeleton.Data.FindSkin("Weapons/" + text);
__instance.PlayerSkin.AddSkin(skin2);

if (__instance.health.HP + __instance.health.BlackHearts + __instance.health.BlueHearts +
__instance.health.SpiritHearts <= 1f && !Mathf.Approximately(DataManager.Instance.PLAYER_TOTAL_HEALTH, 2f))
{
Expand All @@ -144,6 +149,7 @@ private static bool PlayerFarming_SetSkin(ref Skin __result, PlayerFarming __ins
__instance.PlayerSkin.AddSkin(skin4);
}

__instance.PlayerSkin.AddSkin(__instance.Spine.Skeleton.Data.FindSkin("Mops/" + Mathf.Clamp(__instance.isLamb ? DataManager.Instance.ChoreXPLevel + 1 : DataManager.Instance.ChoreXPLevel_Coop + 1, 0, 9).ToString()));
__instance.Spine.Skeleton.SetSkin(__instance.PlayerSkin);
__instance.Spine.Skeleton.SetSlotsToSetupPose();
__result = __instance.PlayerSkin;
Expand Down
6 changes: 3 additions & 3 deletions COTL_API/CustomStructures/CustomStructurePatches.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using HarmonyLib;
using HarmonyLib;
using Lamb.UI.BuildMenu;
using UnityEngine;

Expand Down Expand Up @@ -227,9 +227,9 @@ private static bool StructuresData_CanBeFlipped(StructureBrain.TYPES type, ref b
return false;
}

[HarmonyPatch(typeof(Structure), nameof(Structure.Start))]
[HarmonyPatch(typeof(Structure), nameof(Structure.BrainAssigned))]
[HarmonyPostfix]
private static void Structure_Start(Structure __instance)
private static void Structure_BrainAssigned(Structure __instance)
{
if (!CustomStructureList.TryGetValue(__instance.Type, out var value)) return;
if (value.Interaction == null) return;
Expand Down
8 changes: 4 additions & 4 deletions COTL_API/CustomTarotCard/CustomTarotCard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public abstract class CustomTarotCard
public virtual string LocalisedName()
{
var upgradeIndex =
(from playerRunTrinket in DataManager.Instance.PlayerRunTrinkets
where playerRunTrinket.CardType == CardType
(from playerRunTrinket in PlayerFarming.Instance.RunTrinkets
where playerRunTrinket.CardType == CardType
select playerRunTrinket.UpgradeIndex).FirstOrDefault();

return LocalisedName(upgradeIndex);
Expand All @@ -58,8 +58,8 @@ public virtual string LocalisedName(int upgradeIndex)
public virtual string LocalisedDescription()
{
var upgradeIndex =
(from playerRunTrinket in DataManager.Instance.PlayerRunTrinkets
where playerRunTrinket.CardType == CardType
(from playerRunTrinket in PlayerFarming.Instance.RunTrinkets
where playerRunTrinket.CardType == CardType
select playerRunTrinket.UpgradeIndex).FirstOrDefault();

return LocalisedDescription(upgradeIndex);
Expand Down
8 changes: 4 additions & 4 deletions COTL_API/CustomTarotCard/CustomTarotCardPatches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ private static bool TarotCards_LocalisedName(TarotCards.Card Card, int upgradeIn
return false;
}

[HarmonyPatch(typeof(TarotCards), nameof(TarotCards.LocalisedDescription), typeof(TarotCards.Card))]
[HarmonyPatch(typeof(TarotCards), nameof(TarotCards.LocalisedDescription), typeof(TarotCards.Card), typeof(PlayerFarming))]
[HarmonyPrefix]
private static bool TarotCards_LocalisedDescription(TarotCards.Card Type, ref string __result)
private static bool TarotCards_LocalisedDescription(TarotCards.Card Type, PlayerFarming playerFarming, ref string __result)
{
if (!CustomTarotCardList.TryGetValue(Type, out var value)) return true;

Expand All @@ -86,9 +86,9 @@ private static bool TarotCards_LocalisedDescription(TarotCards.Card Type, ref st
return false;
}

[HarmonyPatch(typeof(TarotCards), nameof(TarotCards.LocalisedDescription), typeof(TarotCards.Card), typeof(int))]
[HarmonyPatch(typeof(TarotCards), nameof(TarotCards.LocalisedDescription), typeof(TarotCards.Card), typeof(int), typeof(PlayerFarming))]
[HarmonyPrefix]
private static bool TarotCards_LocalisedDescription(TarotCards.Card Type, int upgradeIndex, ref string __result)
private static bool TarotCards_LocalisedDescription(TarotCards.Card Type, PlayerFarming playerFarming, int upgradeIndex, ref string __result)
{
if (!CustomTarotCardList.TryGetValue(Type, out var value)) return true;

Expand Down
5 changes: 1 addition & 4 deletions COTL_API/Debug/DebugCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ private static bool UITarotChoiceOverlayController_Show(UITarotChoiceOverlayCont
{
if (Plugin.Instance == null || !Plugin.Instance.Debug) return true;

DataManager.Instance.PlayerRunTrinkets.Remove(card1);
DataManager.Instance.PlayerRunTrinkets.Remove(card2);

__instance._card1 = GetRandModdedCard();
__instance._card2 = GetRandVanillaCard();
__instance._uiCard1.Play(__instance._card1);
Expand All @@ -52,7 +49,7 @@ internal static TarotCards.TarotCard GetRandVanillaCard()
List<TarotCards.Card> vanillaCardList = new(DataManager.Instance.PlayerFoundTrinkets);
vanillaCardList.RemoveAll(c =>
CustomTarotCardManager.CustomTarotCardList.ContainsKey(c) ||
DataManager.Instance.PlayerRunTrinkets.Any(t => t.CardType == c));
PlayerFarming.Instance.RunTrinkets.Any(t => t.CardType == c));

return new TarotCards.TarotCard(
vanillaCardList.ElementAt(Random.Range(0,
Expand Down
5 changes: 3 additions & 2 deletions COTL_API/Debug/DebugRelicClass.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using COTL_API.CustomRelics;
using COTL_API.CustomRelics;

namespace COTL_API.Debug;

Expand All @@ -23,7 +23,8 @@ public override void Init()
{
UISprite = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
UISpriteOutline = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
WorldSprite = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
CleansedSprite = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
CleansedSpriteOutline = TextureHelper.CreateSpriteFromPath(PluginPaths.ResolveAssetPath("placeholder.png"));
DamageRequiredToCharge = 5.0f;
}

Expand Down
2 changes: 1 addition & 1 deletion COTL_API/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ private void RunSavePatch()
LocalizationManager.CurrentLanguage = "English";

if (TwitchAuthentication.IsAuthenticated)
TwitchRequest.SendEBSData();
TwitchManager.SetLanguage(LocalizationManager.CurrentLanguageCode);

LocalizationManager.LocalizeAll(true);
};
Expand Down

0 comments on commit 87f6561

Please sign in to comment.