local records - only notify driver setting
This commit is contained in:
parent
32624e0946
commit
dae67d9dec
@ -32,11 +32,15 @@ class LocalRecordsPlugin implements CallbackListener, Plugin {
|
|||||||
const SETTING_WIDGET_WIDTH = 'Widget Width';
|
const SETTING_WIDGET_WIDTH = 'Widget Width';
|
||||||
const SETTING_WIDGET_LINESCOUNT = 'Widget Displayed Lines Count';
|
const SETTING_WIDGET_LINESCOUNT = 'Widget Displayed Lines Count';
|
||||||
const SETTING_WIDGET_LINEHEIGHT = 'Widget Line Height';
|
const SETTING_WIDGET_LINEHEIGHT = 'Widget Line Height';
|
||||||
|
const SETTING_NOTIFY_ONLY_DRIVER = 'Notify only the Driver on New Records';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private properties
|
* Private properties
|
||||||
*/
|
*/
|
||||||
/** @var maniaControl $maniaControl */
|
/**
|
||||||
|
*
|
||||||
|
* @var maniaControl $maniaControl
|
||||||
|
*/
|
||||||
private $maniaControl = null;
|
private $maniaControl = null;
|
||||||
private $updateManialink = false;
|
private $updateManialink = false;
|
||||||
|
|
||||||
@ -55,6 +59,7 @@ class LocalRecordsPlugin implements CallbackListener, Plugin {
|
|||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_WIDTH, 40.);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_WIDTH, 40.);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINESCOUNT, 25);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINESCOUNT, 25);
|
||||||
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINEHEIGHT, 4.);
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_WIDGET_LINEHEIGHT, 4.);
|
||||||
|
$this->maniaControl->settingManager->initSetting($this, self::SETTING_NOTIFY_ONLY_DRIVER, false);
|
||||||
|
|
||||||
// Register for callbacks
|
// Register for callbacks
|
||||||
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
$this->maniaControl->callbackManager->registerCallbackListener(CallbackManager::CB_MC_ONINIT, $this, 'handleOnInit');
|
||||||
@ -234,19 +239,32 @@ class LocalRecordsPlugin implements CallbackListener, Plugin {
|
|||||||
$this->updateManialink = true;
|
$this->updateManialink = true;
|
||||||
|
|
||||||
// Announce record
|
// Announce record
|
||||||
// TODO: setting to send notification only to the player
|
|
||||||
// TODO: setting to send notifications only for x best records
|
|
||||||
$newRecord = $this->getLocalRecord($map, $player);
|
$newRecord = $this->getLocalRecord($map, $player);
|
||||||
|
$notifyOnlyDriver = $this->maniaControl->settingManager->getSetting($this, self::SETTING_NOTIFY_ONLY_DRIVER);
|
||||||
|
if ($notifyOnlyDriver) {
|
||||||
if (!$oldRecord || $newRecord->rank < $oldRecord->rank) {
|
if (!$oldRecord || $newRecord->rank < $oldRecord->rank) {
|
||||||
$improvement = 'gained the';
|
$improvement = 'gained the';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$improvement = 'improved her/his';
|
$improvement = 'improved Your';
|
||||||
|
}
|
||||||
|
$message = 'You ' . $improvement . ' $<$o' . $newRecord->rank . '.$> Local Record: ' .
|
||||||
|
Formatter::formatTime($newRecord->time);
|
||||||
|
$this->maniaControl->chat->sendInformation($message, $player->login);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!$oldRecord || $newRecord->rank < $oldRecord->rank) {
|
||||||
|
$improvement = 'gained the';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$improvement = 'improved the';
|
||||||
}
|
}
|
||||||
$message = '$<' . $player->nickname . '$> ' . $improvement . ' $<$o' . $newRecord->rank . '.$> Local Record: ' .
|
$message = '$<' . $player->nickname . '$> ' . $improvement . ' $<$o' . $newRecord->rank . '.$> Local Record: ' .
|
||||||
Formatter::formatTime($newRecord->time);
|
Formatter::formatTime($newRecord->time);
|
||||||
$this->maniaControl->chat->sendInformation($message);
|
$this->maniaControl->chat->sendInformation($message);
|
||||||
}
|
}
|
||||||
|
// TODO: setting to send notifications only for x best records
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send manialink to clients
|
* Send manialink to clients
|
||||||
|
Loading…
Reference in New Issue
Block a user