Skip to content

Commit

Permalink
Make silver/rainbow chapter card reskinnable through Everest
Browse files Browse the repository at this point in the history
  • Loading branch information
maddie480 committed Feb 9, 2021
1 parent b4ccd33 commit 5d2ec15
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion UI/InGameOverworldHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,19 @@ private static void ModOuiChapterPanelRender(ILContext il) {
cursor.Index = 0;

// 3. Turn the chapter card silver or rainbow instead of gold when relevant.
while (cursor.TryGotoNext(MoveType.After, instr => instr.MatchLdstr("areaselect/cardtop_golden") || instr.MatchLdstr("areaselect/card_golden"))) {
while (cursor.TryGotoNext(MoveType.After,
instr => instr.MatchLdstr("areaselect/cardtop_golden") || instr.MatchLdstr("areaselect/card_golden"),
instr => instr.MatchLdarg(0),
instr => instr.MatchCall<OuiChapterPanel>("_ModCardTexture"))) {

Logger.Log("CollabUtils2/InGameOverworldHelper", $"Modding chapter panel card at {cursor.Index} in IL for OuiChapterPanel.Render");

cursor.EmitDelegate<Func<string, string>>(orig => {
if (orig != "areaselect/cardtop_golden" && orig != "areaselect/card_golden") {
// chapter card was reskinned through Everest, so don't change it.
return orig;
}

if (isPanelShowingLobby()) {
return orig == "areaselect/cardtop_golden" ? "CollabUtils2/chapterCard/cardtop_rainbow" : "CollabUtils2/chapterCard/card_rainbow";
}
Expand Down

0 comments on commit 5d2ec15

Please sign in to comment.