public static void PatchGameTime_Bind(PlayerChapter __instance) { try { PatchGoldAmount(__instance); } catch (Exception ex) { _instance._logger.Error("Error patching gold amount: " + ex); } }
private static void PatchGoldAmount(PlayerChapter chapter) { var patcher = _instance._patcher; InventoryExt extension1 = chapter.Owner.GetExtension <InventoryExt>(); var goldText = patcher.GetField <LocalizedText>(chapter, "m_goldText"); int resource1 = extension1.GetResource(GameData.Instance.GoldResource); int goldRetainAmount = Game.Instance.ResourceManager.GetGoldRetainAmount(resource1); goldText.Text = resource1 < 0 || Game.Instance.Mode != Game.GameMode.Story ? "{" + resource1.ToString() + "}" : string.Format("{0} {{{1}}}", resource1, goldRetainAmount); }