Exemplo n.º 1
0
def sendRezObject(agent,
                  inventory_item,
                  RayStart,
                  RayEnd,
                  FromTaskID=UUID(),
                  BypassRaycast=1,
                  RayTargetID=UUID(),
                  RayEndIsIntersection=False,
                  RezSelected=False,
                  RemoveItem=True,
                  ItemFlags=0,
                  GroupMask=0,
                  EveryoneMask=0,
                  NextOwnerMask=0):
    """ sends a RezObject packet to a region """

    packet = Message(
        'RezObject',
        Block('AgentData',
              AgentID=agent.agent_id,
              SessionID=agent.session_id,
              GroupID=agent.ActiveGroupID),
        Block('RezData',
              FromTaskID=UUID(str(FromTaskID)),
              BypassRaycast=BypassRaycast,
              RayStart=RayStart,
              RayEnd=RayEnd,
              RayTargetID=UUID(str(RayTargetID)),
              RayEndIsIntersection=RayEndIsIntersection,
              RezSelected=RezSelected,
              RemoveItem=RemoveItem,
              ItemFlags=ItemFlags,
              GroupMask=GroupMask,
              EveryoneMask=EveryoneMask,
              NextOwnerMask=NextOwnerMask),
        Block('InventoryData',
              ItemID=inventory_item.ItemID,
              FolderID=inventory_item.FolderID,
              CreatorID=inventory_item.CreatorID,
              OwnerID=inventory_item.OwnerID,
              GroupID=inventory_item.GroupID,
              BaseMask=inventory_item.BaseMask,
              OwnerMask=inventory_item.OwnerMask,
              GroupMask=inventory_item.GroupMask,
              EveryoneMask=inventory_item.EveryoneMask,
              GroupOwned=inventory_item.GroupOwned,
              TransactionID=UUID(),
              Type=inventory_item.Type,
              InvType=inventory_item.InvType,
              Flags=inventory_item.Flags,
              SaleType=inventory_item.SaleType,
              SalePrice=inventory_item.SalePrice,
              Name=inventory_item.Name,
              Description=inventory_item.Description,
              CreationDate=inventory_item.CreationDate,
              CRC=inventory_item.CRC,
              NextOwnerMask=inventory_item.NextOwnerMask))

    agent.region.enqueue_message(packet)
Exemplo n.º 2
0
 def processGetScriptRunning(self, obj_id, item_id):
     print("GetScriptRunning", obj_id, item_id)
     agent = self.manager.client
     packet = Message(
         'GetScriptRunning',
         Block('Script',
               ObjectID=UUID(str(obj_id)),
               ItemID=UUID(str(item_id))))
     agent.region.enqueue_message(packet)
Exemplo n.º 3
0
 def object_created(object_info):
     prim = object_info.payload['object']
     matches = client.inventory.search_inventory(
         client.inventory.folders, name="Objects")
     folder = matches.pop()
     transaction_id = UUID()
     transaction_id.random()
     prim.derez(client, DeRezDestination.TakeIntoAgentInventory,
                folder.FolderID, transaction_id, client.active_group_id)
     s.signal()
