RynthSuite as of 2026-09-27 (internal 0a2fb99): looting waits for item names and types, release 2026.9.27.3

This commit is contained in:
Tom Bohar 2026-09-27 21:18:57 -04:00
commit c33e24a610
2 changed files with 65 additions and 6 deletions

View file

@ -1108,6 +1108,48 @@ public class WorldObjectCache
return mainFree > 0 ? playerId : 0;
}
/// <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
/// before the engine's off-thread identity snapshot (refreshed every ~0.5 s) has them,
/// so they were classified once with no name and no type and never revisited: looting
/// then judged 3 of 4 items nameless and left them (2026-09-27). Cheap when complete.
/// </summary>
public WorldObject RefreshIdentity(WorldObject wo)
{
bool needName = string.IsNullOrWhiteSpace(wo.Name);
bool needClass = wo.ObjectClass == AcObjectClass.Unknown;
if (!needName && !needClass)
return wo;
uint uid = unchecked((uint)wo.Id);
string name = wo.Name ?? string.Empty;
if (needName && _host.TryGetObjectName(uid, out string n) && !string.IsNullOrWhiteSpace(n))
name = n;
AcObjectClass cls = wo.ObjectClass;
if (needClass)
{
if (_host.TryGetItemType(uid, out uint flags) && (flags & ItemTypeCreature) == 0)
cls = ClassifyByItemType(flags);
if (cls == AcObjectClass.Unknown && name.Length > 0)
cls = ClassifyInventoryItem(name);
}
if (name == wo.Name && cls == wo.ObjectClass)
return wo;
lock (_gate)
{
// Only replace the entry we were handed; a concurrent reclassify wins.
if (!_byId.TryGetValue(wo.Id, out var current) || !ReferenceEquals(current, wo))
return current ?? wo;
var fresh = Make(wo.Id, name, cls);
_byId[wo.Id] = fresh;
return fresh;
}
}
public IEnumerable<WorldObject> GetContainedItems(int containerId)
{
if (containerId == 0)