From 4ef7aac01f5c0f332c2d5ba4ca2d23e08b92d8dc Mon Sep 17 00:00:00 2001 From: AlexCube Date: Thu, 1 Oct 2026 11:13:21 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D0=BA=D0=B0=D0=BA=D1=83=D0=BD:=204=20?= =?UTF-8?q?=D1=8F=D1=87=D0=B5=D0=B9=D0=BA=D0=B8=20=D0=B8=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=80=D0=BE=D0=BC=D1=83=20=D0=BF=D1=80=D0=B5=D0=B4=D0=BC?= =?UTF-8?q?=D0=B5=D1=82=D1=83,=20=D0=BA=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20?= =?UTF-8?q?=C2=AB=D0=97=D0=B0=D0=BF=D1=80=D0=B0=D0=B2=D0=B8=D1=82=D1=8C?= =?UTF-8?q?=C2=BB=20=D0=B2=D1=8B=D0=BA=D0=BB=D1=8E=D1=87=D0=B5=D0=BD=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- HarmonySrc/BoneSteedFuelPatch.cs | 49 +++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/HarmonySrc/BoneSteedFuelPatch.cs b/HarmonySrc/BoneSteedFuelPatch.cs index 2fc46c3..e7722c2 100644 --- a/HarmonySrc/BoneSteedFuelPatch.cs +++ b/HarmonySrc/BoneSteedFuelPatch.cs @@ -175,7 +175,20 @@ namespace NecromancerTome { public static bool Loading; - public static void Prefix() => Loading = true; + /// Скакун, сделанный до появления ячеек (или выданный без них), получает свои + /// 4 ячейки здесь: ItemValue размечает ячейки один раз при создании и сам не дорастает. + public static void Prefix(ItemValue _itemValue) + { + Loading = true; + if (!BoneSteedFuel.IsSteedItem(_itemValue) || _itemValue.ModificationCount >= BoneSteedFuel.Slots) + return; + var mods = new ItemValue[BoneSteedFuel.Slots]; + for (int i = 0; i < mods.Length; i++) + mods[i] = i < _itemValue.ModificationCount && _itemValue.modifications[i] != null + ? _itemValue.modifications[i] + : ItemValue.None.Clone(); + _itemValue.modifications = mods; + } public static void Finalizer(Vehicle __instance) { @@ -257,4 +270,38 @@ namespace NecromancerTome return false; } } + + /// Кнопка «Заправить» в окне обслуживания: у скакуна выключена, текст - «нельзя». + [HarmonyPatch(typeof(XUiC_VehicleFrameWindow), nameof(XUiC_VehicleFrameWindow.Update))] + public static class Patch_XUiC_VehicleFrameWindow_Update_BoneSteed + { + public static void Postfix(XUiC_VehicleFrameWindow __instance) + { + if (__instance.btnRefuel_Background != null && __instance.Vehicle != null && BoneSteed.Is(__instance.Vehicle)) + __instance.btnRefuel_Background.Enabled = false; + } + } + + [HarmonyPatch(typeof(XUiC_VehicleFrameWindow), "GetBindingValueInternal")] + public static class Patch_XUiC_VehicleFrameWindow_Binding_BoneSteed + { + public static void Postfix(XUiC_VehicleFrameWindow __instance, ref string value, string bindingName) + { + if (bindingName == "refueltext" && __instance.Vehicle != null && BoneSteed.Is(__instance.Vehicle)) + value = Localization.Get("xuiRefuelNotAllowed"); + } + } + + /// Страховка: любая ванильная заправка скакуна (кнопка, меню) ничего не делает. + [HarmonyPatch(typeof(EntityVehicle), nameof(EntityVehicle.AddFuelFromInventory))] + public static class Patch_EntityVehicle_AddFuelFromInventory_BoneSteed + { + public static bool Prefix(EntityVehicle __instance, ref bool __result) + { + if (!BoneSteed.Is(__instance)) + return true; + __result = false; + return false; + } + } }