I had an item which was getting parsed very weird (Handwraps of the Aggressor with a +10 stamina enchant). It was failing to detect the enchant and ended up marking the Durability line as the enchant.
This in turn caused the +10 stamina line not to be removed from the stack, which ended up overwriting the basestat of +36 stamina.
I've been debugging and found the error, it's in lib/item.php, lines 961 through 966.
Original code:
- Code: Select all
if( preg_match($roster->locale->wordings[$locale]['tooltip_preg_socketbonus'], $tooltip, $matches) )
{
$tooltip = str_replace( $matches[0], '', $tooltip );
$tooltipWithoutColoredLines = str_replace( $matches[0], '', $tooltipWithoutColoredLines );
$tt['Attributes']['SocketBonus'] = $matches[0];
}
Now the preg_match here is matching just fine, but the 2 lines which are supposed to remove the matched line from the stack forget to remove a newline character, which causes an empty line to end up in the stack.
Later on this will make the check for an enchant fail (@line 1016)
The fixed code:
- Code: Select all
if( preg_match($roster->locale->wordings[$locale]['tooltip_preg_socketbonus'], $tooltip, $matches) )
{
$tooltip = str_replace( $matches[0] . "\n", '', $tooltip );
$tooltipWithoutColoredLines = str_replace( $matches[0] . "\n", '', $tooltipWithoutColoredLines );
$tt['Attributes']['SocketBonus'] = $matches[0];
}
All I did was add . "\n" to the 2 lines that remove the matched line.
If you check the rest of the code, you'll see that at other places the \n was already in place, it appears to have been forgotten at this place.
Afaik this caused no regressions but it did fix several badly parsed items.