public void AddRegion(Scene scene) { if (!enabled) { return; } log("Adding region to MGM"); npc = (NPCModule)scene.RequestModuleInterface <INPCModule>(); if (npc == null || !npc.Enabled) { enabled = false; log("ERROR: NPC module must be enabled for MGM"); return; } scene.AddCommand("mgm", this, "mgm status", "status", "Print the status of the MGM module", consoleStatus); scene.AddCommand("mgm", this, "mgm addUser", "addUser", "Test adding a user", addUser); scene.AddCommand("mgm", this, "mgm removeUser", "removeUser", "Test removing a user", removeUser); mgmLink = new MGMLink(new IPEndPoint(mgmAddress, mgmPort), log); mgmLink.start(); registerEvents(scene.EventManager); string regMsg = MGMJson.Register(scene.Name, scene.RegionInfo.RegionLocX, scene.RegionInfo.RegionLocY, scene.RegionInfo.RegionSizeX); mgmLink.send(regMsg); this.scene = scene; mgr = new MGMClientManager(scene, log); }
public override void SetUp() { base.SetUp(); uint port = 9999; uint sslPort = 9998; // This is an unfortunate bit of clean up we have to do because MainServer manages things through static // variables and the VM is not restarted between tests. MainServer.RemoveHttpServer(port); BaseHttpServer server = new BaseHttpServer(port, false, sslPort, ""); MainServer.AddHttpServer(server); MainServer.Instance = server; IConfigSource config = new IniConfigSource(); config.AddConfig("Startup"); config.Configs["Startup"].Set("EventQueue", "true"); CapabilitiesModule capsModule = new CapabilitiesModule(); m_eqgMod = new EventQueueGetModule(); // For NPC test support config.AddConfig("NPC"); config.Configs["NPC"].Set("Enabled", "true"); m_npcMod = new NPCModule(); m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, capsModule, m_eqgMod, m_npcMod); }
public void initialize(Scene scene) { scene.EventManager.OnFrame += onFrame; m_scene = scene; dialog = m_scene.RequestModuleInterface <IDialogModule>(); /* lookup xEngine */ IScriptModule scriptModule = null; foreach (IScriptModule sm in scene.RequestModuleInterfaces <IScriptModule>()) { if (sm.ScriptEngineName == scene.DefaultScriptEngine) { scriptModule = sm; } else if (scriptModule == null) { scriptModule = sm; } } xEngine = (XEngine)scriptModule; /* lookup NPC module */ npc = (NPCModule)m_scene.RequestModuleInterface <INPCModule>(); }
public static NPCModule getInstance() { if (instance == null) { instance = new NPCModule(); } return instance; }
protected void GetModules() { Modules = new Dictionary <string, NPCModule>(); foreach (KeyValuePair <string, string> entry in NPCModuleTypes) { NPCModule module = (NPCModule)GetComponent(entry.Value); Modules.Add(entry.Key, module); } ; combatModule = (CombatModule)Modules["Combat"]; movementModule = (MovementModule)Modules["Movement"]; bounceModule = (BounceModule)Modules["Bounce"]; handleOpponentModule = (HandleOpponentModule)Modules["HandleOpponent"]; visionModule = (VisionModule)Modules["Vision"]; }
public void Init() { IConfigSource config = new IniConfigSource(); config.AddConfig("NPC"); config.Configs["NPC"].Set("Enabled", "true"); config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); m_afMod = new AvatarFactoryModule(); m_umMod = new UserManagementModule(); m_attMod = new AttachmentsModule(); m_npcMod = new NPCModule(); m_scene = SceneHelpers.SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); }
// Player comes in range void OnTriggerEnter(Collider coll) { if (!GameManager.isPvE) { return; } if (Player.main == null) { return; } if (coll != Player.main.collider) { return; } Player.main.actionTarget = this; // Play sound if (audio != null && audio.clip != null) { audio.Play(); } if (InGameLobby.instance != null && module == null) { if (componentName == "InGameLobby") { module = (NPCModule)InGameLobby.instance; } else if (componentName == "MusicManager") { module = (NPCModule)MusicManager.instance; } else { module = (NPCModule)InGameLobby.instance.GetComponent(componentName); } } if (module != null) { module.OnNPCEnter(); } }
public void SetUpScene(uint sizeX, uint sizeY) { IConfigSource config = new IniConfigSource(); config.AddConfig("NPC"); config.Configs["NPC"].Set("Enabled", "true"); config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); m_afMod = new AvatarFactoryModule(); m_umMod = new UserManagementModule(); m_attMod = new AttachmentsModule(); m_npcMod = new NPCModule(); m_scene = new SceneHelpers().SetupScene("test scene", UUID.Random(), 1000, 1000, sizeX, sizeY, config); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); }
public void Init() { IConfigSource config = new IniConfigSource(); config.AddConfig("NPC"); config.Configs["NPC"].Set("Enabled", "true"); config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); m_afMod = new AvatarFactoryModule(); m_umMod = new UserManagementModule(); m_attMod = new AttachmentsModule(); m_npcMod = new NPCModule(); m_scene = new SceneHelpers().SetupScene(); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); }
private void createActor(UUID originalUuid, string firstName, string lastName, string appearanceNotecard) { if (actors.ContainsKey(originalUuid)) { return; } if (npc == null) { npc = (NPCModule)m_scene.RequestModuleInterface <INPCModule>(); } //read appearance out of notecard AvatarAppearance appearance = loadAvatarAppearance(appearanceNotecard); //create npc UUID uuid = npc.CreateNPC(firstName, lastName, Vector3.Zero, UUID.Zero, false, m_scene, appearance); ScenePresence presence; m_scene.TryGetScenePresence(uuid, out presence); actors[originalUuid] = presence; }
public void SetUpScene(uint sizeX, uint sizeY) { IConfigSource config = new IniConfigSource(); config.AddConfig("NPC"); config.Configs["NPC"].Set("Enabled", "true"); config.AddConfig("Modules"); config.Configs["Modules"].Set("InventoryAccessModule", "BasicInventoryAccessModule"); m_afMod = new AvatarFactoryModule(); m_umMod = new UserManagementModule(); m_attMod = new AttachmentsModule(); m_npcMod = new NPCModule(); m_scene = new SceneHelpers().SetupScene("test scene", UUID.Random(), 1000, 1000, sizeX, sizeY, config); SceneHelpers.SetupSceneModules(m_scene, config, m_afMod, m_umMod, m_attMod, m_npcMod, new BasicInventoryAccessModule()); }