Example #1
0
            // --- Image to draw
            $img = $terrain_images[$terrain];
            // --- Coordinates to place hex on the screen
            $tx = $x * $HEX_SIDE * 1.5;
            $ty = $y * $HEX_SCALED_HEIGHT + $x % 2 * $HEX_SCALED_HEIGHT / 2;
            // --- Style values to position hex image in the right location
            $style = sprintf("left:%dpx;top:%dpx", $tx, $ty);
            // --- Output the image tag for this hex
            print "<img src='images/{$img}' alt='{$terrain}' class='hex' style='zindex:99;{$style}'>\n";
        }
    }
}
// -----------------------------------------------------------------
// --- Generate the map data
// -----------------------------------------------------------------
generate_map_data();
?>
    <!-- Render the hex map inside of a div block -->
    <div id='hexmap' class='hexmap' onclick='handle_map_click(event);'>
        <?php 
render_map_to_html();
?>
        <img id='highlight' class='hex' src='images/hex-highlight.png' style='zindex:100;'>
    </div>

    <!--- output a list of all terrain types -->
    <br/>
    <?php 
reset($terrain_images);
while (list($type, $img) = each($terrain_images)) {
    print "<div class='hex-key-element'><img src='images/{$img}' alt='{$type}'><br/>{$type}</div>";
Example #2
0
function register_channel()
{
    global $trailing;
    global $dest;
    global $game_data;
    global $irciv_data_changed;
    $all_channels = users_get_all_channels();
    # seems to be needed to kick the users bucket into gear
    irciv_term_echo("trailing = \"{$trailing}\"");
    $channel = "";
    if ($trailing != "") {
        irciv_privmsg("syntax: [~civ] register-channel");
        return;
    }
    $channel = strtolower($dest);
    if ($channel == "") {
        irciv_term_echo("error: channel not specified");
        return;
    }
    if (users_chan_exists($channel) == False) {
        irciv_privmsg("error: channel \"{$channel}\" not found");
        return;
    }
    if (isset($game_data["map"]) == True) {
        irciv_privmsg("error: existing map data found");
        return;
    }
    $map_data = generate_map_data();
    $game_data["map"] = $map_data;
    $game_data["players"] = array();
    $irciv_data_changed = True;
    $msg = "map generated for channel \"{$channel}\"";
    if ($trailing != "") {
        irciv_privmsg_dest($trailing, $msg);
    }
    if ($dest != "" and $dest != $trailing) {
        irciv_privmsg($msg);
    }
}