[final] extended arcade stats 1.0.1

Downloads and support of add-ons for phpBB Arcade.

is this list useful for you?

yes, good idea and work
22
96%
don't know
1
4%
no, do not need this / it didn't work for me
0
No votes
 
Total votes : 23

[final] extended arcade stats 1.0.1

Postby Gumfuzi » March 7th, 2009, 8:21 am

Title:
extended arcade stats (earlier known as "Best Scorer")

Description:

- A list of each player and the amount of game ranks he has in total (top 20)
- A list of your own game rankings (on the belower part of the list)
- More other gamestats

Version:
1.0.1

Installation Level:
Easy

Installation Time:
~3 minutes

designed for phpBB Version:
3.0.4+

Author Notes:
Addon for phpBB Arcade by JRSweets http://www.jeffrusso.net

if you have many users and/or many scores or games this list can take quite long, if you have a slow server.
in that case, you can set the value for the cache of this list higher (standard is 60 seconds) - this settings is in "zocker_spieler.php" quite on the top of the file

available languages:
- german
- english
- french (thanks for this!)

mod authors:
- Gumfuzi http://www.gumfuzi.com
- Wuerzi http://www.spieleresidenz.de

Screenshots:
pro_beste_spieler.JPG
more screenshot are in the contrib-folder


mod download:
Last edited by Gumfuzi on July 31st, 2009, 11:19 am, edited 11 times in total.
Gumfuzi
Member
Member
 
Posts: 113
Joined: November 8th, 2008, 2:10 pm
Location: Linz, Austria


Google
 

Re: [beta] "best scorer" list v0.9b

Postby Jeff » March 7th, 2009, 9:07 am

Good job! Thanks for posting this.
Everything ends badly, otherwise, it would never end.
Founding Member of the B.D.P.
Image
User avatar
Jeff
Site Admin
Site Admin
 
Posts: 2994
Joined: April 4th, 2004, 7:00 pm
Location: Brokeback Mountain
Highscores: 1

Re: [beta] "best scorer" list v0.9b

Postby bob87 » March 7th, 2009, 10:52 am

Good job, thanks a lot.

I have just installed it and in passage to translate it into French as well as to top up frames and walks well.

Thank you for this addon. ;)

Image

and

Image


If you want files in French for your archive, made know it me.
bob87
Member
Member
 
Posts: 8
Joined: February 21st, 2009, 9:23 am

Re: [beta] "best scorer" list v0.9b

Postby Gumfuzi » March 7th, 2009, 12:22 pm

maybe jeff can put all languages and this list together into his mod as an addon?

P.S.: thanks for posting a screenshot!
Gumfuzi
Member
Member
 
Posts: 113
Joined: November 8th, 2008, 2:10 pm
Location: Linz, Austria

Re: [beta] "best scorer" list v0.9b

Postby Jeff » March 7th, 2009, 12:58 pm

I was testing this out on my dev board which has debug and debug_extra enabled. There was some debug errors displayed because of unset variables and such.

I made some changes to get rid of the errors. The end result was this...
Code: Select all
<?php

#####################################################
### zocker_spieler v0.9b by Gumfuzi               ###
### www.gumfuzi.com                               ###
### (no guarantee if i have time to support this) ###
#####################################################

# var for caching list in seconds (increase by using on larger boards)
$zs_cache = 60;
# --------------------------------------------------------------------

