本文整理匯總了PHP中onebone\economyapi\EconomyAPI::getMonetaryUnit方法的典型用法代碼示例。如果您正苦於以下問題:PHP EconomyAPI::getMonetaryUnit方法的具體用法?PHP EconomyAPI::getMonetaryUnit怎麽用?PHP EconomyAPI::getMonetaryUnit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類onebone\economyapi\EconomyAPI
的用法示例。
在下文中一共展示了EconomyAPI::getMonetaryUnit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: onCommand
//.........這裏部分代碼省略.........
$output = "[EconomyCasino] Game list : \n";
foreach ($this->casino as $player => $casino) {
$output .= "{$player} : " . count($this->casino[$player]["players"]) . " \n";
}
$output = substr($output, 0, -2);
$sender->sendMessage($output);
} else {
if (isset($this->casino[$player])) {
$output = "[EconomyCasino] Player list of casino game by : {$player} \n";
foreach ($this->casino[$player]["players"] as $p) {
$output .= "{$p}, ";
}
$output = substr($output, 0, -2);
} else {
goto list_general;
}
}
break;
case "gamble":
if (!$sender instanceof Player) {
$sender->sendMessage("Please run this command in-game.");
break;
}
if (!$sender->hasPermission("economycasino.command.casino.gamble")) {
return true;
}
$money = array_shift($params);
if (!is_numeric($money)) {
$sender->sendMessage("Usage: /casino gamble <money>");
break;
}
$money = (int) $money;
if ($this->api->myMoney($sender) < $money) {
$sender->sendMessage("You don't have money to gamble " . $this->api->getMonetaryUnit() . "{$money}");
break;
}
if (isset($this->casino[$sender->getName()])) {
$all = 0;
foreach ($this->casino[$sender->getName()]["players"] as $player => $v) {
$tmp = min($money, $this->api->myMoney($player));
$this->api->reduceMoney($player, $tmp);
$all += $tmp;
}
$got = array_rand($this->casino[$sender->getName()]["players"]);
$this->api->addMoney($got, $all, true, "EconomyCasino");
foreach ($this->casino[$sender->getName()]["players"] as $p => $v) {
if ($got === $p) {
$this->getServer()->getPlayerExact($p)->sendMessage("You've win " . $this->api->getMonetaryUnit() . "{$all}!");
} else {
$this->getServer()->getPlayerExact($p)->sendMessage("You've lost " . $this->api->getMonetaryUnit() . "{$money}");
}
}
} else {
foreach ($this->casino as $player => $casino) {
if (isset($casino["players"][$sender->getName()])) {
$all = 0;
foreach ($this->casino[$player]["players"] as $p => $true) {
$tmp = min($this->api->myMoney($p), $money);
$this->api->reduceMoney($p, $tmp);
$all += $tmp;
}
$got = array_rand($this->casino[$player]["players"]);
$this->api->addMoney($got, $all, true, "EconomyCasino");
foreach ($this->casino[$player]["players"] as $p => $v) {
if ($got === $p) {
$this->getServer()->getPlayerExact($p)->sendMessage("You've win " . $this->api->getMonetaryUnit() . "{$all}!");