RynthSuite as of 2026-11-30 (internal 805a055): release 2026.11.30.1
This commit is contained in:
parent
95282c83fa
commit
e8e4228d15
19 changed files with 983 additions and 315 deletions
|
|
@ -1437,6 +1437,17 @@ public class WorldObjectCache
|
|||
/// This bypasses the crash-prone full cache scan and is the source of truth
|
||||
/// for crafting and ammo diagnostics.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Something just came into the inventory (a loot pickup landed): the next GetDirectInventory walks
|
||||
/// the packs again, forced or not. The list is otherwise reused for up to a second (250 ms when
|
||||
/// forced), and a sceptre on DreamWeave (2026-11-30 03:22) was left because the room check 3 ms after a
|
||||
/// quick pickup read the list from before the helm landed: one free slot, so no room move.
|
||||
/// </summary>
|
||||
public void ExpireDirectInventory()
|
||||
{
|
||||
lock (_gate) _lastDirectInventoryScan = DateTime.MinValue;
|
||||
}
|
||||
|
||||
public IReadOnlyList<WorldObject> GetDirectInventory(bool forceRefresh = false)
|
||||
{
|
||||
// Whole-body lock: the rescan clears+rebuilds _directInventory*, and callers may
|
||||
|
|
@ -1809,32 +1820,31 @@ public class WorldObjectCache
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Where a looted item goes: the main pack (the player) or 0. The pickup used to be a
|
||||
/// UseObject, which let the client pick the spot, but a use on a wearable item lying in a
|
||||
/// corpse is a get-and-wield: jewellery for an empty slot went straight onto the character
|
||||
/// (2026-10-02). So it is a move, and a move from a corpse or chest can only go to the main
|
||||
/// pack: the client refuses one straight into a side pack ("You must first pick up the X",
|
||||
/// and nothing is sent), so the side-pack fallback this used to return when the main pack
|
||||
/// was full never worked (2026-11-12: 75 such pickups in a week of logs, none landed; the
|
||||
/// looter waited out 3 + 3 tries on each and left them).
|
||||
/// Where a looted item goes: the main pack while it has a free slot, else the side pack with the
|
||||
/// most room, 0 when nothing has room. The pickup used to be a UseObject, which let the client pick
|
||||
/// the spot, but a use on a wearable item lying in a corpse is a get-and-wield: jewellery for an
|
||||
/// empty slot went straight onto the character (2026-10-02). So it is a move.
|
||||
/// <list type="bullet">
|
||||
/// <item>The main pack has a free slot: the main pack.</item>
|
||||
/// <item>It is full, and <paramref name="item"/> joins a stack you carry: the main pack anyway.
|
||||
/// The client puts a stack onto a same-name stack with room wherever that is (the pea stacks
|
||||
/// live in a side pack), so no slot is needed.</item>
|
||||
/// <item>Otherwise 0: nothing can take it from the corpse (<see cref="SidePackHasRoom"/> tells
|
||||
/// a full main pack from no room at all).</item>
|
||||
/// <item>Into the main pack the client's own move goes (MoveItemExternal).</item>
|
||||
/// <item>Into a side pack only the raw 0x19 PutItemInContainer packet goes (<see cref="RynthCoreHost.PutItemInContainer"/>,
|
||||
/// plugin API v80). The client's own move refuses a corpse or chest item aimed at a side pack ("You
|
||||
/// must first pick up the X", nothing sent: 2026-11-12, 75 such pickups in a week, none landed), but
|
||||
/// the server takes the packet as any pickup and puts the item in that pack (ACE
|
||||
/// HandleActionPutItemInContainer: a move from the world to the player's own container). On an engine
|
||||
/// without the packet a full main pack is the end (<see cref="SidePackHasRoom"/> tells that from no room at all).</item>
|
||||
/// </list>
|
||||
/// A stack you carry is no slot (2026-11-30): the client drops a pickup aimed at a full main pack
|
||||
/// whatever it would stack with; a DreamWeave hunt left every 'Obsidian Heartstone' from 03:27 to
|
||||
/// 05:02 that way.
|
||||
/// </summary>
|
||||
/// <remarks><paramref name="skip"/>: packs (or the player id, for the main pack) the server refused lately;
|
||||
/// a stack join needs no slot, so it goes whatever the main pack's mark.</remarks>
|
||||
/// <remarks><paramref name="skip"/>: packs (or the player id, for the main pack) the server refused lately.</remarks>
|
||||
public static int FindLootDestination(IReadOnlyList<WorldObject> inv, int playerId, RynthCoreHost? host = null,
|
||||
Func<int, bool>? skip = null, WorldObject? item = null)
|
||||
Func<int, bool>? skip = null)
|
||||
{
|
||||
if (inv == null || playerId == 0) return 0;
|
||||
if (item != null && JoinsCarriedStack(inv, playerId, item)) return playerId;
|
||||
if (MainPackFreeSlots(inv, playerId, host) > 0 && !(skip != null && skip(playerId))) return playerId;
|
||||
return 0;
|
||||
if (host is not { HasPutItemInContainer: true }) return 0;
|
||||
return FindPackFor(inv, playerId, includeMainPack: false, requireFree: 1, host, skip);
|
||||
}
|
||||
|
||||
/// <summary>The main pack's free item slots (102 less the loose items in it; packs, foci and worn items don't count).</summary>
|
||||
|
|
@ -1852,34 +1862,10 @@ public class WorldObjectCache
|
|||
return 102 - mainUsed;
|
||||
}
|
||||
|
||||
/// <summary>A side pack has a free slot (so a loot pickup that found no destination met a full main pack, not full packs).</summary>
|
||||
/// <summary>A side pack has a free slot (so a loot pickup that found no destination on an engine without the raw move met a full main pack, not full packs).</summary>
|
||||
public static bool SidePackHasRoom(IReadOnlyList<WorldObject> inv, int playerId, RynthCoreHost? host = null)
|
||||
=> inv != null && playerId != 0 && FindPackFor(inv, playerId, includeMainPack: false, requireFree: 1, host) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// <paramref name="item"/> stacks and a stack of the same kind you carry (main pack or a side
|
||||
/// pack) still has room for one more: a pickup aimed at the main pack joins it.
|
||||
/// </summary>
|
||||
internal static bool JoinsCarriedStack(IReadOnlyList<WorldObject> inv, int playerId, WorldObject item)
|
||||
{
|
||||
int max = RynthCore.Plugin.RynthAi.Loot.InventoryManager.GetMaxStackSize(item);
|
||||
if (max <= 1 || string.IsNullOrEmpty(item.Name)) return false;
|
||||
int wcid = item.Values(unchecked((int)DecalTypeKey), 0);
|
||||
var packs = new HashSet<int>();
|
||||
foreach (var p in inv)
|
||||
if (p.Container == playerId && p.ObjectClass == AcObjectClass.Container) packs.Add(p.Id);
|
||||
foreach (var s in inv)
|
||||
{
|
||||
if (s.Id == item.Id || s.ObjectClass == AcObjectClass.Container) continue;
|
||||
if (s.Container != playerId && !packs.Contains(s.Container)) continue;
|
||||
int sw = s.Values(unchecked((int)DecalTypeKey), 0);
|
||||
bool same = wcid != 0 && sw != 0 ? sw == wcid : string.Equals(s.Name, item.Name, StringComparison.Ordinal);
|
||||
if (!same) continue;
|
||||
if (Math.Max(1, s.Values(LongValueKey.StackCount, 1)) < max) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Re-reads the name and item type of an object stored with a blank name or an Unknown
|
||||
/// class, and replaces its entry when either improved. Corpse items are usually created
|
||||
|
|
|
|||
Loading…
Reference in a new issue