コード例 #1
0
ファイル: galaxy.php プロジェクト: sonicmaster/RPG
 //mega loop para listar los jugadores y las alianzas
 unset($planetrow);
 unset($playerrow);
 unset($allyrrow);
 $p = array();
 //$planet = doquery( ,"galaxy",true);
 //solo pedimos el user si existe
 if ($galaxyrow[$i]) {
     $planetrow = doquery("SELECT * FROM {{table}} WHERE id='{$galaxyrow[$i]['id_planet']}'", "planets", true);
     /*
       Pequeña conprovacion para verificar que un planeta esta destruido
       En caso de que sea cierto, este se quita de la base de datos si cumplio el maximo
       de tiempo establecido en el campo destruyed
     */
     if ($planetrow["destruyed"] != 0) {
         check_abandon_planet($planetrow);
     } else {
         $planetcount++;
         $playerrow = doquery("SELECT * FROM {{table}} WHERE id='{$planetrow["id_owner"]}'", "users", true);
     }
 }
 //
 // algunos parse comunes
 //
 $tabindex = $i + 1;
 $p['tab'] = $galaxyrow[$i]['id_planet'] != 0 ? " tabindex=\"{$tabindex}\">" : ">";
 $p['g'] = $galaxy;
 $p['s'] = $system;
 $p['i'] = $i;
 $p['p'] = $i;
 $p['T_TEMP'] = $user["settings_tooltiptime"] * 1000;
