This partially fixes an issue where casters only get one spellbook no matter how many their treasurelist says they should start with; the old code considered all spellbooks equivalent as long as they had the same base name, no matter what spell they contained.
Note that if genuine duplicates are generated (e.g. the player gets two books of burning hands) one of them will still be pruned; no attempt is made to generate a replacement book or give them the value of the book in platinum or something as compensation.
Please use this patch instead (argument order changed to match the enclosing macro).
Applied to SVN as revision 21393, thanks!