Function: AddCharacterTitle(Spawn, TitleName)
Description: Adds a master title selected by name to the original Player's profile. A Player who already owns that name keeps the existing title entry.
Parameters:
Spawn: Spawn - The Player receiving the title.TitleName: string - Master title name, matched without case sensitivity.
Returns: SInt32 - The zero-based index in this Player's title list, or -1 for an invalid Player, missing master title or failed insert. New and existing titles use the same index convention. This index identifies the character's profile entry; the master catalogue has its own database ID.
Ownership and connection lifetime: The selected title is copied before persistence and transferred as a value to the original Player. Catalogue replacement during a callback does not change that selection. Appending assigns the actual character index under the list lock, and concurrent duplicate name admission returns the existing index. The original connection is captured before callbacks and retained for the operation. UI delivery stops if its Player relationship or session generation changes. A valid Player can receive the title without an active connection.
Database insertion and the in-memory append are separate operations. Native allocation failures do not turn them into a single database transaction.