mirror of
https://github.com/brues-code/ClassicAPI.git
synced 2026-11-16 16:10:36 +00:00
C_Item.IsItemInRange(item, targetUnit) resolves the item to its on-use spell (Item::Spell::OnUseSpellIDForItemID) and runs the same geometric range test as C_Spell.IsSpellInRange: true / false in-or-out of range, nil when the check doesn't apply (no on-use spell, a rangeless one, or an unresolvable item/unit). Matches retail, which also returns nil for items with no range restriction. item accepts itemID / "item:NNN" / link (names aren't resolvable in vanilla -> nil). Range-only, ignoring LoS/faction, like IsSpellInRange. The range predicate SpellIDHasRange was about to become its fourth copy, so extract the shared core into Spell::Range (SpellIDHasRange + PlayerVsUnit, returning 1/0/-1). C_Spell.IsSpellInRange and C_Item.IsItemInRange are now thin Lua wrappers over PlayerVsUnit, and C_Spell.SpellHasRange / SpellHasRange call the shared SpellIDHasRange -- range logic single-sourced.