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.

[Wotlk][Source] GetSpecialization

Featured Replies

Since there is no method to get the specialization of the character in wotlk i took another way to find it out.
It wont be 100% accurate if you use mixed talends but for the most spec's it should work.

        /// <summary>
        /// Returns the talent tree with the most invested points
        /// </summary>
        /// <returns>Returns the tree index</returns>
        public static int GetSpecialization()
        {
            KeyValuePair<int, int> highestPointTree = new KeyValuePair<int, int>(0, 0);

            // Process talent trees
            for (int i = 1; i <= 3; i++)
            {
                // Get current talent points
                int treePointValue = Lua.LuaDoString<int>($"local _, _, talentPoints = GetTalentTabInfo({i}); return talentPoints;");

                // Bigger than old value?
                if (treePointValue > highestPointTree.Value)
                {
                    // Set new value
                    highestPointTree = new KeyValuePair<int, int>(i, treePointValue);
                }
            }

            // Return
            return highestPointTree.Key;
        }

This will give you the the talent tree with the most invested points.

 

Now you just need to define each talent tree based on the wow class

For example DK:

	    if(ObjectManager.Me.WowClass != WoWClass.DeathKnight)
            {
            	throw new NotSupportedException("You need to be a DK to use this rotation.");
            }

	    // Get the main talent tree
            int mainTalent = GetSpecialization();

            // Choose the right rotation
            switch (mainTalent)
            {
                case 1:
                    {
                        // Set rotation
                        this._rotation = new Blood();
                        Logging.WriteDebug("Choosing Blood rotation.");
                        break;
                    }
                case 2:
                    {
                        // Set rotation
                        this._rotation = new Frost();
                        Logging.WriteDebug("Choosing Frost rotation.");
                        break;
                    }
                case 3:
                    {
                        // Set rotation
                        this._rotation = new Unholy();
                        Logging.WriteDebug("Choosing Unholy rotation.");
                        break;
                    }
                default:
                    {
                        this._rotation = null;
                        throw new NotSupportedException("Your spec is not supported.");
                    }
            }

This is just a small and fast coded example but hope it helps some ppl.

Greez iMod

  • 4 years later...

To help-out you could also use lua to do the same thing with less lines of code

public static string GetSpec()
    {
        string SpecName = @"    
        local highest_tab, highest = 0, 0;
        for i=1, 3 do 
        local name, _, points = GetTalentTabInfo(i);
        if points > highest then
            highest = points;
            highest_tab = i;
            highest_name = name
        end
        end
        return highest_name";

        return Lua.LuaDoString<string>(SpecName);
    }

 

  • 1 month later...

While i was working on my own copy of AIO, i made a simple way to check spec by string, its more Accurate then the method @iMod used, 

public static class ToolHelper_Rotation
{
    public static void Spec()
    {
        string MainTalents = GetSpec();
        if (ObjectManager.Me.WowClass == WoWClass.Priest)
        {
            switch (MainTalents)
            {
                case ("Shadow"):
                    {
                        MessageBox.Show("Your spec is Shadow");
                        break;
                    }
                case ("Holy"):
                    {
                        MessageBox.Show("Your spec is Holy");
                        break;
                    }
                case ("Disco"):
                    {
                        MessageBox.Show("Your spec is Disco");
                        break;
                    }
                default:
                    {
                        MessageBox.Show("Your spec is Shadow");
                        break;
                    }
            }
        }
    }

    public static string GetSpec()
    {
        string SpecName = @"    
        local highest_tab, highest = 0, 0;
        for i=1, 3 do 
        local name, _, points = GetTalentTabInfo(i);
        if points > highest then
            highest = points;
            highest_tab = i;
            highest_name = name
        end
        end
        return highest_name";
        return Lua.LuaDoString<string>(SpecName);
    }
}

 

  • Author

Nice to see some progress even on that pc of old code ;)
One thing i don't understand is how can it be more accurate if you still loop over the tabs and take the one with the highes points? Is is because you read out the name? If so how about multi language can that cause some issues?

I know its just a sample code but you may should check if its not a priest because you don't got any else block. (2cents)

  • Author
3 minutes ago, TheSmokie said:

i simple just used priest for a fightclass, i havent really use much, my code gets the highest talents spec instead of if 2 talent trees etc.

My code does the same if i'm not total wrong. It just gets the highes talent and returns a "Number/ID" instead of the name.

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.