Does anyone know the best affiliate plugin where I can edit

Does anyone know the best affiliate plugin where I can edit the actual payment algo eg; if (Person A) invites a friend (Person B), and Person B signs up, Person A is awarded 5 points. If Person B invites someone (Person C) and they sign up, Person A is awarded 2 points etc...