29 using System.Collections.Generic;
31 using OpenMetaverse.StructuredData;
33 namespace OpenSim.Framework
52 public static readonly
int BODY = 0;
53 public static readonly
int SKIN = 1;
54 public static readonly
int HAIR = 2;
55 public static readonly
int EYES = 3;
56 public static readonly
int SHIRT = 4;
57 public static readonly
int PANTS = 5;
58 public static readonly
int SHOES = 6;
59 public static readonly
int SOCKS = 7;
60 public static readonly
int JACKET = 8;
61 public static readonly
int GLOVES = 9;
62 public static readonly
int UNDERSHIRT = 10;
63 public static readonly
int UNDERPANTS = 11;
64 public static readonly
int SKIRT = 12;
66 public static readonly
int MAX_BASICWEARABLES = 13;
68 public static readonly
int ALPHA = 13;
69 public static readonly
int TATTOO = 14;
71 public static readonly
int LEGACY_VERSION_MAX_WEARABLES = 15;
76 public static readonly UUID DEFAULT_BODY_ITEM =
new UUID(
"66c41e39-38f9-f75a-024e-585989bfaba9");
77 public static readonly UUID DEFAULT_BODY_ASSET =
new UUID(
"66c41e39-38f9-f75a-024e-585989bfab73");
79 public static readonly UUID DEFAULT_HAIR_ITEM =
new UUID(
"d342e6c1-b9d2-11dc-95ff-0800200c9a66");
80 public static readonly UUID DEFAULT_HAIR_ASSET =
new UUID(
"d342e6c0-b9d2-11dc-95ff-0800200c9a66");
82 public static readonly UUID DEFAULT_SKIN_ITEM =
new UUID(
"77c41e39-38f9-f75a-024e-585989bfabc9");
83 public static readonly UUID DEFAULT_SKIN_ASSET =
new UUID(
"77c41e39-38f9-f75a-024e-585989bbabbb");
85 public static readonly UUID DEFAULT_EYES_ITEM =
new UUID(
"cdc31054-eed8-4021-994f-4e0c6e861b50");
86 public static readonly UUID DEFAULT_EYES_ASSET =
new UUID(
"4bb6fa4d-1cd2-498a-a84c-95c1a0e745a7");
88 public static readonly UUID DEFAULT_SHIRT_ITEM =
new UUID(
"77c41e39-38f9-f75a-0000-585989bf0000");
89 public static readonly UUID DEFAULT_SHIRT_ASSET =
new UUID(
"00000000-38f9-1111-024e-222222111110");
91 public static readonly UUID DEFAULT_PANTS_ITEM =
new UUID(
"77c41e39-38f9-f75a-0000-5859892f1111");
92 public static readonly UUID DEFAULT_PANTS_ASSET =
new UUID(
"00000000-38f9-1111-024e-222222111120");
100 protected Dictionary<UUID, UUID> m_items =
new Dictionary<UUID, UUID>();
101 protected List<UUID> m_ids =
new List<UUID>();
109 Wear(itemID, assetID);
121 foreach (UUID
id in m_ids)
124 weardata[
"item"] = OSD.FromUUID(id);
125 weardata[
"asset"] = OSD.FromUUID(m_items[id]);
126 wearlist.Add(weardata);
136 foreach (
OSDMap weardata
in args)
138 Add(weardata[
"item"].AsUUID(), weardata[
"asset"].AsUUID());
144 get {
return m_ids.Count; }
147 public void Add(UUID itemID, UUID assetID)
149 if (itemID == UUID.Zero)
151 if (m_items.ContainsKey(itemID))
153 m_items[itemID] = assetID;
156 if (m_ids.Count >= 5)
160 m_items[itemID] = assetID;
168 public void Wear(UUID itemID, UUID assetID)
171 Add(itemID, assetID);
182 if (m_items.ContainsKey(itemID))
184 m_ids.Remove(itemID);
185 m_items.Remove(itemID);
191 UUID itemID = UUID.Zero;
193 foreach (KeyValuePair<UUID, UUID> kvp
in m_items)
195 if (kvp.Value == assetID)
202 if (itemID != UUID.Zero)
204 m_ids.Remove(itemID);
205 m_items.Remove(itemID);
213 if (idx >= m_ids.Count || idx < 0)
216 return new WearableItem(m_ids[idx], m_items[m_ids[idx]]);
222 if (!m_items.ContainsKey(itemID))
224 return m_items[itemID];
233 for (
int i = 0; i < LEGACY_VERSION_MAX_WEARABLES; i++)
239 defaultWearables[BODY].Add(DEFAULT_BODY_ITEM, DEFAULT_BODY_ASSET);
242 defaultWearables[HAIR].Add(DEFAULT_HAIR_ITEM, DEFAULT_HAIR_ASSET);
245 defaultWearables[SKIN].Add(DEFAULT_SKIN_ITEM, DEFAULT_SKIN_ASSET);
248 defaultWearables[EYES].Add(DEFAULT_EYES_ITEM, DEFAULT_EYES_ASSET);
251 defaultWearables[SHIRT].Add(DEFAULT_SHIRT_ITEM, DEFAULT_SHIRT_ASSET);
254 defaultWearables[PANTS].Add(DEFAULT_PANTS_ITEM, DEFAULT_PANTS_ASSET);
265 return defaultWearables;
void RemoveAsset(UUID assetID)
void Add(UUID itemID, UUID assetID)
void RemoveItem(UUID itemID)
OpenMetaverse.StructuredData.OSDArray OSDArray
void Unpack(OSDArray args)
void Wear(WearableItem item)
OpenMetaverse.StructuredData.OSDMap OSDMap
AvatarWearable(UUID itemID, UUID assetID)
WearableItem(UUID itemID, UUID assetID)
AvatarWearable(OSDArray args)
OpenMetaverse.StructuredData.OSD OSD
void Wear(UUID itemID, UUID assetID)
UUID GetAsset(UUID itemID)