Exemplo n.º 4
0
    def onInventoryDescendents(self, packet):

        if packet['AgentData'][0]['Descendents'] > 0:

            _agent_id = packet['AgentData'][0]['AgentID']
            _folder_id = packet['AgentData'][0]['FolderID']
            _owner_id = packet['AgentData'][0]['OwnerID']
            _version = packet['AgentData'][0]['Version']
            _descendents = packet['AgentData'][0]['Descendents']
            # _descendents is not dealt with in any way here


            if str(packet['ItemData'][0]['ItemID']) != str(UUID()):

                for ItemData_block in packet['ItemData']:

                    _ItemID = ItemData_block['ItemID']
                    _FolderID = ItemData_block['FolderID']
                    _CreatorID = ItemData_block['CreatorID']
                    _OwnerID = ItemData_block['OwnerID']
                    _GroupID = ItemData_block['GroupID']
                    _BaseMask = ItemData_block['BaseMask']
                    _OwnerMask = ItemData_block['OwnerMask']
                    _GroupMask = ItemData_block['GroupMask']
                    _EveryoneMask = ItemData_block['EveryoneMask']
                    _NextOwnerMask = ItemData_block['NextOwnerMask']
                    _GroupOwned = ItemData_block['GroupOwned']
                    _AssetID = ItemData_block['AssetID']
                    _Type = ItemData_block['Type']
                    _InvType = ItemData_block['InvType']
                    _Flags = ItemData_block['Flags']
                    _SaleType = ItemData_block['SaleType']
                    _SalePrice = ItemData_block['SalePrice']
                    _Name = ItemData_block['Name']
                    _Description = ItemData_block['Description']
                    _CreationDate = ItemData_block['CreationDate']
                    _CRC = ItemData_block['CRC']

                    inventory_item = InventoryItem(_ItemID, _FolderID, _CreatorID, _OwnerID, _GroupID, _BaseMask, _OwnerMask, _GroupMask, _EveryoneMask, _NextOwnerMask, _GroupOwned, _AssetID, _Type, _InvType, _Flags, _SaleType, _SalePrice, _Name, _Description, _CreationDate, _CRC)

                    self._store_inventory_item(inventory_item)

            if str(packet['FolderData'][0]['FolderID']) != str(UUID()):

                for FolderData_block in packet['FolderData']:

                    _FolderID = FolderData_block['FolderID']
                    _ParentID = FolderData_block['ParentID']
                    _Type = FolderData_block['Type']
                    _Name = FolderData_block['Name']

                    folder = InventoryFolder( _Name, _FolderID, _ParentID, None, _Type, _agent_id)

                    self._store_inventory_folder(folder)
Exemplo n.º 5
0
 def processScriptReset(self, obj_id, item_id):
     agent = self.manager.client
     packet = Message(
         'ScriptReset',
         Block('AgentData',
               AgentID=agent.agent_id,
               SessionID=agent.session_id),
         Block('Script',
               ObjectID=UUID(str(obj_id)),
               ItemID=UUID(str(item_id))))
     agent.region.enqueue_message(packet)
Exemplo n.º 6
0
    def test_onObjectUpdate_selected(self):

        self.object_store.agent = Agent()
        fake_uuid = UUID()
        fake_uuid.random()
        packet = Message(
            'ObjectUpdate', Block('RegionData', RegionHandle=0,
                                  TimeDilation=0),
            Block('ObjectData',
                  ID=1,
                  State=1,
                  FullID=fake_uuid,
                  CRC=0,
                  PCode=0,
                  Material=0,
                  ClickAction=0,
                  Scale=Vector3(X=0.0, Y=0.0, Z=0.0),
                  ObjectData='',
                  ParentID=fake_uuid,
                  UpdateFlags=0,
                  ProfileCurve=0,
                  PathBegin=0.0,
                  PathEnd=0.0,
                  PathScaleX=0.0,
                  PathScaleY=0.0,
                  PathShearX=0.0,
                  PathShearY=0.0,
                  PathTwist=-1,
                  PathTwistBegin=-1,
                  PathRadiusOffset=-1,
                  PathTaperX=-1,
                  PathTaperY=-1,
                  PathRevolutions=0,
                  PathSkew=-1,
                  ProfileBegin=0,
                  ProfileEnd=0,
                  ProfileHollow=0,
                  TextureEntry='',
                  TextureAnim='',
                  NameValue='Test',
                  Data='',
                  Text='',
                  TextColor=0x0,
                  MedialURL=''))

        def callback(payload):
            self.data.append("foo")

        object_handler = self.object_store.agent.events_handler.register(
            "ObjectSelected")
        object_handler.subscribe(callback)
        self.object_store.region.message_handler.handle(packet)
        self.assertTrue(self.data.pop, "foo")
Exemplo n.º 7
0
 def processCreateInventoryItem(self, trID, asset_type, inv_type, name,
                                desc):
     wearable_type = 0
     agent = self.manager.client
     next_owner_permission = 0
     print("processCreateInventoryItem", trID, asset_type)
     self.inventory.send_CreateInventoryItem(agent.agent_id,
                                             agent.session_id, 0, UUID(),
                                             UUID(trID),
                                             next_owner_permission,
                                             asset_type, inv_type,
                                             wearable_type, name, desc)
