Thread Tools Display Modes
11-15-16, 12:27 PM   #21
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by Seerah View Post
But nil isn't the same as false.
Of course, I mentioned that condition in my post. My expression only works as expected if item ID never is false.

Originally Posted by SDPhantom View Post
Again, differentiating false in this situation is overkill. The API never returns false in place of a value that isn't normally boolean. As a matter of fact, API that returns data often doesn't provide any returns when there isn't any available, not even nil. However, when Lua attempts to assign no value to a variable, it ends up assigning nil anyway.
I already said I was talking from a readability perspective. I think mine reads better, that's it. However I went ahead and timed it and mine and Phanx expressions are actually faster when the value is truthy. Mine is a bit slower when the value is nil.

Originally Posted by _Max_Cavalera_ View Post
Lua Code:
  1. MainFrame:SetShown(itemid and true or false);

Can you explain this line to me? I think that it's supposed to be, show frame if itemID exists?! but I don't get how the and true or false works.
In this case it works like so; the expression "itemid and true or false" evaluates to true if itemid is truthy (any value except nil and false), otherwise evaluates to false. It's essentially a way to write the following in a single expression:
Code:
if itemid then
	return true
else
	return false
end
It doesn't have to return true or false, either. Your example with the two different strings works exactly the same.

You can read more about it here:
http://www.lua.org/pil/3.3.html
__________________
Grab your sword and fight the Horde!

Last edited by Lombra : 11-15-16 at 12:33 PM.
  Reply With Quote
11-15-16, 01:40 PM   #22
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
I still find it very strange like that. I get it, but just find it strange.

Definitely find the not not itemid (that was talked about a few posts before) easier to understand in that case for some reason.

Thank you for the explanation and the link

ok, I implemented the code after doing minor changes that were needed for my personal taste.

Lua Code:
  1. local akMulti = {
  2.     0,
  3.     25, 50, 90, 140, 200,
  4.     275, 375, 500, 650, 850,
  5.     1100, 1400, 1775, 2250, 2850,
  6.     3600, 4550, 5700, 7200, 9000,
  7.     11300, 14200, 17800, 22300, 24900
  8. };
  9.  
  10. local frame = CreateFrame("Frame", "m4xArtifactFrame", UIParent);
  11. local text = frame:CreateFontString(nil, "ARTWORK");
  12. text:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE");
  13. text:SetJustifyH("LEFT");
  14. text:SetTextColor(1, 0.82, 0);
  15. text:SetPoint("TOPLEFT", UIParent, "TOPLEFT");
  16.  
  17. text:SetText("Initializing...");
  18.  
  19. frame:SetAllPoints(text);
  20.  
  21. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  22. frame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED");
  23. frame:RegisterEvent("ARTIFACT_CLOSE");
  24. frame:RegisterEvent("ARTIFACT_RESPEC_PROMPT");
  25. frame:RegisterEvent("ARTIFACT_XP_UPDATE");
  26.  
  27. frame:SetScript("OnEvent", function(self, event, ...)
  28.     local itemID, _, itemName, itemIcon, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
  29.    
  30.     if itemID then
  31.         local pointsFree, xpToNextPoint = 0, C_ArtifactUI.GetCostForPointAtRank(pointsSpent);
  32.         local _, akLevel = GetCurrencyInfo(1171);
  33.        
  34.         while totalXP >= xpToNextPoint do
  35.             totalXP, pointsSpent, pointsFree, xpToNextPoint = totalXP - xpToNextPoint, pointsSpent + 1, pointsFree + 1, C_ArtifactUI.GetCostForPointAtRank(pointsSpent + 1);
  36.         end
  37.         text:SetFormattedText("AP |cff00ff00%d/%d (%.1f%%)|r" .. (pointsFree > 0 and " (+%d)" or "") .. "\nAK |cff00ff00%5$d (+%6$d%%)|r", totalXP, xpToNextPoint, 100 * totalXP / xpToNextPoint, pointsFree, akLevel, akMulti[akLevel + 1]);
  38.     end
  39.  
  40.     frame:SetShown(itemID and true or false);
  41. end);

Changes were:
  • Obviously the variable names, I kinda have my own preference in naming scheme but that's irrelevant
  • The font was changed because I looked at all the game font options from the XML files and none were exactly what I needed, unfortunately...
  • Added 0 to the multiplier table to temporarily fix a problem I was getting where I was getting a nil value from multiplier[level] when the knowledge level was 0, and I'm going to talk about this after
  • Because of adding the 0 to the table I had to add +1 to the level in multiplier[level] obviously
  • Have some variables there not being used but i'm going to use them after

So, that nil because of the knowledge level 0. I totally get it why that is happening, it was trying to get multiplier[0] which doesn't exist since it starts at 1... BUT... on my original code I was doing the same mistake by accident, and it never gave me an error, not only that but it was actually working correctly, giving me on the output knowledge level 0 (+0%)... that's kinda strange, no?

Last edited by _Max_Cavalera_ : 11-15-16 at 01:50 PM.
  Reply With Quote
11-15-16, 02:20 PM   #23
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Originally Posted by _Max_Cavalera_ View Post
Lua Code:
  1. MainFrame:SetShown(itemid and true or false);
Can you explain this line to me? I think that it's supposed to be, show frame if itemID exists?! but I don't get how the and true or false works.
This is basically a hack to implement inline conditions in Lua since there isn't a native method provided. frame:SetShown() either shows or hides a frame depending on the boolean value you pass to it. It shows the frame on true and hides it on false. The expression passed to it is the inline condition in question. The idea is if you have an expression A and B or C, it returns B if A is a true condition or C if not. There is an inherent bug in this expression though. If B evaluates to a false condition, C will always be returned no matter what A is. Keep this in mind if you decide to play around with it.


Originally Posted by _Max_Cavalera_ View Post
Backgrounds... do I really need them? I know I had one, I made it because I was learning from a book and it listed the background as something to use when making a frame but as you know mine wasn't even working and i didn't even notice it because it was already supposed to be almost invisible at 0.2 alpha.
It works without one so I guess there's no problem in not having one? Or can it create problems?
The background is just a visual element to make the text more readable, you can change or remove it if you wish.



Originally Posted by _Max_Cavalera_ View Post
Lua Code:
  1. (available>0 and " (+%d)" or "")
You have this on the formatted text, I guess it's supposed to be if available > 0 do the first one else do the other one?!?! So it's like an IF statement to use inside strings?
This is another example of the inline conditional explained earlier. If available>0 is true then it inserts the format specifier for it.


Originally Posted by _Max_Cavalera_ View Post
Can you explain why %5$d and %6$d is needed to grab the 5th and 6th parameter when the position of those in the string are the 5th and 6th? Shouldn't they already pick up the right ones with just %d? Or is it \n that breaks that?
By the way, I didn't know I could do that so, thanks
This is a modification to string.format() made by the WoW API and isn't normal for Lua itself. I needed to explain the inline condition used here before explaining this so you get the idea. The inline condition decided whether or not to insert the 4th arg into the string, making the identifiers for the 5th and 6th args prone to shifting. Manually selecting which arg the identifier references fixes this problem.


Originally Posted by _Max_Cavalera_ View Post
So, that nil because of the knowledge level 0. I totally get it why that is happening, it was trying to get multiplier[0] which doesn't exist since it starts at 1... BUT... on my original code I was doing the same mistake by accident, and it never gave me an error, not only that but it was actually working correctly, giving me on the output knowledge level 0 (+0%)... that's kinda strange, no?
An alternate fix would've been to define 0 at key 0 in your table. This is done by specifying key = value in a line of your table. If you use square brackets, it evaluates the key as an expression rather than trying to register it as a string. Using this, [0] = 0 writes 0 at index 0 in the table.
Lua Code:
  1. local akMulti = {
  2.     [0] = 0,
  3.     25, 50, 90, 140, 200,
  4.     275, 375, 500, 650, 850,
  5.     1100, 1400, 1775, 2250, 2850,
  6.     3600, 4550, 5700, 7200, 9000,
  7.     11300, 14200, 17800, 22300, 24900
  8. };

