diff options
author | Diva Canto | 2010-01-11 17:30:05 -0800 |
---|---|---|
committer | Diva Canto | 2010-01-11 17:30:05 -0800 |
commit | 77e43f480154b0a950d9d5f54df5c225fc64e77a (patch) | |
tree | 48f1806bd8b0d0f50aef89846bcc186d3ad3eb74 /OpenSim/Services | |
parent | This fixes the problem that region modules (new style) weren't being recognized. (diff) | |
download | opensim-SC_OLD-77e43f480154b0a950d9d5f54df5c225fc64e77a.zip opensim-SC_OLD-77e43f480154b0a950d9d5f54df5c225fc64e77a.tar.gz opensim-SC_OLD-77e43f480154b0a950d9d5f54df5c225fc64e77a.tar.bz2 opensim-SC_OLD-77e43f480154b0a950d9d5f54df5c225fc64e77a.tar.xz |
Fixed a couple of bugs with Appearance. Appearance is all good now.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Services/AvatarService/AvatarService.cs | 6 | ||||
-rw-r--r-- | OpenSim/Services/Interfaces/IAvatarService.cs | 123 | ||||
-rw-r--r-- | OpenSim/Services/LLLoginService/LLLoginService.cs | 2 |
3 files changed, 87 insertions, 44 deletions
diff --git a/OpenSim/Services/AvatarService/AvatarService.cs b/OpenSim/Services/AvatarService/AvatarService.cs index 0b351a2..19e662c 100644 --- a/OpenSim/Services/AvatarService/AvatarService.cs +++ b/OpenSim/Services/AvatarService/AvatarService.cs | |||
@@ -73,6 +73,12 @@ namespace OpenSim.Services.AvatarService | |||
73 | 73 | ||
74 | public bool SetAvatar(UUID principalID, AvatarData avatar) | 74 | public bool SetAvatar(UUID principalID, AvatarData avatar) |
75 | { | 75 | { |
76 | int count = 0; | ||
77 | foreach (KeyValuePair<string, string> kvp in avatar.Data) | ||
78 | if (kvp.Key.StartsWith("_")) | ||
79 | count++; | ||
80 | |||
81 | m_log.DebugFormat("[AVATAR SERVICE]: SetAvatar for {0}, attachs={1}", principalID, count); | ||
76 | m_Database.Delete("PrincipalID", principalID.ToString()); | 82 | m_Database.Delete("PrincipalID", principalID.ToString()); |
77 | 83 | ||
78 | AvatarBaseData av = new AvatarBaseData(); | 84 | AvatarBaseData av = new AvatarBaseData(); |
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index ea08ea5..564c406 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs | |||
@@ -131,17 +131,15 @@ namespace OpenSim.Services.Interfaces | |||
131 | AvatarType = 1; // SL avatars | 131 | AvatarType = 1; // SL avatars |
132 | Data = new Dictionary<string, string>(); | 132 | Data = new Dictionary<string, string>(); |
133 | 133 | ||
134 | Data["Serial"] = appearance.Serial.ToString(); | ||
134 | // Wearables | 135 | // Wearables |
135 | Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); | 136 | Data["AvatarHeight"] = appearance.AvatarHeight.ToString(); |
136 | Data["BodyItem"] = appearance.BodyItem.ToString(); | 137 | Data["BodyItem"] = appearance.BodyItem.ToString(); |
137 | Data["EyesItem"] = appearance.EyesItem.ToString(); | 138 | Data["EyesItem"] = appearance.EyesItem.ToString(); |
138 | Data["GlovesItem"] = appearance.GlovesItem.ToString(); | 139 | Data["GlovesItem"] = appearance.GlovesItem.ToString(); |
139 | Data["HairItem"] = appearance.HairItem.ToString(); | 140 | Data["HairItem"] = appearance.HairItem.ToString(); |
140 | //Data["HipOffset"] = appearance.HipOffset.ToString(); | ||
141 | Data["JacketItem"] = appearance.JacketItem.ToString(); | 141 | Data["JacketItem"] = appearance.JacketItem.ToString(); |
142 | Data["Owner"] = appearance.Owner.ToString(); | ||
143 | Data["PantsItem"] = appearance.PantsItem.ToString(); | 142 | Data["PantsItem"] = appearance.PantsItem.ToString(); |
144 | Data["Serial"] = appearance.Serial.ToString(); | ||
145 | Data["ShirtItem"] = appearance.ShirtItem.ToString(); | 143 | Data["ShirtItem"] = appearance.ShirtItem.ToString(); |
146 | Data["ShoesItem"] = appearance.ShoesItem.ToString(); | 144 | Data["ShoesItem"] = appearance.ShoesItem.ToString(); |
147 | Data["SkinItem"] = appearance.SkinItem.ToString(); | 145 | Data["SkinItem"] = appearance.SkinItem.ToString(); |
@@ -150,53 +148,92 @@ namespace OpenSim.Services.Interfaces | |||
150 | Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString(); | 148 | Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString(); |
151 | Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString(); | 149 | Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString(); |
152 | 150 | ||
151 | Data["BodyAsset"] = appearance.BodyAsset.ToString(); | ||
152 | Data["EyesAsset"] = appearance.EyesAsset.ToString(); | ||
153 | Data["GlovesAsset"] = appearance.GlovesAsset.ToString(); | ||
154 | Data["HairAsset"] = appearance.HairAsset.ToString(); | ||
155 | Data["JacketAsset"] = appearance.JacketAsset.ToString(); | ||
156 | Data["PantsAsset"] = appearance.PantsAsset.ToString(); | ||
157 | Data["ShirtAsset"] = appearance.ShirtAsset.ToString(); | ||
158 | Data["ShoesAsset"] = appearance.ShoesAsset.ToString(); | ||
159 | Data["SkinAsset"] = appearance.SkinAsset.ToString(); | ||
160 | Data["SkirtAsset"] = appearance.SkirtAsset.ToString(); | ||
161 | Data["SocksAsset"] = appearance.SocksAsset.ToString(); | ||
162 | Data["UnderPantsAsset"] = appearance.UnderPantsAsset.ToString(); | ||
163 | Data["UnderShirtAsset"] = appearance.UnderShirtAsset.ToString(); | ||
164 | |||
153 | // Attachments | 165 | // Attachments |
154 | Hashtable attachs = appearance.GetAttachments(); | 166 | Hashtable attachs = appearance.GetAttachments(); |
155 | foreach (KeyValuePair<int, Hashtable> kvp in attachs) | 167 | if (attachs != null) |
156 | { | 168 | foreach (DictionaryEntry dentry in attachs) |
157 | Data["_ap_" + kvp.Key] = kvp.Value["item"].ToString(); | 169 | { |
158 | } | 170 | if (dentry.Value != null) |
171 | { | ||
172 | Hashtable tab = (Hashtable)dentry.Value; | ||
173 | if (tab.ContainsKey("item") && tab["item"] != null) | ||
174 | Data["_ap_" + dentry.Key] = tab["item"].ToString(); | ||
175 | } | ||
176 | } | ||
159 | } | 177 | } |
160 | 178 | ||
161 | public AvatarAppearance ToAvatarAppearance() | 179 | public AvatarAppearance ToAvatarAppearance(UUID owner) |
162 | { | 180 | { |
163 | AvatarAppearance appearance = new AvatarAppearance(); | 181 | AvatarAppearance appearance = new AvatarAppearance(owner); |
164 | // Wearables | 182 | try |
165 | appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]); | ||
166 | appearance.BodyItem = UUID.Parse(Data["BodyItem"]); | ||
167 | appearance.EyesItem = UUID.Parse(Data["EyesItem"]); | ||
168 | appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]); | ||
169 | appearance.HairItem = UUID.Parse(Data["HairItem"]); | ||
170 | //appearance.HipOffset = float.Parse(Data["HipOffset"]); | ||
171 | appearance.JacketItem = UUID.Parse(Data["JacketItem"]); | ||
172 | appearance.Owner = UUID.Parse(Data["Owner"]); | ||
173 | appearance.PantsItem = UUID.Parse(Data["PantsItem"]); | ||
174 | appearance.Serial = Int32.Parse(Data["Serial"]); | ||
175 | appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]); | ||
176 | appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]); | ||
177 | appearance.SkinItem = UUID.Parse(Data["SkinItem"]); | ||
178 | appearance.SkirtItem = UUID.Parse(Data["SkirtItem"]); | ||
179 | appearance.SocksItem = UUID.Parse(Data["SocksItem"]); | ||
180 | appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]); | ||
181 | appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]); | ||
182 | |||
183 | // Attachments | ||
184 | Dictionary<string, string> attchs = new Dictionary<string, string>(); | ||
185 | foreach (KeyValuePair<string, string> _kvp in Data) | ||
186 | if (_kvp.Key.StartsWith("_ap_")) | ||
187 | attchs[_kvp.Key] = _kvp.Value; | ||
188 | Hashtable aaAttachs = new Hashtable(); | ||
189 | foreach (KeyValuePair<string, string> _kvp in attchs) | ||
190 | { | 183 | { |
191 | string pointStr = _kvp.Key.Substring(4); | 184 | appearance.Serial = Int32.Parse(Data["Serial"]); |
192 | int point = 0; | 185 | |
193 | if (!Int32.TryParse(pointStr, out point)) | 186 | // Wearables |
194 | continue; | 187 | appearance.BodyItem = UUID.Parse(Data["BodyItem"]); |
195 | Hashtable tmp = new Hashtable(); | 188 | appearance.EyesItem = UUID.Parse(Data["EyesItem"]); |
196 | tmp["item"] = _kvp.Value; | 189 | appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]); |
197 | tmp["asset"] = UUID.Zero.ToString(); | 190 | appearance.HairItem = UUID.Parse(Data["HairItem"]); |
198 | aaAttachs[point] = tmp; | 191 | appearance.JacketItem = UUID.Parse(Data["JacketItem"]); |
192 | appearance.PantsItem = UUID.Parse(Data["PantsItem"]); | ||
193 | appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]); | ||
194 | appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]); | ||
195 | appearance.SkinItem = UUID.Parse(Data["SkinItem"]); | ||
196 | appearance.SkirtItem = UUID.Parse(Data["SkirtItem"]); | ||
197 | appearance.SocksItem = UUID.Parse(Data["SocksItem"]); | ||
198 | appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]); | ||
199 | appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]); | ||
200 | |||
201 | appearance.BodyAsset = UUID.Parse(Data["BodyAsset"]); | ||
202 | appearance.EyesAsset = UUID.Parse(Data["EyesAsset"]); | ||
203 | appearance.GlovesAsset = UUID.Parse(Data["GlovesAsset"]); | ||
204 | appearance.HairAsset = UUID.Parse(Data["HairAsset"]); | ||
205 | appearance.JacketAsset = UUID.Parse(Data["JacketAsset"]); | ||
206 | appearance.PantsAsset = UUID.Parse(Data["PantsAsset"]); | ||
207 | appearance.ShirtAsset = UUID.Parse(Data["ShirtAsset"]); | ||
208 | appearance.ShoesAsset = UUID.Parse(Data["ShoesAsset"]); | ||
209 | appearance.SkinAsset = UUID.Parse(Data["SkinAsset"]); | ||
210 | appearance.SkirtAsset = UUID.Parse(Data["SkirtAsset"]); | ||
211 | appearance.SocksAsset = UUID.Parse(Data["SocksAsset"]); | ||
212 | appearance.UnderPantsAsset = UUID.Parse(Data["UnderPantsAsset"]); | ||
213 | appearance.UnderShirtAsset = UUID.Parse(Data["UnderShirtAsset"]); | ||
214 | |||
215 | // Attachments | ||
216 | Dictionary<string, string> attchs = new Dictionary<string, string>(); | ||
217 | foreach (KeyValuePair<string, string> _kvp in Data) | ||
218 | if (_kvp.Key.StartsWith("_ap_")) | ||
219 | attchs[_kvp.Key] = _kvp.Value; | ||
220 | Hashtable aaAttachs = new Hashtable(); | ||
221 | foreach (KeyValuePair<string, string> _kvp in attchs) | ||
222 | { | ||
223 | string pointStr = _kvp.Key.Substring(4); | ||
224 | int point = 0; | ||
225 | if (!Int32.TryParse(pointStr, out point)) | ||
226 | continue; | ||
227 | Hashtable tmp = new Hashtable(); | ||
228 | UUID uuid = UUID.Zero; | ||
229 | UUID.TryParse(_kvp.Value, out uuid); | ||
230 | tmp["item"] = uuid; | ||
231 | tmp["asset"] = UUID.Zero.ToString(); | ||
232 | aaAttachs[point] = tmp; | ||
233 | } | ||
234 | appearance.SetAttachments(aaAttachs); | ||
199 | } | 235 | } |
236 | catch { } | ||
200 | 237 | ||
201 | return appearance; | 238 | return appearance; |
202 | } | 239 | } |
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 32df16d..e9c18ec 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs | |||
@@ -375,7 +375,7 @@ namespace OpenSim.Services.LLLoginService | |||
375 | 375 | ||
376 | aCircuit.AgentID = account.PrincipalID; | 376 | aCircuit.AgentID = account.PrincipalID; |
377 | if (avatar != null) | 377 | if (avatar != null) |
378 | aCircuit.Appearance = avatar.ToAvatarAppearance(); | 378 | aCircuit.Appearance = avatar.ToAvatarAppearance(account.PrincipalID); |
379 | //aCircuit.BaseFolder = irrelevant | 379 | //aCircuit.BaseFolder = irrelevant |
380 | aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); | 380 | aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); |
381 | aCircuit.child = false; // the first login agent is root | 381 | aCircuit.child = false; // the first login agent is root |