ACT Advanced Combat Tracker - MMORPG Log Parser Paypal
underwater

Add an arbitrary column/export variable to ACT

  1. using System.Windows.Forms;
  2. using Advanced_Combat_Tracker;
  3.  
  4. namespace ACT_Plugin
  5. {
  6.     public class PluginSample : IActPluginV1
  7.     {
  8.         Label lblStatus;    // The status label that appears in ACT's Plugin tab
  9.  
  10.         public void DeInitPlugin()
  11.         {
  12.             lblStatus.Text = "Plugin Exited";
  13.         }
  14.         public void InitPlugin(TabPage pluginScreenSpace, Label pluginStatusText)
  15.         {
  16.             lblStatus = pluginStatusText;   // Hand the status label's reference to our local var
  17.             CombatantData.ColumnDefs.Add("CurseCures", new CombatantData.ColumnDef("CurseCures", false, "INT", "CurseCures",
  18.                 (Data) => { return GetCurseCureCount(Data).ToString(); }, (Data) => { return GetCurseCureCount(Data).ToString(); },
  19.                 (Left, Right) => { return GetCurseCureCount(Left).CompareTo(GetCurseCureCount(Right)); }));
  20.             ActGlobals.oFormActMain.ValidateTableSetup();   // Make sure the new column is in the Options tab
  21.             CombatantData.ExportVariables.Add("cursecures", new CombatantData.TextExportFormatter("cursecures", "Curse Cures", "Number of curses cured by the combatant.",
  22.                 (Data, Extra) => { return GetCurseCureCount(Data).ToString(); }));  // All lambda expressions, but feel free to write delegated methods
  23.             ActGlobals.oFormActMain.ValidateLists();    // Make sure the new variable appears in the preset creator
  24.             lblStatus.Text = "Plugin Started";
  25.         }
  26.         private int GetCurseCureCount(CombatantData Combatant)
  27.         {
  28.             AttackType curseCures = null;
  29.             if (Combatant.AllOut.TryGetValue("Cure Curse", out curseCures))
  30.                 return curseCures.Swings;
  31.             else
  32.                 return 0;
  33.         }
  34.     }
  35. }
  36.  

Summary:

This example will add a CureCurse column to ACT Encounter view and a matching export variable for each combatant.

It's probably not a good idea to remove them in DeInitPlugin as future calls to the validate methods may remove their usage and config saving.


HTML5 Powered with CSS3 / Styling, Graphics, 3D & Effects, and Semantics
Softpedia Clean Award
Random Background