[adaptation] Statistiques d'activités : HP, MP, EXP

Ce forum vous servira à trouver de l'aide uniquement en ce qui concerne le développement d'un de vos MODs, ou l'adaptation d'un MOD phpBB2 pour phpBB3.

Modérateur: Equipe

[adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar pal » 28 Sep 2008 à 11:05

Salut,

est ce que ça serait possible d'adapter ce module : http://archives.phpbb.biz/viewtopic.php?f=194&t=94282 à phpBB3 ?

voila quelques informations :

Nom du MOD : Level Mod
Description du MOD : Ce mod vous permet de controler l'activité de vos membres au dela du simple compteur de post (voir description du mod pour plus de détails)
Auteur du MOD : William < N/A > N/A
Niveau d'installation du MOD : Facile

sympa comme mod, merci d'avance
pal
Apprenti-posteur
Apprenti-posteur
 
Messages: 128
Inscription: 09 Déc 2007 à 09:50

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar Dakin Quelia » 28 Sep 2008 à 11:58

Bonsoir,

Cela ne concerne pas vraiment une adaptation dans le sens où il existe déjà un en développement là-bas. :wink:

A bientôt,
Image Aucun support par mail, MP ou msn.
Développeur d'une framework phpBB (outil) | Mon blogue: Mon blogue | phpBB Forge: cliquez ici | DeviantArt: cliquez ici
Avatar de l’utilisateur
Dakin Quelia
Superstar
 
Messages: 20633
Inscription: 31 Oct 2006 à 18:33
Localisation: Belgique

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar pal » 28 Sep 2008 à 13:17

Salut,

c'est abandonné je crois : le sujet a été posté le "Sat Mar 22", aucun lien de téléchargement et les liens screenshots sont morts
pal
Apprenti-posteur
Apprenti-posteur
 
Messages: 128
Inscription: 09 Déc 2007 à 09:50

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar pal » 08 Oct 2008 à 09:19

petit up ^^
pal
Apprenti-posteur
Apprenti-posteur
 
Messages: 128
Inscription: 09 Déc 2007 à 09:50

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar Oyo » 13 Oct 2008 à 09:20

Hello,

Je vais essayer de regarder ;)

.:Edit:.
Images à copier dans le dossier imageset de prosilver

Code: Tout sélectionner
#
# [ OPEN ] -------
#
viewtopic.php

#
# [ FIND ] -------
#
$user_cache[$poster_id] = array(
            'joined'      => '',
#
# [ REMPLACE, WITH ] -------
#
$user_cache[$poster_id] = array(
            'user_regdate'      => '',
            'joined'      => '',

#
# [ FIND ] -------
#
$user_cache[$poster_id] = array(
            'joined'      => $user->format_date($row['user_regdate']),

#
# [ REMPLACE, WITH ] -------
#
$user_cache[$poster_id] = array(
            'user_regdate'      => $row['user_regdate'],
            'joined'      => $user->format_date($row['user_regdate']),
            
#
# [ FIND ] -------
#      
   $s_first_unread = false;
   if (!$first_unread && $post_unread)
   {
      $s_first_unread = $first_unread = true;
   }

#
# [ AFTER, ADD ] -------
#
   //
   // BEGIN LEVEL HACK
   //

   /* Determine Level
   *
   * A users level is determined by their total number of posts.
   * We use a nice mathmatical formula to translate a post count
   * into a level.
   * Note, a user with zero posts is level 0
   *
   */
   
   if($user_cache[$poster_id]['posts'] < 1)
   {
         $level_level = 0;
   }
   else
   {
         $level_level = floor( pow( log10( $user_cache[$poster_id]['posts'] ), 3 ) ) + 1;
   }

   /* Determine HP
   *
   * HP is based on user activity.
   * Max HP is based on the users level, and will be the same for
   * all users of the same level.
   *
   * Current HP is based on the users posts per day.
   * The higher the users posts per day (ppd), the more hp
   * they will have. A user with average ppd (as set below)
   * will have 50% of their hp. As a user goes over the average
   * ppd, they will have more hp, but the gains will lessen
   * as the users ppd goes up. This makes it difficult, but not
   * impossible to have 100% hp.
   *
   * For users with under the average ppd, they will have
   * hp equal to 1/2 the percentage their ppd is of average.
   * ie- a user with 2.5 ppd, and an average ppd of 5
   * will have 25% hp.
   *
   * Users who miraculously manage to get higher than 100%
   * of their max health. (by posting far more than average)
   * will get a bonus to their max hp.
   *
   * Note that a user with a level of zero, has 0 / 0 hp.
   *
   */

   /*
   * This value determines what the 'average' posts per day is
   * Users above this value will have more hp, and users below
   * will have less. A user with exactly this posts per day
   * will have 50% of his max hp.
   *
   * This variable should NOT be zero.
   * You may set this to a decimal amount (eg 5.1, 2.35)
   */
      $level_avg_ppd = 5;

   /*
   * this value sets how hard it is to achieve 100%
   * hp. The higher you set it, the harder it is to
   * get full hp.
   *
   * to judge how high to set it, a user must have
   * posts per day equal to the $level_avg_ppd plus
   * the number set below.
   *
   * This should NOT be zero.
   */
      $level_bonus_redux = 5;

   /*
   * We need to calculate the user's
   * posts per day because it's not done for us,
   * unlike in profile.php
   */
     $level_user_ppd = ($user_cache[$poster_id]['posts'] / max(1, round( ( time() - $user_cache[$poster_id]['user_regdate'] ) / 86400 )));

   if($level_level < 1)
   {
         $level_hp = '0 / 0';
         $level_hp_percent = 0;
   }
   else
   {
         $level_max_hp = floor( (pow( $level_level, (1/4) ) ) * (pow( 10, pow( $level_level+2, (1/3) ) ) ) / (1.5) );
   
         if($posts_per_day >= $level_avg_ppd)
         {
               $level_hp_percent = floor( (.5 + (($level_user_ppd - $level_avg_ppd) / ($level_bonus_redux * 2)) ) * 100);
         }
         else
         {
               $level_hp_percent = floor( $level_user_ppd / ($level_avg_ppd / 50) );
         }
   
         if($level_hp_percent > 100)
         {
               //Give the User bonus max HP if they have more than 100% hp
               $level_max_hp += floor( ($level_hp_percent - 100) * pi() );
               $level_hp_percent = 100;
         }
         else
         {
               $level_hp_percent = max(0, $level_hp_percent);
         }
   
         $level_cur_hp = floor($level_max_hp * ($level_hp_percent / 100) );
   
         //Be sure that a user has no more than max
         //and no less than zero hp.
         $level_cur_hp = max(0, $level_cur_hp);
         $level_cur_hp = min($level_max_hp, $level_cur_hp);
   
         $level_hp = $level_cur_hp . ' / ' . $level_max_hp;
   }


   /* Determine MP
   *
   * MP is calculated by how long the user has been around
   * and how often they post.
   *
   * Max MP is based on level, and increases with level
   * Each post a user makes costs them mp,
   * and a user regenerates mp proportional to how
   * many days they have been registered
   *
   */

   //Number of days the user has been at the forums.
   $level_user_days = max(1, round( ( time() - $user_cache[$poster_id]['user_regdate'] ) / 86400 ));

   //The mp cost for one post.
   //Raising this value will generally decrease the current
   // mp for most posters.
   //This may be set to a decimal value (eg, 2, 2.1, 3.141596)
   //This should NOT be set to 0
   $level_post_mp_cost = 1;

   //This determines how much mp a user regenerates per day
   //Raising this value will generally increase the current
   // mp for most posters.
   //This may be set to a decimal value (eg, 3, 3.5, 2.71828)
   //This should NOT be set to 0
   $level_mp_regen_per_day = 4;

   if($level_level < 1)
   {
         $level_mp = '0 / 0';
         $level_mp_percent = 100;
   }
   else
   {
         $level_max_mp = floor( (pow( $level_level, (1/4) ) ) * (pow( 10, pow( $level_level+2, (1/3) ) ) ) / (pi()) );
   
         $level_mp_cost = $user_cache[$poster_id]['posts'] * $level_post_mp_cost;
   
         $level_mp_regen = max(1, $level_user_days * $level_mp_regen_per_day);
   
         $level_cur_mp = floor($level_max_mp - $level_mp_cost + $level_mp_regen);
         $level_cur_mp = max(0, $level_cur_mp);
         $level_cur_mp = min($level_max_mp, $level_cur_mp);
   
         $level_mp = $level_cur_mp . ' / ' . $level_max_mp;
   
         $level_mp_percent = floor($level_cur_mp / $level_max_mp * 100);
   }


   /* Determine EXP percentage
   *
   * Experience is determined by how far the user is away
   * from the next level. This is expressed as a percentage.
   *
   * Note, a user of level 0 has 100% experience. Making one post
   * will put them at level 1. Also, a user that is shown to have 100%
   * experience, will go up a level on their next post.
   *
   */

   if($level_level == 0)
   {
         $level_exp = '0 / 0';
         $level_exp_percent = 100;
   }
   else
   {
         $level_posts_for_next = floor( pow( 10, pow( $level_level, (1/3) ) ) );

      $level_exp = $user_cache[$poster_id]['posts'] . ' / ' . $level_posts_for_next;
      $level_exp_percent = floor( ($user_cache[$poster_id]['posts'] - $level_posts_for_this) / max(1,($level_posts_for_next - $level_posts_for_this)) * 100);   
   }

   //
   // END LEVEL HACK
   //

#
# [ FIND ] -------
#
      'U_DELETE'         => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&amp;f=$forum_id&amp;p={$row['post_id']}") : ''),

#
# [ AFTER, ADD ] -------
#
//
// BEGIN LEVEL MOD
//
      'POSTER_HP' => $level_hp,
      'POSTER_HP_WIDTH' => $level_hp_percent,
      'POSTER_HP_EMPTY' => ( 100 - $level_hp_percent ),
      'POSTER_MP' => $level_mp,
      'POSTER_MP_WIDTH' => $level_mp_percent,
      'POSTER_MP_EMPTY' => ( 100 - $level_mp_percent ),
      'POSTER_EXP' => $level_exp,
      'POSTER_EXP_WIDTH' => $level_exp_percent,
      'POSTER_EXP_EMPTY' => ( 100 - $level_exp_percent ),
      'POSTER_LEVEL' => $level_level,
//
// END LEVEL MOD
//

#
# [ OPEN ] -------
#
styles/prosilver/template/viewtopic_body.html

#
# [ FIND ] -------
#
      <!-- END custom_fields -->
      
#
# [ AFTER, ADD ] -------
#
      <br clear="all"/>
      <dd><span class="postdetails">Niveau: <b>{postrow.POSTER_LEVEL}</b> </dd>
      <br clear="all"/>
      <table width="142" border="0" cellpadding="0" cellspacing="0" background="styles/prosilver/imageset/level_mod/corps.gif" height="49">
           <tr>
                <td width="31" rowspan="2">&nbsp;</td>
                <td width="109" valign="top">
                     <table width="111" border="0" cellpadding="0" cellspacing="0">
                       <tr>
                            <td valign="top" align="left"><img src="styles/prosilver/imageset/level_mod/01.gif" width="1" height="4"></td>
                       </tr>
                       <tr>
                            <td><img src="styles/prosilver/imageset/level_mod/barreV.gif" width="{postrow.POSTER_HP_WIDTH}" height="10" alt="{postrow.POSTER_HP}" name="barreHP"><img src="styles/prosilver/imageset/level_mod/rondV.gif" width="4" height="10"></td>
                       </tr>
                       <tr>
                            <td><img src="styles/prosilver/imageset/level_mod/02.gif" width="1" height="3"></td>
                       </tr>
                       <tr>
                            <td><img src="styles/prosilver/imageset/level_mod/barreB.gif" width="{postrow.POSTER_MP_WIDTH}" height="10" alt="{postrow.POSTER_MP}" name="barreMP"><img src="styles/prosilver/imageset/level_mod/rondB.gif" width="4" height="10"></td>
                       </tr>
                       <tr>
                            <td><img src="styles/prosilver/imageset/level_mod/03.gif" width="1" height="3"></td>
                       </tr>
                       <tr>
                            <td><img src="styles/prosilver/imageset/level_mod/barreR.gif" width="{postrow.POSTER_EXP_WIDTH}" height="10" alt="{postrow.POSTER_EXP}" name="barreEXP"><img src="styles/prosilver/imageset/level_mod/rondR.gif" width="4" height="10"></td>
                       </tr>
                       <tr>
                            <td height="5"></td>
                       </tr>
                     </table>
                </td>
              <td width="3"></td>
           </tr>
      </table> </dd>


le HTML est peut être à revoir, je suis en cours donc...
Ancien Administrateur de phpBB-fr - R.I.P Oyo 2006~2009

Oyo's folio | PrestaShop | PrestaStore | PrestaBox
Avatar de l’utilisateur
Oyo
Inoubliable administrateur
 
Messages: 15266
Inscription: 12 Fév 2003 à 19:02
Localisation: Paris

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar pal » 13 Oct 2008 à 21:14

Salut,

merci 0yo, depuis le temps que je l'ai voulu ce mod :wink:

en l'installant et en activant le debug, y'a des erreurs qui s'affichent sur le viewtopic :

Code: Tout sélectionner
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1510: Undefined variable: posts_per_day
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1510: Undefined variable: posts_per_day
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1510: Undefined variable: posts_per_day
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1510: Undefined variable: posts_per_day
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1510: Undefined variable: posts_per_day
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1510: Undefined variable: posts_per_day
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /viewtopic.php on line 1614: Undefined variable: level_posts_for_this
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3572: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2975)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3574: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2975)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3575: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2975)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3576: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2975)


t'aurais une petite idée pour résoudre ce problème stp ?

sinon pour le code html si c'est du xhtml strict 1.0 je vais le faire ^^
pal
Apprenti-posteur
Apprenti-posteur
 
Messages: 128
Inscription: 09 Déc 2007 à 09:50

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar Oyo » 14 Oct 2008 à 18:50

Salut,

Pour les notices, c'est rien de grave... il t'indique juste que les variables ne sont pas déclarer donc pas d'inquiétude à avoir ;) Si ça avait était en C ou en C++ là ça aurai poser des problèmes.

Si tu veux quand même ne plus savoir de notices dans ce cas là il suffit de prendre chaque variables en notice et de faire ceci:
Code: Tout sélectionner
$posts_per_day = $level_posts_for_this = ''; // ect....


Si tu fait le XHTLM, je veux bien que tu poses ton code (à vrai dire j'ai un peu la flemme de le faire et j'ai pas mal de boulot ^^) comme ça je le mettrai en forme pour en faire un vrai mod et pas une bidouille :p et je le posterai certainement sur phpBB.com
Ancien Administrateur de phpBB-fr - R.I.P Oyo 2006~2009

Oyo's folio | PrestaShop | PrestaStore | PrestaBox
Avatar de l’utilisateur
Oyo
Inoubliable administrateur
 
