当前位置: 首页>>代码示例>>PHP>>正文


PHP EconomyAPI::getMonetaryUnit方法代码示例

本文整理汇总了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}!");
开发者ID:dog194,项目名称:EconomyS,代码行数:67,代码来源:EconomyCasino.php


注:本文中的onebone\economyapi\EconomyAPI::getMonetaryUnit方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。