Exemple #1
0
                            break;
                        }
                    } else {
                        dire('[QUIZZ] Pas asse de gils ' . $sName . '! Il faut 1 gils par réponse proposer.');
                    }
                } else {
                    dire('[QUIZZ] L\'auteur de la question ne peux pas répondre, mais gagne ' . QUIZZ_AUTEUR_XP * 100 . '% d\'XP et ' . QUIZZ_AUTEUR_GILS . ' gils à chaque fois que la question passe.');
                }
            }
        }
        $oFile = fopen(PATH_FROM_QUIZZ, "w+");
        fclose($oFile);
    }
    if ($aCooldown['timerNext'] < microtrue()) {
        // TEMPS ECOULé
        $oPDO->query('UPDATE quizz SET actual=0, used=1 WHERE actual=1');
        dire('[QUIZZ] Le temps est écoulé, vous trouverez la réponse une prochaine fois.');
        $oPDO->query('DELETE FROM cooldown WHERE name="EVENT"');
        purgeQuizzPve();
        exit;
    }
    // NEED INDICE
    $aIndice = $oPDO->query('SELECT * FROM cooldown WHERE name="QUIZZ_INDICE"')->fetch(PDO::FETCH_ASSOC);
    if ($aIndice) {
        if ($aIndice['timerNext'] < microtrue()) {
            // INDICE TEMPS ECOULé
            dire('[QUIZZ] La moitié du temps est écoulé, un indice: ' . $aQuizz['indice']);
            $oPDO->query('DELETE FROM cooldown WHERE name="QUIZZ_INDICE"');
        }
    }
}
Exemple #2
0
<?php

set_time_limit(0);
error_reporting(E_ALL);
session_start();
//sleep(1);
// R�cup�re la date
date_default_timezone_set('Europe/Paris');
$sToday = date('d/m/Y');
// Initialise PDO pour les requete sql
include './DatabaseConfig.php';
include './php/config.php';
include './php/functions.php';
setEvent('STOP');
dire('[QUIZZ/PVE] D�sactiv�.');
$oPDO = null;
Exemple #3
0
    // VERIFIE LE PRIX
    $iPrice = $iTicketGils * $iTicket;
    if ($iPrice > $iGils) {
        $iTicket = floor($iGils / $iTicketGils);
        $iPrice = $iTicketGils * $iTicket;
    }
    // Valide les ticket
    if ($iTicket > 0) {
        $iTotalTicket = $iTotalTicket + $iTicket;
        $iTotalGils = $iTotalGils + $iPrice;
        $aRaffle[$sName] = $iTicket;
        $oPDO->query('UPDATE viewer SET gils=gils-' . $iPrice . ' WHERE name="' . $sName . '"');
    }
}
// Annonce la fermeture de la raffle
dire('[RAFFLE] Un total de ' . $iTotalTicket . ' ont était acheté pour la somme de ' . $iTotalGils . ' gils.');
// Prépare les var pour sortir le gagnant
$iPos = 0;
$iPoolStart = 0;
$iPoolEnd = 0;
$iTicketWin = rand(1, $iTotalTicket);
unlink(PATH_TO_RAFFLE);
raffle('set %raffle.pos 0');
while (true) {
    foreach ($aRaffle as $sName => $iTicket) {
        $sName = formatName($sName);
        // régle le pool start
        if ($iPoolStart == 0) {
            $iPoolStart = 1;
        } else {
            $iPoolStart = $iPoolEnd + 1;
Exemple #4
0
        var_dump($aLine);
        if (isset($aLine[0]) && isset($aLine[1])) {
            $sName = formatName($aLine[0]);
            $sMessage = trim(substr($sLine, strlen($sName)));
            // vérifie les gils
            $aViewer = $oPDO->query('SELECT * FROM viewer WHERE gils>=' . VIEWER_MSG_PRICE . ' AND name="' . $sName . '"')->fetch(PDO::FETCH_ASSOC);
            var_dump($aViewer);
            if ($aViewer) {
                $oPDO->query('UPDATE viewer SET gils=gils-' . VIEWER_MSG_PRICE . ' WHERE name="' . $sName . '"');
                $oSQL = $oPDO->prepare('INSERT INTO message_viewer SET name=:name, message=:message');
                $oSQL->bindValue(':name', $sName);
                $oSQL->bindValue(':message', $sMessage);
                $oSQL->execute();
                dire('[MSG] ' . $sName . ', votre message est ajouté à la liste d\'attente.');
            } else {
                dire('[MSG] ' . $sName . ', enregistrer un message coute 300 gils pour 5 minutes de diffusion.');
            }
        }
    }
    $oFile = fopen(PATH_FROM_MSG, "w+");
    fclose($oFile);
}
// VERIFIE SI QUIZZ
$aQuizz = $oPDO->query('SELECT * FROM quizz WHERE actual=1')->fetch(PDO::FETCH_ASSOC);
if ($aQuizz && $iMSGStatus == 0) {
    // QUIZZ EN COURS
    $sMSG = $aQuizz['question'];
    $sTITRE = MSG_QUIZZ_TITRE;
    $iMSGStatus = 1;
}
// VERIFIE SI PVE
Exemple #5
0
<?php

set_time_limit(0);
error_reporting(E_ALL);
session_start();
//sleep(1);
// R�cup�re la date
date_default_timezone_set('Europe/Paris');
$sToday = date('d/m/Y');
// Initialise PDO pour les requete sql
include './DatabaseConfig.php';
include './php/config.php';
include './php/functions.php';
setEvent('RESET');
dire('[QUIZZ/PVE] D�but des timer.');
$oPDO = null;
Exemple #6
0
<?php

$i7Days = microtrue() + 60 * 60 * 24 * 7;
$aCooldown = $oPDO->query('SELECT * FROM cooldown WHERE name="CLOSE_EVENT"')->fetch(PDO::FETCH_ASSOC);
if (!$aCooldown) {
    $oPDO->query('INSERT INTO cooldown SET name="CLOSE_EVENT", status="0", timerNext=' . $i7Days . ', stepNext="close_event"');
}
if ($aCooldown['status'] == 0 && $aCooldown['stepNext'] == 'close_event' && $aCooldown['timerNext'] < microtrue()) {
    // STATUS: ATTENTE, STEPNEXT: CLOSE_EVENT, TIMERNEXT: DEPASSé
    // Ferme les event et incrémente le score de tout le monde
    dire('[QUIZZ/PVE] Le classement de la semaine sera bientôt disponible sur la page facebook: http://facebook.com/nesstream');
    // INCREMENTE DE 10 LES SCORE
    $oPDO->query('UPDATE viewer SET winPVE=winPVE+1 WHERE winPVE!=0');
    $oPDO->query('UPDATE viewer SET winQuizz=winQuizz+1 WHERE winQuizz!=0');
    // LISTE LES GAGNANT
    $aWINQuizz = $oPDO->query('SELECT * FROM viewer WHERE scoreQuizz>0 ORDER BY scoreQuizz DESC, level DESC, timetotal DESC LIMIT 0,5')->fetchAll(PDO::FETCH_ASSOC);
    $aWINPVE = $oPDO->query('SELECT * FROM viewer WHERE scorePVE>0 ORDER BY scorePVE DESC, level DESC, timetotal DESC LIMIT 0,5')->fetchAll(PDO::FETCH_ASSOC);
    // SAVE LA LISTE
    foreach ($aWINQuizz as $iKey => $aValue) {
        $iPos = $iKey + 1;
        $oPDO->query('UPDATE viewer SET winQuizz=0.' . (6 - $iPos) . ' WHERE name="' . $aValue['name'] . '"');
    }
    foreach ($aWINPVE as $iKey => $aValue) {
        $iPos = $iKey + 1;
        $oPDO->query('UPDATE viewer SET winPVE=0.' . (6 - $iPos) . ' WHERE name="' . $aValue['name'] . '"');
    }
    // RESET LE SCORE
    $oPDO->query('UPDATE viewer SET scoreQuizz=0, scorePVE=0 WHERE scoreQuizz!=0 OR scorePVE!=0');
    // RELANCE LE TIMER
    $oPDO->query('UPDATE cooldown SET timerNext=' . $i7Days . ' WHERE name="CLOSE_EVENT"');
}
Exemple #7
0
     foreach ($aAtkList as $aValue) {
         if ($sDire == '') {
             $sDire = $aPVE['name'] . $sMort . ', les viewer suivant gagnent ' . PVE_ATK_XP * 100 . '% XP de leurs level et ' . PVE_ATK_GILS . ' gils: ';
         }
         if ($sListe == '') {
             $sListe = $aValue['stepNext'];
         } else {
             $sListe .= ', ' . $aValue['stepNext'];
         }
     }
     if ($sDire == '') {
         $sDire = $aPVE['name'] . $sMort . '.';
     }
     dire('[PVE] ' . $sDire);
     if ($sListe != '') {
         dire('[PVE] ' . $sListe);
     }
     $oPDO->query('UPDATE cooldown SET status=0, stepNext="' . EVENT_STEP_AFTER_PVE . '", timerNext=' . (microtrue() + COOLDOWN_QUIZZ * 60) . ' WHERE name="EVENT"');
     $oPDO->query('DELETE FROM cooldown WHERE name="KILL_ATK"');
     purgeQuizzPve();
     exit;
 }
 // Parcours le fichier kill.txt
 if (is_file(PATH_FROM_KILL)) {
     $oFile = fopen(PATH_FROM_KILL, "r");
     $aProfile = array();
     while (!feof($oFile)) {
         $sLine = trim(fgets($oFile, 4096));
         // explose la ligne
         $aLine = explode(',', $sLine);
         $sName = formatName($aLine[0]);
Exemple #8
0
                <div class="tab-pane fade active in" id="grade">
					
                <p>             
					<?php 
    $rows = mysql_result(mysql_query('SELECT COUNT(*) FROM tbl_defaultcomponent'), 0);
    if ($rows) {
        ?>
                            <div class="block">
                                <div class="navbar navbar-inner block-header">
                                </div>
                                <div class="block-content collapse in">
                                    <form class="form-horizontal">
                                      <fieldset>
                                        <legend>Grade Component</legend>
									<?php 
        $result = mysql_query("SELECT * FROM tbl_defaultcomponent") or dire(mysql_error());
        while ($row = mysql_fetch_array($result)) {
            $n = $row['name'];
            $n = str_replace("_", " ", strtolower($n));
            $n = ucwords($n);
            //echo "<tr align=\"center\"><td width=\"150px\">".$n."</td><td width=\"150px\">".$row['required_number']."</td><td width=\"150px\">".$row['percentage']."</td></tr>";
            ?>
											
												<div class="control-group">
												 <label class="control-label" for="typeahead"><?php 
            echo $n;
            ?>
</label>
												  <div class="controls">	
													<span class="input-mini uneditable-input"><?php 
            echo $row['required_number'];
Exemple #9
0
<?php

// Parcours les cmd viewer
if (is_file(PATH_FROM_CMD)) {
    $oFile = fopen(PATH_FROM_CMD, "r");
    while (!feof($oFile)) {
        $aExplode = explode(',', fgets($oFile, 4096));
        $sName = formatName($aExplode[0]);
        if (isset($aExplode[1])) {
            $sCMD = trim($aExplode[1]);
        } else {
            $sCMD = '';
        }
        if ($sCMD == 'gils') {
            $iGils = $oPDO->query('SELECT gils FROM viewer WHERE name="' . $sName . '"')->fetch(PDO::FETCH_ASSOC);
            dire('[GILS] ' . $sName . ': ' . $iGils['gils']);
        }
        if ($sCMD == 'level') {
            $iLevel = $oPDO->query('SELECT * FROM viewer WHERE name="' . $sName . '"')->fetch(PDO::FETCH_ASSOC);
            dire('[LEVEL] ' . $sName . ': ' . $iLevel['level'] . ' (' . round($iLevel['xpcurrent'] / $iLevel['xpreq'] * 100) . '%)');
        }
    }
    fclose($oFile);
    unlink(PATH_FROM_CMD);
}
Exemple #10
0
                } else {
                    // ajoute le fichier
                    if ($sAuteur != 'Nestoyeur') {
                        $oPDO->query('UPDATE viewer SET gils=gils-' . intval($iDuree) . ' WHERE name="' . $sAuteur . '"');
                    }
                    dire('dire [YOUTUBE] Ajout de ' . $sAuteur . ': ' . $sTitre . ' [' . $sDuree . '] ' . $iDuree . ' gils');
                    $insert = $oPDO->prepare('INSERT INTO youtube SET auteur="' . strtolower($sAuteur) . '", lastMod="' . intval(microtime(true)) . '", playlist="' . $sPlaylist . '", played=0, youtubeID="' . $sLink . '", duree="' . $iDuree . '", titre=:titre');
                    $insert->bindValue(':titre', $sTitre);
                    $insert->execute();
                    //$oPDO->query('INSERT INTO youtube SET auteur="'.strtolower($sAuteur).'", playlist="'.$sPlaylist.'", played=0, youtubeID="'.$sLink.'", duree="'.$iDuree.'", titre="'.$sTitre.'"');
                }
                // ajoute la playlist
                $iCountPlaylist = $oPDO->query('SELECT COUNT(*) FROM playlist WHERE playlist="' . $sPlaylist . '"')->fetch(PDO::FETCH_COLUMN);
                if ($iCountPlaylist == '0') {
                    $oPDO->query('INSERT INTO playlist SET playlist="' . $sPlaylist . '", actual="1"');
                    dire('dire [YOUTUBE] Playlist ' . $sPlaylist . ' créé');
                }
                break;
            }
        }
    }
    $oFile = fopen(PATH_OVERLAY_YOUTUBE_ADD, "w+");
    fclose($oFile);
}
$sOrder = getYoutubeStatus();
if ($sOrder == 'STOP') {
    $oPDO->query('UPDATE youtube SET timePlay=0, timeStop=0 WHERE ID>0');
    setYoutube('STOP', '', '0');
}
if ($sOrder == 'NEXT') {
    $oPDO->query('UPDATE youtube SET timePlay=0, timeStop=0, penalite=1 WHERE timePlay>0');