Forum:CPs and DOM Inspection

So I've been doing some poking around when trying to work out challenge point (CP) gains, and thought it was worth sharing my discoveries.

Generally I keep a document with the level and current points of various qualities e.g. Making Waves 28.10 = level 28 plus 10 CPs. When I gain a number of points it's easy enough to calculate the gain by looking at the previous level and the new level. This does require one to keep a record of the old levels, which is somewhat painful. But when an unknown gain hits a level boundary, there's no way to tell what the new level is - I have to mark it as, e.g., Making Waves 29.?, until the level changes by a known amount. If another unknown change occurs I won't be able to work out either amount.

Or so I thought...

It turns out that you can inspect the progress bar element in Chrome or Firefox (right-click and select Inspect Element). This brings up the DOM inspector, in which you'll see something like the following:



The relevant bits here are width="0%", which indicates the bar starting position, and the matching end width in either the onload or style attributes, which here is 83%. Since I know this occurred at level 5, it's easy enough to work out that the start position was at 0 CPs, and the end position was 5 CPs (83% of level 6), which gives a gain of 5 CPs.

The second discovery is that this still works when the gain hits a level boundary, but it's a little bit weird, and requires that we know the starting point. Let me concoct another example: 

If this occurred at level 5, then the apparent rise is from 5.3 (50%) to 6.0, a gain of 3 CPs plus some other number of points above level 6. Except I know that this quality was actually at 5.5 beforehand, so the 50% part appears to makes no sense. The surprise is that this indicates that the gain is actually 3 CPs - the game engine has deducted this amount from the end width to work out the start width. If we add this to our known quality level, we can work out that we're now at 6.2.

I haven't yet looked at how this works when the number of CPs takes one across more than one level - it seems unlikely that the widths will be either less than zero or above 100%.

Hopefully this makes sense and is useful to someone else!

Jemann (talk) 10:47, March 16, 2015 (UTC)