define('IN_PHPBB', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

$page_title = 'Spieler-Platzierungen und eigene Platzierungen';
$template->set_filenames(array('body' => 'zocker_spieler.html'));
if ($user->data['user_id'] == ANONYMOUS)
{
   login_box();
}


# get usernames into array
$uname = array();
$result = $db->sql_query('SELECT user_id, username FROM phpbb_users', $zs_cache);
while( $row = $db->sql_fetchrow($result))
{
   $uname[$row['user_id']] = $row['username'];
}
$info = array();
$info_detail = array();
$punkte = array();


# get scores from high-to-low-scoring games
$platz = $game_count = 0;
$alt_score = $alt_game = '';
$result = $db->sql_query('SELECT s.game_id, s.user_id, s.score, s.score_date, g.game_id, g.game_name, g.game_swf FROM phpbb_arcade_scores s, phpbb_arcade_games g WHERE s.game_id = g.game_id AND g.game_scoretype = 0 AND s.user_id > 1 ORDER BY s.game_id ASC, s.score DESC, s.score_date ASC', $zs_cache);
while( $row = $db->sql_fetchrow($result))
{
   if ($row['game_id'] <> $alt_game)
   {
      $game_count++;
      $platz = 0;
      $alt_score = -1;
      $pl = 0;
   }
   $platz++;

   (isset($info[$row['user_id']][$platz])) ? $info[$row['user_id']][$platz]++ : $info[$row['user_id']][$platz] = 1;
   
   if ($row['user_id'] == $user->data['user_id'])
   {
      (isset($info_detail[$platz]['name'])) ? $info_detail[$platz]['name'] .= '<a href="' . append_sid("arcade.php?mode=stats&g=" . $row['game_id']) . '" title="' . $row['game_name'] . '">' . str_replace(".swf", "", $row['game_swf'])  . '</a> ' : $info_detail[$platz]['name'] = '<a href="' . append_sid("arcade.php?mode=stats&g=" . $row['game_id']) . '" title="' . $row['game_name'] . '">' . str_replace(".swf", "", $row['game_swf'])  . '</a> ' ;
      (isset($info_detail[$platz]['anz'])) ? $info_detail[$platz]['anz']++ : $info_detail[$platz]['anz'] = 1;
   }
   
   $alt_score = $row['score'];
   $alt_game = $row['game_id'];
}
$db->sql_freeresult($result);


# get scores from low-to-high-scoring games
$platz = 0;
$alt_score = $alt_game = '';
$result = $db->sql_query('SELECT s.game_id, s.user_id, s.score, s.score_date, g.game_id, g.game_name, g.game_swf FROM phpbb_arcade_scores s, phpbb_arcade_games g WHERE s.game_id = g.game_id AND g.game_scoretype = 1 AND s.user_id > 1 ORDER BY s.game_id ASC, s.score ASC, s.score_date ASC', $zs_cache);
while( $row = $db->sql_fetchrow($result))
{
   if ($row['game_id'] <> $alt_game)
   {
      $game_count++;
      $platz = 0;
      $alt_score = -1;
      $pl = 0;
   }
   $platz++;

   (isset($info[$row['user_id']][$platz])) ? $info[$row['user_id']][$platz]++ : $info[$row['user_id']][$platz] = 1;
   
   if ($row['user_id'] == $user->data['user_id'])
   {
      (isset($info_detail[$platz]['name'])) ? $info_detail[$platz]['name'] .= '<a href="' . append_sid("arcade.php?mode=stats&g=" . $row['game_id']) . '" title="' . $row['game_name'] . '">' . str_replace(".swf", "", $row['game_swf'])  . '</a> ' : $info_detail[$platz]['name'] = '<a href="' . append_sid("arcade.php?mode=stats&g=" . $row['game_id']) . '" title="' . $row['game_name'] . '">' . str_replace(".swf", "", $row['game_swf'])  . '</a> ' ;
      (isset($info_detail[$platz]['anz'])) ? $info_detail[$platz]['anz']++ : $info_detail[$platz]['anz'] = 1;
   }
   
   $alt_score = $row['score'];
   $alt_game = $row['game_id'];
}
$db->sql_freeresult($result);



$point_values = array(
   1   => 40,
   2   => 35,
   3   => 30,
   4   => 25,
   5   => 22,
   6   => 20,
   7   => 18,
   8   => 16,
   9   => 14,
   10   => 12,
   11   => 10,
   12   => 9,
   13   => 8,
   14   => 7,
   15   => 6,
   16   => 5,
   17   => 4,
   18   => 3,
   19   => 2,
   20   => 1,
);

# calculate points for ranking
foreach($info as $key => $value)
{
   $played_games_in_top = 0;
   for ($i = 1; $i <= 10; $i++)
   {
      if (isset($value[$i]))
      {
         $played_games_in_top += $value[$i];
      }      
   }   
   
   if ($played_games_in_top > 0)
   {
      $pnkte = 0;      
      foreach ($value as $place => $total)
      {
         if (isset($point_values[$place]))
         {
            $pnkte += $total * $point_values[$place];
         }
      }

      $pnkte = intval($pnkte * $played_games_in_top / $game_count);      
      $punkte[$key] = $pnkte;
   }
}
arsort($punkte);
$rang = 0;


# output
$alt_pnkte = $ra = 0;
foreach($punkte as $key => $value)
{
   $pnkte = intval($value);
   if ($pnkte == $alt_pnkte)
   {
      $ra++;
   }
   else
   {
      $rang = $rang + 1 + $ra;
      $ra = 0;
   }
   
   # dump vars into template
   $template->assign_block_vars("alle", array(
      'RANG'      => "<b>" . $rang . "</b>",
      'NAME'      => '<a href="' . append_sid("memberlist.php?mode=viewprofile&u=" . $key) . '">' . $uname[$key] . '</a>',
      'PUNKTE'   => "<b>" . $pnkte . "</b>",
      'PLATZ1'   => (isset($info[$key]['1'])) ? $info[$key]['1'] : '',
      'PLATZ2'   => (isset($info[$key]['2'])) ? $info[$key]['2'] : '',
      'PLATZ3'   => (isset($info[$key]['3'])) ? $info[$key]['3'] : '',
      'PLATZ4'   => (isset($info[$key]['4'])) ? $info[$key]['4'] : '',
      'PLATZ5'   => (isset($info[$key]['5'])) ? $info[$key]['5'] : '',
      'PLATZ6'   => (isset($info[$key]['6'])) ? $info[$key]['6'] : '',
      'PLATZ7'   => (isset($info[$key]['7'])) ? $info[$key]['7'] : '',
      'PLATZ8'   => (isset($info[$key]['8'])) ? $info[$key]['8'] : '',
      'PLATZ9'   => (isset($info[$key]['9'])) ? $info[$key]['9'] : '',
      'PLATZ10'   => (isset($info[$key]['10'])) ? $info[$key]['10'] : '',
      'PLATZ11'   => (isset($info[$key]['11'])) ? $info[$key]['11'] : '',
      'PLATZ12'   => (isset($info[$key]['12'])) ? $info[$key]['12'] : '',
      'PLATZ13'   => (isset($info[$key]['13'])) ? $info[$key]['13'] : '',
      'PLATZ14'   => (isset($info[$key]['14'])) ? $info[$key]['14'] : '',
      'PLATZ15'   => (isset($info[$key]['15'])) ? $info[$key]['15'] : '',
      'PLATZ16'   => (isset($info[$key]['16'])) ? $info[$key]['16'] : '',
      'PLATZ17'   => (isset($info[$key]['17'])) ? $info[$key]['17'] : '',
      'PLATZ18'   => (isset($info[$key]['18'])) ? $info[$key]['18'] : '',
      'PLATZ19'   => (isset($info[$key]['19'])) ? $info[$key]['19'] : '',
      'PLATZ20'   => (isset($info[$key]['20'])) ? $info[$key]['20'] : '',
   ));   
   $alt_pnkte = $pnkte;
}


# dump own game rankings
for ($i = 1; $i <= 100; $i++)
{
   if (isset($info_detail[$i]['anz']))
   {
      if ($info_detail[$i]['anz'] > 0)
      {
         $template->assign_block_vars("eigene", array(
            'PLATZ'      => $i,
            'SPIELE'   => $info_detail[$i]['name'],
            'ANZAHL'   => $info_detail[$i]['anz'],
         ));         
      }
   }
}

# rest
page_header($page_title);
make_jumpbox(append_sid("{$phpbb_root_path}viewforum.$phpEx"));
page_footer();
?>


Great work! I will probably use some of the code (with credit of course) on the stats page to let users know how many first, second, third, etc... they have.
Everything ends badly, otherwise, it would never end.
Founding Member of the B.D.P.
Image
User avatar
Jeff
Site Admin
Site Admin
 
Posts: 2994
Joined: April 4th, 2004, 7:00 pm
Location: Brokeback Mountain
Highscores: 1

Re: [beta] "best scorer" list v0.9b

Postby Gumfuzi » March 7th, 2009, 1:06 pm

thank you!
Gumfuzi
Member
Member
 
Posts: 113
Joined: November 8th, 2008, 2:10 pm
Location: Linz, Austria

Re: [beta] "best scorer" list v0.9b

Postby Taka » March 8th, 2009, 5:28 am

hello

thank you for this add-on.

I have difficulty in understanding the calculation of the total wins of points acquired by the State ..
User avatar
Taka
Member
Member
 
Posts: 31
Joined: August 5th, 2008, 12:25 pm
Location: Montpellier

Re: [beta] "best scorer" list v0.9b

Postby Gumfuzi » March 8th, 2009, 5:39 am

ok points are calculated as this:
every rank for each game a user has played in this list has a value...

1st place: 40 points
2nd: 35
then ... 30, 25, 22, 20, 18, 16, 14, 12, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
(1 point for the 20th place)
then it will calculate the summary of all those ranking point

this points are multiplied with the amount of games the user has scored within the top 10 and then divided through the amount of all games you have in your arcade.

hopefully i could get the calculation almost clearly to you.
Gumfuzi
Member
Member
 
Posts: 113
Joined: November 8th, 2008, 2:10 pm
Location: Linz, Austria

Re: [beta] "best scorer" list v0.9b

Postby Taka » March 8th, 2009, 11:46 am

Hello ..


Thank you for your explanation ...
it is clear to me.
Please re mod for this ... very well done.
User avatar
Taka
Member
Member
 
Posts: 31
Joined: August 5th, 2008, 12:25 pm
Location: Montpellier

Re: [beta] "best scorer" list v0.9b

Postby Mustang » March 10th, 2009, 1:09 am

Hi Gumfuzi

Thank you very much your addon works very well,

But I would like display on the arcade header the top 5 best scorer users

How could I do that ?

Thanks
Mustang
Member
Member
 
Posts: 53
Joined: May 10th, 2008, 9:37 am

Re: [beta] "best scorer" list v0.9b

Postby Wuerzi » March 10th, 2009, 11:29 am

Hello all :)

