Exemple #1
0
    foreach ($variantsOff as $variantName) {
        $Variant = libVariant::loadFromVariantName($variantName);
        print '<li><a href="variants.php#' . $Variant->name . '">' . l_t($Variant->name) . '</a> ' . l_t('(%s Players)', count($Variant->countries)) . '</li>';
    }
    print '</ul>';
}
libHTML::pagebreak();
foreach ($variantsOn as $variantName) {
    $Variant = libVariant::loadFromVariantName($variantName);
    print '<h2><a name="' . $Variant->name . '"></a>' . l_t($Variant->fullName) . ' ' . l_t('(%s Players)', count($Variant->countries)) . '</h2>';
    if (isset($Variant->description)) {
        print l_t($Variant->description) . "<br /><br />";
    }
    print '<div style="text-align:center"><img id="Image_' . $Variant->name . '" src="';
    if (file_exists(l_s(libVariant::cacheDir($Variant->name) . '/sampleMap.png'))) {
        print l_s(libVariant::cacheDir($Variant->name) . '/sampleMap.png');
    } else {
        print 'map.php?variantID=' . $Variant->id;
    }
    print '" alt=" " title="' . l_t('The map for the %s Variant', $Variant->name) . '" /></div><br />';
    print '<strong>' . l_t('Variant Parameters') . '';
    if (isset($Variant->version)) {
        print ' ' . l_t('(Version: %s)', $Variant->version) . '';
    }
    print ':</strong>';
    print '<ul>';
    if (isset($Variant->homepage)) {
        print '<li><a href="' . $Variant->homepage . '">' . l_t('Variant homepage') . '</a></li>';
    }
    if (isset($Variant->author)) {
        print '<li> ' . l_t('Created by: %s', $Variant->author) . '</li>';
Exemple #2
0
 /**
  * The location of the territories JSON file which gives the order-generation JavaScript the board layout it needs.
  * Some variants need to extend this function to point to another variant which defines their shared map.
  *
  * @return string
  */
 public function territoriesJSONFile()
 {
     return l_j(libVariant::cacheDir($this->name) . '/territories.js');
 }
Exemple #3
0
        }
        $owners[$terrID] = $countryID;
        $drawMap->colorTerritory($terrID, $countryID);
    }
    if (isset($Game) && $Game->phase == 'Retreats' or $mapType != 'small') {
        // Only draw standoffs if we're in the retreats phase, or we're viewing that large map
        if ($standoff == 'Yes') {
            $drawMap->drawStandoff($terrID);
        }
    }
}
if (isset($_REQUEST['variantID'])) {
    $drawMap->addTerritoryNames();
    $drawMap->saveThumbnail(libVariant::cacheDir($Variant->name) . '/sampleMap-thumbnail.png');
    $drawMap->write(libVariant::cacheDir($Variant->name) . '/sampleMap.png');
    libHTML::serveImage(libVariant::cacheDir($Variant->name) . '/sampleMap.png');
    die;
}
/*
 * Collect the de-coast mappings. There are 4 types of moves which store decoasted territory data, which now
 * needs to be reconstructed to determine the actual positions.
 */
$deCoastMap = array('SupportMoveFromTerrID' => array(), 'SupportMoveToTerrID' => array(), 'SupportHoldToTerrID' => array(), 'DestroyToTerrID' => array());
$tabl = $DB->sql_tabl("SELECT type, terrID, toTerrID, dislodged, success FROM wD_MovesArchive\r\n\tWHERE gameID = " . $Game->id . " AND turn = " . $turn . " AND unitType='Fleet' AND\r\n\t\t( type='Hold' OR type='Move' OR type='Support hold' OR type='Support move' )");
while (list($moveType, $terrID, $toTerrID, $dislodged, $success) = $DB->tabl_row($tabl)) {
    $terrDeCoast = $Game->Variant->deCoast($terrID);
    $toTerrDeCoast = $Game->Variant->deCoast($toTerrID);
    if ($terrDeCoast != $terrID) {
        $deCoastMap['SupportMoveFromTerrID'][$terrDeCoast] = $terrID;
        $deCoastMap['SupportHoldToTerrID'][$terrDeCoast] = $terrID;
        if (($moveType != 'Move' || $success == 'No') && $dislodged == 'No') {