Function: SetTradeskillLevel(spawn, level)
Description:
Requests a tradeskill level change for a Player, or sets an NPC's tradeskill level directly. Player changes use the Player's current tradeskill level, class progression limits, maximum-level rules, and the global and original-zone on_tradeskill_level_up hooks. A hook returning -1 vetoes the change. This function does not award or consume tradeskill XP.
Parameters:
spawn(Spawn) - Player or other Spawn to update.level(uint8) - Requested tradeskill level. Player levels must be at least 1.
Returns: None. A refused or vetoed request has no Lua return value.
Ownership and callbacks: Player changes retain the original Player and capture its connection and zone once. A disconnect or reconnect during a hook cannot redirect the level change or spell grants to a replacement Player. A newer level or XP mutation supersedes the older pending transition. Accepted changes update the original Player's tradeskill level, next XP requirement, skill caps, and eligible tradeskill spells. UI delivery requires the original connection, session, packet context, and transition revision to remain current. An offline Player can receive backend changes; configured hooks still apply. Each later Lua call observes its own current connection.
An exception after the level commits can still interrupt later effects; this function does not provide a durable completion or retry guarantee. It does not extend the lifetime of unrelated Lua userdata.