These are chat archives for arenanet/api-cdi

5th
Feb 2018
ChieftainAlex
@ChieftainAlex
Feb 05 2018 18:04

https://wiki.guildwars2.com/wiki/Talk:Winter%27s_Heart_Infusion_(Healing_Power)

How come when I look at these on places like spidy it doubles up the stats? i.e. shows the +5 HP +9 AR twice...? ~Lya

do you think that counts as a bug with the api?
yes
more accurately, conflict with content
Archomeda
@Archomeda
Feb 05 2018 18:12
i doubt it's a conflict with content
i'm unsure if the infix_upgrade always showed the attributes
while unnecessary for the API to show the buff, it's not really a bug
it's only shown once in the attributes
Medyro
@Medyro
Feb 05 2018 19:52
Four things:
  1. Looking at the souce code of GW2Spidy, i'd guess that this might heve it's cause in this Method
  2. I have not much of an idear of PHP. As such be aware that the following is only a guess; as is the above
  3. I think replacing the Line here with the following could possibly solve the duplicated display; at least for the Winter's Heart Infusion witch only lists "Healing" in the Descryption on the API but not "Healing Power" witch this Line implies that the Implementation seems to expect.
    if ($attr['attribute'] == 'AgonyResistance')    $attr['attribute'] = 'Agony Resistance';
  4. I'd be greatfull if anyone with PHP knowledge could maybe check this and tell me if i guessed right or not.
Archomeda
@Archomeda
Feb 05 2018 19:58
seems this method needs to be partly rewritten
it takes the existing attributes from the api, and parses the buff description into additional attributes
which is why for some infusions, you get things like "+10 Power", while for others that have different namings "+5 ConditionDuration" and "+5 Expertise"
Medyro
@Medyro
Feb 05 2018 20:00
The thing is that that Method seems to be caled only after the one i linked tough. See here
So i tought it would be enough to replace that line. But as said only guessed :/
Archomeda
@Archomeda
Feb 05 2018 20:01
hmm
i think you're right about that line
that whole function addBuffsToAttributes seems to be redundant
#112 maybe related?

However, upgrade components only have a buff, so we have to look to see if the number has a percent sign or not before we can translate Boon/ConditionDuration to Concentration/Expertise.

this implies that at some point in the past, certain items did not have any attributes associated with them

so, that explains why gw2spidy has that piece of code
Medyro
@Medyro
Feb 05 2018 20:07
Um.. could be. My guess relied on the presence of the $.infix_upgrade.buff.description field witch tryed to check against the array of attribute names in $.infix_upgrade.attributes witch however, at the time of the check, seem to have already been replaced with other asumptions for there representation in the Descryption Field.
Archomeda
@Archomeda
Feb 05 2018 20:09
hmm yeah, some of the names are replaced indeed
that's just to make it look nice on the website i think
if an attribute happens to be in both the buff description and as an attribute, they are still counted twice
Medyro
@Medyro
Feb 05 2018 20:11
Expect that it seems to happen a bit to early as it happens before here
Archomeda
@Archomeda
Feb 05 2018 20:11
poking @lye if he can remember doing something on the /v2/items endpoint in regarding to the attributes
Medyro
@Medyro
Feb 05 2018 20:13
I don't think that he has done anything there. Besides that i just wanted to guess anyway, so it doesn't really matter.
Archomeda
@Archomeda
Feb 05 2018 20:13
that line specifically checks if an attribute ID already exists in the array of attribute IDs
it's no problem :D
i got curious as well when you sent your message
Medyro
@Medyro
Feb 05 2018 20:14
Anyways. Thanks for having a look for me at it; regarding 4. :D
Archomeda
@Archomeda
Feb 05 2018 20:14
it might very well be that the buffs were transformed into actual attributes in content
at some point recently
in that case, lye doesn't know about it at all
it's just that no one was bothered to remove the buffs, either due to legacy support, or just forgotten
Medyro
@Medyro
Feb 05 2018 20:16
If you walk it trough from the getTooltipDescryption Method at the beginning you might find out what i mean. And as that is something implementation specific, given that i'm right, he couldn't even if he wanted to.
Might as well be true
Archomeda
@Archomeda
Feb 05 2018 20:18
:)
anyhow, whatever the problem/inconsistency was with buffs and actual attributes, it seems to be fixed on API level
@darthmaim how are you parsing the attributes, on e.g. https://en.gw2treasures.com/item/86405 ?
@Archomeda I don't recall how infix buffs work, unfortunately
Archomeda
@Archomeda
Feb 05 2018 20:20
hmm :(
i do recall something like buff descriptions, but missing their attribute counterparts; but that was a long time ago i think, and that seems to be fixed now
iirc the buff description is a string, and infix attrs are the machine-readable version that generates a string
(the actual values can be different from both of them)
I'm not sure which one takes precedence in the UI if both are set
I'm guessing the description string though
Medyro
@Medyro
Feb 05 2018 20:23
@Archomeda Hes probably not adding both things into one (that is either $.infix_upgrade.buff.description into $.infix_upgrade.attributes or vice versa) and only uses one of the two things, probably the later.
And i think it also might be that this is a little longer on Spidy already, only that no one sayd anything about it yet probably.
Archomeda
@Archomeda
Feb 05 2018 20:25
@CuriousCharr this piece of code indeed checks if the attribute hasn't been added already; but there's also an else statement that adds the values of 2 equally named attributes together
@lye so the buff description can be manually set, and if not, it will generate a description based on the attributes? makes sense
Archomeda
@Archomeda
Feb 05 2018 20:31
would be interesting to see if there are actually still items that have no infix attributes associated with them, but do have infix buff descriptions on them
Medyro
@Medyro
Feb 05 2018 20:32
I get what the line does, it looks into an array from the infix_uppgrade, only that this Method has already been caled before, witch means that the 'Healing' from the atributes array has already been replaced with 'Healing Power' by this line i still don't trust witch seems to do an in place replace of the names in the infix_atribtes array, leaving 'Healing Power in there. Witch is then leater gathered here and checked against an exploded version of the Descrption. Problem is, the description is '+5 Healing\n+9 Agony Resistance' aka. doesn't include the in place replaced value 'Healing Power'
That's as good as i can do with trying to explain with Text.
Also, all of witch originates from here witch is wy i always go back to the order of methodcalls in that one Method
But anyways. I thank you for having a look at 4. for me again and don't want to bother anny further :D
isn't it still this ugly thing?
(haven't checked for new infix skills tho)
JC123
@JC123
Feb 05 2018 22:30
looks like the string is used for ui when both are present