Adds UserFlags and GodLevel to the user data store and plumbs then in.

This will have no effect unless both the UGAI and the region are
this revision or later
0.6.0-stable
Melanie Thielker 2008-08-14 19:59:32 +00:00
parent c2f1771c63
commit 7161689a97
8 changed files with 82 additions and 5 deletions

View File

@ -587,6 +587,9 @@ namespace OpenSim.Data.MySQL
LLUUID.TryParse((string)reader["webLoginKey"], out tmp);
retval.WebLoginKey = tmp;
}
retval.UserFlags = Convert.ToInt32(reader["userFlags"].ToString());
retval.GodLevel = Convert.ToInt32(reader["godLevel"].ToString());
}
else
@ -728,14 +731,14 @@ namespace OpenSim.Data.MySQL
"`homeLocationX`, `homeLocationY`, `homeLocationZ`, `homeLookAtX`, `homeLookAtY`, `homeLookAtZ`, `created`, ";
sql +=
"`lastLogin`, `userInventoryURI`, `userAssetURI`, `profileCanDoMask`, `profileWantDoMask`, `profileAboutText`, ";
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`) VALUES ";
sql += "`profileFirstText`, `profileImage`, `profileFirstImage`, `webLoginKey`, `userFlags`, `godLevel`) VALUES ";
sql += "(?UUID, ?username, ?lastname, ?passwordHash, ?passwordSalt, ?homeRegion, ";
sql +=
"?homeLocationX, ?homeLocationY, ?homeLocationZ, ?homeLookAtX, ?homeLookAtY, ?homeLookAtZ, ?created, ";
sql +=
"?lastLogin, ?userInventoryURI, ?userAssetURI, ?profileCanDoMask, ?profileWantDoMask, ?profileAboutText, ";
sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey)";
sql += "?profileFirstText, ?profileImage, ?profileFirstImage, ?webLoginKey, ?userFlags, ?godLevel)";
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["?UUID"] = uuid.ToString();
@ -761,6 +764,9 @@ namespace OpenSim.Data.MySQL
parameters["?profileImage"] = profileImage.ToString();
parameters["?profileFirstImage"] = firstImage.ToString();
parameters["?webLoginKey"] = string.Empty;
parameters["?userFlags"] = "0";
parameters["?godLevel"] = "0";
bool returnval = false;
@ -815,7 +821,7 @@ namespace OpenSim.Data.MySQL
float homeLookAtX, float homeLookAtY, float homeLookAtZ, int created, int lastlogin,
string inventoryURI, string assetURI, uint canDoMask, uint wantDoMask,
string aboutText, string firstText,
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey)
LLUUID profileImage, LLUUID firstImage, LLUUID webLoginKey, int userFlags, int godLevel)
{
string sql = "UPDATE users SET `username` = ?username , `lastname` = ?lastname ";
sql += ", `passwordHash` = ?passwordHash , `passwordSalt` = ?passwordSalt , ";
@ -827,6 +833,7 @@ namespace OpenSim.Data.MySQL
sql += "`profileCanDoMask` = ?profileCanDoMask , `profileWantDoMask` = ?profileWantDoMask , ";
sql += "`profileAboutText` = ?profileAboutText , `profileFirstText` = ?profileFirstText, ";
sql += "`profileImage` = ?profileImage , `profileFirstImage` = ?profileFirstImage , ";
sql += "`userFlags` = ?userFlags , `godLevel` = ?godLevel , ";
sql += "`webLoginKey` = ?webLoginKey WHERE UUID = ?UUID";
Dictionary<string, string> parameters = new Dictionary<string, string>();
@ -854,6 +861,8 @@ namespace OpenSim.Data.MySQL
parameters["?profileImage"] = profileImage.ToString();
parameters["?profileFirstImage"] = firstImage.ToString();
parameters["?webLoginKey"] = webLoginKey.ToString();
parameters["?userFlags"] = userFlags.ToString();
parameters["?godLevel"] = userFlags.ToString();
bool returnval = false;
try

View File

@ -685,7 +685,7 @@ namespace OpenSim.Data.MySQL
user.HomeRegion, user.HomeRegionID, user.HomeLocation.X, user.HomeLocation.Y, user.HomeLocation.Z, user.HomeLookAt.X,
user.HomeLookAt.Y, user.HomeLookAt.Z, user.Created, user.LastLogin, user.UserInventoryURI,
user.UserAssetURI, user.CanDoMask, user.WantDoMask, user.AboutText,
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey);
user.FirstLifeAboutText, user.Image, user.FirstLifeImage, user.WebLoginKey, user.UserFlags, user.GodLevel);
}
return true;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE users add userFlags integer NOT NULL default 0;
ALTER TABLE users add godLevel integer NOT NULL default 0;
COMMIT;

View File

@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE users add userFlags integer NOT NULL default 0;
ALTER TABLE users add godLevel integer NOT NULL default 0;
COMMIT;

View File

@ -681,6 +681,8 @@ namespace OpenSim.Data.SQLite
SQLiteUtil.createCol(users, "profileImage", typeof (String));
SQLiteUtil.createCol(users, "profileFirstImage", typeof (String));
SQLiteUtil.createCol(users, "webLoginKey", typeof(String));
SQLiteUtil.createCol(users, "userFlags", typeof (Int32));
SQLiteUtil.createCol(users, "godLevel", typeof (Int32));
// Add in contraints
users.PrimaryKey = new DataColumn[] {users.Columns["UUID"]};
return users;
@ -789,6 +791,8 @@ namespace OpenSim.Data.SQLite
LLUUID.TryParse((String)row["profileFirstImage"], out tmp);
user.FirstLifeImage = tmp;
user.WebLoginKey = new LLUUID((String) row["webLoginKey"]);
user.UserFlags = Convert.ToInt32(row["userFlags"]);
user.GodLevel = Convert.ToInt32(row["godLevel"]);
return user;
}
@ -829,6 +833,8 @@ namespace OpenSim.Data.SQLite
row["profileImage"] = user.Image;
row["profileFirstImage"] = user.FirstLifeImage;
row["webLoginKey"] = user.WebLoginKey;
row["userFlags"] = user.UserFlags;
row["godLevel"] = user.GodLevel;
// ADO.NET doesn't handle NULL very well
foreach (DataColumn col in ds.Tables["users"].Columns)

View File

@ -136,6 +136,12 @@ namespace OpenSim.Framework
/// </summary>
private LLUUID _webLoginKey;
// Data for estates and other goodies
// to get away from per-machine configs a little
//
private int _userFlags;
private int _godLevel;
/// <summary>
/// The regionhandle of the users preffered home region. If multiple sims occupy the same spot, the grid may decide which region the user logs into
/// </summary>
@ -330,5 +336,17 @@ namespace OpenSim.Framework
get { return _currentAgent; }
set { _currentAgent = value; }
}
public virtual int UserFlags
{
get { return _userFlags; }
set { _userFlags = value; }
}
public virtual int GodLevel
{
get { return _godLevel; }
set { _godLevel = value; }
}
}
}
}

View File

@ -156,6 +156,9 @@ namespace OpenSim.Grid.UserServer
responseData["home_look_x"] = profile.HomeLookAt.X.ToString();
responseData["home_look_y"] = profile.HomeLookAt.Y.ToString();
responseData["home_look_z"] = profile.HomeLookAt.Z.ToString();
responseData["user_flags"] = profile.UserFlags.ToString();
responseData["god_level"] = profile.GodLevel.ToString();
response.Value = responseData;
return response;
@ -638,6 +641,28 @@ namespace OpenSim.Grid.UserServer
m_log.Error("[PROFILE]:Failed to set home lookat z");
}
}
if (requestData.Contains("user_flags"))
{
try
{
userProfile.UserFlags = Convert.ToInt32((string)requestData["user_flags"]);
}
catch (InvalidCastException)
{
m_log.Error("[PROFILE]:Failed to set user flags");
}
}
if (requestData.Contains("god_level"))
{
try
{
userProfile.GodLevel = Convert.ToInt32((string)requestData["god_level"]);
}
catch (InvalidCastException)
{
m_log.Error("[PROFILE]:Failed to set god level");
}
}
// call plugin!
bool ret = UpdateUserProfileProperties(userProfile);
responseData["returnString"] = ret.ToString();

View File

@ -85,6 +85,11 @@ namespace OpenSim.Region.Communications.OGS1
new LLVector3((float) Convert.ToDecimal((string) data["home_look_x"]),
(float) Convert.ToDecimal((string) data["home_look_y"]),
(float) Convert.ToDecimal((string) data["home_look_z"]));
if(data.Contains("user_flags"))
userData.UserFlags = Convert.ToInt32((string) data["user_flags"]);
if(data.Contains("god_level"))
userData.GodLevel = Convert.ToInt32((string) data["god_level"]);
return userData;
}
@ -462,6 +467,8 @@ namespace OpenSim.Region.Communications.OGS1
param["home_look_x"] = UserProfile.HomeLookAtX.ToString();
param["home_look_y"] = UserProfile.HomeLookAtY.ToString();
param["home_look_z"] = UserProfile.HomeLookAtZ.ToString();
param["user_flags"] = UserProfile.UserFlags.ToString();
param["god_level"] = UserProfile.GodLevel.ToString();
IList parameters = new ArrayList();
parameters.Add(param);