Сумка зомби: лут по E, как у волка (ящики, мешки, предметы с земли)

WolfBag.Target - текущая сумка (зомби, если он с сумкой, иначе волка): обыск, подбор, окно рюкзака при обыске и подсказки общие. Тексты «Сумка зомби» и подсказка E - 13 языков.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
AlexCube
2026-10-13 17:12:26 +03:00
co-authored by Claude Opus 5.5
parent eb6c5fb4f1
commit 9717ae200d
6 changed files with 46 additions and 15 deletions
+30 -14
View File
@@ -85,6 +85,22 @@ namespace NecromancerTome
return _bag;
}
/// <summary>Сумка, куда идёт лут сейчас (13.10): одержимого зомби (ZombieBag), если он с сумкой, иначе волка.
/// Обыск, подбор с земли, окно рюкзака при обыске и подсказки - общие, разница только здесь.</summary>
public static Bag Target => ZombieBag.Active ? ZombieBag.Current : Get();
public static int TargetSlots => ZombieBag.Active ? ZombieBag.Current.SlotCount : Slots;
static void SaveTarget()
{
if (ZombieBag.Active)
{
Version++;
ZombieBag.SaveNow();
return;
}
Save();
}
static void Save()
{
Version++;
@@ -108,7 +124,7 @@ namespace NecromancerTome
public static string Describe()
{
Bag b = Get();
Bag b = Target;
List<string> parts = new List<string>();
foreach (ItemStack s in b.ItemGrid.items)
{
@@ -125,7 +141,7 @@ namespace NecromancerTome
EntityPlayerLocal p = GameManager.Instance?.World?.GetPrimaryPlayer();
if (p != null)
{
GameManager.ShowTooltip(p, string.Format(Localization.Get(_key), Describe(), Get().GetUsedSlotCount(), Slots));
GameManager.ShowTooltip(p, string.Format(Localization.Get(ZombieBag.Active ? _key.Replace("necroWolfBag", "necroZombieBag") : _key), Describe(), Target.GetUsedSlotCount(), TargetSlots));
}
}
@@ -168,7 +184,7 @@ namespace NecromancerTome
{
return null;
}
Bag b = Get();
Bag b = Target;
ItemStack moving = src.Clone();
int before = moving.count;
b.TryStackItem(0, moving);
@@ -185,7 +201,7 @@ namespace NecromancerTome
}
ItemStack rest = src.Clone();
rest.count = moving.count;
Save();
SaveTarget();
Audio.Manager.PlayInsidePlayerHead("UseActions/takeall1");
Show("necroWolfBagTook");
Debug.Log("[NecromancerTome] WolfBag: в сумку " + src.itemValue.ItemClass.GetItemName() + " x" + moved + " - " + Describe());
@@ -234,7 +250,7 @@ namespace NecromancerTome
public static void PutAll(TEFeatureStorage _te, EntityLootContainer _bag, bool _similarOnly)
{
bool any = false;
ItemStack[] slots = Get().ItemGrid.items;
ItemStack[] slots = Target.ItemGrid.items;
for (int i = 0; i < slots.Length; i++)
{
if (slots[i] == null || slots[i].IsEmpty())
@@ -257,14 +273,14 @@ namespace NecromancerTome
/// <summary>«Сортировать» - по самой сумке.</summary>
public static void Sort()
{
Get().ItemGrid.Sort();
Save();
Target.ItemGrid.Sort();
SaveTarget();
}
/// <summary>Переложить ячейку сумки в массив ячеек контейнера (сами ячейки меняются, номера - в _changed).</summary>
static bool Give(int _idx, ItemStack[] _g, List<int> _changed)
{
Bag b = Get();
Bag b = Target;
ItemStack src = _idx < b.SlotCount ? b.ItemGrid.items[_idx] : null;
if (src == null || src.IsEmpty())
{
@@ -302,7 +318,7 @@ namespace NecromancerTome
ItemStack rest = src.Clone();
rest.count = left;
b.SetSlot(_idx, left > 0 ? rest : ItemStack.Empty.Clone());
Save();
SaveTarget();
Audio.Manager.PlayInsidePlayerHead("UseActions/takeall1");
Debug.Log("[NecromancerTome] WolfBag: из сумки в контейнер " + name + " x" + moved + " - " + Describe());
return true;
@@ -360,7 +376,7 @@ namespace NecromancerTome
bool any = false;
for (int i = 0; i < _te.ItemGrid.items.Length; i++)
{
if (!_te.ItemGrid.items[i].IsEmpty() && Get().CanTakeItem(_te.ItemGrid.items[i]))
if (!_te.ItemGrid.items[i].IsEmpty() && Target.CanTakeItem(_te.ItemGrid.items[i]))
{
any |= TakeFrom(_te, i);
}
@@ -379,7 +395,7 @@ namespace NecromancerTome
ItemStack[] slots = _src.bag.ItemGrid.items;
for (int i = 0; i < slots.Length; i++)
{
if (!slots[i].IsEmpty() && Get().CanTakeItem(slots[i]))
if (!slots[i].IsEmpty() && Target.CanTakeItem(slots[i]))
{
any |= TakeFrom(_src, i);
}
@@ -665,7 +681,7 @@ namespace NecromancerTome
public static ItemStack[] Slots(int _n)
{
ItemStack[] a = new ItemStack[_n];
ItemStack[] b = WolfBag.Get().ItemGrid.items;
ItemStack[] b = WolfBag.Target.ItemGrid.items;
for (int i = 0; i < _n; i++)
{
a[i] = i < b.Length && b[i] != null ? b[i].Clone() : ItemStack.Empty.Clone();
@@ -684,7 +700,7 @@ namespace NecromancerTome
for (int i = 0; c != null && i < c.Length; i++)
{
c[i].IsLocked = true;
if (i >= WolfBag.Slots && c[i].ViewComponent.IsVisible)
if (i >= WolfBag.TargetSlots && c[i].ViewComponent.IsVisible)
{
c[i].ViewComponent.IsVisible = false;
_hidden.Add(c[i]);
@@ -729,7 +745,7 @@ namespace NecromancerTome
{
return true;
}
__result = WolfBagBackpack.Slots(__instance.itemControllers?.Length ?? WolfBag.Slots);
__result = WolfBagBackpack.Slots(__instance.itemControllers?.Length ?? WolfBag.TargetSlots);
return false;
}
}