Exemplo n.º 1
0
        public void Startup(ConfigurationLoader loader)
        {
            HomeURI = loader.HomeURI;

            m_AgentInventoryService = loader.GetService <InventoryServiceInterface>(m_AgentInventoryServiceName);
            m_AgentAssetService     = loader.GetService <AssetServiceInterface>(m_AgentAssetServiceName);
            if (m_AgentProfileServiceName?.Length != 0)
            {
                m_AgentProfileService = loader.GetService <ProfileServiceInterface>(m_AgentProfileServiceName);
            }
            m_AgentFriendsService = loader.GetService <FriendsServiceInterface>(m_AgentFriendsServiceName);
            m_UserSessionService  = loader.GetService <UserSessionServiceInterface>(m_UserSessionServiceName);
            m_GridService         = loader.GetService <GridServiceInterface>(m_GridServiceName);
            if (m_OfflineIMServiceName?.Length != 0)
            {
                m_OfflineIMService = loader.GetService <OfflineIMServiceInterface>(m_OfflineIMServiceName);
            }
            if (m_AgentExperienceServiceName?.Length != 0)
            {
                loader.GetService(m_AgentExperienceServiceName, out m_AgentExperienceService);
            }
            if (m_AgentGroupsServiceName?.Length != 0)
            {
                loader.GetService(m_AgentGroupsServiceName, out m_AgentGroupsService);
            }
            m_UserAccountService    = loader.GetService <UserAccountServiceInterface>(m_UserAccountServiceName);
            m_AgentUserAgentService = new LocalUserAgentService(m_UserSessionService, m_UserAccountService, m_RequiresInventoryIDAsIMSessionID, HomeURI);

            m_Scenes               = loader.Scenes;
            m_Commands             = loader.CommandRegistry;
            m_CapsRedirector       = loader.CapsRedirector;
            m_PacketHandlerPlugins = loader.GetServicesByValue <IProtocolExtender>();
        }
Exemplo n.º 2
0
 public NpcAgent(
     UGUIWithName npcID,
     AgentServiceList serviceList,
     UUID sceneID)
     : base(npcID.ID, npcID.HomeURI)
 {
     FirstName           = npcID.FirstName;
     LastName            = npcID.LastName;
     m_InventoryService  = serviceList.Get <InventoryServiceInterface>();
     m_ProfileService    = serviceList.Get <ProfileServiceInterface>();
     m_PresenceService   = serviceList.Get <IPresenceServiceInterface>();
     NpcPresenceService  = serviceList.Get <NpcPresenceServiceInterface>();
     m_UpdateInfo        = new AgentUpdateInfo(this, sceneID);
     OnAppearanceUpdate += HandleAppearanceUpdate;
 }
Exemplo n.º 3
0
        public void Startup(ConfigurationLoader loader)
        {
            List <IAdminWebIF> webifs = loader.GetServicesByValue <IAdminWebIF>();

            if (webifs.Count > 0)
            {
                m_AdminWebIF = webifs[0];
                m_AdminWebIF.JsonMethods.Add("npcs.show", HandleShowNpcs);
                m_AdminWebIF.JsonMethods.Add("npc.remove", HandleRemoveNpc);
                m_AdminWebIF.JsonMethods.Add("npc.get", HandleGetNpc);
                m_AdminWebIF.AutoGrantRights["npcs.manage"].Add("npcs.view");
                m_AdminWebIF.ModuleNames.Add("npcs");
            }
            /* non persistent inventory is needed for baking logic */
            m_NonpersistentInventoryService = loader.GetService <InventoryServiceInterface>(m_NonpersistentInventoryServiceName);
            m_NonpersistentAgentServices.Add(m_NonpersistentInventoryService);
            m_NonpersistentAgentServices.Add(new NpcNonPersistentPresenceService());

            /* persistence is optional */
            if (!string.IsNullOrEmpty(m_NpcPresenceServiceName) || !string.IsNullOrEmpty(m_PersistentInventoryServiceName))
            {
                m_NpcPresenceService = loader.GetService <NpcPresenceServiceInterface>(m_NpcPresenceServiceName);
                m_PersistentAgentServices.Add(m_NpcPresenceService);
                m_PersistentInventoryService = loader.GetService <InventoryServiceInterface>(m_PersistentInventoryServiceName);
                m_PersistentAgentServices.Add(m_PersistentInventoryService);

                /* profile is optional */
                if (!string.IsNullOrEmpty(m_PersistentProfileServiceName))
                {
                    m_PersistentProfileService = loader.GetService <ProfileServiceInterface>(m_PersistentProfileServiceName);
                    m_PersistentAgentServices.Add(m_PersistentProfileService);
                }
            }

            /* profile is optional */
            if (!string.IsNullOrEmpty(m_NonpersistentProfileServiceName))
            {
                m_NonpersistentProfileService = loader.GetService <ProfileServiceInterface>(m_NonpersistentProfileServiceName);
                m_NonpersistentAgentServices.Add(m_NonpersistentProfileService);
            }
            loader.Scenes.OnRegionAdd    += OnSceneAdded;
            loader.Scenes.OnRegionRemove += OnSceneRemoved;

            loader.CommandRegistry.AddShowCommand("npcs", ShowNpcsCommand);
            loader.CommandRegistry.AddRemoveCommand("npc", RemoveNpcCommand);
            loader.CommandRegistry.AddCreateCommand("npc", CreateNpcCommand);
            loader.CommandRegistry.AddRemoveAllCommand("npcs", RemoveAllNpcsCommand);
        }
