public UnsitCommand(RadegastInstance instance) : base(instance) { Name = "unsit"; Description = "Unsits if seated"; Usage = "unsit"; }
public PauseCommand(RadegastInstance inst) : base(inst) { Name = "pause"; Description = "pauses command script execution"; Usage = "pause [seconds]"; }
public MediaManager(RadegastInstance instance) : base() { this.Instance = instance; manager = this; if (MainProgram.CommandLine.DisableSound) { soundSystemAvailable = false; return; } endCallback = new FMOD.CHANNEL_CALLBACK(DispatchEndCallback); allBuffers = new Dictionary<UUID, BufferSound>(); // Start the background thread that does all the FMOD calls. soundThread = new Thread(new ThreadStart(CommandLoop)); soundThread.IsBackground = true; soundThread.Name = "SoundThread"; soundThread.Start(); // Start the background thread that updates listerner position. listenerThread = new Thread(new ThreadStart(ListenerUpdate)); listenerThread.IsBackground = true; listenerThread.Name = "ListenerThread"; listenerThread.Start(); Instance.ClientChanged += new EventHandler<ClientChangedEventArgs>(Instance_ClientChanged); // Wait for init to complete initDone.WaitOne(); initDone = null; }
public TalkToAvatar(RadegastInstance inst, AIMLBot bot) : base(inst) { ContextType = typeof (Avatar); Label = "Talk to"; aimlBot = bot; }
public EVOvendPlugin(RadegastInstance instance, bool unused) : base(instance) { //this.instance = instance; Init(); Disposed += new EventHandler(EVOvendTab_Disposed); RegisterClientEvents(client); }
public FaceCommand(RadegastInstance instance) : base(instance) { Name = "face"; Description = "Changes the direction"; Usage = "face (direction|heading|object|person|help) [additional args] (type \"" + CommandsManager.CmdPrefix + "face help\" for full usage)"; Chat = (ChatConsole)TC.Tabs["chat"].Control; }
public SitCommand(RadegastInstance instance) : base(instance) { Name = "sit"; Description = "Sits on an object or on the ground"; Usage = "sit (object name|ground)"; Chat = (ChatConsole)TC.Tabs["chat"].Control; }
public FollowCommand(RadegastInstance instance) : base(instance) { Name = "follow"; Description = "Follows a person"; Usage = "follow (person name|stop)"; Chat = (ChatConsole)TC.Tabs["chat"].Control; }
public AutoSit(RadegastInstance instance) { m_instance = instance; m_Timer = new Timer(10 * 1000); m_Timer.Elapsed += new ElapsedEventHandler((sender, args) => { TrySit(); }); m_Timer.Enabled = false; }
public FindCommand(RadegastInstance instance) : base(instance) { Name = "find"; Description = "Finds nearby person or object"; Usage = "find (object|person) name"; Chat = (ChatConsole)TC.Tabs["chat"].Control; }
public PseudoHome(RadegastInstance instance) { m_instance = instance; m_Timer = new Timer(5000); m_Timer.Elapsed += new ElapsedEventHandler((sender, args) => { ETGoHome(); }); m_Timer.Enabled = false; }
public ScriptInfoCommand(RadegastInstance instance) : base(instance) { Name = "scriptinfo"; Description = "Prints out available information about the current script usage"; Usage = "scriptinfo (avatar|parcel) - display script resource usage details about your avatar or parcel you are on. If not specified avatar is assumed"; this.instance = instance; }
public SimInfoCommand(RadegastInstance instance) : base(instance) { Name = "siminfo"; Description = "Prints out available information about the current region"; Usage = Name; this.instance = instance; }
public GoCommand(RadegastInstance instance) : base(instance) { Name = "go"; Description = "Moves avatar"; Usage = "go [tp] (distance|xyz|object|person|help) [additional args] (type \"" + CommandsManager.CmdPrefix + "go help\" for full usage)"; subCommand = new Regex(@"(?<subcmd>.*)\s*=\s*(?<subarg>.*)", regexOptions); Chat = (ChatConsole)TC.Tabs["chat"].Control; }
public StatusCommand(RadegastInstance instance) : base(instance) { Name = "status"; Description = "Prints various status infromation"; Usage = "status (doing|region|parcel|money|location|time)"; this.instance = instance; args = new List<string>(); }
public ParcelInfoCommand(RadegastInstance instance) : base(instance) { Name = "parcelinfo"; Description = "Prints out info about all the parcels in this simulator"; Usage = Name; this.instance = instance; this.instance.Netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(Netcom_ClientDisconnected); }
public GraphicsPreferences(RadegastInstance instance) { this.Instance = instance; InitializeComponent(); Disposed += new EventHandler(GraphicsPreferences_Disposed); Text = "Graphics preferences"; cbAA.Checked = instance.GlobalSettings["use_multi_sampling"]; tbDrawDistance.Value = Utils.Clamp(Instance.GlobalSettings["draw_distance"].AsInteger(), tbDrawDistance.Minimum, tbDrawDistance.Maximum); lblDrawDistance.Text = string.Format("Draw distance: {0}", tbDrawDistance.Value); cbWaterReflections.Enabled = RenderSettings.HasMultiTexturing && RenderSettings.HasShaders; if (cbWaterReflections.Enabled) { cbWaterReflections.Checked = instance.GlobalSettings["water_reflections"]; } cbOcclusionCulling.Checked = Instance.GlobalSettings["rendering_occlusion_culling_enabled"]; cbShiny.Checked = Instance.GlobalSettings["scene_viewer_shiny"]; cbVBO.Checked = Instance.GlobalSettings["rendering_use_vbo"]; }
public CommandsManager(RadegastInstance inst) { instance = inst; AddCmd("help", "Shows help info", "help help", (name, cmdargs, writeline) => { string args = String.Join(" ", cmdargs); Help(args, writeline); lock (InterpretersLoaded) foreach (ICommandInterpreter manager in InterpretersLoaded) { manager.Help(args, writeline); } }); _commandWorker = new Thread(CommandsManager_CommandWorker) { Name = "CommandsManager Worker", IsBackground = true }; _commandWorker.Start(); }
public void StopPlugin(RadegastInstance instance) { List <RadegastTab> toRemove = new List <RadegastTab>(); foreach (RadegastTab tab in this.instance.TabConsole.Tabs.Values) { if (tab.Control is RelayConsole) { toRemove.Add(tab); } } foreach (var tab in toRemove) { tab.Close(); } if (IRCButton != null) { IRCButton.Dispose(); IRCButton = null; } }
public MediaManager(RadegastInstance instance) : base() { this.Instance = instance; manager = this; if (MainProgram.CommandLineOpts.DisableSound) { soundSystemAvailable = false; return; } endCallback = new FMOD.CHANNEL_CALLBACK(DispatchEndCallback); allBuffers = new Dictionary <UUID, BufferSound>(); // Start the background thread that does all the FMOD calls. soundThread = new Thread(CommandLoop) { IsBackground = true, Name = "SoundThread" }; soundThread.Start(); // Start the background thread that updates listerner position. listenerThread = new Thread(ListenerUpdate) { IsBackground = true, Name = "ListenerThread" }; listenerThread.Start(); Instance.ClientChanged += new EventHandler <ClientChangedEventArgs>(Instance_ClientChanged); // Wait for init to complete initDone.WaitOne(); initDone = null; }
/// <summary> /// For simple creation of new commands /// </summary> /// <param name="inst"></param> /// <param name="exec"></param> public RadegastCommand(RadegastInstance inst, CommandExecuteDelegate exec) { Instance = inst; _execute = exec; }
public CogbotRadegastPlugin(RadegastInstance instance) { RadegastInstance = instance; }
public SceneWindow(RadegastInstance instance) : base(instance) { InitializeComponent(); this.Instance = instance; this.Client = instance.Client; UseMultiSampling = Instance.GlobalSettings["use_multi_sampling"]; genericTaskThread = new Thread(new ThreadStart(GenericTaskRunner)); genericTaskThread.IsBackground = true; genericTaskThread.Name = "Generic task queue"; genericTaskThread.Start(); renderer = new MeshmerizerR(); renderTimer = new System.Diagnostics.Stopwatch(); renderTimer.Start(); // Camera initial setting Camera = new Camera(); InitCamera(); SetWaterPlanes(); chatOverlay = new ChatOverlay(instance, this); cbChatType.SelectedIndex = 1; DrawDistance = Instance.GlobalSettings["draw_distance"]; pnlDebug.Visible = Instance.GlobalSettings["scene_viewer_debug_panel"]; Client.Objects.TerseObjectUpdate += new EventHandler<TerseObjectUpdateEventArgs>(Objects_TerseObjectUpdate); Client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_ObjectUpdate); Client.Objects.AvatarUpdate += new EventHandler<AvatarUpdateEventArgs>(Objects_AvatarUpdate); Client.Network.RegisterCallback(PacketType.KillObject, KillObjectHandler); Client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged); Client.Terrain.LandPatchReceived += new EventHandler<LandPatchReceivedEventArgs>(Terrain_LandPatchReceived); Client.Avatars.AvatarAnimation += new EventHandler<AvatarAnimationEventArgs>(AvatarAnimationChanged); Client.Avatars.AvatarAppearance += new EventHandler<AvatarAppearanceEventArgs>(Avatars_AvatarAppearance); Client.Appearance.AppearanceSet += new EventHandler<AppearanceSetEventArgs>(Appearance_AppearanceSet); Instance.Netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(Netcom_ClientDisconnected); Application.Idle += new EventHandler(Application_Idle); }
/// <summary> /// Plugin start-up entry. /// </summary> /// <param name="inst"></param> /// <remarks>Called by Radegast at start-up</remarks> public void StartPlugin(RadegastInstance inst) { instance = inst; // Get configuration settings, and initialize if not found. config = instance.GlobalSettings["plugin.speech"] as OSDMap; if (config == null) { config = new OSDMap(); config["enabled"] = new OSDBoolean(false); config["voices"] = new OSDMap(); config["properties"] = new OSDMap(); config["substitutions"] = new OSDMap(); instance.GlobalSettings["plugin.speech"] = config; } if (!config.ContainsKey("enabled_for_inventory")) { config["enabled_for_inventory"] = true; } if (!config.ContainsKey("enabled_for_objects")) { config["enabled_for_objects"] = true; } if (!config.ContainsKey("enabled_for_friends")) { config["enabled_for_friends"] = true; } OSDMap props = (OSDMap)config["properties"]; if (props["voice_speed"] == "") { props["voice_speed"] = "medium"; } #region Buttons on the plugin menu // SpeechButton = new ToolStripMenuItem("Speech", null, OnSpeechMenuButtonClicked); SpeechButton = new ToolStripMenuItem("Speech"); instance.MainForm.PluginsMenu.DropDownItems.Add(SpeechButton); SpeechButton.Checked = config["enabled"].AsBoolean(); // Enabled sub menu { ToolStripMenuItem button = new ToolStripMenuItem("Enabled", null, (sender, e) => { OnSpeechMenuButtonClicked(SpeechButton, EventArgs.Empty); ((ToolStripMenuItem)sender).Checked = SpeechButton.Checked; }); button.Checked = SpeechButton.Checked; SpeechButton.DropDownItems.Add(button); } SpeechButton.DropDownItems.Add(new ToolStripSeparator()); // Voice rate { ToolStripMenuItem slowButton = new ToolStripMenuItem("Slow"); slowButton.Name = "slow"; if (props["voice_speed"] == "slow") { slowButton.Checked = true; } ToolStripMenuItem mediumButton = new ToolStripMenuItem("Medium"); if (props["voice_speed"] == "medium") { mediumButton.Checked = true; } mediumButton.Name = "medium"; ToolStripMenuItem fastButton = new ToolStripMenuItem("Fast"); if (props["voice_speed"] == "fast") { fastButton.Checked = true; } fastButton.Name = "fast"; slowButton.Click += (sender, e) => { slowButton.Checked = !slowButton.Checked; if (slowButton.Checked) { props["voice_speed"] = "slow"; mediumButton.Checked = false; fastButton.Checked = false; } }; mediumButton.Click += (sender, e) => { mediumButton.Checked = !mediumButton.Checked; if (mediumButton.Checked) { props["voice_speed"] = "medium"; slowButton.Checked = false; fastButton.Checked = false; } }; fastButton.Click += (sender, e) => { fastButton.Checked = !fastButton.Checked; if (fastButton.Checked) { props["voice_speed"] = "fast"; slowButton.Checked = false; mediumButton.Checked = false; } }; SpeechButton.DropDownItems.Add(slowButton); SpeechButton.DropDownItems.Add(mediumButton); SpeechButton.DropDownItems.Add(fastButton); } SpeechButton.DropDownItems.Add(new ToolStripSeparator()); // Enable / disable for inventory tab { ToolStripMenuItem button = new ToolStripMenuItem("Inventory", null, (sender, e) => { var me = (ToolStripMenuItem)sender; me.Checked = !me.Checked; config["enabled_for_inventory"] = me.Checked; }); button.Name = "speech_for_inventory"; button.AccessibleName = "Speech for inventory"; button.Checked = config["enabled_for_inventory"].AsBoolean(); SpeechButton.DropDownItems.Add(button); } // Enable / disable for objects tab { ToolStripMenuItem button = new ToolStripMenuItem("Objects", null, (sender, e) => { var me = (ToolStripMenuItem)sender; me.Checked = !me.Checked; config["enabled_for_objects"] = me.Checked; }); button.Name = "speech_for_objects"; button.AccessibleName = "Speech for objects"; button.Checked = config["enabled_for_objects"].AsBoolean(); SpeechButton.DropDownItems.Add(button); } // Enable / disable for friends tab { ToolStripMenuItem button = new ToolStripMenuItem("Friends", null, (sender, e) => { var me = (ToolStripMenuItem)sender; me.Checked = !me.Checked; config["enabled_for_friends"] = me.Checked; }); button.Name = "speech_for_friends"; button.AccessibleName = "Speech for friends"; button.Checked = config["enabled_for_friends"].AsBoolean(); SpeechButton.DropDownItems.Add(button); } SpeechButton.DropDownItems.Add(new ToolStripSeparator()); // 3D Sound sub menu { ToolStripMenuItem button = new ToolStripMenuItem("3D Sound", null, (sender, e) => { var me = (ToolStripMenuItem)sender; me.Checked = !me.Checked; config["3d_sound"] = me.Checked; instance.GlobalSettings.Save(); Radegast.Media.Speech.Surround = me.Checked; }); button.Checked = config["3d_sound"].AsBoolean(); Radegast.Media.Speech.Surround = button.Checked; SpeechButton.DropDownItems.Add(button); } #endregion Buttons on the plugin menu if (SpeechButton.Checked) { Initialize(); } instance.GlobalSettings.Save(); instance.MainForm.KeyDown += MainForm_KeyDown; }
public void StartInterpreter(RadegastInstance inst) { instance = inst; }
public RelayConsole(RadegastInstance instance) : base(instance) { InitializeComponent(); Disposed += RelayConsole_Disposed; textPrinter = new RichTextBoxPrinter(rtbChatText); // Get configuration settings, and initialize if not found. config = instance.GlobalSettings["plugin.irc"] as OSDMap; if (config == null) { config = new OSDMap(); config["server"] = new OSDString("irc.freenode.net"); config["port"] = new OSDInteger(6667); config["nick"] = new OSDString(string.Empty); config["channel"] = new OSDString("#"); config["send_delay"] = new OSDInteger(200); config["auto_reconnect"] = new OSDBoolean(true); config["ctcp_version"] = new OSDString("Radegast IRC"); instance.GlobalSettings["plugin.irc"] = config; } if (!config.ContainsKey("server")) { config["server"] = new OSDString("irc.freenode.net"); } if (!config.ContainsKey("port")) { config["port"] = new OSDInteger(6667); } if (!config.ContainsKey("nick")) { config["nick"] = new OSDString(instance.Client.Self.Name); } if (!config.ContainsKey("channel")) { config["channel"] = new OSDString("#"); } if (!config.ContainsKey("send_delay")) { config["send_delay"] = new OSDInteger(200); } if (!config.ContainsKey("auto_reconnect")) { config["auto_reconnect"] = new OSDBoolean(true); } if (!config.ContainsKey("ctcp_version")) { config["ctcp_version"] = new OSDString("Radegast IRC"); } txtChan.Text = config["channel"].AsString(); txtNick.Text = config["nick"].AsString(); txtPort.Text = config["port"].AsString(); txtServer.Text = config["server"].AsString(); irc = new IrcClient(); irc.SendDelay = config["send_delay"].AsInteger(); irc.AutoReconnect = config["auto_reconnect"].AsBoolean(); irc.CtcpVersion = config["ctcp_version"].AsString(); irc.Encoding = Encoding.UTF8; TC.OnTabAdded += TC_OnTabAdded; TC.OnTabRemoved += TC_OnTabRemoved; irc.OnError += irc_OnError; irc.OnRawMessage += irc_OnRawMessage; irc.OnChannelMessage += irc_OnChannelMessage; irc.OnConnected += irc_OnConnected; irc.OnDisconnected += irc_OnDisconnected; client.Self.IM += Self_IM; client.Self.ChatFromSimulator += Self_ChatFromSimulator; UpdateGui(); RefreshGroups(); }
public void StopPlugin(RadegastInstance inst) { inst.TabConsole.MainChatManger.ChatLineAdded -= MainChatManger_ChatLineAdded; }
public void StartCommand(RadegastInstance inst) { instance = inst; instance.CommandsManager.CommandsByName.Add("kill", this); instance.CommandsManager.CommandsByName.Add("threads", this); }
public void StopPlugin(RadegastInstance inst) { _mainTimer.Stop(); }
/// <summary> /// Called when the plugin manager unloads our plugin. /// Close the tab if it's active and remove the menu button /// </summary> /// <param name="inst"></param> public void StopPlugin(RadegastInstance inst) { ActivateTabButton.Dispose(); instance.TabConsole.Tabs[tabID].Close(); }
public SceneWindow(RadegastInstance instance) : base(instance) { InitializeComponent(); Disposed += new EventHandler(frmPrimWorkshop_Disposed); this.Instance = instance; this.Client = instance.Client; UseMultiSampling = cbAA.Checked = instance.GlobalSettings["use_multi_sampling"]; cbAA.CheckedChanged += cbAA_CheckedChanged; this.instance = instance; genericTaskThread = new Thread(new ThreadStart(GenericTaskRunner)); genericTaskThread.IsBackground = true; genericTaskThread.Name = "Generic task queue"; genericTaskThread.Start(); renderer = new MeshmerizerR(); renderTimer = new System.Diagnostics.Stopwatch(); renderTimer.Start(); // Camera initial setting Camera = new Camera(); InitCamera(); tbDrawDistance.Value = (int)DrawDistance; lblDrawDistance.Text = string.Format("Draw distance: {0}", tbDrawDistance.Value); Client.Objects.TerseObjectUpdate += new EventHandler<TerseObjectUpdateEventArgs>(Objects_TerseObjectUpdate); Client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_ObjectUpdate); Client.Objects.ObjectDataBlockUpdate += new EventHandler<ObjectDataBlockUpdateEventArgs>(Objects_ObjectDataBlockUpdate); Client.Objects.KillObject += new EventHandler<KillObjectEventArgs>(Objects_KillObject); Client.Network.SimChanged += new EventHandler<SimChangedEventArgs>(Network_SimChanged); Client.Terrain.LandPatchReceived += new EventHandler<LandPatchReceivedEventArgs>(Terrain_LandPatchReceived); Client.Avatars.AvatarAnimation += new EventHandler<AvatarAnimationEventArgs>(AvatarAnimationChanged); Client.Avatars.AvatarAppearance += new EventHandler<AvatarAppearanceEventArgs>(Avatars_AvatarAppearance); Client.Appearance.AppearanceSet += new EventHandler<AppearanceSetEventArgs>(Appearance_AppearanceSet); Instance.Netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(Netcom_ClientDisconnected); Application.Idle += new EventHandler(Application_Idle); }
public void StartPlugin(RadegastInstance inst) { Instance = inst; Instance.ClientChanged += new EventHandler <ClientChangedEventArgs>(Instance_ClientChanged); if (!Instance.GlobalSettings.Keys.Contains("plugin.alice.enabled")) { Instance.GlobalSettings["plugin.alice.enabled"] = OSD.FromBoolean(Enabled); } else { Enabled = Instance.GlobalSettings["plugin.alice.enabled"].AsBoolean(); } if (!Instance.GlobalSettings.Keys.Contains("plugin.alice.disableOnStart")) { Instance.GlobalSettings["plugin.alice.disableOnStart"] = OSD.FromBoolean(DisableOnStart); } else { DisableOnStart = Instance.GlobalSettings["plugin.alice.disableOnStart"].AsBoolean(); } if (DisableOnStart) { Enabled = false; } btn_DisableOnStart = new ToolStripMenuItem("Disable on start", null, (object sender, EventArgs e) => { DisableOnStart = btn_DisableOnStart.Checked = !DisableOnStart; Instance.GlobalSettings["plugin.alice.disableOnStart"] = OSD.FromBoolean(DisableOnStart); }); btn_DisableOnStart.Checked = DisableOnStart; EnabledButton = new ToolStripMenuItem("Enabled", null, (object sender, EventArgs e) => { Enabled = SetEnabled(!Enabled); EnabledButton.Checked = MenuButton.Checked = Enabled; Instance.GlobalSettings["plugin.alice.enabled"] = OSD.FromBoolean(Enabled); }); if (!Instance.GlobalSettings.Keys.Contains("plugin.alice.respondWithoutName")) { Instance.GlobalSettings["plugin.alice.respondWithoutName"] = OSD.FromBoolean(respondWithoutName); } else { respondWithoutName = Instance.GlobalSettings["plugin.alice.respondWithoutName"].AsBoolean(); } respondWithoutNameButton = new ToolStripMenuItem("Respond without name", null, (object sender, EventArgs e) => { respondWithoutName = respondWithoutNameButton.Checked = !respondWithoutName; Instance.GlobalSettings["plugin.alice.respondWithoutName"] = OSD.FromBoolean(respondWithoutName); }); if (!Instance.GlobalSettings.Keys.Contains("plugin.alice.respondRange")) { Instance.GlobalSettings["plugin.alice.respondRange"] = respondRange; } else { respondRange = Instance.GlobalSettings["plugin.alice.respondRange"]; } distance_5m = new ToolStripMenuItem("5m range", null, (object sender, EventArgs e) => { distance_5m.Checked = !distance_5m.Checked; if (distance_5m.Checked) { respondRange = 5; distance_10m.Checked = false; distance_15m.Checked = false; distance_20m.Checked = false; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } else if (!distance_10m.Checked && !distance_15m.Checked && !distance_20m.Checked) { respondRange = -1; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } }); distance_10m = new ToolStripMenuItem("10m range", null, (object sender, EventArgs e) => { distance_10m.Checked = !distance_10m.Checked; if (distance_10m.Checked) { respondRange = 10; distance_5m.Checked = false; distance_15m.Checked = false; distance_20m.Checked = false; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } else if (!distance_5m.Checked && !distance_15m.Checked && !distance_20m.Checked) { respondRange = -1; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } }); distance_15m = new ToolStripMenuItem("15m range", null, (object sender, EventArgs e) => { distance_15m.Checked = !distance_15m.Checked; if (distance_15m.Checked) { respondRange = 15; distance_5m.Checked = false; distance_10m.Checked = false; distance_20m.Checked = false; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } else if (!distance_5m.Checked && !distance_10m.Checked && !distance_20m.Checked) { respondRange = -1; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } }); distance_20m = new ToolStripMenuItem("20m range", null, (object sender, EventArgs e) => { distance_20m.Checked = !distance_20m.Checked; if (distance_20m.Checked) { respondRange = 20; distance_5m.Checked = false; distance_10m.Checked = false; distance_15m.Checked = false; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } else if (!distance_5m.Checked && !distance_10m.Checked && !distance_15m.Checked) { respondRange = -1; Instance.GlobalSettings["plugin.alice.respondRange"] = OSD.FromReal(respondRange); } }); if (!Instance.GlobalSettings.ContainsKey("plugin.alice.shout2shout")) { Instance.GlobalSettings["plugin.alice.shout2shout"] = OSD.FromBoolean(shout2shout); } else { shout2shout = Instance.GlobalSettings["plugin.alice.shout2shout"].AsBoolean(); } btn_shout2shout = new ToolStripMenuItem("Shout response to Shout", null, (object sender, EventArgs e) => { shout2shout = btn_shout2shout.Checked = !shout2shout; Instance.GlobalSettings["plugin.alice.shout2shout"] = OSD.FromBoolean(shout2shout); }); if (!Instance.GlobalSettings.ContainsKey("plugin.alice.whisper2whisper")) { Instance.GlobalSettings["plugin.alice.whisper2whisper"] = OSD.FromBoolean(whisper2whisper); } else { whisper2whisper = Instance.GlobalSettings["plugin.alice.whisper2whisper"].AsBoolean(); } btn_whisper2whisper = new ToolStripMenuItem("Whisper response to Whisper", null, (object sender, EventArgs e) => { whisper2whisper = btn_whisper2whisper.Checked = !whisper2whisper; Instance.GlobalSettings["plugin.alice.whisper2whisper"] = OSD.FromBoolean(whisper2whisper); }); MenuButton = new ToolStripMenuItem("ALICE chatbot", null, (object sender, EventArgs e) => { Enabled = SetEnabled(!Enabled); EnabledButton.Checked = MenuButton.Checked = Enabled; Instance.GlobalSettings["plugin.alice.enabled"] = OSD.FromBoolean(Enabled); }); btn_enableDelay = new ToolStripMenuItem("Enable random delay", null, (sender, e) => { btn_enableDelay.Checked = !btn_enableDelay.Checked; Instance.GlobalSettings["plugin.alice.enable_delay"] = EnableRandomDelay = btn_enableDelay.Checked; }); btn_enableDelay.Checked = EnableRandomDelay = Instance.GlobalSettings["plugin.alice.enable_delay"]; Instance.MainForm.PluginsMenu.DropDownItems.Add(MenuButton); Instance.MainForm.PluginsMenu.Visible = true; MenuButton.DropDownItems.Add(EnabledButton); MenuButton.Checked = EnabledButton.Checked = Enabled; MenuButton.DropDownItems.Add(respondWithoutNameButton); MenuButton.DropDownItems.Add(distance_5m); MenuButton.DropDownItems.Add(distance_10m); MenuButton.DropDownItems.Add(distance_15m); MenuButton.DropDownItems.Add(distance_20m); MenuButton.DropDownItems.Add(btn_shout2shout); MenuButton.DropDownItems.Add(btn_whisper2whisper); respondWithoutNameButton.Checked = respondWithoutName; if (respondRange == 5.0) { distance_5m.Checked = true; } else if (respondRange == 10.0) { distance_10m.Checked = true; } else if (respondRange == 15.0) { distance_15m.Checked = true; } else if (respondRange == 20.0) { distance_20m.Checked = true; } btn_shout2shout.Checked = shout2shout; btn_whisper2whisper.Checked = whisper2whisper; MenuButton.DropDownItems.Add(btn_enableDelay); MenuButton.DropDownItems.Add(btn_DisableOnStart); MenuButton.DropDownItems.Add("Reload AIML", null, (object sender, EventArgs e) => { Alice = null; GC.Collect(); LoadALICE(); }); SetEnabled(Enabled); // Events RegisterClientEvents(Client); }
public void StopPlugin(RadegastInstance inst) { inst.Client.Self.IM -= Self_IM; }
public void StopInterpreter(RadegastInstance inst) { Dispose(); }
public void StartCommand(RadegastInstance inst) { instance = inst; }
/// <summary> /// Builds a composited terrain texture given the region texture /// and heightmap settings /// </summary> /// <param name="heightmap">Terrain heightmap</param> /// <param name="regionInfo">Region information including terrain texture parameters</param> /// <returns>A composited 256x256 RGB texture ready for rendering</returns> /// <remarks>Based on the algorithm described at http://opensimulator.org/wiki/Terrain_Splatting /// </remarks> public static Bitmap Splat(RadegastInstance instance, float[,] heightmap, UUID[] textureIDs, float[] startHeights, float[] heightRanges) { Debug.Assert(textureIDs.Length == 4); Debug.Assert(startHeights.Length == 4); Debug.Assert(heightRanges.Length == 4); int outputSize = 2048; Bitmap[] detailTexture = new Bitmap[4]; // Swap empty terrain textureIDs with default IDs for (int i = 0; i < textureIDs.Length; i++) { if (textureIDs[i] == UUID.Zero) { textureIDs[i] = DEFAULT_TERRAIN_DETAIL[i]; } } #region Texture Fetching for (int i = 0; i < 4; i++) { AutoResetEvent textureDone = new AutoResetEvent(false); UUID textureID = textureIDs[i]; instance.Client.Assets.RequestImage(textureID, TextureDownloadCallback(detailTexture, i, textureDone)); textureDone.WaitOne(60 * 1000, false); } #endregion Texture Fetching // Fill in any missing textures with a solid color for (int i = 0; i < 4; i++) { if (detailTexture[i] == null) { // Create a solid color texture for this layer detailTexture[i] = new Bitmap(outputSize, outputSize, PixelFormat.Format24bppRgb); using (Graphics gfx = Graphics.FromImage(detailTexture[i])) { using (SolidBrush brush = new SolidBrush(DEFAULT_TERRAIN_COLOR[i])) gfx.FillRectangle(brush, 0, 0, outputSize, outputSize); } } else if (detailTexture[i].Width != outputSize || detailTexture[i].Height != outputSize) { detailTexture[i] = ResizeBitmap(detailTexture[i], 256, 256); } } #region Layer Map int diff = heightmap.GetLength(0) / RegionSize; float[] layermap = new float[RegionSize * RegionSize]; for (int y = 0; y < heightmap.GetLength(0); y += diff) { for (int x = 0; x < heightmap.GetLength(1); x += diff) { int newX = x / diff; int newY = y / diff; float height = heightmap[newX, newY]; float pctX = (float)newX / 255f; float pctY = (float)newY / 255f; // Use bilinear interpolation between the four corners of start height and // height range to select the current values at this position float startHeight = ImageUtils.Bilinear( startHeights[0], startHeights[2], startHeights[1], startHeights[3], pctX, pctY); startHeight = Utils.Clamp(startHeight, 0f, 255f); float heightRange = ImageUtils.Bilinear( heightRanges[0], heightRanges[2], heightRanges[1], heightRanges[3], pctX, pctY); heightRange = Utils.Clamp(heightRange, 0f, 255f); // Generate two frequencies of perlin noise based on our global position // The magic values were taken from http://opensimulator.org/wiki/Terrain_Splatting Vector3 vec = new Vector3 ( newX * 0.20319f, newY * 0.20319f, height * 0.25f ); float lowFreq = Perlin.noise2(vec.X * 0.222222f, vec.Y * 0.222222f) * 6.5f; float highFreq = Perlin.turbulence2(vec.X, vec.Y, 2f) * 2.25f; float noise = (lowFreq + highFreq) * 2f; // Combine the current height, generated noise, start height, and height range parameters, then scale all of it float layer = ((height + noise - startHeight) / heightRange) * 4f; if (Single.IsNaN(layer)) { layer = 0f; } layermap[newY * RegionSize + newX] = Utils.Clamp(layer, 0f, 3f); } } #endregion Layer Map #region Texture Compositing Bitmap output = new Bitmap(outputSize, outputSize, PixelFormat.Format24bppRgb); BitmapData outputData = output.LockBits(new Rectangle(0, 0, outputSize, outputSize), ImageLockMode.WriteOnly, PixelFormat.Format24bppRgb); unsafe { // Get handles to all of the texture data arrays BitmapData[] datas = new BitmapData[] { detailTexture[0].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[0].PixelFormat), detailTexture[1].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[1].PixelFormat), detailTexture[2].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[2].PixelFormat), detailTexture[3].LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.ReadOnly, detailTexture[3].PixelFormat) }; int[] comps = new int[] { (datas[0].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, (datas[1].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, (datas[2].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3, (datas[3].PixelFormat == PixelFormat.Format32bppArgb) ? 4 : 3 }; int[] strides = new int[] { datas[0].Stride, datas[1].Stride, datas[2].Stride, datas[3].Stride }; IntPtr[] scans = new IntPtr[] { datas[0].Scan0, datas[1].Scan0, datas[2].Scan0, datas[3].Scan0 }; int ratio = outputSize / RegionSize; for (int y = 0; y < outputSize; y++) { for (int x = 0; x < outputSize; x++) { float layer = layermap[(y / ratio) * RegionSize + x / ratio]; float layerx = layermap[(y / ratio) * RegionSize + Math.Min(outputSize - 1, (x + 1)) / ratio]; float layerxx = layermap[(y / ratio) * RegionSize + Math.Max(0, (x - 1)) / ratio]; float layery = layermap[Math.Min(outputSize - 1, (y + 1)) / ratio * RegionSize + x / ratio]; float layeryy = layermap[(Math.Max(0, (y - 1)) / ratio) * RegionSize + x / ratio]; // Select two textures int l0 = (int)Math.Floor(layer); int l1 = Math.Min(l0 + 1, 3); byte *ptrA = (byte *)scans[l0] + (y % 256) * strides[l0] + (x % 256) * comps[l0]; byte *ptrB = (byte *)scans[l1] + (y % 256) * strides[l1] + (x % 256) * comps[l1]; byte *ptrO = (byte *)outputData.Scan0 + y * outputData.Stride + x * 3; float aB = *(ptrA + 0); float aG = *(ptrA + 1); float aR = *(ptrA + 2); int lX = (int)Math.Floor(layerx); byte *ptrX = (byte *)scans[lX] + (y % 256) * strides[lX] + (x % 256) * comps[lX]; int lXX = (int)Math.Floor(layerxx); byte *ptrXX = (byte *)scans[lXX] + (y % 256) * strides[lXX] + (x % 256) * comps[lXX]; int lY = (int)Math.Floor(layery); byte *ptrY = (byte *)scans[lY] + (y % 256) * strides[lY] + (x % 256) * comps[lY]; int lYY = (int)Math.Floor(layeryy); byte *ptrYY = (byte *)scans[lYY] + (y % 256) * strides[lYY] + (x % 256) * comps[lYY]; float bB = *(ptrB + 0); float bG = *(ptrB + 1); float bR = *(ptrB + 2); float layerDiff = layer - l0; float xlayerDiff = layerx - layer; float xxlayerDiff = layerxx - layer; float ylayerDiff = layery - layer; float yylayerDiff = layeryy - layer; // Interpolate between the two selected textures *(ptrO + 0) = (byte)Math.Floor(aB + layerDiff * (bB - aB) + xlayerDiff * (*ptrX - aB) + xxlayerDiff * (*(ptrXX) - aB) + ylayerDiff * (*ptrY - aB) + yylayerDiff * (*(ptrYY) - aB)); *(ptrO + 1) = (byte)Math.Floor(aG + layerDiff * (bG - aG) + xlayerDiff * (*(ptrX + 1) - aG) + xxlayerDiff * (*(ptrXX + 1) - aG) + ylayerDiff * (*(ptrY + 1) - aG) + yylayerDiff * (*(ptrYY + 1) - aG)); *(ptrO + 2) = (byte)Math.Floor(aR + layerDiff * (bR - aR) + xlayerDiff * (*(ptrX + 2) - aR) + xxlayerDiff * (*(ptrXX + 2) - aR) + ylayerDiff * (*(ptrY + 2) - aR) + yylayerDiff * (*(ptrYY + 2) - aR)); } } for (int i = 0; i < 4; i++) { detailTexture[i].UnlockBits(datas[i]); detailTexture[i].Dispose(); } } layermap = null; output.UnlockBits(outputData); output.RotateFlip(RotateFlipType.Rotate270FlipNone); #endregion Texture Compositing return(output); }
public TextRendering(RadegastInstance instance) { this.Instance = instance; textItems = new List<TextItem>(); }
public void StartPlugin(RadegastInstance inst) { Instance = inst; Instance.Netcom.InstantMessageReceived += Netcom_InstantMessageReceived; }
public void StartCommand(RadegastInstance inst) { instance = inst; instance.CommandsManager.CommandsByName.Add("kill", this); instance.CommandsManager.CommandsByName.Add("threads", this); }
public void StartInterpreter(RadegastInstance inst) { RadegastInstance = inst; }
/// <summary> /// Plugin shut-down entry /// </summary> /// <param name="inst"></param> /// <remarks>Called by Radegast at shut-down, or when Speech is switched off. /// We use this to release system resources.</remarks> public void StopPlugin(RadegastInstance inst) { instance.MainForm.KeyDown -= MainForm_KeyDown; SpeechButton.Dispose(); Shutdown(); }
public void StopPlugin(RadegastInstance instance) { // kill timer timer.Dispose(); EVOButton.Dispose(); // unregister inventory receiver events client.Inventory.ItemReceived -= Inventory_ItemReceived; client.Inventory.InventoryObjectOffered -= Inventory_InventoryObjectOffered; }
public RenderTerrain(RadegastInstance instance) { this.Instance = instance; renderer = new MeshmerizerR(); }
/// <summary> /// Plugin loader calls this at the time plugin gets created /// We add a button to the Plugins menu on the main window /// for this tab /// </summary> /// <param name="inst">Main RadegastInstance</param> public void StartPlugin(RadegastInstance inst) { this.instance = inst; ActivateTabButton = new ToolStripMenuItem(tabLabel, null, MenuButtonClicked); instance.MainForm.PluginsMenu.DropDownItems.Add(ActivateTabButton); }
public void StopInterpreter(RadegastInstance inst) { Dispose(); }
public void StopPlugin(RadegastInstance inst) { // throw new NotImplementedException(); }
public void StartPlugin0(RadegastInstance inst) { RadegastInstance = inst; Control.CheckForIllegalCrossThreadCalls = false; AddRadegastEvents(); CogbotContextMenuListener = new CogbotContextMenuListener(); CogbotNoticeuListener = new CogbotNotificationListener(); if (ClientManagerConfig.UsingRadegastFromCogbot) { // just unregister events for now inst.Netcom.Dispose(); clientManager = ClientManager.SingleInstance ?? new ClientManager(); // _theBot = clientManager.LastBotClient; } else { if (!plugInitCalledEver) { CogbotGUI.GlobalRadegastInstance = inst; } ClientManagerConfig.UsingCogbotFromRadegast = true; clientManager = ClientManager.SingleInstance ?? new ClientManager(); } BotClient bc = clientManager.EnsureBotByGridClient(inst.Client); bc.TheRadegastInstance = inst; _theBot = bc; cogbotRadegastInterpreter = new CogbotRadegastInterpreter(this); RadegastInstance.CommandsManager.LoadInterpreter(cogbotRadegastInterpreter); _commandContextAction = new CommandContextAction(inst, this); _commandContextAction.ScanCogbotMenu(); inst.TabConsole.RegisterContextAction(_commandContextAction); _aspectContextAction = new AspectContextAction(inst, this); inst.TabConsole.RegisterContextAction(_aspectContextAction); _simUsageContextAction = new SimUsageContextAction(inst, this); inst.TabConsole.RegisterContextAction(_simUsageContextAction); //if (ClientManager.UsingRadgastFromCogbot) return; inst.Client.Settings.MULTIPLE_SIMS = true; clientManager.outputDelegate = System.Console.Out.WriteLine; GUIInvoke(() => SetupRadegastGUI(inst)); DLRConsole.SafelyRun(() => clientManager.ProcessCommandArgs()); chatConsole.StartWriter(); if (!bc.IsLoggedInAndReady) { TheBot.InvokeNext("Re-enable login button", () => { TheBot.DebugWriteLine("SetLoginButton = r-enabled"); SetLoginButton(OldLoginText, true); }); } if (plugInitCalledEver) { return; } plugInitCalledEver = true; if (ClientManagerConfig.StartLispThreadAtPluginInit) { RunClientManagerStartupLisp(); } }
public RenderTerrain(RadegastInstance instance) { this.Instance = instance; renderer = new MeshmerizerR(); }
/// <summary> /// For simple creation of new commands /// </summary> /// <param name="inst"></param> public RadegastCommand(RadegastInstance inst) { Instance = inst; _execute = null; }
public void StopPlugin(RadegastInstance inst) { }
public virtual void StartCommand(RadegastInstance inst) { Instance = inst; }
public void StopPlugin(RadegastInstance inst) { Instance.Netcom.InstantMessageReceived -= Netcom_InstantMessageReceived; }
public void Dispose() { instance = null; }
public void StopPlugin(RadegastInstance inst) { inst.Client.Network.SimChanged -= Network_SimChanged; inst.Client.Parcels.ParcelProperties -= Parcels_ParcelProperties; inst.Client.Parcels.ParcelInfoReply -= Parcels_ParcelInfoReply; }
public TextRendering(RadegastInstance instance) { Instance = instance; textItems = new List <TextItem>(); }
public LSLHelper(RadegastInstance instance) { this.instance = instance; }
public void StartPlugin(RadegastInstance inst) { instance = inst; instance.MainForm.TabConsole.DisplayNotificationInChat(pluginName + " version " + version + " loaded"); Init(); EVOButton = new ToolStripMenuItem(tabLabel, null, OnEVOButtonClicked); instance.MainForm.PluginsMenu.DropDownItems.Add(EVOButton); // setup timer timer = new System.Threading.Timer(new TimerCallback(productCallback)); this.SetupTimer(); // invenotry receiving client.Inventory.ItemReceived += Inventory_ItemReceived; client.Inventory.InventoryObjectOffered +=Inventory_InventoryObjectOffered; }
public void Dispose() { foreach (var cmd in _commandThreads) { try { cmd.Abort(); } catch (Exception) { } } instance = null; }
public frmPrimWorkshop(RadegastInstance instance, uint rootLocalID) : base(instance) { this.RootPrimLocalID = rootLocalID; InitializeComponent(); Disposed += new EventHandler(frmPrimWorkshop_Disposed); AutoSavePosition = true; UseMultiSampling = cbAA.Checked = instance.GlobalSettings["use_multi_sampling"]; cbAA.CheckedChanged += cbAA_CheckedChanged; this.instance = instance; renderer = new MeshmerizerR(); textRendering = new TextRendering(instance); Client.Objects.TerseObjectUpdate += new EventHandler<TerseObjectUpdateEventArgs>(Objects_TerseObjectUpdate); Client.Objects.ObjectUpdate += new EventHandler<PrimEventArgs>(Objects_ObjectUpdate); Client.Objects.ObjectDataBlockUpdate += new EventHandler<ObjectDataBlockUpdateEventArgs>(Objects_ObjectDataBlockUpdate); }
public UriParser(RadegastInstance instance) { this.instance = instance; }