Last active
August 29, 2015 14:25
-
-
Save Dyrr/009d3a7cbb7b0ef2f054 to your computer and use it in GitHub Desktop.
mod a ref_header.php per gdrcd per controllo exp massima giornaliera
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if($PARAMETERS['mode']['exp_by_chat']=='ON') | |
{ | |
//definisce $exp_giornaliera per evitare notice nel while | |
$exp_giornaliera = 0; | |
//Query che recupera il numero di caratteri per messaggi del pg delle ultime 24 ore che hanno generato px; | |
$query = "SELECT CHAR_LENGTH(testo) AS msg_lenght"; | |
$query .= " FROM chat"; | |
$query .= " WHERE"; //CONDIZIONI | |
$query .= " mittente = '".gdrcd_filter_in($_SESSION['login'])."'"; //il mittente è il pg loggato | |
$query .= " AND (tipo = 'P' OR tipo = 'A' OR tipo = 'M')"; //il messaggio è del tipo di quelli che danno px | |
$query .= " AND DATE_ADD( ora, INTERVAL 1 DAY ) >= NOW()"; //è meno vecchio di 24 | |
//$query .= " AND CHAR_LENGTH(testo) > ".gdrcd_filter('num',$PARAMETERS['settings']['exp_by_chat']['number']); //è della lunghezza minima per generare px | |
//echo $query; | |
$result = gdrcd_query($query,'result'); | |
//clalcola l'esperienza accumulata nelle ultime 24h | |
while($row = gdrcd_query($result,'fetch')) | |
{ | |
$exp_giornaliera = $exp_giornaliera + ($row['msg_lenght']/$char_needed); | |
} | |
if($exp_giornaliera < $PARAMETERS['settings']['exp_by_chat']['max_exp']) | |
{ | |
if ($m_type == 'A' || $m_type == 'P' || $m_type == 'M') | |
gdrcd_query("UPDATE personaggio SET esperienza = esperienza + ".$exp_bonus." WHERE nome = '".$_SESSION['login']."' LIMIT 1"); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment