============================================================================================================================
Modification Name: Experience Stats RPG

Version: 1.0

Author: John Briggs

Description: This modification will display a RPG Experience stats graph in your threads based on activity.

Copyright:  2010 John Briggs. All Rights Reserved.

Compatability: XMB 1.9.5 SP1

Install Note: Before adding this modification to your forum, you should back up all files related to this modification.

License Note: This modification is released under the GPL License v3. A copy is provided with this software package.

Author Note:
You downloaded this modification from XMBGarage.com, the #1 source for XMB related downloads.
Please visit http://www.xmbgarage.com/ for support.

============================================================================================================================
=======
Step 1:
=======
====================================
Go To Administration Panel --> Insert Raw SQL
====================================

Upload provided file named "SQL.txt" and click "Submit Changes" button.

============================================================================================================================
=======
Step 2:
=======
===================
Edit File: viewthread.php
===================
==========
Find Code:
==========

loadtemplates(

================
Replace Code With:
================

loadtemplates(
'viewthread_post_experience',

==========
Find Code:
==========

            if (X_MEMBER && $post['email'] != '' && $post['showemail'] == 'yes') {

===============
Add Code Above:
===============

        // Experience RPG Stats Graph Mod Begin
        $exp = '';
        if ($SETTINGS['expstatus'] == 'on') {
            $jointime = ($onlinetime - $post['regdate']) / 86400;
            $postsperday = sprintf('%.2f', ($post['postnum'] / $jointime));
            $level = pow(log10($post['postnum']), 3);
            $showlevel = floor($level + 1);
            $ep = floor(100 * ($level - floor($level)));
            $hpmulti = round($postsperday / 6, 1);

            if ($hpmulti > 1.5) {
                $hpmulti = 1.5;
            }

            if ($hpmulti < 1) {
                $hpmulti = 1;
            }

            $maxhp = $level * 25 * $hpmulti;
            $hp = $postsperday / 10;

            if ($hp >= 1) {
                $hp = $maxhp;
            } else {
                $hp = floor($hp * $maxhp);
            }

            $hp = floor($hp);
            $maxhp= floor($maxhp);

            if ($maxhp <= 0) {
                $zhp = 1;
            } else {
                $zhp = $maxhp;
            }

            $hpf = floor(100 * ($hp / $zhp)) - 1;
            $maxmp = ($jointime * $level) / 5;
            $mp = $post['postnum'] / 3;

            if ($mp >= $maxmp) {
                $mp = $maxmp;
            }

            $maxmp = floor($maxmp);
            $mp = floor($mp);

            if ($maxmp <= 0) {
                $zmp = 1;
            } else {
                $zmp = $maxmp;
            }

            $mpf = floor(100 * ($mp / $zmp)) - 1;
            eval('$exp = "'.template('viewthread_post_experience').'";');
        }
        // Experience RPG Stats Graph Mod End

==========
Find Code:
==========

            $location = '';
            $mood = '';

===============
Add Code Below:
===============

            // Experience RPG Stats Graph Mod Begin
            $exp = '';
            // Experience RPG Stats Graph Mod End

============================================================================================================================
=======
Step 3:
=======
=======================
Edit File: lang/English.lang.php
=======================
=============================
Add Code To End Of File ABOVE  ?>
=============================

// Experience RPG Stats Graph Mod Begin
$lang['explevel'] = "Level:";
$lang['expactivity'] = "Activity:";
$lang['expparticipation'] = "Participation:";
$lang['expexperience'] = "Experience:";
$lang['expstatus'] = "RPG experience stats status:<br /><span class=\"smalltxt\">Enable this to show RPG experience graph in threads.</span>";
// Experience RPG Stats Graph Mod End

============================================================================================================================
=======
Step 4:
=======
==============
Edit File: cp.php
==============
==========
Find Code:
==========

        $resetSigOn = $resetSigOff = '';
        if ($SETTINGS['resetsigs'] == 'on') {
            $resetSigOn = $selHTML;
        } else {
            $resetSigOff = $selHTML;
        }

===============
Add Code Below:
===============

        // Experience RPG Stats Graph Mod Begin
        $expstatuson = $expstatusoff = '';
        switch ($SETTINGS['expstatus']) {
            case 'on':
                $expstatuson = $selHTML;
                break;
            default:
                $expstatusoff = $selHTML;
                break;
        }
        // Experience RPG Stats Graph Mod End

==========
Find Code:
==========

        printsetting1($lang['attachimginpost'], "attachimgpostnew", $attachimgposton, $attachimgpostoff);

===============
Add Code Below:
===============

        // Experience RPG Stats Graph Mod Begin
        printsetting1($lang['expstatus'], 'expstatusnew', $expstatuson, $expstatusoff);
        // Experience RPG Stats Graph Mod End

==========
Find Code:
==========

        $resetSigNew = ($resetSigNew == 'on') ? 'on' : 'off';

===============
Add Code Below:
===============

        // Experience RPG Stats Graph Mod Begin
        $expstatusnew = ($expstatusnew == 'on') ? 'on' : 'off';
        // Experience RPG Stats Graph Mod End

==========
Find Code:
==========

$db->query("UPDATE $table_settings SET langfile='$langfilenew'

==============================
Find Code At End Of Above Statement:
==============================

");

================
Replace Code With:
================

, expstatus='$expstatusnew'");

============================================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================
===============
Edit Template: css
===============
==========
Find Code:
==========

.tablerow {
    color: $tabletext;
    font-family: $font;
    font-size: $fontsize;
    table-layout: fixed;
}

===============
Add Code Below:
===============

.expgraph {
    border: $bordercolor 1px dashed;
    padding: 0;
    margin: 0;
    width: 100px;
    height: 9px;
    text-align: left;
}

============================================================================================================================
=======
Step 6:
=======
===============================
Go To Administration Panel --> Templates
===============================
======================================
Create New Template: viewthread_post_experience
======================================
========================
Add Code and Submit Changes:
========================

<br />
<br />
<strong>$lang[explevel]</strong> $showlevel<br />
<strong>$lang[expactivity]</strong> $hp / $maxhp
<div class="expgraph">
<img src="./images/bhg.gif" width="$hpf%" height="9" border="0" alt="" title="" /><img src="./images/bhb.gif" width="1" height="9" border="0" alt="" title="" />
</div>
<strong>$lang[expparticipation]</strong> $mp / $maxmp
<div class="expgraph">
<img src="./images/bmg.gif" width="$mpf%" height="9" border="0" alt="" title="" /><img src="./images/bmb.gif" width="1" height="9" border="0" alt="" title="" />
</div>
<strong>$lang[expexperience]</strong> $ep%
<div class="expgraph">
<img src="./images/bxg.gif" width="$ep%" height="9" border="0" alt="" title="" /><img src="./images/bxb.gif" width="1" height="9" border="0" alt="" title="" />
</div>

============================================================================================================================
=======
Step 7:
=======
===============================
Go To Administration Panel --> Templates
===============================
========================
Edit Template: viewthread_post
========================
==========
Find Code:
==========

$mood

===============
Add Code Below:
===============

$exp

============================================================================================================================
=======
Step 8:
=======

Upload provided images located in the folder named "Contents" to your forum "/images/" folder.

============================================================================================================================
Enjoy!