Thread: Miscellaneous Hacks - WoW Character BBCode
View Single Post
  #37  
Old 02-14-2008, 08:40 PM
sweede's Avatar
sweede sweede is offline
 
Join Date: Jan 2007
Posts: 391
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MrShides View Post
we got it all working, its www.free-collective.us.

it just began working on its own, maybe armory lag?

What I'd really like to do is get this added to the postbit using a custom profile field. That would be slick.
Create a new plugin, make sure that you select the WoW BB Code product
HookLocation: postbit_display_start
title : WoW Char Postbit
PHP code is as follows
Code:
// Change the Field2 to whatever custom profile field your have setup in the admincp.
// If your server field is 7 and your character field is 8, you would use
// $wowchar_server   = $post['field7'];
// $wowchar_charname = $post['field8'];
////////////////////////////////////////////////////////////////////////////////////////

$wowchar_server   = $post['field1'];
$wowchar_charname = $post['field2'];

global $vbulletin;
$wowchar_use_default =  false;
if(!$wowchar_server)
{
	$wowchar_server = $vbulletin->options['wowcharcode_default_realm'];
	$wowchar_use_default =  true;
}

if($wowchar_charname != false or $server != false)
{
	$wowchar_charname = trim($wowchar_charname);
	$wowchar_server = trim($wowchar_server);
	
	//override default armory URL.
	preg_match("/(EU|US)-(.*)/", $wowchar_server, $match);
	
	if($match[1] == true)
	{
		$armory_locale = strtolower($match[1]);
		$armory_server = $match[2];
	} else {
		$armory_locale = strtolower($vbulletin->options['wowcharcode_locale']);
		$armory_server = $wowchar_server;
	}
	
	switch($armory_locale)
	{
		case 'eu':
			$armoryurl = 'http://eu.wowarmory.com';
			break;
		case 'us':
			$armoryurl = 'http://www.wowarmory.com';
			break;
	}

	//$wowchar_code = "<img src='clientscript/wowbbcode_js/char.gif' border='0' align='middle'>";
	$wowchar_code .= "<a href=\"".$armoryurl."/character-sheet.xml?r=".str_replace(" ","+",$armory_server)."&n=".$wowchar_charname."\"";
	$wowchar_code .= " target=\"new\"";
	$wowchar_code .= " onmouseover='ajax_showTooltip(\"".$vbulletin->options['bburl']."/ajax.php?do=wowcharcode&server={xserver}&char={charname}\",this);";
	$wowchar_code .= " return false' onmouseout='ajax_hideTooltip()'>";
	if($vbulletin->options['wowcharcode_display_realm'] == 0 && $wowchar_use_default == true) 
	{
		$wowchar_code .= "<strong>&lt;{charname}&gt;</strong></a>";
	} else {
		$wowchar_code .= "<strong>&lt;{server}: {charname}&gt;</strong></a>";
	}
	
	$wowchar_server = str_replace("'","'",$wowchar_server);
	$wowchar_code = str_replace("{xserver}",str_replace(" ","+",$wowchar_server), $wowchar_code);
	$wowchar_code = str_replace("{server}",$wowchar_server, $wowchar_code);
	$wowchar_code = str_replace("{charname}",$wowchar_charname, $wowchar_code);
}   else {
	$wowchar_code = false;
}
Be sure to read and edit the first few lines of the plugin code.
Save

The variable $wowchar_code is now avialable to use in the postbit (or postbit_legacy). The output is something like "<Vek'nilash: Azaril>"

It where ever you see fit.

The other error, you can fix it by opening up the functions_wowcharcode.php and replacing line 743
Code:
unset($char['characterinfo']['charactertab']['items']);
with

Code:
    if(is_array($char['characterinfo']['charactertab']['items']))
    {
        unset($char['characterinfo']['charactertab']['items']);
    }
Reply With Quote
 
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01121 seconds
  • Memory Usage 1,784KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD_SHOWPOST
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code
  • (1)bbcode_quote
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • reputationlevel
  • showthread
Included Files:
  • ./showpost.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showpost_start
  • bbcode_fetch_tags
  • bbcode_create
  • postbit_factory
  • showpost_post
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • showpost_complete