/// <summary> /// Appearance /// TODO: stubs for now to get us to a compiling state gently /// override /// </summary> public override AvatarAppearance GetUserAppearance(UUID user) { MySQLSuperManager dbm = GetLockedConnection("GetUserAppearance"); try { Dictionary <string, object> param = new Dictionary <string, object>(); param["?owner"] = user.ToString(); IDbCommand result = dbm.Manager.Query("SELECT * FROM " + m_appearanceTableName + " WHERE owner = ?owner", param); IDataReader reader = result.ExecuteReader(); AvatarAppearance appearance = dbm.Manager.readAppearanceRow(reader); reader.Dispose(); result.Dispose(); if (null == appearance) { m_log.WarnFormat("[USER DB] No appearance found for user {0}", user.ToString()); return(null); } appearance.SetAttachments(GetUserAttachments(user)); return(appearance); } catch (Exception e) { dbm.Manager.Reconnect(); m_log.Error(e.ToString()); return(null); } finally { dbm.Release(); } }
public AvatarAppearance ToAvatarAppearance(UUID owner) { AvatarAppearance appearance = new AvatarAppearance(owner); try { appearance.Serial = Int32.Parse(Data["Serial"]); // Wearables appearance.BodyItem = UUID.Parse(Data["BodyItem"]); appearance.EyesItem = UUID.Parse(Data["EyesItem"]); appearance.GlovesItem = UUID.Parse(Data["GlovesItem"]); appearance.HairItem = UUID.Parse(Data["HairItem"]); appearance.JacketItem = UUID.Parse(Data["JacketItem"]); appearance.PantsItem = UUID.Parse(Data["PantsItem"]); appearance.ShirtItem = UUID.Parse(Data["ShirtItem"]); appearance.ShoesItem = UUID.Parse(Data["ShoesItem"]); appearance.SkinItem = UUID.Parse(Data["SkinItem"]); appearance.SkirtItem = UUID.Parse(Data["SkirtItem"]); appearance.SocksItem = UUID.Parse(Data["SocksItem"]); appearance.UnderPantsItem = UUID.Parse(Data["UnderPantsItem"]); appearance.UnderShirtItem = UUID.Parse(Data["UnderShirtItem"]); appearance.BodyAsset = UUID.Parse(Data["BodyAsset"]); appearance.EyesAsset = UUID.Parse(Data["EyesAsset"]); appearance.GlovesAsset = UUID.Parse(Data["GlovesAsset"]); appearance.HairAsset = UUID.Parse(Data["HairAsset"]); appearance.JacketAsset = UUID.Parse(Data["JacketAsset"]); appearance.PantsAsset = UUID.Parse(Data["PantsAsset"]); appearance.ShirtAsset = UUID.Parse(Data["ShirtAsset"]); appearance.ShoesAsset = UUID.Parse(Data["ShoesAsset"]); appearance.SkinAsset = UUID.Parse(Data["SkinAsset"]); appearance.SkirtAsset = UUID.Parse(Data["SkirtAsset"]); appearance.SocksAsset = UUID.Parse(Data["SocksAsset"]); appearance.UnderPantsAsset = UUID.Parse(Data["UnderPantsAsset"]); appearance.UnderShirtAsset = UUID.Parse(Data["UnderShirtAsset"]); // Attachments Dictionary <string, string> attchs = new Dictionary <string, string>(); foreach (KeyValuePair <string, string> _kvp in Data) { if (_kvp.Key.StartsWith("_ap_")) { attchs[_kvp.Key] = _kvp.Value; } } Hashtable aaAttachs = new Hashtable(); foreach (KeyValuePair <string, string> _kvp in attchs) { string pointStr = _kvp.Key.Substring(4); int point = 0; if (!Int32.TryParse(pointStr, out point)) { continue; } Hashtable tmp = new Hashtable(); UUID uuid = UUID.Zero; UUID.TryParse(_kvp.Value, out uuid); tmp["item"] = uuid; tmp["asset"] = UUID.Zero.ToString(); aaAttachs[point] = tmp; } appearance.SetAttachments(aaAttachs); } catch { } return(appearance); }