コード例 #2
0
ファイル: galaxy.php プロジェクト: sonicmaster/RPG
function echo_galaxy($g, $s)
{
    global $planetcount, $dpath, $user;
    for ($i = 1; $i < 16; $i++) {
        //mega loop para listar los jugadores y las alianzas
        unset($planetrow);
        unset($playerrow);
        unset($allyrrow);
        //$planet = doquery( ,"galaxy",true);
        $galaxyrow = doquery("SELECT * FROM {{table}} WHERE galaxy = '{$g}' AND system='{$s}' AND planet = {$i}", "galaxy", true);
        if ($galaxyrow) {
            $planetrow = doquery("SELECT * FROM {{table}} WHERE id = '" . $galaxyrow["id_planet"] . "'", "planets", true);
            /*
              Pequeña conprovacion para verificar que un planeta esta destruido
              En caso de que sea cierto, este se quita de la base de datos si cumplio el maximo
              de tiempo establecido en el campo destruyed
            */
            if ($planetrow["destruyed"] != 0) {
                check_abandon_planet($planetrow);
            } else {
                $planetcount++;
                $playerrow = doquery("SELECT * FROM {{table}} WHERE id = '" . $planetrow["id_owner"] . "'", "users", true);
            }
        }
        echo '
    <tr>
    <th width="30">
      <a href="#"';
        $tabindex = $i + 1;
        $tab = $galaxyrow["id_planet"] != 0 ? " tabindex=\"{$tabindex}\">" : ">";
        echo $tab . $i;
        echo '</a>
    </th>
    <th width="30">
     ';
        if ($galaxyrow && $planetrow["destruyed"] == 0 && $galaxyrow["id_planet"] != 0) {
            ?>
<a style="cursor: pointer;" onmouseover="this.T_WIDTH=250;this.T_OFFSETX=-110;this.T_OFFSETY=-30;this.T_STICKY=true;this.T_TEMP=<?php 
            $T_TEMP = $user["settings_tooltiptime"] * 1000;
            echo $T_TEMP;
            ?>
;this.T_STATIC=true;return escape('<table width=\'240\'><tr><td class=\'c\' colspan=\'2\'>Planeta <?php 
            echo $planetrow["name"] . " [{$g}:{$s}:{$i}]";
            ?>
</td></tr><tr><th width=\'80\'><img src=\'<?php 
            echo $dpath . "planeten/small/s_" . $planetrow["image"] . ".jpg";
            ?>
\' height=\'75\' width=\'75\'/></th><th style=\'text-align: left\'><a href=\'#\' onclick=\'doit(6, 2, 288, 5, 1, 1)\'>Espiar</a><br /><br /><a href=\'fleet.php?galaxy=2&system=288&planet=5&planettype=1&target_mission=1\'>Atacar</a><br /><a href=\'fleet.php?galaxy=2&system=288&planet=5&planettype=1&target_mission=3\'>Transportar</a></th></tr></table>');">
      <img src="<?php 
            echo $dpath . "planeten/small/s_" . $planetrow["image"] . ".jpg";
            ?>
" height="30" width="30"></a><?php 
        }
        ?>
</th>
<th style="white-space: nowrap;" width="130">
<?php 
        if ($galaxyrow && $planetrow["destruyed"] == 0) {
            echo $planetrow["name"];
        } elseif ($planetrow["destruyed"] != 0) {
            echo "Planeta destruido";
        }
        ?>
</th>
<th style="white-space: nowrap;" width="30">
 

<?php 
        //Para mostrar escombros
        if ($galaxyrow) {
            if ($galaxyrow["metal"] != 0 || $galaxyrow["crystal"] != 0) {
                echo "\n\t    <th style=\"";
                //muestra de color rojo el fondo cuando hay muchos recursos
                if ($galaxyrow["metal"] >= 5000 || $galaxyrow["crystal"] >= 5000) {
                    echo "background-color: rgb(51, 0, 0);";
                }
                ?>
background-image: none;" width="30">

	<a href="fleet.php?galaxy=7&amp;system=325&amp;planet=6&amp;planettype=2&amp;target_mission=8" style="cursor: pointer;" onmouseover="this.T_WIDTH=250;this.T_OFFSETX=-110;this.T_OFFSETY=-110;this.T_STICKY=true;this.T_TEMP=<?php 
                $T_TEMP = $user["settings_tooltiptime"] * 1000;
                echo $T_TEMP;
                ?>
;return escape('<table width=\'240\'><tr><td class=\'c\' colspan=\'2\'>Escombros [7:325:6]</td></tr><tr><th width=\'80\'><img src=\'<?php 
                echo $dpath;
                ?>
planeten/debris.jpg\' height=\'75\' width=\'75\' alt=\'T\'/></th><th><table><tr><td class=\'c\' colspan=\'2\'>Recursos:</td></tr><tr><th>Metal:</th><th><?php 
                echo number_format($galaxyrow["metal"], 0, '', '.');
                ?>
</th></tr><tr><th>Cristal:</th><th><?php 
                echo number_format($galaxyrow["crystal"], 0, '', '.');
                ?>
</th></tr><tr><td class=\'c\' colspan=\'2\'>Acciones:</tr><tr><th colspan=\'2\' style=\'text-align: left\'><font color=\'#808080\'>Recolectar</font></tr></table></th></tr></table>');">
<img src="<?php 
                echo $dpath;
                ?>
planeten/debris.jpg" alt="Escombros" height="16" width="16"></a>

	  <?php 
            } else {
                echo "\t      </th> \n    <th width=\"30\">";
            }
            //Fin escombros
        } else {
            echo "\t      </th> \n    <th width=\"30\">";
        }
        //Fin escombros
        echo "\n\n   </th>\n    <th width=\"150\"> \n\n     ";
        if ($playerrow && $planetrow["destruyed"] == 0) {
            ?>
<a style="cursor: pointer;" onmouseover="this.T_WIDTH=200;this.T_OFFSETX=-20;this.T_OFFSETY=-30;this.T_STICKY=true;this.T_TEMP=<?php 
            $T_TEMP = $user["settings_tooltiptime"] * 1000;
            echo $T_TEMP;
            ?>
;return escape('<table width=\'190\'><tr><td class=\'c\' colspan=\'2\'>Jugador <?php 
            echo $playerrow["username"];
            ?>
</td></tr><tr><td><a href=\'messages.php?mode=write&id=<?php 
            echo $playerrow["id"];
            ?>
\'>Escribir mensaje</a></td></tr><tr><td><a href=\'buddy.php?a=2&u=<?php 
            echo $playerrow["id"];
            ?>
\'>Solicitud de compañeros</a></td></tr></table>');"><span class="noob"><?php 
            echo $playerrow["username"];
            ?>
</span></a>

<?php 
        }
        //(<span class="noob">d</span>)
        ?>

</th>
<th width="80">
<?php 
        //Alianzas!
        if ($playerrow['ally_id'] && $playerrow['ally_id'] != 0) {
            $allyquery = doquery("SELECT * FROM {{table}} WHERE id=" . $playerrow['ally_id'], "alliance", true);
            if ($allyquery) {
                $members_count = doquery("SELECT COUNT(DISTINCT(id)) FROM {{table}} WHERE ally_id=" . $allyquery['id'] . ";", "users", true);
                echo "<a style=\"cursor:pointer\" onmouseover=\"this.T_WIDTH=250;this.T_OFFSETX=-30;this.T_OFFSETY=-30;this.T_STICKY=true;this.T_TEMP=5000;return escape('&lt;table width=\\'240\\'&gt;&lt;tr&gt;&lt;td class=\\'c\\'&gt;Alianza " . $allyquery['ally_name'] . " en la posición 111 con " . $members_count[0] . " Miembro(s)&lt;/td&gt;&lt;/tr&gt;&lt;th&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=\\'alliance.php?mode=ainfo&a=" . $allyquery['id'] . "\\'&gt;Ver página de alianza&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=\\'stat.php?start=101&who=ally\\'&gt;Ver en estadísticas&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=\\'" . $allyquery["ally_web"] . "\\' target=\\'_new\\'&gt;Página principal de la alianza&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/th&gt;&lt;/table&gt;');\">";
                echo $allyquery['ally_tag'] . "</a>";
            }
        }
        ?>
</th>
<th style="white-space: nowrap;" width="125">
<?php 
        if ($playerrow && $planetrow["destruyed"] == 0) {
            if ($user["settings_esp"] == "1") {
                ?>
<a style="cursor: pointer;" onclick="<?php 
                echo "javascript:doit(6, {$g}, {$s}, {$i}, 1, 1);";
                ?>
"><img src="<?php 
                echo $dpath;
                ?>
img/e.gif" alt="Espiar" title="Espiar" border="0"></a>
		<?php 
            }
            if ($user["settings_wri"] == "1") {
                ?>
<a href="messages.php?mode=write&id=<?php 
                echo $playerrow["id"];
                ?>
"><img src="<?php 
                echo $dpath;
                ?>
img/m.gif" alt="Escribir mensaje" title="Escribir mensaje" border="0"></a>
		<?php 
            }
            if ($user["settings_bud"] == "1") {
                ?>
<a href="buddy.php?a=2&amp;u=<?php 
                echo $playerrow["id"];
                ?>
"><img src="<?php 
                echo $dpath;
                ?>
img/b.gif" alt="Solicitud de compañeros" title="Solicitud de compañeros" border="0"></a>
<?php 
            }
        }
        ?>
</th>
</tr>
<?php 
    }
}