aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDiva Canto2010-01-02 16:26:40 -0800
committerDiva Canto2010-01-02 16:26:40 -0800
commit6da6b8d9c5821719302c355d21e94200586e25f1 (patch)
tree846073e7af839a1cc4c06b1f206a4e8a40e8ddcf
parent* Avatar service connectors all in place, but untested. (diff)
downloadopensim-SC_OLD-6da6b8d9c5821719302c355d21e94200586e25f1.zip
opensim-SC_OLD-6da6b8d9c5821719302c355d21e94200586e25f1.tar.gz
opensim-SC_OLD-6da6b8d9c5821719302c355d21e94200586e25f1.tar.bz2
opensim-SC_OLD-6da6b8d9c5821719302c355d21e94200586e25f1.tar.xz
* Converters from new AvatarData to old AvatarAppearance and vice-versa
* Login now retrieves AvatarData from AvatarService and sends it off with the agent data
Diffstat (limited to '')
-rw-r--r--OpenSim/Services/Interfaces/IAvatarService.cs95
-rw-r--r--OpenSim/Services/LLLoginService/LLLoginService.cs31
2 files changed, 117 insertions, 9 deletions
diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs
index 682616a..39368f1 100644
--- a/OpenSim/Services/Interfaces/IAvatarService.cs
+++ b/OpenSim/Services/Interfaces/IAvatarService.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
29using System.Collections.Generic; 30using System.Collections.Generic;
30 31
31using OpenSim.Framework; 32using OpenSim.Framework;
@@ -93,7 +94,16 @@ namespace OpenSim.Services.Interfaces
93 94
94 public AvatarData(Dictionary<string, object> kvp) 95 public AvatarData(Dictionary<string, object> kvp)
95 { 96 {
96 // TODO 97 Data = new Dictionary<string, string>();
98
99 if (kvp.ContainsKey("AvatarType"))
100 Int32.TryParse(kvp["AvatarType"].ToString(), out AvatarType);
101
102 foreach (KeyValuePair<string, object> _kvp in kvp)
103 {
104 if (_kvp.Value != null)
105 Data[_kvp.Key] = _kvp.Value.ToString();
106 }
97 } 107 }
98 108
99 /// <summary> 109 /// <summary>
@@ -101,7 +111,90 @@ namespace OpenSim.Services.Interfaces
101 /// <returns></returns> 111 /// <returns></returns>
102 public Dictionary<string, object> ToKeyValuePairs() 112 public Dictionary<string, object> ToKeyValuePairs()
103 { 113 {
114 Dictionary<string, object> result = new Dictionary<string, object>();
115
116 result["AvatarType"] = AvatarType.ToString();
117 foreach (KeyValuePair<string, string> _kvp in Data)
118 {
119 if (_kvp.Value != null)
120 result[_kvp.Key] = _kvp.Value;
121 }
104 return null; 122 return null;
105 } 123 }
124
125 public AvatarData(AvatarAppearance appearance)
126 {
127 AvatarType = 1; // SL avatars
128 Data = new Dictionary<string, string>();
129
130 // Wearables
131 Data["AvatarHeight"] = appearance.AvatarHeight.ToString();
132 Data["BodyItem"] = appearance.BodyItem.ToString();
133 Data["EyesItem"] = appearance.EyesItem.ToString();
134 Data["GlovesItem"] = appearance.GlovesItem.ToString();
135 Data["HairItem"] = appearance.HairItem.ToString();
136 //Data["HipOffset"] = appearance.HipOffset.ToString();
137 Data["JacketItem"] = appearance.JacketItem.ToString();
138 Data["Owner"] = appearance.Owner.ToString();
139 Data["PantsItem"] = appearance.PantsItem.ToString();
140 Data["Serial"] = appearance.Serial.ToString();
141 Data["ShirtItem"] = appearance.ShirtItem.ToString();
142 Data["ShoesItem"] = appearance.ShoesItem.ToString();
143 Data["SkinItem"] = appearance.SkinItem.ToString();
144 Data["SkirtItem"] = appearance.SkirtItem.ToString();
145 Data["SocksItem"] = appearance.SocksItem.ToString();
146 Data["UnderPantsItem"] = appearance.UnderPantsItem.ToString();
147 Data["UnderShirtItem"] = appearance.UnderShirtItem.ToString();
148
149 // Attachments
150 Hashtable attachs = appearance.GetAttachments();
151 foreach (KeyValuePair<int, Hashtable> kvp in attachs)
152 {
153 Data["_ap_" + kvp.Key] = kvp.Value["item"].ToString();
154 }
155 }
156
157 public AvatarAppearance ToAvatarAppearance()
158 {
159 AvatarAppearance appearance = new AvatarAppearance();
160 // Wearables
161 appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]);
162 appearance.BodyItem = UUID.Parse(Data["BodyItem"]);
163 appearance.EyesItem = UUID.Parse(Data["EyesItem"]);
164 appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]);
165 appearance.HairItem = UUID.Parse(Data["HairItem"]);
166 //appearance.HipOffset = float.Parse(Data["HipOffset"]);
167 appearance.JacketItem = UUID.Parse(Data["JacketItem"]);
168 appearance.Owner = UUID.Parse(Data["Owner"]);
169 appearance.PantsItem = UUID.Parse(Data["PantsItem"]);
170 appearance.Serial = Int32.Parse(Data["Serial"]);
171 appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]);
172 appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]);
173 appearance.SkinItem = UUID.Parse(Data["SkinItem"]);
174 appearance.SkirtItem = UUID.Parse(Data["SkirtItem"]);
175 appearance.SocksItem = UUID.Parse(Data["SocksItem"]);
176 appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]);
177 appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]);
178
179 // Attachments
180 Dictionary<string, string> attchs = new Dictionary<string, string>();
181 foreach (KeyValuePair<string, string> _kvp in Data)
182 if (_kvp.Key.StartsWith("_ap_"))
183 attchs[_kvp.Key] = _kvp.Value;
184 Hashtable aaAttachs = new Hashtable();
185 foreach (KeyValuePair<string, string> _kvp in attchs)
186 {
187 string pointStr = _kvp.Key.Substring(4);
188 int point = 0;
189 if (!Int32.TryParse(pointStr, out point))
190 continue;
191 Hashtable tmp = new Hashtable();
192 tmp["item"] = _kvp.Value;
193 tmp["asset"] = UUID.Zero.ToString();
194 aaAttachs[point] = tmp;
195 }
196
197 return appearance;
198 }
106 } 199 }
107} 200}
diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs
index 2b74539..82e5ba4 100644
--- a/OpenSim/Services/LLLoginService/LLLoginService.cs
+++ b/OpenSim/Services/LLLoginService/LLLoginService.cs
@@ -27,6 +27,7 @@ namespace OpenSim.Services.LLLoginService
27 private IPresenceService m_PresenceService; 27 private IPresenceService m_PresenceService;
28 private ISimulationService m_LocalSimulationService; 28 private ISimulationService m_LocalSimulationService;
29 private ILibraryService m_LibraryService; 29 private ILibraryService m_LibraryService;
30 private IAvatarService m_AvatarService;
30 31
31 private string m_DefaultRegionName; 32 private string m_DefaultRegionName;
32 private string m_RemoteSimulationDll; 33 private string m_RemoteSimulationDll;
@@ -45,15 +46,15 @@ namespace OpenSim.Services.LLLoginService
45 string gridService = serverConfig.GetString("GridService", String.Empty); 46 string gridService = serverConfig.GetString("GridService", String.Empty);
46 string presenceService = serverConfig.GetString("PresenceService", String.Empty); 47 string presenceService = serverConfig.GetString("PresenceService", String.Empty);
47 string libService = serverConfig.GetString("LibraryService", String.Empty); 48 string libService = serverConfig.GetString("LibraryService", String.Empty);
49 string avatarService = serverConfig.GetString("AvatarService", String.Empty);
48 50
49 m_DefaultRegionName = serverConfig.GetString("DefaultRegion", String.Empty); 51 m_DefaultRegionName = serverConfig.GetString("DefaultRegion", String.Empty);
50 m_RemoteSimulationDll = serverConfig.GetString("RemoteSimulationService", String.Empty); 52 m_RemoteSimulationDll = serverConfig.GetString("RemoteSimulationService", String.Empty);
51 m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!"); 53 m_WelcomeMessage = serverConfig.GetString("WelcomeMessage", "Welcome to OpenSim!");
52 m_RequireInventory = serverConfig.GetBoolean("RequireInventory", true); 54 m_RequireInventory = serverConfig.GetBoolean("RequireInventory", true);
53 55
54 // These 3 are required; the others aren't 56 // These are required; the others aren't
55 if (accountService == string.Empty || authService == string.Empty || 57 if (accountService == string.Empty || authService == string.Empty)
56 invService == string.Empty)
57 throw new Exception("LoginService is missing service specifications"); 58 throw new Exception("LoginService is missing service specifications");
58 59
59 Object[] args = new Object[] { config }; 60 Object[] args = new Object[] { config };
@@ -64,7 +65,8 @@ namespace OpenSim.Services.LLLoginService
64 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args); 65 m_GridService = ServerUtils.LoadPlugin<IGridService>(gridService, args);
65 if (presenceService != string.Empty) 66 if (presenceService != string.Empty)
66 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args); 67 m_PresenceService = ServerUtils.LoadPlugin<IPresenceService>(presenceService, args);
67 68 if (avatarService != string.Empty)
69 m_AvatarService = ServerUtils.LoadPlugin<IAvatarService>(avatarService, args);
68 // 70 //
69 // deal with the services given as argument 71 // deal with the services given as argument
70 // 72 //
@@ -116,6 +118,11 @@ namespace OpenSim.Services.LLLoginService
116 } 118 }
117 119
118 // Get the user's inventory 120 // Get the user's inventory
121 if (m_RequireInventory && m_InventoryService == null)
122 {
123 m_log.WarnFormat("[LLOGIN SERVICE]: Login failed, reason: inventory service not set up");
124 return LLFailedLoginResponse.InventoryProblem;
125 }
119 List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID); 126 List<InventoryFolderBase> inventorySkel = m_InventoryService.GetInventorySkeleton(account.PrincipalID);
120 if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0))) 127 if (m_RequireInventory && ((inventorySkel == null) || (inventorySkel != null && inventorySkel.Count == 0)))
121 { 128 {
@@ -159,6 +166,13 @@ namespace OpenSim.Services.LLLoginService
159 return LLFailedLoginResponse.GridProblem; 166 return LLFailedLoginResponse.GridProblem;
160 } 167 }
161 168
169 // Get the avatar
170 AvatarData avatar = null;
171 if (m_AvatarService != null)
172 {
173 avatar = m_AvatarService.GetAvatar(account.PrincipalID);
174 }
175
162 // Instantiate/get the simulation interface and launch an agent at the destination 176 // Instantiate/get the simulation interface and launch an agent at the destination
163 ISimulationService simConnector = null; 177 ISimulationService simConnector = null;
164 string reason = string.Empty; 178 string reason = string.Empty;
@@ -175,7 +189,7 @@ namespace OpenSim.Services.LLLoginService
175 if (simConnector != null) 189 if (simConnector != null)
176 { 190 {
177 circuitCode = (uint)Util.RandomClass.Next(); ; 191 circuitCode = (uint)Util.RandomClass.Next(); ;
178 aCircuit = LaunchAgent(simConnector, destination, account, session, secureSession, circuitCode, position, out reason); 192 aCircuit = LaunchAgent(simConnector, destination, account, avatar, session, secureSession, circuitCode, position, out reason);
179 } 193 }
180 if (aCircuit == null) 194 if (aCircuit == null)
181 { 195 {
@@ -337,16 +351,17 @@ namespace OpenSim.Services.LLLoginService
337 } 351 }
338 352
339 private AgentCircuitData LaunchAgent(ISimulationService simConnector, GridRegion region, UserAccount account, 353 private AgentCircuitData LaunchAgent(ISimulationService simConnector, GridRegion region, UserAccount account,
340 UUID session, UUID secureSession, uint circuit, Vector3 position, out string reason) 354 AvatarData avatar, UUID session, UUID secureSession, uint circuit, Vector3 position, out string reason)
341 { 355 {
342 reason = string.Empty; 356 reason = string.Empty;
343 AgentCircuitData aCircuit = new AgentCircuitData(); 357 AgentCircuitData aCircuit = new AgentCircuitData();
344 358
345 aCircuit.AgentID = account.PrincipalID; 359 aCircuit.AgentID = account.PrincipalID;
346 //aCircuit.Appearance = optional 360 if (avatar != null)
361 aCircuit.Appearance = avatar.ToAvatarAppearance();
347 //aCircuit.BaseFolder = irrelevant 362 //aCircuit.BaseFolder = irrelevant
348 aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath(); 363 aCircuit.CapsPath = CapsUtil.GetRandomCapsObjectPath();
349 aCircuit.child = false; 364 aCircuit.child = false; // the first login agent is root
350 aCircuit.circuitcode = circuit; 365 aCircuit.circuitcode = circuit;
351 aCircuit.firstname = account.FirstName; 366 aCircuit.firstname = account.FirstName;
352 //aCircuit.InventoryFolder = irrelevant 367 //aCircuit.InventoryFolder = irrelevant