Advertisement
Multivit4min

Untitled

Aug 2nd, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.03 KB | None | 0 0
  1. --- autopass.lua Contains everything related to autopassing
  2. -- @author Potdisc
  3. -- Create Date : 23/9/2016
  4.  
  5. --- Never autopass these armor types.
  6. -- @table autopassOverride
  7. local autopassOverride = {
  8. "INVTYPE_CLOAK",
  9. }
  10.  
  11. --- Classes that should autopass a subtype.
  12. -- @table autopassTable
  13. local autopassTable = {
  14. ["Cloth"] = {"WARRIOR", "DEATHKNIGHT", "PALADIN", "DRUID", "MONK", "ROGUE", "HUNTER", "SHAMAN", "DEMONHUNTER"},
  15. ["Leather"] = {"WARRIOR", "DEATHKNIGHT", "PALADIN", "HUNTER", "SHAMAN", "PRIEST", "MAGE", "WARLOCK"},
  16. ["Mail"] = {"WARRIOR", "DEATHKNIGHT", "PALADIN", "DRUID", "MONK", "ROGUE", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  17. ["Plate"] = {"DRUID", "MONK", "ROGUE", "HUNTER", "SHAMAN", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  18. ["Shields"] = {"DEATHKNIGHT", "DRUID", "MONK", "ROGUE", "HUNTER","PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  19. ["Bows"] = {"DEATHKNIGHT", "PALADIN", "DRUID", "MONK", "SHAMAN", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  20. ["Crossbows"] = {"DEATHKNIGHT", "PALADIN", "DRUID", "MONK", "SHAMAN", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  21. ["Daggers"] = {"WARRIOR", "DEATHKNIGHT", "PALADIN", "DRUID", "MONK", "HUNTER", },
  22. ["Guns"] = {"DEATHKNIGHT", "PALADIN", "DRUID", "MONK","SHAMAN", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  23. ["Fist Weapons"] = {"DEATHKNIGHT", "PALADIN", "PRIEST", "MAGE", "WARLOCK"},
  24. ["One-Handed Axes"] = {"DRUID", "ROGUE", "PRIEST", "MAGE", "WARLOCK"},
  25. ["One-Handed Maces"] = {"HUNTER", "MAGE", "WARLOCK"},
  26. ["One-Handed Swords"] = {"DRUID", "SHAMAN", "PRIEST",},
  27. ["Polearms"] = {"ROGUE", "SHAMAN", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  28. ["Staves"] = {"WARRIOR", "DEATHKNIGHT", "PALADIN", "ROGUE", "DEMONHUNTER"},
  29. ["Two-Handed Axes"] = {"DRUID", "ROGUE", "MONK", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  30. ["Two-Handed Maces"] = {"MONK", "ROGUE", "HUNTER", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  31. ["Two-Handed Swords"] = {"DRUID", "MONK", "ROGUE", "SHAMAN", "PRIEST", "MAGE", "WARLOCK", "DEMONHUNTER"},
  32. ["Wands"] = {"WARRIOR", "DEATHKNIGHT", "PALADIN", "DRUID", "MONK", "ROGUE", "HUNTER", "SHAMAN", "DEMONHUNTER"},
  33. ["Warglaives"] = {"WARRIOR", "DEATHKNIGHT", "PALADIN", "DRUID", "MONK", "ROGUE", "PRIEST", "MAGE", "WARLOCK", "HUNTER", "SHAMAN",}
  34. }
  35.  
  36. --- Types of relics. Thanks to xmyno for the list.
  37. -- NOTE I'm not sure if the return from C_ArtifactUI.GetRelicInfoByItemID() is localized
  38. -- @table relicTypes
  39. local relicTypes = {
  40. BLOOD = 'Blood',
  41. SHADOW = 'Shadow',
  42. IRON = 'Iron',
  43. FROST = 'Frost',
  44. FIRE = 'Fire',
  45. FEL = 'Fel',
  46. ARCANE = 'Arcane',
  47. LIFE = 'Life',
  48. STORM = 'Wind', -- Great job Blizzard -.-
  49. HOLY = 'Holy'
  50. }
  51.  
  52. --- The type of relic each class can use
  53. -- @table relics
  54. local relics = {
  55. DEATHKNIGHT = {relicTypes.BLOOD, relicTypes.SHADOW,relicTypes.IRON, relicTypes.FROST, relicTypes.FIRE },
  56. DEMONHUNTER = {relicTypes.FEL, relicTypes.SHADOW,relicTypes.IRON, relicTypes.ARCANE},
  57. DRUID = {relicTypes.ARCANE,relicTypes.LIFE, relicTypes.FIRE, relicTypes.BLOOD, relicTypes.FROST},
  58. HUNTER = {relicTypes.STORM, relicTypes.ARCANE,relicTypes.IRON, relicTypes.BLOOD, relicTypes.LIFE},
  59. MAGE = {relicTypes.ARCANE,relicTypes.FROST, relicTypes.FIRE},
  60. MONK = {relicTypes.LIFE, relicTypes.STORM, relicTypes.IRON, relicTypes.FROST},
  61. PALADIN = {relicTypes.HOLY, relicTypes.LIFE, relicTypes.FIRE, relicTypes.IRON, relicTypes.ARCANE},
  62. PRIEST = {relicTypes.HOLY, relicTypes.SHADOW,relicTypes.LIFE, relicTypes.BLOOD},
  63. ROGUE = {relicTypes.SHADOW,relicTypes.IRON, relicTypes.BLOOD, relicTypes.STORM, relicTypes.FEL},
  64. SHAMAN = {relicTypes.STORM, relicTypes.FROST, relicTypes.FIRE, relicTypes.IRON, relicTypes.LIFE},
  65. WARLOCK = {relicTypes.SHADOW,relicTypes.BLOOD, relicTypes.FIRE, relicTypes.FEL},
  66. WARRIOR = {relicTypes.IRON, relicTypes.BLOOD, relicTypes.SHADOW,relicTypes.FIRE, relicTypes.STORM},
  67. }
  68.  
  69. --- Checks if the player should autopass on a given item.
  70. -- All params are supplied by the lootTable from the ML.
  71. -- @usage
  72. -- -- Check if the item in session 1 should be auto passed:
  73. -- local dat = lootTable[1] -- Shortening
  74. -- local boolean = RCLootCouncil:AutoPassCheck(dat.subType, dat.equipLoc, dat.link, dat.token, dat.relic)
  75. --@return true if the player should autopass the given item.
  76. function RCLootCouncil:AutoPassCheck(subType, equipLoc, link, isToken, isRelic)
  77. if not tContains(autopassOverride, equipLoc) then
  78. if isRelic or (equipLoc == "" and subType == self.db.global.localizedSubTypes["Artifact Relic"]) then
  79. if isRelic then -- New in v2.3+
  80. self:DebugLog("NewRelicAutopassCheck", link, isRelic)
  81. return not tContains(relics[self.playerClass], isRelic)
  82. else
  83. local id = self:GetItemIDFromLink(link)
  84. local type = select(3, C_ArtifactUI.GetRelicInfoByItemID(id))
  85. self:DebugLog("RelicAutopassCheck", type, id)
  86. -- If the type exists in the table, then the player can use it, so we need to negate it
  87. return not tContains(relics[self.playerClass], type)
  88. end
  89.  
  90. elseif subType and autopassTable[self.db.global.localizedSubTypes[subType]] then
  91. return tContains(autopassTable[self.db.global.localizedSubTypes[subType]], self.playerClass)
  92. end
  93. -- The item wasn't a type we check for, but it might be a token
  94. local id = type(link) == "number" and link or self:GetItemIDFromLink(link) -- Convert to id if needed
  95. if isToken or RCTokenClasses[id] then -- It's a token
  96. return not tContains(RCTokenClasses[id], self.playerClass)
  97. end
  98. end
  99. return false
  100. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement