1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
| function onChallengeListModified($curChallengeIndex, $nextChallengeIndex, $isListModified)
{
$this->debugLog("*** ChallengeListModified\n");
if (!self::$connected) return;
}
function onBeginChallenge($challenge,$warmUp, $matchContinuation)
{
if (!self::$connected) return;
$this->debugLog('*** BeginChallenge '.TMStrings::stripAllTmStyle($challenge['Name']));
$this->connection->chatSendServerMessage(self::$prefSrv.'Begin Challenge',null,true);
self::$prix = $this->getPrix(self::$idEvenement);
// les spectateurs ne peuvent pas participer
foreach($this->storage->spectators as $login=>$player)
{ // on interdit de jouer aux spectateurs pour la mise
$this->joueurs[$login]->ready = false;
$this->joueurs[$login]->spectator = true;
}
foreach($this->storage->players as $login=>$player)
{ // on passe tout le monde en ready = false
$this->joueurs[$login]->ready = false;
$this->joueurs[$login]->spectator = false;
}
// on fait le ménage : si pas assez de crédit on zappe
self::$participants = 0;
foreach($this->joueurs as $login=>$joueur)
{
$this->joueurs[$login]->rank = 0;
$this->joueurs[$login]->best = -1;
$this->joueurs[$login]->credits = $this->getCredits($joueur->id_j);
if ($joueur->credits < self::$prix)
{
// on vire ceux qui n'ont plus rien a faire l▒|
$this->debugLog("* BeginChallenge : $login n'a pas assez de crédit");
$this->cacheWidget($login);
$this->cacheCredit($login);
$this->kickPlayer($login);
$this->joueurs[$login]->ready = false;
}
else
{
if ($joueur->spectator == false)
{
$this->joueurs[$login]->ready = true;
self::$participants++;
}
}
}
$this->debugLog('* BeginChallenge : Nb participants :'.self::$participants.' | Min : '.self::$nbMin);
// si nb joueur >= nbmin on joue sinon on attend de nouveau joueur
if (self::$participants < self::$nbMin)
{
self::$race = false;
$msg = self::$prefSrv.'Il n\'y a pas assez de joueurs (au moins '.self::$nbMin.' joueurs)';
$this->connection->chatSendServerMessage($msg,null,true);
$this->debugLog('* BeginChallenge : '.$msg);
$liste = $this->getListeJoueur();
}
else
{
self::$race = true;
foreach($this->joueurs as $login=>$joueur)
{
if ($joueur->ready)
{
$joueur->credits -= self::$prix;
$this->afficheCredit($login,$joueur->credits);
$this->joueurs[$login]->credits = $joueur->credits;
$this->updateCredits($joueur->id_j,$joueur->credits);
$this->connection->chatSendServerMessage(self::$prefPlayer.'Vous participez ▒| cette map, il vous reste '.$joueu r->credits.' credit(s).',$login,true);
self::$pot += self::$prix;
}
}
$liste = $this->getListeJoueur();
$msg = 'Nouvelle donne avec un pot de '.self::$pot.'<br/>Participants : '.count($liste).' ('.TMStrings::stripColors(implode(',',$ liste)).')';
$this->updateHisto(self::$idEvenement,$msg);
$msg = self::$prefSrv.self::$participants. ' participants, le pot est de '.self::$pot.' crédits';
$this->connection->chatSendServerMessage($msg,null,true);
$this->debugLog('* BeginChallenge : '.$msg);
}
$this->setPot(self::$pot,self::$idEvenement);
// on met a jour le widget GC
$players= array_merge($this->storage->players,$this->storage->spectators);
foreach($players as $login=>$p)
$this->afficheWidget($login,self::$pot,'','',$liste);
$this->connection->executeMulticall(); |
Partager