diff --git a/MosswartMassacre/MainView.cs b/MosswartMassacre/MainView.cs
new file mode 100644
index 0000000..2877688
--- /dev/null
+++ b/MosswartMassacre/MainView.cs
@@ -0,0 +1,54 @@
+using System;
+using MyClasses.MetaViewWrappers;
+
+namespace MosswartMassacre
+{
+ internal static class MainView
+ {
+ private static IView View;
+ private static IStaticText lblTotalKills;
+ private static IStaticText lblKillsPer5Min;
+ private static IStaticText lblKillsPerHour;
+
+ public static void ViewInit()
+ {
+ try
+ {
+ // Load the view from the embedded XML resource
+ View = MyClasses.MetaViewWrappers.ViewSystemSelector.CreateViewResource(
+ PluginCore.MyHost, "MosswartMassacre.ViewXML.mainView.xml");
+
+ // Get references to controls
+ lblTotalKills = (IStaticText)View["lblTotalKills"];
+ lblKillsPer5Min = (IStaticText)View["lblKillsPer5Min"];
+ lblKillsPerHour = (IStaticText)View["lblKillsPerHour"];
+
+ PluginCore.WriteToChat("View initialized.");
+ }
+ catch (Exception ex)
+ {
+ PluginCore.WriteToChat("Error initializing view: " + ex.Message);
+ }
+ }
+
+ public static void ViewDestroy()
+ {
+ try
+ {
+ View.Dispose();
+ PluginCore.WriteToChat("View destroyed.");
+ }
+ catch (Exception ex)
+ {
+ PluginCore.WriteToChat("Error destroying view: " + ex.Message);
+ }
+ }
+
+ public static void UpdateKillStats(int totalKills, double killsPer5Min, double killsPerHour)
+ {
+ lblTotalKills.Text = $"Total Kills: {totalKills}";
+ lblKillsPer5Min.Text = $"Kills per 5 Min: {killsPer5Min:F2}";
+ lblKillsPerHour.Text = $"Kills per Hour: {killsPerHour:F2}";
+ }
+ }
+}
diff --git a/MosswartMassacre/MosswartMassacre.csproj b/MosswartMassacre/MosswartMassacre.csproj
new file mode 100644
index 0000000..d7f67be
--- /dev/null
+++ b/MosswartMassacre/MosswartMassacre.csproj
@@ -0,0 +1,87 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {8C97E839-4D05-4A5F-B0C8-E8E778654322}
+ Library
+ Properties
+ MosswartMassacre
+ MosswartMassacre
+ v4.8
+ 512
+ true
+
+
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE;VVS_REFERENCED;DECAL_INTEROP
+ prompt
+ 4
+ x86
+
+
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+ lib\Decal.Adapter.dll
+ False
+
+
+ False
+ False
+ lib\Decal.Interop.Core.DLL
+
+
+ False
+ False
+ lib\Decal.Interop.Inject.dll
+
+
+
+
+
+
+
+
+
+
+
+ lib\VirindiViewService.dll
+
+
+
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/MosswartMassacre/PluginCore.cs b/MosswartMassacre/PluginCore.cs
new file mode 100644
index 0000000..4761a3b
--- /dev/null
+++ b/MosswartMassacre/PluginCore.cs
@@ -0,0 +1,141 @@
+using System;
+using System.Text.RegularExpressions;
+using Decal.Adapter;
+using Decal.Adapter.Wrappers;
+
+namespace MosswartMassacre
+{
+ [FriendlyName("Mosswart Massacre")]
+ public class PluginCore : PluginBase
+ {
+ internal static PluginHost MyHost;
+ internal static int totalKills = 0;
+ internal static DateTime lastKillTime = DateTime.Now;
+ internal static double killsPer5Min = 0;
+ internal static double killsPerHour = 0;
+ internal static DateTime statsStartTime = DateTime.Now;
+
+ protected override void Startup()
+ {
+ try
+ {
+ MyHost = Host;
+ WriteToChat("Mosswart Massacre has started!");
+
+ // Subscribe to chat message event
+ CoreManager.Current.ChatBoxMessage += new EventHandler(OnChatText);
+
+ // Initialize the view (UI)
+ MainView.ViewInit();
+ }
+ catch (Exception ex)
+ {
+ WriteToChat("Error during startup: " + ex.Message);
+ }
+ }
+
+ protected override void Shutdown()
+ {
+ try
+ {
+ WriteToChat("Mosswart Massacre is shutting down...");
+
+ // Unsubscribe from chat message event
+ CoreManager.Current.ChatBoxMessage -= new EventHandler(OnChatText);
+
+ // Clean up the view
+ MainView.ViewDestroy();
+ MyHost = null;
+ }
+ catch (Exception ex)
+ {
+ WriteToChat("Error during shutdown: " + ex.Message);
+ }
+ }
+
+ private void OnChatText(object sender, ChatTextInterceptEventArgs e)
+ {
+ try
+ {
+ if (IsKilledByMeMessage(e.Text))
+ {
+ totalKills++;
+ CalculateKillsPerInterval();
+ MainView.UpdateKillStats(totalKills, killsPer5Min, killsPerHour);
+ }
+ }
+ catch (Exception ex)
+ {
+ WriteToChat("Error processing chat message: " + ex.Message);
+ }
+ }
+
+ private void CalculateKillsPerInterval()
+ {
+ // Calculate kills per 5 minutes
+ var timeSinceLastKill = DateTime.Now - lastKillTime;
+ if (timeSinceLastKill.TotalMinutes > 0)
+ {
+ killsPer5Min = (totalKills / (DateTime.Now - statsStartTime).TotalMinutes) * 5;
+ killsPerHour = (totalKills / (DateTime.Now - statsStartTime).TotalMinutes) * 60;
+ }
+ lastKillTime = DateTime.Now;
+ }
+
+ private bool IsKilledByMeMessage(string text)
+ {
+ string[] killPatterns = new string[]
+ {
+ @"^You flatten (?.+)'s body with the force of your assault!$",
+ @"^You bring (?.+) to a fiery end!$",
+ @"^You beat (?.+) to a lifeless pulp!$",
+ @"^You smite (?.+) mightily!$",
+ @"^You obliterate (?.+)!$",
+ @"^You run (?.+) through!$",
+ @"^You reduce (?.+) to a sizzling, oozing mass!$",
+ @"^You knock (?.+) into next Morningthaw!$",
+ @"^You split (?.+) apart!$",
+ @"^You cleave (?.+) in twain!$",
+ @"^You slay (?.+) viciously enough to impart death several times over!$",
+ @"^You reduce (?.+) to a drained, twisted corpse!$",
+ @"^Your killing blow nearly turns (?.+) inside-out!$",
+ @"^Your attack stops (?.+) cold!$",
+ @"^Your lightning coruscates over (?.+)'s mortal remains!$",
+ @"^Your assault sends (?.+) to an icy death!$",
+ @"^You killed (?.+)!$",
+ @"^The thunder of crushing (?.+) is followed by the deafening silence of death!$",
+ @"^The deadly force of your attack is so strong that (?.+)'s ancestors feel it!$",
+ @"^(?.+)'s seared corpse smolders before you!$",
+ @"^(?.+) is reduced to cinders!$",
+ @"^(?.+) is shattered by your assault!$",
+ @"^(?.+) catches your attack, with dire consequences!$",
+ @"^(?.+) is utterly destroyed by your attack!$",
+ @"^(?.+) suffers a frozen fate!$",
+ @"^(?.+)'s perforated corpse falls before you!$",
+ @"^(?.+) is fatally punctured!$",
+ @"^(?.+)'s death is preceded by a sharp, stabbing pain!$",
+ @"^(?.+) is torn to ribbons by your assault!$",
+ @"^(?.+) is liquified by your attack!$",
+ @"^(?.+)'s last strength dissolves before you!$",
+ @"^Electricity tears (?.+) apart!$",
+ @"^Blistered by lightning, (?.+) falls!$",
+ @"^(?.+)'s last strength withers before you!$",
+ @"^(?.+) is dessicated by your attack!$",
+ @"^(?.+) is incinerated by your assault!$"
+ };
+
+ foreach (string pattern in killPatterns)
+ {
+ if (Regex.IsMatch(text, pattern))
+ return true;
+ }
+
+ return false;
+ }
+
+ public static void WriteToChat(string message)
+ {
+ MyHost.Actions.AddChatText("[Mosswart Massacre] " + message, 0, 1);
+ }
+ }
+}
diff --git a/MosswartMassacre/Properties/AssemblyInfo.cs b/MosswartMassacre/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..3a7c682
--- /dev/null
+++ b/MosswartMassacre/Properties/AssemblyInfo.cs
@@ -0,0 +1,30 @@
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Mosswart Massacre")]
+[assembly: AssemblyDescription("Track and report monster kills in Asheron's Call")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Mosswart Massacre Dev Team")]
+[assembly: AssemblyProduct("Mosswart Massacre Plugin")]
+[assembly: AssemblyCopyright("Copyright © 2025")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("9b6a07e1-ae78-47f4-b09c-174f6a27d7a3")]
+
+// Version information for an assembly consists of the following four values:
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
\ No newline at end of file
diff --git a/MosswartMassacre/Properties/Resources.Designer.cs b/MosswartMassacre/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..5b9fcc3
--- /dev/null
+++ b/MosswartMassacre/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+//
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+//
+//------------------------------------------------------------------------------
+
+namespace MosswartMassacre.Properties {
+ using System;
+
+
+ ///
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ ///
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Returns the cached ResourceManager instance used by this class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("MosswartMassacre.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/MosswartMassacre/Properties/Resources.resx b/MosswartMassacre/Properties/Resources.resx
new file mode 100644
index 0000000..4fdb1b6
--- /dev/null
+++ b/MosswartMassacre/Properties/Resources.resx
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/MosswartMassacre/ViewSystemSelector.cs b/MosswartMassacre/ViewSystemSelector.cs
new file mode 100644
index 0000000..5e75b7a
--- /dev/null
+++ b/MosswartMassacre/ViewSystemSelector.cs
@@ -0,0 +1,262 @@
+///////////////////////////////////////////////////////////////////////////////
+//File: ViewSystemSelector.cs
+//
+//Description: Contains the MyClasses.MetaViewWrappers.ViewSystemSelector class,
+// which is used to determine whether the Virindi View Service is enabled.
+// As with all the VVS wrappers, the VVS_REFERENCED compilation symbol must be
+// defined for the VVS code to be compiled. Otherwise, only Decal views are used.
+//
+//References required:
+// VirindiViewService (if VVS_REFERENCED is defined)
+// Decal.Adapter
+// Decal.Interop.Core
+//
+//This file is Copyright (c) 2009 VirindiPlugins
+//
+//Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+//The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+///////////////////////////////////////////////////////////////////////////////
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Reflection;
+
+#if METAVIEW_PUBLIC_NS
+namespace MetaViewWrappers
+#else
+namespace MyClasses.MetaViewWrappers
+#endif
+{
+ internal static class ViewSystemSelector
+ {
+ public enum eViewSystem
+ {
+ DecalInject,
+ VirindiViewService,
+ }
+
+
+ ///////////////////////////////System presence detection///////////////////////////////
+
+ public static bool IsPresent(Decal.Adapter.Wrappers.PluginHost pHost, eViewSystem VSystem)
+ {
+ switch (VSystem)
+ {
+ case eViewSystem.DecalInject:
+ return true;
+ case eViewSystem.VirindiViewService:
+ return VirindiViewsPresent(pHost);
+ default:
+ return false;
+ }
+ }
+ static bool VirindiViewsPresent(Decal.Adapter.Wrappers.PluginHost pHost)
+ {
+#if VVS_REFERENCED
+ System.Reflection.Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();
+
+ foreach (System.Reflection.Assembly a in asms)
+ {
+ AssemblyName nmm = a.GetName();
+ if ((nmm.Name == "VirindiViewService") && (nmm.Version >= new System.Version("1.0.0.37")))
+ {
+ try
+ {
+ return Curtain_VVS_Running();
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ return false;
+#else
+ return false;
+#endif
+ }
+ public static bool VirindiViewsPresent(Decal.Adapter.Wrappers.PluginHost pHost, Version minver)
+ {
+#if VVS_REFERENCED
+ System.Reflection.Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();
+
+ foreach (System.Reflection.Assembly a in asms)
+ {
+ AssemblyName nm = a.GetName();
+ if ((nm.Name == "VirindiViewService") && (nm.Version >= minver))
+ {
+ try
+ {
+ return Curtain_VVS_Running();
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ return false;
+#else
+ return false;
+#endif
+ }
+
+#if VVS_REFERENCED
+ static bool Curtain_VVS_Running()
+ {
+ return VirindiViewService.Service.Running;
+ }
+#endif
+
+ ///////////////////////////////CreateViewResource///////////////////////////////
+
+ public static IView CreateViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource)
+ {
+#if VVS_REFERENCED
+ if (IsPresent(pHost, eViewSystem.VirindiViewService))
+ return CreateViewResource(pHost, pXMLResource, eViewSystem.VirindiViewService);
+ else
+#endif
+ return CreateViewResource(pHost, pXMLResource, eViewSystem.DecalInject);
+ }
+ public static IView CreateViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource, eViewSystem VSystem)
+ {
+ if (!IsPresent(pHost, VSystem)) return null;
+ switch (VSystem)
+ {
+ case eViewSystem.DecalInject:
+ return CreateDecalViewResource(pHost, pXMLResource);
+ case eViewSystem.VirindiViewService:
+#if VVS_REFERENCED
+ return CreateMyHudViewResource(pHost, pXMLResource);
+#else
+ break;
+#endif
+ }
+ return null;
+ }
+ static IView CreateDecalViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource)
+ {
+ IView ret = new DecalControls.View();
+ ret.Initialize(pHost, pXMLResource);
+ return ret;
+ }
+
+#if VVS_REFERENCED
+ static IView CreateMyHudViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource)
+ {
+ IView ret = new VirindiViewServiceHudControls.View();
+ ret.Initialize(pHost, pXMLResource);
+ return ret;
+ }
+#endif
+
+
+ ///////////////////////////////CreateViewXML///////////////////////////////
+
+ public static IView CreateViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
+ {
+#if VVS_REFERENCED
+ if (IsPresent(pHost, eViewSystem.VirindiViewService))
+ return CreateViewXML(pHost, pXML, eViewSystem.VirindiViewService);
+ else
+#endif
+ return CreateViewXML(pHost, pXML, eViewSystem.DecalInject);
+ }
+
+ public static IView CreateViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML, eViewSystem VSystem)
+ {
+ if (!IsPresent(pHost, VSystem)) return null;
+ switch (VSystem)
+ {
+ case eViewSystem.DecalInject:
+ return CreateDecalViewXML(pHost, pXML);
+ case eViewSystem.VirindiViewService:
+#if VVS_REFERENCED
+ return CreateMyHudViewXML(pHost, pXML);
+#else
+ break;
+#endif
+ }
+ return null;
+ }
+ static IView CreateDecalViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
+ {
+ IView ret = new DecalControls.View();
+ ret.InitializeRawXML(pHost, pXML);
+ return ret;
+ }
+
+#if VVS_REFERENCED
+ static IView CreateMyHudViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
+ {
+ IView ret = new VirindiViewServiceHudControls.View();
+ ret.InitializeRawXML(pHost, pXML);
+ return ret;
+ }
+#endif
+
+
+ ///////////////////////////////HasChatOpen///////////////////////////////
+
+ public static bool AnySystemHasChatOpen(Decal.Adapter.Wrappers.PluginHost pHost)
+ {
+ if (IsPresent(pHost, eViewSystem.VirindiViewService))
+ if (HasChatOpen_VirindiViews()) return true;
+ if (pHost.Actions.ChatState) return true;
+ return false;
+ }
+
+ static bool HasChatOpen_VirindiViews()
+ {
+#if VVS_REFERENCED
+ if (VirindiViewService.HudView.FocusControl != null)
+ {
+ if (VirindiViewService.HudView.FocusControl.GetType() == typeof(VirindiViewService.Controls.HudTextBox))
+ return true;
+ }
+ return false;
+#else
+ return false;
+#endif
+ }
+
+ public delegate void delConditionalSplit(object data);
+ public static void ViewConditionalSplit(IView v, delConditionalSplit onDecal, delConditionalSplit onVVS, object data)
+ {
+ Type vtype = v.GetType();
+
+#if VVS_REFERENCED
+ if (vtype == typeof(VirindiViewServiceHudControls.View))
+ {
+ if (onVVS != null)
+ onVVS(data);
+ }
+#endif
+
+ if (vtype == typeof(DecalControls.View))
+ {
+ if (onDecal != null)
+ onDecal(data);
+ }
+ }
+ }
+}
diff --git a/MosswartMassacre/ViewXML/mainView.xml b/MosswartMassacre/ViewXML/mainView.xml
new file mode 100644
index 0000000..3f46a6c
--- /dev/null
+++ b/MosswartMassacre/ViewXML/mainView.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/MosswartMassacre/VirindiViews/ViewSystemSelector.cs b/MosswartMassacre/VirindiViews/ViewSystemSelector.cs
new file mode 100644
index 0000000..5e75b7a
--- /dev/null
+++ b/MosswartMassacre/VirindiViews/ViewSystemSelector.cs
@@ -0,0 +1,262 @@
+///////////////////////////////////////////////////////////////////////////////
+//File: ViewSystemSelector.cs
+//
+//Description: Contains the MyClasses.MetaViewWrappers.ViewSystemSelector class,
+// which is used to determine whether the Virindi View Service is enabled.
+// As with all the VVS wrappers, the VVS_REFERENCED compilation symbol must be
+// defined for the VVS code to be compiled. Otherwise, only Decal views are used.
+//
+//References required:
+// VirindiViewService (if VVS_REFERENCED is defined)
+// Decal.Adapter
+// Decal.Interop.Core
+//
+//This file is Copyright (c) 2009 VirindiPlugins
+//
+//Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+//The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+///////////////////////////////////////////////////////////////////////////////
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Reflection;
+
+#if METAVIEW_PUBLIC_NS
+namespace MetaViewWrappers
+#else
+namespace MyClasses.MetaViewWrappers
+#endif
+{
+ internal static class ViewSystemSelector
+ {
+ public enum eViewSystem
+ {
+ DecalInject,
+ VirindiViewService,
+ }
+
+
+ ///////////////////////////////System presence detection///////////////////////////////
+
+ public static bool IsPresent(Decal.Adapter.Wrappers.PluginHost pHost, eViewSystem VSystem)
+ {
+ switch (VSystem)
+ {
+ case eViewSystem.DecalInject:
+ return true;
+ case eViewSystem.VirindiViewService:
+ return VirindiViewsPresent(pHost);
+ default:
+ return false;
+ }
+ }
+ static bool VirindiViewsPresent(Decal.Adapter.Wrappers.PluginHost pHost)
+ {
+#if VVS_REFERENCED
+ System.Reflection.Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();
+
+ foreach (System.Reflection.Assembly a in asms)
+ {
+ AssemblyName nmm = a.GetName();
+ if ((nmm.Name == "VirindiViewService") && (nmm.Version >= new System.Version("1.0.0.37")))
+ {
+ try
+ {
+ return Curtain_VVS_Running();
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ return false;
+#else
+ return false;
+#endif
+ }
+ public static bool VirindiViewsPresent(Decal.Adapter.Wrappers.PluginHost pHost, Version minver)
+ {
+#if VVS_REFERENCED
+ System.Reflection.Assembly[] asms = AppDomain.CurrentDomain.GetAssemblies();
+
+ foreach (System.Reflection.Assembly a in asms)
+ {
+ AssemblyName nm = a.GetName();
+ if ((nm.Name == "VirindiViewService") && (nm.Version >= minver))
+ {
+ try
+ {
+ return Curtain_VVS_Running();
+ }
+ catch
+ {
+ return false;
+ }
+ }
+ }
+
+ return false;
+#else
+ return false;
+#endif
+ }
+
+#if VVS_REFERENCED
+ static bool Curtain_VVS_Running()
+ {
+ return VirindiViewService.Service.Running;
+ }
+#endif
+
+ ///////////////////////////////CreateViewResource///////////////////////////////
+
+ public static IView CreateViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource)
+ {
+#if VVS_REFERENCED
+ if (IsPresent(pHost, eViewSystem.VirindiViewService))
+ return CreateViewResource(pHost, pXMLResource, eViewSystem.VirindiViewService);
+ else
+#endif
+ return CreateViewResource(pHost, pXMLResource, eViewSystem.DecalInject);
+ }
+ public static IView CreateViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource, eViewSystem VSystem)
+ {
+ if (!IsPresent(pHost, VSystem)) return null;
+ switch (VSystem)
+ {
+ case eViewSystem.DecalInject:
+ return CreateDecalViewResource(pHost, pXMLResource);
+ case eViewSystem.VirindiViewService:
+#if VVS_REFERENCED
+ return CreateMyHudViewResource(pHost, pXMLResource);
+#else
+ break;
+#endif
+ }
+ return null;
+ }
+ static IView CreateDecalViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource)
+ {
+ IView ret = new DecalControls.View();
+ ret.Initialize(pHost, pXMLResource);
+ return ret;
+ }
+
+#if VVS_REFERENCED
+ static IView CreateMyHudViewResource(Decal.Adapter.Wrappers.PluginHost pHost, string pXMLResource)
+ {
+ IView ret = new VirindiViewServiceHudControls.View();
+ ret.Initialize(pHost, pXMLResource);
+ return ret;
+ }
+#endif
+
+
+ ///////////////////////////////CreateViewXML///////////////////////////////
+
+ public static IView CreateViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
+ {
+#if VVS_REFERENCED
+ if (IsPresent(pHost, eViewSystem.VirindiViewService))
+ return CreateViewXML(pHost, pXML, eViewSystem.VirindiViewService);
+ else
+#endif
+ return CreateViewXML(pHost, pXML, eViewSystem.DecalInject);
+ }
+
+ public static IView CreateViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML, eViewSystem VSystem)
+ {
+ if (!IsPresent(pHost, VSystem)) return null;
+ switch (VSystem)
+ {
+ case eViewSystem.DecalInject:
+ return CreateDecalViewXML(pHost, pXML);
+ case eViewSystem.VirindiViewService:
+#if VVS_REFERENCED
+ return CreateMyHudViewXML(pHost, pXML);
+#else
+ break;
+#endif
+ }
+ return null;
+ }
+ static IView CreateDecalViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
+ {
+ IView ret = new DecalControls.View();
+ ret.InitializeRawXML(pHost, pXML);
+ return ret;
+ }
+
+#if VVS_REFERENCED
+ static IView CreateMyHudViewXML(Decal.Adapter.Wrappers.PluginHost pHost, string pXML)
+ {
+ IView ret = new VirindiViewServiceHudControls.View();
+ ret.InitializeRawXML(pHost, pXML);
+ return ret;
+ }
+#endif
+
+
+ ///////////////////////////////HasChatOpen///////////////////////////////
+
+ public static bool AnySystemHasChatOpen(Decal.Adapter.Wrappers.PluginHost pHost)
+ {
+ if (IsPresent(pHost, eViewSystem.VirindiViewService))
+ if (HasChatOpen_VirindiViews()) return true;
+ if (pHost.Actions.ChatState) return true;
+ return false;
+ }
+
+ static bool HasChatOpen_VirindiViews()
+ {
+#if VVS_REFERENCED
+ if (VirindiViewService.HudView.FocusControl != null)
+ {
+ if (VirindiViewService.HudView.FocusControl.GetType() == typeof(VirindiViewService.Controls.HudTextBox))
+ return true;
+ }
+ return false;
+#else
+ return false;
+#endif
+ }
+
+ public delegate void delConditionalSplit(object data);
+ public static void ViewConditionalSplit(IView v, delConditionalSplit onDecal, delConditionalSplit onVVS, object data)
+ {
+ Type vtype = v.GetType();
+
+#if VVS_REFERENCED
+ if (vtype == typeof(VirindiViewServiceHudControls.View))
+ {
+ if (onVVS != null)
+ onVVS(data);
+ }
+#endif
+
+ if (vtype == typeof(DecalControls.View))
+ {
+ if (onDecal != null)
+ onDecal(data);
+ }
+ }
+ }
+}
diff --git a/MosswartMassacre/VirindiViews/Wrapper.cs b/MosswartMassacre/VirindiViews/Wrapper.cs
new file mode 100644
index 0000000..7cca722
--- /dev/null
+++ b/MosswartMassacre/VirindiViews/Wrapper.cs
@@ -0,0 +1,427 @@
+///////////////////////////////////////////////////////////////////////////////
+//File: Wrapper.cs
+//
+//Description: Contains the interface definitions for the MetaViewWrappers classes.
+//
+//References required:
+// System.Drawing
+//
+//This file is Copyright (c) 2010 VirindiPlugins
+//
+//Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+//The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+///////////////////////////////////////////////////////////////////////////////
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+#if METAVIEW_PUBLIC_NS
+namespace MetaViewWrappers
+#else
+namespace MyClasses.MetaViewWrappers
+#endif
+{
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ delegate void dClickedList(object sender, int row, int col);
+
+
+ #region EventArgs Classes
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class MVControlEventArgs : EventArgs
+ {
+ private int id;
+
+ internal MVControlEventArgs(int ID)
+ {
+ this.id = ID;
+ }
+
+ public int Id
+ {
+ get { return this.id; }
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class MVIndexChangeEventArgs : MVControlEventArgs
+ {
+ private int index;
+
+ internal MVIndexChangeEventArgs(int ID, int Index)
+ : base(ID)
+ {
+ this.index = Index;
+ }
+
+ public int Index
+ {
+ get { return this.index; }
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class MVListSelectEventArgs : MVControlEventArgs
+ {
+ private int row;
+ private int col;
+
+ internal MVListSelectEventArgs(int ID, int Row, int Column)
+ : base(ID)
+ {
+ this.row = Row;
+ this.col = Column;
+ }
+
+ public int Row
+ {
+ get { return this.row; }
+ }
+
+ public int Column
+ {
+ get { return this.col; }
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class MVCheckBoxChangeEventArgs : MVControlEventArgs
+ {
+ private bool check;
+
+ internal MVCheckBoxChangeEventArgs(int ID, bool Check)
+ : base(ID)
+ {
+ this.check = Check;
+ }
+
+ public bool Checked
+ {
+ get { return this.check; }
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class MVTextBoxChangeEventArgs : MVControlEventArgs
+ {
+ private string text;
+
+ internal MVTextBoxChangeEventArgs(int ID, string text)
+ : base(ID)
+ {
+ this.text = text;
+ }
+
+ public string Text
+ {
+ get { return this.text; }
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class MVTextBoxEndEventArgs : MVControlEventArgs
+ {
+ private bool success;
+
+ internal MVTextBoxEndEventArgs(int ID, bool success)
+ : base(ID)
+ {
+ this.success = success;
+ }
+
+ public bool Success
+ {
+ get { return this.success; }
+ }
+ }
+
+ #endregion EventArgs Classes
+
+
+ #region View
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IView: IDisposable
+ {
+ void Initialize(Decal.Adapter.Wrappers.PluginHost p, string pXML);
+ void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML);
+ void Initialize(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey);
+ void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey);
+
+ void SetIcon(int icon, int iconlibrary);
+ void SetIcon(int portalicon);
+
+ string Title { get; set; }
+ bool Visible { get; set; }
+#if !VVS_WRAPPERS_PUBLIC
+ ViewSystemSelector.eViewSystem ViewType { get; }
+#endif
+
+ System.Drawing.Point Location { get; set; }
+ System.Drawing.Rectangle Position { get; set; }
+ System.Drawing.Size Size { get; }
+
+ IControl this[string id] { get; }
+
+ void Activate();
+ void Deactivate();
+ bool Activated { get; set; }
+ }
+
+ #endregion View
+
+ #region Controls
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IControl : IDisposable
+ {
+ string Name { get; }
+ bool Visible { get; set; }
+ string TooltipText { get; set;}
+ int Id { get; }
+ System.Drawing.Rectangle LayoutPosition { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IButton : IControl
+ {
+ string Text { get; set; }
+ event EventHandler Hit;
+ event EventHandler Click;
+ System.Drawing.Color TextColor { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface ICheckBox : IControl
+ {
+ string Text { get; set; }
+ bool Checked { get; set; }
+ event EventHandler Change;
+ event EventHandler Change_Old;
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface ITextBox : IControl
+ {
+ string Text { get; set; }
+ event EventHandler Change;
+ event EventHandler Change_Old;
+ event EventHandler End;
+ int Caret { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface ICombo : IControl
+ {
+ IComboIndexer Text { get; }
+ IComboDataIndexer Data { get; }
+ int Count { get; }
+ int Selected { get; set; }
+ event EventHandler Change;
+ event EventHandler Change_Old;
+ void Add(string text);
+ void Add(string text, object obj);
+ void Insert(int index, string text);
+ void RemoveAt(int index);
+ void Remove(int index);
+ void Clear();
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IComboIndexer
+ {
+ string this[int index] { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IComboDataIndexer
+ {
+ object this[int index] { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface ISlider : IControl
+ {
+ int Position { get; set; }
+ event EventHandler Change;
+ event EventHandler Change_Old;
+ int Maximum { get; set; }
+ int Minimum { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IList : IControl
+ {
+ event EventHandler Selected;
+ event dClickedList Click;
+ void Clear();
+ IListRow this[int row] { get; }
+ IListRow AddRow();
+ IListRow Add();
+ IListRow InsertRow(int pos);
+ IListRow Insert(int pos);
+ int RowCount { get; }
+ void RemoveRow(int index);
+ void Delete(int index);
+ int ColCount { get; }
+ int ScrollPosition { get; set;}
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IListRow
+ {
+ IListCell this[int col] { get; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IListCell
+ {
+ System.Drawing.Color Color { get; set; }
+ int Width { get; set; }
+ object this[int subval] { get; set; }
+ void ResetColor();
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IStaticText : IControl
+ {
+ string Text { get; set; }
+ event EventHandler Click;
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface INotebook : IControl
+ {
+ event EventHandler Change;
+ int ActiveTab { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IProgressBar : IControl
+ {
+ int Position { get; set; }
+ int Value { get; set; }
+ string PreText { get; set; }
+ int MaxValue { get; set; }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ interface IImageButton : IControl
+ {
+ event EventHandler Click;
+ void SetImages(int unpressed, int pressed);
+ void SetImages(int hmodule, int unpressed, int pressed);
+ int Background { set; }
+ System.Drawing.Color Matte { set; }
+ }
+
+ #endregion Controls
+}
diff --git a/MosswartMassacre/VirindiViews/Wrapper_Decal.cs b/MosswartMassacre/VirindiViews/Wrapper_Decal.cs
new file mode 100644
index 0000000..a917ca8
--- /dev/null
+++ b/MosswartMassacre/VirindiViews/Wrapper_Decal.cs
@@ -0,0 +1,1120 @@
+///////////////////////////////////////////////////////////////////////////////
+//File: Wrapper_Decal.cs
+//
+//Description: Contains MetaViewWrapper classes implementing Decal views.
+//
+//References required:
+// System.Drawing
+// Decal.Adapter
+//
+//This file is Copyright (c) 2010 VirindiPlugins
+//
+//Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+//The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+///////////////////////////////////////////////////////////////////////////////
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+#if METAVIEW_PUBLIC_NS
+namespace MetaViewWrappers.DecalControls
+#else
+namespace MyClasses.MetaViewWrappers.DecalControls
+#endif
+
+{
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class View : IView
+ {
+ Decal.Adapter.Wrappers.ViewWrapper myView;
+ public Decal.Adapter.Wrappers.ViewWrapper Underlying { get { return myView; } }
+
+ #region IView Members
+
+ public void Initialize(Decal.Adapter.Wrappers.PluginHost p, string pXML)
+ {
+ myView = p.LoadViewResource(pXML);
+ }
+
+ public void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML)
+ {
+ myView = p.LoadView(pXML);
+ }
+
+ public void Initialize(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey)
+ {
+ myView = p.LoadViewResource(pXML);
+ }
+
+ public void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey)
+ {
+ myView = p.LoadView(pXML);
+ }
+
+ public void SetIcon(int icon, int iconlibrary)
+ {
+ myView.SetIcon(icon, iconlibrary);
+ }
+
+ public void SetIcon(int portalicon)
+ {
+ //throw new Exception("The method or operation is not implemented.");
+ }
+
+ public string Title
+ {
+ get
+ {
+ return myView.Title;
+ }
+ set
+ {
+ myView.Title = value;
+ }
+ }
+
+ public bool Visible
+ {
+ get
+ {
+ return myView.Activated;
+ }
+ set
+ {
+ myView.Activated = value;
+ }
+ }
+
+ public bool Activated
+ {
+ get
+ {
+ return Visible;
+ }
+ set
+ {
+ Visible = value;
+ }
+ }
+
+ public void Activate()
+ {
+ Visible = true;
+ }
+
+ public void Deactivate()
+ {
+ Visible = false;
+ }
+
+ public System.Drawing.Point Location
+ {
+ get
+ {
+ return new System.Drawing.Point(myView.Position.X, myView.Position.Y);
+ }
+ set
+ {
+ int w = myView.Position.Width;
+ int h = myView.Position.Height;
+ myView.Position = new System.Drawing.Rectangle(value.X, value.Y, w, h);
+ }
+ }
+
+ public System.Drawing.Rectangle Position
+ {
+ get
+ {
+ return myView.Position;
+ }
+ set
+ {
+ myView.Position = value;
+ }
+ }
+
+ public System.Drawing.Size Size
+ {
+ get
+ {
+ return new System.Drawing.Size(myView.Position.Width, myView.Position.Height);
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ internal
+#else
+ public
+#endif
+ ViewSystemSelector.eViewSystem ViewType { get { return ViewSystemSelector.eViewSystem.DecalInject; } }
+ Dictionary CreatedControlsByName = new Dictionary();
+
+ public IControl this[string id]
+ {
+ get
+ {
+ if (CreatedControlsByName.ContainsKey(id)) return CreatedControlsByName[id];
+
+ Control ret = null;
+ Decal.Adapter.Wrappers.IControlWrapper iret = myView.Controls[id];
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.PushButtonWrapper))
+ ret = new Button();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.CheckBoxWrapper))
+ ret = new CheckBox();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.TextBoxWrapper))
+ ret = new TextBox();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ChoiceWrapper))
+ ret = new Combo();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.SliderWrapper))
+ ret = new Slider();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ListWrapper))
+ ret = new List();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.StaticWrapper))
+ ret = new StaticText();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.NotebookWrapper))
+ ret = new Notebook();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ProgressWrapper))
+ ret = new ProgressBar();
+ if (iret.GetType() == typeof(Decal.Adapter.Wrappers.ButtonWrapper))
+ ret = new ImageButton();
+
+ if (ret == null) return null;
+
+ ret.myControl = iret;
+ ret.myName = id;
+ ret.Initialize();
+ allocatedcontrols.Add(ret);
+ CreatedControlsByName[id] = ret;
+ return ret;
+ }
+ }
+
+ List allocatedcontrols = new List();
+
+ #endregion
+
+ #region IDisposable Members
+
+ bool disposed = false;
+ public void Dispose()
+ {
+ if (disposed) return;
+ disposed = true;
+ GC.SuppressFinalize(this);
+
+ foreach (Control c in allocatedcontrols)
+ c.Dispose();
+
+ myView.Dispose();
+ }
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Control : IControl
+ {
+ internal Decal.Adapter.Wrappers.IControlWrapper myControl;
+ public Decal.Adapter.Wrappers.IControlWrapper Underlying { get { return myControl; } }
+ internal string myName;
+
+ public virtual void Initialize()
+ {
+
+ }
+
+ #region IControl Members
+
+ public string Name
+ {
+ get { return myName; }
+ }
+
+ public bool Visible
+ {
+ get { return true; }
+ set { }
+ }
+
+ public string TooltipText
+ {
+ get
+ {
+ return "";
+ }
+ set
+ {
+
+ }
+ }
+
+ public int Id
+ {
+ get
+ {
+ return myControl.Id;
+ }
+ }
+
+ public System.Drawing.Rectangle LayoutPosition
+ {
+ get
+ {
+#if DECAL_INTEROP
+ //This is kinda bad, but whatever
+ Decal.Interop.Inject.ILayer Ly = (Decal.Interop.Inject.ILayer)(Underlying.Underlying);
+ Decal.Interop.Core.tagRECT rct = Ly.get_Position();
+ return new System.Drawing.Rectangle(rct.left, rct.top, rct.right - rct.left, rct.bottom - rct.top);
+#else
+#warning DECAL_INTEROP not defined, MetaViewWrappers.DecalControls.Control.LayoutPosition will not be available.
+ return new System.Drawing.Rectangle();
+#endif
+ }
+ set
+ {
+#if DECAL_INTEROP
+ Decal.Interop.Inject.ILayer Ly = (Decal.Interop.Inject.ILayer)(Underlying.Underlying);
+ Decal.Interop.Core.tagRECT rct = new Decal.Interop.Core.tagRECT();
+ rct.left = value.Left;
+ rct.top = value.Top;
+ rct.right = value.Right;
+ rct.bottom = value.Bottom;
+ Ly.set_Position(ref rct);
+#endif
+ }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ bool disposed = false;
+ public virtual void Dispose()
+ {
+ if (disposed) return;
+ disposed = true;
+
+ //myControl.Dispose();
+ }
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Button : Control, IButton
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).Hit += new EventHandler(Button_Hit);
+ ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).Click += new EventHandler(Button_Click);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).Hit -= new EventHandler(Button_Hit);
+ ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).Click -= new EventHandler(Button_Click);
+ }
+
+ void Button_Hit(object sender, Decal.Adapter.ControlEventArgs e)
+ {
+ if (Hit != null)
+ Hit(this, null);
+ }
+
+ void Button_Click(object sender, Decal.Adapter.ControlEventArgs e)
+ {
+ if (Click != null)
+ Click(this, new MVControlEventArgs(this.Id));
+ }
+
+ #region IButton Members
+
+ public string Text
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).Text;
+ //throw new Exception("The method or operation is not implemented.");
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).Text = value;
+ //throw new Exception("The method or operation is not implemented.");
+ }
+ }
+
+ public System.Drawing.Color TextColor
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).TextColor;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.PushButtonWrapper)myControl).TextColor = value;
+ }
+ }
+
+ public event EventHandler Hit;
+ public event EventHandler Click;
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class CheckBox : Control, ICheckBox
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.CheckBoxWrapper)myControl).Change += new EventHandler(CheckBox_Change);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.CheckBoxWrapper)myControl).Change -= new EventHandler(CheckBox_Change);
+ }
+
+ void CheckBox_Change(object sender, Decal.Adapter.CheckBoxChangeEventArgs e)
+ {
+ if (Change != null)
+ Change(this, new MVCheckBoxChangeEventArgs(this.Id, Checked));
+ if (Change_Old != null)
+ Change_Old(this, null);
+ }
+
+ #region ICheckBox Members
+
+ public string Text
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.CheckBoxWrapper)myControl).Text;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.CheckBoxWrapper)myControl).Text = value;
+ }
+ }
+
+ public bool Checked
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.CheckBoxWrapper)myControl).Checked;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.CheckBoxWrapper)myControl).Checked = value;
+ }
+ }
+
+ public event EventHandler Change;
+ public event EventHandler Change_Old;
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class TextBox : Control, ITextBox
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).Change += new EventHandler(TextBox_Change);
+ ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).End += new EventHandler(TextBox_End);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).Change -= new EventHandler(TextBox_Change);
+ ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).End -= new EventHandler(TextBox_End);
+ }
+
+ void TextBox_Change(object sender, Decal.Adapter.TextBoxChangeEventArgs e)
+ {
+ if (Change != null)
+ Change(this, new MVTextBoxChangeEventArgs(this.Id, e.Text));
+ if (Change_Old != null)
+ Change_Old(this, null);
+ }
+
+ void TextBox_End(object sender, Decal.Adapter.TextBoxEndEventArgs e)
+ {
+ if (End != null)
+ End(this, new MVTextBoxEndEventArgs(this.Id, e.Success));
+ }
+
+ #region ITextBox Members
+
+ public string Text
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).Text;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).Text = value;
+ }
+ }
+
+ public int Caret
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).Caret;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.TextBoxWrapper)myControl).Caret = value;
+ }
+ }
+
+ public event EventHandler Change;
+ public event EventHandler Change_Old;
+ public event EventHandler End;
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Combo : Control, ICombo
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Change += new EventHandler(Combo_Change);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Change -= new EventHandler(Combo_Change);
+ }
+
+ void Combo_Change(object sender, Decal.Adapter.IndexChangeEventArgs e)
+ {
+ if (Change != null)
+ Change(this, new MVIndexChangeEventArgs(this.Id, e.Index));
+ if (Change_Old != null)
+ Change_Old(this, null);
+ }
+
+ #region ICombo Members
+
+ public IComboIndexer Text
+ {
+ get
+ {
+ return new ComboIndexer(this);
+ }
+ }
+
+ public IComboDataIndexer Data
+ {
+ get
+ {
+ return new ComboDataIndexer(this);
+ }
+ }
+
+ public int Count
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Count;
+ }
+ }
+
+ public int Selected
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Selected;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Selected = value;
+ }
+ }
+
+ public event EventHandler Change;
+ public event EventHandler Change_Old;
+
+ public void Add(string text)
+ {
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Add(text, null);
+ }
+
+ public void Add(string text, object obj)
+ {
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Add(text, obj);
+ }
+
+ public void Insert(int index, string text)
+ {
+ throw new Exception("The method or operation is not implemented.");
+ }
+
+ public void RemoveAt(int index)
+ {
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Remove(index);
+ }
+
+ public void Remove(int index)
+ {
+ RemoveAt(index);
+ }
+
+ public void Clear()
+ {
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myControl).Clear();
+ }
+
+ #endregion
+
+ internal class ComboIndexer: IComboIndexer
+ {
+ Combo myCombo;
+ internal ComboIndexer(Combo c)
+ {
+ myCombo = c;
+ }
+
+ #region IComboIndexer Members
+
+ public string this[int index]
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ChoiceWrapper)myCombo.myControl).Text[index];
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myCombo.myControl).Text[index] = value;
+ }
+ }
+
+ #endregion
+ }
+
+ internal class ComboDataIndexer : IComboDataIndexer
+ {
+ Combo myCombo;
+ internal ComboDataIndexer(Combo c)
+ {
+ myCombo = c;
+ }
+
+ #region IComboIndexer Members
+
+ public object this[int index]
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ChoiceWrapper)myCombo.myControl).Data[index];
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ChoiceWrapper)myCombo.myControl).Data[index] = value;
+ }
+ }
+
+ #endregion
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Slider : Control, ISlider
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.SliderWrapper)myControl).Change += new EventHandler(Slider_Change);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.SliderWrapper)myControl).Change -= new EventHandler(Slider_Change);
+ }
+
+ void Slider_Change(object sender, Decal.Adapter.IndexChangeEventArgs e)
+ {
+ if (Change != null)
+ Change(this, new MVIndexChangeEventArgs(this.Id, e.Index));
+ if (Change_Old != null)
+ Change_Old(this, null);
+ }
+
+ #region ISlider Members
+
+ public int Position
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.SliderWrapper)myControl).SliderPostition;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.SliderWrapper)myControl).SliderPostition = value;
+ }
+ }
+
+ public event EventHandler Change;
+ public event EventHandler Change_Old;
+
+ public int Maximum
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.SliderWrapper)myControl).Maximum;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.SliderWrapper)myControl).Maximum = value;
+ }
+ }
+ public int Minimum
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.SliderWrapper)myControl).Minimum;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.SliderWrapper)myControl).Minimum = value;
+ }
+ }
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class List : Control, IList
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.ListWrapper)myControl).Selected += new EventHandler(List_Selected);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.ListWrapper)myControl).Selected -= new EventHandler(List_Selected);
+ }
+
+ void List_Selected(object sender, Decal.Adapter.ListSelectEventArgs e)
+ {
+ if (Click != null)
+ Click(this, e.Row, e.Column);
+ if (Selected != null)
+ Selected(this, new MVListSelectEventArgs(this.Id, e.Row, e.Column));
+ }
+
+ #region IList Members
+
+ public event dClickedList Click;
+ public event EventHandler Selected;
+
+ public void Clear()
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myControl).Clear();
+ }
+
+ public IListRow this[int row]
+ {
+ get
+ {
+ return new ListRow(this, row);
+ }
+ }
+
+ public IListRow AddRow()
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myControl).Add();
+ return new ListRow(this, ((Decal.Adapter.Wrappers.ListWrapper)myControl).RowCount - 1);
+ }
+
+ public IListRow Add()
+ {
+ return AddRow();
+ }
+
+ public IListRow InsertRow(int pos)
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myControl).Insert(pos);
+ return new ListRow(this, pos);
+ }
+
+ public IListRow Insert(int pos)
+ {
+ return InsertRow(pos);
+ }
+
+ public int RowCount
+ {
+ get { return ((Decal.Adapter.Wrappers.ListWrapper)myControl).RowCount; }
+ }
+
+ public void RemoveRow(int index)
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myControl).Delete(index);
+ }
+
+ public void Delete(int index)
+ {
+ RemoveRow(index);
+ }
+
+ public int ColCount
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ListWrapper)myControl).ColCount;
+ }
+ }
+
+ public int ScrollPosition
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ListWrapper)myControl).ScrollPosition;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myControl).ScrollPosition = value;
+ }
+ }
+
+ #endregion
+
+ public class ListRow : IListRow
+ {
+ internal List myList;
+ internal int myRow;
+ internal ListRow(List l, int r)
+ {
+ myList = l;
+ myRow = r;
+ }
+
+
+ #region IListRow Members
+
+ public IListCell this[int col]
+ {
+ get { return new ListCell(myList, myRow, col); }
+ }
+
+ #endregion
+ }
+
+ public class ListCell : IListCell
+ {
+ internal List myList;
+ internal int myRow;
+ internal int myCol;
+ public ListCell(List l, int r, int c)
+ {
+ myList = l;
+ myRow = r;
+ myCol = c;
+ }
+
+ #region IListCell Members
+
+ public void ResetColor()
+ {
+ Color = System.Drawing.Color.White;
+ }
+
+ public System.Drawing.Color Color
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ListWrapper)myList.myControl)[myRow][myCol].Color;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myList.myControl)[myRow][myCol].Color = value;
+ }
+ }
+
+ public int Width
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ListWrapper)myList.myControl)[myRow][myCol].Width;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myList.myControl)[myRow][myCol].Width = value;
+ }
+ }
+
+ public object this[int subval]
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ListWrapper)myList.myControl)[myRow][myCol][subval];
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ListWrapper)myList.myControl)[myRow][myCol][subval] = value;
+ }
+ }
+
+ #endregion
+ }
+
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class StaticText : Control, IStaticText
+ {
+
+ #region IStaticText Members
+
+ public string Text
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.StaticWrapper)myControl).Text;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.StaticWrapper)myControl).Text = value;
+ }
+ }
+
+#pragma warning disable 0067
+ public event EventHandler Click;
+#pragma warning restore 0067
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Notebook : Control, INotebook
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.NotebookWrapper)myControl).Change += new EventHandler(Notebook_Change);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.NotebookWrapper)myControl).Change -= new EventHandler(Notebook_Change);
+ }
+
+ void Notebook_Change(object sender, Decal.Adapter.IndexChangeEventArgs e)
+ {
+ if (Change != null)
+ Change(this, new MVIndexChangeEventArgs(this.Id, e.Index));
+ }
+
+ #region INotebook Members
+
+ public event EventHandler Change;
+
+ public int ActiveTab
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.NotebookWrapper)myControl).ActiveTab;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.NotebookWrapper)myControl).ActiveTab = value;
+ }
+ }
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class ProgressBar : Control, IProgressBar
+ {
+
+ #region IProgressBar Members
+
+ public int Position
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ProgressWrapper)myControl).Value;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ProgressWrapper)myControl).Value = value;
+ }
+ }
+
+ public int Value
+ {
+ get
+ {
+ return Position;
+ }
+ set
+ {
+ Position = value;
+ }
+ }
+
+ public string PreText
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ProgressWrapper)myControl).PreText;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ProgressWrapper)myControl).PreText = value;
+ }
+ }
+
+ public int MaxValue
+ {
+ get
+ {
+ return ((Decal.Adapter.Wrappers.ProgressWrapper)myControl).MaxValue;
+ }
+ set
+ {
+ ((Decal.Adapter.Wrappers.ProgressWrapper)myControl).MaxValue = value;
+ }
+ }
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class ImageButton : Control, IImageButton
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((Decal.Adapter.Wrappers.ButtonWrapper)myControl).Click += new EventHandler(ImageButton_Click);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((Decal.Adapter.Wrappers.ButtonWrapper)myControl).Click -= new EventHandler(ImageButton_Click);
+ }
+
+ void ImageButton_Click(object sender, Decal.Adapter.ControlEventArgs e)
+ {
+ if (Click != null)
+ Click(this, new MVControlEventArgs(this.Id));
+ }
+
+
+ #region IImageButton Members
+
+ public event EventHandler Click;
+
+ public void SetImages(int unpressed, int pressed)
+ {
+ ((Decal.Adapter.Wrappers.ButtonWrapper)myControl).SetImages(unpressed, pressed);
+ }
+
+ public void SetImages(int hmodule, int unpressed, int pressed)
+ {
+ ((Decal.Adapter.Wrappers.ButtonWrapper)myControl).SetImages(hmodule, unpressed, pressed);
+ }
+
+ public int Background
+ {
+ set
+ {
+ ((Decal.Adapter.Wrappers.ButtonWrapper)myControl).Background = value;
+ }
+ }
+
+ public System.Drawing.Color Matte
+ {
+ set
+ {
+ ((Decal.Adapter.Wrappers.ButtonWrapper)myControl).Matte = value;
+ }
+ }
+
+ #endregion
+ }
+}
+
diff --git a/MosswartMassacre/VirindiViews/Wrapper_MyHuds.cs b/MosswartMassacre/VirindiViews/Wrapper_MyHuds.cs
new file mode 100644
index 0000000..e2e097f
--- /dev/null
+++ b/MosswartMassacre/VirindiViews/Wrapper_MyHuds.cs
@@ -0,0 +1,1225 @@
+///////////////////////////////////////////////////////////////////////////////
+//File: Wrapper_MyHuds.cs
+//
+//Description: Contains MetaViewWrapper classes implementing Virindi View Service
+// views. These classes are only compiled if the VVS_REFERENCED symbol is defined.
+//
+//References required:
+// System.Drawing
+// VirindiViewService (if VVS_REFERENCED is defined)
+//
+//This file is Copyright (c) 2010 VirindiPlugins
+//
+//Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+//The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+///////////////////////////////////////////////////////////////////////////////
+
+#if VVS_REFERENCED
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using VirindiViewService;
+
+#if METAVIEW_PUBLIC_NS
+namespace MetaViewWrappers.VirindiViewServiceHudControls
+#else
+namespace MyClasses.MetaViewWrappers.VirindiViewServiceHudControls
+#endif
+{
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class View : IView
+ {
+ HudView myView;
+ public HudView Underlying { get { return myView; } }
+
+ #region IView Members
+
+ public void Initialize(Decal.Adapter.Wrappers.PluginHost p, string pXML)
+ {
+ VirindiViewService.XMLParsers.Decal3XMLParser ps = new VirindiViewService.XMLParsers.Decal3XMLParser();
+ ViewProperties iprop;
+ ControlGroup igroup;
+ ps.ParseFromResource(pXML, out iprop, out igroup);
+ myView = new VirindiViewService.HudView(iprop, igroup);
+ }
+
+ public void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML)
+ {
+ VirindiViewService.XMLParsers.Decal3XMLParser ps = new VirindiViewService.XMLParsers.Decal3XMLParser();
+ ViewProperties iprop;
+ ControlGroup igroup;
+ ps.Parse(pXML, out iprop, out igroup);
+ myView = new VirindiViewService.HudView(iprop, igroup);
+ }
+
+ public void Initialize(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey)
+ {
+ VirindiViewService.XMLParsers.Decal3XMLParser ps = new VirindiViewService.XMLParsers.Decal3XMLParser();
+ ViewProperties iprop;
+ ControlGroup igroup;
+ ps.ParseFromResource(pXML, out iprop, out igroup);
+ myView = new VirindiViewService.HudView(iprop, igroup, pWindowKey);
+ }
+
+ public void InitializeRawXML(Decal.Adapter.Wrappers.PluginHost p, string pXML, string pWindowKey)
+ {
+ VirindiViewService.XMLParsers.Decal3XMLParser ps = new VirindiViewService.XMLParsers.Decal3XMLParser();
+ ViewProperties iprop;
+ ControlGroup igroup;
+ ps.Parse(pXML, out iprop, out igroup);
+ myView = new VirindiViewService.HudView(iprop, igroup, pWindowKey);
+ }
+
+ public void SetIcon(int icon, int iconlibrary)
+ {
+ myView.Icon = ACImage.FromIconLibrary(icon, iconlibrary);
+ }
+
+ public void SetIcon(int portalicon)
+ {
+ myView.Icon = portalicon;
+ }
+
+ public string Title
+ {
+ get
+ {
+ return myView.Title;
+ }
+ set
+ {
+ myView.Title = value;
+ }
+ }
+
+ public bool Visible
+ {
+ get
+ {
+ return myView.Visible;
+ }
+ set
+ {
+ myView.Visible = value;
+ }
+ }
+
+ public bool Activated
+ {
+ get
+ {
+ return Visible;
+ }
+ set
+ {
+ Visible = value;
+ }
+ }
+
+ public void Activate()
+ {
+ Visible = true;
+ }
+
+ public void Deactivate()
+ {
+ Visible = false;
+ }
+
+ public System.Drawing.Point Location
+ {
+ get
+ {
+ return myView.Location;
+ }
+ set
+ {
+ myView.Location = value;
+ }
+ }
+
+ public System.Drawing.Size Size
+ {
+ get
+ {
+ return new System.Drawing.Size(myView.Width, myView.Height);
+ }
+ }
+
+ public System.Drawing.Rectangle Position
+ {
+ get
+ {
+ return new System.Drawing.Rectangle(Location, Size);
+ }
+ set
+ {
+ Location = value.Location;
+ myView.ClientArea = value.Size;
+ }
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ internal
+#else
+ public
+#endif
+ ViewSystemSelector.eViewSystem ViewType { get { return ViewSystemSelector.eViewSystem.VirindiViewService; } }
+ Dictionary CreatedControlsByName = new Dictionary();
+
+ public IControl this[string id]
+ {
+ get
+ {
+ if (CreatedControlsByName.ContainsKey(id)) return CreatedControlsByName[id];
+
+ Control ret = null;
+ VirindiViewService.Controls.HudControl iret = myView[id];
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudButton))
+ ret = new Button();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudCheckBox))
+ ret = new CheckBox();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudTextBox))
+ ret = new TextBox();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudCombo))
+ ret = new Combo();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudHSlider))
+ ret = new Slider();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudList))
+ ret = new List();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudStaticText))
+ ret = new StaticText();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudTabView))
+ ret = new Notebook();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudProgressBar))
+ ret = new ProgressBar();
+ if (iret.GetType() == typeof(VirindiViewService.Controls.HudImageButton))
+ ret = new ImageButton();
+
+ if (ret == null) return null;
+
+ ret.myControl = iret;
+ ret.myName = id;
+ ret.Initialize();
+ allocatedcontrols.Add(ret);
+ CreatedControlsByName[id] = ret;
+ return ret;
+ }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ bool disposed = false;
+ public void Dispose()
+ {
+ if (disposed) return;
+ disposed = true;
+ GC.SuppressFinalize(this);
+
+ foreach (Control c in allocatedcontrols)
+ c.Dispose();
+
+ myView.Dispose();
+ }
+
+ #endregion
+
+ List allocatedcontrols = new List();
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Control : IControl
+ {
+ internal VirindiViewService.Controls.HudControl myControl;
+ internal string myName;
+ public VirindiViewService.Controls.HudControl Underlying { get { return myControl; } }
+
+ public virtual void Initialize()
+ {
+
+ }
+
+ #region IControl Members
+
+ public string Name
+ {
+ get { return myName; }
+ }
+
+ public bool Visible
+ {
+ get { return myControl.Visible; }
+ set { myControl.Visible = value; }
+ }
+
+ VirindiViewService.TooltipSystem.cTooltipInfo itooltipinfo = null;
+ public string TooltipText
+ {
+ get
+ {
+ if (itooltipinfo != null)
+ return itooltipinfo.Text;
+ else
+ return "";
+ }
+ set
+ {
+ if (itooltipinfo != null)
+ {
+ VirindiViewService.TooltipSystem.RemoveTooltip(itooltipinfo);
+ itooltipinfo = null;
+ }
+ if (!String.IsNullOrEmpty(value))
+ {
+ itooltipinfo = VirindiViewService.TooltipSystem.AssociateTooltip(myControl, value);
+ }
+ }
+ }
+
+ public int Id
+ {
+ get
+ {
+ return myControl.XMLID;
+ }
+ }
+
+ public System.Drawing.Rectangle LayoutPosition
+ {
+ get
+ {
+ //Relative to what?!??!
+ if (Underlying.Group.HeadControl == null)
+ return new System.Drawing.Rectangle();
+
+ if (Underlying.Group.HeadControl.Name == Underlying.Name)
+ return new System.Drawing.Rectangle();
+
+ VirindiViewService.Controls.HudControl myparent = Underlying.Group.ParentOf(Underlying.Name);
+
+ if (myparent == null)
+ return new System.Drawing.Rectangle();
+
+ //Position only valid inside fixedlayouts
+ VirindiViewService.Controls.HudFixedLayout layoutparent = myparent as VirindiViewService.Controls.HudFixedLayout;
+
+ if (layoutparent == null)
+ return new System.Drawing.Rectangle();
+
+ return layoutparent.GetControlRect(Underlying);
+ }
+ set
+ {
+ if (Underlying.Group.HeadControl == null)
+ return;
+
+ if (Underlying.Group.HeadControl.Name == Underlying.Name)
+ return;
+
+ VirindiViewService.Controls.HudControl myparent = Underlying.Group.ParentOf(Underlying.Name);
+
+ if (myparent == null)
+ return;
+
+ //Position only valid inside fixedlayouts
+ VirindiViewService.Controls.HudFixedLayout layoutparent = myparent as VirindiViewService.Controls.HudFixedLayout;
+
+ if (layoutparent == null)
+ return;
+
+ layoutparent.SetControlRect(Underlying, value);
+ }
+ }
+
+ #endregion
+
+ #region IDisposable Members
+
+ bool disposed = false;
+ public virtual void Dispose()
+ {
+ if (disposed) return;
+ disposed = true;
+
+ myControl.Dispose();
+ }
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Button : Control, IButton
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((VirindiViewService.Controls.HudButton)myControl).MouseEvent += new EventHandler(Button_MouseEvent);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((VirindiViewService.Controls.HudButton)myControl).MouseEvent -= new EventHandler(Button_MouseEvent);
+ }
+
+ void Button_MouseEvent(object sender, VirindiViewService.Controls.ControlMouseEventArgs e)
+ {
+ switch (e.EventType)
+ {
+ case VirindiViewService.Controls.ControlMouseEventArgs.MouseEventType.MouseHit:
+ if (Click != null)
+ Click(this, new MVControlEventArgs(this.Id));
+ return;
+ case VirindiViewService.Controls.ControlMouseEventArgs.MouseEventType.MouseDown:
+ if (Hit != null)
+ Hit(this, null);
+ return;
+ }
+ }
+
+ #region IButton Members
+
+ public string Text
+ {
+ get
+ {
+ return ((VirindiViewService.Controls.HudButton)myControl).Text;
+ }
+ set
+ {
+ ((VirindiViewService.Controls.HudButton)myControl).Text = value;
+ }
+ }
+
+ public System.Drawing.Color TextColor
+ {
+ get
+ {
+ return System.Drawing.Color.Black;
+ }
+ set
+ {
+
+ }
+ }
+
+ public event EventHandler Hit;
+ public event EventHandler Click;
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class CheckBox : Control, ICheckBox
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((VirindiViewService.Controls.HudCheckBox)myControl).Change += new EventHandler(CheckBox_Change);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((VirindiViewService.Controls.HudCheckBox)myControl).Change -= new EventHandler(CheckBox_Change);
+ }
+
+ void CheckBox_Change(object sender, EventArgs e)
+ {
+ if (Change != null)
+ Change(this, new MVCheckBoxChangeEventArgs(this.Id, Checked));
+ if (Change_Old != null)
+ Change_Old(this, null);
+ }
+
+ #region ICheckBox Members
+
+ public string Text
+ {
+ get
+ {
+ return ((VirindiViewService.Controls.HudCheckBox)myControl).Text;
+ }
+ set
+ {
+ ((VirindiViewService.Controls.HudCheckBox)myControl).Text = value;
+ }
+ }
+
+ public bool Checked
+ {
+ get
+ {
+ return ((VirindiViewService.Controls.HudCheckBox)myControl).Checked;
+ }
+ set
+ {
+ ((VirindiViewService.Controls.HudCheckBox)myControl).Checked = value;
+ }
+ }
+
+ public event EventHandler Change;
+ public event EventHandler Change_Old;
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class TextBox : Control, ITextBox
+ {
+ public override void Initialize()
+ {
+ base.Initialize();
+ ((VirindiViewService.Controls.HudTextBox)myControl).Change += new EventHandler(TextBox_Change);
+ myControl.LostFocus += new EventHandler(myControl_LostFocus);
+ }
+
+ public override void Dispose()
+ {
+ base.Dispose();
+ ((VirindiViewService.Controls.HudTextBox)myControl).Change -= new EventHandler(TextBox_Change);
+ myControl.LostFocus -= new EventHandler(myControl_LostFocus);
+ }
+
+ void TextBox_Change(object sender, EventArgs e)
+ {
+ if (Change != null)
+ Change(this, new MVTextBoxChangeEventArgs(this.Id, Text));
+ if (Change_Old != null)
+ Change_Old(this, null);
+ }
+
+ void myControl_LostFocus(object sender, EventArgs e)
+ {
+ if (!myControl.HasFocus) return;
+
+ if (End != null)
+ End(this, new MVTextBoxEndEventArgs(this.Id, true));
+ }
+
+ #region ITextBox Members
+
+ public string Text
+ {
+ get
+ {
+ return ((VirindiViewService.Controls.HudTextBox)myControl).Text;
+ }
+ set
+ {
+ ((VirindiViewService.Controls.HudTextBox)myControl).Text = value;
+ }
+ }
+
+ public int Caret
+ {
+ get
+ {
+ return 0;
+ }
+ set
+ {
+
+ }
+ }
+
+ public event EventHandler Change;
+ public event EventHandler Change_Old;
+ public event EventHandler End;
+
+ #endregion
+ }
+
+#if VVS_WRAPPERS_PUBLIC
+ public
+#else
+ internal
+#endif
+ class Combo : Control, ICombo
+ {
+ List