Skip to content

Commit

Permalink
Merge pull request #319 from HumabHatterZed/main
Browse files Browse the repository at this point in the history
Fix index error when loading custom challenges, publicise SetPrefabModelType
  • Loading branch information
IngoHHacks authored Nov 29, 2024
2 parents da6e101 + a5e68a5 commit e3d3144
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Fixed pelt names when a user goes to the trader with modded cards, Examples shown below.
<img src="https://github.com/user-attachments/assets/49b9da13-e602-4020-a560-40344e9ef6af" width="750">
<img src="https://github.com/user-attachments/assets/4b432cc9-a0f7-4d75-99b4-8951ba46705b" width="750">
- Fixed index error when loading custom challenges
- Publicised ConsumableItemData.SetPrefabModelType

# 2.22.2
- Added GetEnergyConfig method to community patch's EnergyDrone class - retrieves the current Act's EnergyConfigInfo
Expand Down
9 changes: 5 additions & 4 deletions InscryptionAPI/Ascension/AscensionChallengePaginator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
int numBossesAdded = 0;

// 14 = regular + boss * 2
//Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {bossChallengeInfos.Count} | {bossStartingIndex}");
//Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {numBosses} | {bossStartingIndex}");

for (int i = 0; i < 14; i++)
{
Expand All @@ -88,7 +88,7 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
int columnIndex = i % 7;
//Debug.Log($"{i} ({columnIndex}) | {bossStartingIndex + numBosses} / {bossStartingIndex}");

if (columnIndex >= bossStartingIndex && columnIndex < bossStartingIndex + numBosses)
if (numBosses > 0 && columnIndex >= bossStartingIndex && columnIndex < bossStartingIndex + numBosses)
{
//Debug.Log($"In boss column {i}");
if (numBossesAdded < numBosses)
Expand Down Expand Up @@ -125,11 +125,11 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
int infoCount = challengeInfos.Count;
for (int i = 0; i < newPage.Count; i++)
{
AscensionChallengeInfo info = challengeInfos[infoIdx];
AscensionIconInteractable interactable = newPage[i].GetComponent<AscensionIconInteractable>();
//Debug.Log($"Checking icon [{i}] info at {infoIdx} : {info.title}");
//Debug.Log($"Checking icon [{i}] info at {infoIdx} : ({infoCount}) ({newPage.Count})");
if (i < infoCount)
{
AscensionChallengeInfo info = challengeInfos[infoIdx];
// if we're assigning boss info to an icon that isn't a boss icon
if (info.GetFullChallenge().Boss && (interactable.coll2D as BoxCollider2D).size.y < 1f)
{
Expand All @@ -146,6 +146,7 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
}
else
{
//Debug.Log("Missing challenge");
interactable.challengeInfo = missingChallengeInfo;
newPage[i].AddComponent<NoneChallengeDisplayer>();
}
Expand Down
2 changes: 1 addition & 1 deletion InscryptionAPI/Items/ConsumableItemDataExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public static string GetCardWithinBottle(this ConsumableItemData data)
}

/// <returns>The same ConsumableItemData so a chain can continue.</returns>
internal static ConsumableItemData SetPrefabModelType(this ConsumableItemData data, ConsumableItemManager.ModelType modelType)
public static ConsumableItemData SetPrefabModelType(this ConsumableItemData data, ConsumableItemManager.ModelType modelType)
{
data.SetExtendedProperty("PrefabModelType", (int)modelType);
return data;
Expand Down

0 comments on commit e3d3144

Please sign in to comment.