Exemplo n.º 8
0
    def create_new_item(self, folder, name, desc, asset_type, inv_type,
                        wearable_type, next_owner_permission, callback=None):
        """
        Creates a new item in folder.
        """
        transaction_id = UUID()
        transaction_id.random()

        updateCreateInventoryHandler = self.agent.region.message_handler.register('UpdateCreateInventoryItem')

        def onUpdateCreateInventoryItem(packet):
            if str(transaction_id) != str(packet['AgentData'][0]['TransactionID']):
                inv_data = packet['InventoryData'][0]
                item = InventoryItem(inv_data['ItemID'],
                                     inv_data['FolderID'],
                                     inv_data['CreatorID'],
                                     inv_data['OwnerID'],
                                     inv_data['GroupID'],
                                     inv_data['BaseMask'],
                                     inv_data['OwnerMask'],
                                     inv_data['GroupMask'],
                                     inv_data['EveryoneMask'],
                                     inv_data['NextOwnerMask'],
                                     inv_data['GroupOwned'],
                                     inv_data['AssetID'],
                                     inv_data['Type'],
                                     inv_data['InvType'],
                                     inv_data['Flags'],
                                     inv_data['SaleType'],
                                     inv_data['SalePrice'],
                                     inv_data['Name'],
                                     inv_data['Description'],
                                     inv_data['CreationDate'],
                                     inv_data['CRC'])

                self._store_inventory_item(item)
                updateCreateInventoryHandler.unsubscribe(onUpdateCreateInventoryItem)
                if callback != None:
                    callback(item)

        updateCreateInventoryHandler.subscribe(onUpdateCreateInventoryItem) 

        self.send_CreateInventoryItem(self.agent.agent_id,
                                      self.agent.session_id,
                                      0,
                                      folder.FolderID,
                                      transaction_id,
                                      next_owner_permission,
                                      asset_type,
                                      inv_type,
                                      wearable_type,
                                      name,
                                      desc)
Exemplo n.º 9
0
 def processSetScriptRunning(self, obj_id, item_id, running):
     print("SetScriptRunning", obj_id, item_id, running)
     agent = self.manager.client
     packet = Message(
         'SetScriptRunning',
         Block('AgentData',
               AgentID=agent.agent_id,
               SessionID=agent.session_id),
         Block('Script',
               ObjectID=UUID(str(obj_id)),
               ItemID=UUID(str(item_id)),
               Running=int(running)))
     agent.region.enqueue_message(packet)
Exemplo n.º 10
0
    def __init__(self, Name = None, FolderID = None, ParentID = None, Version = None, Type = None, AgentID = UUID(), Descendents = 0):
        """ initialize the inventory folder """

        self.type = 'InventoryFolder'

        self.Name = Name
        self.FolderID = UUID(str(FolderID))
        self.ParentID = UUID(str(ParentID))
        self.Version = Version
        self.Type = Type
        self.Descendents = Descendents
        self.AgentID = UUID(str(AgentID))

        self.inventory = []
Exemplo n.º 11
0
    def request_agent_wearables(self):
        """
        Asks the simulator what the avatar is wearing
        #TODO create a one--shot callback
        """
        if self.agent.agent_id == None or self.agent.session_id == None or \
              str(self.agent.agent_id) == str(UUID()) or \
              str(self.agent.session_id) == str(UUID()):
            logger.warning(
                "Agent has either no agent_id or session_id, message not sent")
            return

        self.send_AgentWearablesRequest(self.agent.agent_id,
                                        self.agent.session_id)
Exemplo n.º 12
0
    def processCreate(self, obj_name, obj_uuid_str, mesh_name, mesh_uuid_str, pos, rot,
                     scale, b64data, materials):
        # create asset
        obj_uuid = UUID(obj_uuid_str)
        data = base64.urlsafe_b64decode(b64data.encode('ascii'))
        self._next_create = (self._next_create + 1) % (256*256)
        obj_idx = self._next_create
        def finishupload(asset_id, transaction_id):
            # asset uploaded, we have its uuid and can proceed now
            tok = UUID(str(uuid.uuid4()))
            def finish_creating(real_uuid):
                # object finished creating and here we get its real uuid and can
                # confirm creation to the client sending the new uuids.
                del self._creating_cb[obj_idx]
                args = {"RexMeshUUID": str(asset_id),
                        "RexIsVisible": True,
                        "materials": materials}
                #self.processPos(obj_uuid_str, pos, rot)
                self.rexdata.sendRexPrimData(real_uuid, args)
                self.out_queue.put(["meshcreated", obj_uuid_str, mesh_uuid_str,
                                    str(real_uuid), str(asset_id)])
            self._creating_cb[obj_idx] = finish_creating
            self.sendCreateObject(obj_uuid, pos, rot, scale, obj_idx)

        # send the asset data and wait for ack from the uploader
        assetID = self.manager.uploader.uploadAsset(AssetType.OgreMesh, data, finishupload)
