Read the xml content from an .awcav preset; something like:
file_read (filename, &data &len);
Create the compressed data buffer and set the max len
Compressed data must be always shorter in size, so len is long enough
zip_buf = new UCHAR[len];
zip_len = len;
Compress the data
aw_zip (zip_buf, &zip_len, data, len);
Set all attributes necessary
aw_int_set (AW_CAV_CITIZEN, citizen);
aw_int_set (AW_CAV_SESSION, session);
aw_data_set (AW_CAV_DEFINITION, (const char*)zip_buf, zip_len);
In case it is a universe CAV, the bot must be uni-admin to change other's uni-CAVs
but always can change his own universe-CAV, using:
aw_cav_change ();
In case it is a world CAV, the bot must be CT to change other's world-CAVs but always can change his own world-CAV, using:
aw_world_cav_change ();
Once the preset is uploaded, set the avatar to CUSTOM_AVATAR (type = 65534)
or to CUSTOM_WORLD_AVATAR (type = 65533) using either:
aw_state_change () for your own avatar
or
aw_avatar_set (session) for other's avatars.
To request a CAV definition from the universe, use:
aw_cav_request (citizen, session);
To request a CAV defintion from the world, use:
aw_world_cav_request (citizen, session);
Uni-Callbacks:
AW_CALLBACK_CAV
AW_CALLBACK_CAV_RESULT
World-Callbacks:
AW_CALLBACK_WORLD_CAV_RESULT,
AW_CALLBACK_WORLD_CAV,
Uni-Events:
AW_EVENT_CAV_DEFINITION_CHANGE,
World-Events:
AW_EVENT_WORLD_CAV_DEFINITION_CHANGE,