display mx karma in maplist

This commit is contained in:
kremsy 2015-01-21 17:47:29 +01:00
parent 8419498959
commit 97f4d44202
2 changed files with 26 additions and 5 deletions

View File

@ -437,7 +437,17 @@ class MapCommands implements CommandListener, ManialinkPageAnswerListener, Callb
private function showMapListKarma($best, Player $player) {
/** @var \MCTeam\KarmaPlugin $karmaPlugin */
$karmaPlugin = $this->maniaControl->getPluginManager()->getPlugin(MapList::DEFAULT_KARMA_PLUGIN);
$displayMxKarma = $this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_WIDGET_DISPLAY_MX);
if ($karmaPlugin) {
//Sort by Mx Karma in Maplist
if ($displayMxKarma) { //TODO
//Sort by Local Karma in Maplist
} else {
}
$maps = $this->maniaControl->getMapManager()->getMaps();
$mapList = array();
foreach ($maps as $map) {

View File

@ -441,8 +441,19 @@ class MapList implements ManialinkPageAnswerListener, CallbackListener {
// Display Karma bar
if ($karmaPlugin) {
$displayMxKarma = $this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_WIDGET_DISPLAY_MX);
//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 ($this->maniaControl->getSettingManager()->getSettingValue($karmaPlugin, $karmaPlugin::SETTING_NEWKARMA)
) {