You can use another inline conditional to hide the AK display if you don't have any.
Lua Code:
  1. text:SetFormattedText("AP |cff00ff00%d/%d (%.1f%%)|r" .. (pointsFree > 0 and " (+%d)" or "") .. (akLevel > 0 and "\nAK |cff00ff00%5$d (+%d%%)|r" or ""), totalXP, xpToNextPoint, 100 * totalXP / xpToNextPoint, pointsFree, akLevel, akMulti[akLevel]);
I also trimmed %6$d since the previous identifier would make it select the 6th arg anyway. This is an undocumented feature, so many of the internal processes are unknown. I initially found Blizzard using it in the localization strings and poked around with it in my own testing.



Another alternative would be to implement a fallback by using akMulti[akLevel] or 0. The or operator will make sure if the table returns nil, it'll use 0 instead.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)

Last edited by SDPhantom : 11-15-16 at 02:43 PM.
  Reply With Quote
11-15-16, 03:21 PM   #24
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
Damn, you guys are too awesome... I'm learning more these last few days than I did these last few weeks xD

The %5$d stuff I eventually understood the logic, I edited my post, but thanks for validating what I thought was happening

Those alternative fixes are great, my fix was really just temporary anyway, I was testing it and had to do something to just check if the values were fine, was the first thing that came to me xD

But why would my original code not give me any problems on that same variable when I'm not using any kind of fix to make it 0 when nil?!?!
  Reply With Quote
11-15-16, 04:31 PM   #25
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
I'm guessing it's something new involving Blizzard's formatting code, but without extensive testing to validate it, I'd avoid depending on it.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-15-16, 04:58 PM   #26
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
Yeah, for sure, if it's not 100% correct I'm not gonna use it for sure.
  Reply With Quote
11-15-16, 07:19 PM   #27
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by SDPhantom View Post
This is a modification to string.format() made by the WoW API and isn't normal for Lua itself. I needed to explain the inline condition used here before explaining this so you get the idea. The inline condition decided whether or not to insert the 4th arg into the string, making the identifiers for the 5th and 6th args prone to shifting. Manually selecting which arg the identifier references fixes this problem.
This is actually an upstream port from Lua 4.0 to WoW's version of Lua 5.1 - no idea why it was removed from Lua after 4.0, but it's obviously useful for localization purposes.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
11-15-16, 07:45 PM   #28
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
So, I'm already adding functionality, made a tooltip so that when I add more info I won't get it 100% of the time on the screen.

Lua Code:
  1. local function OnEnter(self)
  2.     GameTooltip:SetOwner(self, "ANCHOR_BOTTOM");
  3.     GameTooltip:SetText("Artifact Weapon name going here");
  4.     GameTooltip:AddLine("Move Artifact Knowledge info here and only keep one line on main frame");
  5.     GameTooltip:Show();
  6. end
  7.  
  8. local function OnLeave(self)
  9.     GameTooltip:Hide();
  10. end
  11.  
  12. frame:SetScript("OnEnter", OnEnter);
  13. frame:SetScript("OnLeave", OnLeave);

It's working as it is, easy enough. Now I wonder, since I need to use variables I already have inside the frame:SetScript("OnEvent", function(self, event, ...), should I put the tooltip code inside? Return the variables from that one so I can use them outside? Or just remake new ones outside?

What would be the correct way of doing it? The proper, efficient code way xD

