本文整理汇总了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}!");