View Single Post
09-09-23, 07:55 AM   #10
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
ok so everything is working "kinda" the stat datatext i would like to dive in a little deeper and have it choose by player spec.

for instance a Pally has a heal spec, a DPS spec, and a tank spec so i would like the stats to adjust to this.

Heal = SP (not sure if classic doe SP or not)
DPS = AP
Tank = Armor

the following code gives me there spec numbers:
Lua Code:
  1. local Warrior = {
  2.   ID = 1,
  3.   displayName = "Warrior",
  4.   name = "WARRIOR",
  5.   Arms = 71,
  6.   Fury = 72,
  7.   Prot = 73,
  8.   specs = {71, 72, 73}
  9. }
  10. local Paladin = {
  11.   ID = 2,
  12.   displayName = "Paladin",
  13.   name = "PALADIN",
  14.   Holy = 65,
  15.   Prot = 66,
  16.   Ret = 70,
  17.   specs = {65, 66, 70}
  18. }
  19. local Hunter = {
  20.   ID = 3,
  21.   displayName = "Hunter",
  22.   name = "HUNTER",
  23.   BM = 253,
  24.   MM = 254,
  25.   SV = 255,
  26.   specs = {253, 254, 255}
  27. }
  28. local Rogue = {
  29.   ID = 4,
  30.   displayName = "Rogue",
  31.   name = "ROGUE",
  32.   Assasin = 259,
  33.   Combat = 260,
  34.   Sub = 261,
  35.   specs = {259, 260, 261}
  36. }
  37. local Priest = {
  38.   ID = 5,
  39.   displayName = "Priest",
  40.   name = "PRIEST",
  41.   Disc = 256,
  42.   Holy = 257,
  43.   Shadow = 258,
  44.   specs = {256, 257, 258}
  45. }
  46. local DK = {
  47.   ID = 6,
  48.   displayName = "Death knight",
  49.   name = "DEATHKNIGHT",
  50.   Blood = 250,
  51.   Frost = 251,
  52.   Unholy = 252,
  53.   specs = {250, 251, 252}
  54. }
  55. local Shaman = {
  56.   ID = 7,
  57.   displayName = "Shaman",
  58.   name = "SHAMAN",
  59.   Ele = 262,
  60.   Enh = 263,
  61.   Resto = 264,
  62.   specs = {262, 263, 264}
  63. }
  64. local Mage = {
  65.   ID = 8,
  66.   displayName = "Mage",
  67.   name = "MAGE",
  68.   Arcane = 62,
  69.   Fire = 63,
  70.   Frost = 64,
  71.   specs = {62, 63, 64}
  72. }
  73. local Warlock = {
  74.   ID = 9,
  75.   displayName = "Warlock",
  76.   name = "WARLOCK",
  77.   Affl = 265,
  78.   Demo = 266,
  79.   Destro = 267,
  80.   specs = {265, 266, 267}
  81. }
  82. local Monk = {
  83.   ID = 10,
  84.   displayName = "Monk",
  85.   name = "MONK",
  86.   BRM = 268,
  87.   WW = 269,
  88.   MW = 270,
  89.   specs = {268, 269, 270}
  90. }
  91. local Druid = {
  92.   ID = 11,
  93.   displayName = "Druid",
  94.   name = "DRUID",
  95.   Balance = 102,
  96.   Feral = 103,
  97.   Guardian = 104,
  98.   Resto = 105,
  99.   specs = {102, 103, 104, 105}
  100. }
  101. local DH = {
  102.   ID = 12,
  103.   displayName = "Demon hunter",
  104.   name = "DEMONHUNTER",
  105.   Havoc = 577,
  106.   Veng = 581,
  107.   specs = {577, 581}
  108. }

Here is the function to get the spec number:
Lua Code:
  1. playerClass = select(1, GetSpecializationInfo(specIndex))

How would i group them together to use them in:
Lua Code:
  1. if playerStat == 1 then        
  2.                 if playerClass == 66 or 73 or 104 then
  3.                     local Total_Dodge = GetDodgeChance()
  4.                     local Total_Parry = GetParryChance()
  5.                     local Total_Block = GetBlockChance()
  6.                    
  7.                     GameTooltip:AddLine(STAT_CATEGORY_DEFENSE)
  8.                     GameTooltip:AddDoubleLine(DODGE_CHANCE, format("%.2f%%", Total_Dodge),1,1,1)
  9.                     GameTooltip:AddDoubleLine(PARRY_CHANCE, format("%.2f%%", Total_Parry),1,1,1)
  10.                     GameTooltip:AddDoubleLine(BLOCK_CHANCE, format("%.2f%%", Total_Block),1,1,1)
  11.                 elseif playerClass == 70 or 71 or 72 then
  12.                     local Melee_Crit = GetCritChance("player")
  13.                     local Total_Melee_Haste = GetMeleeHaste("player")
  14.                     local mainSpeed = UnitAttackSpeed("player");
  15.                     local MH = mainSpeed
  16.                    
  17.                     GameTooltip:AddLine(STAT_CATEGORY_MELEE)
  18.                     GameTooltip:AddDoubleLine(STAT_CRITICAL_STRIKE, format("%.2f%%", Melee_Crit), 1, 1, 1)     
  19.                     --GameTooltip:AddDoubleLine(STAT_HASTE, format("%.2f%%", Total_Melee_Haste), 1, 1, 1)
  20.                     GameTooltip:AddDoubleLine(STAT_ATTACK_SPEED, format("%.2f".." (sec)", MH), 1, 1, 1)                            
  21.                 end

so when i do the print to chat to see what i get (on my ret pally) I get
Lua Code:
  1. playerStat 1 3
  2. playerClass 70 3

so if we referance the top table we can see that playerClass 70 is a Ret Pally which should give me a stat for AP but it currently is just giving me playerStat 1 which is the tank spec for Armor.


I have attached the whole Datapanel.lua file if you need to see the whole thing.
thanks for any help with this.
Attached Files
File Type: lua Datapanel.lua (82.5 KB, 33 views)
  Reply With Quote