diff --git a/Shootmania/Elite/Elite.php b/Shootmania/Elite/Elite.php
index 23845e8..48200d0 100644
--- a/Shootmania/Elite/Elite.php
+++ b/Shootmania/Elite/Elite.php
@@ -70,7 +70,7 @@ class Elite extends \ManiaLive\PluginHandler\Plugin {
private $playerIDs = array();
function onInit() {
- $this->setVersion('1.0.6a');
+ $this->setVersion('1.0.6.b');
$this->logger = new Log('./logs/', Log::DEBUG, $this->storage->serverLogin);
$this->mapdirectory = $this->connection->getMapsDirectory();
@@ -440,8 +440,7 @@ function onLoad() {
}
- if(!$this->db->tableExists()){
-
+ if(!$this->db->tableExists('team_stats')){
$q = "CREATE TABLE IF NOT EXISTS `team_stats` (
`team_id` mediumint(9) NOT NULL,
`competition_id` mediumint(9) NOT NULL,
@@ -1859,4 +1858,4 @@ protected function getWeaponName($num) {
}
-?>
+?>
\ No newline at end of file
diff --git a/Shootmania/Elite/Spectator/Spectator.php b/Shootmania/Elite/Spectator/Spectator.php
index ff294fa..f56cd98 100644
--- a/Shootmania/Elite/Spectator/Spectator.php
+++ b/Shootmania/Elite/Spectator/Spectator.php
@@ -45,7 +45,6 @@ class Spectator extends \ManiaLive\PluginHandler\Plugin {
/** @var integer */
protected $MatchNumber = false;
- protected $imagequad = 'http://tmrankings.com/mp/header2.png';
/** @var integer */
private $AtkPlayer;
@@ -79,9 +78,9 @@ class Spectator extends \ManiaLive\PluginHandler\Plugin {
private $playerIDs = array();
function onInit() {
- $this->setVersion('1.0.5j');
+ $this->setVersion('1.0.6.b');
- $this->logger = new Log($this->storage->serverLogin);
+ $this->logger = new Log('./logs/', Log::DEBUG, $this->storage->serverLogin);
}
function onLoad() {
@@ -114,7 +113,7 @@ function getServerCurrentMatch($serverLogin) {
'SELECT id FROM matches ' .
'where MatchEnd = "0000-00-00 00:00:00" and `matchServerLogin` = ' . $this->db->quote($serverLogin) .
'order by id desc')->fetchSingleValue();
- $this->logger->Normal($CurrentMatchid);
+ $this->logger->logDebug($CurrentMatchid);
return $this->db->execute(
'SELECT id FROM matches ' .
'where MatchEnd = "0000-00-00 00:00:00" and `matchServerLogin` = ' . $this->db->quote($serverLogin) .
@@ -122,8 +121,8 @@ function getServerCurrentMatch($serverLogin) {
}
public function onModeScriptCallback($event, $json) {
- $this->logger->Callbacks($event);
- $this->logger->Callbacks($json);
+ $this->logger->logInfo($event);
+ $this->logger->logInfo($json);
switch ($event) {
case 'BeginTurn':
$this->onXmlRpcEliteBeginTurn(new JsonCallbacks\BeginTurn($json));
@@ -159,14 +158,14 @@ function onXmlRpcEliteBeginTurn(JsonCallbacks\BeginTurn $content) {
}
function onTick() {
- if ((time() - $this->lastUpdate) > 3 && $this->needUpdate || $this->forceUpdate == true) {
+ if ((time() - $this->lastUpdate) > 0.5 && $this->needUpdate || $this->forceUpdate == true) {
$this->lastUpdate = time();
$this->forceUpdate = false;
$this->needUpdate = false;
$this->MatchNumber = $this->getServerCurrentMatch($this->storage->serverLogin);
//var_dump($this->BeginTurnAtkPlayer);
//var_dump($this->AtkPlayer);
- if (empty($this->SpecTarget->login) || $this->SpecTarget->login == $this->storage->serverLogin || empty($this->BeginTurnAtkPlayer) || empty($this->AtkPlayer))
+ if (empty($this->SpecTarget->login) || $this->SpecTarget->login === $this->storage->serverLogin || empty($this->BeginTurnAtkPlayer) || empty($this->AtkPlayer) || $this->SpecPlayer->currentTargetId === 255)
return;
if ($this->SpecPlayer->spectator) {
@@ -180,7 +179,7 @@ function onTick() {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryCurrentMatchAtkPlayerStats);
+ $this->logger->logDebug($queryCurrentMatchAtkPlayerStats);
$this->db->execute($queryCurrentMatchAtkPlayerStats);
$AtkRoundsObject = $this->db->execute($queryCurrentMatchAtkPlayerStats)->fetchObject()->atkrounds;
@@ -203,7 +202,7 @@ function onTick() {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryCurrentMatchAtkPlayerStats);
+ $this->logger->logDebug($queryCurrentMatchAtkPlayerStats);
$this->db->execute($queryCurrentMatchAtkPlayerStats);
$AtkRoundsObject = $this->db->execute($queryCurrentMatchAtkPlayerStats)->fetchObject()->atkrounds;
@@ -222,7 +221,7 @@ function onTick() {
}
$QueryRocketHits = "SELECT (SUM(hits)/SUM(shots)*100) as ratio, SUM(shots) as shots, SUM(hits) as hits FROM `shots` AS `Shot` WHERE ((`Shot`.`player_id` = " . $this->db->quote($this->AtkPlayer) . ") AND (`Shot`.`weapon_id` = 2) AND (`Shot`.`match_map_id` = " . $this->db->quote($this->match_map_id) . ")) LIMIT 1";
- $this->logger->Spectator($QueryRocketHits);
+ $this->logger->logDebug($QueryRocketHits);
$this->db->execute($QueryRocketHits);
$RocketHitsQuery = $this->db->execute($QueryRocketHits)->fetchObject()->hits;
@@ -233,7 +232,7 @@ function onTick() {
}
$LaserAccQuery = "SELECT (SUM(hits)/SUM(shots)*100) as ratio, SUM(shots) as shots, SUM(hits) as hits FROM `shots` AS `Shot` WHERE ((`Shot`.`player_id` = " . $this->db->quote($this->AtkPlayer) . ") AND (`Shot`.`weapon_id` = 1) AND (`Shot`.`match_map_id` = " . $this->db->quote($this->match_map_id) . ")) LIMIT 1";
- $this->logger->Spectator($LaserAccQuery);
+ $this->logger->logDebug($LaserAccQuery);
$this->db->execute($LaserAccQuery);
$LaserAccRatio = $this->db->execute($LaserAccQuery)->fetchObject()->ratio;
@@ -251,7 +250,7 @@ function onTick() {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryCurrentMatchAtkPlayerStatsCaptures);
+ $this->logger->logDebug($queryCurrentMatchAtkPlayerStatsCaptures);
$this->db->execute($queryCurrentMatchAtkPlayerStatsCaptures);
$AtkCaptureObject = $this->db->execute($queryCurrentMatchAtkPlayerStatsCaptures)->fetchObject()->Captures;
@@ -267,7 +266,7 @@ function onTick() {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($QueryShots_HitsAtkPlayer);
+ $this->logger->logDebug($QueryShots_HitsAtkPlayer);
$this->db->execute($QueryShots_HitsAtkPlayer);
$AtkShotsObject = $this->db->execute($QueryShots_HitsAtkPlayer)->fetchObject()->shots;
@@ -284,7 +283,7 @@ function onTick() {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryAtkHitRatio);
+ $this->logger->logDebug($queryAtkHitRatio);
$this->db->execute($queryAtkHitRatio);
@@ -318,8 +317,8 @@ public function toggleWidgetForPlayer($login) {
}
public function onPlayerInfoChanged($playerInfo) {
- $player = \ManiaPlanet\DedicatedServer\Structures\Player::fromArray($playerInfo);
-
+ $player = \ManiaPlanet\DedicatedServer\Structures\PlayerInfo::fromArray($playerInfo);
+ echo $player->currentTargetId;
if (!array_key_exists($player->login, $this->widgetVisible)) {
$this->widgetVisible[$player->login] = True;
@@ -346,25 +345,13 @@ public function onPlayerInfoChanged($playerInfo) {
//var_dump($player);
$this->SpecPlayer = $player;
if ($this->SpecPlayer->currentTargetId == 0) {
- $xml = '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $this->connection->sendHideManialinkPage($player->login, $xml, 0, true, true);
+ $this->connection->sendHideManialinkPage();
}
foreach ($this->storage->spectators as $login => $player) {
- $xml = '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $this->connection->sendHideManialinkPage($player->login, $xml, 0, true, true);
+ $this->connection->sendHideManialinkPage();
}
- if ($this->SpecPlayer->currentTargetId == 255) {
- $xml = '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $this->connection->sendHideManialinkPage($player->login, $xml, 0, true, true);
+ if ($this->SpecPlayer->currentTargetId === 255) {
+ $this->connection->sendHideManialinkPage();
}
if ($player->spectator == true && $player->pureSpectator == true && $this->widgetVisible[$player->login]) {
$this->needUpdate = true;
@@ -384,7 +371,7 @@ public function onPlayerInfoChanged($playerInfo) {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryCurrentMatchAtkPlayerStats);
+ $this->logger->logDebug($queryCurrentMatchAtkPlayerStats);
$this->db->execute($queryCurrentMatchAtkPlayerStats);
$AtkRoundsObject = $this->db->execute($queryCurrentMatchAtkPlayerStats)->fetchObject()->atkrounds;
@@ -407,7 +394,7 @@ public function onPlayerInfoChanged($playerInfo) {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryCurrentMatchAtkPlayerStats);
+ $this->logger->logDebug($queryCurrentMatchAtkPlayerStats);
$this->db->execute($queryCurrentMatchAtkPlayerStats);
$AtkRoundsObject = $this->db->execute($queryCurrentMatchAtkPlayerStats)->fetchObject()->atkrounds;
@@ -426,7 +413,7 @@ public function onPlayerInfoChanged($playerInfo) {
}
$QueryRocketHits = "SELECT (SUM(hits)/SUM(shots)*100) as ratio, SUM(shots) as shots, SUM(hits) as hits FROM `shots` AS `Shot` WHERE ((`Shot`.`player_id` = " . $this->db->quote($this->AtkPlayer) . ") AND (`Shot`.`weapon_id` = 2) AND (`Shot`.`match_map_id` = " . $this->db->quote($this->match_map_id) . ")) LIMIT 1";
- $this->logger->Spectator($QueryRocketHits);
+ $this->logger->logDebug($QueryRocketHits);
$this->db->execute($QueryRocketHits);
$RocketHitsQuery = $this->db->execute($QueryRocketHits)->fetchObject()->hits;
@@ -437,7 +424,7 @@ public function onPlayerInfoChanged($playerInfo) {
}
$LaserAccQuery = "SELECT (SUM(hits)/SUM(shots)*100) as ratio, SUM(shots) as shots, SUM(hits) as hits FROM `shots` AS `Shot` WHERE ((`Shot`.`player_id` = " . $this->db->quote($this->AtkPlayer) . ") AND (`Shot`.`weapon_id` = 1) AND (`Shot`.`match_map_id` = " . $this->db->quote($this->match_map_id) . ")) LIMIT 1";
- $this->logger->Spectator($LaserAccQuery);
+ $this->logger->logDebug($LaserAccQuery);
$this->db->execute($LaserAccQuery);
$LaserAccRatio = $this->db->execute($LaserAccQuery)->fetchObject()->ratio;
@@ -455,7 +442,7 @@ public function onPlayerInfoChanged($playerInfo) {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryCurrentMatchAtkPlayerStatsCaptures);
+ $this->logger->logDebug($queryCurrentMatchAtkPlayerStatsCaptures);
$this->db->execute($queryCurrentMatchAtkPlayerStatsCaptures);
$AtkCaptureObject = $this->db->execute($queryCurrentMatchAtkPlayerStatsCaptures)->fetchObject()->Captures;
@@ -472,7 +459,7 @@ public function onPlayerInfoChanged($playerInfo) {
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($QueryShots_HitsAtkPlayer);
+ $this->logger->logDebug($QueryShots_HitsAtkPlayer);
$this->db->execute($QueryShots_HitsAtkPlayer);
$AtkShotsObject = $this->db->execute($QueryShots_HitsAtkPlayer)->fetchObject()->shots;
@@ -489,7 +476,7 @@ public function onPlayerInfoChanged($playerInfo) {
WHERE player_maps.player_id = " . $this->db->quote($this->AtkPlayer) . "
AND player_maps.match_id = " . $this->db->quote($this->MatchNumber) . "
AND player_maps.match_map_id = " . $this->db->quote($this->match_map_id) . "";
- $this->logger->Spectator($queryAtkHitRatio);
+ $this->logger->logDebug($queryAtkHitRatio);
$this->db->execute($queryAtkHitRatio);
@@ -536,16 +523,21 @@ function ShowWidget($login, $AttackPlayerNick, $RoundsAtk, $RoundsSuccess, $Capt
$red = $this->connection->getTeamInfo(2);
$xml = '';
$xml .= '';
- $xml .= '';
- $xml .= ''; // MainWindow
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
- $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
+ $xml .= '';
if ($TeamNr == 1) {
if ($blue->clubLinkUrl) {
//$xml .= '';
@@ -625,14 +617,14 @@ function getPlayerId($login) {
return $this->playerIDs[$login];
} else {
$q = "SELECT id FROM `players` WHERE `login` = " . $this->db->quote($login) . "";
- $this->logger->Spectator($q);
+ $this->logger->logDebug($q);
return $this->db->execute($q)->fetchObject()->id;
}
}
function getMapid() {
$q = "SELECT id FROM `maps` WHERE `uid` = " . $this->db->quote($this->storage->currentMap->uId) . "";
- $this->logger->Spectator($q);
+ $this->logger->logDebug($q);
return $this->db->execute($q)->fetchObject()->id;
}