Пример #1
0
        private void addUser(string module, string[] args)
        {
            log("Adding user manually");
            OpenMetaverse.UUID guid   = new OpenMetaverse.UUID("cf86b3be-8c15-4f3b-aa47-2a8589ac46c8");
            MGMClient          client = mgr.NewClient(
                "test", "load_0",
                guid,
                new OpenMetaverse.Vector3(50, 50, 50));

            client.registerCallbacks(this.mgmLink);
        }
Пример #2
0
        public MGMClient NewClient(string firstname, string lastname, UUID agentID, Vector3 position)
        {
            MGMClient client       = null;
            UUID      owner        = agentID;
            bool      senseAsAgent = true;

            try
            {
                if (agentID == UUID.Zero)
                {
                    client = new MGMClient(firstname, lastname, position,
                                           owner, senseAsAgent, scene, log);
                }
                else
                {
                    client = new MGMClient(firstname, lastname, agentID, position,
                                           owner, senseAsAgent, scene, log);
                }
            }
            catch (Exception e)
            {
                log("[NPC MODULE]: exception creating NPC avatar: " + e.ToString());
                return(null);
            }

            client.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);

            log(String.Format(
                    "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
                    firstname, lastname, client.AgentId, owner,
                    senseAsAgent, position, scene.RegionInfo.RegionName));

            AgentCircuitData acd = new AgentCircuitData();

            acd.AgentID     = client.AgentId;
            acd.firstname   = firstname;
            acd.lastname    = lastname;
            acd.IPAddress   = "0.0.0.0";
            acd.ServiceURLs = new Dictionary <string, object>();

            AvatarAppearance npcAppearance = new AvatarAppearance();            //  (appearance, true);

            acd.Appearance = npcAppearance;

            lock (m_avatars)
            {
                scene.AuthenticateHandler.AddNewCircuit(client.CircuitCode, acd);
                scene.AddNewAgent(client, PresenceType.Npc);

                ScenePresence sp;
                if (scene.TryGetScenePresence(client.AgentId, out sp))
                {
                    sp.CompleteMovement(client, false);
                    m_avatars.Add(client.AgentId, client);
                    log(string.Format("[MGM MODULE]: Created NPC {0} {1}", client.AgentId, sp.Name));

                    return(client);
                }
                else
                {
                    log(string.Format(
                            "[MGM MODULE]: Could not find scene presence for NPC {0} {1}",
                            sp.Name, sp.UUID));

                    return(null);
                }
            }
        }
Пример #3
0
        public MGMClient NewClient(string firstname, string lastname, UUID agentID, Vector3 position)
        {
            MGMClient client = null;
            UUID owner = agentID;
            bool senseAsAgent = true;
            try
            {
                if (agentID == UUID.Zero)
                    client = new MGMClient(firstname, lastname, position,
                                              owner, senseAsAgent, scene, log);
                else
                    client = new MGMClient(firstname, lastname, agentID, position,
                                              owner, senseAsAgent, scene, log);
            }
            catch (Exception e)
            {
                log("[NPC MODULE]: exception creating NPC avatar: " + e.ToString());
                return null;
            }

            client.CircuitCode = (uint)Util.RandomClass.Next(0, int.MaxValue);

            log(String.Format(
                "[NPC MODULE]: Creating NPC {0} {1} {2}, owner={3}, senseAsAgent={4} at {5} in {6}",
                firstname, lastname, client.AgentId, owner,
                senseAsAgent, position, scene.RegionInfo.RegionName));

            AgentCircuitData acd = new AgentCircuitData();
            acd.AgentID = client.AgentId;
            acd.firstname = firstname;
            acd.lastname = lastname;
            acd.ServiceURLs = new Dictionary<string, object>();

            AvatarAppearance npcAppearance = new AvatarAppearance();//  (appearance, true);
            acd.Appearance = npcAppearance;

            lock (m_avatars)
            {
                scene.AuthenticateHandler.AddNewCircuit(client.CircuitCode, acd);
                scene.AddNewAgent(client, PresenceType.Npc);

                ScenePresence sp;
                if (scene.TryGetScenePresence(client.AgentId, out sp))
                {
                    sp.CompleteMovement(client, false);
                    m_avatars.Add(client.AgentId, client);
                    log(string.Format("[MGM MODULE]: Created NPC {0} {1}", client.AgentId, sp.Name));

                    return client;
                }
                else
                {
                    log(string.Format(
                        "[MGM MODULE]: Could not find scene presence for NPC {0} {1}",
                        sp.Name, sp.UUID));

                    return null;
                }
            }
        }