예제 #1
0
        public LSL_Key llRequestInventoryData(string name)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return "";


            TaskInventoryDictionary itemDictionary = (TaskInventoryDictionary) m_host.TaskInventory.Clone();

            foreach (TaskInventoryItem item in itemDictionary.Values)
            {
                if (item.Type == 3 && item.Name == name)
                {
                    UUID rq = UUID.Random();
                    DataserverPlugin dataserverPlugin = (DataserverPlugin) m_ScriptEngine.GetScriptPlugin("Dataserver");

                    UUID tid = dataserverPlugin.RegisterRequest(m_host.UUID,
                                                                m_itemID, rq.ToString());

                    Vector3 region = new Vector3(
                        World.RegionInfo.RegionLocX,
                        World.RegionInfo.RegionLocY,
                        0);

                    World.AssetService.Get(item.AssetID.ToString(), this,
                                           delegate(string i, object sender, AssetBase a)
                                               {
                                                   AssetLandmark lm = new AssetLandmark(a);

                                                   float rx = (uint) (lm.RegionHandle >> 32);
                                                   float ry = (uint) lm.RegionHandle;
                                                   region = lm.Position + new Vector3(rx, ry, 0) - region;

                                                   string reply = region.ToString();
                                                   dataserverPlugin.AddReply(rq.ToString(),
                                                                             reply, 1000);
                                               });

                    ScriptSleep(1000);
                    return tid.ToString();
                }
            }
            ScriptSleep(1000);
            return String.Empty;
        }
예제 #2
0
        public void llTeleportAgent(LSL_Key avatar, LSL_String landmark, LSL_Vector position, LSL_Vector look_at)
        {
            if (!ScriptProtection.CheckThreatLevel(ThreatLevel.None, "LSL", m_host, "LSL", m_itemID)) return;

            UUID invItemID = InventorySelf();

            if (invItemID == UUID.Zero)
                return;

            lock (m_host.TaskInventory)
            {
                if (m_host.TaskInventory[invItemID].PermsGranter == UUID.Zero)
                {
                    ShoutError("No permissions to teleport the agent");
                    return;
                }

                if ((m_host.TaskInventory[invItemID].PermsMask & ScriptBaseClass.PERMISSION_TELEPORT) == 0)
                {
                    ShoutError("No permissions to teleport the agent");
                    return;
                }
            }

            TaskInventoryItem item = null;
            lock (m_host.TaskInventory)
            {
                foreach (KeyValuePair<UUID, TaskInventoryItem> inv in m_host.TaskInventory)
                {
                    if (inv.Value.Name == landmark)
                        item = inv.Value;
                }
            }
            if (item == null && landmark != "")
                return;

            IScenePresence presence = World.GetScenePresence(m_host.OwnerID);
            if (presence != null)
            {
                IEntityTransferModule module = World.RequestModuleInterface<IEntityTransferModule>();
                if (module != null)
                {
                    if (landmark == "")
                        module.Teleport(presence, World.RegionInfo.RegionHandle,
                                        position.ToVector3(), look_at.ToVector3(), (uint) TeleportFlags.ViaLocation);
                    else
                    {
                        AssetLandmark lm = new AssetLandmark(
                            World.AssetService.Get(item.AssetID.ToString()));
                        module.Teleport(presence, lm.RegionHandle, lm.Position,
                                        look_at.ToVector3(), (uint) TeleportFlags.ViaLocation);
                    }
                }
            }
        }