Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local PARTY_PROFILE = "Primary"
- local RAID_25_PROFILE = "raid";
- local RAID_40_PROFILE = "lfr";
- local PARTY_HEALER_PROFILE = "healer dungeon";
- local RAID_25_HEALER_PROFILE = "healer raid";
- local SPECIALIZATION = "Restoration";
- local SPECIALIZATIONTWO = "Holy";
- local SPECIALIZATIONTHREE = "Discipline";
- local SPECIALIZATIONFOUR = "Mistweaver";
- function switchProfile()
- if InCombatLockdown() == false then --This should fix in-combat issues.
- local currentSpec = GetSpecialization();
- local currentSpecName = currentSpec and select(2, GetSpecializationInfo(currentSpec)) or "None";
- isArena, _ = IsActiveBattlefieldArena();
- if currentSpecName == SPECIALIZATION or currentSpecName == SPECIALIZATIONTWO or currentSpecName == SPECIALIZATIONTHREE or currentSpecName == SPECIALIZATIONFOUR then
- if isArena == true then --**IN ARENA**.
- if GetActiveRaidProfile() ~= PARTY_HEALER_PROFILE then --if arena profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_HEALER_PROFILE); --...set arena profile.
- print("Activated RaidProfile: "..PARTY_HEALER_PROFILE)
- end
- elseif InActiveBattlefield() then --**IN BG**.
- if GetActiveRaidProfile() ~= RAID_25_HEALER_PROFILE then --if battleground profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_HEALER_PROFILE); --...set battleground profile.
- print("Activated RaidProfile: "..RAID_25_HEALER_PROFILE)
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 0 then --**IN INSTANCE GROUP**
- if GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 25 then
- if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
- print("Activated RaidProfile: "..RAID_40_PROFILE)
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 5 then
- if GetActiveRaidProfile() ~= RAID_25_HEALER_PROFILE then --if Raid25 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_HEALER_PROFILE); --...set raid25 profile.
- print("Activated RaidProfile: "..RAID_25_HEALER_PROFILE)
- end
- else
- if GetActiveRaidProfile() ~= PARTY_HEALER_PROFILE then --if Party profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_HEALER_PROFILE); --...set Party profile.
- print("Activated RaidProfile: "..PARTY_HEALER_PROFILE)
- end
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 0 then --**IN MANUAL GROUP**
- if GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 25 then
- if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
- print("Activated RaidProfile: "..RAID_40_PROFILE)
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 5 then
- if GetActiveRaidProfile() ~= RAID_25_HEALER_PROFILE then --if Raid25 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_HEALER_PROFILE); --...set raid25 profile.
- print("Activated RaidProfile: "..RAID_25_HEALER_PROFILE)
- end
- else
- if GetActiveRaidProfile() ~= PARTY_HEALER_PROFILE then --if Party profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_HEALER_PROFILE); --...set Party profile.
- print("Activated RaidProfile: "..PARTY_HEALER_PROFILE)
- end
- end
- end
- else
- if isArena == true then --**IN ARENA**.
- if GetActiveRaidProfile() ~= PARTY_PROFILE then --if arena profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set arena profile.
- print("Activated RaidProfile: "..PARTY_PROFILE)
- end
- elseif InActiveBattlefield() then --**IN BG**.
- if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if battleground profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set battleground profile.
- print("Activated RaidProfile: "..RAID_25_PROFILE)
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 0 then --**IN INSTANCE GROUP**
- if GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 25 then
- if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
- print("Activated RaidProfile: "..RAID_40_PROFILE)
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 5 then
- if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if Raid25 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set raid25 profile.
- print("Activated RaidProfile: "..RAID_25_PROFILE)
- end
- else
- if GetActiveRaidProfile() ~= PARTY_PROFILE then --if Party profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set Party profile.
- print("Activated RaidProfile: "..PARTY_PROFILE)
- end
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 0 then --**IN MANUAL GROUP**
- if GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 25 then
- if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
- print("Activated RaidProfile: "..RAID_40_PROFILE)
- end
- elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 5 then
- if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if Raid25 profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set raid25 profile.
- print("Activated RaidProfile: "..RAID_25_PROFILE)
- end
- else
- if GetActiveRaidProfile() ~= PARTY_PROFILE then --if Party profile is not active
- CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set Party profile.
- print("Activated RaidProfile: "..PARTY_PROFILE)
- end
- end
- end
- end
- end
- end
- local f = CreateFrame("Frame")
- f:RegisterEvent("GROUP_ROSTER_UPDATE") --fires when player joins or leaves group
- f:RegisterEvent("PLAYER_REGEN_ENABLED") --fires when leaving combat
- f:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") --run when player changes spec
- f:SetScript("OnEvent",switchProfile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement