Example #1
0
 public function genRoll($serialAgainst = '')
 {
     $rollId = $this->_appInstance->generateRoll($serialAgainst);
     $result = new RESTResult();
     $result->Data['RollID'] = $rollId;
     $result->Data['RollURL'] = 'http://' . RRApplication::getHost() . RRApplication::getWebApplicationDirectory() . 'roll/' . $rollId;
     echo json_encode($result, JSON_PRETTY_PRINT);
 }
Example #2
0
 public function getJsonArray()
 {
     $dieArray = array();
     $dieArray['dieAbbr'] = $this->getDieAbbrev();
     $dieArray['dieType'] = $this->getDieName();
     $dieArray['dieLogo'] = 'http://' . RRApplication::getDiceImgPath() . $this->getDieLogo();
     $dieArray['dieSide'] = $this->getCurrentSide();
     $dieArray['dieSImg'] = 'http://' . RRApplication::getDiceImgPath() . $this->getCurrentSideDieLogo();
     return $dieArray;
 }
Example #3
0
 public function showRollURL($rollId)
 {
     $this->renderArray['RollURL'] = 'http://' . RRApplication::getHost() . RRApplication::getWebApplicationDirectory() . 'roll/' . $rollId;
     $this->renderTemplate = $this->twigObj->loadTemplate('URLGet.html');
 }
Example #4
0
<?php

require_once 'config.php';
require RRConfig::ComposerAutoload;
require 'lib/EoEDice.php';
require 'lib/RollTable.php';
require 'lib/RRApplication.php';
require 'lib/RRRest.php';
// ------------------------------------------------------- App Bootloader Below
$rrApp = new RRApplication();
$appRoute = new \Slim\Slim();
$appRoute->get('/', function () use($rrApp) {
    // Generate Roll - Homepage
    $rrApp->showMain();
});
$appRoute->get('/roll/:rollid', function ($rollid) use($rrApp) {
    // Get Roll
    $rrApp->showRoll($rollid);
});
$appRoute->get('/roll/:rollid/:serialdice', function ($rollid, $serialdice) use($rrApp) {
    // Get Roll
    $rrApp->executeRoll($rollid, $serialdice);
    $rrApp->showExecuteRoll($rollid);
});
$appRoute->get('/generate', function () use($rrApp) {
    // Generate Roll - selection screen
    $rrApp->showGenerateMain();
});
$appRoute->get('/generate/:dd', function ($dd) use($rrApp) {
    // Generate Roll - with difficulty dice
    $rrApp->showRollURL($rrApp->generateRoll($dd));