SimplePortal

Customization => Blocks and Modifications => Mod Requests => Topic started by: Xerog on January 07, 2011, 12:52:51 PM

Title: Wow Raid Progression Code Assistance.
Post by: Xerog on January 07, 2011, 12:52:51 PM
I was trying to come up with a way to post raid progression on our website and came across this code here.
http://www.tinyportal.co.uk/index.php?topic=19751.30

I am aware that this code was configured for use with tiny portal however I am able to plug the code into a custom php block and preview it but when I click add block the error I receive is... Syntax error in block code. Please check the code.

here is the code. I would just like to know if its possible for this to work in SP since I prefer it over TP and if so, what or where is the syntax error located?


/* WoW Progression Block - ver. 0.2
Author: Erik Gulliksen(progressionblock@erik-gulliksen.com) / Protarion of Pendulum  @ EU-Vek'Nilash.
Created: August 13, 2010
Last Update: August 14, 2010
Website: http://pendulum-guild.co.uk/index.php?topic=266.0

This is a code block that displays your raid progression for each individual raid and a tooltip with boss breakdowns. New raids and modes can easily be added by adding new arrays to the config section.
The script is loosely based on SMF-TinyPortal WoW Recruitment Block - ver. 0.5 by Raugturi (Raugturi@gmail.com).

This block code is released under a Creative Commons Attribution 3.0 Unported licence: http://creativecommons.org/licenses/by/3.0/

 Requires wz_tooltip to be loaded in the page
 http://www.walterzorn.com/tooltip/tooltip_e.htm (The official page appears to be down, a copy can be found at http://pendulum-guild.co.uk/wz_tooltip.js)

Changelog

0.2
* Background image for each raid
* Color seperate for each raid

0.1
* Initial release

*/

// ******************
// * Config Section *
// ******************



// Image Directory: Path to icon folder
// Note: Must contain trailing '/'
$image_dir = 'images/progress/';

// Status Colors: Set the color for each status here.
$notkilled_color = '#8B0000';
$killed_color = '#006400';




/*
== Instance arrays ==

Variables:
Name   - Type: Text,    Value: Instance shortname name (e.g ICC10HC, ICC25N, Nax25 or Nax10)
Display - Type: Integer, Value: 0=hidden, 1=visible
Bosses  - Type: Array,   Element Format: Key = Bossname, Value = Kill status (1 if killed,0 if not killed)
*/

$icc_instances = array(
array(
'name' => 'ICC10 (N)',
'display' => 1,
'bosses' => array('Lord Marrowgar' => 1,'Lady Deathwhisper' => 1,'Gunship Battle' => 1,'Deathbring Saurfang' => 1,'Festergut' => 1,'Rotface' => 1,'Professor Putricide' => 1,'Blood Prince Council' => 1,'Blood-Queen Lana\\\'thel' => 1,'Valithria Dreamwalker' => 1,'Sindragosa' => 1,'The Lich King' => 1)),
array(
'name' => 'ICC10 (HC)',
'display' => 1,
'bosses' => array('Lord Marrowgar' => 1,'Lady Deathwhisper' => 1,'Gunship Battle' => 1,'Deathbring Saurfang' => 0,'Festergut' => 1,'Rotface' => 1,'Professor Putricide' => 0,'Blood Prince Council' => 0,'Blood-Queen Lana\\\'thel' => 1,'Valithria Dreamwalker' => 1,'Sindragosa' => 0,'The Lich King' => 0)),
array(
'name' => 'ICC25 (N)',
'display' => 0,
'bosses' => array('Lord Marrowgar' => 1,'Lady Deathwhisper' => 1,'Gunship Battle' => 1,'Deathbring Saurfang' => 1,'Festergut' => 1,'Rotface' => 0,'Professor Putricide' => 0,'Blood Prince Council' => 0,'Blood-Queen Lana\\\'thel' => 0,'Valithria Dreamwalker' => 0,'Sindragosa' => 0,'The Lich King' => 0)),
array(
'name' => 'ICC25 (HC)',
'display' => 0,
'bosses' => array('Lord Marrowgar' => 0,'Lady Deathwhisper' => 0,'Gunship Battle' => 0,'Deathbring Saurfang' => 0,'Festergut' => 0,'Rotface' => 0,'Professor Putricide' => 0,'Blood Prince Council' => 0,'Blood-Queen Lana\\\'thel' => 0,'Valithria Dreamwalker' => 0,'Sindragosa' => 0,'The Lich King' => 0))
);