Exemplo n.º 13
0
    def store_agent(self, agent):
        """ adds an agent to the store """

        if str(type(agent)) != '<class \'pyogp.lib.client.agent.Agent\'>':
            logger.warning("The AgentManager stores only Agent instances to initialize. Stopping.")
            return False

        # check if the agent is on the store
        if self._is_stored(agent) == False:

            if agent.agent_id == None:
                key = UUID().random()
            else:
                key = agent.agent_id

            self.agents[key] = agent

            logger.info("Stored agent %s with a key of %s" % (agent.name, key))

        else: 

            if agent.firstname != None and agent.lastname != None:
                uniq = ' named ' + agent.Name()

            logger.warning("The AgentManager is already storing an agent%s. Stopping." % (uniq))
Exemplo n.º 14
0
def fetch_agent_properties(client, agent_id, callback=None):

    # Send AvatarPropertiesRequest
    # Get back AvatarPropertiesReply

    def onAgentPropertiesReply(packet):
        if repr(packet['AgentData'][0]['AvatarID']) == agent_id:

            block = packet['PropertiesData'][0]
            for prop in [
                    'ImageID', 'FLImageID', 'PartnerID', 'AboutText',
                    'FLAboutText', 'BornOn', 'ProfileURL', 'CharterMember',
                    'Flags'
            ]:
                print "%s: %s" % (prop, block[prop])

            if callback:
                callback(packet)

    client.region.message_handler.register('AvatarPropertiesReply').subscribe(
        onAgentPropertiesReply)

    packet = Message(
        'AvatarPropertiesRequest',
        Block('AgentData',
              AgentID=client.agent_id,
              SessionID=client.session_id,
              AvatarID=UUID(agent_id)))

    client.region.enqueue_message(packet)
Exemplo n.º 15
0
    def request_join_group_chat(self):
        """ sends an ImprovedInstantMessage packet with the atributes necessary to join a group chat """

        logger.info("Requesting to join group chat session for \'%s\'" %
                    (self.GroupName))

        _AgentID = self.agent.agent_id
        _SessionID = self.agent.session_id
        _FromGroup = False
        _ToAgentID = self.GroupID
        _ParentEstateID = 0
        _RegionID = UUID()
        _Position = Vector3()
        _Offline = 0
        _Dialog = ImprovedIMDialogue.SessionGroupStart
        _ID = self.GroupID
        _Timestamp = 0
        _FromAgentName = self.agent.Name()
        _Message = 'Message' ''
        _BinaryBucket = ''

        self.agent.send_ImprovedInstantMessage(_AgentID, _SessionID,
                                               _FromGroup, _ToAgentID,
                                               _ParentEstateID, _RegionID,
                                               _Position, _Offline, _Dialog,
                                               _ID, _Timestamp, _FromAgentName,
                                               _Message, _BinaryBucket)
Exemplo n.º 16
0
    def send_UUIDNameRequest(self, agent_ids, callback):
        """ sends a UUIDNameRequest message to the host simulator """

        handler = self.region.message_handler.register('UUIDNameReply')

        def onUUIDNameReply(packet):
            """ handles the UUIDNameReply message from a simulator """
            logger.info('UUIDNameReplyPacket received')

            cbdata = []
            for block in packet['UUIDNameBlock']:
                agent_id = str(block['ID'])
                first_name = block['FirstName']
                last_name = block['LastName']
                self.agent_id_map[agent_id] = (first_name, last_name)
                cbdata.append((agent_id, first_name, last_name))

            # Fire the callback only when all names are received
            missing = [ agent_id
                        for agent_id in agent_ids
                        if agent_id not in self.agent_id_map ]
            if not missing:
                handler.unsubscribe(onUUIDNameReply)
                callback(cbdata)
            else:
                logger.info('Still waiting on %d names in send_UUIDNameRequest', len(missing))

        handler.subscribe(onUUIDNameReply)

        logger.info('sending UUIDNameRequest')

        packet = Message('UUIDNameRequest', 
                        [Block('UUIDNameBlock', ID = UUID(agent_id)) for agent_id in agent_ids])

        self.region.enqueue_message(packet)
