vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=33)
-   -   V3Arcade - Game Rating addon (https://vborg.vbsupport.ru/showthread.php?t=71460)

GenSec 11-06-2004 10:00 PM

V3Arcade - Game Rating addon
 
These hack adds rating system for your arcade games.

Files to edit: 1
Templates to edit: 2
Files to add: 1

Add 1 new db table + 2 changes for games table

Very easy to install...
################################################## ##############################################
Before the installation!
Please make a Backup of your database and the changed files!
################################################## ##############################################

1. ADD this to MySQL DB using phpmyadmin or admincp :
Code:

ALTER TABLE `games` ADD `votetotal` smallint(5)  UNSIGNED DEFAULT '0' NOT NULL ;

ALTER TABLE `games` ADD `votenum` smallint(5)  UNSIGNED DEFAULT '0' NOT NULL ;

CREATE TABLE `game_rate` (
  `gamerateid` int(11) NOT NULL auto_increment,
  `gameid` int(11) NOT NULL default '0',
  `userid` int(10) NOT NULL default '0',
  `vote` smallint(5) default NULL,
  `ipaddress` char(15) NOT NULL default '',
  PRIMARY KEY  (`gamerateid`)
) TYPE=MyISAM AUTO_INCREMENT=8 ;

2. Upload gamerate.php to your forumroot directory.
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
There are somу redirects phrases like "redirect_threadrate_add", "error_threadratevoted" etc.
You саn change them to similar with the word "game" instead of "thread".
I didn't. And it works fine on my board.

3. Edit arcade.php
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Find:
Code:

$phrasegroups = array();
Change to:
Code:

$phrasegroups = array('arcade','showthread');
* in case you decide to use the above "thread" phrases


Find:
Code:


        // While loop constructs the $gamebits variable, with games where scores have been recorded
        while ($game = $DB_site->fetch_array($result_topscore2)) {


Add right after:
Code:


      // display ratings if enabled
            if ($game['votenum'] > 0)
            {
                $game['voteavg'] = vb_number_format($game['votetotal'] / $game['votenum'], 2);
                $game['rating'] = round($game['voteavg']);
                } else {
        $game['rating']=0;
            }
        //

Find:
Code:


$thisGame = $DB_site->query_first("SELECT * FROM " . TABLE_PREFIX . "games WHERE gameid=$gameid");



Add right after:
Code:


// display ratings if enabled
$show['rating'] = false;

        if ($thisGame['votenum'] > 0)
        {
                $thisGame['voteavg'] = vb_number_format($thisGame['votetotal'] / $thisGame['votenum'], 2);
                $game['rating'] = round($thisGame['voteavg']);
                        $show['rating'] = true;
        }

        if ($rating = $DB_site->query_first("
                SELECT vote, gamerateid FROM " . TABLE_PREFIX . "game_rate
                WHERE userid = $bbuserinfo[userid] AND gameid = $gameid
        ")) {

                    if ($$rating['vote'])
                  {
                                $voteselected["$rating[vote]"] = HTML_SELECTED;
                                $votechecked["$rating[vote]"] = HTML_CHECKED;
                          }        else {
                                $voteselected[0] = HTML_SELECTED;
                                $votechecked[0] = HTML_CHECKED;
                          }
    }
//

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Save arcade.php

4. Edit arcade templates

to place the voting form in play control panel

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+



In arcade_play template find:
Code:


<table cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%">
  <tr>
    <td class="thead" colspan="2"><span class="smallfont">$thisGame[title]</span></td>
  </tr>



Add right after:
Code:

<tr>
<td class="alt2" align="center" id="gamerating" nowrap="nowrap"><span class="smallfont">
<a href="#goto_gamerating">
<if condition="$show['rating']">$vbphrase[rating]</a>: <img class="inlineimg" src="$stylevar[imgdir_rating]/rating_$game[rating].gif" alt="<phrase 1="$thisGame[votenum]" 2="$thisGame[voteavg]">$vbphrase[thread_rating_x_votes_y_average]</phrase>" border="0" />
                  <else />$vbphrase[rate_thread]</a></if>
<if condition="$show['popups']"><script type="text/javascript"> vbmenu_register("gamerating"); </script></if>
</span></td></tr>


Find:
Code:


 <tr><td class="alt1" align="center"><img src="$stylevar[imgdir_arcade]/backtip.gif" border=0></td>
</table>
</td>
</tr></table>


Add right after:

Code:


<div class="vbmenu_popup" id="gamerating_menu" style="display:none">
<form action="gamerate.php" method="post">
        <table cellpadding="4" cellspacing="1" border="0">
        <tr>
                <td class="thead">Зацени игру<a name="goto_gamerating"></a></td>
        </tr>
        <tr>
                <td class="vbmenu_option" title="nohilite">
                <div><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_5.gif" alt="$vbphrase[excellent]" /><label for="vote5"><input type="radio" name="vote" id="vote5" value="5" $votechecked[5] />$vbphrase[excellent]</label></div>
                <div><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_4.gif" alt="$vbphrase[good]" /><label for="vote4"><input type="radio" name="vote" id="vote4" value="4" $votechecked[4] />$vbphrase[good]</label></div>
                <div><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_3.gif" alt="$vbphrase[average]" /><label for="vote3"><input type="radio" name="vote" id="vote3" value="3" $votechecked[3] />$vbphrase[average]</label></div>
                <div><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_2.gif" alt="$vbphrase[bad]" /><label for="vote2"><input type="radio" name="vote" id="vote2" value="2" $votechecked[2] />$vbphrase[bad]</label></div>
                <div><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_1.gif" alt="$vbphrase[terrible]" /><label for="vote1"><input type="radio" name="vote" id="vote1" value="1" $votechecked[1] />$vbphrase[terrible]</label></div>
                </td>
        </tr>
        <tr>
                <td class="vbmenu_option" title="nohilite" align="center">
        <input type="hidden" name="s" value="$session[dbsessionhash]" />
        <input type="hidden" name="gameid" value="$gameid" />
        <input type="submit" class="button" value="$vbphrase[vote_now]" />
                </td>
        </tr>
        </table>
</form>
</div>

Save arcade_play


5. At last find the right place to show the game rating

I placed in arcade_main_games_bit temlate :
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+


Code:

<if condition="$game['rating'] > 0"><img class="inlineimg" src="$stylevar[imgdir_rating]/rating_$game[rating].gif" alt="<phrase 1="$game[votenum]" 2="$game[voteavg]">$vbphrase[thread_rating_x_votes_y_average]</phrase>" border="0" />
</if>

#############################
Thats all!

I hope it works :classic:

Oblivion Knight 11-07-2004 06:34 PM

Awesome! I'll certainly have a look at this one later tonight..

Thanks for sharing your work. :)

GenSec 11-07-2004 06:55 PM

Quote:

Originally Posted by Rick Sample
It looks much more organized! I'm curiouse though, I went to your site: http://www.2x2ru.net/forum/arcade.php in each one of those game boxes, what does it say?

As usuall :) :
game size, champion, record, played games, personal record...

Rick Sample 11-07-2004 06:55 PM

cool, when you say game rating, does this include your arcade home layout, too? That looks very organized!

let us know :)

GenSec 11-07-2004 07:06 PM

Rick Sample.
No. The rest was made before. And it's mush more hard for me to make clear instructions than to make the code :)
Generally it's templates modification.
Because my board in russian it needs to translate back :ermm:

moley 11-07-2004 09:03 PM

thanks for sharing looks like a very nice addon.

Lionel 11-07-2004 09:45 PM

you beat frankenberrie at that one!

Lionel 11-07-2004 10:03 PM

Where are the phrases?

Lionel 11-07-2004 11:24 PM

you've got one extra space in your alter table games query for votetotal and votenum on this page that gives a database column not found error. Removing the space fixes that.

glorify 11-08-2004 01:20 AM

where are the spaces to be removed?


All times are GMT. The time now is 03:19 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01259 seconds
  • Memory Usage 1,760KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (12)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete