display mx karma in maplist
This commit is contained in:
parent
8419498959
commit
97f4d44202
@ -436,8 +436,18 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
|
|||||||
*/
|
*/
|
||||||
private function showMapListKarma($best, Player $player) {
|
private function showMapListKarma($best, Player $player) {
|
||||||
/** @var \MCTeam\KarmaPlugin $karmaPlugin */
|
/** @var \MCTeam\KarmaPlugin $karmaPlugin */
|
||||||
$karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(MapList::DEFAULT_KARMA_PLUGIN);
|
$karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(MapList::DEFAULT_KARMA_PLUGIN);
|
||||||
|
$displayMxKarma = $this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_WIDGET_DISPLAY_MX);
|
||||||
|
|
||||||
if ($karmaPlugin) {
|
if ($karmaPlugin) {
|
||||||
|
//Sort by Mx Karma in Maplist
|
||||||
|
if ($displayMxKarma) { //TODO
|
||||||
|
|
||||||
|
//Sort by Local Karma in Maplist
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$maps = $this->maniaControl->getMapManager()->getMaps();
|
$maps = $this->maniaControl->getMapManager()->getMaps();
|
||||||
$mapList = array();
|
$mapList = array();
|
||||||
foreach ($maps as $map) {
|
foreach ($maps as $map) {
|
||||||
|
@ -122,7 +122,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
|
$height = $this->maniaControl->getManialinkManager()->getStyleManager()->getListWidgetsHeight();
|
||||||
|
|
||||||
if ($pageIndex < 0) {
|
if ($pageIndex < 0) {
|
||||||
$pageIndex = (int)$player->getCache($this, self::CACHE_CURRENT_PAGE);
|
$pageIndex = (int) $player->getCache($this, self::CACHE_CURRENT_PAGE);
|
||||||
}
|
}
|
||||||
$player->setCache($this, self::CACHE_CURRENT_PAGE, $pageIndex);
|
$player->setCache($this, self::CACHE_CURRENT_PAGE, $pageIndex);
|
||||||
$queueBuffer = $this->maniaControl->getMapManager()->getMapQueue()->getQueueBuffer();
|
$queueBuffer = $this->maniaControl->getMapManager()->getMapQueue()->getQueueBuffer();
|
||||||
@ -441,8 +441,19 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
|
|
||||||
// Display Karma bar
|
// Display Karma bar
|
||||||
if ($karmaPlugin) {
|
if ($karmaPlugin) {
|
||||||
$karma = $karmaPlugin->getMapKarma($map);
|
$displayMxKarma = $this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_WIDGET_DISPLAY_MX);
|
||||||
$votes = $karmaPlugin->getMapVotes($map);
|
|
||||||
|
//Display Mx Karma
|
||||||
|
if ($displayMxKarma && $map->mx) {
|
||||||
|
$karma = $map->mx->ratingVoteAverage / 100;
|
||||||
|
$votes = array("count" => $map->mx->ratingVoteCount);
|
||||||
|
|
||||||
|
//Display Local Karma
|
||||||
|
} else {
|
||||||
|
$karma = $karmaPlugin->getMapKarma($map);
|
||||||
|
$votes = $karmaPlugin->getMapVotes($map);
|
||||||
|
}
|
||||||
|
|
||||||
if (is_numeric($karma)) {
|
if (is_numeric($karma)) {
|
||||||
if ($this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA)
|
if ($this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA)
|
||||||
) {
|
) {
|
||||||
@ -692,7 +703,7 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
|
|||||||
default:
|
default:
|
||||||
if (substr($actionId, 0, strlen(self::ACTION_PAGING_CHUNKS)) === self::ACTION_PAGING_CHUNKS) {
|
if (substr($actionId, 0, strlen(self::ACTION_PAGING_CHUNKS)) === self::ACTION_PAGING_CHUNKS) {
|
||||||
// Paging chunks
|
// Paging chunks
|
||||||
$neededPage = (int)substr($actionId, strlen(self::ACTION_PAGING_CHUNKS));
|
$neededPage = (int) substr($actionId, strlen(self::ACTION_PAGING_CHUNKS));
|
||||||
$this->showMapList($player, null, $neededPage - 1);
|
$this->showMapList($player, null, $neededPage - 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user