Exemplo n.º 17
0
 def parse_data(self):
     if not self.data:
         return
     tokens = self.data.split()
     i = iter(tokens)
     while True:
         try:
             token = i.next()
             if token.lower() == 'version':
                 self.Version = int(i.next())
             if token.lower() == 'type':
                 self.Type = int(i.next())
             if token.lower() == 'parameters':
                 count = int(i.next())
                 for num in range(count):
                     paramID = int(i.next())
                     paramVal = i.next()
                     #TODO Verify this is correct behavior this fix may be a hack
                     if paramVal == '.':
                         self.params[paramID] = 0.0
                     else:
                         self.params[paramID] = float(paramVal)
             if token.lower() == 'textures':
                 count = int(i.next())
                 for num in range(count):
                     textureID = int(i.next())
                     self.textures[textureID] = UUID(i.next())
         except StopIteration:
             break
Exemplo n.º 18
0
 def sendLocalTeleport(self, agent, pos):
     client = self.manager.client
     if not agent.FullID == client.agent_id:
         print("Trying to move an agent for other user")
     t_id = uuid.uuid4()
     invoice_id = UUID()
     client.teleport(region_handle=client.region.RegionHandle,
                     position=Vector3(X=pos[0], Y=pos[1], Z=pos[2]))
Exemplo n.º 19
0
 def create_default_wearables(self):
     create = [True, True, True, True, True, True, True, True, False, False, \
               True, True, False]
     for i in range(WearablesIndex.WT_COUNT):
         if create[i]:
             asset_id == UUID()
             asset_id.random()
             self.wearables[i] = Wearable(i, AssetID=asset_id)
Exemplo n.º 20
0
 def processRezScript(self, obj_uuid_str, item_id):
     agent = self.manager.client
     obj = agent.region.objects.get_object_from_store(FullID=obj_uuid_str)
     item = self.findItem(item_id)
     if obj and item:
         agent.region.objects.send_RezScript(agent,
                                             obj,
                                             UUID(item_id),
                                             Name=item.Name)
Exemplo n.º 21
0
    def sendCreateObject(self, objId, pos, rot, scale, tok):
        RayTargetID = UUID()
        RayTargetID.random()

        client = self.manager.client
        client.region.objects.object_add(client.agent_id, client.session_id,
                        PCodeEnum.Primitive,
                        Material = 3, AddFlags = 2, PathCurve = 16,
                        ProfileCurve = 1, PathBegin = 0, PathEnd = 0,
                        PathScaleX = 100, PathScaleY = 100, PathShearX = 0,
                        PathShearY = 0, PathTwist = 0, PathTwistBegin = 0,
                        PathRadiusOffset = 0, PathTaperX = 0, PathTaperY = 0,
                        PathRevolutions = 0, PathSkew = 0, ProfileBegin = 0,
                        ProfileEnd = 0, ProfileHollow = tok, BypassRaycast = 1,
                        RayStart = pos, RayEnd = pos,
                        RayTargetID = RayTargetID, RayEndIsIntersection = 0,
                        Scale = scale, Rotation = rot,
                        State = 0)
Exemplo n.º 22
0
    def sendCreateObject(self, objId, pos, rot, scale, tok):
        RayTargetID = UUID()
        RayTargetID.random()

        client = self.manager.client
        client.region.objects.object_add(client.agent_id, client.session_id,
                        PCodeEnum.Primitive,
                        Material = 3, AddFlags = 2, PathCurve = 16,
                        ProfileCurve = 1, PathBegin = 0, PathEnd = 0,
                        PathScaleX = 100, PathScaleY = 100, PathShearX = 0,
                        PathShearY = 0, PathTwist = 0, PathTwistBegin = 0,
                        PathRadiusOffset = 0, PathTaperX = 0, PathTaperY = 0,
                        PathRevolutions = 0, PathSkew = 0, ProfileBegin = 0,
                        ProfileEnd = 0, ProfileHollow = tok, BypassRaycast = 1,
                        RayStart = pos, RayEnd = pos,
                        RayTargetID = RayTargetID, RayEndIsIntersection = 0,
                        Scale = scale, Rotation = rot,
                        State = 0)
