Jump to content

kergudu

Members
  • Posts

    19
  • Joined

  • Last visited

Bug Report Comments posted by kergudu

  1. It tricky but possible :wink:

    This is additional C#, nothing special, only proof (with egyptian brackets, because i am Java programmer :smile:)

    Spoiler
    
    [Serializable]
    public class TestSettings : Settings {
    
      [Setting, DefaultValue(0)]
      [Category("Test")]
      [DisplayName("Test Spell")]
      [Description("Print here any known spell")]
      public string testSpell { get; set; }
    
      private TestSettings(){
        ConfigWinForm(new System.Drawing.Point(400, 400), "Test " + Translate.Get("Settings"));
      }
    
      public static TestSettings CurrentSetting { get; set; }
    
      public bool Save() {
        try {
          return Save(AdviserFilePathAndName("CustomClass-Test", ObjectManager.Me.Name + "." + Usefuls.RealmName));
        } catch (Exception e) {
          Logging.WriteError("TestSettings > Save(): " + e);
          return false;
        }
      }
    
      public static bool Load() {
        try {
          if (File.Exists(AdviserFilePathAndName("CustomClass-Test", ObjectManager.Me.Name + "." + Usefuls.RealmName))) {
            CurrentSetting =
              Load<TestSettings>(AdviserFilePathAndName("CustomClass-Test",
                                     ObjectManager.Me.Name + "." + Usefuls.RealmName));
            return true;
          }
          CurrentSetting = new TestSettings();
        } catch (Exception e) {
          Logging.WriteError("TestSettings > Load(): " + e);
        }
        return false;
      }
    }
    
    public bool castSpell() {
      SpellManager.CastSpellByNameLUA(Main.TestSettings.CurrentSetting.testSpell);
      Usefuls.WaitIsCasting();
      return true;
    }

     

    And this is fight class: testClass.xml 

    Load it, open Settings and type any known spell. For example, "Steady Shot" for hunter. Then go to target dumy and check.

    Just want to use the same "legally", without special names for settings class. Maybe one more property in fight class

×
×
  • Create New...