本文整理汇总了C#中IClientAPI类的典型用法代码示例。如果您正苦于以下问题:C# IClientAPI类的具体用法?C# IClientAPI怎么用?C# IClientAPI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IClientAPI类属于命名空间,在下文中一共展示了IClientAPI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RequestGodlikePowers
public void RequestGodlikePowers(
UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
{
ScenePresence sp = m_scene.GetScenePresence(agentID);
if (sp != null)
{
if (godLike == false)
{
sp.GrantGodlikePowers(agentID, sessionID, token, godLike);
return;
}
// First check that this is the sim owner
if (m_scene.Permissions.IsGod(agentID))
{
// Next we check for spoofing.....
UUID testSessionID = sp.ControllingClient.SessionId;
if (sessionID == testSessionID)
{
if (sessionID == controllingClient.SessionId)
{
//m_log.Info("godlike: " + godLike.ToString());
sp.GrantGodlikePowers(agentID, testSessionID, token, godLike);
}
}
}
else
{
if (m_dialogModule != null)
m_dialogModule.SendAlertToUser(agentID, "Request for god powers denied");
}
}
}
示例2: client_OnGroupAccountDetailsRequest
/// <summary>
/// Sends the details about what
/// </summary>
/// <param name="client"></param>
/// <param name="agentID"></param>
/// <param name="groupID"></param>
/// <param name="transactionID"></param>
/// <param name="sessionID"></param>
/// <param name="currentInterval"></param>
/// <param name="intervalDays"></param>
private void client_OnGroupAccountDetailsRequest(IClientAPI client, UUID agentID, UUID groupID,
UUID transactionID, UUID sessionID, int currentInterval,
int intervalDays)
{
IGroupsModule groupsModule = client.Scene.RequestModuleInterface<IGroupsModule>();
if (groupsModule != null && groupsModule.GroupPermissionCheck(agentID, groupID, GroupPowers.Accountable))
{
IMoneyModule moneyModule = client.Scene.RequestModuleInterface<IMoneyModule>();
if (moneyModule != null)
{
int amt = moneyModule.Balance(groupID);
List<GroupAccountHistory> history = moneyModule.GetTransactions(groupID, agentID, currentInterval,
intervalDays);
history = (from h in history where h.Stipend select h).ToList();
//We don't want payments, we only want stipends which we sent to users
GroupBalance balance = moneyModule.GetGroupBalance(groupID);
client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, amt, currentInterval,
intervalDays,
Util.BuildYMDDateString(
balance.StartingDate.AddDays(-currentInterval*intervalDays)),
history.ToArray());
}
else
client.SendGroupAccountingDetails(client, groupID, transactionID, sessionID, 0, currentInterval,
intervalDays,
"Never", new GroupAccountHistory[0]);
}
}
示例3: XferReceive
/// <summary>
/// Process transfer data received from the client.
/// </summary>
/// <param name = "xferID"></param>
/// <param name = "packetID"></param>
/// <param name = "data"></param>
public void XferReceive(IClientAPI remoteClient, ulong xferID, uint packetID, byte[] data)
{
if (mXferID == xferID)
{
// if (m_asset.Data.Length > 1)//comment out for raw terrain bug fix --VS
lock (_lock) // added
if (m_asset.Data.Length > 1)
{
byte[] destinationArray = new byte[m_asset.Data.Length + data.Length];
Array.Copy(m_asset.Data, 0, destinationArray, 0, m_asset.Data.Length);
Array.Copy(data, 0, destinationArray, m_asset.Data.Length, data.Length);
m_asset.Data = destinationArray;
}
else
{
byte[] buffer2 = new byte[data.Length - 4];
Array.Copy(data, 4, buffer2, 0, data.Length - 4);
m_asset.Data = buffer2;
}
remoteClient.SendConfirmXfer(xferID, packetID);
if ((packetID & 0x80000000) != 0)
{
SendCompleteMessage(remoteClient);
}
}
}
示例4: GetPriorityByDistance
private double GetPriorityByDistance(IClientAPI client, ISceneEntity entity)
{
ScenePresence presence = m_scene.GetScenePresence(client.AgentId);
if (presence != null)
{
// If this is an update for our own avatar give it the highest priority
if (presence == entity)
return 0.0;
// Use the camera position for local agents and avatar position for remote agents
Vector3 presencePos = (presence.IsChildAgent) ?
presence.AbsolutePosition :
presence.CameraPosition;
// Use group position for child prims
Vector3 entityPos;
if (entity is SceneObjectPart)
entityPos = m_scene.GetGroupByPrim(entity.LocalId).AbsolutePosition;
else
entityPos = entity.AbsolutePosition;
return Vector3.DistanceSquared(presencePos, entityPos);
}
return double.NaN;
}
示例5: AttachObject
public void AttachObject(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, bool silent)
{
m_log.Debug("[ATTACHMENTS MODULE]: Invoking AttachObject");
// If we can't take it, we can't attach it!
SceneObjectPart part = m_scene.GetSceneObjectPart(objectLocalID);
if (part == null)
return;
if (!m_scene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
return;
// Calls attach with a Zero position
if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
{
m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
// Save avatar attachment information
ScenePresence presence;
if (m_scene.AvatarFactory != null && m_scene.TryGetScenePresence(remoteClient.AgentId, out presence))
{
m_log.Info(
"[ATTACHMENTS MODULE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
+ ", AttachmentPoint: " + AttachmentPt);
m_scene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
}
}
}
示例6: sendDetailedEstateData
private void sendDetailedEstateData(IClientAPI remote_client, UUID invoice)
{
uint sun = 0;
if (!m_scene.RegionInfo.EstateSettings.UseGlobalTime)
sun=(uint)(m_scene.RegionInfo.EstateSettings.SunPosition*1024.0) + 0x1800;
UUID estateOwner;
if (m_scene.RegionInfo.EstateSettings.EstateOwner != UUID.Zero)
estateOwner = m_scene.RegionInfo.EstateSettings.EstateOwner;
else
estateOwner = m_scene.RegionInfo.MasterAvatarAssignedUUID;
if (m_scene.Permissions.IsGod(remote_client.AgentId))
estateOwner = remote_client.AgentId;
remote_client.SendDetailedEstateData(invoice,
m_scene.RegionInfo.EstateSettings.EstateName,
m_scene.RegionInfo.EstateSettings.EstateID,
m_scene.RegionInfo.EstateSettings.ParentEstateID,
GetEstateFlags(),
sun,
m_scene.RegionInfo.RegionSettings.Covenant,
m_scene.RegionInfo.EstateSettings.AbuseEmail,
estateOwner);
remote_client.SendEstateManagersList(invoice,
m_scene.RegionInfo.EstateSettings.EstateManagers,
m_scene.RegionInfo.EstateSettings.EstateID);
remote_client.SendBannedUserList(invoice,
m_scene.RegionInfo.EstateSettings.EstateBans,
m_scene.RegionInfo.EstateSettings.EstateID);
}
示例7: OnConnectionClose
public void OnConnectionClose(IClientAPI client)
{
if (client == null)
return;
if (client.SceneAgent == null)
return;
if (client.SceneAgent.IsChildAgent)
return;
//m_log.DebugFormat("[ACTIVITY DETECTOR]: Detected client logout {0} in {1}", userId, client.Scene.RegionInfo.RegionName);
string userId;
/* without scene we cannot logout correctly at all since we do not know how to send the loggedout message then */
if (client.Scene is Scene)
{
Scene s = (Scene)client.Scene;
userId = s.UserManagementModule.GetUserUUI(client.AgentId);
if(s.UserManagementModule.GetUserUUI(client.AgentId, out userId))
{
m_GridUserService.LoggedOut(
userId, client.SessionId, client.Scene.RegionInfo.RegionID,
client.SceneAgent.AbsolutePosition, client.SceneAgent.Lookat);
}
}
}
示例8: DeactivateGesture
public virtual void DeactivateGesture(IClientAPI client, List<UUID> gestureIds)
{
IInventoryProviderSelector selector = ProviderRegistry.Instance.Get<IInventoryProviderSelector>();
ICheckedInventoryStorage provider = selector.GetCheckedProvider(client.AgentId);
provider.DeactivateGestures(client.AgentId, gestureIds);
}
示例9: ClientConnect
public void ClientConnect(IClientAPI client)
{
m_virtScene.UnSubscribeToClientPrimEvents(client);
m_virtScene.UnSubscribeToClientPrimRezEvents(client);
m_virtScene.UnSubscribeToClientInventoryEvents(client);
if(m_virtScene.AttachmentsModule != null)
((AttachmentsModule)m_virtScene.AttachmentsModule).UnsubscribeFromClientEvents(client);
//m_virtScene.UnSubscribeToClientTeleportEvents(client);
m_virtScene.UnSubscribeToClientScriptEvents(client);
IGodsModule virtGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
if (virtGodsModule != null)
((GodsModule)virtGodsModule).UnsubscribeFromClientEvents(client);
m_virtScene.UnSubscribeToClientNetworkEvents(client);
m_rootScene.SubscribeToClientPrimEvents(client);
client.OnAddPrim += LocalAddNewPrim;
client.OnRezObject += LocalRezObject;
m_rootScene.SubscribeToClientInventoryEvents(client);
if (m_rootScene.AttachmentsModule != null)
((AttachmentsModule)m_rootScene.AttachmentsModule).SubscribeToClientEvents(client);
//m_rootScene.SubscribeToClientTeleportEvents(client);
m_rootScene.SubscribeToClientScriptEvents(client);
IGodsModule rootGodsModule = m_virtScene.RequestModuleInterface<IGodsModule>();
if (rootGodsModule != null)
((GodsModule)rootGodsModule).UnsubscribeFromClientEvents(client);
m_rootScene.SubscribeToClientNetworkEvents(client);
}
示例10: OnNewClient
public void OnNewClient(IClientAPI client)
{
//Detect object data changes by hooking into the IClientAPI.
//Very dirty, and breaks whenever someone changes the client API.
client.OnAddPrim += delegate (UUID ownerID, UUID groupID, Vector3 RayEnd, Quaternion rot,
PrimitiveBaseShape shape, byte bypassRaycast, Vector3 RayStart, UUID RayTargetID,
byte RayEndIsIntersection) { this.Stale = true; };
client.OnLinkObjects += delegate (IClientAPI remoteClient, uint parent, List<uint> children)
{ this.Stale = true; };
client.OnDelinkObjects += delegate(List<uint> primIds, IClientAPI clientApi) { this.Stale = true; };
client.OnGrabUpdate += delegate(UUID objectID, Vector3 offset, Vector3 grapPos,
IClientAPI remoteClient, List<SurfaceTouchEventArgs> surfaceArgs) { this.Stale = true; };
client.OnObjectAttach += delegate(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt,
Quaternion rot, bool silent) { this.Stale = true; };
client.OnObjectDuplicate += delegate(uint localID, Vector3 offset, uint dupeFlags, UUID AgentID,
UUID GroupID) { this.Stale = true; };
client.OnObjectDuplicateOnRay += delegate(uint localID, uint dupeFlags, UUID AgentID, UUID GroupID,
UUID RayTargetObj, Vector3 RayEnd, Vector3 RayStart, bool BypassRaycast,
bool RayEndIsIntersection, bool CopyCenters, bool CopyRotates) { this.Stale = true; };
client.OnObjectIncludeInSearch += delegate(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
{ this.Stale = true; };
client.OnObjectPermissions += delegate(IClientAPI controller, UUID agentID, UUID sessionID,
byte field, uint localId, uint mask, byte set) { this.Stale = true; };
client.OnRezObject += delegate(IClientAPI remoteClient, UUID itemID, Vector3 RayEnd,
Vector3 RayStart, UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection,
bool RezSelected,
bool RemoveItem, UUID fromTaskID) { this.Stale = true; };
}
示例11: AddNewClient
public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)
{
client.OnObjectName += RecordObjectNameCall;
// FIXME
return null;
}
示例12: RequestGodlikePowers
public void RequestGodlikePowers (
UUID agentID, UUID sessionID, UUID token, bool godLike, IClientAPI controllingClient)
{
IScenePresence sp = m_scene.GetScenePresence (agentID);
if (sp != null) {
if (godLike == false) {
//Unconditionally remove god levels
sp.GodLevel = Constants.USER_NORMAL;
sp.ControllingClient.SendAdminResponse (token, (uint)sp.GodLevel);
return;
}
// First check that this is the sim owner
if (m_scene.Permissions.IsAdministrator (sp.UUID)) {
sp.GodLevel = sp.UserLevel;
if (sp.GodLevel == Constants.USER_NORMAL)
sp.GodLevel = Constants.USER_GOD_MAINTENANCE;
MainConsole.Instance.InfoFormat ("[GODS]: God level set for {0}, level {1}", sp.Name, sp.GodLevel);
sp.ControllingClient.SendAdminResponse (token, (uint)sp.GodLevel);
} else {
if (m_dialogModule != null)
m_dialogModule.SendAlertToUser (agentID, "Request for god powers denied. This request has been logged.");
MainConsole.Instance.Info ("[GODS]: God powers requested by " + sp.Name +
", user is not allowed to have god powers");
}
}
}
示例13: SignificantClientMovement
void SignificantClientMovement(IClientAPI remote_client)
{
if (remote_client.AgentId != m_presence.UUID)
return;
if(m_presence.DrawDistance == 0)
return;
//This checks to see if we need to send more updates to the avatar since they last moved
EntityBase[] Entities = m_presence.Scene.Entities.GetEntities();
foreach (EntityBase entity in Entities)
{
if (entity is SceneObjectGroup) //Only objects
{
//Check to see if they are in range
if (Util.DistanceLessThan(m_presence.CameraPosition, entity.AbsolutePosition, m_presence.DrawDistance))
{
//Check if we already have sent them an update
if (!m_objectsInView.Contains(entity.UUID))
{
if (m_pendingObjects != null)
{
//Update the list
m_objectsInView.Add(entity.UUID);
//Enqueue them for an update
m_pendingObjects.Enqueue((SceneObjectGroup)entity);
}
}
}
}
}
Entities = null;
}
示例14: HandleXfer
public void HandleXfer(IClientAPI client, ulong xferID, uint packetID, byte[] data)
{
AssetXferUploader foundUploader = null;
lock (XferUploaders)
{
foreach (AssetXferUploader uploader in XferUploaders.Values)
{
// MainConsole.Instance.DebugFormat(
// "[AGENT ASSETS TRANSACTIONS]: In HandleXfer, inspect xfer upload with xfer id {0}",
// uploader.XferID);
if (uploader.XferID == xferID)
{
foundUploader = uploader;
break;
}
}
}
if (foundUploader != null)
{
// MainConsole.Instance.DebugFormat(
// "[AGENT ASSETS TRANSACTIONS]: Found xfer uploader for xfer id {0}, packet id {1}, data length {2}",
// xferID, packetID, data.Length);
foundUploader.HandleXferPacket(xferID, packetID, data);
}
}
示例15: CheckForBannedViewer
/// <summary>
/// Check to see if the client has baked textures that belong to banned clients
/// </summary>
/// <param name="client"></param>
/// <param name="textureEntry"></param>
public void CheckForBannedViewer(IClientAPI client, Primitive.TextureEntry textureEntry)
{
try
{
//Read the website once!
if (m_map == null)
m_map = (OSDMap)OSDParser.Deserialize(Utilities.ReadExternalWebsite("http://auroraserver.ath.cx:8080/client_tags.xml"));
//This is the givaway texture!
for (int i = 0; i < textureEntry.FaceTextures.Length; i++)
{
if (textureEntry.FaceTextures[i] != null)
{
if (m_map.ContainsKey(textureEntry.FaceTextures[i].TextureID.ToString()))
{
OSDMap viewerMap = (OSDMap)m_map[textureEntry.FaceTextures[i].TextureID.ToString()];
//Check the names
if (BannedViewers.Contains(viewerMap["name"].ToString()))
{
client.Kick("You cannot use " + viewerMap["name"] + " in this sim.");
((Scene)client.Scene).IncomingCloseAgent(client.AgentId);
}
else if (m_banEvilViewersByDefault && viewerMap.ContainsKey("evil") && (viewerMap["evil"].AsBoolean() == true))
{
client.Kick("You cannot use " + viewerMap["name"] + " in this sim.");
((Scene)client.Scene).IncomingCloseAgent(client.AgentId);
}
}
}
}
}
catch { }
}