Fix badge renumbering

Completely rewrites the badge renumbering functions.

The primary goal was to make badge auto-numbering work when badge shifting was turned off, as it was assigning duplicate badges in some circumstances.

Secondary goals were:
- making the function easier to read
- removing shift_custom_badges check from the shifting function and instead preventing the function from being called unless shift_custom_badges is true
- adding a warning for admins when badge numbers start going out of range (I wanted to automatically renumber badges back into their range, but this caused too much headache)
- keeping the logic about "which badge is actually considered 'next'" in the next_badge_num function, instead of tacking on adjustments after calling it