Nice addon :)

I have last night work on a update to 0.1.0, but Gumfuzi must this update testing if he have time.
Download not yet available. ;)

New in 0.1.0:

    - Separate language file (en/de) new (Wuerzi)
    - subsilver2 new (Wuerzi)
    - prosilver changed (Wuerzi)
    - color usernames new (Gumfuzi)
    - fixed debug errors changed (Gumfuzi)
    - ModX install new (Wuerzi)

And it works great in my board with 5000 games :)

I hope my translation to english is good :? :oops:

Best regards from germany and thanks to jeff for the great arcade mod :)
User avatar
Wuerzi
Member
Member
 
Posts: 11
Joined: March 10th, 2009, 9:49 am
Location: Würzburg/Germany

Re: [beta] "best scorer" list v0.9b

Postby Gumfuzi » March 11th, 2009, 9:37 am

remember that there will be no "update instructions" from the version i have posted in this first posting to the next coming version.
Anyway, it should be very easy to "uninstall" the first version of this mod (this in my first posting here), because there were only 2 files to copy ;)

so if you absolutely need this addon in the next days you can still go on with the version in my first post here.
if not, stay tuned a few days (or one or two weeks?) to get the new version with modx, languages, etc.
Gumfuzi
Member
Member
 
Posts: 113
Joined: November 8th, 2008, 2:10 pm
Location: Linz, Austria

