29 using System.Collections;
30 using System.Collections.Generic;
32 using OpenSim.Framework;
36 namespace OpenSim.Services.Interfaces
68 bool SetAvatar(UUID userID,
AvatarData avatar);
75 bool ResetAvatar(UUID userID);
84 bool SetItems(UUID userID,
string[] names,
string[] values);
85 bool RemoveItems(UUID userID,
string[] names);
108 public Dictionary<string,string>
Data;
116 Data =
new Dictionary<string, string>();
118 if (kvp.ContainsKey(
"AvatarType"))
119 Int32.TryParse(kvp[
"AvatarType"].ToString(), out AvatarType);
121 foreach (KeyValuePair<string, object> _kvp
in kvp)
123 if (_kvp.Value != null)
124 Data[_kvp.Key] = _kvp.Value.ToString();
133 Dictionary<string, object> result =
new Dictionary<string, object>();
135 result[
"AvatarType"] = AvatarType.ToString();
136 foreach (KeyValuePair<string, string> _kvp
in Data)
138 if (_kvp.Value != null)
139 result[_kvp.Key] = _kvp.Value;
147 Data =
new Dictionary<string, string>();
149 Data[
"Serial"] = appearance.Serial.ToString();
151 Data[
"AvatarHeight"] = appearance.AvatarHeight.ToString();
154 for (
int i = 0 ; i < AvatarWearable.LEGACY_VERSION_MAX_WEARABLES ; i++)
156 for (
int j = 0 ; j < appearance.Wearables[i].Count ; j++)
158 string fieldName = String.Format(
"Wearable {0}:{1}", i, j);
159 Data[fieldName] = String.Format(
"{0}:{1}",
160 appearance.Wearables[i][j].ItemID.ToString(),
161 appearance.
Wearables[i][j].AssetID.ToString());
171 byte[] binary = appearance.VisualParams;
172 string[] vps =
new string[binary.Length];
174 for (
int i = 0; i < binary.Length; i++)
176 vps[i] = binary[i].ToString();
179 Data[
"VisualParams"] = String.Join(
",", vps);
182 List<AvatarAttachment> attachments = appearance.GetAttachments();
183 Dictionary<int, List<string>> atts =
new Dictionary<int, List<string>>();
186 if (attach.
ItemID != UUID.Zero)
190 atts[attach.AttachPoint].Add(attach.ItemID.ToString());
193 foreach (KeyValuePair<
int, List<string>> kvp
in atts)
194 Data[
"_ap_" + kvp.Key] = string.Join(
",", kvp.Value.ToArray());
204 appearance.ClearWearables();
207 if (Data.ContainsKey(
"Serial"))
208 appearance.
Serial = Int32.Parse(Data[
"Serial"]);
210 if (Data.ContainsKey(
"AvatarHeight"))
212 float h = float.Parse(Data[
"AvatarHeight"]);
215 appearance.SetSize(
new Vector3(0.45f, 0.6f, h ));
220 if (Data.ContainsKey(
"BodyItem"))
222 UUID.Parse(Data[
"BodyItem"]),
223 UUID.Parse(Data[
"BodyAsset"]));
225 if (Data.ContainsKey(
"SkinItem"))
227 UUID.Parse(Data[
"SkinItem"]),
228 UUID.Parse(Data[
"SkinAsset"]));
230 if (Data.ContainsKey(
"HairItem"))
232 UUID.Parse(Data[
"HairItem"]),
233 UUID.Parse(Data[
"HairAsset"]));
235 if (Data.ContainsKey(
"EyesItem"))
237 UUID.Parse(Data[
"EyesItem"]),
238 UUID.Parse(Data[
"EyesAsset"]));
240 if (Data.ContainsKey(
"ShirtItem"))
242 UUID.Parse(Data[
"ShirtItem"]),
243 UUID.Parse(Data[
"ShirtAsset"]));
245 if (Data.ContainsKey(
"PantsItem"))
247 UUID.Parse(Data[
"PantsItem"]),
248 UUID.Parse(Data[
"PantsAsset"]));
250 if (Data.ContainsKey(
"ShoesItem"))
252 UUID.Parse(Data[
"ShoesItem"]),
253 UUID.Parse(Data[
"ShoesAsset"]));
255 if (Data.ContainsKey(
"SocksItem"))
257 UUID.Parse(Data[
"SocksItem"]),
258 UUID.Parse(Data[
"SocksAsset"]));
260 if (Data.ContainsKey(
"JacketItem"))
262 UUID.Parse(Data[
"JacketItem"]),
263 UUID.Parse(Data[
"JacketAsset"]));
265 if (Data.ContainsKey(
"GlovesItem"))
267 UUID.Parse(Data[
"GlovesItem"]),
268 UUID.Parse(Data[
"GlovesAsset"]));
270 if (Data.ContainsKey(
"UnderShirtItem"))
272 UUID.Parse(Data[
"UnderShirtItem"]),
273 UUID.Parse(Data[
"UnderShirtAsset"]));
275 if (Data.ContainsKey(
"UnderPantsItem"))
277 UUID.Parse(Data[
"UnderPantsItem"]),
278 UUID.Parse(Data[
"UnderPantsAsset"]));
280 if (Data.ContainsKey(
"SkirtItem"))
282 UUID.Parse(Data[
"SkirtItem"]),
283 UUID.Parse(Data[
"SkirtAsset"]));
285 if (Data.ContainsKey(
"VisualParams"))
287 string[] vps = Data[
"VisualParams"].Split(
new char[] {
','});
291 byte[] binary =
new byte[vps.Length];
293 for (
int i = 0; i < vps.Length; i++)
294 binary[i] = (byte)Convert.ToInt32(vps[i]);
296 appearance.VisualParams = binary;
300 foreach (KeyValuePair<string, string> _kvp
in Data)
302 if (_kvp.Key.StartsWith(
"Wearable "))
304 string wearIndex = _kvp.Key.Substring(9);
305 string[] wearIndices = wearIndex.Split(
new char[] {
':'});
306 int index = Convert.ToInt32(wearIndices[0]);
308 string[] ids = _kvp.Value.Split(
new char[] {
':'});
309 UUID itemID =
new UUID(ids[0]);
310 UUID assetID =
new UUID(ids[1]);
312 appearance.Wearables[index].Add(itemID, assetID);
317 Dictionary<string, string> attchs =
new Dictionary<string, string>();
318 foreach (KeyValuePair<string, string> _kvp
in Data)
319 if (_kvp.Key.StartsWith(
"_ap_"))
320 attchs[_kvp.Key] = _kvp.Value;
322 foreach (KeyValuePair<string, string> _kvp in attchs)
324 string pointStr = _kvp.Key.Substring(4);
326 if (!Int32.TryParse(pointStr, out point))
329 List<string> idList =
new List<string>(_kvp.Value.Split(
new char[] {
','}));
331 appearance.SetAttachment(point, UUID.Zero, UUID.Zero);
332 foreach (
string id in idList)
334 UUID uuid = UUID.Zero;
335 UUID.TryParse(id, out uuid);
337 appearance.SetAttachment(point | 0x80, uuid, UUID.Zero);
342 appearance.Wearables[AvatarWearable.BODY].Wear(
343 AvatarWearable.DefaultWearables[
344 AvatarWearable.BODY][0]);
347 appearance.Wearables[AvatarWearable.SKIN].Wear(
348 AvatarWearable.DefaultWearables[
349 AvatarWearable.SKIN][0]);
352 appearance.Wearables[AvatarWearable.HAIR].Wear(
353 AvatarWearable.DefaultWearables[
354 AvatarWearable.HAIR][0]);
357 appearance.Wearables[AvatarWearable.EYES].Wear(
358 AvatarWearable.DefaultWearables[
359 AvatarWearable.EYES][0]);
static readonly int SHOES
void Wear(WearableItem item)
Contains the Avatar's Appearance and methods to manipulate the appearance.
Dictionary< string, object > ToKeyValuePairs()
AvatarData(Dictionary< string, object > kvp)
static readonly int GLOVES
static readonly int SKIRT
static readonly int SHIRT
virtual AvatarWearable[] Wearables
AvatarData(AvatarAppearance appearance)
static readonly int SOCKS
static readonly int JACKET
Each region/client that uses avatars will have a data structure of this type representing the avatars...
AvatarAppearance ToAvatarAppearance()
delegate void SetAppearance(IClientAPI remoteClient, Primitive.TextureEntry textureEntry, byte[] visualParams, Vector3 AvSize, WearableCacheItem[] CacheItems)
Dictionary< string, string > Data
static readonly int UNDERSHIRT
static readonly int UNDERPANTS
static readonly int PANTS