Скакун: 4 ячейки и старому предмету, кнопка «Заправить» выключена
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
24d6e9f675
commit
4ef7aac01f
@@ -175,7 +175,20 @@ namespace NecromancerTome
|
|||||||
{
|
{
|
||||||
public static bool Loading;
|
public static bool Loading;
|
||||||
|
|
||||||
public static void Prefix() => Loading = true;
|
/// <summary>Скакун, сделанный до появления ячеек (или выданный без них), получает свои
|
||||||
|
/// 4 ячейки здесь: ItemValue размечает ячейки один раз при создании и сам не дорастает.</summary>
|
||||||
|
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)
|
public static void Finalizer(Vehicle __instance)
|
||||||
{
|
{
|
||||||
@@ -257,4 +270,38 @@ namespace NecromancerTome
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>Кнопка «Заправить» в окне обслуживания: у скакуна выключена, текст - «нельзя».</summary>
|
||||||
|
[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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Страховка: любая ванильная заправка скакуна (кнопка, меню) ничего не делает.</summary>
|
||||||
|
[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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user