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,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,27 +87,28 @@ public enum AcIntProperty
|
|||
|
||||
/// <summary>
|
||||
/// Loot-relevant float item properties. Values match Chorizite STypeFloat sequential enum
|
||||
/// (UNDEF=0, HEARTBEAT_INTERVAL=1, …). Cast to int when calling item.Values(key, 0.0).
|
||||
/// (UNDEF=0, HEARTBEAT_INTERVAL=1, …) and ACE's PropertyFloat. Cast to int when calling item.Values(key, 0.0).
|
||||
/// AttackBonus, DamageMod, ManaConvMod and SlayerDamageBonus were one low until 2026-10-05.
|
||||
/// </summary>
|
||||
public enum AcFloatProperty
|
||||
{
|
||||
AcidProtMod = 18, // ARMOR_MOD_VS_ACID
|
||||
AttackBonus = 61, // WEAPON_OFFENSE — attack bonus %
|
||||
AttackBonus = 62, // WEAPON_OFFENSE — attack bonus %
|
||||
BluntProtMod = 15, // ARMOR_MOD_VS_BLUDGEON
|
||||
ColdProtMod = 16, // ARMOR_MOD_VS_COLD
|
||||
DamageMod = 62, // DAMAGE_MOD — damage bonus %
|
||||
DamageMod = 63, // DAMAGE_MOD — damage bonus %
|
||||
DamageVariance = 22, // DAMAGE_VARIANCE
|
||||
DefenseBonus = 29, // WEAPON_DEFENSE — melee defense bonus %
|
||||
ElectricProtMod = 19, // ARMOR_MOD_VS_ELECTRIC
|
||||
ElementalDamageMod = 152, // ELEMENTAL_DAMAGE_MOD
|
||||
FireProtMod = 17, // ARMOR_MOD_VS_FIRE
|
||||
MagicDefBonus = 150, // WEAPON_MAGIC_DEFENSE
|
||||
ManaConvMod = 143, // MANA_CONVERSION_MOD
|
||||
ManaConvMod = 144, // MANA_CONVERSION_MOD
|
||||
MissileDefBonus = 149, // WEAPON_MISSILE_DEFENSE
|
||||
NetherProtMod = 165, // ARMOR_MOD_VS_NETHER
|
||||
PierceProtMod = 14, // ARMOR_MOD_VS_PIERCE
|
||||
SlashProtMod = 13, // ARMOR_MOD_VS_SLASH
|
||||
SlayerDamageBonus = 137, // SLAYER_DAMAGE_BONUS
|
||||
SlayerDamageBonus = 138, // SLAYER_DAMAGE_BONUS
|
||||
}
|
||||
|
||||
/// <summary>AC material types. Integer values match the live acclient.exe property table.</summary>
|
||||
|
|
|
|||
|
|
@ -45,23 +45,42 @@ public static class LootRuleText
|
|||
{
|
||||
var keys = new List<(int, string)>
|
||||
{
|
||||
(5, "EncumbVal"), (9, "Locations"), (19, "Value"), (25, "Level"), (28, "ArmorLevel"), (44, "Damage"), (45, "DamageType"),
|
||||
(48, "WeaponSkill"), (54, "MaxDamage"),
|
||||
(5, "EncumbVal"), (9, "Locations"), (19, "Value"), (25, "Level"), (28, "ArmorLevel"), (44, "Damage (max)"), (45, "DamageType"),
|
||||
(48, "WeaponSkill"), (54, "WeaponEncumbrance"), // 54 was labelled MaxDamage until 2026-10-07; max damage is 44
|
||||
(87, "MaxStructure"), (88, "Structure"), (105, "ItemWorkmanship"), (107, "ItemMaxMana"),
|
||||
(131, "MaterialType"), (158, "WieldRequirements"), (159, "WieldSkilltype"), (160, "WieldDifficulty"),
|
||||
(218, "EquippedSlots"), (353, "ImbuedEffect"), (370, "DamageRating"), (371, "DamageResistRating"),
|
||||
(372, "CritRating"), (373, "CritResistRating"), (374, "CritDamageRating"),
|
||||
(375, "CritDamageResistRating"), (376, "HealBoostRating"), (377, "NetherResistRating"), (379, "VitalityRating"),
|
||||
(0x0D000000, "Type (WCID)"), // Decal's synthetic key: the weenie class id
|
||||
// Decal's other synthetic keys (Decal.Adapter LongValueKey), as VTank's editor names them;
|
||||
// RynthAi reads each as the game property it is (WorldObjectCache.GetDecalLongKey).
|
||||
(0x0D000001, "Icon"), (0x0D000004, "ItemSlots"), (0x0D000005, "PackSlots"),
|
||||
(0x0D000006, "StackCount"), (0x0D000007, "StackMax"), (0x0D000008, "AssociatedSpell"),
|
||||
(0x0D00000B, "WieldingSlot"), (0x0D00000D, "Coverage"), (0x0D00000E, "EquipableSlots"),
|
||||
(0x0D00000F, "EquipType"), (0x0D000010, "IconOutline"), (0x0D000011, "MissileType"),
|
||||
(0x0D000012, "UsageMask"), (0x0D000014, "HookMask"), (0x0D000015, "HookType"),
|
||||
(0x0D00001A, "Category"), (0x0D00001F, "WeapSpeed"), (0x0D000020, "EquipSkill"),
|
||||
(0x0D000021, "DamageType (Decal)"), (0x0D000022, "MaxDamage"),
|
||||
(0x0D000029, "IconOverlay"), (0x0D00002A, "IconUnderlay"),
|
||||
};
|
||||
keys.AddRange(T11.T11Keys.Names());
|
||||
return keys.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// STypeFloat ids (ACE's PropertyFloat), then the 0x0A0000xx keys VTank's own editor writes
|
||||
/// for the appraisal's weapon profile (uTank2 LootPlugins.DoubleValueKey). 5, 29, 62, 63 and
|
||||
/// 167 were labelled ApproachDistance, WeaponLength, WeaponDefense, WeaponOffense and ManaRate
|
||||
/// until 2026-10-05.
|
||||
/// </summary>
|
||||
public static readonly (int Id, string Name)[] DoubleKeys =
|
||||
{
|
||||
(5, "ApproachDistance"), (22, "DamageVariance"), (29, "WeaponLength"), (62, "WeaponDefense"),
|
||||
(63, "WeaponOffense"), (152, "ElementalDamageVsMonsters"), (167, "ManaRate"),
|
||||
(5, "ManaRate"), (22, "DamageVariance"), (29, "WeaponDefense"), (62, "WeaponOffense"),
|
||||
(63, "DamageMod"), (144, "ManaConversionMod"), (149, "WeaponMissileDefense"),
|
||||
(150, "WeaponMagicDefense"), (152, "ElementalDamageVsMonsters"), (167, "CooldownDuration"),
|
||||
(0x0A000009, "SalvageWorkmanship"), (0x0A00000B, "Variance"),
|
||||
(0x0A00000C, "AttackBonus"), (0x0A00000E, "DamageBonus"),
|
||||
};
|
||||
|
||||
/// <summary>String keys. Use (14) and LongDesc (16) hold the T11 "Modifiers:" / "Property Details:" text.</summary>
|
||||
|
|
@ -141,8 +160,8 @@ public static class LootRuleText
|
|||
/// </summary>
|
||||
public static (int Id, string Name)[]? ValueTableFor(int longKey) => longKey switch
|
||||
{
|
||||
45 => DamageTypes,
|
||||
48 => Skills,
|
||||
45 or 0x0D000021 => DamageTypes,
|
||||
48 or 0x0D000020 => Skills,
|
||||
131 => Materials,
|
||||
158 => WieldRequirements,
|
||||
159 => Skills,
|
||||
|
|
@ -151,10 +170,10 @@ public static class LootRuleText
|
|||
};
|
||||
|
||||
/// <summary>True when the long key's value is a set of flags (a named value is one flag or a common pair).</summary>
|
||||
public static bool ValueTableIsFlags(int longKey) => longKey == 45;
|
||||
public static bool ValueTableIsFlags(int longKey) => longKey is 45 or 0x0D000021;
|
||||
|
||||
/// <summary>The long keys that have a value table, for the vocabulary.</summary>
|
||||
public static readonly int[] KeysWithValueTables = { 45, 48, 131, 158, 159, T11.T11Keys.WeaponGrade };
|
||||
public static readonly int[] KeysWithValueTables = { 45, 48, 131, 158, 159, 0x0D000020, 0x0D000021, T11.T11Keys.WeaponGrade };
|
||||
|
||||
/// <summary>
|
||||
/// True for the conditions whose value is picked by name when the key has a
|
||||
|
|
|
|||
|
|
@ -366,15 +366,7 @@ internal static class TypedEditors
|
|||
RynthCore.Loot.Editing.LootRuleText.LongKeys;
|
||||
|
||||
public static readonly (int Id, string Name)[] DoubleKeys =
|
||||
{
|
||||
(5, "ApproachDistance"),
|
||||
(22, "DamageVariance"),
|
||||
(29, "WeaponLength"),
|
||||
(62, "WeaponDefense"),
|
||||
(63, "WeaponOffense"),
|
||||
(152, "ElementalDamageVsMonsters"),
|
||||
(167, "ManaRate"),
|
||||
};
|
||||
RynthCore.Loot.Editing.LootRuleText.DoubleKeys;
|
||||
|
||||
public static readonly (int Id, string Name)[] StringKeys =
|
||||
{
|
||||
|
|
|
|||
|
|
@ -14,8 +14,9 @@ namespace RynthCore.RynthAiHostTests.Tests;
|
|||
// when the selected profile is a .json file.
|
||||
internal static class NativeLootTests
|
||||
{
|
||||
private const int MaxDamage = 54, Value = 19, ArmorLevel = 28, Workmanship = 105, Material = 131;
|
||||
private const int DamageVariance = 22, DamageMod = 62, WeaponDefense = 29;
|
||||
private const int MaxDamage = 44, Value = 19, ArmorLevel = 28, Workmanship = 105, Material = 131;
|
||||
// ACE PropertyFloat ids (WeaponOffense 62 / DamageMod 63; 61 is EconRecoveryInterval).
|
||||
private const int DamageVariance = 22, WeaponOffense = 62, DamageMod = 63, WeaponDefense = 29;
|
||||
|
||||
public static void Register(Runner r)
|
||||
{
|
||||
|
|
@ -32,6 +33,7 @@ internal static class NativeLootTests
|
|||
r.Add("loot native: string regex, case-insensitive, falls back to the name", StringValue);
|
||||
r.Add("loot native: min damage = max - variance * max", MinDamage);
|
||||
r.Add("loot native: damage percent reads DamageMod * 100", DamagePercent);
|
||||
r.Add("loot native: DoubleValueKey ids are ACE's PropertyFloat (DamageMod 63, not WeaponOffense 62)", DoubleValueKeyIds);
|
||||
r.Add("loot native: total ratings sum keys 370-376 and 379 only", TotalRatings);
|
||||
r.Add("loot native: character skill (null, stub and live skills)", CharacterSkill);
|
||||
r.Add("loot native: unknown condition type passes", UnknownConditionPasses);
|
||||
|
|
@ -211,6 +213,35 @@ internal static class NativeLootTests
|
|||
var bow = new Item("Bow").Dbl(DamageMod, 1.5);
|
||||
Check.True(Eval(new DamagePercentGECondition { Value = 150 }, bow), "1.5 -> 150%");
|
||||
Check.False(Eval(new DamagePercentGECondition { Value = 151 }, bow), "above");
|
||||
|
||||
// A launcher with a big attack mod and a small damage mod: the rule must read the damage
|
||||
// mod (63). With DamageMod = 62 in the enum (before 2026-10-05) it read the attack mod.
|
||||
var launcher = new Item("Bow").Dbl(WeaponOffense, 1.5).Dbl(DamageMod, 1.1).Dbl(61, 2.0);
|
||||
Check.True(Eval(new DamagePercentGECondition { Value = 110 }, launcher), "damage mod 1.1 -> 110%");
|
||||
Check.False(Eval(new DamagePercentGECondition { Value = 111 }, launcher), "the 1.5 attack mod is not read");
|
||||
Check.False(Eval(new DamagePercentGECondition { Value = 150 }, new Item("Bow").Dbl(WeaponOffense, 1.5)),
|
||||
"attack mod alone: no damage percent");
|
||||
}
|
||||
|
||||
private static void DoubleValueKeyIds()
|
||||
{
|
||||
Check.Eq((int)DoubleValueKey.DamageVariance, 22, "DamageVariance");
|
||||
Check.Eq((int)DoubleValueKey.MaximumVelocity, 26, "MaximumVelocity");
|
||||
Check.Eq((int)DoubleValueKey.WeaponDefense, 29, "WeaponDefense");
|
||||
Check.Eq((int)DoubleValueKey.UseRadius, 54, "UseRadius");
|
||||
Check.Eq((int)DoubleValueKey.WeaponOffense, 62, "WeaponOffense");
|
||||
Check.Eq((int)DoubleValueKey.DamageMod, 63, "DamageMod");
|
||||
Check.Eq((int)DoubleValueKey.PowerLevel, 92, "PowerLevel");
|
||||
Check.Eq((int)DoubleValueKey.AccuracyLevel, 93, "AccuracyLevel");
|
||||
Check.Eq((int)AcFloatProperty.AttackBonus, 62, "LootSdk AttackBonus = WeaponOffense");
|
||||
Check.Eq((int)AcFloatProperty.DamageMod, 63, "LootSdk DamageMod");
|
||||
Check.Eq((int)AcFloatProperty.ManaConvMod, 144, "LootSdk ManaConvMod");
|
||||
Check.Eq((int)AcFloatProperty.SlayerDamageBonus, 138, "LootSdk SlayerDamageBonus");
|
||||
|
||||
// The double-key condition reads the id it is given: 63 is the damage mod.
|
||||
var bow = new Item("Bow").Dbl(WeaponOffense, 1.25).Dbl(DamageMod, 1.05);
|
||||
Check.True(Eval(new DoubleValKeyGECondition { Key = 63, Value = 1.05 }, bow), "key 63 reads DamageMod");
|
||||
Check.False(Eval(new DoubleValKeyGECondition { Key = 63, Value = 1.06 }, bow), "not WeaponOffense");
|
||||
}
|
||||
|
||||
private static void TotalRatings()
|
||||
|
|
|
|||
|
|
@ -26,7 +26,9 @@ internal static class VTankLootTests
|
|||
r.Add("loot vtank: string value match", StringValueMatch);
|
||||
r.Add("loot vtank: long keys LE/GE/E/NE and flag, at the boundary", LongKeys);
|
||||
r.Add("loot vtank: Decal's Type key (0x0D000000) is the WCID - 'loot everything that isn't retail'", WcidKey);
|
||||
r.Add("loot vtank: Decal's long keys (MaxDamage, Coverage, EquipType, IconOverlay) read the game property", DecalLongKeys);
|
||||
r.Add("loot vtank: double keys LE/GE", DoubleKeys);
|
||||
r.Add("loot vtank: VTank's 0x0A0000xx double keys (AttackBonus, DamageBonus, Variance) read 62/63/22", VTankDoubleKeys);
|
||||
r.Add("loot vtank: object class", ObjectClass);
|
||||
r.Add("loot vtank: value and workmanship requirements", ValueAndWorkmanship);
|
||||
r.Add("loot vtank: damage nodes (min, median, missile, tinked, percent)", DamageNodes);
|
||||
|
|
@ -165,6 +167,33 @@ internal static class VTankLootTests
|
|||
Check.True(M(retail, C(N.LongValKeyE, "20646", type)), "an exact WCID match works too");
|
||||
}
|
||||
|
||||
// 2026-10-07: LootSnobV4's "(2H) Cleaving MAX 350" (Buffed Long Key >= on 218103842) never kept
|
||||
// anything: Decal's synthetic keys were read as STypeInt ids no object has. 336 of its rules
|
||||
// use MaxDamage, 109 Coverage, 83 IconOverlay.
|
||||
private static void DecalLongKeys()
|
||||
{
|
||||
var axe = new Item("Greataxe", AcObjectClass.MeleeWeapon).Int(44, 30).Int(51, 5).Int(48, 41);
|
||||
Check.True(M(axe, C(N.BuffedLongValKeyGE, "25", "218103842")), "MaxDamage 30 >= 25");
|
||||
Check.False(M(axe, C(N.BuffedLongValKeyGE, "31", "218103842")), "MaxDamage 30 < 31");
|
||||
Check.True(M(axe, C(N.LongValKeyGE, "30", "218103842")), "plain Long Key too");
|
||||
Check.True(M(axe, C(N.LongValKeyE, "5", "218103823")), "EquipType = CombatUse (5, two-handed)");
|
||||
Check.True(M(axe, C(N.LongValKeyE, "41", "218103840")), "EquipSkill = WeaponSkill");
|
||||
var shirt = new Item("Shirt", AcObjectClass.Clothing).Int(4, 0x1A);
|
||||
Check.True(M(shirt, C(N.LongValKeyFlagExists, "2", "218103821")), "Coverage flag reads ClothingPriority");
|
||||
Check.False(M(shirt, C(N.LongValKeyFlagExists, "1", "218103821")), "a flag it lacks");
|
||||
Check.Eq(new Item("Stick").Wo.Values(218103820, -7), -7, "an unmapped Decal key (Monarch) answers the default");
|
||||
|
||||
FakeHost.Reset();
|
||||
var host = FakeHost.Create();
|
||||
var cache = new WorldObjectCache(host);
|
||||
const uint Rare = 0x80001101;
|
||||
FakeHost.DataIds[(Rare, 50)] = 0x06006C38;
|
||||
var rare = new WorldObject(unchecked((int)Rare), "Pearl of Blood Drinking", AcObjectClass.Misc) { Cache = cache };
|
||||
Check.Eq(rare.Values(218103849, 0), 27704, "IconOverlay is the overlay's portal index, as Decal gives it");
|
||||
Check.True(M(rare, C(N.LongValKeyE, "27704", "218103849")), "an IconOverlay rule matches");
|
||||
Check.Eq(rare.Values(218103850, -1), -1, "no underlay: the default");
|
||||
}
|
||||
|
||||
private static void DoubleKeys()
|
||||
{
|
||||
var item = new Item("x").Dbl(29, 1.25);
|
||||
|
|
@ -175,6 +204,27 @@ internal static class VTankLootTests
|
|||
Check.True(M(item, C(N.DoubleValKeyGE, "1e0", "29")), "exponent notation parses");
|
||||
}
|
||||
|
||||
// VTank's editor writes the weapon profile's attack/damage mods under Decal's synthetic keys
|
||||
// (uTank2 LootPlugins.DoubleValueKey AttackBonus 0x0A00000C, DamageBonus 0x0A00000E,
|
||||
// Variance 0x0A00000B). LootSnobV4's "(H) Axe (AT +8)" rules are BuffedDoubleValKeyGE
|
||||
// 1.31 on 167772172; read raw the key was never set, so they could not match.
|
||||
private static void VTankDoubleKeys()
|
||||
{
|
||||
var axe = new Item("Axe").Dbl(62, 1.31).Dbl(63, 1.2).Dbl(22, 0.4);
|
||||
const string attack = "167772172", damage = "167772174", variance = "167772171";
|
||||
Check.True(M(axe, C(N.BuffedDoubleValKeyGE, "1.31", attack)), "LootSnob AT rule: attack 1.31 >= 1.31");
|
||||
Check.False(M(axe, C(N.BuffedDoubleValKeyGE, "1.32", attack)), "attack just above");
|
||||
Check.True(M(axe, C(N.DoubleValKeyGE, "1.2", damage)), "DamageBonus reads DamageMod 63");
|
||||
Check.False(M(axe, C(N.DoubleValKeyGE, "1.21", damage)), "not WeaponOffense");
|
||||
Check.True(M(axe, C(N.DoubleValKeyLE, "0.4", variance)), "Variance reads DamageVariance 22");
|
||||
Check.False(M(axe, C(N.DoubleValKeyLE, "0.39", variance)), "variance below");
|
||||
Check.False(M(new Item("Stick"), C(N.DoubleValKeyGE, "0.1", attack)), "no attack mod: reads 0");
|
||||
|
||||
var armor = new Item("Coat").Dbl(13, 1.6).Dbl(19, 0.8);
|
||||
Check.True(M(armor, C(N.DoubleValKeyGE, "1.6", "167772160")), "SlashProt reads ArmorModVsSlash 13");
|
||||
Check.True(M(armor, C(N.DoubleValKeyLE, "0.8", "167772164")), "LightningProt reads ArmorModVsElectric 19");
|
||||
}
|
||||
|
||||
private static void ObjectClass()
|
||||
{
|
||||
Check.True(M(new Item("x", AcObjectClass.Salvage), C(N.ObjectClass, "39")), "salvage is class 39");
|
||||
|
|
@ -199,7 +249,7 @@ internal static class VTankLootTests
|
|||
|
||||
private static void DamageNodes()
|
||||
{
|
||||
var sword = new Item("Sword").Int(54, 40).Dbl(22, 0.5); // min 20, median 30
|
||||
var sword = new Item("Sword").Int(44, 40).Dbl(22, 0.5); // min 20, median 30
|
||||
Check.True(M(sword, C(N.MinDamageGE, "20")), "min 20");
|
||||
Check.False(M(sword, C(N.MinDamageGE, "20.5")), "min above");
|
||||
Check.True(M(sword, C(N.BuffedMedianDamageGE, "30")), "median 30");
|
||||
|
|
@ -211,10 +261,10 @@ internal static class VTankLootTests
|
|||
Check.False(M(nodmg, C(N.BuffedMedianDamageGE, "0")), "no max damage: median fails");
|
||||
Check.False(M(nodmg, C(N.BuffedMissileDamageGE, "0")), "no max damage: missile fails");
|
||||
|
||||
var bow = new Item("Bow").Int(54, 50).Dbl(152, 1.2);
|
||||
var bow = new Item("Bow").Int(44, 50).Dbl(152, 1.2);
|
||||
Check.True(M(bow, C(N.BuffedMissileDamageGE, "60")), "50 * elemental 1.2 = 60");
|
||||
Check.False(M(bow, C(N.BuffedMissileDamageGE, "60.1")), "just above");
|
||||
var weakBow = new Item("Bow").Int(54, 50).Dbl(152, 0.5);
|
||||
var weakBow = new Item("Bow").Int(44, 50).Dbl(152, 0.5);
|
||||
Check.True(M(weakBow, C(N.BuffedMissileDamageGE, "50")), "an elemental bonus below 1 counts as 1");
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue