Here is a list of code replacements for modified WoW Roster users:
Find In File: settings.php
- Code: Select all
require_once (ROSTER_LIB.'commonfunctions.lib.php');
Add BEFORE
- Code: Select all
require_once (ROSTER_LIB.'WoW_IDs.php'); // include before common functions because of a define used in functions file.
Find In File: lib/item.php
- Code: Select all
$tooltip = makeOverlib($this->data['item_tooltip'],'',$this->data['item_color'],0,$lang);
CHANGE to
- Code: Select all
$tooltip = makeOverlib($this->data['item_tooltip'],'',$this->data['item_color'],0,$lang,'',$this->data['item_id']);
Find In File: lib/commonfunctions.lib.php
- Code: Select all
function makeOverlib( $tooltip , $caption='' , $caption_color='' , $mode=0 , $locale='' , $extra_parameters='')
CHANGE to
- Code: Select all
function makeOverlib( $tooltip , $caption='' , $caption_color='' , $mode=0 , $locale='' , $extra_parameters='', $itemid='' )
Find In File: lib/commonfunctions.lib.php
- Code: Select all
switch ($mode)
{
case 0:
$tooltip = colorTooltip($tooltip,$caption_color,$locale,$caption_mode);
break;
case 1:
$tooltip = cleanTooltip($tooltip,$caption_color,$caption_mode);
break;
case 2:
break;
default:
$tooltip = colorTooltip($tooltip,$caption_color,$locale,$caption_mode);
break;
}
CHANGE to
- Code: Select all
switch ($mode)
{
case 0:
$tooltip = colorTooltip($tooltip,$caption_color,$locale,$caption_mode,$itemid);
break;
case 1:
$tooltip = cleanTooltip($tooltip,$caption_color,$caption_mode);
break;
case 2:
break;
default:
$tooltip = colorTooltip($tooltip,$caption_color,$locale,$caption_mode,$itemid);
break;
}
Find In File: lib/commonfunctions.lib.php
- Code: Select all
setTooltip($num_of_tips,$tooltip);
return 'onmouseover="return overlib(overlib_'.$num_of_tips.$caption.$extra_parameters.');" onmouseout="return nd();"';
}
CHANGE to
- Code: Select all
setTooltip($num_of_tips,$tooltip);
return 'onmouseover="return overlib(overlib_'.$num_of_tips.$caption.$extra_parameters.', WIDTH, '.OVERLIB_WIDTH.');" onmouseout="return nd();"';
}
Find In File: lib/commonfunctions.lib.php
- Code: Select all
/**
* Tooltip colorizer function with string cleaning
* Use only with makeOverlib
*
* @param string $tooltip | Tooltip as a string (delimited by "\n" character)
* @param string $caption_color | (optional) Color for the caption
* Default is 'ffffff' - white
* @param string $locale | (optional) Locale so color parser can work correctly
* Default is $roster_conf['roster_lang']
* @param bool $inline_caption | (optional)
* Default is true
* @return string | Formatted tooltip
*/
function colorTooltip( $tooltip , $caption_color='' , $locale='' , $inline_caption=1 )
{
REPLACE THIS FUNCTION WITH THE FOLLOWING THREE FUNCTIONS!
- Code: Select all
function parseItemId($itemid)
{
if(empty($itemid))
{
return false;
}
list ($item_id, $enchant_id, $gem_id_1, $gem_id_2, $gem_id_3, $gem_id_4, $suffix_id, $unique_id) = explode(':', $itemid);
$return = array
(
'item_id' => $item_id,
'enchant_id' => $enchant_id,
'gem1' => $gem_id_1,
'gem2' => $gem_id_2,
'gem3' => $gem_id_3,
'gem4' => $gem_id_4,
'suffix_id' => $suffix_id,
'unique_id' => $unique_id
);
return $return;
}
function parseTooltipEnchantments($searchLine, $search_IDs, $searchEnchants=false, $searchGems=false)
{
if(empty($searchLine) OR empty($search_IDs)) // did this function get called correctly?
{
return false;
}
global $enchantment_ids;
global $gem_ids;
global $roster_conf;
//init return array
$return = array
(
'matched_enchant' => false, // true if enchant is found in line
'matched_gem' => false, // true if a gem is found in line
'txt' => '', // converted text to return
'debug' => '', // debug level 1 messages
'debug_2' => '', // debug level 2 messages
);
if ($searchEnchants) // the searchLine might include an enchantment so look for one.
{
if(strstr($searchLine, $enchantment_ids[$search_IDs['enchant_id']]))
{
$return['txt'] = '<span style="color:#00ff00;">'.$searchLine.'</span>';
$return['matched_enchant'] = true;
$return['debug_2'] = 'Found Enchantment: "'.$enchantment_ids[$search_IDs['enchant_id']].'"';
}
}
if($search_IDs['gid1'] <> 0)
{
$gemlist = array($search_IDs['gid1'], $search_IDs['gid2'], $search_IDs['gid3'], $search_IDs['gid4']);
foreach($gemlist as $id)
{
if(strstr($searchLine, $gem_ids[$id]['txt']))
{
$return['txt'] = '<img width="16px" height="16px" src="'.$roster_conf['interface_url'].'Interface/Icons/'.$gem_ids[$id]['img'].'.'.$roster_conf['img_suffix'].'" alt="" /><span style="color:#00ff00;"> '.$gem_ids[$id]['txt'].'</span>';
$return['debug_2'] = 'Found gem id: '.$id.'<br />';
$return['matched_gem'] = true;
$return['found_id'] = $id;
break; // found a match... break out of loop
}
}
}
return $return;
}
/**
* Tooltip colorizer function with string cleaning
* Use only with makeOverlib
*
* @param string $tooltip | Tooltip as a string (delimited by "\n" character)
* @param string $caption_color | (optional) Color for the caption
* Default is 'ffffff' - white
* @param string $locale | (optional) Locale so color parser can work correctly
* Default is $roster_conf['roster_lang']
* @param bool $inline_caption | (optional)
* Default is true
* @param string $itemid | (optional) will parse enchantments and gems if passed
* @return string | Formatted tooltip
*/
function colorTooltip( $tooltip , $caption_color='' , $locale='' , $inline_caption=1, $itemid='' )
{
global $wordings, $roster_conf, $enchantment_ids;
// Use main locale if one is not specified
if( $locale == '' )
$locale = $roster_conf['roster_lang'];
// Initialize tooltip_out
$tooltip_out = array();
$current_line = 0;
$out = array();
// Standardize for conversion
$tooltip = str_replace("\n\n", '<br>', $tooltip); // cheap hack to fix double line breaks in tooltip
$tooltip = str_replace('<br>', "\n", $tooltip);
$tooltip = str_replace('<br />', "\n", $tooltip);
//convert tooltip to array
$tooltip = explode("\n", $tooltip);
//how many lines is the tooltip?
$tooltip_lines = count($tooltip);
//reverse the array to process last first
$tooltip = array_reverse($tooltip);
$tooltip_debug = ''; // quiet
$tooltip_debug_2 = ''; // verbose
if(!empty($itemid))
{
// itemid was passed
$itemid = parseItemId($itemid);
$doEnchants = (empty($itemid['enchant_id']) ? false : true);
$doGems = (empty($itemid['gem1']) ? false : true);
$search_IDs = array
(
'enchant_id'=> $itemid['enchant_id'],
'gid1' => $itemid['gem1'],
'gid2' => $itemid['gem2'],
'gid3' => $itemid['gem3'],
'gid4' => $itemid['gem4'],
);
}
foreach ( $tooltip as $line )
{
//foreach loop counter
$current_line++;
$color = '';
if( !empty($line) )
{
$line = preg_replace('|\\>|','›', $line );
$line = preg_replace('|\\<|','‹', $line );
$line = preg_replace('/\|c[a-f0-9]{2}([a-f0-9]{6})(.+?)\|r/i','<span style="color:#$1;">$2</span>',$line);
// Do this on the last line (first line when reversed again)
// This is performed when $caption_color is set
if( ($inline_caption == 1) && ($current_line == $tooltip_lines) )
{
if( $caption_color == '' )
$caption_color = 'ffffff';
if( strlen($caption_color) > 6 )
$color = substr( $caption_color, 2, 6 ) . ';font-size:12px;font-weight:bold';
else
$color = $caption_color . ';font-size:12px;font-weight:bold';
}
else
{
if ( ereg('^'.$wordings[$locale]['tooltip_use'],$line) )
$color = '00ff00';
elseif ( ereg('^'.$wordings[$locale]['tooltip_requires'],$line) )
$color = 'ff0000';
elseif ( ereg('^'.$wordings[$locale]['tooltip_reinforced'],$line) )
$color = '00ff00';
elseif ( ereg('^'.$wordings[$locale]['tooltip_equip'],$line) )
$color = '00ff00';
elseif ( ereg('^'.$wordings[$locale]['tooltip_chance'],$line) )
$color = '00ff00';
elseif ( ereg('^'.$wordings[$locale]['tooltip_enchant'],$line) )
$color = '00ff00';
elseif ( ereg('^'.$wordings[$locale]['tooltip_soulbound'],$line) )
$color = '00bbff';
elseif ( ereg('^'.$wordings[$locale]['tooltip_set'],$line) )
$color = '00ff00';
elseif ( preg_match('|\([a-f0-9]\).'.$wordings[$locale]['tooltip_set'].'|',$line) )
$color = '666666';
elseif ( ereg('^"',$line) )
$color = 'ffd517';
elseif (ereg('Shift Right Click', $line))
$line = '';
}
// Convert tabs to a formated table
if( strpos($line,"\t") )
{
$line = str_replace("\t",'</td><td align="right" class="overlib_maintext">', $line);
$line = '<table width="100%" cellspacing="0" cellpadding="0"><tr><td class="overlib_maintext">'.$line.'</td></tr></table>';
$tooltip_out[] = $line;
}
elseif (preg_match('/(Yellow|Blue|Red|Meta)\sSocket/', $line))
{
$tooltip_out[] = preg_replace('/(Yellow|Blue|Red|Meta)\sSocket/', '<img src="'.$roster_conf['interface_url'].'Interface/ItemSocketingFrame/UI-EmptySocket-$1.'.$roster_conf['img_suffix'].'"> $1 Socket', $line);
}
elseif( !empty($color) )
{
$tooltip_out[] = '<span style="color:#'.$color.';">'.$line.'</span><br />';
}
elseif(!empty($itemid)) // nothing else matched lets try to match enchantments and gems if we have an ItemID string
{
$out = parseTooltipEnchantments($line, $search_IDs, $doEnchants, $doGems);
if ($out['matched_enchant'] == true)
{
$line = $out['txt'];
$doEnchants = false;
if(TOOLTIP_DEBUG == 2)
$toolip_debug_2 .= $out['debug_2'];
if(TOOLTIP_DEBUG == 1)
$toolip_debug .= $out['debug'];
}
elseif ($out['matched_gem'] == true)
{
// matched gem
$line = $out['txt'];
if(TOOLTIP_DEBUG == 2)
$toolip_debug_2 .= $out['debug_2'];
}
$tooltip_out[] = $line.'<br />';
}
}
else
{
$tooltip_out[] = '<br />';
}
}
// convert tooltip back to a sting and re-reverse
$tooltip_out = implode('', array_reverse($tooltip_out));
if (TOOLTIP_DEBUG == 2) // display verbose debugging info in tooltip
{
$tooltip_out .= '<hr><br />itemid: '.$itemid['item_id'].' enchantid: '.$itemid['enchant_id'].'<br />';
$tooltip_out .= 'gem1: '.$itemid['gem1'].' gem2: '.$itemid['gem2'].' gem3: '.$itemid['gem3'].' gem4: '.$itemid['gem4'].'<br />';
$tooltip_out .= $toolip_debug_2;
}
if (TOOLTIP_DEBUG >= 1) // display quiet debugging info, just parsing errors / unmatched texts.
{
if($itemid['enchant_id'] <> 0 && $doEnchants == true)
{
if(TOOLTIP_DEBUG == 1)
{
$tooltip_out .= '<hr>';
}
$tooltip_out .= 'Failed to match enchant_id: <b>'.$itemid['enchant_id'].'</b> to tooltip text!<br />"'.$enchantment_ids[$itemid['enchant_id']].'" was searched for.<br />';
}
}
return $tooltip_out;
}