Exemplo n.º 4
0
 public ViewerAgent(
     SceneList scenes,
     UUID agentID,
     string firstName,
     string lastName,
     Uri homeURI,
     UUID sessionID,
     UUID secureSessionID,
     ClientInfo clientInfo,
     UserAccount untrustedAccountInfo,
     AgentServiceList serviceList)
     : base(agentID, homeURI)
 {
     m_Scenes           = scenes;
     m_TeleportServices = serviceList.GetAll <IAgentTeleportServiceInterface>();
     foreach (IAgentTeleportServiceInterface service in m_TeleportServices)
     {
         service.Agent = this;
     }
     CollisionPlane         = Vector4.UnitW;
     SessionID              = sessionID;
     m_UntrustedAccountInfo = untrustedAccountInfo;
     m_SecureSessionID      = secureSessionID;
     Client              = clientInfo;
     m_AssetService      = serviceList.Get <AssetServiceInterface>();
     m_InventoryService  = serviceList.Get <InventoryServiceInterface>();
     m_GroupsService     = serviceList.Get <GroupsServiceInterface>();
     m_ExperienceService = serviceList.Get <ExperienceServiceInterface>();
     m_ProfileService    = serviceList.Get <ProfileServiceInterface>();
     m_FriendsService    = serviceList.Get <FriendsServiceInterface>();
     m_UserAgentService  = serviceList.Get <UserAgentServiceInterface>();
     m_PresenceService   = serviceList.Get <IPresenceServiceInterface>();
     EconomyService      = serviceList.Get <EconomyServiceInterface>();
     OfflineIMService    = serviceList.Get <OfflineIMServiceInterface>();
     MuteListService     = serviceList.Get <MuteListServiceInterface>();
     FirstName           = firstName;
     LastName            = lastName;
     OnPositionChange   += ChildUpdateOnPositionChange;
     OnAppearanceUpdate += HandleAppearanceUpdate;
 }
Exemplo n.º 5
0
 public ProfileServiceData(UserAgentServiceInterface userAgent, ProfileServiceInterface profileService)
 {
     UserAgentService = userAgent;
     ProfileService   = profileService;
     TicksAt          = Environment.TickCount;
 }
Exemplo n.º 6
0
        private ProfileServiceData LookupProfileService(SceneInterface scene, UUID agentID, out UGUI agentUUI)
        {
            ProfileServiceData        serviceData      = null;
            ProfileServiceInterface   profileService   = null;
            UserAgentServiceInterface userAgentService = null;

            agentUUI = UGUI.Unknown;

            if (profileService == null)
            {
                try
                {
                    IAgent agent = scene.Agents[agentID];
                    agentUUI         = agent.NamedOwner;
                    profileService   = agent.ProfileService;
                    userAgentService = agent.UserAgentService;
                    if (profileService == null)
                    {
                        profileService = new DummyProfileService();
                    }
                    if (userAgentService == null)
                    {
                        userAgentService = new DummyUserAgentService();
                    }
                    serviceData = new ProfileServiceData(userAgentService, profileService);
                }
                catch
                {
                    agentUUI = UGUI.Unknown;
                }
            }

            if (profileService == null && userAgentService == null)
            {
                UGUI uui;
                try
                {
                    uui      = scene.AvatarNameService[agentID];
                    agentUUI = uui;

                    if (!m_LastKnownProfileServices.TryGetValue(uui.HomeURI.ToString(), out serviceData))
                    {
                        foreach (IUserAgentServicePlugin userAgentPlugin in m_UserAgentServices)
                        {
                            if (userAgentPlugin.IsProtocolSupported(uui.HomeURI.ToString()))
                            {
                                userAgentService = userAgentPlugin.Instantiate(uui.HomeURI.ToString());
                                break;
                            }
                        }

                        Dictionary <string, string> urls = userAgentService.GetServerURLs(uui);
                        if (urls.ContainsKey("ProfileServerURI"))
                        {
                            string profileServerURI = urls["ProfileServerURI"];
                            foreach (IProfileServicePlugin profilePlugin in m_ProfileServices)
                            {
                                if (profilePlugin.IsProtocolSupported(profileServerURI))
                                {
                                    profileService = profilePlugin.Instantiate(profileServerURI);
                                }
                            }
                        }

                        if (userAgentService != null)
                        {
                            if (profileService == null)
                            {
                                profileService = new DummyProfileService();
                            }

                            serviceData = new ProfileServiceData(userAgentService, profileService);
                            m_LastKnownProfileServices.Add(uui.HomeURI.ToString(), serviceData);
                        }
                    }
                }
                catch
                {
                    agentUUI = UGUI.Unknown;
                }
            }

            return(serviceData);
        }