Re: [beta] "best scorer" list v0.1.0

Postby Gumfuzi » March 12th, 2009, 2:03 pm

new version uploaded (version 0.1.0) - see first post if this topic!

... now it comes with an modx install file, language support and more!
Gumfuzi
Member
Member
 
Posts: 113
Joined: November 8th, 2008, 2:10 pm
Location: Linz, Austria

Re: [beta] "best scorer" list v0.1.0

Postby Callteg4 » March 12th, 2009, 2:43 pm

I have put this on my site, looks great. however there seems to be a few spelling mistakes that would need correcting for this to be great

1. Who hast which or the best ranks?
Have
2.The more games a user has within the top 10, the besser the total points are
Better

Thanks Callteg4
http://www.arcadewithme.com/zocker_spieler.php
Callteg4
Member
Member
 
Posts: 45
Joined: March 10th, 2008, 8:02 am
Highscores: 1

Re: [beta] "best scorer" list v0.1.0

Postby Gumfuzi » March 12th, 2009, 3:00 pm

thank you, we will correct them in the language files.
Gumfuzi
Member
Member
 
Posts: 113
Joined: November 8th, 2008, 2:10 pm
Location: Linz, Austria


Google
 

Next

Return to [Arcade] Add-ons

Who is online

Users browsing this forum: No registered users and 1 guest