public function show_Show() { if (!$this->user->hasPremium()) { $this->error('Nur für Premiumaccounts.'); } $o = '<h3>Aktuelle Lagerverwaltungs-Regeln</h3>'; $o .= '<table class="ordered"> <tr> <th>Aktion</th> <th>Ressource/Produkt</th> <th>Lager-Limit</th> <th>Preis pro VE</th> <th>Gültig bis</th> <th></th> </tr>'; $show = R::related($this->myCompany, 'crule'); foreach ($show as $s) { $o .= '<tr> <td>' . ($s->action == 'buy' ? 'Kaufen' : 'Verkaufen') . '</td> <td>{' . ($s->r_type == 'resource' ? 'r' : 'p') . '_' . $s->r_name . '}</td> <td>' . ($s->action == 'buy' ? '<' : '>') . ' ' . formatCash($s->r_limit) . '</td> <td>' . formatCash($s->r_price) . ' {money}</td> <td>' . date('d.m.Y - H:i:s', $s->until) . '</td> <td><a href="#cancel/' . $s->id . '">{cross title="Stornieren"}</a></td> </tr>'; } $o .= '</table>'; $this->output('maintext', $o); $this->output('options', array('add' => 'Neue Regel hinzufügen')); }
public function show_Main() { $usersPerPage = 20; $totalUsers = R::getCell('SELECT count(id) FROM user'); $pages = ceil($totalUsers / $usersPerPage); $currentPage = is_numeric($this->get(1)) && $this->get(1) > 0 && $this->get(1) <= $pages ? $this->get(1) : 1; $players = array(); $dbP = R::find('user', ' 1=1 ORDER BY xp DESC LIMIT ?,?', array(($currentPage - 1) * $usersPerPage, $usersPerPage)); $i = $usersPerPage * ($currentPage - 1) + 1; foreach ($dbP as $p) { $players[] = array("rank" => $i, "username" => $p->username, "level" => $p->level, "xp" => formatCash($p->xp), "premium" => $p->hasPremium()); $i++; } Framework::TPL()->assign('players', $players); Framework::TPL()->assign('currentPage', $currentPage); Framework::TPL()->assign('pages', $pages); }
$orders = array(); for ($i = 0; $i < count($ordersRows); $i++) { $orders[$ordersRows[$i]['id']] = $ordersRows[$i]; } $tariffTable = new table('tariff'); $tariffsRows = $tariffTable->load(); $tariffs = array(); for ($i = 0; $i < count($tariffsRows); $i++) { $tariffs[$tariffsRows[$i]['id']] = $tariffsRows[$i]; } $rows = $moneyflowTable->load("WHERE user="******" ORDER BY `id` DESC"); $loadedUsers = array(); foreach ($rows as $key => $row) { $paymentDate = new DateTime($row['date']); $rows[$key]['date'] = $paymentDate->format($timeDateFormat); $rows[$key]['sum'] = formatCash($row['sum']); if ($row['name']) { $rows[$key]['details'] = $row['name']; } else { switch ($row['detailsname']) { case 'scratchcard': $rows[$key]['details'] = __('Fund with scratchcard'); break; case 'refund': $rows[$key]['details'] = __('Refund operation'); break; case 'referrerpay': $referrerId = $row['detailsid']; if (!isset($loadedUsers[$referrerId])) { $loadedUsers[$referrerId] = new User("WHERE id=" . $referrerId); }
private function foundCompany() { if (!$this->company) { $myBalance = R::getCell('SELECT balance FROM bank_account WHERE user_id = ?', array($this->user->id)); if (isset($_POST['foundName']) && isset($_POST["foundCash"]) && is_numeric($_POST["foundCash"])) { $fName = $_POST['foundName']; $fCash = $_POST['foundCash']; if ($fCash < 0 || $fCash > $myBalance) { $this->output('maintext', 'Du hast ein ungültiges Startkapital angegeben.'); $this->output('options', array('interact' => 'Zurück')); return true; } $isUnique = R::getCell('SELECT COUNT(id) FROM company WHERE LOWER(name) = LOWER(?)', array($fName)); if ($isUnique != 0) { $this->output('maintext', 'Der angegebene Name wird bereits verwendet.'); $this->output('options', array('interact' => 'Zurück')); return true; } $company = R::dispense('company'); $company->name = $fName; $company->user = $this->user; $company->balance = $fCash; $company->lastCalc = time(); R::$adapter->startTransaction(); try { R::store($company); } catch (Exception $e) { R::$adapter->rollback(); $this->output('maintext', $e->getMessage()); $this->output('options', array('interact' => 'Zurück')); return true; } R::exec('UPDATE bank_account SET balance = balance - ? WHERE user_id = ?', array($fCash, $this->user->id)); R::$adapter->commit(); $this->output('maintext', 'Herzlichen Glückwunsch! Die Firma ' . htmlspecialchars($company->name) . ' wurde soeben gegründet.'); $this->output('options', array('interact' => 'Weiter')); return true; } $this->output('maintext', 'Willkommen im BusinessManager-System. Von hier kannst du deine Firma und ihre Fabrikation verwalten. <br /> <br /> Du besitzt derzeit noch keine Firma. Um eine Firma zu gründen brauchen wir einen Namen, und wie viel Startkapital von deinem Konto auf das Firmenkonto überwiesen werden soll.<br /> Dein derzeitiger Kontostand beträgt ' . formatCash($myBalance) . ' {money}. <br /> <br /> <i>Hinweis: Der Name kann nachträglich nicht mehr geändert werden!</i>'); $this->output('form', array('target' => 'interact', 'elements' => array(array('desc' => 'Name der Firma', 'type' => 'text', 'name' => 'foundName'), array('desc' => 'Startkapital', 'type' => 'text', 'name' => 'foundCash')))); return true; } return false; }
public function show_Play() { if ($this->get(1) == '1') { $this->user->cash -= 10; } elseif ($this->get(2) == '2') { $this->user->cash -= 30; } else { $this->user->cash -= 50; } if ($this->user->cash < 0) { $this->error('Du hast leider nicht genügend Geld!'); } R::store($this->user); $slotField = array(0, 0, 0, 0, 0, 0, 0, 0, 0); $mark = array(); $slotRows = array(); $keys = array_keys(self::$slot); $slotRows[0] = $keys; $slotRows[1] = $keys; $slotRows[2] = $keys; shuffle($slotRows[0]); shuffle($slotRows[1]); shuffle($slotRows[2]); foreach ($slotField as $k => $v) { $slotField[$k] = array_pop($slotRows[($k + 1) % 3]); } $win = array(); // check rows if ($this->get(1) >= 2 && ($slotField[0] == $slotField[1] && $slotField[1] == $slotField[2])) { array_push($mark, 0, 1, 2); array_push($win, array('type' => $slotField[0], 'text' => 'Reihe 1')); } if ($this->get(1) >= 1 && ($slotField[3] == $slotField[4] && $slotField[4] == $slotField[5])) { array_push($mark, 3, 4, 5); array_push($win, array('type' => $slotField[3], 'text' => 'Reihe 2')); } if ($this->get(1) >= 2 && ($slotField[6] == $slotField[7] && $slotField[7] == $slotField[8])) { array_push($mark, 6, 7, 8); array_push($win, array('type' => $slotField[6], 'text' => 'Reihe 3')); } // check diagonals if ($this->get(1) >= 3 && ($slotField[0] == $slotField[4] && $slotField[4] == $slotField[8])) { array_push($mark, 0, 4, 8); array_push($win, array('type' => $slotField[0], 'text' => 'Diagonal: Oben-Links nach Unten-Rechts')); } if ($this->get(1) >= 3 && ($slotField[6] == $slotField[4] && $slotField[4] == $slotField[2])) { array_push($mark, 6, 4, 2); array_push($win, array('type' => $slotField[6], 'text' => 'Diagonal: Unten-Links nach Oben-Rechts')); } // display $o = "<table class='ordered'><tr>"; $i = 0; foreach ($slotField as $k => $f) { if ($i % 3 == 0) { $o .= "</tr><tr>"; } $o .= "<td " . (in_array($k, $mark) ? "style='background:#FFFB3A;'" : "") . "><img src='" . APP_DIR . "static/images/icons/" . self::$slot[$f] . ".png' alt='{$f}' /></td>"; $i++; } $o .= "</tr></table>"; // outcome if (count($win) == 0) { $o .= "<h3>Du verlierst deinen Einsatz!</h3>"; } else { $o .= "<h3>Gewonnen!</h3><ul>"; $total = 0; foreach ($win as $w) { $winMoney = floor(pow(1.25, $w['type'] + 1) * 250); $total += $winMoney; $o .= "<li><b>" . $w['text'] . ":</b> <br />\n\t\t\t\t3x <img src='" . APP_DIR . "static/images/icons/" . self::$slot[$w['type']] . ".png' alt='" . $w['type'] . "' /> = " . formatCash($winMoney) . " {money}</li>"; } $o .= "</ul>"; $o .= "<h3>Du hast " . formatCash($total) . " {money} gewonnen!</h3>"; $this->user->cash += $total; R::store($this->user); } $this->output('maintext', $o); $this->output('options', array('interact' => 'Zurück')); }
public function show_Game() { if ($this->_myGame == null) { $this->error('Du spielst derzeit nicht!'); } switch ($this->get(1)) { case 'card': $this->_myCards[] = PlayingCards::getRandomCard(); $this->_myGame->user_cards = json_encode($this->_myCards); R::store($this->_myGame); $this->output('load', 'interact'); break; case 'finish': // check if dealer needs new card or not $dealerValue = 0; $dealerCards = array(); foreach ($this->_dealerCards as $c) { $dealerCards[] = PlayingCards::displayCard($c['card'], $c['color']); $dealerValue += ($dealerValue + $c['value'] > 21 and $c['card'] == 'a') ? 1 : $c['value']; } // now see if dealer has to draw more cards while ($dealerValue < 17) { $c = PlayingCards::getRandomCard(); $dealerValue += ($dealerValue + $c['value'] > 21 and $c['card'] == 'a') ? 1 : $c['value']; $this->_dealerCards[] = $c; $dealerCards[] = PlayingCards::displayCard($c['card'], $c['color']); } // calculate player value $playerValue = 0; $playerCards = array(); $playerSevenCount = 0; foreach ($this->_myCards as $c) { $playerCards[] = PlayingCards::displayCard($c['card'], $c['color']); if ($c['card'] == '7') { $playerSevenCount++; } // first count all the cards but no A-cards if ($c['card'] == 'a') { continue; } $playerValue += $c['value']; } foreach ($this->_myCards as $c) { // now count A-cards if ($c['card'] != 'a') { continue; } if ($playerValue + $c['value'] > 21) { $playerValue += 1; // if we would top 21 with 11, count as 1 } elseif ($playerValue + 1 < $dealerValue) { $playerValue += 11; // if counting as 1 would be smaller than // dealer count as 11 } else { $playerValue += 1; // count as 1 } } // now check who wins? $CardDisplay = '<h3>Deine Karten:</h3> ' . implode("", $playerCards) . ' <h3>Karten des Dealers:</h3> ' . implode("", $dealerCards); // player bust if ($playerValue > 21) { $this->output('maintext', '<b>BUST:</b> Deine Hand übersteigt 21 Punkte (' . $playerValue . ' P). <br /> Du verlierst deinen Einsatz ' . $CardDisplay); R::trash($this->_myGame); $this->output('options', array('interact' => 'Zurück')); return; } // triple seven if ($playerSevenCount == 3 && count($playerCards) == 3) { $winAmount = 1.5 * $this->_myGame->bid + $this->_myGame->bid; $this->output('maintext', '<b>TRIPLE SEVEN:</b> Du hast genau 3 Siebener auf der Hand! Du erhälst ' . formatCash($winAmount) . ' {money} ' . $CardDisplay); $this->user->cash += $winAmount; R::store($this->user); R::trash($this->_myGame); $this->output('options', array('interact' => 'Zurück')); return; } // dealer busts if ($dealerValue > 21) { $this->output('maintext', '<b>DEALER BUST:</b> Der Dealer hat mehr als 21 Punkte auf der Hand! <br /> Du bekommst ' . formatCash($this->_myGame->bid * 2) . ' {money} ' . $CardDisplay); $this->user->cash += $this->_myGame->bid * 2; R::store($this->user); R::trash($this->_myGame); $this->output('options', array('interact' => 'Zurück')); return; } // dealer has blackjack and player has blackjack too if ($dealerValue == 21 && count($dealerCards) == 2 && ($playerValue == 21 && count($playerCards) == 2) || $playerValue == $dealerValue) { $this->output('maintext', '<b>STAND OFF:</b> Der Dealer hat die gleichviele Punkte. Du bekommst deinen Einsatz zurück!' . $CardDisplay); $this->user->cash += $this->_myGame->bid; R::store($this->user); R::trash($this->_myGame); $this->output('options', array('interact' => 'Zurück')); return; } // player has blackjack if ($playerValue == 21 && count($playerCards) == 2) { $winAmount = 1.5 * $this->_myGame->bid + $this->_myGame->bid; $this->output('maintext', '<b>BLACK JACK:</b> Du hast einen Black Jack. Du erhälst ' . formatCash($winAmount) . ' {money}' . $CardDisplay); $this->user->cash += $winAmount; R::store($this->user); R::trash($this->_myGame); $this->output('options', array('interact' => 'Zurück')); return; } // compare points if ($playerValue > $dealerValue) { $this->output('maintext', '<b>EVEN MONEY:</b> Du gewinnst mit ' . $playerValue . ' Punkten gegen den Dealer (' . $dealerValue . ' Punkte)! <br /> Du erhälst ' . formatCash($this->_myGame->bid * 2) . ' {money}' . $CardDisplay); $this->user->cash += $this->_myGame->bid * 2; R::store($this->user); R::trash($this->_myGame); $this->output('options', array('interact' => 'Zurück')); return; } // dealer wins $this->output('maintext', 'Du verlierst gegen den Dealer. Du hast ' . $playerValue . ' Punkte, der Dealer ' . $dealerValue . ' Punkte. Du verlierst deinen Einsatz. ' . $CardDisplay); R::trash($this->_myGame); $this->output('options', array('interact' => 'Zurück')); break; default: $this->error('Invalid ACTION!'); break; } }
public function show_Questing() { if ($this->myNPCQuestRole == 'none') { $this->error('Dieses NPC hat keine Quest für dich!'); } if ($this->myNPCQuestRole == 'startnpc' && $this->myNPCQuest->accepted == 0) { $this->output('maintext', $this->myNPCQuestData["text2"] . ' Denk daran: Je schneller du dieses Quest erledigst, desto mehr Erfahrungspunkte bekommst du als Belohnung!'); R::begin(); foreach ($this->myNPCQuestData["items"] as $k => $v) { $inv = R::dispense('inventory'); $inv->amount = $v["amount"]; $inv->param = $v["param"]; $inv->item_id = $v["id"]; $inv->user = $this->user; R::store($inv); } $this->myNPCQuest->accepted = 1; $this->myNPCQuest->accept_time = time(); R::store($this->myNPCQuest); R::commit(); } elseif ($this->myNPCQuestRole == 'stopnpc' && $this->myNPCQuest->accepted == 1) { // check if user has needed items in inventory $items = array(); foreach ($this->myNPCQuestData["items"] as $k => $v) { $inv = R::findOne('inventory', ' item_id = ? AND amount >= ? AND param = ? AND user_id = ?', array($v["id"], $v["amount"], $v["param"], $this->user->getID())); if ($inv == null) { $this->output('maintext', 'Leider hast du nicht alle nötigen Items dabei!'); $this->output('options', array('interact' => 'Zurück')); return; } $items[$v["id"]]["data"] = $inv; $items[$v["id"]]["amount"] = $v["amount"]; } // calculate bonus $this->myNPCQuest->complete_time = time(); $took = $this->myNPCQuest->complete_time - $this->myNPCQuest->accept_time; $xp = $this->myNPCQuestData["base_xp"]; $cash = $this->myNPCQuestData["base_cash"]; // randomize xp/cash $xp += 2 - mt_rand(0, 4); $cash += 2 - mt_rand(0, 4); if ($took > $this->myNPCQuestData["base_time"]) { $diff = $took - $this->myNPCQuestData["base_time"]; // subtract of the bonus $xp -= floor($diff / 10); // every ten seconds late subtract 1xp if ($xp < 1) { $xp = 1; } $cash -= floor($diff / 5); // every five seconds late substract 1 cash if ($cash < 0) { $cash = 0; } } R::begin(); $this->user->cash += $cash; $this->user->changeXP($this->user->xp + $xp); // take items from inventory foreach ($items as $i) { $i["data"]->amount -= $i["amount"]; R::store($i["data"]); } R::store($this->myNPCQuest); R::commit(); $quest = R::dispense('quests_npc'); $quest->giveNewQuest($this->user); $this->output('maintext', $this->myNPCQuestData["text2"] . ' <br /> <b>Du erhälst als Belohnung: ' . formatCash($cash) . ' {money} und ' . formatCash($xp) . ' {eye}</b>'); } else { $this->output('maintext', 'Ich habe leider im Moment nichts zu tun für dich!'); } $this->output('options', array('interact' => 'Zurück')); }
public function show_Action() { /* $order = R::dispense('order'); $order->type = 'buy'; $order->r_type = 'product'; $order->r_name = 'smartphone'; $order->r_amount = 100; $order->price = 577; $order->date = time(); $order->automatic = true; // $order->a_limit = 5; useless! $order->a_expires = 0; R::store($order); R::associate($this->myCompany, $order);*/ if (!in_array($this->get(1), array("sell", "buy"))) { $this->output('maintext', 'Ungültig.'); return; } $action = $this->get(1); $rp = array_merge(Config::getConfig('resources'), Config::getConfig('products')); if ($this->get(2) != '') { $this->actionDetails($action, $this->get(2), $rp); $this->output('options', array('action/' . $action . '/' . ($this->get(3) == '' ? '' : $this->get(2)) => 'Zurück')); return; } $icons = array('', '', '', ''); $market_price = array('', '', '', ''); $availible = array('', '', '', ''); $details = array('', '', '', ''); $iTable = 0; $intCount = 0; foreach ($rp as $name => $r) { if (!isset($r['needs'])) { continue; } $type = is_array($r['needs'][0]) ? 'p' : 'r'; $icons[$iTable] .= '<th>{' . $type . '_' . $name . '}</th>'; $mp = R::getCell('SELECT `value` FROM market_price WHERE `type` = ? AND `name` = ?', array($action, $name)); $market_price[$iTable] .= '<td>' . formatCash($mp) . ' {money}</td>'; $availible[$iTable] .= '<td>' . formatCash($type == 'p' ? $this->myProducts->{$name} : $this->myRess->{$name}) . '</td>'; $details[$iTable] .= '<td><a href="#action/' . $action . '/' . $name . '">{magnifier title="Detailansicht"}</a></td>'; $intCount++; if ($intCount % 4 == 0) { $iTable++; } } $tables = array(); foreach ($icons as $k => $v) { $tables[$k] = '<table class="ordered"> <tr> <th></th> ' . $icons[$k] . ' </tr> <tr> <th>Aktueller Kurs pro VE*</th> ' . $market_price[$k] . ' </tr> <tr> <th>Derzeit vorhanden**</th> ' . $availible[$k] . ' </tr> <tr> <td></td> ' . $details[$k] . ' </tr> </table>'; } $this->output('maintext', '<h3>Rohstoffe und Produkte ' . ($action == "buy" ? "kaufen" : "verkaufen") . '</h3> ' . implode('<br />', $tables) . ' <p>* VE = Verkaufseinheit <br /> ** Anzahl der Rohstoffe, die derzeit in deiner Firma lagern</p> '); $this->output('options', array('interact' => 'Zurück')); }
$tariffCopy[$row] = formatSpeed($tariffCopy[$row]); } $tariffCopy['price'] = formatCash($tariffCopy['price']); $tariffsByCities[$tariffCity][] = $tariffCopy; } } } } else { foreach ($tariffs as $tariff) { if ($tariff['public'] == '1') { $tariffCities = $tariff['city']; $tariffCopy = $tariff; foreach ($speedRows as $row) { $tariffCopy[$row] = formatSpeed($tariffCopy[$row]); } $tariffCopy['price'] = formatCash($tariffCopy['price']); $tariffsByCities[0][] = $tariffCopy; } } } function sortByPrice($a, $b) { global $tariffsById; return $tariffsById[$b['id']]['price'] < $tariffsById[$a['id']]['price']; //return $b['price'] < $a['price']; } foreach ($tariffsByCities as $city => $tariffsByCity) { uasort($tariffsByCities[$city], substr("sortByPrice(", 0, -1)); } $tpl = array("nameText" => __('Name'), "downloadSpeedText" => __('Download speed'), "uploadSpeedText" => __('Upload speed'), "nightDownloadSpeedText" => __('Night download speed'), "nightUploadSpeedText" => __('Night upload speed'), "priceText" => __("Price"), "citiesById" => $citiesById, "tariffsByCities" => $tariffsByCities); $fenom->display($theme->getTemplateLocation('header.tpl'), $headerData);
public function show_Show_quests() { $quests = Config::getConfig('company_quests'); if ($this->get(1) == 'check') { $name = $this->get(2); if (!isset($quests[$name]) || $quests[$name]["level"] > $this->user->level) { $this->output('maintext', 'Du hast eine ungültige Aufgabe gewählt'); $this->output('options', array('show_quests' => 'Zurück')); return; } $quest = $quests[$name]; if ($this->get(3) == 'accept' && $this->get(4) == $_SESSION['secHash']) { unset($_SESSION['secHash']); // security $company_quest = R::dispense('company_quest'); $company_quest->name = $name; $company_quest->valid_until = time() + $quest["time"] * 24 * 3600; $company_quest->completed = false; R::store($company_quest); R::associate($this->user, $company_quest); $this->output('maintext', 'Du hast diese Aufgabe akzeptiert! Viel erfolg dabei!'); $this->output('options', array('show_quests' => 'Zurück')); return; } $th = ""; $td = ""; foreach ($quest["needs"] as $n) { $th .= "<th>{" . ($n["type"] == "resource" ? 'r' : 'p') . "_" . $n["name"] . "}</th>"; $td .= "<td>" . formatCash($n["amount"]) . "</td>"; } $this->output('maintext', '<h3>' . htmlspecialchars($quest["title"]) . '</h3> <p>' . htmlspecialchars($quest["text"]) . '</p> <p>Du musst folgende Resourcen und Produkte abliefern:</p> <table class="ordered"> <tr> <th></th>' . $th . ' </tr> <tr> <td>Menge</td>' . $td . ' </tr> </table> <i>Du hast <b>' . $quest["time"] . ' Tage</b> Zeit um diesen Auftrag zu erledigen. Solltest du den Auftrag nicht in dieser Zeit erledigen wird der Auftrag abgebrochen. Außerdem musst du ' . formatCash(floor($quest["oncomplete"]["cash"] * 0.1)) . ' {money} Strafe zahlen, was automatisch von deinem Firmenkonto abgebucht wird. Du kannst den Auftrag danach erneut annehmen.</i> <p>Wenn du den Auftrag erledigst, bekommst du:</p> <table class="ordered"> <tr> <th>Erfahrungspunkte:</th> <td>' . formatCash($quest["oncomplete"]["xp"]) . ' {eye}</td> </tr> <tr> <th>Geld*:</th> <td>' . formatCash($quest["oncomplete"]["cash"]) . ' {money}</td> </tr> </table> <br /> <i>* das verdiente Geld wird auf das Firmenkonto überwiesen</i>'); $_SESSION['secHash'] = md5(time() . mt_rand(1000, 10000)); $this->output('options', array('show_quests/check/' . $name . '/accept/' . $_SESSION['secHash'] => 'Aufgabe annehmen', 'show_quests' => 'Zurück zur Übersicht')); return; } $this->output('maintext', 'Je nach deinem Level kannst du unterschiedliche Aufträge übernehmen. Sollten ich derzeit keine Aufträge mehr für dein Level haben, so sammel etwas Erfahrung und komm dann nochmal wieder! <br /> Folgende Aufträge kannst du zur Zeit für mich übernehmen:'); $oDesc = array(); $oOpt = array(); $todo = false; foreach ($quests as $name => $quest) { if ($quest["level"] > $this->user->level) { continue; } if (count($this->myQuests) > 0) { $isDone = false; foreach ($this->myQuests as $q) { if ($q->name == $name) { $isDone = true; break; } } if ($isDone) { continue; } } $todo = true; $oDesc["show_quests/check/" . $name] = "<hr /><h3>" . htmlspecialchars($quest["title"]) . "</h3>\n\t\t\t<p>" . htmlspecialchars($quest["text"]) . "</p>"; $oOpt["show_quests/check/" . $name] = "mehr Informationen"; } if (!$todo) { $oDesc["interact"] = "<i>Ich habe derzeit leider keine Aufträge für dich!</i>"; } else { $oDesc["interact"] = "<hr />"; } $oOpt["interact"] = "Zurück"; $this->output('options_desc', $oDesc); $this->output('options', $oOpt); }
private function chatShowDown(array $data) { /*10 => new PokerParser("[a>a>a>a>a"), 9 => new PokerParser("a>a>a>a>a"), 8 => new PokerParser("1{4}"), 7 => new PokerParser("1{3}2{2}"), 6 => new PokerParser("a{5}"), 5 => new PokerParser("?>?>?>?>?"), 4 => new PokerParser("1{3}"), 3 => new PokerParser("1{2}2{2}"), 2 => new PokerParser("1{2}"), 1 => new PokerParser("?")*/ $def = array(10 => "Royal Flush", 9 => "Straight Flush", 8 => "Four of a Kind", 7 => "Full House", 6 => "Flush", 5 => "Straight", 4 => "Three of a kind", 3 => "Two pair", 2 => "Pair", 1 => "High Card"); foreach ($data['winners'] as $winner) { $chat = R::dispense('poker_message'); $chat->time = time(); $t = floor($data['bestValue'] / 100); $type = $def[$t]; $trans = array_flip(PokerParser::$playingCardsOrder); $hc = $trans[$data['bestValue'] - $t * 100]; $chat->message = htmlspecialchars($winner) . ' gewinnt mit einem ' . $type . ' (Höchste Karte: ' . $hc . ') ' . formatCash($data['amount']) . ' {money}'; R::store($chat); } }