Advertisement
hucking

Untitled

Aug 8th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. local PARTY_PROFILE = "Primary"
  2. local RAID_25_PROFILE = "raid";
  3. local RAID_40_PROFILE = "lfr";
  4. local PARTY_HEALER_PROFILE = "healer dungeon";
  5. local RAID_25_HEALER_PROFILE = "healer raid";
  6. local SPECIALIZATION = "Restoration";
  7. local SPECIALIZATIONTWO = "Holy";
  8. local SPECIALIZATIONTHREE = "Discipline";
  9. local SPECIALIZATIONFOUR = "Mistweaver";
  10.  
  11. function switchProfile()
  12. if InCombatLockdown() == false then --This should fix in-combat issues.
  13. local currentSpec = GetSpecialization();
  14. local currentSpecName = currentSpec and select(2, GetSpecializationInfo(currentSpec)) or "None";
  15. isArena, _ = IsActiveBattlefieldArena();
  16. if currentSpecName == SPECIALIZATION or currentSpecName == SPECIALIZATIONTWO or currentSpecName == SPECIALIZATIONTHREE or currentSpecName == SPECIALIZATIONFOUR then
  17. if isArena == true then --**IN ARENA**.
  18. if GetActiveRaidProfile() ~= PARTY_HEALER_PROFILE then --if arena profile is not active
  19. CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_HEALER_PROFILE); --...set arena profile.
  20. print("Activated RaidProfile: "..PARTY_HEALER_PROFILE)
  21. end
  22. elseif InActiveBattlefield() then --**IN BG**.
  23. if GetActiveRaidProfile() ~= RAID_25_HEALER_PROFILE then --if battleground profile is not active
  24. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_HEALER_PROFILE); --...set battleground profile.
  25. print("Activated RaidProfile: "..RAID_25_HEALER_PROFILE)
  26. end
  27. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 0 then --**IN INSTANCE GROUP**
  28. if GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 25 then
  29. if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
  30. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
  31. print("Activated RaidProfile: "..RAID_40_PROFILE)
  32. end
  33. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 5 then
  34. if GetActiveRaidProfile() ~= RAID_25_HEALER_PROFILE then --if Raid25 profile is not active
  35. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_HEALER_PROFILE); --...set raid25 profile.
  36. print("Activated RaidProfile: "..RAID_25_HEALER_PROFILE)
  37. end
  38. else
  39. if GetActiveRaidProfile() ~= PARTY_HEALER_PROFILE then --if Party profile is not active
  40. CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_HEALER_PROFILE); --...set Party profile.
  41. print("Activated RaidProfile: "..PARTY_HEALER_PROFILE)
  42. end
  43. end
  44. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 0 then --**IN MANUAL GROUP**
  45. if GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 25 then
  46. if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
  47. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
  48. print("Activated RaidProfile: "..RAID_40_PROFILE)
  49. end
  50. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 5 then
  51. if GetActiveRaidProfile() ~= RAID_25_HEALER_PROFILE then --if Raid25 profile is not active
  52. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_HEALER_PROFILE); --...set raid25 profile.
  53. print("Activated RaidProfile: "..RAID_25_HEALER_PROFILE)
  54. end
  55. else
  56. if GetActiveRaidProfile() ~= PARTY_HEALER_PROFILE then --if Party profile is not active
  57. CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_HEALER_PROFILE); --...set Party profile.
  58. print("Activated RaidProfile: "..PARTY_HEALER_PROFILE)
  59. end
  60. end
  61. end
  62. else
  63. if isArena == true then --**IN ARENA**.
  64. if GetActiveRaidProfile() ~= PARTY_PROFILE then --if arena profile is not active
  65. CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set arena profile.
  66. print("Activated RaidProfile: "..PARTY_PROFILE)
  67. end
  68. elseif InActiveBattlefield() then --**IN BG**.
  69. if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if battleground profile is not active
  70. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set battleground profile.
  71. print("Activated RaidProfile: "..RAID_25_PROFILE)
  72. end
  73. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 0 then --**IN INSTANCE GROUP**
  74. if GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 25 then
  75. if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
  76. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
  77. print("Activated RaidProfile: "..RAID_40_PROFILE)
  78. end
  79. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_INSTANCE) > 5 then
  80. if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if Raid25 profile is not active
  81. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set raid25 profile.
  82. print("Activated RaidProfile: "..RAID_25_PROFILE)
  83. end
  84. else
  85. if GetActiveRaidProfile() ~= PARTY_PROFILE then --if Party profile is not active
  86. CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set Party profile.
  87. print("Activated RaidProfile: "..PARTY_PROFILE)
  88. end
  89. end
  90. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 0 then --**IN MANUAL GROUP**
  91. if GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 25 then
  92. if GetActiveRaidProfile() ~= RAID_40_PROFILE then -- if Raid40 profile is not active
  93. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_40_PROFILE); --...set raid40 profile.
  94. print("Activated RaidProfile: "..RAID_40_PROFILE)
  95. end
  96. elseif GetNumGroupMembers(LE_PARTY_CATEGORY_HOME) > 5 then
  97. if GetActiveRaidProfile() ~= RAID_25_PROFILE then --if Raid25 profile is not active
  98. CompactUnitFrameProfiles_ActivateRaidProfile(RAID_25_PROFILE); --...set raid25 profile.
  99. print("Activated RaidProfile: "..RAID_25_PROFILE)
  100. end
  101. else
  102. if GetActiveRaidProfile() ~= PARTY_PROFILE then --if Party profile is not active
  103. CompactUnitFrameProfiles_ActivateRaidProfile(PARTY_PROFILE); --...set Party profile.
  104. print("Activated RaidProfile: "..PARTY_PROFILE)
  105. end
  106. end
  107. end
  108. end
  109. end
  110. end
  111.  
  112. local f = CreateFrame("Frame")
  113. f:RegisterEvent("GROUP_ROSTER_UPDATE") --fires when player joins or leaves group
  114. f:RegisterEvent("PLAYER_REGEN_ENABLED") --fires when leaving combat
  115. f:RegisterEvent("PLAYER_SPECIALIZATION_CHANGED") --run when player changes spec
  116. f:SetScript("OnEvent",switchProfile);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement