Centralizing the Asset/Inventory Systems' packets to the main libsecondlife.Packet name space.
git-svn-id: http://libopenmetaverse.googlecode.com/svn/trunk@162 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -109,7 +109,7 @@ namespace libsecondlife.InventorySystem
|
||||
|
||||
output += "description = '" + xmlSafe(Description) + "' ";
|
||||
output += "crc = '" + CRC + "' ";
|
||||
output += "debug = '" + PacketHelpers.UpdateInventoryItem.BuildCRC(this) + "' ";
|
||||
output += "debug = '" + Packets.InventoryPackets.InventoryUpdateCRC(this) + "' ";
|
||||
output += "ownerid = '" + OwnerID + "' ";
|
||||
output += "creatorid = '" + CreatorID + "' ";
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace libsecondlife.InventorySystem
|
||||
|
||||
private void UpdateCRC()
|
||||
{
|
||||
_CRC = PacketHelpers.UpdateInventoryItem.BuildCRC(this);
|
||||
_CRC = Packets.InventoryPackets.InventoryUpdateCRC(this);
|
||||
}
|
||||
|
||||
public void MoveTo( InventoryFolder targetFolder )
|
||||
@@ -369,7 +369,7 @@ namespace libsecondlife.InventorySystem
|
||||
|
||||
output += "description = '" + xmlSafe(Description) + "' ";
|
||||
output += "crc = '" + CRC + "' ";
|
||||
output += "debug = '" + PacketHelpers.UpdateInventoryItem.BuildCRC(this) + "' ";
|
||||
output += "debug = '" + Packets.InventoryPackets.InventoryUpdateCRC(this) + "' ";
|
||||
output += "ownerid = '" + OwnerID + "' ";
|
||||
output += "creatorid = '" + CreatorID + "' ";
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ namespace libsecondlife.InventorySystem
|
||||
|
||||
internal void ItemUpdate( InventoryItem iitem )
|
||||
{
|
||||
Packet packet = InventorySystem.PacketHelpers.UpdateInventoryItem.BuildPacket( slClient.Protocol, iitem, slClient.Network.AgentID );
|
||||
Packet packet = InventoryPackets.UpdateInventoryItem( slClient.Protocol, iitem, slClient.Network.AgentID );
|
||||
slClient.Network.SendPacket(packet);
|
||||
}
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ namespace libsecondlife.InventorySystem
|
||||
|
||||
output += "description = '" + xmlSafe(Description) + "' ";
|
||||
output += "crc = '" + CRC + "' ";
|
||||
output += "debug = '" + PacketHelpers.UpdateInventoryItem.BuildCRC(this) + "' ";
|
||||
output += "debug = '" + Packets.InventoryPackets.InventoryUpdateCRC(this) + "' ";
|
||||
output += "ownerid = '" + OwnerID + "' ";
|
||||
output += "creatorid = '" + CreatorID + "' ";
|
||||
|
||||
|
||||
@@ -270,15 +270,15 @@ namespace libsecondlife.Packets
|
||||
return PacketBuilder.BuildPacket("UpdateInventoryFolder", protocol, blocks, Helpers.MSG_RELIABLE | Helpers.MSG_ZEROCODED);
|
||||
}
|
||||
|
||||
/*
|
||||
Low 00323 - MoveInventoryItem - Untrusted - Unencoded
|
||||
0065 InventoryData (Variable)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
1025 FolderID (LLUUID / 1)
|
||||
1297 AgentData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
1252 Stamp (BOOL / 1)
|
||||
*/
|
||||
/*
|
||||
Low 00323 - MoveInventoryItem - Untrusted - Unencoded
|
||||
0065 InventoryData (Variable)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
1025 FolderID (LLUUID / 1)
|
||||
1297 AgentData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
1252 Stamp (BOOL / 1)
|
||||
*/
|
||||
public static Packet MoveInventoryItem(ProtocolManager protocol
|
||||
, LLUUID agentID
|
||||
, LLUUID itemID
|
||||
@@ -426,23 +426,279 @@ Low 00323 - MoveInventoryItem - Untrusted - Unencoded
|
||||
|
||||
|
||||
|
||||
/*
|
||||
Low 00337 - RequestInventoryAsset - Trusted - Zerocoded
|
||||
1266 QueryData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
0640 QueryID (LLUUID / 1)
|
||||
0719 OwnerID (LLUUID / 1)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
Low 00338 - InventoryAssetResponse - Trusted - Zerocoded
|
||||
1266 QueryData (01)
|
||||
0640 QueryID (LLUUID / 1)
|
||||
0680 AssetID (LLUUID / 1)
|
||||
1058 IsReadable (BOOL / 1)
|
||||
*/
|
||||
public static Packet RequestInventoryAsset(ProtocolManager protocol
|
||||
, LLUUID agentID, LLUUID queryUD, LLUUID ownerID, LLUUID itemID )
|
||||
{
|
||||
int packetLength = 8; // header
|
||||
packetLength += 16; // AgentID (UUID)
|
||||
packetLength += 16; // QueryID (UUID)
|
||||
packetLength += 16; // OwnerID (UUID)
|
||||
packetLength += 16; // ItemID (UUID)
|
||||
|
||||
Packet packet = new Packet("RequestInventoryAsset", protocol, packetLength );
|
||||
|
||||
int pos = 8; // Leave room for header
|
||||
|
||||
// AgentID
|
||||
Array.Copy(agentID.Data, 0, packet.Data, pos, 16);
|
||||
pos += 16;
|
||||
|
||||
// QueryID
|
||||
Array.Copy(queryUD.Data, 0, packet.Data, pos, 16);
|
||||
pos += 16;
|
||||
|
||||
// OwnerID
|
||||
Array.Copy(ownerID.Data, 0, packet.Data, pos, 16);
|
||||
pos += 16;
|
||||
|
||||
// ItemID
|
||||
Array.Copy(itemID.Data, 0, packet.Data, pos, 16);
|
||||
pos += 16;
|
||||
|
||||
// Set the packet flags
|
||||
packet.Data[0] = Helpers.MSG_ZEROCODED + Helpers.MSG_RELIABLE;
|
||||
|
||||
return packet;
|
||||
}
|
||||
|
||||
/*
|
||||
Low 00322 - UpdateInventoryItemAsset - Untrusted - Unencoded
|
||||
0065 InventoryData (Variable)
|
||||
0680 AssetID (LLUUID / 1)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
1297 AgentData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
Low 00326 - ChangeInventoryItemFlags - Untrusted - Zerocoded
|
||||
0065 InventoryData (Variable)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
1189 Flags (U32 / 1)
|
||||
1297 AgentData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
*/
|
||||
|
||||
public static Packet UpdateInventoryItem(ProtocolManager protocol, InventoryItem iitem, LLUUID agentID)
|
||||
{
|
||||
return UpdateInventoryItem( protocol
|
||||
, iitem.GroupOwned
|
||||
, InventoryUpdateCRC(iitem)
|
||||
, iitem.CreationDate
|
||||
, iitem.SaleType
|
||||
, iitem.BaseMask
|
||||
, iitem.Name
|
||||
, iitem.InvType
|
||||
, iitem.Type
|
||||
, iitem.AssetID
|
||||
, iitem.GroupID
|
||||
, iitem.SalePrice
|
||||
, iitem.OwnerID
|
||||
, iitem.CreatorID
|
||||
, iitem.ItemID
|
||||
, iitem.FolderID
|
||||
, iitem.EveryoneMask
|
||||
, iitem.Description
|
||||
, iitem.Flags
|
||||
, iitem.NextOwnerMask
|
||||
, iitem.GroupMask
|
||||
, iitem.OwnerMask
|
||||
, agentID
|
||||
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Low 00321 - UpdateInventoryItem - Untrusted - Unencoded
|
||||
0065 InventoryData (Variable)
|
||||
0047 GroupOwned (BOOL / 1)
|
||||
0149 CRC (U32 / 1)
|
||||
0159 CreationDate (S32 / 1)
|
||||
0345 SaleType (U8 / 1)
|
||||
0395 BaseMask (U32 / 1)
|
||||
0506 Name (Variable / 1)
|
||||
0562 InvType (S8 / 1)
|
||||
0630 Type (S8 / 1)
|
||||
0680 AssetID (LLUUID / 1)
|
||||
0699 GroupID (LLUUID / 1)
|
||||
0716 SalePrice (S32 / 1)
|
||||
0719 OwnerID (LLUUID / 1)
|
||||
0736 CreatorID (LLUUID / 1)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
1025 FolderID (LLUUID / 1)
|
||||
1084 EveryoneMask (U32 / 1)
|
||||
1101 Description (Variable / 1)
|
||||
1189 Flags (U32 / 1)
|
||||
1348 NextOwnerMask (U32 / 1)
|
||||
1452 GroupMask (U32 / 1)
|
||||
1505 OwnerMask (U32 / 1)
|
||||
1297 AgentData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
|
||||
|
||||
----- UpdateInventoryItem -----
|
||||
InventoryData
|
||||
GroupOwned: False
|
||||
CRC: 3330379543
|
||||
CreationDate: 1152566548
|
||||
SaleType: 0
|
||||
BaseMask: 2147483647
|
||||
Name: New Note
|
||||
InvType: 7
|
||||
Type: 7
|
||||
AssetID: 00000000000000000000000000000000
|
||||
GroupID: 00000000000000000000000000000000
|
||||
SalePrice: 10
|
||||
OwnerID: 25472683cb324516904a6cd0ecabf128
|
||||
CreatorID: 25472683cb324516904a6cd0ecabf128
|
||||
ItemID: 6f11a788c6478fb50610b65b4a8f9c11
|
||||
FolderID: a4947fc066c247518d9854aaf90097f4
|
||||
EveryoneMask: 0
|
||||
Description: 2006-07-10 14:22:38 note card
|
||||
Flags: 0
|
||||
NextOwnerMask: 2147483647
|
||||
GroupMask: 0
|
||||
OwnerMask: 2147483647
|
||||
AgentData
|
||||
AgentID: 25472683cb324516904a6cd0ecabf128
|
||||
|
||||
*/
|
||||
private static Packet UpdateInventoryItem(ProtocolManager protocol
|
||||
, bool groupOwned
|
||||
, uint crc
|
||||
, int creationDate
|
||||
, byte saleType
|
||||
, uint baseMask
|
||||
, string name
|
||||
, sbyte invType, sbyte type
|
||||
, LLUUID assetID
|
||||
, LLUUID groupID
|
||||
, int salePrice
|
||||
, LLUUID ownerID
|
||||
, LLUUID creatorID
|
||||
, LLUUID itemID
|
||||
, LLUUID folderID
|
||||
, uint everyoneMask
|
||||
, string description
|
||||
, uint flags
|
||||
, uint nextOwnerMask
|
||||
, uint groupMask
|
||||
, uint ownerMask
|
||||
, LLUUID agentID
|
||||
)
|
||||
{
|
||||
Hashtable blocks = new Hashtable();
|
||||
Hashtable fields = new Hashtable();
|
||||
|
||||
fields["GroupOwned"] = groupOwned;
|
||||
fields["CRC"] = crc;
|
||||
fields["CreationDate"] = creationDate;
|
||||
fields["SaleType"] = saleType;
|
||||
fields["BaseMask"] = baseMask;
|
||||
fields["Name"] = name;
|
||||
fields["InvType"] = invType;
|
||||
fields["Type"] = type;
|
||||
fields["AssetID"] = assetID;
|
||||
fields["GroupID"] = groupID;
|
||||
fields["SalePrice"] = salePrice;
|
||||
fields["OwnerID"] = ownerID;
|
||||
fields["CreatorID"] = creatorID;
|
||||
fields["ItemID"] = itemID;
|
||||
fields["FolderID"] = folderID;
|
||||
fields["EveryoneMask"] = everyoneMask;
|
||||
fields["Description"] = description;
|
||||
fields["Flags"] = flags;
|
||||
fields["NextOwnerMask"] = nextOwnerMask;
|
||||
fields["GroupMask"] = groupMask;
|
||||
fields["OwnerMask"] = ownerMask;
|
||||
blocks[fields] = "InventoryData";
|
||||
|
||||
fields = new Hashtable();
|
||||
fields["AgentID"] = agentID;
|
||||
blocks[fields] = "AgentData";
|
||||
|
||||
return PacketBuilder.BuildPacket("UpdateInventoryItem", protocol, blocks, Helpers.MSG_RELIABLE);
|
||||
}
|
||||
|
||||
|
||||
public static uint InventoryUpdateCRC(InventoryItem iitem)
|
||||
{
|
||||
return InventoryUpdateCRC(
|
||||
iitem.CreationDate
|
||||
, iitem.SaleType
|
||||
, iitem.InvType
|
||||
, iitem.Type
|
||||
, iitem.AssetID
|
||||
, iitem.GroupID
|
||||
, iitem.SalePrice
|
||||
, iitem.OwnerID
|
||||
, iitem.CreatorID
|
||||
, iitem.ItemID
|
||||
, iitem.FolderID
|
||||
, iitem.EveryoneMask
|
||||
, iitem.Flags
|
||||
, iitem.NextOwnerMask
|
||||
, iitem.GroupMask
|
||||
, iitem.OwnerMask
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Low 00322 - UpdateInventoryItemAsset - Untrusted - Unencoded
|
||||
0065 InventoryData (Variable)
|
||||
0680 AssetID (LLUUID / 1)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
1297 AgentData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
Low 00326 - ChangeInventoryItemFlags - Untrusted - Zerocoded
|
||||
0065 InventoryData (Variable)
|
||||
0968 ItemID (LLUUID / 1)
|
||||
1189 Flags (U32 / 1)
|
||||
1297 AgentData (01)
|
||||
0219 AgentID (LLUUID / 1)
|
||||
*/
|
||||
private static uint InventoryUpdateCRC (
|
||||
int creationDate
|
||||
, byte saleType
|
||||
, sbyte invType, sbyte type
|
||||
, LLUUID assetID
|
||||
, LLUUID groupID
|
||||
, int salePrice
|
||||
, LLUUID ownerID
|
||||
, LLUUID creatorID
|
||||
, LLUUID itemID
|
||||
, LLUUID folderID
|
||||
, uint everyoneMask
|
||||
, uint flags
|
||||
, uint nextOwnerMask
|
||||
, uint groupMask
|
||||
, uint ownerMask
|
||||
)
|
||||
{
|
||||
|
||||
uint CRC = 0;
|
||||
|
||||
/* IDs */
|
||||
CRC += assetID.CRC(); // AssetID
|
||||
CRC += folderID.CRC(); // FolderID
|
||||
CRC += itemID.CRC(); // ItemID
|
||||
|
||||
/* Permission stuff */
|
||||
CRC += creatorID.CRC(); // CreatorID
|
||||
CRC += ownerID.CRC(); // OwnerID
|
||||
CRC += groupID.CRC(); // GroupID
|
||||
|
||||
/* CRC += another 4 words which always seem to be zero -- unclear if this is a LLUUID or what */
|
||||
CRC += ownerMask; //owner_mask; // Either owner_mask or next_owner_mask may need to be
|
||||
CRC += nextOwnerMask; //next_owner_mask; // switched with base_mask -- 2 values go here and in my
|
||||
CRC += everyoneMask; //everyone_mask; // study item, the three were identical.
|
||||
CRC += groupMask; //group_mask;
|
||||
|
||||
/* The rest of the CRC fields */
|
||||
CRC += flags; // Flags
|
||||
CRC += (uint)invType; // InvType
|
||||
CRC += (uint)type; // Type
|
||||
CRC += (uint)creationDate; // CreationDate
|
||||
CRC += (uint)salePrice; // SalePrice
|
||||
CRC += (uint)((uint)saleType * 0x07073096); // SaleType
|
||||
|
||||
return CRC;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -173,16 +173,6 @@
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssetSystem\PacketHelpers\AssetPackets.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssetSystem\PacketHelpers\ImagePackets.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InventorySystem\InventoryBase.cs"
|
||||
SubType = "Code"
|
||||
@@ -213,21 +203,6 @@
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InventorySystem\PacketHelpers\InventoryPackets.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InventorySystem\PacketHelpers\RequestInventoryAsset.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "InventorySystem\PacketHelpers\UpdateInventoryItem.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "JSON\JSONArray.cs"
|
||||
SubType = "Code"
|
||||
@@ -248,11 +223,21 @@
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Packets\AssetPackets.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Packets\CommunicationPackets.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Packets\ImagePackets.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "Packets\InventoryPackets.cs"
|
||||
SubType = "Code"
|
||||
|
||||
@@ -31,10 +31,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InventoryDump", "examples\I
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TaskInventory", "..\..\TaskInventory\TaskInventory.csproj", "{96337025-122D-460F-9AC5-46B6D0BD668E}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
@@ -73,10 +69,6 @@ Global
|
||||
{6478BE37-9272-4D91-B641-5E2FD0680B27}.Debug.Build.0 = Debug|.NET
|
||||
{6478BE37-9272-4D91-B641-5E2FD0680B27}.Release.ActiveCfg = Release|.NET
|
||||
{6478BE37-9272-4D91-B641-5E2FD0680B27}.Release.Build.0 = Release|.NET
|
||||
{96337025-122D-460F-9AC5-46B6D0BD668E}.Debug.ActiveCfg = Debug|.NET
|
||||
{96337025-122D-460F-9AC5-46B6D0BD668E}.Debug.Build.0 = Debug|.NET
|
||||
{96337025-122D-460F-9AC5-46B6D0BD668E}.Release.ActiveCfg = Release|.NET
|
||||
{96337025-122D-460F-9AC5-46B6D0BD668E}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
||||
Reference in New Issue
Block a user