added message to billdata

This commit is contained in:
kremsy 2015-06-03 22:49:08 +02:00
parent 65802d38f5
commit ea33ebc47b
2 changed files with 11 additions and 8 deletions

View File

@ -15,12 +15,13 @@ class BillData {
/*
* Public properties
*/
public $function = null;
public $pay = false;
public $player = null;
public $function = null;
public $pay = false;
public $player = null;
public $receiverLogin = null;
public $amount = 0;
public $creationTime = -1;
public $amount = 0;
public $creationTime = -1;
public $message = "";
/**
* Construct new Bill Data Model
@ -30,13 +31,15 @@ class BillData {
* @param int $amount
* @param bool $pay
* @param string $receiverLogin
* @param string $message
*/
public function __construct(callable $function, $player, $amount, $pay = false, $receiverLogin = null) {
public function __construct(callable $function, $player, $amount, $pay = false, $receiverLogin = null, $message = '') {
$this->function = $function;
$this->player = $player;
$this->amount = $amount;
$this->pay = $pay;
$this->receiverLogin = $receiverLogin;
$this->message = $message;
$this->creationTime = time();
}
}

View File

@ -58,7 +58,7 @@ class BillManager implements CallbackListener {
*/
public function sendBill(callable $function, Player $player, $amount, $message, $receiver = '') {
$billId = $this->maniaControl->getClient()->sendBill($player->login, $amount, $message, $receiver);
$this->openBills[$billId] = new BillData($function, $player, $amount, false, $receiver);
$this->openBills[$billId] = new BillData($function, $player, $amount, false, $receiver, $message);
return true;
}
@ -73,7 +73,7 @@ class BillManager implements CallbackListener {
*/
public function sendPlanets(callable $function, $receiverLogin, $amount, $message) {
$billId = $this->maniaControl->getClient()->pay($receiverLogin, $amount, $message);
$this->openBills[$billId] = new BillData($function, $receiverLogin, $amount, true, $receiverLogin);
$this->openBills[$billId] = new BillData($function, $receiverLogin, $amount, true, $receiverLogin, $message);
return true;
}