aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services')
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs105
1 files changed, 77 insertions, 28 deletions
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index 186871a..860a13b 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -149,33 +149,28 @@ namespace OpenSim.Services.Interfaces
149 Data["Serial"] = appearance.Serial.ToString(); 149 Data["Serial"] = appearance.Serial.ToString();
150 // Wearables 150 // Wearables
151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); 151 Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
152 Data["BodyItem"] = appearance.Wearables[AvatarWearable.BODY][0].ItemID.ToString(); 152
153 Data["EyesItem"] = appearance.Wearables[AvatarWearable.EYES][0].ItemID.ToString(); 153 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++)
154 Data["GlovesItem"] = appearance.Wearables[AvatarWearable.GLOVES][0].ItemID.ToString(); 154 {
155 Data["HairItem"] = appearance.Wearables[AvatarWearable.HAIR][0].ItemID.ToString(); 155 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
156 Data["JacketItem"] = appearance.Wearables[AvatarWearable.JACKET][0].ItemID.ToString(); 156 {
157 Data["PantsItem"] = appearance.Wearables[AvatarWearable.PANTS][0].ItemID.ToString(); 157 string fieldName = String.Format("Wearable {0}:{1}", i, j);
158 Data["ShirtItem"] = appearance.Wearables[AvatarWearable.SHIRT][0].ItemID.ToString(); 158 Data[fieldName] = String.Format("{0}:{1}",
159 Data["ShoesItem"] = appearance.Wearables[AvatarWearable.SHOES][0].ItemID.ToString(); 159 appearance.Wearables[i][j].ItemID.ToString(),
160 Data["SkinItem"] = appearance.Wearables[AvatarWearable.SKIN][0].ItemID.ToString(); 160 appearance.Wearables[i][j].AssetID.ToString());
161 Data["SkirtItem"] = appearance.Wearables[AvatarWearable.SKIRT][0].ItemID.ToString(); 161 }
162 Data["SocksItem"] = appearance.Wearables[AvatarWearable.SOCKS][0].ItemID.ToString(); 162 }
163 Data["UnderPantsItem"] = appearance.Wearables[AvatarWearable.UNDERPANTS][0].ItemID.ToString(); 163
164 Data["UnderShirtItem"] = appearance.Wearables[AvatarWearable.UNDERSHIRT][0].ItemID.ToString(); 164 // Visual Params
165 165 string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT];
166 Data["BodyAsset"] = appearance.Wearables[AvatarWearable.BODY][0].AssetID.ToString(); 166 byte[] binary = appearance.VisualParams;
167 Data["EyesAsset"] = appearance.Wearables[AvatarWearable.EYES][0].AssetID.ToString(); 167
168 Data["GlovesAsset"] = appearance.Wearables[AvatarWearable.GLOVES][0].AssetID.ToString(); 168 for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++)
169 Data["HairAsset"] = appearance.Wearables[AvatarWearable.HAIR][0].AssetID.ToString(); 169 {
170 Data["JacketAsset"] = appearance.Wearables[AvatarWearable.JACKET][0].AssetID.ToString(); 170 vps[i] = binary[i].ToString();
171 Data["PantsAsset"] = appearance.Wearables[AvatarWearable.PANTS][0].AssetID.ToString(); 171 }
172 Data["ShirtAsset"] = appearance.Wearables[AvatarWearable.SHIRT][0].AssetID.ToString(); 172
173 Data["ShoesAsset"] = appearance.Wearables[AvatarWearable.SHOES][0].AssetID.ToString(); 173 Data["VisualParams"] = String.Join(",", vps);
174 Data["SkinAsset"] = appearance.Wearables[AvatarWearable.SKIN][0].AssetID.ToString();
175 Data["SkirtAsset"] = appearance.Wearables[AvatarWearable.SKIRT][0].AssetID.ToString();
176 Data["SocksAsset"] = appearance.Wearables[AvatarWearable.SOCKS][0].AssetID.ToString();
177 Data["UnderPantsAsset"] = appearance.Wearables[AvatarWearable.UNDERPANTS][0].AssetID.ToString();
178 Data["UnderShirtAsset"] = appearance.Wearables[AvatarWearable.UNDERSHIRT][0].AssetID.ToString();
179 174
180 // Attachments 175 // Attachments
181 List<AvatarAttachment> attachments = appearance.GetAttachments(); 176 List<AvatarAttachment> attachments = appearance.GetAttachments();
@@ -188,12 +183,17 @@ namespace OpenSim.Services.Interfaces
188 public AvatarAppearance ToAvatarAppearance(UUID owner) 183 public AvatarAppearance ToAvatarAppearance(UUID owner)
189 { 184 {
190 AvatarAppearance appearance = new AvatarAppearance(owner); 185 AvatarAppearance appearance = new AvatarAppearance(owner);
186
187 if (Data.Count == 0)
188 return appearance;
189
190 appearance.ClearWearables();
191 try 191 try
192 { 192 {
193 if (Data.ContainsKey("Serial")) 193 if (Data.ContainsKey("Serial"))
194 appearance.Serial = Int32.Parse(Data["Serial"]); 194 appearance.Serial = Int32.Parse(Data["Serial"]);
195 195
196 // Wearables 196 // Legacy Wearables
197 if (Data.ContainsKey("BodyItem")) 197 if (Data.ContainsKey("BodyItem"))
198 appearance.Wearables[AvatarWearable.BODY].Wear( 198 appearance.Wearables[AvatarWearable.BODY].Wear(
199 UUID.Parse(Data["BodyItem"]), 199 UUID.Parse(Data["BodyItem"]),
@@ -260,6 +260,35 @@ namespace OpenSim.Services.Interfaces
260 UUID.Parse(Data["SkirtAsset"])); 260 UUID.Parse(Data["SkirtAsset"]));
261 261
262 262
263 if (Data.ContainsKey("VisualParams"))
264 {
265 string[] vps = Data["VisualParams"].Split(new char[] {','});
266 byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT];
267
268 for (int i = 0 ; i < vps.Length && i < binary.Length ; i++)
269 binary[i] = (byte)Convert.ToInt32(vps[i]);
270
271 appearance.VisualParams = binary;
272 }
273
274 // New style wearables
275 foreach (KeyValuePair<string, string> _kvp in Data)
276 {
277 if (_kvp.Key.StartsWith("Wearable "))
278 {
279 string wearIndex = _kvp.Key.Substring(9);
280 string[] wearIndices = wearIndex.Split(new char[] {':'});
281 int index = Convert.ToInt32(wearIndices[0]);
282
283 string[] ids = _kvp.Value.Split(new char[] {':'});
284 UUID itemID = new UUID(ids[0]);
285 UUID assetID = new UUID(ids[1]);
286
287 appearance.Wearables[index].Add(itemID, assetID);
288 }
289 }
290
291
263 // Attachments 292 // Attachments
264 Dictionary<string, string> attchs = new Dictionary<string, string>(); 293 Dictionary<string, string> attchs = new Dictionary<string, string>();
265 foreach (KeyValuePair<string, string> _kvp in Data) 294 foreach (KeyValuePair<string, string> _kvp in Data)
@@ -278,6 +307,26 @@ namespace OpenSim.Services.Interfaces
278 307
279 appearance.SetAttachment(point,uuid,UUID.Zero); 308 appearance.SetAttachment(point,uuid,UUID.Zero);
280 } 309 }
310
311 if (appearance.Wearables[AvatarWearable.BODY].Count == 0)
312 appearance.Wearables[AvatarWearable.BODY].Wear(
313 AvatarWearable.DefaultWearables[
314 AvatarWearable.BODY][0]);
315
316 if (appearance.Wearables[AvatarWearable.SKIN].Count == 0)
317 appearance.Wearables[AvatarWearable.SKIN].Wear(
318 AvatarWearable.DefaultWearables[
319 AvatarWearable.SKIN][0]);
320
321 if (appearance.Wearables[AvatarWearable.HAIR].Count == 0)
322 appearance.Wearables[AvatarWearable.HAIR].Wear(
323 AvatarWearable.DefaultWearables[
324 AvatarWearable.HAIR][0]);
325
326 if (appearance.Wearables[AvatarWearable.EYES].Count == 0)
327 appearance.Wearables[AvatarWearable.EYES].Wear(
328 AvatarWearable.DefaultWearables[
329 AvatarWearable.EYES][0]);
281 } 330 }
282 catch 331 catch
283 { 332 {