I think I should return them and put it outside just because adding more and more stuff to that frame:SetScript("OnEvent", function(self, event, ...) isn't probably a good idea? But on the other hand, the info that goes in the tooltip needs to be up to date with those Events.

I donno... that's why I'm learning

Last edited by _Max_Cavalera_ : 11-15-16 at 07:51 PM.
  Reply With Quote
11-15-16, 08:56 PM   #29
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Getting that info shouldn't be terribly CPU intensive (ie not at all), so it's fine to just get it anew when you show the tooltip. You don't wanna put the SetScript("OnEnter") inside the OnEvent, if that's what you meant. You could, but that will create a new function every time you set the script which, while equally insignificant of a performance hit, is just not something you want to get into the habit of doing.

Storing the values collected in the event handler and reusing them in the tooltip is certainly not bad. Personally I would prefer not to clutter the main scope with upvalues for such a minuscule gain, but others probably would, and strictly speaking it should be the most efficient approach. If you do choose to just get the values again in the tooltip, you might want to consider making a function for it. Writing the same code more than once (except for very small amounts) should be avoided if at all possible.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
11-15-16, 09:46 PM   #30
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
So, just to see if I got it.

Putting it inside the OnEvent isn't a good idea like I imagined.

Returning the values from the OnEvent so I can use them outside on another function (which was what I thought to be the best way), you're saying you wouldn't do?

Doing the same code since it's not much doesn't seem bad but since some info needs to update on Events wouldn't that mean I would need to do like 90% of the OnEvent again? I would end up with OnEnter inside the OnEvent anyway?! Or maybe I'm not seeing it right, it's like 4 AM, I'll look at it tomorrow

Thanks for the input.

Edit:. Yeah..... As soon as I lay down in bed I was like "wtf did I say"

The tooltip doesn't need the events to update the info, it updates at least every time I put the mouse over the frame, right?

I'm going to sleep, this is lack of it xD

Last edited by _Max_Cavalera_ : 11-15-16 at 10:04 PM.
  Reply With Quote
11-16-16, 04:47 AM   #31
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
You can try this. Be sure to add frame:EnableMouse(true) up where the frame is being set up to have it respond to mouse events.

Lua Code:
  1. frame:SetScript("OnEvent", function(self, event, ...)
  2.     local itemID, _, itemName, itemIcon, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
  3.  
  4.     if itemID then
  5.         local pointsFree, xpToNextPoint = 0, C_ArtifactUI.GetCostForPointAtRank(pointsSpent);
  6.  
  7.         while totalXP >= xpToNextPoint do
  8.             totalXP, pointsSpent, pointsFree, xpToNextPoint = totalXP - xpToNextPoint, pointsSpent + 1, pointsFree + 1, C_ArtifactUI.GetCostForPointAtRank(pointsSpent + 1);
  9.         end
  10.         text:SetFormattedText("AP |cff00ff00%d/%d (%.1f%%)|r" .. (pointsFree > 0 and " (+%d)" or ""), totalXP, xpToNextPoint, 100 * totalXP / xpToNextPoint, pointsFree);
  11.     end
  12.  
  13.     frame:SetShown(itemID and true or false);
  14. end);
  15.  
  16. frame:SetScript("OnEnter", function(self)
  17.     local _, _, itemName = C_ArtifactUI.GetEquippedArtifactInfo()
  18.     local _, akLevel = GetCurrencyInfo(1171);
  19.  
  20.     GameTooltip:SetOwner(self, "ANCHOR_BOTTOM");
  21.     GameTooltip:SetText(itemName);
  22.     if akLevel > 0 then
  23.         GameTooltip:AddLine(string.format("Artifact Knowledge |cff00ff00%d (+%d%%)|r",akLevel,akMulti[akLevel] or 0));
  24.     end
  25.     GameTooltip:Show();
  26. end);
  27.  
  28. frame:SetScript("OnLeave", function(self) GameTooltip:Hide(); end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-16-16, 02:24 PM   #32
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
After my "epiphany" yesterday when going to bed, I got to think that Lombra was most probably right when saying the best way in this case would be to just do those 1 or 2 lines again since it was just that pretty much.

I did this before I saw your post.

Lua Code:
  1. local akMulti = {
  2.     25, 50, 90, 140, 200,
  3.     275, 375, 500, 650, 850,
  4.     1100, 1400, 1775, 2250, 2850,
  5.     3600, 4550, 5700, 7200, 9000,
  6.     11300, 14200, 17800, 22300, 24900
  7. };
  8.  
  9. local frame = CreateFrame("Frame", "m4xArtifactFrame", UIParent);
  10. local text = frame:CreateFontString(nil, "ARTWORK");
  11. text:SetFont("Fonts\\FRIZQT__.TTF", 15, "OUTLINE");
  12. text:SetJustifyH("LEFT");
  13. text:SetTextColor(1, 0.82, 0);
  14. text:SetPoint("TOPLEFT", UIParent, "TOPLEFT");
  15.  
  16. text:SetText("Initializing...");
  17.  
  18. frame:SetAllPoints(text);
  19.  
  20. frame:RegisterEvent("PLAYER_ENTERING_WORLD");
  21. frame:RegisterEvent("PLAYER_EQUIPMENT_CHANGED");
  22. frame:RegisterEvent("ARTIFACT_CLOSE");
  23. frame:RegisterEvent("ARTIFACT_RESPEC_PROMPT");
  24. frame:RegisterEvent("ARTIFACT_XP_UPDATE");
  25.  
  26. frame:SetScript("OnEvent", function(self, event, ...)
  27.     local itemID, _, _, _, totalXP, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
  28.    
  29.     if itemID then
  30.         local pointsFree, xpToNextPoint = 0, C_ArtifactUI.GetCostForPointAtRank(pointsSpent);
  31.        
  32.         while totalXP >= xpToNextPoint do
  33.             totalXP, pointsSpent, pointsFree, xpToNextPoint = totalXP - xpToNextPoint, pointsSpent + 1, pointsFree + 1, C_ArtifactUI.GetCostForPointAtRank(pointsSpent + 1);
  34.         end
  35.  
  36.         text:SetFormattedText("AP |cff00ff00%d/%d (%.1f%%)|r" .. (pointsFree > 0 and " (+%d)" or ""), totalXP, xpToNextPoint, 100 * totalXP / xpToNextPoint, pointsFree);
  37.  
  38.     end
  39.  
  40.     frame:SetShown(itemID and true or false);
  41. end);
  42.  
  43. local function OnEnter(self)
  44.     local _, akLevel = GetCurrencyInfo(1171);
  45.     local _, _, itemName, itemIcon, _, pointsSpent = C_ArtifactUI.GetEquippedArtifactInfo()
  46.     local _, effectiveStat = UnitStat("player", 3);
  47.  
  48.     GameTooltip:SetOwner(self, "ANCHOR_BOTTOM");
  49.     GameTooltip:SetText(itemName);
  50.     GameTooltip:AddLine(" ");
  51.     GameTooltip:AddLine(string.format("Artifact Knowledge Level: |cff00ff00%d (+%d%%)|r", akLevel, akMulti[akLevel] or 0));
  52.     GameTooltip:AddLine(string.format("Next Artifact Knowledge: |cff00ff00%d (+%d%%)|r", akLevel + 1, akMulti[akLevel + 1]));
  53.     GameTooltip:AddLine(" ");
  54.     GameTooltip:AddLine(string.format("Stamina from points: |cff00ff00+%g%% (+%d)|r", pointsSpent * 0.75, effectiveStat - (effectiveStat / ((pointsSpent * 0.75 / 100) + 1))));
  55.     GameTooltip:Show();
  56. end
  57.  
  58. local function OnLeave(self)
  59.     GameTooltip:Hide();
  60. end
  61.  
  62. frame:SetScript("OnEnter", OnEnter);
  63. frame:SetScript("OnLeave", OnLeave);

You think it's not as "correct" as your example?

It's working perfectly as it is.


This is with mouseover obviously, mouse just doesn't show on the screenshot.

Don't have that frame:EnableMouse(true), you think it's just enabled by default now or something?
  Reply With Quote
11-16-16, 03:17 PM   #33
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
Originally Posted by _Max_Cavalera_ View Post
Don't have that frame:EnableMouse(true), you think it's just enabled by default now or something?
You only need it to respond to mouse clicks, I think.
__________________
Grab your sword and fight the Horde!
  Reply With Quote
11-16-16, 04:52 PM   #34
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
Originally Posted by Lombra View Post
You only need it to respond to mouse clicks, I think.
oh, ok
Then I guess I will need it since I want to use mouse clicks after
  Reply With Quote
11-16-16, 07:06 PM   #35
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
You might want to take note that the stat bonuses from spending points in your artifact is different for each one. Some scale differently and some boost a completely different stat.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-16-16, 08:59 PM   #36
_Max_Cavalera_
A Fallenroot Satyr
 
_Max_Cavalera_'s Avatar
Join Date: Dec 2007
Posts: 28
Originally Posted by SDPhantom View Post
You might want to take note that the stat bonuses from spending points in your artifact is different for each one. Some scale differently and some boost a completely different stat.
I have 5 110's and never seen anything other than Stamina :/ Have to check it more carefully.
What some have that I've noticed is, on healing and tank spec for example they get bonus damage on top of the stamina.

edit:. Just checked a bunch of chars and multiple spec weapons on each and the 0.75% stamina per point seems to be consistent. Even though between those chars and specs, the artifact weapon development of each was different, so it was a good test group so to say.

Then the tank specs seem to have on top of that, 0.5% damage per point, and healers 1% damage per point, but those I don't know if I had different because it was tank and healer or because the healer was further ahead in artifact weapon development. But I would bet it's also static 0.5 for tanks and 1 for healers.

edit:. Just found this on WoWHead

Trait Perks

The amount of total trait ranks you have purchased increases the amount of Stamina +/- Damage Dealt (up to point #34 on your Artifact tree).
Healer and Tank Specs gain 0.75% Stamina + 1% Damage Dealt for every trait unlocked (25.5% increased Stamina and 34% increased Damage Dealt for a fully maxed Artifact Weapon).
Discipline Sacerdotes, as a hybrid DPS/Healer gains 0.75% Stamina and 0.5% Damage Dealt for every trait unlocked (25.5% increased Stamina and 17% increased Damage Dealt for a fully maxed Artifact Weapon).
DPS Specs gain 0.75% Stamina for every trait unlocked (25.5% increased Stamina for a fully maxed Artifact Weapon).

They say tanks also get 1% like healers but my tanks had 0.5 :/

Last edited by _Max_Cavalera_ : 11-17-16 at 06:41 AM.
  Reply With Quote
11-17-16, 11:39 PM   #37
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Seerah View Post
I think it is, too. And it doesn't save on anything other than space.
Not quite true -- it's applicable to other languages that don't have a ternary syntax (or at least a sensible one) like Python. Also, even for languages that do have some kind of (sensible) ternary syntax, "not not X" or "!!X" looks and works pretty much the same way in every language where it works at all, meaning you have to shift fewer gears when you move between a Lua project and a project in another language. Even if I found "not not X" harder to follow at first glance than "X and true or false", I'd still favor "not not X" for that reason.

Plus, when I see "not not X" there's only one possible intention -- to typecast to a boolean. When I see "X and A or B" there are a lot of possibilities, and I find it's more mental effort to read.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote
11-18-16, 01:22 AM   #38
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,313
Lua doesn't have ternary syntax either. It's two binary logic operators taking advantage of shortcuts Lua takes in evaluating them. It's literally a hack to implement.

When I quickly scan through code to try to understand what it's doing, my mind has a hard time registering not not and only sees one of them, which throws in a bit of confusion requiring a couple more looks over finally catch it.

Feel free to use it in your own code, but I reserve the right to respectfully disagree.
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote
11-18-16, 12:48 PM   #39
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Originally Posted by Phanx View Post
Not quite true -- it's applicable to other languages...
I don't think that counts.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
11-18-16, 11:47 PM   #40
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Seerah View Post
I don't think that counts.
Depends on what you're counting towards/against, I guess.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Learning, need help

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off