@@ -62,6 +62,8 @@ public static bool Prefix(string prefix, ref string __result)
6262
6363 internal static class ModBigEnergyIconHelper
6464 {
65+ private static readonly Lock UnmappedContentWarningGate = new ( ) ;
66+ private static readonly HashSet < string > UnmappedContentWarningLoggedKeys = new ( StringComparer . Ordinal ) ;
6567 private static Dictionary < string , string > ? _cache ;
6668
6769 public static bool TryOverridePath ( string prefix , ref string result )
@@ -82,18 +84,71 @@ private static Dictionary<string, string> BuildCache()
8284 foreach ( var character in ModContentRegistry . GetModCharacters ( ) )
8385 AddPoolIfMapped ( dict , character . CardPool ) ;
8486
85- foreach ( var pool in ModelDb . AllCards . Select ( c => c . Pool ) . Distinct ( ) )
87+ var cardPools = ModelDb . AllCardPools . ToArray ( ) ;
88+ foreach ( var pool in cardPools )
8689 AddPoolIfMapped ( dict , pool ) ;
90+ WarnUnmappedCards ( cardPools ) ;
8791
88- foreach ( var pool in ModelDb . AllRelics . Select ( r => r . Pool ) . Distinct ( ) )
92+ var relicPools = ModelDb . AllRelicPools . ToArray ( ) ;
93+ foreach ( var pool in relicPools )
8994 AddPoolIfMapped ( dict , pool ) ;
95+ WarnUnmappedRelics ( relicPools ) ;
9096
91- foreach ( var pool in ModelDb . AllPotions . Select ( p => p . Pool ) . Distinct ( ) )
97+ var potionPools = ModelDb . AllPotionPools . ToArray ( ) ;
98+ foreach ( var pool in potionPools )
9299 AddPoolIfMapped ( dict , pool ) ;
100+ WarnUnmappedPotions ( potionPools ) ;
93101
94102 return dict ;
95103 }
96104
105+ private static void WarnUnmappedCards ( CardPoolModel [ ] pools )
106+ {
107+ foreach ( var card in ModelDb . AllCards )
108+ {
109+ if ( pools . Any ( pool => pool . AllCardIds . Contains ( card . Id ) ) )
110+ continue ;
111+
112+ WarnUnmappedContentOnce ( "card" , card . Id ) ;
113+ }
114+ }
115+
116+ private static void WarnUnmappedRelics ( RelicPoolModel [ ] pools )
117+ {
118+ foreach ( var relic in ModelDb . AllRelics )
119+ {
120+ if ( pools . Any ( pool => pool . AllRelicIds . Contains ( relic . Id ) ) )
121+ continue ;
122+
123+ WarnUnmappedContentOnce ( "relic" , relic . Id ) ;
124+ }
125+ }
126+
127+ private static void WarnUnmappedPotions ( PotionPoolModel [ ] pools )
128+ {
129+ foreach ( var potion in ModelDb . AllPotions )
130+ {
131+ if ( pools . Any ( pool => pool . AllPotionIds . Contains ( potion . Id ) ) )
132+ continue ;
133+
134+ WarnUnmappedContentOnce ( "potion" , potion . Id ) ;
135+ }
136+ }
137+
138+ private static void WarnUnmappedContentOnce ( string contentType , ModelId id )
139+ {
140+ var key = contentType + "\0 " + id ;
141+ lock ( UnmappedContentWarningGate )
142+ {
143+ if ( ! UnmappedContentWarningLoggedKeys . Add ( key ) )
144+ return ;
145+ }
146+
147+ RitsuLibFramework . Logger . Warn (
148+ $ "[Content] { contentType } '{ id } ' is registered in ModelDb but is not contained in any { contentType } pool. " +
149+ "Skipping it while building energy icon overrides." ) ;
150+ }
151+
97152 private static void AddPoolIfMapped ( Dictionary < string , string > dict , IPoolModel pool )
98153 {
99154 if ( pool is not IModBigEnergyIconPool mapped )
0 commit comments