Ok, so I'm trying to think of a way to integrate the new diminishing returns on secondary stats into my addon's calculations so that it shows the correct numbers.
Currently, since everything is linear all I have to do is pull the amount of a secondary stat that the item gives from the stats table returned by GetItemStats, and divide it by the amount of rating per 1% at your current level. Now with the diminishing returns, it seems like its going to get a lot more complicated to present the actual percentage that an amount of a particular stat on an item will actually give you.
So using this table as my guide:
From 0 to 25%, there's no penalty.
From 25% to 34%, there's a 10% penalty.
From 34% to 42%, there's a 20% penalty.
From 42% to 49%, there's a 30% penalty.
From 49% to 106%, there's a 40% penalty.
You can't get more than 106% from gear rating.
This is how I think I should work on calculating the correct amounts.
Get the item's stat table using the itemlink from GetItemInfo, inserted itno GetItemStats
Using the item stat table, capture the current rating totals that your character has for the secondary stats that the item has.
Get the item's inventory type by using C_Item.GetItemInventoryType
Use the item's inventory type id, to get the itemlink for the currently equipped item for the slot that the new item goes into
Pull the stats off that equipped item
If the currently equipped item has any of the same secondary stats as the new item, subtract them from the current player total to get a new baseline for those stats.
Take the new baseline stats and the stats from the new item, and run them through a complicated formula using the DR table to determine what the actual percentages provided by the rating amounts on the new item actually are.
This seems like the most logical way to accurately calculate the conversion from ratings to percentages, in my mind at least. Anyone have any more streamlined ideas, or see any major flaws in my logic?
Also, in regards to mastery, if I read everything right, the DR applies to the formula prior to multiplying by the mastery coefficient? Anyone know for sure?