@@ -25,13 +25,22 @@ public static void Postfix(ref SpellXml __result)
2525 {
2626 if ( fndValue . IsReplaced ) return ;
2727 fndValue . IsReplaced = true ;
28- var fndContext = TranslationDB . CardInfo [ contextId ] ;
2928 __result . name = fndValue . Translation ;
30- __result . context = fndContext . Translation ;
29+ if ( TranslationDB . CardInfo . TryGetValue ( contextId , out var fndContext ) )
30+ {
31+ __result . context = fndContext . Translation ;
32+ }
33+ else
34+ {
35+
36+ Logger . Log ( $ "Unexpected Replace Result { nameId } with { __result . name } , { contextId } with { __result . context } ") ;
37+ }
38+
3139 }
3240 }
3341 }
3442
43+
3544 [ HarmonyPatch ( typeof ( EnchantContainer ) , nameof ( EnchantContainer . LoadResource ) ) ]
3645 public static class EnchantPostfix
3746 {
@@ -56,7 +65,6 @@ public static void Postfix(ref EnchantContainer.EnchantXml __result)
5665 }
5766 }
5867 }
59-
6068 [ HarmonyPatch ( typeof ( Vocabulary ) , nameof ( Vocabulary . Load ) ) ]
6169 public static class VocabularyFix
6270 {
@@ -66,7 +74,7 @@ public static string[] ApplyLocalization(string[] input)
6674 . Select ( item => TranslationDB . VocabularyInfo . GetValueOrDefault ( item , item ) )
6775 . ToArray ( ) ;
6876 }
69-
77+
7078 public static void Postfix ( )
7179 {
7280 {
@@ -93,4 +101,5 @@ public static void Prefix(ScenarioComponent __instance, ref string str)
93101 Logger . Log ( $ "Translated:{ str } ") ;
94102 }
95103 }
104+
96105}
0 commit comments