Exemplo n.º 23
0
    def processClone(self, obj_name, obj_uuid_str, mesh_name, mesh_uuid_str, pos, rot,
                     scale, materials):
        # create asset
        obj_uuid = UUID(obj_uuid_str)
        self._next_create = (self._next_create + 1) % (256*256)
        obj_idx = self._next_create

        tok = UUID(str(uuid.uuid4()))
        def finish_creating(real_uuid, transaction_id):
            del self._creating_cb[obj_idx]
            args = {"RexMeshUUID": mesh_uuid_str,
                    "materials": materials,
                    "RexIsVisible": True}
            self.out_queue.put(["meshcreated", obj_uuid_str, mesh_uuid_str,
                                str(real_uuid), mesh_uuid_str])
            self.rexdata.sendRexPrimData(real_uuid, args)
        self._creating_cb[obj_idx] = finish_creating
        self.sendCreateObject(obj_uuid, pos, rot, scale, obj_idx)
Exemplo n.º 24
0
 def processScriptSensorRequest(self, obj_id, item_id, *args):
     agent = self.manager.client
     # XXX missing parameter setup
     packet = Message(
         'ScriptSensorRequest',
         Block('Requester',
               SourceID=UUID(source_id),
               RequestID=UUID(request_id),
               SearchID=UUID(search_id),
               SearchPos=Vector3(search_pos),
               SearchDir=Quaternion(search_dir),
               SearchName=search_name,
               Type=_type,
               Range=_range,
               Arc=arc,
               RegionHandle=region_handle,
               SearchRegions=search_regions))
     agent.region.enqueue_message(packet)
Exemplo n.º 25
0
    def instant_message(self, 
                        ToAgentID = None, 
                        _Message = None, 
                        _ID = None):
        """ sends an instant message to another avatar, wrapping Agent().send_ImprovedInstantMessage() with some handy defaults """

        if ToAgentID != None and _Message != None:

            if _ID == None: 
                _ID = self.agent_id

            _AgentID = self.agent_id
            _SessionID = self.session_id
            _FromGroup = False
            _ToAgentID = UUID(str(ToAgentID))
            _ParentEstateID = 0
            _RegionID = UUID()
            _Position = self.Position
            _Offline = 0
            _Dialog = ImprovedIMDialogue.FromAgent
            _ID = _ID
            _Timestamp = 0
            _FromAgentName = self.firstname + ' ' + self.lastname
            _Message = _Message
            _BinaryBucket = ''

            self.send_ImprovedInstantMessage(_AgentID, 
                                            _SessionID, 
                                            _FromGroup, 
                                            _ToAgentID, 
                                            _ParentEstateID, 
                                            _RegionID, 
                                            _Position, 
                                            _Offline, 
                                            _Dialog, 
                                            _ID, 
                                            _Timestamp, 
                                            _FromAgentName, 
                                            _Message, 
                                            _BinaryBucket)

        else:

            logger.info("Please specify an agentid and message to send in agent.instant_message")
Exemplo n.º 26
0
    def __init__(self,
                 ItemID = None,
                 FolderID = None,
                 CreatorID = None,
                 OwnerID = None,
                 GroupID = None,
                 BaseMask = None,
                 OwnerMask = None,
                 GroupMask = None,
                 EveryoneMask = None,
                 NextOwnerMask = 0,
                 GroupOwned = None,
                 AssetID = None,
                 Type = None,
                 InvType = None,
                 Flags = None,
                 SaleType = None,
                 SalePrice = None,
                 Name = None,
                 Description = None,
                 CreationDate = None,
                 CRC = None,
                 LastOwnerID = UUID()):
        """ initialize the inventory item """

        self.type = 'InventoryItem'

        self.ItemID = UUID(str(ItemID))            # LLUUID
        self.FolderID = UUID(str(FolderID))        # LLUUID
        self.CreatorID = UUID(str(CreatorID))      # LLUUID
        self.OwnerID = UUID(str(OwnerID))          # LLUUID
        self.GroupID = UUID(str(GroupID))          # LLUUID
        self.BaseMask = BaseMask                        # U32
        self.OwnerMask = OwnerMask                      # U32
        self.GroupMask = GroupMask                      # U32
        self.EveryoneMask = EveryoneMask                # U32
        self.NextOwnerMask = NextOwnerMask
        self.GroupOwned = GroupOwned                    # Bool
        self.AssetID = UUID(str(AssetID))          # LLUUID
        self.Type = Type                                # S8
        self.InvType = InvType                          # S8
        self.Flags = Flags                              # U32
        self.SaleType = SaleType                        # U8
        self.SalePrice = SalePrice                      # S32
        self.Name = Name                                # Variable 1
        self.Description = Description                  # Variable 1
        self.CreationDate = CreationDate                # S32
        self.CRC = CRC                                  # U32
        self.LastOwnerID = UUID(str(LastOwnerID))
