Annotation of /trunk/ModularRex/RexNetwork/RexClientView.cs
Parent Directory
|
Revision Log
Revision 45 - (view) (download)
| 1 : | afrisby | 25 | using System; |
| 2 : | using System.Collections; | ||
| 3 : | afrisby | 4 | using System.Collections.Generic; |
| 4 : | afrisby | 2 | using System.Net; |
| 5 : | afrisby | 4 | using System.Reflection; |
| 6 : | using System.Threading; | ||
| 7 : | using log4net; | ||
| 8 : | afrisby | 25 | using ModularRex.RexFramework; |
| 9 : | afrisby | 4 | using Nwc.XmlRpc; |
| 10 : | afrisby | 2 | using OpenMetaverse; |
| 11 : | afrisby | 25 | using OpenMetaverse.Packets; |
| 12 : | afrisby | 2 | using OpenSim.Framework; |
| 13 : | using OpenSim.Framework.Communications.Cache; | ||
| 14 : | afrisby | 5 | using OpenSim.Region.ClientStack; |
| 15 : | afrisby | 2 | using OpenSim.Region.ClientStack.LindenUDP; |
| 16 : | |||
| 17 : | namespace ModularRex.RexNetwork | ||
| 18 : | { | ||
| 19 : | public delegate void RexAppearanceDelegate(RexClientView sender); | ||
| 20 : | |||
| 21 : | mikkopa | 14 | public delegate void RexFaceExpressionDelegate(RexClientView sender, List<string> parameters); |
| 22 : | afrisby | 2 | |
| 23 : | afrisby | 5 | public delegate void RexAvatarProperties(RexClientView sender, List<string> parameters); |
| 24 : | |||
| 25 : | afrisby | 25 | public delegate void RexRecieveObjectPropertiesDelegate(RexClientView sender, UUID id, RexObjectProperties props); |
| 26 : | |||
| 27 : | mikkopa | 14 | public delegate void ReceiveRexStartUp(RexClientView remoteClient, UUID agentID, string status); |
| 28 : | |||
| 29 : | public delegate void ReceiveRexClientScriptCmd(RexClientView remoteClient, UUID agentID, List<string> parameters); | ||
| 30 : | |||
| 31 : | afrisby | 11 | /// <summary> |
| 32 : | /// Inherits from LLClientView the majority of functionality | ||
| 33 : | /// Overrides and extends for Rex-specific functionality. | ||
| 34 : | /// | ||
| 35 : | /// In the case whereby functionality uses the same packets but differs | ||
| 36 : | /// between Rex and LL, you can use a override on those specific functions | ||
| 37 : | /// to overload the request. | ||
| 38 : | /// </summary> | ||
| 39 : | afrisby | 3 | public class RexClientView : LLClientView, IClientRexFaceExpression, IClientRexAppearance |
| 40 : | afrisby | 2 | { |
| 41 : | afrisby | 4 | private static readonly ILog m_log = |
| 42 : | LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
| 43 : | |||
| 44 : | afrisby | 10 | private string m_rexAccountID; |
| 45 : | afrisby | 4 | private string m_rexAvatarURL; |
| 46 : | private string m_rexAuthURL; | ||
| 47 : | private string m_rexSkypeURL; | ||
| 48 : | mikkopa | 12 | public string AvatarStorageOverride; |
| 49 : | afrisby | 4 | |
| 50 : | mikkopa | 20 | public float RexCharacterSpeedMod = 1.0f; |
| 51 : | public float RexMovementSpeedMod = 1.0f; | ||
| 52 : | public float RexVertMovementSpeedMod = 1.0f; | ||
| 53 : | public bool RexWalkDisabled = false; | ||
| 54 : | public bool RexFlyDisabled = false; | ||
| 55 : | public bool RexSitDisabled = false; | ||
| 56 : | |||
| 57 : | afrisby | 2 | public event RexAppearanceDelegate OnRexAppearance; |
| 58 : | public event RexFaceExpressionDelegate OnRexFaceExpression; | ||
| 59 : | afrisby | 5 | public event RexAvatarProperties OnRexAvatarProperties; |
| 60 : | afrisby | 25 | public event RexRecieveObjectPropertiesDelegate OnRexObjectProperties; |
| 61 : | mikkopa | 14 | public event ReceiveRexStartUp OnReceiveRexStartUp; |
| 62 : | public event ReceiveRexClientScriptCmd OnReceiveRexClientScriptCmd; | ||
| 63 : | afrisby | 2 | |
| 64 : | public RexClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, | ||
| 65 : | afrisby | 6 | LLPacketServer packServer, AuthenticateResponse authenSessions, UUID agentId, |
| 66 : | afrisby | 5 | UUID sessionId, uint circuitCode, EndPoint proxyEP, ClientStackUserSettings userSettings) |
| 67 : | afrisby | 2 | : base(remoteEP, scene, assetCache, packServer, authenSessions, agentId, |
| 68 : | afrisby | 5 | sessionId, circuitCode, proxyEP, userSettings) |
| 69 : | afrisby | 2 | { |
| 70 : | afrisby | 11 | // Rex communication now occurs via GenericMessage |
| 71 : | // We have a special handler here below. | ||
| 72 : | afrisby | 25 | |
| 73 : | |||
| 74 : | AddGenericPacketHandler("RexAppearance", RealXtendClientView_OnGenericMessage); | ||
| 75 : | AddGenericPacketHandler("RexFaceExpression", RealXtendClientView_OnGenericMessage); | ||
| 76 : | AddGenericPacketHandler("RexAvatarProp", RealXtendClientView_OnGenericMessage); | ||
| 77 : | AddGenericPacketHandler("RexPrimData", RealXtendClientView_OnGenericMessage); | ||
| 78 : | AddGenericPacketHandler("RexData", RealXtendClientView_OnGenericMessage); | ||
| 79 : | |||
| 80 : | OnBinaryGenericMessage += RexClientView_BinaryGenericMessage; | ||
| 81 : | afrisby | 2 | OnGenericMessage += RealXtendClientView_OnGenericMessage; |
| 82 : | } | ||
| 83 : | |||
| 84 : | afrisby | 4 | public RexClientView(EndPoint remoteEP, IScene scene, AssetCache assetCache, |
| 85 : | afrisby | 6 | LLPacketServer packServer, AuthenticateResponse authenSessions, UUID agentId, |
| 86 : | afrisby | 5 | UUID sessionId, uint circuitCode, EndPoint proxyEP, string rexAvatarURL, string rexAuthURL, ClientStackUserSettings userSettings) |
| 87 : | afrisby | 4 | : base(remoteEP, scene, assetCache, packServer, authenSessions, agentId, |
| 88 : | afrisby | 5 | sessionId, circuitCode, proxyEP, userSettings) |
| 89 : | afrisby | 4 | { |
| 90 : | afrisby | 11 | // Rex communication now occurs via GenericMessage |
| 91 : | afrisby | 25 | // We need to register GenericMessage handlers |
| 92 : | afrisby | 4 | |
| 93 : | afrisby | 25 | AddGenericPacketHandler("RexAppearance", RealXtendClientView_OnGenericMessage); |
| 94 : | AddGenericPacketHandler("RexFaceExpression", RealXtendClientView_OnGenericMessage); | ||
| 95 : | AddGenericPacketHandler("RexAvatarProp", RealXtendClientView_OnGenericMessage); | ||
| 96 : | AddGenericPacketHandler("RexPrimData", RealXtendClientView_OnGenericMessage); | ||
| 97 : | AddGenericPacketHandler("RexData", RealXtendClientView_OnGenericMessage); | ||
| 98 : | |||
| 99 : | OnBinaryGenericMessage += RexClientView_BinaryGenericMessage; | ||
| 100 : | |||
| 101 : | afrisby | 4 | RexAvatarURL = rexAvatarURL; |
| 102 : | RexAuthURL = rexAuthURL; | ||
| 103 : | } | ||
| 104 : | |||
| 105 : | afrisby | 11 | /// <summary> |
| 106 : | /// Registers interfaces for IClientCore, | ||
| 107 : | /// every time you make a new Rex-specific | ||
| 108 : | /// Interface. Make sure to register it here. | ||
| 109 : | /// </summary> | ||
| 110 : | afrisby | 9 | protected override void RegisterInterfaces() |
| 111 : | { | ||
| 112 : | RegisterInterface<IClientRexAppearance>(this); | ||
| 113 : | RegisterInterface<IClientRexFaceExpression>(this); | ||
| 114 : | |||
| 115 : | afrisby | 25 | // Register our own class 'as-is' so it can be |
| 116 : | // used via IClientCore.Get<RexClientView>()... | ||
| 117 : | RegisterInterface(this); | ||
| 118 : | |||
| 119 : | afrisby | 9 | base.RegisterInterfaces(); |
| 120 : | } | ||
| 121 : | |||
| 122 : | afrisby | 11 | /// <summary> |
| 123 : | /// The avatar URL for this avatar | ||
| 124 : | /// Eg: http://avatar.com:10000/uuid/ | ||
| 125 : | /// </summary> | ||
| 126 : | afrisby | 4 | public string RexAvatarURL |
| 127 : | { | ||
| 128 : | get { return m_rexAvatarURL; } | ||
| 129 : | set | ||
| 130 : | { | ||
| 131 : | m_rexAvatarURL = value; | ||
| 132 : | if (OnRexAppearance != null) | ||
| 133 : | { | ||
| 134 : | OnRexAppearance(this); | ||
| 135 : | return; | ||
| 136 : | } | ||
| 137 : | } | ||
| 138 : | } | ||
| 139 : | |||
| 140 : | afrisby | 11 | /// <summary> |
| 141 : | /// Skype username of the avatar | ||
| 142 : | /// eg: Skypeuser | ||
| 143 : | /// </summary> | ||
| 144 : | afrisby | 4 | public string RexSkypeURL |
| 145 : | { | ||
| 146 : | get { return m_rexSkypeURL; } | ||
| 147 : | set { m_rexSkypeURL = value; } | ||
| 148 : | } | ||
| 149 : | |||
| 150 : | afrisby | 11 | /// <summary> |
| 151 : | /// The full Rex Username of this account | ||
| 152 : | /// Eg: user@hostname.com:10001 | ||
| 153 : | /// | ||
| 154 : | /// Note: This is not filled immedietely on | ||
| 155 : | /// creation. This property is filled in | ||
| 156 : | /// via Login and may not be availible | ||
| 157 : | /// immedietely upon connect. | ||
| 158 : | /// | ||
| 159 : | /// The above glitch is scheduled to be | ||
| 160 : | /// fixed by a new RexCommsManager which | ||
| 161 : | /// will allow this to be set at spawn in | ||
| 162 : | /// login. | ||
| 163 : | /// </summary> | ||
| 164 : | afrisby | 10 | public string RexAccount |
| 165 : | { | ||
| 166 : | get { return m_rexAccountID; } | ||
| 167 : | set | ||
| 168 : | { | ||
| 169 : | // Todo: More solid data checking here. | ||
| 170 : | m_rexAccountID = value; | ||
| 171 : | RexAuthURL = m_rexAccountID.Split('@')[1]; | ||
| 172 : | } | ||
| 173 : | } | ||
| 174 : | |||
| 175 : | afrisby | 11 | /// <summary> |
| 176 : | /// The URL of the Avatar's Authentication Server | ||
| 177 : | /// Eg: http://authentication.com:10001/ | ||
| 178 : | /// </summary> | ||
| 179 : | afrisby | 4 | public string RexAuthURL |
| 180 : | { | ||
| 181 : | get { return m_rexAuthURL; } | ||
| 182 : | set | ||
| 183 : | { | ||
| 184 : | mikkopa | 39 | m_rexAuthURL = value; |
| 185 : | |||
| 186 : | afrisby | 4 | // Request Agent Properties Asynchronously |
| 187 : | ThreadPool.QueueUserWorkItem(RequestProperties); | ||
| 188 : | } | ||
| 189 : | } | ||
| 190 : | |||
| 191 : | afrisby | 25 | void RexClientView_BinaryGenericMessage(Object sender, string method, byte[][] args) |
| 192 : | { | ||
| 193 : | if(method == "RexPrimData".ToLower()) | ||
| 194 : | { | ||
| 195 : | HandleRexPrimData(args); | ||
| 196 : | return; | ||
| 197 : | } | ||
| 198 : | } | ||
| 199 : | |||
| 200 : | private void HandleRexPrimData(byte[][] args) | ||
| 201 : | { | ||
| 202 : | int rpdLen = 0; | ||
| 203 : | int idx = 0; | ||
| 204 : | bool first = false; | ||
| 205 : | UUID id = UUID.Zero; | ||
| 206 : | |||
| 207 : | foreach (byte[] arg in args) | ||
| 208 : | { | ||
| 209 : | if(!first) | ||
| 210 : | { | ||
| 211 : | id = new UUID(Util.FieldToString(arg)); | ||
| 212 : | first = true; | ||
| 213 : | continue; | ||
| 214 : | } | ||
| 215 : | |||
| 216 : | rpdLen += arg.Length; | ||
| 217 : | } | ||
| 218 : | |||
| 219 : | first = false; | ||
| 220 : | byte[] rpdArray = new byte[rpdLen]; | ||
| 221 : | |||
| 222 : | foreach (byte[] arg in args) | ||
| 223 : | { | ||
| 224 : | if(!first) | ||
| 225 : | { | ||
| 226 : | first = true; | ||
| 227 : | continue; | ||
| 228 : | } | ||
| 229 : | |||
| 230 : | arg.CopyTo(rpdArray,idx); | ||
| 231 : | idx += arg.Length; | ||
| 232 : | } | ||
| 233 : | |||
| 234 : | if (OnRexObjectProperties != null) | ||
| 235 : | OnRexObjectProperties(this, id, new RexObjectProperties(rpdArray)); | ||
| 236 : | } | ||
| 237 : | |||
| 238 : | afrisby | 11 | /// <summary> |
| 239 : | /// Special - used to convert GenericMessage packets | ||
| 240 : | /// to their appropriate Rex equivilents. | ||
| 241 : | /// | ||
| 242 : | /// Eg: GenericMessage(RexAppearance) -> | ||
| 243 : | /// OnRexAppearance(...) | ||
| 244 : | /// </summary> | ||
| 245 : | afrisby | 2 | void RealXtendClientView_OnGenericMessage(object sender, string method, List<string> args) |
| 246 : | { | ||
| 247 : | //TODO: Convert to Dictionary<Method, GenericMessageHandler> | ||
| 248 : | |||
| 249 : | if (method == "RexAppearance") | ||
| 250 : | if (OnRexAppearance != null) | ||
| 251 : | { | ||
| 252 : | OnRexAppearance(this); | ||
| 253 : | return; | ||
| 254 : | } | ||
| 255 : | |||
| 256 : | afrisby | 4 | if (method == "RexFaceExpression") |
| 257 : | afrisby | 2 | { |
| 258 : | afrisby | 4 | if (OnRexFaceExpression != null) |
| 259 : | afrisby | 2 | { |
| 260 : | OnRexFaceExpression(this, args); | ||
| 261 : | afrisby | 5 | return; |
| 262 : | afrisby | 2 | } |
| 263 : | } | ||
| 264 : | afrisby | 5 | |
| 265 : | if (method == "RexAvatarProp") | ||
| 266 : | { | ||
| 267 : | if(OnRexAvatarProperties != null) | ||
| 268 : | { | ||
| 269 : | OnRexAvatarProperties(this, args); | ||
| 270 : | return; | ||
| 271 : | } | ||
| 272 : | } | ||
| 273 : | |||
| 274 : | afrisby | 25 | if(method == "RexData") |
| 275 : | { | ||
| 276 : | |||
| 277 : | } | ||
| 278 : | |||
| 279 : | mikkopa | 14 | if (method == "rexscr") |
| 280 : | { | ||
| 281 : | if (OnReceiveRexClientScriptCmd != null) | ||
| 282 : | { | ||
| 283 : | OnReceiveRexClientScriptCmd(this, AgentId, args); | ||
| 284 : | mikkopa | 43 | return; |
| 285 : | mikkopa | 14 | } |
| 286 : | } | ||
| 287 : | |||
| 288 : | if (method == "RexStartup") | ||
| 289 : | { | ||
| 290 : | if (OnReceiveRexStartUp != null) | ||
| 291 : | { | ||
| 292 : | OnReceiveRexStartUp(this, AgentId, args[0]); | ||
| 293 : | mikkopa | 43 | return; |
| 294 : | mikkopa | 14 | } |
| 295 : | } | ||
| 296 : | |||
| 297 : | afrisby | 5 | m_log.Warn("[REXCLIENTVIEW] Unhandled GenericMessage (" + method + ") {"); |
| 298 : | foreach (string s in args) | ||
| 299 : | { | ||
| 300 : | m_log.Warn("\t" + s); | ||
| 301 : | } | ||
| 302 : | m_log.Warn("}"); | ||
| 303 : | |||
| 304 : | afrisby | 2 | } |
| 305 : | |||
| 306 : | afrisby | 25 | public void SendRexObjectProperties(UUID id, RexObjectProperties x) |
| 307 : | { | ||
| 308 : | GenericMessagePacket gmp = new GenericMessagePacket(); | ||
| 309 : | gmp.MethodData.Method = Utils.StringToBytes("RexPrimData"); | ||
| 310 : | |||
| 311 : | byte[] temprexprimdata = x.GetRexPrimDataToBytes(); | ||
| 312 : | int numlines = 0; | ||
| 313 : | int i = 0; | ||
| 314 : | |||
| 315 : | if (temprexprimdata != null) | ||
| 316 : | { | ||
| 317 : | while (i <= temprexprimdata.Length) | ||
| 318 : | { | ||
| 319 : | numlines++; | ||
| 320 : | i += 200; | ||
| 321 : | } | ||
| 322 : | } | ||
| 323 : | |||
| 324 : | gmp.ParamList = new GenericMessagePacket.ParamListBlock[1 + numlines]; | ||
| 325 : | gmp.ParamList[0] = new GenericMessagePacket.ParamListBlock(); | ||
| 326 : | gmp.ParamList[0].Parameter = Utils.StringToBytes(id.ToString()); | ||
| 327 : | |||
| 328 : | for (i = 0; i < numlines; i++) | ||
| 329 : | { | ||
| 330 : | gmp.ParamList[i + 1] = new GenericMessagePacket.ParamListBlock(); | ||
| 331 : | |||
| 332 : | if ((temprexprimdata.Length - i * 200) < 200) | ||
| 333 : | { | ||
| 334 : | gmp.ParamList[i + 1].Parameter = new byte[temprexprimdata.Length - i * 200]; | ||
| 335 : | Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, temprexprimdata.Length - i * 200); | ||
| 336 : | } | ||
| 337 : | else | ||
| 338 : | { | ||
| 339 : | gmp.ParamList[i + 1].Parameter = new byte[200]; | ||
| 340 : | Buffer.BlockCopy(temprexprimdata, i * 200, gmp.ParamList[i + 1].Parameter, 0, 200); | ||
| 341 : | } | ||
| 342 : | } | ||
| 343 : | |||
| 344 : | // m_log.Warn("[REXDEBUG]: SendRexPrimData " + vPrimId.ToString()); | ||
| 345 : | OutPacket(gmp, ThrottleOutPacketType.Task); | ||
| 346 : | |||
| 347 : | } | ||
| 348 : | |||
| 349 : | afrisby | 11 | /// <summary> |
| 350 : | /// Sends a Rex Script Command to the viewer | ||
| 351 : | /// attached to this ClientView. | ||
| 352 : | /// | ||
| 353 : | /// If you are coding something, try use | ||
| 354 : | /// SendRex*** instead, as many of them | ||
| 355 : | /// will trigger this instead with type | ||
| 356 : | /// and parameter checking. | ||
| 357 : | /// </summary> | ||
| 358 : | afrisby | 5 | public void SendRexScriptCommand(string unit, string command, string parameters) |
| 359 : | { | ||
| 360 : | List<string> pack = new List<string>(); | ||
| 361 : | |||
| 362 : | pack.Add(unit); | ||
| 363 : | pack.Add(command); | ||
| 364 : | |||
| 365 : | if (!string.IsNullOrEmpty(parameters)) | ||
| 366 : | pack.Add(parameters); | ||
| 367 : | |||
| 368 : | SendGenericMessage("RexScr", pack); | ||
| 369 : | } | ||
| 370 : | |||
| 371 : | public void SendRexInventoryMessage(string message) | ||
| 372 : | { | ||
| 373 : | SendRexScriptCommand("hud", "ShowInventoryMessage(\"" + message + "\")", ""); | ||
| 374 : | } | ||
| 375 : | |||
| 376 : | afrisby | 6 | public void SendRexScrollMessage(string message, double time) |
| 377 : | { | ||
| 378 : | SendRexScriptCommand("hud", "ShowScrollMessage(\"" + message + "\", \"" + time + "\")", ""); | ||
| 379 : | } | ||
| 380 : | |||
| 381 : | public void SendRexTutorialMessage(string message, double time) | ||
| 382 : | { | ||
| 383 : | SendRexScriptCommand("hud", "ShowScrollMessage(\"" + message + "\", \"" + time + "\")", ""); | ||
| 384 : | } | ||
| 385 : | |||
| 386 : | public void SendRexFadeInAndOut(string message, double between, double time) | ||
| 387 : | { | ||
| 388 : | SendRexScriptCommand("hud", | ||
| 389 : | "ShowInventoryMessage(\"" + message + "\"," | ||
| 390 : | + " \"" + between + "\", \"" + time + "\")", ""); | ||
| 391 : | } | ||
| 392 : | |||
| 393 : | |||
| 394 : | afrisby | 2 | public void SendRexFaceExpression(List<string> expressionData) |
| 395 : | { | ||
| 396 : | expressionData.Insert(0, AgentId.ToString()); | ||
| 397 : | SendGenericMessage("RexFaceExpression", expressionData); | ||
| 398 : | } | ||
| 399 : | |||
| 400 : | public void SendRexAppearance(UUID agentID, string avatarURL) | ||
| 401 : | { | ||
| 402 : | List<string> pack = new List<string>(); | ||
| 403 : | pack.Add(avatarURL); | ||
| 404 : | pack.Add(agentID.ToString()); | ||
| 405 : | |||
| 406 : | SendGenericMessage("RexAppearance", pack); | ||
| 407 : | } | ||
| 408 : | afrisby | 4 | |
| 409 : | /// <summary> | ||
| 410 : | /// Requests properties about this agent from their | ||
| 411 : | /// authentication server. This should be run in | ||
| 412 : | /// an async thread. | ||
| 413 : | /// | ||
| 414 : | /// Note that this particular function may set the | ||
| 415 : | /// avatars appearance which may in turn call | ||
| 416 : | /// additional modules and functions elsewhere. | ||
| 417 : | /// </summary> | ||
| 418 : | /// <param name="o"></param> | ||
| 419 : | private void RequestProperties(object o) | ||
| 420 : | { | ||
| 421 : | m_log.Info("[REXCLIENT] Resolving avatar..."); | ||
| 422 : | Hashtable ReqVals = new Hashtable(); | ||
| 423 : | afrisby | 25 | ReqVals["avatar_account"] = RexAccount; |
| 424 : | afrisby | 4 | ReqVals["AuthenticationAddress"] = RexAuthURL; |
| 425 : | |||
| 426 : | ArrayList SendParams = new ArrayList(); | ||
| 427 : | SendParams.Add(ReqVals); | ||
| 428 : | |||
| 429 : | afrisby | 25 | XmlRpcRequest req = new XmlRpcRequest("get_user_by_account", SendParams); |
| 430 : | afrisby | 4 | |
| 431 : | afrisby | 25 | m_log.Info("[REXCLIENT] Sending XMLRPC Request to http://" + RexAuthURL); |
| 432 : | afrisby | 4 | |
| 433 : | afrisby | 25 | XmlRpcResponse authreply = req.Send("http://" + RexAuthURL, 9000); |
| 434 : | |||
| 435 : | mikkopa | 39 | //m_log.Info(authreply.ToString()); |
| 436 : | mikkopa | 28 | if (!((Hashtable)authreply.Value).ContainsKey("error_type")) |
| 437 : | { | ||
| 438 : | afrisby | 25 | string rexAsAddress = ((Hashtable)authreply.Value)["as_address"].ToString(); |
| 439 : | mikkopa | 39 | //string rexSkypeURL = ((Hashtable)authreply.Value)["skype_url"].ToString(); |
| 440 : | afrisby | 25 | UUID userID = new UUID(((Hashtable) authreply.Value)["uuid"].ToString()); |
| 441 : | |||
| 442 : | mikkopa | 14 | // Sanity check |
| 443 : | if (userID == AgentId) | ||
| 444 : | { | ||
| 445 : | RexAvatarURL = rexAsAddress; | ||
| 446 : | mikkopa | 39 | //RexSkypeURL = rexSkypeURL; |
| 447 : | mikkopa | 14 | } |
| 448 : | } | ||
| 449 : | else | ||
| 450 : | afrisby | 4 | { |
| 451 : | mikkopa | 28 | m_log.Warn("[REXCLIENT]: User not found"); |
| 452 : | afrisby | 4 | } |
| 453 : | } | ||
| 454 : | mikkopa | 12 | |
| 455 : | mikkopa | 20 | /// <summary> |
| 456 : | /// Sends Fog parameters to client. Only works underwater. | ||
| 457 : | /// </summary> | ||
| 458 : | /// <param name="start">meters from camera where the fog starts</param> | ||
| 459 : | /// <param name="end">meters from camera where the fog ends</param> | ||
| 460 : | /// <param name="red">redness in fog</param> | ||
| 461 : | /// <param name="green">greeness in fog</param> | ||
| 462 : | /// <param name="blue">blueness in fog</param> | ||
| 463 : | public void SendRexFog(float start, float end, float red, float green, float blue) | ||
| 464 : | mikkopa | 12 | { |
| 465 : | mikkopa | 20 | List<string> pack = new List<string>(); |
| 466 : | |||
| 467 : | pack.Add(start.ToString()); | ||
| 468 : | pack.Add(end.ToString()); | ||
| 469 : | pack.Add(red.ToString()); | ||
| 470 : | pack.Add(green.ToString()); | ||
| 471 : | pack.Add(blue.ToString()); | ||
| 472 : | |||
| 473 : | SendGenericMessage("RexFog", pack); | ||
| 474 : | mikkopa | 12 | } |
| 475 : | |||
| 476 : | mikkopa | 20 | /// <summary> |
| 477 : | /// Sends water height to client. Usually used when changing water height on the fly with scripting. | ||
| 478 : | /// </summary> | ||
| 479 : | /// <param name="height">Water height in meters</param> | ||
| 480 : | public void SendRexWaterHeight(float height) | ||
| 481 : | mikkopa | 12 | { |
| 482 : | mikkopa | 20 | List<string> pack = new List<string>(); |
| 483 : | |||
| 484 : | pack.Add(height.ToString()); | ||
| 485 : | |||
| 486 : | SendGenericMessage("RexWaterHeight", pack); | ||
| 487 : | mikkopa | 12 | } |
| 488 : | |||
| 489 : | mikkopa | 21 | /// <summary> |
| 490 : | /// Sends post postprosessing effect toggle to client. | ||
| 491 : | /// </summary> | ||
| 492 : | /// <see cref="http://rexdeveloper.org/wiki/index.php?title=Content_Scripting_Python_Post-Process"/> | ||
| 493 : | /// <param name="effectId">Id of the effect. See documentation for the effect ids</param> | ||
| 494 : | /// <param name="toggle">True to set effect on. False to set effect off.</param> | ||
| 495 : | public void SendRexPostProcess(int effectId, bool toggle) | ||
| 496 : | mikkopa | 12 | { |
| 497 : | mikkopa | 21 | List<string> pack = new List<string>(); |
| 498 : | |||
| 499 : | pack.Add(effectId.ToString()); | ||
| 500 : | pack.Add(toggle.ToString()); | ||
| 501 : | |||
| 502 : | SendGenericMessage("RexPostP", pack); | ||
| 503 : | mikkopa | 12 | } |
| 504 : | |||
| 505 : | mikkopa | 21 | /// <summary> |
| 506 : | /// Creates client side rtt camera | ||
| 507 : | /// </summary> | ||
| 508 : | /// <param name="command">0 to remove existing rtt camera (by name), 1 to add new rtt camera</param> | ||
| 509 : | /// <param name="name">Unique identifier for the camera</param> | ||
| 510 : | /// <param name="assetId">UUID of the texture that gets rendered to</param> | ||
| 511 : | /// <param name="pos">Position of the camera in the world</param> | ||
| 512 : | /// <param name="lookat">Point in the world the camera will look at</param> | ||
| 513 : | /// <param name="width">Width of the texture</param> | ||
| 514 : | /// <param name="height">Height of the texture</param> | ||
| 515 : | public void SendRexRttCamera(int command, string name, UUID assetId, Vector3 pos, Vector3 lookat, int width, int height) | ||
| 516 : | mikkopa | 12 | { |
| 517 : | mikkopa | 21 | List<string> pack = new List<string>(); |
| 518 : | |||
| 519 : | pack.Add(command.ToString()); | ||
| 520 : | pack.Add(name); | ||
| 521 : | pack.Add(assetId.ToString()); | ||
| 522 : | pack.Add(pos.ToString()); | ||
| 523 : | pack.Add(lookat.ToString()); | ||
| 524 : | pack.Add(width.ToString()); | ||
| 525 : | pack.Add(height.ToString()); | ||
| 526 : | |||
| 527 : | SendGenericMessage("RexRttCam", pack); | ||
| 528 : | mikkopa | 12 | } |
| 529 : | |||
| 530 : | mikkopa | 21 | /// <summary> |
| 531 : | /// Sends a viewport to client | ||
| 532 : | /// </summary> | ||
| 533 : | /// <param name="command">0 to remove existing viewport (by name), 1 to add new viewport.</param> | ||
| 534 : | /// <param name="name">Unique identifier for the viewport</param> | ||
| 535 : | /// <param name="posX">screen relative position of the left edge of the viewport</param> | ||
| 536 : | /// <param name="posY">screen relative position of the top edge of the viewport</param> | ||
| 537 : | /// <param name="width">screen relative width of the viewport</param> | ||
| 538 : | /// <param name="height">screen relative height of the viewport</param> | ||
| 539 : | public void SendRexViewport(int command, string name, float posX, float posY, float width, float height) | ||
| 540 : | mikkopa | 12 | { |
| 541 : | mikkopa | 21 | List<string> pack = new List<string>(); |
| 542 : | |||
| 543 : | pack.Add(command.ToString()); | ||
| 544 : | pack.Add(name); | ||
| 545 : | pack.Add(posX.ToString()); | ||
| 546 : | pack.Add(posY.ToString()); | ||
| 547 : | pack.Add(width.ToString()); | ||
| 548 : | pack.Add(height.ToString()); | ||
| 549 : | |||
| 550 : | SendGenericMessage("RexSetViewport", pack); | ||
| 551 : | mikkopa | 12 | } |
| 552 : | |||
| 553 : | mikkopa | 21 | /// <summary> |
| 554 : | /// Toggles the wind sound on client | ||
| 555 : | /// </summary> | ||
| 556 : | /// <param name="toggle"></param> | ||
| 557 : | public void SendRexToggleWindSound(bool toggle) | ||
| 558 : | mikkopa | 12 | { |
| 559 : | mikkopa | 21 | List<string> pack = new List<string>(); |
| 560 : | |||
| 561 : | pack.Add(toggle.ToString()); | ||
| 562 : | |||
| 563 : | SendGenericMessage("RexToggleWindSound", pack); | ||
| 564 : | mikkopa | 12 | } |
| 565 : | |||
| 566 : | mikkopa | 21 | /// <summary> |
| 567 : | /// Sends Rex clientside camera effects, particle script attached to camera etc. | ||
| 568 : | /// </summary> | ||
| 569 : | /// <param name="enable">True to enable the effect, False to disable</param> | ||
| 570 : | /// <param name="assetId">Id of the effect</param> | ||
| 571 : | /// <param name="pos">Offset position from the camera</param> | ||
| 572 : | /// <param name="rot">Offset rotation from the camera</param> | ||
| 573 : | public void SendRexCameraClientSideEffect(bool enable, UUID assetId, Vector3 pos, Quaternion rot) | ||
| 574 : | mikkopa | 12 | { |
| 575 : | mikkopa | 21 | List<string> pack = new List<string>(); |
| 576 : | |||
| 577 : | pack.Add(assetId.ToString()); | ||
| 578 : | pack.Add(pos.ToString()); | ||
| 579 : | pack.Add(rot.ToString()); | ||
| 580 : | pack.Add(enable.ToString()); | ||
| 581 : | |||
| 582 : | SendGenericMessage("RexSCSEffect", pack); | ||
| 583 : | mikkopa | 12 | } |
| 584 : | |||
| 585 : | mikkopa | 21 | /// <summary> |
| 586 : | /// Overrides default lighting conditions and ambient light in the world. | ||
| 587 : | /// | ||
| 588 : | /// Note that this override is a hard one. The user will be unable to change the lighting | ||
| 589 : | /// conditions in any way after they are overridden. | ||
| 590 : | /// </summary> | ||
| 591 : | /// <param name="direction">Direction of the global light (sun)</param> | ||
| 592 : | /// <param name="colour">Colour of the global light</param> | ||
| 593 : | /// <param name="ambientColour">Colour of the ambient light (the light that is always present)</param> | ||
| 594 : | public void SendRexSetAmbientLight(Vector3 direction, Vector3 colour, Vector3 ambientColour) | ||
| 595 : | mikkopa | 12 | { |
| 596 : | mikkopa | 21 | List<string> pack = new List<string>(); |
| 597 : | |||
| 598 : | pack.Add(direction.ToString()); | ||
| 599 : | pack.Add(colour.ToString()); | ||
| 600 : | pack.Add(ambientColour.ToString()); | ||
| 601 : | |||
| 602 : | SendGenericMessage("RexAmbientL", pack); | ||
| 603 : | mikkopa | 12 | } |
| 604 : | |||
| 605 : | mikkopa | 21 | /// <summary> |
| 606 : | /// Lauch flash animation to play on client | ||
| 607 : | /// </summary> | ||
| 608 : | /// <param name="assetId">Id of the flash animation (swf) to play</param> | ||
| 609 : | /// <param name="left">left border of the rectangle</param> | ||
| 610 : | /// <param name="top">top border of the rectangle</param> | ||
| 611 : | /// <param name="right">right border of the rectangle</param> | ||
| 612 : | /// <param name="bottom">bottom border of the rectangle</param> | ||
| 613 : | /// <param name="timeToDeath">time in seconds from start of animation playback until the flash control is destroyed</param> | ||
| 614 : | public void SendRexPlayFlashAnimation(UUID assetId, float left, float top, float right, float bottom, float timeToDeath) | ||
| 615 : | mikkopa | 12 | { |
| 616 : | mikkopa | 21 | List<string> pack = new List<string>(); |
| 617 : | |||
| 618 : | pack.Add(assetId.ToString()); | ||
| 619 : | pack.Add(left.ToString()); | ||
| 620 : | pack.Add(top.ToString()); | ||
| 621 : | pack.Add(right.ToString()); | ||
| 622 : | pack.Add(bottom.ToString()); | ||
| 623 : | pack.Add(timeToDeath.ToString()); | ||
| 624 : | |||
| 625 : | SendGenericMessage("RexFlashAnim", pack); | ||
| 626 : | mikkopa | 12 | } |
| 627 : | |||
| 628 : | internal void SendRexPreloadAvatarAssets(List<string> vAssetsList) | ||
| 629 : | { | ||
| 630 : | throw new System.NotImplementedException(); | ||
| 631 : | } | ||
| 632 : | |||
| 633 : | mikkopa | 45 | /// <summary> |
| 634 : | /// Force Field Of View | ||
| 635 : | /// </summary> | ||
| 636 : | /// <param name="fov">Field of View in degrees. This parameter is irrelevant when disabling FOV</param> | ||
| 637 : | /// <param name="enable">True to enable, False to disable</param> | ||
| 638 : | public void SendRexForceFOV(float fov, bool enable) | ||
| 639 : | mikkopa | 12 | { |
| 640 : | mikkopa | 45 | List<string> pack = new List<string>(); |
| 641 : | |||
| 642 : | pack.Add(fov.ToString()); | ||
| 643 : | pack.Add(enable.ToString()); | ||
| 644 : | |||
| 645 : | SendGenericMessage("RexForceFOV", pack); | ||
| 646 : | mikkopa | 12 | } |
| 647 : | |||
| 648 : | mikkopa | 45 | /// <summary> |
| 649 : | /// Sends Forced Camera mode to client | ||
| 650 : | /// </summary> | ||
| 651 : | /// <param name="forceMode">1 = 1st person mode, 3 = 3rd person mode, 0 = no limits</param> | ||
| 652 : | /// <param name="minZoom">Minimum zoom (0.0-1.0)</param> | ||
| 653 : | /// <param name="maxZoom">Maximum zoom (0.0-1.0)</param> | ||
| 654 : | public void SendRexForceCamera(int forceMode, float minZoom, float maxZoom) | ||
| 655 : | mikkopa | 12 | { |
| 656 : | mikkopa | 45 | List<string> pack = new List<string>(); |
| 657 : | |||
| 658 : | pack.Add(forceMode.ToString()); | ||
| 659 : | pack.Add(minZoom.ToString()); | ||
| 660 : | pack.Add(maxZoom.ToString()); | ||
| 661 : | |||
| 662 : | SendGenericMessage("RexForceCamera", pack); | ||
| 663 : | mikkopa | 12 | } |
| 664 : | |||
| 665 : | mikkopa | 45 | /// <summary> |
| 666 : | /// Sends the sky to user | ||
| 667 : | /// </summary> | ||
| 668 : | /// <param name="type">Type of the sky: 0 = none, 1 = skybox, 2 = skydome</param> | ||
| 669 : | /// <param name="images">List of image uuids - separated by space - to use for the sky. | ||
| 670 : | /// Skyboxes need 6 images, skydomes take one image. | ||
| 671 : | /// You can add suffix to the uuids to specify which side the texture should go to: | ||
| 672 : | /// _fr front, _lf left, _rt right, _bk back, _up up, _dn down </param> | ||
| 673 : | /// <param name="curvature">Curvature of the skydome. Values around 10.0 are good for | ||
| 674 : | /// open spaces and landscapes. Not used with skyboxes</param> | ||
| 675 : | /// <param name="tiling">Skydome tiling. Not used with skyboxes.</param> | ||
| 676 : | public void SendRexSky(int type, string images, float curvature, float tiling) | ||
| 677 : | mikkopa | 12 | { |
| 678 : | mikkopa | 45 | List<string> pack = new List<string>(); |
| 679 : | |||
| 680 : | pack.Add(type.ToString()); | ||
| 681 : | pack.Add(images); | ||
| 682 : | pack.Add(curvature.ToString()); | ||
| 683 : | pack.Add(tiling.ToString()); | ||
| 684 : | |||
| 685 : | SendGenericMessage("RexSky", pack); | ||
| 686 : | mikkopa | 12 | } |
| 687 : | |||
| 688 : | internal void SendRexPreloadAssets(Dictionary<UUID, uint> tempassetlist) | ||
| 689 : | { | ||
| 690 : | throw new System.NotImplementedException(); | ||
| 691 : | } | ||
| 692 : | |||
| 693 : | mikkopa | 45 | /// <summary> |
| 694 : | /// Sends MediaURL to client | ||
| 695 : | /// </summary> | ||
| 696 : | /// <param name="assetId">UUID of the asset which to replace with MediaURL content</param> | ||
| 697 : | /// <param name="mediaURL">URL pointing to web-page or vnc server</param> | ||
| 698 : | /// <param name="refreshRate">How many times per second to refresh the texture</param> | ||
| 699 : | public void SendMediaURL(UUID assetId, string mediaURL, byte refreshRate) | ||
| 700 : | mikkopa | 12 | { |
| 701 : | mikkopa | 45 | List<string> pack = new List<string>(); |
| 702 : | |||
| 703 : | pack.Add(assetId.ToString()); | ||
| 704 : | pack.Add(mediaURL); | ||
| 705 : | pack.Add(refreshRate.ToString()); | ||
| 706 : | |||
| 707 : | SendGenericMessage("RexMediaUrl", pack); | ||
| 708 : | mikkopa | 12 | } |
| 709 : | |||
| 710 : | mikkopa | 45 | public void RexIKSendLimbTarget(UUID agentID, int limbId, Vector3 destination, float timeToTarget, |
| 711 : | float stayTime, float constraintAngle, string startAnim, string targetAnim, string endAnim) | ||
| 712 : | mikkopa | 12 | { |
| 713 : | mikkopa | 45 | List<string> pack = new List<string>(); |
| 714 : | |||
| 715 : | pack.Add("0"); | ||
| 716 : | pack.Add(agentID.ToString()); | ||
| 717 : | pack.Add(limbId.ToString()); | ||
| 718 : | string sDest = destination.X.ToString() + " " + destination.Y.ToString() + " " + destination.Z.ToString(); | ||
| 719 : | sDest = sDest.Replace(",", "."); | ||
| 720 : | pack.Add(sDest); | ||
| 721 : | pack.Add(timeToTarget.ToString()); | ||
| 722 : | pack.Add(stayTime.ToString()); | ||
| 723 : | pack.Add(constraintAngle.ToString()); | ||
| 724 : | pack.Add(startAnim); | ||
| 725 : | pack.Add(targetAnim); | ||
| 726 : | pack.Add(endAnim); | ||
| 727 : | |||
| 728 : | SendGenericMessage("RexIK", pack); | ||
| 729 : | mikkopa | 12 | } |
| 730 : | |||
| 731 : | mikkopa | 45 | public void SendRexAvatarAnimation(UUID agentID, string animName, float rate, float fadeIn, |
| 732 : | float fadeOut, int repeats, bool stopAnim) | ||
| 733 : | mikkopa | 12 | { |
| 734 : | mikkopa | 45 | List<string> pack = new List<string>(); |
| 735 : | |||
| 736 : | pack.Add(agentID.ToString()); | ||
| 737 : | pack.Add(animName); | ||
| 738 : | pack.Add(rate.ToString()); | ||
| 739 : | pack.Add(fadeIn.ToString().Replace(",",".")); | ||
| 740 : | pack.Add(fadeOut.ToString().Replace(",", ".")); | ||
| 741 : | pack.Add(repeats.ToString()); | ||
| 742 : | pack.Add(stopAnim.ToString()); | ||
| 743 : | |||
| 744 : | SendGenericMessage("RexAnim", pack); | ||
| 745 : | mikkopa | 12 | } |
| 746 : | |||
| 747 : | mikkopa | 45 | public void SendRexAvatarMorph(UUID agentID, string morphName, float weight, float time) |
| 748 : | mikkopa | 12 | { |
| 749 : | mikkopa | 45 | List<string> pack = new List<string>(); |
| 750 : | |||
| 751 : | pack.Add(agentID.ToString()); | ||
| 752 : | pack.Add(morphName); | ||
| 753 : | pack.Add(weight.ToString()); | ||
| 754 : | pack.Add(time.ToString()); | ||
| 755 : | |||
| 756 : | SendGenericMessage("RexMorph", pack); | ||
| 757 : | mikkopa | 12 | } |
| 758 : | |||
| 759 : | internal void SendRexMeshAnimation(UUID uUID, string vAnimName, float vRate, bool vbLooped, bool vbStopAnim) | ||
| 760 : | { | ||
| 761 : | throw new System.NotImplementedException(); | ||
| 762 : | } | ||
| 763 : | |||
| 764 : | internal void SendRexClientSideEffect(string assetId, float vTimeUntilLaunch, float vTimeUntilDeath, Vector3 pos, Quaternion rot, float vSpeed) | ||
| 765 : | { | ||
| 766 : | throw new System.NotImplementedException(); | ||
| 767 : | } | ||
| 768 : | afrisby | 2 | } |
| 769 : | afrisby | 25 | } |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

