Exemple #1
0
function load_ruth_appearance($user_uuid)
{
    $items_array = array('AvatarHeight' => array('PrincipalID' => $user_uuid, 'Name' => 'AvatarHeight', 'Value' => '1.690999'), 'AvatarType' => array('PrincipalID' => $user_uuid, 'Name' => 'AvatarType', 'Value' => '1'), 'Serial' => array('PrincipalID' => $user_uuid, 'Name' => 'Serial', 'Value' => '0'), 'VisualParams' => array('PrincipalID' => $user_uuid, 'Name' => 'VisualParams', 'Value' => '33,61,85,23,58,127,63,85,63,42,0,85,63,36,85,95,153,63,34,0,63,109,88,132,63,136,81,85,103,136,127,0,150,150,150,127,0,0,0,0,0,127,0,0,255,127,114,127,99,63,127,140,127,127,0,0,0,191,0,104,0,0,0,0,0,0,0,0,0,145,216,133,0,127,0,127,170,0,0,127,127,109,85,127,127,63,85,42,150,150,150,150,150,150,150,25,150,150,150,0,127,0,0,144,85,127,132,127,85,0,127,127,127,127,127,127,59,127,85,127,127,106,47,79,127,127,204,2,141,66,0,0,127,127,0,0,0,0,127,0,159,0,0,178,127,36,85,131,127,127,127,153,95,0,140,75,27,127,127,0,150,150,198,0,0,63,30,127,165,209,198,127,127,153,204,51,51,255,255,255,204,0,255,150,150,150,150,150,150,150,150,150,150,0,150,150,150,150,150,0,127,127,150,150,150,150,150,150,150,150,0,0,150,51,132,150,150,150'), 'Wearable 0:0' => array('PrincipalID' => $user_uuid, 'Name' => 'Wearable 0:0', 'Value' => '66c41e39-38f9-f75a-024e-585989bfab73'), 'Wearable 1:0' => array('PrincipalID' => $user_uuid, 'Name' => 'Wearable 1:0', 'Value' => '77c41e39-38f9-f75a-024e-585989bbabbb'), 'Wearable 2:0' => array('PrincipalID' => $user_uuid, 'Name' => 'Wearable 2:0', 'Value' => 'd342e6c0-b9d2-11dc-95ff-0800200c9a66'), 'Wearable 3:0' => array('PrincipalID' => $user_uuid, 'Name' => 'Wearable 3:0', 'Value' => '4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7'), 'Wearable 4:0' => array('PrincipalID' => $user_uuid, 'Name' => 'Wearable 4:0', 'Value' => '00000000-38f9-1111-024e-222222111110'), 'Wearable 5:0' => array('PrincipalID' => $user_uuid, 'Name' => 'Wearable 5:0', 'Value' => '00000000-38f9-1111-024e-222222111120'));
    // From the appearance,
    // get only items with uuid values
    // those must be wearable items
    $items_only_uuids = array();
    foreach ($items_array as $key => $value) {
        if (\Opensim\UUID::is_valid($value['Value'])) {
            $items_only_uuids[$value['Name']] = $value['Value'];
        }
    }
    // Get items inserted on the database
    $apearance_items = \Opensim\Model\Os\InventoryItem::where_in('assetID', array_values($items_only_uuids))->where('avatarID', '=', $user_uuid)->get();
    // Build appearance values with
    // received appareance items
    foreach ($apearance_items as $a_item) {
        $key = array_search($a_item->assetid, $items_only_uuids);
        if (isset($key) and !empty($key)) {
            // inventoryid:assetid
            $items_array[$key]['Value'] = $a_item->inventoryid . ':' . $items_only_uuids[$key];
        }
    }
    return $items_array;
}
Exemple #2
0
 public function create_inventory($user_uuid)
 {
     if (!isset($user_uuid) or empty($user_uuid)) {
         return null;
     }
     $inventory_uuid = UUID::random();
     $inventory = array('Textures' => array('folderName' => 'Textures', 'type' => 0, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Sounds' => array('folderName' => 'Sounds', 'type' => 1, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Calling Cards' => array('folderName' => 'Calling Cards', 'type' => 2, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Landmarks' => array('folderName' => 'Landmarks', 'type' => 3, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'My Inventory' => array('folderName' => 'My Inventory', 'type' => 9, 'version' => 1, 'folderID' => $inventory_uuid, 'agentID' => $user_uuid, 'parentFolderID' => UUID::ZERO), 'Photo Album' => array('folderName' => 'Photo Album', 'type' => 15, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Clothing' => array('folderName' => 'Clothing', 'type' => 5, 'version' => 3, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Objects' => array('folderName' => 'Objects', 'type' => 6, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Notecards' => array('folderName' => 'Notecards', 'type' => 7, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Scripts' => array('folderName' => 'Scripts', 'type' => 10, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Body Parts' => array('folderName' => 'Body Parts', 'type' => 13, 'version' => 5, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Trash' => array('folderName' => 'Trash', 'type' => 14, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Lost And Found' => array('folderName' => 'Lost And Found', 'type' => 16, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Animations' => array('folderName' => 'Animations', 'type' => 20, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid), 'Gestures' => array('folderName' => 'Gestures', 'type' => 21, 'version' => 1, 'folderID' => UUID::random(), 'agentID' => $user_uuid, 'parentFolderID' => $inventory_uuid));
     $modified_inventory = Event::until('opensim.model.os.inventoryfolder.create_inventory', array($inventory_uuid, $inventory));
     if (!is_null($modified_inventory)) {
         $inventory = $modified_inventory;
     }
     $this->insert($inventory);
     return $inventory;
 }
Exemple #3
0
 public function delete_destroy($region_uuid)
 {
     if (\Opensim\UUID::is_valid($region_uuid)) {
         $affected = DB::connection('opensim')->table('regions')->where_uuid($region_uuid)->delete();
     }
     $this->data['message'] = __('opensim::lang.Region was successfully deleted')->get(ADM_LANG);
     $this->data['message_type'] = 'success';
     if (Request::ajax()) {
         // the element that hold the user info
         // to be removed by ajax
         $data = array('flash_message' => array('message_type' => 'success', 'messages' => array(__('opensim::lang.Region was successfully deleted')->get(ADM_LANG))), 'hide' => array('identifier' => 'tr#' . $region_uuid));
         return json_encode($data);
     }
     return Redirect::to(ADM_URI . '/opensim/regions')->with($this->data);
 }
Exemple #4
0
 public function create_account($user, $default_avatar_name = 'ruth')
 {
     // Check if user already exists
     $user_account = self::where_PrincipalID($user->uuid)->first();
     if (!isset($user_account)) {
         $ServiceURLs = 'HomeURI= GatekeeperURI= InventoryServerURI= AssetServerURI=';
         $user_account = new self();
         $user_account->PrincipalID = $user->uuid;
         $user_account->ScopeID = UUID::ZERO;
         $user_account->FirstName = $user->avatar_first_name;
         $user_account->LastName = $user->avatar_last_name;
         $user_account->Email = $user->email;
         $user_account->ServiceURLs = $ServiceURLs;
         $user_account->Created = time();
         $user_account->UserLevel = 0;
         $user_account->UserFlags = 0;
         $user_account->UserTitle = '';
         $user_account->save();
     }
     // Set passwords
     $account_auth = Auth::where_UUID($user->uuid)->first();
     // Check if there is no
     // password already set for this account
     if (!isset($account_auth)) {
         $account_auth = new Auth();
         if ($user->status == 'active') {
             $account_auth->passwordHash = $user->hash;
             $account_auth->passwordSalt = $user->salt;
         } else {
             $account_auth->passwordHash = $user->status;
             $account_auth->passwordSalt = $user->status;
         }
         $account_auth->UUID = $user->uuid;
         $account_auth->webLoginKey = UUID::ZERO;
         $account_auth->accountType = 'UserAccount';
         $account_auth->save();
     }
     // Set home location
     $home_location = \Settings\Model\Setting::where_module_slug('opensim')->where_slug('opensim_home_location')->first();
     if (isset($home_location->value) and \Opensim\UUID::is_valid($home_location->value)) {
         $home_location_data = array('UserID' => $user->uuid, 'HomeRegionID' => $home_location->value, 'HomePosition' => '<0,0,0>', 'HomeLookAt' => '<0,0,0>', 'LastRegionID' => $home_location->value, 'LastPosition' => '<128,128,22>', 'LastLookAt' => '<0,1,0>', 'Online' => 'False', 'Login' => $user->created_at->getTimestamp(), 'Logout' => $user->created_at->getTimestamp());
         Griduser::insert($home_location_data);
     }
     // create inventory
     $account_inventory = InventoryFolder::where_agentID($user->uuid)->get();
     if (!isset($account_inventory) or empty($account_inventory)) {
         $account_inventory = new InventoryFolder();
         $account_inventory = $account_inventory->create_inventory($user->uuid);
     } else {
         $acc_inv = array();
         foreach ($account_inventory as $folder_name => $folder) {
             $acc_inv[$folder->foldername] = array('folderName' => $folder->foldername, 'type' => $folder->type, 'version' => $folder->version, 'folderID' => $folder->folderid, 'agentID' => $folder->agentid, 'parentFolderID' => $folder->parentfolderid);
         }
         $account_inventory = $acc_inv;
     }
     // Load avatar initial items items
     $items = Event::until('opensim.load.avatar.items', array($default_avatar_name, $user, $account_inventory));
     if (is_null($items)) {
         $items = \Opensim\load_ruth_items($user->uuid, $account_inventory);
     }
     if (isset($items) and !empty($items)) {
         $invento = InventoryItem::insert($items);
     }
     // Load Avatar appearance
     $items_array = Event::until('opensim.load.avatar.appearance', array($default_avatar_name, $user));
     if (is_null($items_array)) {
         $items_array = \Opensim\load_ruth_appearance($user->uuid);
     }
     // Save appearance
     $avatar_apearance = \Opensim\Model\Os\Avatar::insert($items_array);
 }