added login to topdons list

This commit is contained in:
kremsy 2015-01-17 18:01:46 +01:00
parent 0d8ff77867
commit f46cd9c939

View File

@ -290,34 +290,34 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
//Send and Handle the Bill //Send and Handle the Bill
$this->maniaControl->getBillManager()->sendBill(function ($data, $status) use (&$player, $amount, $receiver) { $this->maniaControl->getBillManager()->sendBill(function ($data, $status) use (&$player, $amount, $receiver) {
switch ($status) { switch ($status) {
case BillManager::DONATED_TO_SERVER: case BillManager::DONATED_TO_SERVER:
if ($this->maniaControl->getSettingManager()->getSettingValue($this, DonationPlugin::SETTING_ANNOUNCE_SERVER_DONATION, true) if ($this->maniaControl->getSettingManager()->getSettingValue($this, DonationPlugin::SETTING_ANNOUNCE_SERVER_DONATION, true)
&& $amount >= $this->maniaControl->getSettingManager()->getSettingValue($this, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true) && $amount >= $this->maniaControl->getSettingManager()->getSettingValue($this, DonationPlugin::SETTING_MIN_AMOUNT_SHOWN, true)
) { ) {
$login = null; $login = null;
$message = $player->getEscapedNickname() . ' donated ' . $amount . ' Planets! Thanks.'; $message = $player->getEscapedNickname() . ' donated ' . $amount . ' Planets! Thanks.';
} else { } else {
$login = $player->login; $login = $player->login;
$message = 'Donation successful! Thanks.'; $message = 'Donation successful! Thanks.';
} }
$this->maniaControl->getChat()->sendSuccess($message, $login); $this->maniaControl->getChat()->sendSuccess($message, $login);
$this->maniaControl->getStatisticManager()->insertStat(DonationPlugin::STAT_PLAYER_DONATIONS, $player, $this->maniaControl->getServer()->index, $amount); $this->maniaControl->getStatisticManager()->insertStat(DonationPlugin::STAT_PLAYER_DONATIONS, $player, $this->maniaControl->getServer()->index, $amount);
break; break;
case BillManager::DONATED_TO_RECEIVER: case BillManager::DONATED_TO_RECEIVER:
$message = "Successfully donated {$amount} to '{$receiver}'!"; $message = "Successfully donated {$amount} to '{$receiver}'!";
$this->maniaControl->getChat()->sendSuccess($message, $player); $this->maniaControl->getChat()->sendSuccess($message, $player);
break; break;
case BillManager::PLAYER_REFUSED_DONATION: case BillManager::PLAYER_REFUSED_DONATION:
$message = 'Transaction cancelled.'; $message = 'Transaction cancelled.';
$this->maniaControl->getChat()->sendError($message, $player); $this->maniaControl->getChat()->sendError($message, $player);
break; break;
case BillManager::ERROR_WHILE_TRANSACTION: case BillManager::ERROR_WHILE_TRANSACTION:
$message = $data; $message = $data;
$this->maniaControl->getChat()->sendError($message, $player); $this->maniaControl->getChat()->sendError($message, $player);
break; break;
} }
}, $player, $amount, $message); }, $player, $amount, $message);
} }
/** /**
@ -346,7 +346,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$this->sendDonateUsageExample($player); $this->sendDonateUsageExample($player);
return; return;
} }
$amount = (int)$params[1]; $amount = (int) $params[1];
if (!$amount || $amount <= 0) { if (!$amount || $amount <= 0) {
$this->sendDonateUsageExample($player); $this->sendDonateUsageExample($player);
return; return;
@ -391,7 +391,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$this->sendPayUsageExample($player); $this->sendPayUsageExample($player);
return; return;
} }
$amount = (int)$params[1]; $amount = (int) $params[1];
if (!$amount || $amount <= 0) { if (!$amount || $amount <= 0) {
$this->sendPayUsageExample($player); $this->sendPayUsageExample($player);
return; return;
@ -404,21 +404,21 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$message = 'Payout from $<' . $this->maniaControl->getClient()->getServerName() . '$>.'; $message = 'Payout from $<' . $this->maniaControl->getClient()->getServerName() . '$>.';
$this->maniaControl->getBillManager()->sendPlanets(function ($data, $status) use (&$player, $amount, $receiver) { $this->maniaControl->getBillManager()->sendPlanets(function ($data, $status) use (&$player, $amount, $receiver) {
switch ($status) { switch ($status) {
case BillManager::PAYED_FROM_SERVER: case BillManager::PAYED_FROM_SERVER:
$message = "Successfully payed out {$amount} to '{$receiver}'!"; $message = "Successfully payed out {$amount} to '{$receiver}'!";
$this->maniaControl->getChat()->sendSuccess($message, $player); $this->maniaControl->getChat()->sendSuccess($message, $player);
break; break;
case BillManager::PLAYER_REFUSED_DONATION: case BillManager::PLAYER_REFUSED_DONATION:
$message = 'Transaction cancelled.'; $message = 'Transaction cancelled.';
$this->maniaControl->getChat()->sendError($message, $player); $this->maniaControl->getChat()->sendError($message, $player);
break; break;
case BillManager::ERROR_WHILE_TRANSACTION: case BillManager::ERROR_WHILE_TRANSACTION:
$message = $data; $message = $data;
$this->maniaControl->getChat()->sendError($message, $player); $this->maniaControl->getChat()->sendError($message, $player);
break; break;
} }
}, $receiver, $amount, $message); }, $receiver, $amount, $message);
} }
/** /**
@ -491,7 +491,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
$headFrame = new Frame(); $headFrame = new Frame();
$frame->add($headFrame); $frame->add($headFrame);
$headFrame->setY($posY - 5); $headFrame->setY($posY - 5);
$array = array('$oId' => $posX + 5, '$oNickname' => $posX + 18, '$oDonated planets' => $posX + 70); $array = array('$oId' => $posX + 5, '$oNickname' => $posX + 18, '$oLogin' => $posX + 70, '$oDonated planets' => $posX + 110);
$this->maniaControl->getManialinkManager()->labelLine($headFrame, $array); $this->maniaControl->getManialinkManager()->labelLine($headFrame, $array);
$index = 1; $index = 1;
@ -519,7 +519,7 @@ class DonationPlugin implements CallbackListener, CommandListener, Plugin {
} }
$donatingPlayer = $this->maniaControl->getPlayerManager()->getPlayerByIndex($playerIndex); $donatingPlayer = $this->maniaControl->getPlayerManager()->getPlayerByIndex($playerIndex);
$array = array($index => $posX + 5, $donatingPlayer->nickname => $posX + 18, $donations => $posX + 70); $array = array($index => $posX + 5, $donatingPlayer->nickname => $posX + 18, $donatingPlayer->login => $posX + 70, $donations => $posX + 110);
$this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array); $this->maniaControl->getManialinkManager()->labelLine($playerFrame, $array);
$posY -= 4; $posY -= 4;