本文整理汇总了C#中IClientAPI.GetGroupPowers方法的典型用法代码示例。如果您正苦于以下问题:C# IClientAPI.GetGroupPowers方法的具体用法?C# IClientAPI.GetGroupPowers怎么用?C# IClientAPI.GetGroupPowers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IClientAPI
的用法示例。
在下文中一共展示了IClientAPI.GetGroupPowers方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanUseObjectReturn
private bool CanUseObjectReturn(ILandObject parcel, uint type, IClientAPI client, List<SceneObjectGroup> retlist, Scene scene)
{
DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name);
if (m_bypassPermissions) return m_bypassPermissionsValue;
ulong powers = 0;
if (parcel.landData.GroupID != UUID.Zero)
powers = client.GetGroupPowers(parcel.landData.GroupID);
switch (type)
{
case (uint)ObjectReturnType.Owner:
// Don't let group members return owner's objects, ever
//
if (parcel.landData.IsGroupOwned)
{
if ((powers & (ulong)GroupPowers.ReturnGroupOwned) != 0)
return true;
}
else
{
if (parcel.landData.OwnerID != client.AgentId)
return false;
}
return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnGroupOwned);
case (uint)ObjectReturnType.Group:
if (parcel.landData.OwnerID != client.AgentId)
{
// If permissionis granted through a group...
//
if ((powers & (long)GroupPowers.ReturnGroupSet) != 0)
{
foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist))
{
// check for and remove group owned objects unless
// the user also has permissions to return those
//
if (g.OwnerID == g.GroupID &&
((powers & (long)GroupPowers.ReturnGroupOwned) == 0))
{
retlist.Remove(g);
}
}
// And allow the operation
//
return true;
}
}
return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnNonGroup);
case (uint)ObjectReturnType.Other:
if ((powers & (long)GroupPowers.ReturnNonGroup) != 0)
return true;
return GenericParcelOwnerPermission(client.AgentId, parcel, (ulong)GroupPowers.ReturnNonGroup);
case (uint)ObjectReturnType.List:
foreach (SceneObjectGroup g in new List<SceneObjectGroup>(retlist))
{
if (!CanReturnObject(g.UUID, client.AgentId, scene))
{
retlist.Remove(g);
}
}
// And allow the operation
//
return true;
}
return GenericParcelPermission(client.AgentId, parcel, 0);
}
示例2: RezScript
/// <summary>
/// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"> </param>
/// <param name="localID"></param>
public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID)
{
UUID itemID = itemBase.ID;
UUID copyID = UUID.Random();
if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
{
CachedUserInfo userInfo = CommsManager.UserService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null)
{
InventoryItemBase item = userInfo.FindItem(itemID);
// Try library
bool fromLibrary = false;
if (null == item)
{
item = CommsManager.LibraryRoot.FindItem(itemID);
fromLibrary = true;
}
if (item != null)
{
SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{
if (!Permissions.CanEditObjectInventory(part.ParentGroup.UUID, remoteClient.AgentId))
return;
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
part.Inventory.CreateScriptInstance(copyID, 0, ScriptStartFlags.None, DefaultScriptEngine, 0, null);
part.GetProperties(remoteClient);
//if the script is no copy, remove it from the avatar inventory
if (!fromLibrary && ((item.CurrentPermissions & (int)PermissionMask.Copy) == 0))
{
userInfo.DeleteItem(item);
}
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Could not rez script {0} into prim local ID {1} for user {2}"
+ " because the prim could not be found in the region!",
item.Name, localID, remoteClient.Name);
}
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
itemID, remoteClient.Name);
}
}
}
else // script has been rezzed directly into a prim's inventory
{
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
if (part == null)
return;
if (part.OwnerID != remoteClient.AgentId)
{
// Group permissions
if ( (part.GroupID == UUID.Zero) || (remoteClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0) )
return;
} else {
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
}
if (!Permissions.CanCreateObjectInventory(
itemBase.InvType, part.ParentGroup.UUID, remoteClient.AgentId))
return;
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.UTF8.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"));
try
{
CommsManager.AssetCache.AddAsset(asset, AssetRequestInfo.GenericNetRequest());
}
catch (AssetServerException e)
{
m_log.ErrorFormat("[TASK INVENTORY] Unable to rez new script. Asset write failed: {0}", e);
if (remoteClient != null) remoteClient.SendAgentAlertMessage("Unable to create asset. Please try again later.", false);
return;
}
TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ResetIDs(itemBase.Folder);
//.........这里部分代码省略.........
示例3: ClientOnSetHome
/// <summary>
/// Sets the Home Point. The LoginService uses this to know where to put a user when they log-in
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="regionHandle"></param>
/// <param name="position"></param>
/// <param name="lookAt"></param>
/// <param name="flags"></param>
public virtual void ClientOnSetHome(IClientAPI remoteClient, ulong regionHandle, Vector3 position, Vector3 lookAt, uint flags)
{
// Let's find the parcel in question
ILandObject land = landChannel.GetLandObject(position);
if (land == null || m_scene.GridUserService == null)
{
m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
return;
}
// Gather some data
ulong gpowers = remoteClient.GetGroupPowers(land.LandData.GroupID);
SceneObjectGroup telehub = null;
if (m_scene.RegionInfo.RegionSettings.TelehubObject != UUID.Zero)
// Does the telehub exist in the scene?
telehub = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
// Can the user set home here?
if (// (a) gods and land managers can set home
m_scene.Permissions.IsAdministrator(remoteClient.AgentId) ||
m_scene.Permissions.IsGod(remoteClient.AgentId) ||
// (b) land owners can set home
remoteClient.AgentId == land.LandData.OwnerID ||
// (c) members of the land-associated group in roles that can set home
((gpowers & (ulong)GroupPowers.AllowSetHome) == (ulong)GroupPowers.AllowSetHome) ||
// (d) parcels with telehubs can be the home of anyone
(telehub != null && land.ContainsPoint((int)telehub.AbsolutePosition.X, (int)telehub.AbsolutePosition.Y)))
{
if (m_scene.GridUserService.SetHome(remoteClient.AgentId.ToString(), land.RegionUUID, position, lookAt))
// FUBAR ALERT: this needs to be "Home position set." so the viewer saves a home-screenshot.
m_Dialog.SendAlertToUser(remoteClient, "Home position set.");
else
m_Dialog.SendAlertToUser(remoteClient, "Set Home request failed.");
}
else
m_Dialog.SendAlertToUser(remoteClient, "You are not allowed to set your home location in this parcel.");
}
示例4: RezScript
/// <summary>
/// Rez a script into a prim's inventory, either ex nihilo or from an existing avatar inventory
/// </summary>
/// <param name="remoteClient"></param>
/// <param name="itemID"> </param>
/// <param name="localID"></param>
public void RezScript(IClientAPI remoteClient, InventoryItemBase itemBase, UUID transactionID, uint localID)
{
UUID itemID = itemBase.ID;
UUID copyID = UUID.Random();
if (itemID != UUID.Zero) // transferred from an avatar inventory to the prim's inventory
{
CachedUserInfo userInfo = CommsManager.UserProfileCacheService.GetUserDetails(remoteClient.AgentId);
if (userInfo != null && userInfo.RootFolder != null)
{
InventoryItemBase item = userInfo.RootFolder.FindItem(itemID);
// Try library
// XXX clumsy, possibly should be one call
if (null == item)
{
item = CommsManager.UserProfileCacheService.LibraryRoot.FindItem(itemID);
}
if (item != null)
{
SceneObjectPart part = GetSceneObjectPart(localID);
if (part != null)
{
if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId))
return;
part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID);
// TODO: switch to posting on_rez here when scripts
// have state in inventory
part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0);
// m_log.InfoFormat("[PRIMINVENTORY]: " +
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
part.GetProperties(remoteClient);
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: " +
"Could not rez script {0} into prim local ID {1} for user {2}"
+ " because the prim could not be found in the region!",
item.Name, localID, remoteClient.Name);
}
}
else
{
m_log.ErrorFormat(
"[PRIM INVENTORY]: Could not find script inventory item {0} to rez for {1}!",
itemID, remoteClient.Name);
}
}
}
else // script has been rezzed directly into a prim's inventory
{
SceneObjectPart part = GetSceneObjectPart(itemBase.Folder);
if (part == null)
return;
if (part.OwnerID != remoteClient.AgentId)
{
// Group permissions
if ((part.GroupID == UUID.Zero) || (remoteClient.GetGroupPowers(part.GroupID) == 0) || ((part.GroupMask & (uint)PermissionMask.Modify) == 0))
return;
} else {
if ((part.OwnerMask & (uint)PermissionMask.Modify) == 0)
return;
}
if (!Permissions.CanCreateObjectInventory(
itemBase.InvType, part.UUID, remoteClient.AgentId))
return;
AssetBase asset = CreateAsset(itemBase.Name, itemBase.Description, (sbyte)itemBase.AssetType, Encoding.ASCII.GetBytes("default\n{\n state_entry()\n {\n llSay(0, \"Script running\");\n }\n}"));
AssetService.Store(asset);
TaskInventoryItem taskItem = new TaskInventoryItem();
taskItem.ResetIDs(itemBase.Folder);
taskItem.ParentID = itemBase.Folder;
taskItem.CreationDate = (uint)itemBase.CreationDate;
taskItem.Name = itemBase.Name;
taskItem.Description = itemBase.Description;
taskItem.Type = itemBase.AssetType;
taskItem.InvType = itemBase.InvType;
taskItem.OwnerID = itemBase.Owner;
taskItem.CreatorID = itemBase.CreatorIdAsUuid;
taskItem.BasePermissions = itemBase.BasePermissions;
taskItem.CurrentPermissions = itemBase.CurrentPermissions;
taskItem.EveryonePermissions = itemBase.EveryOnePermissions;
taskItem.GroupPermissions = itemBase.GroupPermissions;
taskItem.NextPermissions = itemBase.NextPermissions;
//.........这里部分代码省略.........