Fixed false positive for  template & faction locks

Also split code for different unlock checks onto different attributes.
Conflict resolution

(hope this works)