aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Services/Interfaces/IAvatarService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Services/Interfaces/IAvatarService.cs')
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs205
1 files changed, 148 insertions, 57 deletions
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index eaa6534..d7af562 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.BodyItem.ToString(); 152
153 Data["EyesItem"] = appearance.EyesItem.ToString(); 153 for (int i = 0 ; i < AvatarWearable.MAX_WEARABLES ; i++)
154 Data["GlovesItem"] = appearance.GlovesItem.ToString(); 154 {
155 Data["HairItem"] = appearance.HairItem.ToString(); 155 for (int j = 0 ; j < appearance.Wearables[i].Count ; j++)
156 Data["JacketItem"] = appearance.JacketItem.ToString(); 156 {
157 Data["PantsItem"] = appearance.PantsItem.ToString(); 157 string fieldName = String.Format("Wearable {0}:{1}", i, j);
158 Data["ShirtItem"] = appearance.ShirtItem.ToString(); 158 Data[fieldName] = String.Format("{0}:{1}",
159 Data["ShoesItem"] = appearance.ShoesItem.ToString(); 159 appearance.Wearables[i][j].ItemID.ToString(),
160 Data["SkinItem"] = appearance.SkinItem.ToString(); 160 appearance.Wearables[i][j].AssetID.ToString());
161 Data["SkirtItem"] = appearance.SkirtItem.ToString(); 161 }
162 Data["SocksItem"] = appearance.SocksItem.ToString(); 162 }
163 Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString(); 163
164 Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString(); 164 // Visual Params
165 165 string[] vps = new string[AvatarAppearance.VISUALPARAM_COUNT];
166 Data["BodyAsset"] = appearance.BodyAsset.ToString(); 166 byte[] binary = appearance.VisualParams;
167 Data["EyesAsset"] = appearance.EyesAsset.ToString(); 167
168 Data["GlovesAsset"] = appearance.GlovesAsset.ToString(); 168 for (int i = 0 ; i < AvatarAppearance.VISUALPARAM_COUNT ; i++)
169 Data["HairAsset"] = appearance.HairAsset.ToString(); 169 {
170 Data["JacketAsset"] = appearance.JacketAsset.ToString(); 170 vps[i] = binary[i].ToString();
171 Data["PantsAsset"] = appearance.PantsAsset.ToString(); 171 }
172 Data["ShirtAsset"] = appearance.ShirtAsset.ToString(); 172
173 Data["ShoesAsset"] = appearance.ShoesAsset.ToString(); 173 Data["VisualParams"] = String.Join(",", vps);
174 Data["SkinAsset"] = appearance.SkinAsset.ToString();
175 Data["SkirtAsset"] = appearance.SkirtAsset.ToString();
176 Data["SocksAsset"] = appearance.SocksAsset.ToString();
177 Data["UnderPantsAsset"] = appearance.UnderPantsAsset.ToString();
178 Data["UnderShirtAsset"] = appearance.UnderShirtAsset.ToString();
179 174
180 // Attachments 175 // Attachments
181 List<AvatarAttachment> attachments = appearance.GetAttachments(); 176 List<AvatarAttachment> attachments = appearance.GetAttachments();
@@ -188,38 +183,114 @@ 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 appearance.Serial = Int32.Parse(Data["Serial"]); 193 if (Data.ContainsKey("Serial"))
194 194 appearance.Serial = Int32.Parse(Data["Serial"]);
195 // Wearables 195
196 appearance.BodyItem = UUID.Parse(Data["BodyItem"]); 196 if (Data.ContainsKey("AvatarHeight"))
197 appearance.EyesItem = UUID.Parse(Data["EyesItem"]); 197 appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]);
198 appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]); 198
199 appearance.HairItem = UUID.Parse(Data["HairItem"]); 199 // Legacy Wearables
200 appearance.JacketItem = UUID.Parse(Data["JacketItem"]); 200 if (Data.ContainsKey("BodyItem"))
201 appearance.PantsItem = UUID.Parse(Data["PantsItem"]); 201 appearance.Wearables[AvatarWearable.BODY].Wear(
202 appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]); 202 UUID.Parse(Data["BodyItem"]),
203 appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]); 203 UUID.Parse(Data["BodyAsset"]));
204 appearance.SkinItem = UUID.Parse(Data["SkinItem"]); 204
205 appearance.SkirtItem = UUID.Parse(Data["SkirtItem"]); 205 if (Data.ContainsKey("SkinItem"))
206 appearance.SocksItem = UUID.Parse(Data["SocksItem"]); 206 appearance.Wearables[AvatarWearable.SKIN].Wear(
207 appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]); 207 UUID.Parse(Data["SkinItem"]),
208 appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]); 208 UUID.Parse(Data["SkinAsset"]));
209 209
210 appearance.BodyAsset = UUID.Parse(Data["BodyAsset"]); 210 if (Data.ContainsKey("HairItem"))
211 appearance.EyesAsset = UUID.Parse(Data["EyesAsset"]); 211 appearance.Wearables[AvatarWearable.HAIR].Wear(
212 appearance.GlovesAsset = UUID.Parse(Data["GlovesAsset"]); 212 UUID.Parse(Data["HairItem"]),
213 appearance.HairAsset = UUID.Parse(Data["HairAsset"]); 213 UUID.Parse(Data["HairAsset"]));
214 appearance.JacketAsset = UUID.Parse(Data["JacketAsset"]); 214
215 appearance.PantsAsset = UUID.Parse(Data["PantsAsset"]); 215 if (Data.ContainsKey("EyesItem"))
216 appearance.ShirtAsset = UUID.Parse(Data["ShirtAsset"]); 216 appearance.Wearables[AvatarWearable.EYES].Wear(
217 appearance.ShoesAsset = UUID.Parse(Data["ShoesAsset"]); 217 UUID.Parse(Data["EyesItem"]),
218 appearance.SkinAsset = UUID.Parse(Data["SkinAsset"]); 218 UUID.Parse(Data["EyesAsset"]));
219 appearance.SkirtAsset = UUID.Parse(Data["SkirtAsset"]); 219
220 appearance.SocksAsset = UUID.Parse(Data["SocksAsset"]); 220 if (Data.ContainsKey("ShirtItem"))
221 appearance.UnderPantsAsset = UUID.Parse(Data["UnderPantsAsset"]); 221 appearance.Wearables[AvatarWearable.SHIRT].Wear(
222 appearance.UnderShirtAsset = UUID.Parse(Data["UnderShirtAsset"]); 222 UUID.Parse(Data["ShirtItem"]),
223 UUID.Parse(Data["ShirtAsset"]));
224
225 if (Data.ContainsKey("PantsItem"))
226 appearance.Wearables[AvatarWearable.PANTS].Wear(
227 UUID.Parse(Data["PantsItem"]),
228 UUID.Parse(Data["PantsAsset"]));
229
230 if (Data.ContainsKey("ShoesItem"))
231 appearance.Wearables[AvatarWearable.SHOES].Wear(
232 UUID.Parse(Data["ShoesItem"]),
233 UUID.Parse(Data["ShoesAsset"]));
234
235 if (Data.ContainsKey("SocksItem"))
236 appearance.Wearables[AvatarWearable.SOCKS].Wear(
237 UUID.Parse(Data["SocksItem"]),
238 UUID.Parse(Data["SocksAsset"]));
239
240 if (Data.ContainsKey("JacketItem"))
241 appearance.Wearables[AvatarWearable.JACKET].Wear(
242 UUID.Parse(Data["JacketItem"]),
243 UUID.Parse(Data["JacketAsset"]));
244
245 if (Data.ContainsKey("GlovesItem"))
246 appearance.Wearables[AvatarWearable.GLOVES].Wear(
247 UUID.Parse(Data["GlovesItem"]),
248 UUID.Parse(Data["GlovesAsset"]));
249
250 if (Data.ContainsKey("UnderShirtItem"))
251 appearance.Wearables[AvatarWearable.UNDERSHIRT].Wear(
252 UUID.Parse(Data["UnderShirtItem"]),
253 UUID.Parse(Data["UnderShirtAsset"]));
254
255 if (Data.ContainsKey("UnderPantsItem"))
256 appearance.Wearables[AvatarWearable.UNDERPANTS].Wear(
257 UUID.Parse(Data["UnderPantsItem"]),
258 UUID.Parse(Data["UnderPantsAsset"]));
259
260 if (Data.ContainsKey("SkirtItem"))
261 appearance.Wearables[AvatarWearable.SKIRT].Wear(
262 UUID.Parse(Data["SkirtItem"]),
263 UUID.Parse(Data["SkirtAsset"]));
264
265
266 if (Data.ContainsKey("VisualParams"))
267 {
268 string[] vps = Data["VisualParams"].Split(new char[] {','});
269 byte[] binary = new byte[AvatarAppearance.VISUALPARAM_COUNT];
270
271 for (int i = 0 ; i < vps.Length && i < binary.Length ; i++)
272 binary[i] = (byte)Convert.ToInt32(vps[i]);
273
274 appearance.VisualParams = binary;
275 }
276
277 // New style wearables
278 foreach (KeyValuePair<string, string> _kvp in Data)
279 {
280 if (_kvp.Key.StartsWith("Wearable "))
281 {
282 string wearIndex = _kvp.Key.Substring(9);
283 string[] wearIndices = wearIndex.Split(new char[] {':'});
284 int index = Convert.ToInt32(wearIndices[0]);
285
286 string[] ids = _kvp.Value.Split(new char[] {':'});
287 UUID itemID = new UUID(ids[0]);
288 UUID assetID = new UUID(ids[1]);
289
290 appearance.Wearables[index].Add(itemID, assetID);
291 }
292 }
293
223 294
224 // Attachments 295 // Attachments
225 Dictionary<string, string> attchs = new Dictionary<string, string>(); 296 Dictionary<string, string> attchs = new Dictionary<string, string>();
@@ -239,6 +310,26 @@ namespace OpenSim.Services.Interfaces
239 310
240 appearance.SetAttachment(point,uuid,UUID.Zero); 311 appearance.SetAttachment(point,uuid,UUID.Zero);
241 } 312 }
313
314 if (appearance.Wearables[AvatarWearable.BODY].Count == 0)
315 appearance.Wearables[AvatarWearable.BODY].Wear(
316 AvatarWearable.DefaultWearables[
317 AvatarWearable.BODY][0]);
318
319 if (appearance.Wearables[AvatarWearable.SKIN].Count == 0)
320 appearance.Wearables[AvatarWearable.SKIN].Wear(
321 AvatarWearable.DefaultWearables[
322 AvatarWearable.SKIN][0]);
323
324 if (appearance.Wearables[AvatarWearable.HAIR].Count == 0)
325 appearance.Wearables[AvatarWearable.HAIR].Wear(
326 AvatarWearable.DefaultWearables[
327 AvatarWearable.HAIR][0]);
328
329 if (appearance.Wearables[AvatarWearable.EYES].Count == 0)
330 appearance.Wearables[AvatarWearable.EYES].Wear(
331 AvatarWearable.DefaultWearables[
332 AvatarWearable.EYES][0]);
242 } 333 }
243 catch 334 catch
244 { 335 {