Package com.ngt.jopenmetaverse.shared.types

Examples of com.ngt.jopenmetaverse.shared.types.UUID


    {
        AbortXferPacket abort = (AbortXferPacket)e.getPacket();
        XferDownload download = null;

        // Lame ulong to UUID conversion, please go away Xfer system
        UUID transferID = new UUID(abort.XferID.ID.longValue());

        synchronized(Transfers)
        {
            Transfer transfer;
            if ((transfer = Transfers.get(transferID))!=null)
View Full Code Here


                    case Edit:
                        if (onViewerEffect != null)
                        {
                            if (block.TypeData.length == 56)
                            {
                                UUID sourceAvatar = new UUID(block.TypeData, 0);
                                UUID targetObject = new UUID(block.TypeData, 16);
                                Vector3d targetPos = new Vector3d(block.TypeData, 32);
                                onViewerEffect.raiseEvent(new ViewerEffectEventArgs(type, sourceAvatar, targetObject, targetPos, block.Duration, block.ID));
                            }
                            else
                            {
                                JLogger.warn("Received a " + type.toString() +
                                    " ViewerEffect with an incorrect TypeData size of " +
                                    block.TypeData.length + " bytes");
                            }
                        }
                        break;
                    case LookAt:
                        if (onViewerEffectLookAt != null)
                        {
                            if (block.TypeData.length == 57)
                            {
                                UUID sourceAvatar = new UUID(block.TypeData, 0);
                                UUID targetObject = new UUID(block.TypeData, 16);
                                Vector3d targetPos = new Vector3d(block.TypeData, 32);
                                LookAtType lookAt = LookAtType.get(block.TypeData[56]);

                                onViewerEffectLookAt.raiseEvent(new ViewerEffectLookAtEventArgs(sourceAvatar, targetObject, targetPos, lookAt,
                                    block.Duration, block.ID));
                            }
                            else
                            {
                                JLogger.warn("Received a LookAt ViewerEffect with an incorrect TypeData size of " +
                                    block.TypeData.length + " bytes");
                            }
                        }
                        break;
                    case PointAt:
                        if (onViewerEffectPointAt != null)
                        {
                            if (block.TypeData.length == 57)
                            {
                                UUID sourceAvatar = new UUID(block.TypeData, 0);
                                UUID targetObject = new UUID(block.TypeData, 16);
                                Vector3d targetPos = new Vector3d(block.TypeData, 32);
                                PointAtType pointAt = PointAtType.get(block.TypeData[56]);

                                onViewerEffectPointAt.raiseEvent(new ViewerEffectPointAtEventArgs(e.getSimulator(), sourceAvatar, targetObject, targetPos,
                                    pointAt, block.Duration, block.ID));
View Full Code Here

  private void EmptySystemFolder(AssetType folderType) throws InventoryException
  {
    List<InventoryBase> items = _Store.GetContents(_Store.getRootFolder());

    UUID folderKey = UUID.Zero;
    for(InventoryBase item : items)
    {
      if (((InventoryFolder)item) != null)
      {
        InventoryFolder folder =(InventoryFolder)item;
View Full Code Here

  /// <remarks>If you specify a preferred type of <code>AsseType.Folder</code>
  /// it will create a new root folder which may likely cause all sorts
  /// of strange problems</remarks>
  public UUID CreateFolder(UUID parentID, String name, AssetType preferredType)
  {
    UUID id = UUID.Random();

    // Assign a folder name if one is not already set
    if (Utils.isNullOrEmpty(name))
    {
      if (preferredType.getIndex() >= AssetType.Texture.getIndex() && preferredType.getIndex() <= AssetType.Gesture.getIndex())
View Full Code Here

  /// <remarks>For items with copy permissions a copy of the item is placed in the tasks inventory,
  /// for no-copy items the object is moved to the tasks inventory</remarks>
  // DocTODO: what does the return UUID correlate to if anything?
  public UUID UpdateTaskInventory(long objectLocalID, InventoryItem item)
  {
    UUID transactionID = UUID.Random();

    UpdateTaskInventoryPacket update = new UpdateTaskInventoryPacket();
    update.AgentData.AgentID = Client.self.getAgentID();
    update.AgentData.SessionID = Client.self.getSessionID();
    update.UpdateData.Key = 0;
View Full Code Here

  /// </code>
  /// </example>
  // DocTODO: what does the return UUID correlate to if anything?
  public UUID CopyScriptToTask(long objectLocalID, InventoryItem item, boolean enableScript)
  {
    UUID transactionID = UUID.Random();

    RezScriptPacket ScriptPacket = new RezScriptPacket();
    ScriptPacket.AgentData.AgentID = Client.self.getAgentID();
    ScriptPacket.AgentData.SessionID = Client.self.getSessionID();
View Full Code Here

            if (key[0].equals("inv_object"))
            {
              //region inv_object
   
              // In practice this appears to only be used for folders
              UUID itemID = UUID.Zero;
              UUID parentID = UUID.Zero;
              String name = "";
              AssetType assetType = AssetType.Unknown;
   
              while (lineNum < lines.length)
              {
                if (ParseLine(lines[lineNum++], key, value))
                {
                  if (key[0].equals("{"))
                  {
                    continue;
                  }
                  else if (key[0].equals("}"))
                  {
                    break;
                  }
                  else if (key[0].equals("obj_id"))
                  {
                    itemID= UUID.Parse(value[0]);
                  }
                  else if (key[0].equals("parent_id"))
                  {
                    parentID= UUID.Parse(value[0]);
                  }
                  else if (key[0].equals("type"))
                  {
                    assetType = Utils.StringToAssetType(value[0]);
                  }
                  else if (key[0].equals("name"))
                  {
                    name = value[0].substring(0, value[0].indexOf('|'));
                  }
                }
              }
   
              if (assetType == AssetType.Folder)
              {
                InventoryFolder folder = new InventoryFolder(itemID);
                folder.Name = name;
                folder.ParentUUID = parentID;
   
                items.add(folder);
              }
              else
              {
                InventoryItem item = new InventoryItem(itemID);
                item.Name = name;
                item.ParentUUID = parentID;
                item.AssetType = assetType;
   
                items.add(item);
              }
   
              //endregion inv_object
            }
            else if (key.equals("inv_item"))
            {
              //region inv_item
   
              // Any inventory item that links to an assetID, has permissions, etc
              UUID itemID = UUID.Zero;
              UUID assetID = UUID.Zero;
              UUID parentID = UUID.Zero;
              UUID creatorID = UUID.Zero;
              UUID ownerID = UUID.Zero;
              UUID lastOwnerID = UUID.Zero;
              UUID groupID = UUID.Zero;
              boolean groupOwned = false;
              String name = "";
              String desc = "";
              AssetType assetType = AssetType.Unknown;
              InventoryType inventoryType = InventoryType.Unknown;
View Full Code Here

    if (onInventoryObjectOffered != null &&
        (e.getIM().Dialog == InstantMessageDialog.InventoryOffered
        || e.getIM().Dialog == InstantMessageDialog.TaskInventoryOffered))
    {
      AssetType type = AssetType.Unknown;
      UUID objectID = UUID.Zero;
      boolean fromTask = false;

      if (e.getIM().Dialog == InstantMessageDialog.InventoryOffered)
      {
        if (e.getIM().BinaryBucket.length == 17)
        {
          type = AssetType.get(e.getIM().BinaryBucket[0]);
          objectID = new UUID(e.getIM().BinaryBucket, 1);
          fromTask = false;
        }
        else
        {
          JLogger.warn("Malformed inventory offer from agent");
          return;
        }
      }
      else if (e.getIM().Dialog == InstantMessageDialog.TaskInventoryOffered)
      {
        if (e.getIM().BinaryBucket.length == 1)
        {
          type = AssetType.get(e.getIM().BinaryBucket[0]);
          fromTask = true;
        }
        else
        {
          JLogger.warn("Malformed inventory offer from object");
          return;
        }
      }

      // Find the folder where this is going to go
      UUID destinationFolderID = FindFolderForType(type);

      // Fire the callback
      try
      {
        ImprovedInstantMessagePacket imp = new ImprovedInstantMessagePacket();
View Full Code Here

    private static ShapeBlock ReadShap(Node root, PrimObject prim) throws AssetPrimitiveParsingException
    {
      ShapeBlock shape = new ShapeBlock();
      ProfileShape profileShape = ProfileShape.Circle;
      HoleType holeType = HoleType.Circle;
      UUID sculptTexture = UUID.Zero;
      SculptType sculptType = SculptType.None;
        boolean hasFlexi = false;
        boolean hasLight = false;
     
        PrimObject.FlexibleBlock flexible = new PrimObject.FlexibleBlock();
        PrimObject.LightBlock light = new PrimObject.LightBlock();
     
      NodeList inodeList = root.getChildNodes();
      for(int j = 0; j < inodeList.getLength(); j++)
      {
        Node node = inodeList.item(j);
        if(node.getNodeType() == Node.ELEMENT_NODE)
        {
          String nodeName = node.getNodeName();
          if(nodeName.equalsIgnoreCase("ProfileCurve"))
          {
            shape.ProfileCurve = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("TextureEntry"))
          {
            byte[] teData = Utils.decodeBase64String(node.getFirstChild().getNodeValue().trim());
            try {
            prim.Textures =  new TextureEntry(teData, 0, teData.length);
          } catch (Exception e) {
            throw new AssetPrimitiveParsingException(e);
          }
          }
          else if(nodeName.equalsIgnoreCase("PathBegin"))
          {
            shape.PathBegin = Primitive.UnpackBeginCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathCurve"))
          {
            shape.PathCurve = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("PathEnd"))
          {
            shape.PathEnd = Primitive.UnpackEndCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathRadiusOffset"))
          {
            shape.PathRadiusOffset = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }  
          else if(nodeName.equalsIgnoreCase("PathRevolutions"))
          {
            shape.PathRevolutions = Primitive.UnpackPathRevolutions((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathScaleX"))
          {
            shape.PathScaleX = Primitive.UnpackPathScale((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathScaleY"))
          {
            shape.PathScaleY = Primitive.UnpackPathScale((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathShearX"))
          {
            shape.PathShearX = Primitive.UnpackPathShear((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathShearY"))
          {
            shape.PathShearY = Primitive.UnpackPathShear((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathSkew"))
          {
            shape.PathSkew = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTaperX"))
          {
            shape.PathTaperX = Primitive.UnpackPathTaper((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTaperY"))
          {
            shape.PathTaperY = Primitive.UnpackPathShear((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTwist"))
          {
            shape.PathTwist = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PathTwistBegin"))
          {
            shape.PathTwistBegin = Primitive.UnpackPathTwist((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("PCode"))
          {
            prim.PCode = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("ProfileBegin"))
          {
            shape.ProfileBegin = Primitive.UnpackBeginCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("ProfileEnd"))
          {
            shape.ProfileEnd = Primitive.UnpackEndCut(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("ProfileHollow"))
          {
            shape.ProfileHollow = Primitive.UnpackProfileHollow(Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("Scale"))
          {
            prim.Scale = ReadVector(node);
          }
          else if(nodeName.equalsIgnoreCase("State"))
          {
            prim.State = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("ProfileShape"))
          {
            profileShape = ProfileShape.valueOf(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("HollowShape"))
          {
            holeType = HoleType.valueOf(node.getFirstChild().getNodeValue().trim());
          }
            else if(nodeName.equalsIgnoreCase("SculptTexture"))
          {
              sculptTexture = ReadUUID(node);
          }
          else if(nodeName.equalsIgnoreCase("SculptType"))
          {
            sculptType = SculptType.get((byte)Integer.parseInt(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("FlexiSoftness"))
          {
            flexible.Softness = Integer.parseInt(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiTension"))
          {
            flexible.Tension = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiDrag"))
          {
            flexible.Drag = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiGravity"))
          {
            flexible.Gravity = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiWind"))
          {
            flexible.Wind = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiForceX"))
          {
            flexible.Force.X = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiForceY"))
          {
            flexible.Force.Y = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiForceZ"))
          {
            flexible.Force.Z = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightColorR"))
          {
            light.Color.setR(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightColorG"))
          {
            light.Color.setG(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightColorB"))
          {
            light.Color.setB(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightColorA"))
          {
            light.Color.setA(Float.parseFloat(node.getFirstChild().getNodeValue().trim()));
          }
          else if(nodeName.equalsIgnoreCase("LightRadius"))
          {
            light.Radius = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightCutoff"))
          {
            light.Cutoff = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightFalloff"))
          {
            light.Falloff = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightIntensity"))
          {
            light.Intensity = Float.parseFloat(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("FlexiEntry"))
          {
            hasFlexi = Boolean.parseBoolean(node.getFirstChild().getNodeValue().trim());
          }
          else if(nodeName.equalsIgnoreCase("LightEntry"))
          {
            hasLight = Boolean.parseBoolean(node.getFirstChild().getNodeValue().trim());
          }
          else
          {
            JLogger.warn("Not handled parsing of node " + root.getNodeName() + ":" + nodeName);
          }

        }
      }
     
        shape.ProfileCurve = Utils.ubyteToInt(profileShape.getIndex()) | Utils.ubyteToInt(holeType.getIndex());
        if (!sculptTexture.equals(UUID.Zero))
        {
            prim.Sculpt = new PrimObject.SculptBlock();
            prim.Sculpt.Texture = sculptTexture;
            prim.Sculpt.Type = Utils.ubyteToInt(sculptType.getIndex());
        }
View Full Code Here

    }
   
   
    static UUID ReadUUID(Node root)
    {
        UUID id;
        String idStr = "";

        NodeList nodeList = root.getChildNodes();   
      for(int i = 0; i < nodeList.getLength(); i++)
      {
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.types.UUID

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.