I think you're looking to start at
this thread.
Basically Darkvision thing looks for two field values -- abValue and abValue2
abValue is the base distance granted
abValue2 is used to extend existing Darkvision
There are some cases where having a high abValue on an item that exceeds the character's existing darkvision abValue causes a math error that requires more logic in any scripting. I think this logic might have went into the Dragon Masks but I'm not sure.