Messages: 15266
Inscription: 12 Fév 2003 à 19:02
Localisation: Paris

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar pal » 16 Oct 2008 à 10:22

c'est en cours, en modx ^^
pal
Apprenti-posteur
Apprenti-posteur
 
Messages: 128
Inscription: 09 Déc 2007 à 09:50

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar Bruno36 » 13 Nov 2008 à 08:56

Oyo a écrit:Salut,

Pour les notices, c'est rien de grave... il t'indique juste que les variables ne sont pas déclarer donc pas d'inquiétude à avoir ;) Si ça avait était en C ou en C++ là ça aurai poser des problèmes.

Si tu veux quand même ne plus savoir de notices dans ce cas là il suffit de prendre chaque variables en notice et de faire ceci:
Code: Tout sélectionner
$posts_per_day = $level_posts_for_this = ''; // ect....


Si tu fait le XHTLM, je veux bien que tu poses ton code (à vrai dire j'ai un peu la flemme de le faire et j'ai pas mal de boulot ^^) comme ça je le mettrai en forme pour en faire un vrai mod et pas une bidouille :p et je le posterai certainement sur phpBB.com


Bonjour!

J'ai pas trop comprit comment modifier car j'ai c'est 2 ligne qui me pause probleme :oops:
if($posts_per_day >= $level_avg_ppd)
$level_exp_percent = floor( ($user_cache[$poster_id]['posts'] - $level_posts_for_this) / max(1,($level_posts_for_next - $level_posts_for_this)) * 100);
Avatar de l’utilisateur
Bruno36
Roi des posts
Roi des posts
 
Messages: 845
Inscription: 14 Nov 2007 à 12:53
Localisation: issoudun

Re: [adaptation] Statistiques d'activités : HP, MP, EXP

Messagepar Oyo » 15 Nov 2008 à 18:28

Salut,

A savoir ? tu as un problème car tu as des notices ? Si c'est le cas ce n'est pas bien grave ça ne doit pas avoir d'influence(il me semble) sur le fonctionnement du mod ;) sinon soit un peu plus claire dans tes propos je n'ai pas de boule de cristal:mrgreen: :mrgreen:

pal m'a fourni une version modx mais je n'ai pas vraiment eu le temps de la poster.
Ancien Administrateur de phpBB-fr - R.I.P Oyo 2006~2009

Oyo's folio | PrestaShop | PrestaStore | PrestaBox
Avatar de l’utilisateur
Oyo
Inoubliable administrateur
 
Messages: 15266
Inscription: 12 Fév 2003 à 19:02
Localisation: Paris


Retourner vers Aide au développement

 


  • Articles en relation
    Réponses
    Vus
    Dernier message

Qui est en ligne

Utilisateurs parcourant ce forum: Aucun utilisateur enregistré et 1 invité

Partenaires : phpBBHacks.com • phpBB-Seo.com • EzCom-fr.com • phpBB3 Styles • phpBB podpora • phpBB Portugal    Liens : Net Avenir • PromoBenef • Ticket Gagnant