diff options
author | Justin Clarke Casey | 2008-01-06 22:55:45 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-01-06 22:55:45 +0000 |
commit | 286802558e063dd6b3997cefba06f277de51b639 (patch) | |
tree | 0e4a9f289141cd569e58ee4acf827d786480063d | |
parent | Factor out inventory related code in SceneObjectPart into separate class (diff) | |
download | opensim-SC-286802558e063dd6b3997cefba06f277de51b639.zip opensim-SC-286802558e063dd6b3997cefba06f277de51b639.tar.gz opensim-SC-286802558e063dd6b3997cefba06f277de51b639.tar.bz2 opensim-SC-286802558e063dd6b3997cefba06f277de51b639.tar.xz |
Factor out inventory code in SceneObjectGroup into seperate class.
As was true for the previous update, this might require nant users to re-run prebuild.[sh|bat]
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | 136 | ||||
-rw-r--r-- | OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | 97 |
2 files changed, 137 insertions, 96 deletions
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs new file mode 100644 index 0000000..046e05b --- /dev/null +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -0,0 +1,136 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSim Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS AS IS AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | using System; | ||
30 | |||
31 | using libsecondlife; | ||
32 | |||
33 | using OpenSim.Framework; | ||
34 | using OpenSim.Framework.Console; | ||
35 | using OpenSim.Region.Environment.Interfaces; | ||
36 | |||
37 | namespace OpenSim.Region.Environment.Scenes | ||
38 | { | ||
39 | public partial class SceneObjectGroup : EntityBase | ||
40 | { | ||
41 | /// <summary> | ||
42 | /// | ||
43 | /// </summary> | ||
44 | /// <param name="remoteClient"></param> | ||
45 | /// <param name="localID"></param> | ||
46 | public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) | ||
47 | { | ||
48 | SceneObjectPart part = GetChildPart(localID); | ||
49 | if (part != null) | ||
50 | { | ||
51 | return part.GetInventoryFileName(remoteClient, localID); | ||
52 | } | ||
53 | else | ||
54 | { | ||
55 | MainLog.Instance.Warn( | ||
56 | "SCENE", | ||
57 | "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", | ||
58 | localID, Name, UUID); | ||
59 | } | ||
60 | return false; | ||
61 | } | ||
62 | |||
63 | public void RequestInventoryFile(uint localID, IXfer xferManager) | ||
64 | { | ||
65 | SceneObjectPart part = GetChildPart(localID); | ||
66 | if (part != null) | ||
67 | { | ||
68 | part.RequestInventoryFile(xferManager); | ||
69 | } | ||
70 | else | ||
71 | { | ||
72 | MainLog.Instance.Warn( | ||
73 | "PRIMINVENTORY", | ||
74 | "Couldn't find part {0} in object group {1}, {2} to request inventory data", | ||
75 | localID, Name, UUID); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) | ||
80 | { | ||
81 | SceneObjectPart part = GetChildPart(localID); | ||
82 | if (part != null) | ||
83 | { | ||
84 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
85 | taskItem.item_id = item.inventoryID; | ||
86 | taskItem.asset_id = item.assetID; | ||
87 | taskItem.name = item.inventoryName; | ||
88 | taskItem.desc = item.inventoryDescription; | ||
89 | taskItem.owner_id = item.avatarID; | ||
90 | taskItem.creator_id = item.creatorsID; | ||
91 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | ||
92 | taskItem.inv_type = TaskInventoryItem.Types[item.invType]; | ||
93 | part.AddInventoryItem(taskItem); | ||
94 | return true; | ||
95 | } | ||
96 | return false; | ||
97 | } | ||
98 | |||
99 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) | ||
100 | { | ||
101 | if (copyItemID != LLUUID.Zero) | ||
102 | { | ||
103 | SceneObjectPart part = GetChildPart(localID); | ||
104 | if (part != null) | ||
105 | { | ||
106 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
107 | taskItem.item_id = copyItemID; | ||
108 | taskItem.asset_id = item.assetID; | ||
109 | taskItem.name = item.inventoryName; | ||
110 | taskItem.desc = item.inventoryDescription; | ||
111 | taskItem.owner_id = new LLUUID(item.avatarID.ToString()); | ||
112 | taskItem.creator_id = new LLUUID(item.creatorsID.ToString()); | ||
113 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | ||
114 | taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; | ||
115 | part.AddInventoryItem(taskItem); | ||
116 | return true; | ||
117 | } | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | return AddInventoryItem(remoteClient, localID, item); | ||
122 | } | ||
123 | return false; | ||
124 | } | ||
125 | |||
126 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | ||
127 | { | ||
128 | SceneObjectPart part = GetChildPart(localID); | ||
129 | if (part != null) | ||
130 | { | ||
131 | return part.RemoveInventoryItem(remoteClient, localID, itemID); | ||
132 | } | ||
133 | return -1; | ||
134 | } | ||
135 | } | ||
136 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs index a9b3fe9..e8d12ff 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs | |||
@@ -44,7 +44,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
44 | { | 44 | { |
45 | public delegate void PrimCountTaintedDelegate(); | 45 | public delegate void PrimCountTaintedDelegate(); |
46 | 46 | ||
47 | public class SceneObjectGroup : EntityBase | 47 | public partial class SceneObjectGroup : EntityBase |
48 | { | 48 | { |
49 | private Encoding enc = Encoding.ASCII; | 49 | private Encoding enc = Encoding.ASCII; |
50 | 50 | ||
@@ -1138,101 +1138,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1138 | /// <summary> | 1138 | /// <summary> |
1139 | /// | 1139 | /// |
1140 | /// </summary> | 1140 | /// </summary> |
1141 | /// <param name="remoteClient"></param> | ||
1142 | /// <param name="localID"></param> | ||
1143 | public bool GetPartInventoryFileName(IClientAPI remoteClient, uint localID) | ||
1144 | { | ||
1145 | SceneObjectPart part = GetChildPart(localID); | ||
1146 | if (part != null) | ||
1147 | { | ||
1148 | return part.GetInventoryFileName(remoteClient, localID); | ||
1149 | } | ||
1150 | else | ||
1151 | { | ||
1152 | MainLog.Instance.Warn( | ||
1153 | "SCENE", | ||
1154 | "Couldn't find part {0} in object group {1}, {2} to retreive prim inventory", | ||
1155 | localID, Name, UUID); | ||
1156 | } | ||
1157 | return false; | ||
1158 | } | ||
1159 | |||
1160 | public void RequestInventoryFile(uint localID, IXfer xferManager) | ||
1161 | { | ||
1162 | SceneObjectPart part = GetChildPart(localID); | ||
1163 | if (part != null) | ||
1164 | { | ||
1165 | part.RequestInventoryFile(xferManager); | ||
1166 | } | ||
1167 | else | ||
1168 | { | ||
1169 | MainLog.Instance.Warn( | ||
1170 | "PRIMINVENTORY", | ||
1171 | "Couldn't find part {0} in object group {1}, {2} to request inventory data", | ||
1172 | localID, Name, UUID); | ||
1173 | } | ||
1174 | } | ||
1175 | |||
1176 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item) | ||
1177 | { | ||
1178 | SceneObjectPart part = GetChildPart(localID); | ||
1179 | if (part != null) | ||
1180 | { | ||
1181 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
1182 | taskItem.item_id = item.inventoryID; | ||
1183 | taskItem.asset_id = item.assetID; | ||
1184 | taskItem.name = item.inventoryName; | ||
1185 | taskItem.desc = item.inventoryDescription; | ||
1186 | taskItem.owner_id = item.avatarID; | ||
1187 | taskItem.creator_id = item.creatorsID; | ||
1188 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | ||
1189 | taskItem.inv_type = TaskInventoryItem.Types[item.invType]; | ||
1190 | part.AddInventoryItem(taskItem); | ||
1191 | return true; | ||
1192 | } | ||
1193 | return false; | ||
1194 | } | ||
1195 | |||
1196 | public bool AddInventoryItem(IClientAPI remoteClient, uint localID, InventoryItemBase item, LLUUID copyItemID) | ||
1197 | { | ||
1198 | if (copyItemID != LLUUID.Zero) | ||
1199 | { | ||
1200 | SceneObjectPart part = GetChildPart(localID); | ||
1201 | if (part != null) | ||
1202 | { | ||
1203 | TaskInventoryItem taskItem = new TaskInventoryItem(); | ||
1204 | taskItem.item_id = copyItemID; | ||
1205 | taskItem.asset_id = item.assetID; | ||
1206 | taskItem.name = item.inventoryName; | ||
1207 | taskItem.desc = item.inventoryDescription; | ||
1208 | taskItem.owner_id = new LLUUID(item.avatarID.ToString()); | ||
1209 | taskItem.creator_id = new LLUUID(item.creatorsID.ToString()); | ||
1210 | taskItem.type = TaskInventoryItem.Types[item.assetType]; | ||
1211 | taskItem.inv_type = TaskInventoryItem.InvTypes[item.invType]; | ||
1212 | part.AddInventoryItem(taskItem); | ||
1213 | return true; | ||
1214 | } | ||
1215 | } | ||
1216 | else | ||
1217 | { | ||
1218 | return AddInventoryItem(remoteClient, localID, item); | ||
1219 | } | ||
1220 | return false; | ||
1221 | } | ||
1222 | |||
1223 | public int RemoveInventoryItem(IClientAPI remoteClient, uint localID, LLUUID itemID) | ||
1224 | { | ||
1225 | SceneObjectPart part = GetChildPart(localID); | ||
1226 | if (part != null) | ||
1227 | { | ||
1228 | return part.RemoveInventoryItem(remoteClient, localID, itemID); | ||
1229 | } | ||
1230 | return -1; | ||
1231 | } | ||
1232 | |||
1233 | /// <summary> | ||
1234 | /// | ||
1235 | /// </summary> | ||
1236 | /// <param name="localID"></param> | 1141 | /// <param name="localID"></param> |
1237 | /// <param name="type"></param> | 1142 | /// <param name="type"></param> |
1238 | /// <param name="inUse"></param> | 1143 | /// <param name="inUse"></param> |