aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs')
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectPart.cs206
1 files changed, 1 insertions, 205 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
index b07b43c..f82771b 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs
@@ -42,7 +42,7 @@ using OpenSim.Region.Physics.Manager;
42 42
43namespace OpenSim.Region.Environment.Scenes 43namespace OpenSim.Region.Environment.Scenes
44{ 44{
45 public class SceneObjectPart : IScriptHost 45 public partial class SceneObjectPart : IScriptHost
46 { 46 {
47 private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL = 47 private const LLObject.ObjectFlags OBJFULL_MASK_GENERAL =
48 LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer; 48 LLObject.ObjectFlags.ObjectCopy | LLObject.ObjectFlags.ObjectModify | LLObject.ObjectFlags.ObjectTransfer;
@@ -55,36 +55,8 @@ namespace OpenSim.Region.Environment.Scenes
55 55
56 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647; 56 private const uint FULL_MASK_PERMISSIONS_GENERAL = 2147483647;
57 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647; 57 private const uint FULL_MASK_PERMISSIONS_OWNER = 2147483647;
58 private string m_inventoryFileName = "";
59
60 /// <summary>
61 /// The inventory folder for this prim
62 /// </summary>
63 private LLUUID m_folderID = LLUUID.Zero;
64
65 /// <summary>
66 /// Exposing this is not particularly good, but it's one of the least evils at the moment to see
67 /// folder id from prim inventory item data, since it's not (yet) actually stored with the prim.
68 /// </summary>
69 public LLUUID FolderID
70 {
71 get { return m_folderID; }
72 set { m_folderID = value; }
73 }
74 58
75 [XmlIgnore] public PhysicsActor PhysActor = null; 59 [XmlIgnore] public PhysicsActor PhysActor = null;
76
77 /// <summary>
78 /// Holds in memory prim inventory
79 /// </summary>
80 protected IDictionary<LLUUID, TaskInventoryItem> m_taskInventory
81 = new Dictionary<LLUUID, TaskInventoryItem>();
82
83 [XmlIgnore]
84 public IDictionary<LLUUID, TaskInventoryItem> TaskInventory
85 {
86 get { return m_taskInventory; }
87 }
88 60
89 public LLUUID LastOwnerID; 61 public LLUUID LastOwnerID;
90 public LLUUID OwnerID; 62 public LLUUID OwnerID;
@@ -130,17 +102,6 @@ namespace OpenSim.Region.Environment.Scenes
130 get { return CreatorID; } 102 get { return CreatorID; }
131 } 103 }
132 104
133 /// <summary>
134 /// Serial count for inventory file , used to tell if inventory has changed
135 /// no need for this to be part of Database backup
136 /// </summary>
137 protected uint m_inventorySerial = 0;
138
139 public uint InventorySerial
140 {
141 get { return m_inventorySerial; }
142 }
143
144 protected LLUUID m_uuid; 105 protected LLUUID m_uuid;
145 106
146 public LLUUID UUID 107 public LLUUID UUID
@@ -1066,123 +1027,6 @@ namespace OpenSim.Region.Environment.Scenes
1066 1027
1067 #endregion 1028 #endregion
1068 1029
1069 #region Inventory
1070
1071 /// <summary>
1072 /// Add an item to this prim's inventory.
1073 /// </summary>
1074 /// <param name="item"></param>
1075 public void AddInventoryItem(TaskInventoryItem item)
1076 {
1077 item.parent_id = m_folderID;
1078 item.creation_date = 1000;
1079 item.ParentPartID = UUID;
1080 m_taskInventory.Add(item.item_id, item);
1081 m_inventorySerial++;
1082 }
1083
1084 /// <summary>
1085 /// Add a whole collection of items to the prim's inventory at once. We assume that the items already
1086 /// have all their fields correctly filled out.
1087 /// </summary>
1088 /// <param name="items"></param>
1089 public void AddInventoryItems(ICollection<TaskInventoryItem> items)
1090 {
1091 foreach (TaskInventoryItem item in items)
1092 {
1093 m_taskInventory.Add(item.item_id, item);
1094 }
1095
1096 m_inventorySerial++;
1097 }
1098
1099 public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID)
1100 {
1101 if (localID == LocalID)
1102 {
1103 if (m_taskInventory.ContainsKey(itemID))
1104 {
1105 string type = m_taskInventory[itemID].inv_type;
1106 m_taskInventory.Remove(itemID);
1107 m_inventorySerial++;
1108 if (type == "lsl_text")
1109 {
1110 return 10;
1111 }
1112 else
1113 {
1114 return 0;
1115 }
1116 }
1117 }
1118 return -1;
1119 }
1120
1121 /// <summary>
1122 ///
1123 /// </summary>
1124 /// <param name="client"></param>
1125 /// <param name="localID"></param>
1126 public bool GetInventoryFileName(IClientAPI client, uint localID)
1127 {
1128 if (m_inventorySerial > 0)
1129 {
1130 client.SendTaskInventory(m_uuid, (short) m_inventorySerial,
1131 Helpers.StringToField(m_inventoryFileName));
1132 return true;
1133 }
1134 else
1135 {
1136 client.SendTaskInventory(m_uuid, 0, new byte[0]);
1137 return false;
1138 }
1139 }
1140
1141 public void RequestInventoryFile(IXfer xferManager)
1142 {
1143 byte[] fileData = new byte[0];
1144 InventoryStringBuilder invString = new InventoryStringBuilder(m_folderID, UUID);
1145 foreach (TaskInventoryItem item in m_taskInventory.Values)
1146 {
1147 invString.AddItemStart();
1148 invString.AddNameValueLine("item_id", item.item_id.ToString());
1149 invString.AddNameValueLine("parent_id", item.parent_id.ToString());
1150
1151 invString.AddPermissionsStart();
1152 invString.AddNameValueLine("base_mask", "0x7FFFFFFF");
1153 invString.AddNameValueLine("owner_mask", "0x7FFFFFFF");
1154 invString.AddNameValueLine("group_mask", "0x7FFFFFFF");
1155 invString.AddNameValueLine("everyone_mask", "0x7FFFFFFF");
1156 invString.AddNameValueLine("next_owner_mask", "0x7FFFFFFF");
1157 invString.AddNameValueLine("creator_id", item.creator_id.ToString());
1158 invString.AddNameValueLine("owner_id", item.owner_id.ToString());
1159 invString.AddNameValueLine("last_owner_id", item.last_owner_id.ToString());
1160 invString.AddNameValueLine("group_id", item.group_id.ToString());
1161 invString.AddSectionEnd();
1162
1163 invString.AddNameValueLine("asset_id", item.asset_id.ToString());
1164 invString.AddNameValueLine("type", item.type);
1165 invString.AddNameValueLine("inv_type", item.inv_type);
1166 invString.AddNameValueLine("flags", "0x00");
1167 invString.AddNameValueLine("name", item.name + "|");
1168 invString.AddNameValueLine("desc", item.desc + "|");
1169 invString.AddNameValueLine("creation_date", item.creation_date.ToString());
1170 invString.AddSectionEnd();
1171 }
1172
1173 fileData = Helpers.StringToField(invString.BuildString);
1174
1175// MainLog.Instance.Verbose(
1176// "PRIMINVENTORY", "RequestInventoryFile fileData: {0}", Helpers.FieldToUTF8String(fileData));
1177
1178 if (fileData.Length > 2)
1179 {
1180 xferManager.AddNewFile(m_inventoryFileName, fileData);
1181 }
1182 }
1183
1184 #endregion
1185
1186 #region ExtraParams 1030 #region ExtraParams
1187 1031
1188 public void UpdatePrimFlags(ushort type, bool inUse, byte[] data) 1032 public void UpdatePrimFlags(ushort type, bool inUse, byte[] data)
@@ -1688,53 +1532,5 @@ namespace OpenSim.Region.Environment.Scenes
1688 (int) (color.z*0xff)); 1532 (int) (color.z*0xff));
1689 Text = text; 1533 Text = text;
1690 } 1534 }
1691
1692 public class InventoryStringBuilder
1693 {
1694 public string BuildString = "";
1695
1696 public InventoryStringBuilder(LLUUID folderID, LLUUID parentID)
1697 {
1698 BuildString += "\tinv_object\t0\n\t{\n";
1699 AddNameValueLine("obj_id", folderID.ToString());
1700 AddNameValueLine("parent_id", parentID.ToString());
1701 AddNameValueLine("type", "category");
1702 AddNameValueLine("name", "Contents");
1703 AddSectionEnd();
1704 }
1705
1706 public void AddItemStart()
1707 {
1708 BuildString += "\tinv_item\t0\n";
1709 BuildString += "\t{\n";
1710 }
1711
1712 public void AddPermissionsStart()
1713 {
1714 BuildString += "\tpermissions 0\n";
1715 BuildString += "\t{\n";
1716 }
1717
1718 public void AddSectionEnd()
1719 {
1720 BuildString += "\t}\n";
1721 }
1722
1723 public void AddLine(string addLine)
1724 {
1725 BuildString += addLine;
1726 }
1727
1728 public void AddNameValueLine(string name, string value)
1729 {
1730 BuildString += "\t\t";
1731 BuildString += name + "\t";
1732 BuildString += value + "\n";
1733 }
1734
1735 public void Close()
1736 {
1737 }
1738 }
1739 } 1535 }
1740} 1536}