$rs_instances = array(
array(
'name' => 'RS10 (N)',
'display' => 1,
'bosses' => array('Saviana Ragefire' => 1,'Baltharus the Warborn' => 1,'General Zarithrian' => 1,'Halion' => 0)),
array(
'name' => 'RS10 (HC)',
'display' => 0,
'bosses' => array('Saviana Ragefire' => 0,'Baltharus the Warborn' => 0,'General Zarithrian' => 0,'Halion' => 0)),
array(
'name' => 'RS25 (N)',
'display' => 0,
'bosses' => array('Saviana Ragefire' => 0,'Baltharus the Warborn' => 0,'General Zarithrian' => 0,'Halion' => 0)),
array(
'name' => 'RS25 (HC)',
'display' => 0,
'bosses' => array('Saviana Ragefire' => 0,'Baltharus the Warborn' => 0,'General Zarithrian' => 0,'Halion' => 0))
);

/*
== Raid arrays ==

Variables:
Name   - Type: Text,    Value: Raid name
Color - Type: Text, Value: HTML color code, e.g. '#FF2B43'
Image - Type: Text, Value: Filename of the image. Will be appended to the image directory defined up top.
Instances  - Type: Instance Array, Value: Use the corresponding $variable defined above
*/
$icc = array(
'name' => 'Icecrown Citadel',
'color'  => '#BBFF00',
'image' => 'icc.jpg',
'instances' => $icc_instances
);

$rs = array(
'name' => 'Ruby Sanctum',
'color'  => '#FF8C00',
'image' => 'rs.jpg',
'instances' => $rs_instances
);


/*
== Main progress array ==

Fill the array with the Raid Arrays defined directly above in the order you want them displayed.
*/
$progress = array(
   $icc,
   $rs
);


//**********************
//* END Config Section *
//**********************

//*********************************
//* Do not edit below here unless *
//* you know what you are doing!! *
//*********************************


foreach ($progress as $raid) {
   echo '<table width="100%" style="background-image:url(\''.$image_dir.$raid['image'].'\');"><tr><td colspan="2" style="color:'.$raid['color'].';">'.$raid['name'].'</td></tr>';
   
   
   foreach($raid['instances'] as $instance) {
      if($instance['display'] == 0)
         continue;
     
     
      $killcount = 0;
      // Creation of the mouseover tooltip for each instance
      $tooltip = '<table width=100% cellpadding=0 cellspacing=0>';
      foreach ($instance['bosses'] as $key => $value) {
         //$color = $value ? $killed_color : $notkilled_color;
         $style = $value ? "color:$killed_color ;" : "text-decoration:line-through;color:$notkilled_color ;";
         $tooltip = $tooltip . '<tr><td style=\\\''.$style.' \\\'> ' . $key . ' </td></tr>';
         $killcount += $value;
      }
      $tooltip = $tooltip . '</table>';
     
      $killcount_text = ' ['.$killcount.'/'.count($instance['bosses']).']';
      echo '<tr><td></td><td align="right"><a style="text-decoration: none;color:'.$raid['color'].';" href="javascript:void(0);" onMouseover="Tip(\'' . $tooltip . '\')" onMouseout="UnTip()">' . $instance['name'] . $killcount_text . '[/url]</td></tr>';
     
   }
   echo '</table>';
}
SimplePortal 2.3.8 © 2008-2024, SimplePortal