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] How to get the tank

Featured Replies

 protected WoWPlayer GetPartyTank()
        {
            WoWPlayer tank;

            var lua = new[]
                          {
                            "partyTank = \"\";",
                            "for groupindex = 1,MAX_PARTY_MEMBERS do",
                            "	if (UnitInParty(\"party\" .. groupindex)) then",
                            "		local role = UnitGroupRolesAssigned(\"party\" .. groupindex);",
                            "		if role == \"TANK\" then",
                            "			local name, realm = UnitName(\"party\" .. groupindex);",
                            "			partyTank = name;",
                            "			return;",
                            "		end",
                            "	end",
                            "end",
                        };

            // Get tank name
            string tankName = Lua.LuaDoString(lua, "partyTank");

            if (string.IsNullOrEmpty(tankName))
            {
                // Set us as tank
                tank = this.Me;
            }
            else
            {
                // Set tank
                tank = this.GetPartyMember().Single(p => p.Name == tankName);
            }

            return tank;
        }

i'm looking for a way to get the tank object of a party or raid. it seems i'm something missing couz i get an empty string back.

On WOTLK "UnitGroupRolesAssigned" change, try this (not tested):

    public WoWPlayer GetPartyTank()
    {
        WoWPlayer tank = new WoWPlayer(0);

        var lua = @"
                    for groupindex = 1,MAX_PARTY_MEMBERS do
	                    if (UnitInParty('party' .. groupindex)) then
		                    local isTank, isHealer, isDamage = UnitGroupRolesAssigned('party' .. groupindex);
		                    if isTank then
			                    local name = UnitName('party' .. groupindex);
			                    return name;
		                    end
	                    end
                    end
                    return '';
                    ";

        // Get tank name
        string tankName = Lua.LuaDoString<string>(lua);

        if (!string.IsNullOrEmpty(tankName))
        {
            tankName = tankName.Trim().ToLower();

            //foreach (var p in Party.GetPartyHomeAndInstance())
            foreach (var p in ObjectManager.GetObjectWoWPlayer())
            {
                if (p != null && p.IsValid && p.Name.Trim().ToLower() == tankName)
                {
                    tank = new WoWPlayer(p.GetBaseAddress);
                    break;
                }
            }
        }

        return tank;
    }

 

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.