Exemplo n.º 27
0
    def processRemoveInventoryItem(self, item_id):
        logger = self.logger
        logger.debug('processRemoveIntenvoryItem')

        self.removeInventoryItem(item_id)

        client = self.manager.client
        self.inventory.send_RemoveInventoryItem(client.agent_id,
                                                client.session_id,
                                                UUID(str(item_id)))
Exemplo n.º 28
0
 def get_hash(self, wearables):
     """
     Creates a hash using the assetIDs for each wearable in a baked layer
     """
     wearable_map = WearableMap().map
     hash = UUID()
     for wearable_index in wearable_map[self.bakedIndex]:
         hash ^= wearables[wearable_index].AssetID
     if str(hash) != '00000000-0000-0000-0000-000000000000':
         hash ^= self.secret_hash
     return hash
Exemplo n.º 29
0
    def sendUpdateInventoryItem(self,
                                agent,
                                transaction_id,
                                inventory_items=[]):
        """ sends an UpdateInventoryItem packet to a region 

        this function expects an InventoryItem instance already with updated data
        """
        packet = Message(
            'UpdateInventoryItem',
            Block('AgentData',
                  AgentID=agent.agent_id,
                  SessionID=agent.session_id,
                  TransactionID=UUID()), *[
                      Block('InventoryData',
                            ItemID=item.ItemID,
                            FolderID=item.FolderID,
                            CallbackID=random.randint(0,
                                                      pow(2, 32) - 1),
                            CreatorID=item.CreatorID,
                            OwnerID=item.OwnerID,
                            GroupID=item.GroupID,
                            BaseMask=item.BaseMask,
                            OwnerMask=item.OwnerMask,
                            GroupMask=item.GroupMask,
                            EveryoneMask=item.EveryoneMask,
                            NextOwnerMask=item.NextOwnerMask,
                            GroupOwned=item.GroupOwned,
                            TransactionID=UUID(transaction_id),
                            Type=item.Type,
                            InvType=item.InvType,
                            Flags=item.Flags,
                            SaleType=item.SaleType,
                            SalePrice=item.SalePrice,
                            Name=item.Name,
                            Description=item.Description,
                            CreationDate=item.CreationDate,
                            CRC=item.CRC) for item in inventory_items
                  ])

        agent.region.enqueue_message(packet)
Exemplo n.º 30
0
    def uploadAsset(self, assetType, data, cb):
        """
        Request an asset upload from the simulator
        """
        tr_uuid = UUID()
        tr_uuid.random()
        init_data = None
        assetID = uuid_combine(tr_uuid, self._agent.secure_session_id)

        #if len(data) < 1024:
        #    init_data = array('c', data)
        #else:
        newuploader = XferUploader(data, cb, tr_uuid)
        self._uploaders[str(assetID)] = newuploader

        self._agent.asset_manager.upload_asset(tr_uuid,
                                               assetType,
                                               False, # tempfile
                                               False, # storelocal
                                               init_data) # asset_data
        return  assetID
Exemplo n.º 31
0
    def sendParcelDwellRequest(self, agent_id, session_id, LocalID):
        """ send a ParcelDwellRequest packet """

        packet = Message('ParcelDwellRequest', 
                        Block('AgentData',
                                AgentID = agent_id,
                                SessionID = session_id),
                        Block('Data',
                                LocalID = LocalID,
                                ParcelID = UUID()))

        self.region.enqueue_message(packet, True)
Exemplo n.º 32
0
 def processPos(self, objId, pos, rot=None):
     client = self.client
     obj = client.region.objects.get_object_from_store(FullID=objId)
     if not obj:
         obj = client.region.objects.get_avatar_from_store(FullID=UUID(objId))
         if obj:
             self.manager.misc.sendLocalTeleport(obj, pos)
             return
     if obj:
         pos = pos
         rot = rot
         self.sendPositionUpdate(obj, pos, rot)