Snapshot for release 2026.10.7.2 (internal caaf7ea)
This commit is contained in:
parent
26907e6ab1
commit
e5950ddb04
9 changed files with 216 additions and 40 deletions
|
|
@ -49,7 +49,9 @@ public enum StringValueKey
|
|||
|
||||
/// <summary>
|
||||
/// STypeFloat keys used with TryGetObjectDoubleProperty / WorldObjectCache.GetDoubleProperty.
|
||||
/// Values match Chorizite's STypeFloat sequential enum.
|
||||
/// Values match ACE's PropertyFloat and Chorizite's STypeFloat (UNDEF = 0). WeaponOffense and
|
||||
/// DamageMod were 61/62 until 2026-10-05 (61 is EconRecoveryInterval), so a native "damage
|
||||
/// percent" loot rule read the weapon's attack mod; PowerLevel/AccuracyLevel were 86/87.
|
||||
/// </summary>
|
||||
public enum DoubleValueKey
|
||||
{
|
||||
|
|
@ -59,10 +61,10 @@ public enum DoubleValueKey
|
|||
MaximumVelocity = 26, // missile launcher launch speed (m/s); known once appraised
|
||||
WeaponDefense = 29,
|
||||
UseRadius = 54,
|
||||
WeaponOffense = 61,
|
||||
DamageMod = 62,
|
||||
PowerLevel = 86,
|
||||
AccuracyLevel = 87,
|
||||
WeaponOffense = 62,
|
||||
DamageMod = 63,
|
||||
PowerLevel = 92,
|
||||
AccuracyLevel = 93,
|
||||
}
|
||||
|
||||
// ── Combat mode int constants (matches acclient.exe CM_Combat enum) ────────
|
||||
|
|
@ -123,6 +125,13 @@ public class WorldObject
|
|||
if (RynthCore.Loot.T11.T11Keys.IsVirtual(key))
|
||||
return Loot.T11ItemSupport.VirtualValue(this, key, defaultValue);
|
||||
|
||||
// Decal's synthetic keys that are a plain int property (MaxDamage = Damage 44, Coverage =
|
||||
// ClothingPriority 4, ...) read as that property, from the overlay or live. The icon and
|
||||
// spell ones are data ids: WorldObjectCache.GetIntProperty answers them.
|
||||
uint decalStype = WorldObjectCache.DecalIntStype(unchecked((uint)key));
|
||||
if (decalStype != 0)
|
||||
return Values(unchecked((int)decalStype), defaultValue);
|
||||
|
||||
var o = Overlay;
|
||||
if (o != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1136,10 +1136,64 @@ public class WorldObjectCache
|
|||
uint uid = unchecked((uint)id);
|
||||
if (stype == DecalTypeKey)
|
||||
return _host.HasGetObjectWcid && _host.TryGetObjectWcid(uid, out uint wcid) ? unchecked((int)wcid) : defaultValue;
|
||||
if ((stype & 0xFFFFFF00u) == DecalTypeKey)
|
||||
return GetDecalLongKey(uid, stype, defaultValue);
|
||||
if (!_host.HasGetObjectIntProperty) return defaultValue;
|
||||
return _host.TryGetObjectIntProperty(uid, stype, out int v) ? v : defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decal's other synthetic LongValueKeys (0x0D000001-0x0D00002A, Decal.Adapter's numbering),
|
||||
/// read as the game property each one is. VTank profiles use them: LootSnobV4 has 336 rules on
|
||||
/// MaxDamage and 109 on Coverage. They were read as STypeInt ids, which no object has, so
|
||||
/// they were always 0 and those rules never matched (until 2026-10-07). Icons are the
|
||||
/// portal.dat index without its 0x06000000 base, as Decal gives them. Keys with no property
|
||||
/// here (landblock, monarch, physics flags, spell counts) answer the default.
|
||||
/// </summary>
|
||||
private int GetDecalLongKey(uint uid, uint key, int defaultValue)
|
||||
{
|
||||
switch (key)
|
||||
{
|
||||
case 0x0D000001: return DecalIcon(uid, 8, defaultValue); // Icon
|
||||
case 0x0D000008: { uint s = GetDataIdProperty(unchecked((int)uid), 28); return s != 0 ? unchecked((int)s) : defaultValue; } // AssociatedSpell
|
||||
case 0x0D000029: return DecalIcon(uid, 50, defaultValue); // IconOverlay
|
||||
case 0x0D00002A: return DecalIcon(uid, 52, defaultValue); // IconUnderlay
|
||||
}
|
||||
uint stype = DecalIntStype(key);
|
||||
if (stype == 0 || !_host.HasGetObjectIntProperty) return defaultValue;
|
||||
return _host.TryGetObjectIntProperty(uid, stype, out int v) ? v : defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>The STypeInt a Decal synthetic long key is, or 0 (not an int property).</summary>
|
||||
public static uint DecalIntStype(uint key) => key switch
|
||||
{
|
||||
0x0D000004 => 6, // ItemSlots -> ItemsCapacity
|
||||
0x0D000005 => 7, // PackSlots -> ContainersCapacity
|
||||
0x0D000006 => 12, // StackCount -> StackSize
|
||||
0x0D000007 => 11, // StackMax -> MaxStackSize
|
||||
0x0D00000B => 10, // WieldingSlot -> CurrentWieldedLocation
|
||||
0x0D00000D => 4, // Coverage -> ClothingPriority
|
||||
0x0D00000E => 9, // EquipableSlots -> ValidLocations
|
||||
0x0D00000F => 51, // EquipType -> CombatUse
|
||||
0x0D000010 => 18, // IconOutline -> UiEffects
|
||||
0x0D000011 => 50, // MissileType -> AmmoType
|
||||
0x0D000012 => 16, // UsageMask -> ItemUseable
|
||||
0x0D000014 => 152, // HookMask -> HookItemType
|
||||
0x0D000015 => 151, // HookType
|
||||
0x0D00001A => 1, // Category -> ItemType
|
||||
0x0D00001F => 49, // WeapSpeed -> WeaponTime
|
||||
0x0D000020 => 48, // EquipSkill -> WeaponSkill
|
||||
0x0D000021 => 45, // DamageType
|
||||
0x0D000022 => 44, // MaxDamage -> Damage (the appraisal's weapon profile)
|
||||
_ => 0,
|
||||
};
|
||||
|
||||
private int DecalIcon(uint uid, uint did, int defaultValue)
|
||||
{
|
||||
uint v = GetDataIdProperty(unchecked((int)uid), did);
|
||||
return v != 0 ? unchecked((int)(v & 0x00FFFFFFu)) : defaultValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read an STypeDID property (e.g. a scroll's Spell 28 from its CreateObject header).
|
||||
/// 0 if the API is unavailable or the property is not set.
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public static class LootEvaluator
|
|||
|
||||
private static double EvalMinDamage(WorldObject item)
|
||||
{
|
||||
int maxDamage = item.Values(54, 0); // STypeInt MAX_DAMAGE
|
||||
int maxDamage = item.Values(44, 0); // Damage, the weapon profile's max (was 54, WeaponEncumbrance, until 2026-10-07)
|
||||
double variance = item.Values(DoubleValueKey.DamageVariance, 0.0);
|
||||
return maxDamage - variance * maxDamage;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -194,8 +194,8 @@ public static class VTankLootEvaluator
|
|||
VTankNodeTypes.StringValueMatch => MatchStringValue(item, d),
|
||||
VTankNodeTypes.LongValKeyLE => Long(d) is var (val,key) && item.Values((LongValueKey)key, 0) <= val,
|
||||
VTankNodeTypes.LongValKeyGE => Long(d) is var (val,key) && item.Values((LongValueKey)key, 0) >= val,
|
||||
VTankNodeTypes.DoubleValKeyLE => Double(d) is var (val,key) && item.Values((DoubleValueKey)key, 0.0) <= val,
|
||||
VTankNodeTypes.DoubleValKeyGE => Double(d) is var (val,key) && item.Values((DoubleValueKey)key, 0.0) >= val,
|
||||
VTankNodeTypes.DoubleValKeyLE => Double(d) is var (val,key) && item.Values(FloatKey(key), 0.0) <= val,
|
||||
VTankNodeTypes.DoubleValKeyGE => Double(d) is var (val,key) && item.Values(FloatKey(key), 0.0) >= val,
|
||||
VTankNodeTypes.DamagePercentGE => false, // VTank source returns false unconditionally
|
||||
VTankNodeTypes.ObjectClass => ScrollLearner.ClassMatches(item, ReadInt(d, 0)), // Scroll (42) also matches scroll Books
|
||||
VTankNodeTypes.SpellCountGE => ctx is null || ctx.GetItemSpellIds(itemId).Length >= ReadInt(d, 0),
|
||||
|
|
@ -216,8 +216,8 @@ public static class VTankLootEvaluator
|
|||
VTankNodeTypes.BuffedMedianDamageGE => MatchBuffedMedianDamageGE(item, d),
|
||||
VTankNodeTypes.BuffedMissileDamageGE => MatchBuffedMissileDamageGE(item, d),
|
||||
VTankNodeTypes.BuffedLongValKeyGE => DoubleKey(d) is var (val,key) && item.Values((LongValueKey)key, 0) >= val,
|
||||
VTankNodeTypes.BuffedDoubleValKeyGE => DoubleKey(d) is var (val,key) && item.Values((DoubleValueKey)key, 0.0) >= val,
|
||||
VTankNodeTypes.CalcdBuffedTinkedDamageGE => item.Values(54, 0) >= ReadDouble(d, 0),
|
||||
VTankNodeTypes.BuffedDoubleValKeyGE => DoubleKey(d) is var (val,key) && item.Values(FloatKey(key), 0.0) >= val,
|
||||
VTankNodeTypes.CalcdBuffedTinkedDamageGE => item.Values(44, 0) >= ReadDouble(d, 0),
|
||||
VTankNodeTypes.TotalRatingsGE => MatchTotalRatingsGE(item, d),
|
||||
VTankNodeTypes.CalcedBuffedTinkedTargetMeleeGE => false, // not implemented
|
||||
VTankNodeTypes.DisabledRule => MatchDisabledRule(d),
|
||||
|
|
@ -278,7 +278,7 @@ public static class VTankLootEvaluator
|
|||
private static bool MatchMinDamageGE(WorldObject item, IList<string> d)
|
||||
{
|
||||
double threshold = ReadDouble(d, 0);
|
||||
int maxDamage = item.Values(54, 0);
|
||||
int maxDamage = item.Values(44, 0); // Damage: the weapon profile's max (54 is WeaponEncumbrance; until 2026-10-07)
|
||||
if (maxDamage == 0) return false;
|
||||
double variance = item.Values(DoubleValueKey.DamageVariance, 0.0);
|
||||
double minDamage = maxDamage - (variance * maxDamage);
|
||||
|
|
@ -310,7 +310,7 @@ public static class VTankLootEvaluator
|
|||
private static bool MatchBuffedMedianDamageGE(WorldObject item, IList<string> d)
|
||||
{
|
||||
double threshold = ReadDouble(d, 0);
|
||||
int maxDamage = item.Values(54, 0);
|
||||
int maxDamage = item.Values(44, 0); // Damage: the weapon profile's max (54 is WeaponEncumbrance; until 2026-10-07)
|
||||
if (maxDamage == 0) return false;
|
||||
double variance = item.Values(DoubleValueKey.DamageVariance, 0.0);
|
||||
double minDamage = maxDamage - (variance * maxDamage);
|
||||
|
|
@ -320,7 +320,7 @@ public static class VTankLootEvaluator
|
|||
private static bool MatchBuffedMissileDamageGE(WorldObject item, IList<string> d)
|
||||
{
|
||||
double threshold = ReadDouble(d, 0);
|
||||
int maxDamage = item.Values(54, 0);
|
||||
int maxDamage = item.Values(44, 0); // Damage: the weapon profile's max (54 is WeaponEncumbrance; until 2026-10-07)
|
||||
if (maxDamage == 0) return false;
|
||||
double elemBonus = item.Values((DoubleValueKey)152, 1.0);
|
||||
if (elemBonus < 1.0) elemBonus = 1.0;
|
||||
|
|
@ -356,4 +356,24 @@ public static class VTankLootEvaluator
|
|||
private static (double Val, int Key) Double(IList<string> d) => (ReadDouble(d, 0), ReadInt(d, 1));
|
||||
// Buffed long/double helpers store value as double in slot 0 (matching VTank's "Read" of doubles).
|
||||
private static (double Val, int Key) DoubleKey(IList<string> d) => (ReadDouble(d, 0), ReadInt(d, 1));
|
||||
|
||||
// A double key as the STypeFloat it reads. VTank files the appraisal's armor and weapon
|
||||
// profiles under Decal's 0x0A0000xx keys (uTank2 LootPlugins.DoubleValueKey), which no
|
||||
// object property has: read raw they were always 0, so LootSnob's "AttackBonus >=" rules
|
||||
// never matched (until 2026-10-05). Range (0x0A00000D) and the physics keys stay unmapped.
|
||||
private static DoubleValueKey FloatKey(int key) => unchecked((uint)key) switch
|
||||
{
|
||||
0x0A000000 => (DoubleValueKey)13, // SlashProt → ArmorModVsSlash
|
||||
0x0A000001 => (DoubleValueKey)14, // PierceProt → ArmorModVsPierce
|
||||
0x0A000002 => (DoubleValueKey)15, // BludgeonProt → ArmorModVsBludgeon
|
||||
0x0A000003 => (DoubleValueKey)18, // AcidProt → ArmorModVsAcid
|
||||
0x0A000004 => (DoubleValueKey)19, // LightningProt → ArmorModVsElectric
|
||||
0x0A000005 => (DoubleValueKey)17, // FireProt → ArmorModVsFire
|
||||
0x0A000006 => (DoubleValueKey)16, // ColdProt → ArmorModVsCold
|
||||
0x0A000009 => (DoubleValueKey)280, // SalvageWorkmanship → the engine's workmanship read (as wobjectgetdoubleprop)
|
||||
0x0A00000B => DoubleValueKey.DamageVariance, // Variance
|
||||
0x0A00000C => DoubleValueKey.WeaponOffense, // AttackBonus
|
||||
0x0A00000E => DoubleValueKey.DamageMod, // DamageBonus
|
||||
_ => (DoubleValueKey)key,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue