improved variable names
This commit is contained in:
parent
b1ce658fc9
commit
c59b5ac9cd
@ -174,18 +174,16 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$itemQuad->addToggleFeature($popoutFrame);
|
||||
|
||||
// Add items
|
||||
$x = -1;
|
||||
$itemPosX = -1;
|
||||
foreach ($this->adminMenuItems as $menuItems) {
|
||||
foreach ($menuItems as $menuItem) {
|
||||
$menuQuad = $menuItem[0];
|
||||
/**
|
||||
* @var Quad $menuQuad
|
||||
*/
|
||||
/** @var Quad $menuQuad */
|
||||
$popoutFrame->add($menuQuad);
|
||||
$menuQuad->setSize($itemSize, $itemSize);
|
||||
$menuQuad->setX($x);
|
||||
$menuQuad->setX($itemPosX);
|
||||
$menuQuad->setHAlign(Control::RIGHT);
|
||||
$x -= $itemSize * 1.05;
|
||||
$itemPosX -= $itemSize * 1.05;
|
||||
|
||||
if ($menuItem[1]) {
|
||||
$menuQuad->removeScriptFeatures();
|
||||
@ -240,18 +238,16 @@ class ActionsMenu implements CallbackListener, ManialinkPageAnswerListener {
|
||||
$itemQuad->addToggleFeature($popoutFrame);
|
||||
|
||||
// Add items
|
||||
$x = -1;
|
||||
$itemPosX = -1;
|
||||
foreach ($this->playerMenuItems as $menuItems) {
|
||||
foreach ($menuItems as $menuItem) {
|
||||
$menuQuad = $menuItem[0];
|
||||
/**
|
||||
* @var Quad $menuQuad
|
||||
*/
|
||||
/** @var Quad $menuQuad */
|
||||
$popoutFrame->add($menuQuad);
|
||||
$menuQuad->setSize($itemSize, $itemSize);
|
||||
$menuQuad->setX($x);
|
||||
$menuQuad->setX($itemPosX);
|
||||
$menuQuad->setHAlign(Control::RIGHT);
|
||||
$x -= $itemSize * 1.05;
|
||||
$itemPosX -= $itemSize * 1.05;
|
||||
|
||||
if ($menuItem[1]) {
|
||||
$menuQuad->removeScriptFeatures();
|
||||
|
@ -174,27 +174,27 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
$paging->setLabel($pageCountLabel);
|
||||
|
||||
// Setting pages
|
||||
$y = 0.;
|
||||
$id = 0;
|
||||
$posY = 0.;
|
||||
$index = 0;
|
||||
$pageFrame = null;
|
||||
|
||||
foreach ($serverSettings as $name => $value) {
|
||||
// Continue on CurrentMaxPlayers...
|
||||
$pos = strpos($name, "Current"); // TODO maybe display current somewhere
|
||||
$pos = strpos($name, 'Current'); // TODO maybe display current somewhere
|
||||
if ($pos !== false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($id % 13 === 0) {
|
||||
if ($index % 13 === 0) {
|
||||
$pageFrame = new Frame();
|
||||
$frame->add($pageFrame);
|
||||
$y = $height * 0.41;
|
||||
$posY = $height * 0.41;
|
||||
$paging->addPage($pageFrame);
|
||||
}
|
||||
|
||||
$settingFrame = new Frame();
|
||||
$pageFrame->add($settingFrame);
|
||||
$settingFrame->setY($y);
|
||||
$settingFrame->setY($posY);
|
||||
|
||||
$nameLabel = new Label_Text();
|
||||
$settingFrame->add($nameLabel);
|
||||
@ -227,16 +227,16 @@ class ServerSettings implements ConfiguratorMenu, CallbackListener {
|
||||
if ($name === 'Comment') {
|
||||
$entry->setAutoNewLine(true);
|
||||
$entry->setSize($width * 0.48, $settingHeight * 3 + $settingHeight * 0.9);
|
||||
$settingFrame->setY($y - $settingHeight * 1.5);
|
||||
$settingFrame->setY($posY - $settingHeight * 1.5);
|
||||
// dummy:
|
||||
// TODO: "dummy:" what? remove?
|
||||
$y -= $settingHeight * 3;
|
||||
$id += 3;
|
||||
$posY -= $settingHeight * 3;
|
||||
$index += 3;
|
||||
}
|
||||
}
|
||||
|
||||
$y -= $settingHeight;
|
||||
$id++;
|
||||
$posY -= $settingHeight;
|
||||
$index++;
|
||||
}
|
||||
|
||||
return $frame;
|
||||
|
@ -625,6 +625,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
||||
$votesPlugin->defineVote('switchmap', "Goto " . $map->name, true, $message);
|
||||
|
||||
$votesPlugin->startVote($player, 'switchmap', function ($result) use (&$votesPlugin, &$map) {
|
||||
// TODO: $result isn't used -> bug? does it skip even if vote is not successful?
|
||||
$this->maniaControl->chat->sendInformation('$sVote Successful -> Map switched!');
|
||||
$votesPlugin->undefineVote('switchmap');
|
||||
|
||||
|
@ -167,10 +167,10 @@ class MapQueue implements CallbackListener, CommandListener {
|
||||
}
|
||||
|
||||
$message = '$fa0Upcoming maps in the Map-Queue:';
|
||||
$i = 1;
|
||||
$index = 1;
|
||||
foreach ($this->queuedMaps as $queuedMap) {
|
||||
$message .= ' $<$fff' . $i . '$>. [$<$fff' . Formatter::stripCodes($queuedMap[1]->name) . '$>]';
|
||||
$i++;
|
||||
$message .= ' $<$fff' . $index . '$>. [$<$fff' . Formatter::stripCodes($queuedMap[1]->name) . '$>]';
|
||||
$index++;
|
||||
}
|
||||
|
||||
$this->maniaControl->chat->sendInformation($message, $player->login);
|
||||
|
@ -198,11 +198,11 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
$accuracies = $this->maniaControl->statisticManager->getStatsRanking(StatisticManager::SPECIAL_STAT_LASER_ACC);
|
||||
|
||||
$ranks = array();
|
||||
foreach ($hits as $player => $hitCount) {
|
||||
if (!isset($killDeathRatios[$player]) || !isset($accuracies[$player])) {
|
||||
foreach ($hits as $login => $hitCount) {
|
||||
if (!isset($killDeathRatios[$login]) || !isset($accuracies[$login])) {
|
||||
continue;
|
||||
}
|
||||
$ranks[$player] = $killDeathRatios[$player] * $accuracies[$player] * 1000;
|
||||
$ranks[$login] = $killDeathRatios[$login] * $accuracies[$login] * 1000;
|
||||
}
|
||||
|
||||
arsort($ranks);
|
||||
@ -212,7 +212,8 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
$minHits = $this->maniaControl->settingManager->getSettingValue($this, self::SETTING_MIN_HITS_POINTS_RANKING);
|
||||
$ranks = $this->maniaControl->statisticManager->getStatsRanking(StatisticCollector::STAT_ON_HIT, -1, $minHits);
|
||||
break;
|
||||
case self::RANKING_TYPE_RECORDS: //TODO verify workable status
|
||||
case self::RANKING_TYPE_RECORDS:
|
||||
// TODO: verify workable status
|
||||
/** @var LocalRecordsPlugin $localRecordsPlugin */
|
||||
$localRecordsPlugin = $this->maniaControl->pluginManager->getPlugin(__NAMESPACE__ . '\LocalRecordsPlugin');
|
||||
if (!$localRecordsPlugin) {
|
||||
@ -252,11 +253,11 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
|
||||
//compute each players new average score
|
||||
$ranks = array();
|
||||
foreach ($players as $player => $val) {
|
||||
foreach ($players as $playerIndex => $val) {
|
||||
$sum = $val[0];
|
||||
$cnt = $val[1];
|
||||
// ranked maps sum + $maxRecs rank for all remaining maps
|
||||
$ranks[$player] = ($sum + ($mapCount - $cnt) * $maxRecords) / $mapCount;
|
||||
$ranks[$playerIndex] = ($sum + ($mapCount - $cnt) * $maxRecords) / $mapCount;
|
||||
}
|
||||
|
||||
asort($ranks);
|
||||
@ -273,8 +274,8 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
$query = "INSERT INTO `" . self::TABLE_RANK . "` VALUES ";
|
||||
$index = 1;
|
||||
|
||||
foreach ($ranks as $player => $rankValue) {
|
||||
$query .= '(' . $player . ',' . $index . ',' . $rankValue . '),';
|
||||
foreach ($ranks as $playerIndex => $rankValue) {
|
||||
$query .= '(' . $playerIndex . ',' . $index . ',' . $rankValue . '),';
|
||||
$index++;
|
||||
}
|
||||
$query = substr($query, 0, strlen($query) - 1); // strip trailing ','
|
||||
@ -315,9 +316,9 @@ class ServerRankingPlugin implements Plugin, CallbackListener, CommandListener {
|
||||
if ($rankObj) {
|
||||
switch ($type) {
|
||||
case self::RANKING_TYPE_RATIOS:
|
||||
$kd = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index);
|
||||
$acc = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_LASER_ACC, $player->index);
|
||||
$message = '$0f3Your Server rank is $<$ff3' . $rankObj->rank . '$> / $<$fff' . $this->recordCount . '$> (K/D: $<$fff' . round($kd, 2) . '$> Acc: $<$fff' . round($acc * 100) . '%$>)';
|
||||
$killDeathRatio = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_KD_RATIO, $player->index);
|
||||
$accuracy = $this->maniaControl->statisticManager->getStatisticData(StatisticManager::SPECIAL_STAT_LASER_ACC, $player->index);
|
||||
$message = '$0f3Your Server rank is $<$ff3' . $rankObj->rank . '$> / $<$fff' . $this->recordCount . '$> (K/D: $<$fff' . round($killDeathRatio, 2) . '$> Acc: $<$fff' . round($accuracy * 100) . '%$>)';
|
||||
break;
|
||||
case self::RANKING_TYPE_POINTS:
|
||||
$message = '$0f3Your Server rank is $<$ff3' . $rankObj->rank . '$> / $<$fff' . $this->recordCount . '$> Points: $fff' . $rankObj->avg;
|
||||
|
Loading…
Reference in New Issue
Block a user