Skip to content
View in the app

A better way to browse. Learn more.

WRobot

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I impliment Fight Class Settings

Featured Replies

Hey everyone,

I'm working on a Totem Twist Fight Class for TBC and i want to add Settings, which allow me to chose the Totems i want the bot to use.

I'm creating C# Fightclasses for a while. Yet i couldn't figure out, how to properly impliment options in the Settings.

This is how i tried to make it work:

 [Serializable]
    public class TestingSettings : Settings
    {
        [Setting]
        [DefaultValue("")]
        [Category("Category")]
        [DisplayName("Displ")]
        [Description("Descr")]
        public string Setting1 { get; set; }

    
        private TestingSettings()
        {
            Setting1 = "";
        }

        public static TestingSettings CurrentSetting { get; set; }

        public bool Save()
        {
            try
            {
                return Save(AdviserFilePathAndName("TestSetting", ObjectManager.Me.Name + "." + Usefuls.RealmName));
            }
            catch (Exception e)
            {
                Logging.WriteError("Failed" + e);
                return false;
            }
        }

        public static bool Load()
        {
            try
            {
                if (File.Exists(AdviserFilePathAndName("TestSetting", ObjectManager.Me.Name + "." + Usefuls.RealmName)))
                {
                    CurrentSetting =
                        Load<TestingSettings>(AdviserFilePathAndName("TestSetting", ObjectManager.Me.Name + "." + Usefuls.RealmName));
                    return true;
                }
                CurrentSetting = new TestingSettings();
            }
            catch (Exception e)
            {
                Logging.WriteError("Failed" + e);
            }
            return false;
        }
    }

Unfortunatly, when i press "Settings", just nothing happens. What am I doing wrong?

 

Looks good to me at first sight.

Maybe you forgot to declare the following method?

    public static void ShowConfiguration()
    {
        TestingSettings.Load();
        TestingSettings.CurrentSetting.ToForm();
        TestingSettings.CurrentSetting.Save();
    }

You also need to load the settings in the Initialize() method of the FC:

TestingSettings.Load();

 

  • Author
1 hour ago, Zer0 said:

Looks good to me at first sight.

Maybe you forgot to declare the following method?


    public static void ShowConfiguration()
    {
        TestingSettings.Load();
        TestingSettings.CurrentSetting.ToForm();
        TestingSettings.CurrentSetting.Save();
    }

You also need to load the settings in the Initialize() method of the FC:


TestingSettings.Load();

 

This made it work. Thanks a lot!
(ofc I was missing the obvious stuff ... time to feel stupido for a few minutes ? )

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.