Foros del Web » Programando para Internet » PHP »

Ayuda Juego Browser

Estas en el tema de Ayuda Juego Browser en el foro de PHP en Foros del Web. Hola a todos , tengo un juego browser , y hasta el momento he estado añadiendo modulos , arreglando algunos pequeños errores y demas. Pero ...
  #1 (permalink)  
Antiguo 15/06/2010, 06:15
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Ayuda Juego Browser

Hola a todos , tengo un juego browser , y hasta el momento he estado añadiendo modulos , arreglando algunos pequeños errores y demas. Pero ahora tengo un problema bastante grave , y sinceramente no se solucionarlo , mas que nada es porque es un problema que no sigue un patron exacto , sino que es variable ( es decir aveces pasa y otras veces no ) El problema en si , debe estar en 4 archivos dedicados a la accion que falla , y su relacion con la base de datos. Pido porfavor al que quiera ayudarme , o tenga la curiosidad de participar conmigo en este proyecto y formar parte de el me mande un correo o me agregue :

Gracias de antemano.

P.D. No pongo el codigo de los 4 archivos aqui ya que son muy largos.

Última edición por GatorV; 15/06/2010 a las 08:52
  #2 (permalink)  
Antiguo 15/06/2010, 06:48
Avatar de pateketrueke
Modernizr
 
Fecha de Ingreso: abril-2008
Ubicación: Mexihco-Tenochtitlan
Mensajes: 26.399
Antigüedad: 16 años
Puntos: 2534
Respuesta: Ayuda Juego Browser

me parece que no estas respetando las reglas del foro.... ¿cierto?

por favor, este foro es un espacio publico donde se ayuda a resolver problemas, si requieres atención personalizada y a tu correo, por favor, ve el foro de ofertas de empleo o trueque de servicios...

si no estas dispuesto, entonces también puedes ayudarnos a ayudarte, y aprende a como hacer preguntas inteligentes
__________________
Y U NO RTFM? щ(ºдºщ)

No atiendo por MP nada que no sea personal.
  #3 (permalink)  
Antiguo 15/06/2010, 07:07
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

Bueno entonces , ya que es para ayuda a los demas tambien pongo el codigo , asi no es " atencion personalizada" .

Veamos primero el problema:

Tenemos 4 archivos , que son los que controlan los ataques/misiones en el juego. El problema es que algunas veces ( no siempre ) los ataques no vuelven a su origen. Otras veces vuelven hombres diferentes a los que has mandado. Es decir por ejemplo mandamos 100 matones , 100 asesinos , 100 francotiradores , y de la batalla pongamos que sobreviven , 50 matones , 70 asesinos , y 35 francotiradores. Pues los 2 casos que se dan , es que no vuelve ninguno o vuelven por ejemplo: 340 matones , 5 asesinos , y 7 francotiradores.

Tambien otro problema que hay , es que mientras se estan creando hombres de un tipo , cuando mandamos una mision , no nos los resta del total que tenemos , y cuando vuelven , practicamente se multiplican. Y si mandamos hombres de otro tipo , mientras se esten creando hombres nos vuelven multiplicados. Caso practico:

Ponemos a crear 100 matones , mandamos una mision con 50 matones y 10 asesinos , no nos resta ni asesinos ni matones , luego mandamos otra mision con 10 asesinos mas , y no nos los resta , pero al volver las 2 misiones nos vuelven 30 asesinos.

Ahi van los 4 archivos:
  #4 (permalink)  
Antiguo 15/06/2010, 07:08
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

fleet.php ( archivo que nos da una tabla con el total de nuestros hombres para elegir los que necesitamos para la mision)

Código:
<?php



define('INSIDE', true);
$ugamela_root_path = './';
include($ugamela_root_path . 'extension.inc');
include($ugamela_root_path . 'common.'.$phpEx);
include('ban.php');


if(!check_user()){ header("Location: login.php"); }
//if($user['authlevel'] != 3){ message("Przebudowa","work","overview.php","3"); }


//
// Esta funcion permite cambiar el planeta actual.
//
include($ugamela_root_path . 'includes/planet_toggle.'.$phpEx);

$planetrow = doquery("SELECT * FROM {{table}} WHERE id={$user['current_planet']}",'planets',true);
$galaxyrow = doquery("SELECT * FROM {{table}} WHERE id_planet={$planetrow['id']}",'galaxy',true);
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
$maxfleet = doquery("SELECT COUNT(fleet_owner) as ilosc FROM {{table}} WHERE fleet_owner='{$user['id']}'",'fleets',true);
$maxfleet_count = $maxfleet["ilosc"];
//$flota = doquery("SELECT * FROM {{table}} WHERE fleet_owner={$user['id']}",'flota',true);

check_field_current($planetrow);

includeLang('fleet');
includeLang('tech');

{//info

	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		5 => 'Destruir',
		6 => 'Espiar',
		8 => 'Recojer',
		9 => 'Negociar',
		);
		
	$speed = array(
		10 => 100,
		9 => 90,
		8 => 80,
		7 => 70,
		6 => 60,
		5 => 50,
		4 => 40,
		3 => 30,
		2 => 20,
		1 => 10,
		);
}



	if(!$galaxy){$galaxy = $planetrow['galaxy'];}
	if(!$system){$system = $planetrow['system'];}
	if(!$planet){$planet = $planetrow['planet'];}
	if(!$planettype){$planettype = $planetrow['planet_type'];}
	$ile = ''.++$user[$resource[108]].'';	
	$page = '<script language="JavaScript" src="scripts/flotten.js"></script>
<script language="JavaScript" src="scripts/ocnt.js"></script>
  <center>
    <table width="519" border="0" cellpadding="0" cellspacing="1">
      <tr height="20">
        <td colspan="9" class="c">Ataques (Max. '.$ile.')</td>
      </tr>
      <tr height="20">
        <th>ID</th>
        <th>Mision</th>
        <th>Matones Total</th>
		 <th>???</th>
        <th>Origen</th>
        <th>Enviado</th>
        <th>Objetivo</th>
        <th>Llegada</th>
        <th>Opciones</th>
      </tr>';
	/*
	  Here must show the fleet movings of owner player.
	*/

	$fq = doquery("SELECT * FROM {{table}} WHERE fleet_owner={$user[id]}",'fleets');

	$i=0;
	while($f = mysql_fetch_array($fq)){
		$i++;
		
		$page .= "<tr height=20><th>$i</th><th>";
		$page .= "<a title=\"\">{$missiontype[$f[fleet_mission]]}</a>";
		$page .= "<a title=\"Hombres Enviados\">(F)</a>";
		$page .= "</th><th><a title=\"";
		/*
		  Se debe hacer una lista de las tropas
		*/
		$fleet = explode(";",$f['fleet_array']);
		$e=0;
		foreach($fleet as $a =>$b){
			if($b != ''){
				$e++;
				$a = explode(",",$b);
				$page .= "{$lang['tech']{$a[0]}}: {$a[1]}\n";
				if($e>1){$page .= "\t";}
			}
		}
		$page .= "\">{$f[fleet_amount]}</a></th>";
		$page .= "<th>".gmdate("D M d H:i:s",$f['fleet_start_hour']+2*60*60)."</th>";
		$page .= "<th>[{$f[fleet_start_galaxy]}:{$f[fleet_start_system]}:{$f[fleet_start_planet]}]</th>";
		$page .= "<th>".gmdate("D M d H:i:s",$f['fleet_start_time']+2*60*60)."</th>";
		$page .= "<th>[{$f[fleet_end_galaxy]}:{$f[fleet_end_system]}:{$f[fleet_end_planet]}]</th>";
		$page .= "<th>".gmdate("D M d H:i:s",$f['fleet_end_time']+2*60*60)."</th>";
		 $page .= " </form><th>";
     	if ($f['fleet_mess'] == 0) {
     		$page .= "     <form action=\"fleetback.php\" method=\"post\">
      <input name=\"zawracanie\" value=".$f['fleet_id']." type=hidden>
         <input value=\"Cancelar\" type=\"submit\">
       </form>";
     	}
            $page .= "<font color=\"lime\"><div id=\"time_0\"><font>".pretty_time(floor($f['fleet_end_time']+1-time()))."</font></div></font></th>
            </tr>";
	/*if($_POST['order_return'] = 1){	
doquery("UPDATE {{table}} SET
	`fleet_owner`='{$user['id']}',
	`fleet_mission`='4',
	`fleet_start_galaxy`='{$f[fleet_end_galaxy]}',
	`fleet_start_system`='{$f[fleet_end_system]}',
	`fleet_start_planet`='{$f[fleet_end_planet]}',
	`fleet_end_galaxy`='{$f[fleet_start_galaxy]}',
	`fleet_end_system`='{$f[fleet_start_system]}',
	`fleet_end_planet`='{$f[fleet_start_planet]}',
	`fleet_ofiara`='{$user['id']}' WHERE `fleet_id` = '{$f['fleet_id']}'" ,"fleets");}*/
		
	}

	if($i==0){$page .= "<th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th><th>-</th>";}
		 /*      <tr height="20">
			<th>2</th>
			<th> <a title="">Recolectar</a> <a title="Volver al planeta">(V)</a> </th>
			<th> <a title="Reciclador: 1">1</a></th>
			<th>[5:328:12]</th>
			<th>Thu Jun 29 1:52:13</th>
			<th>[5:328:13]</th>
			<th>Thu Jun 29 4:44:59</th>
			<th> </th>
		  </tr> */
		if($ile == $maxfleet_count){$maxflot = '<tr height="20"><th colspan="9"><font color="red">Misiones Maximas alcanzadas , debe esperar para enviar otra!</font></th></tr>';}
		$page .= '
		'.$maxflot.'</table>
	  </center>
	  <center>
		<form action="floten1.php" method="post">
		<table width="519" border="0" cellpadding="0" cellspacing="1">
		  <tr height="20">
			<td colspan="4" class="c">Seleccione los hombres para la mision:</td>
		  </tr>
		  <tr height="20">
			<th>Tipo de Hombre</th>
			<th>Disponibles</th>';
			//<!--    <th>Gesch.</th> -->
			$page .= '
			<th>-</th>
			<th>-</th>
		  </tr>';
	if(!$planetrow){message('WTF! ERROR!','ERROR');}//uno nunca sabe xD
	/*
	  Peque?o loop para mostrar las naves que se encuentran en el planeta.
	*/
	
	foreach($reslist['fleet'] as $n => $i){
		  
		if($planetrow[$resource[$i]] > 0){
		  if($i == 202 or $i == 203 or $i == 204 or $i == 209 or $i == 210)
		{$pricelist[$i]['speed'] = $pricelist[$i]['speed']+(($pricelist[$i]['speed']*$user['combustion_tech'])*0.1);}
		  if($i == 205 or $i == 206 or $i == 208 or $i == 211)
		{$pricelist[$i]['speed'] = $pricelist[$i]['speed']+(($pricelist[$i]['speed']*$user['impulse_motor_tech'])*0.2);}
		  if($i == 207 or $i == 213 or $i == 214 or $i == 215 or $i == 216)
		{$pricelist[$i]['speed'] = $pricelist[$i]['speed']+(($pricelist[$i]['speed']*$user['hyperspace_motor_tech'])*0.3);}
			$page .= '<tr height="20">
			<th><a title="Szybko??: '.$pricelist[$i]['speed'].'">'.$lang['tech'][$i].'</a></th>
			<th>'.$planetrow[$resource[$i]].'
			  <input type="hidden" name="maxship'.$i.'" value="'.$planetrow[$resource[$i]].'"/></th>
			<!--    <th>28000 -->
			<input type="hidden" name="consumption'.$i.'" value="'.$pricelist[$i]['consumption'].'"/>
			
			<input type="hidden" name="speed'.$i.'" value="'.$pricelist[$i]['speed'].'" />
			<input type="hidden" name="galaxy" value="'.$galaxy.'"/>
			
			<input type="hidden" name="system" value="'.$system.'"/>
			<input type="hidden" name="planet" value="'.$planet.'"/>
			<input type="hidden" name="planet_type" value="'.$planettype.'"/>
			<input type="hidden" name="mission" value="'.$target_mission.'"/>
			</th>
			<input type="hidden" name="capacity'.$i.'" value="'.$pricelist[$i]['capacity'].'" />
			</th>';
			if ($i == 212){
			$page .= '<th></th><th></th></tr>';
			} else {
				$page .= '<th><a href="javascript:maxShip(\'ship'.$i.'\'); shortInfo();">max</a> </th>
				<th><input name="ship'.$i.'" size="10" value="0" onfocus="javascript:if(this.value == \'0\') this.value=\'\';" onblur="javascript:if(this.value == \'\') this.value=\'0\';" alt="'.$lang['tech'][$i].$planetrow[$resource[$i]].'"  onChange="shortInfo()" onKeyUp="shortInfo()"/></th>
				</tr>';
				$aaaaaaa = $pricelist[$i]['consumption'];
			}
			$have_ships = true;
		}

	}

	if(!$have_ships){
		/*
		  En caso de que no se tenga nunguna nave, solo se cambia el boton
		  por uno que no tenga submit, y la propiedad disabled
		*/
		$page .= '<tr height="20">
		<th colspan="4">No fleets</th>
		</tr>
		<tr height="20">
		<th colspan="4">
		<input type="button" value="Continuar" enabled/></th>
		</tr>
		</table>
		</center>
		</form>';
	}
	else{
		$page .= '
		  <tr height="20">
			<th colspan="2"><a href="javascript:noShips();shortInfo();noResources();" >Ningun Hombre</a></th>
			<th colspan="2"><a href="javascript:maxShips();shortInfo();" >Todos mis Hombres</a></th>
		  </tr>';
		  
		$przydalej = '<tr height="20"><th colspan="4"><input type="submit" value="Continuar" /><br></th></tr>';
if($ile == $maxfleet_count){$przydalej = '';}
		$page .= '
		'.$przydalej.'
		<tr><th colspan="4">
		<br><center></center><br>
		</th></tr>
		</table>
	  </center>
	</form>';
	


	}
	display($page,"Flota");


?>
  #5 (permalink)  
Antiguo 15/06/2010, 07:09
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

floten1.php ( archivo donde ya se elige el tipo de mision , y en teoria se restan los hombres , y se suman en un array en la bdd )

Código:
<?



define('INSIDE', true);
$ugamela_root_path = './';
include($ugamela_root_path . 'extension.inc');
include($ugamela_root_path . 'common.'.$phpEx);

if(!check_user()){ header("Location: login.php"); }

//
// Esta funcion permite cambiar el planeta actual.
//
include($ugamela_root_path . 'includes/planet_toggle.'.$phpEx);

$planetrow = doquery("SELECT * FROM {{table}} WHERE id={$user['current_planet']}",'planets',true);
$galaxyrow = doquery("SELECT * FROM {{table}} WHERE id_planet={$planetrow['id']}",'galaxy',true);
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
check_field_current($planetrow);

includeLang('fleet');
includeLang('tech');

{//info

	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Recojer',
		5 => 'Destruir',
		6 => 'Espiar',
		8 => 'Recojer',
		9 => 'Negociar',
		);
		
	$speed = array(
		10 => 100,
		9 => 90,
		8 => 80,
		7 => 70,
		6 => 60,
		5 => 50,
		4 => 40,
		3 => 30,
		2 => 20,
		1 => 10,
		);
}
	$g = $_POST['galaxy'];
	$s = $_POST['system'];
	$p = $_POST['planet'];
	$t = $_POST['planet_type'];
	if(!$g){$g = $planetrow['galaxy'];}
	if(!$s){$s = $planetrow['system'];}
	if(!$p){$p = $planetrow['planet'];}
	if(!$t){$t = $planetrow['planet_type'];}
//	$fleet='';

	foreach($reslist['fleet'] as $n => $i){
		
		if($i > 200&&$i < 300 && $_POST["ship$i"] > "0"){
			if($_POST["ship$i"] > $planetrow[$resource[$i]])
			{
			$page .='za duzo statkow';
			}
			else {
				$fleet['fleetarray'][$i] = $_POST["ship$i"];
				$fleet['fleetlist'] .= $i.",".$_POST["ship$i"].";";
				$fleet['amount'] += $_POST["ship$i"];
				//$planetrow[$resource[$i]] -= $_POST["ship$i"];
				//$pquery .= $resource[$i]."= '".$planetrow[$resource[$i]]."' ,";
				//$aquery .= $fleet['fleetarray'][$i]."^";
				$speedalls[$i] = $_POST["speed$i"];
			}	
			
		}
	}	

if(!$fleet['fleetlist']){
		message( "No dispone de Hombres.","Error","Hombres.".$phpEx,1);
		}
	/*

	CREATE TABLE `ugml_flota` (
	`fleet_owner` VARCHAR( 11 ) NOT NULL ,
	`fleet_amount` VARCHAR( 11 ) NOT NULL ,
	`fleet_array` VARCHAR( 11 ) NOT NULL ,
	`query` VARCHAR( 99 ) NOT NULL
	) ENGINE = MYISAM ;
	*/

	
	//ahora se deven quitar las naves correspondientes
	//o mejor dicho. actualizar el row del planet
/*$page = '<script language="JavaScript" src="scripts/flotten.js"></script>
<script language="JavaScript" src="scripts/ocnt.js"></script>';
*/
$page .='<form action="floten2.php" method="post">';
$kolon = "0";
$sondka = "0";
$recek = "0";
$gwiazdka = "0";
//$predkosc[$i] =	$pricelist[$i]['speed']	;
//$speedalls += 100000000000000000000;
//echo "$speedalls";
$speedallsmin = min($speedalls);

foreach($reslist['fleet'] as $n => $i){
		
		if($i > 200&&$i < 300 && $_POST["ship$i"] > "0"){
	$page .= '	    
			<input type="hidden" name="maxship'.$i.'" value="'.$planetrow[$resource[$i]].'"/>
			<input type="hidden" name="consumption'.$i.'" value="'.$pricelist[$i]['consumption'].'"/>
			<input type="hidden" name="speed'.$i.'" value="'.$pricelist[$i]['speed'].'" />
			<input type="hidden" name="capacity'.$i.'" value="'.$pricelist[$i]['capacity'].'" />
			<input type="hidden" name="ship'.$i.'" size="10" value="'.$_POST["ship$i"].'""/>';

			if ("ship$i" == "ship208")
			{
			$kolon = "1";
			}
			if ("ship$i" == "ship210")
			{
			$sondka = "1";
			}
               if ("ship$i" == "ship209")
			{
			$recek = "1";
			}
if ("ship$i" == "ship214")
			{
			$gwiazdka = "1";
			}
			$page .='
			
			</tr>';
			$have_ships = true;
			
			}
	
		}
		$page .='<input type="hidden" name="speedallsmin" size="10" value="'.$speedallsmin.'"/>';



	$page .= '
		<input type="hidden" name="kolonizator" size="10" value="'.$kolon.'""/>
		<input type="hidden" name="sondeczka" size="10" value="'.$sondka.'""/>		
		<input type="hidden" name="Recykler" size="10" value="'.$recek.'""/>     
		<input type="hidden" name="Gwiazda" size="10" value="'.$gwiazdka.'""/>

	  <div><center>
		<table width="519" border="0" cellpadding="0" cellspacing="1">';
		  
		$page .= '
		  <input name="flota" type="hidden" value="'.base64_encode(serialize($fleet["fleetarray"])).'" />
		  <input name="thisgalaxy" type="hidden" value="'.$planetrow["galaxy"].'" />
		  <input name="thissystem" type="hidden" value="'.$planetrow["system"].'" />
		  <input name="thisplanet" type="hidden" value="'.$planetrow["planet"].'" />
		  <input name="galaxyend" type="hidden" value="'.$_POST["galaxy"].'" />
		  <input name="systemend" type="hidden" value="'.$_POST["system"].'" />
		  <input name="planetend" type="hidden" value="'.$_POST["planet"].'" />
		  <input name="speedfactor" type="hidden" value="'.($game_config['fleet_speed']/2500).'" />
		  <input name="thisplanettype" type="hidden" value="1" />
		  <input name="thisresource1" type="hidden" value="'.floor($planetrow["metal"]).'" />
		  <input name="thisresource2" type="hidden" value="'.floor($planetrow["crystal"]).'" />
		  <input name="thisresource3" type="hidden" value="'.floor($planetrow["deuterium"]).'" />';
		  
		  
		  
		  
		$page .= '
		  <tr height="20">
			<td colspan="2" class="c">Ordenes Mision</td>
		  </tr>
		  <tr height="20">
			<th width="50%">Coordenadas.</th>
			<th> <input name="galaxy" size="3" maxlength="2" onChange="shortInfo()" onKeyUp="shortInfo()"  value="'.$g.'" />
			  <input name="system" size="3" maxlength="3" onChange="shortInfo()" onKeyUp="shortInfo()" value="'.$s.'" />
			  <input name="planet" size="3" maxlength="2" onChange="shortInfo()" onKeyUp="shortInfo()" value="'.$p.'" />
			  <select name="planettype" onChange="shortInfo()" onKeyUp="shortInfo()">';
				
		$page .= '<option value="1"'.(($t==1)?" SELECTED":"").">Distrito</option>";
		$page .= '<option value="2"'.(($t==2)?" SELECTED":"").">SubDistrito</option>";
		$page .= '<option value="3"'.(($t==3)?" SELECTED":"").">Restos</option>";
		
		
		$page .= '
			  </select>
		  </tr>
		  <tr height="20">
			<th>Modificar Velocidad</th>
			<th> <select name="speed" onChange="shortInfo()" onKeyUp="shortInfo()">';
			
			foreach($speed as $a => $b){
				$page .= "<option value=\"$a\">$b</option>";
			}

		$page .= '</select>
			  % </th>
';
			  

		$page .= '
		  </tr>
		  <tr height="20">
			<th>Distancia</th>
			<th><div id="distance">-</div></th>
		  </tr>
		  <tr height="20">
			<th>Duracion</th>
			<th><div id="duration">-</div></th>
		  </tr>
		  <tr height="20">
			<th>Consumo de Drogas</th>
			<th><div id="consumption">-</div>
			<input name="consumption" type="hidden" value="'.$_POST["consumption"].'" /></th>
		  </tr>
		  <tr height="20">
			<th>Rapidez</th>
			<th><div id="maxspeed">-</div></th>
		  </tr>
		  <tr height="20">
			<th>Carga Transporte</th>
			<th><div id="storage">-</div></th>
		  </tr>
		  
		  </table>
		  <table width="519" border="0" cellpadding="0" cellspacing="1">
		  <tr height="20">
			<td colspan="2" class="c">Acceso Rapido <a href="fleetshortcut.php">(View)</a></td>
		  </tr>';
		  
		if($user['fleet_shortcut']){
			/*
			  Dentro de fleet_shortcut, se pueden almacenar las diferentes direcciones
			  de acceso directo, el formato es el siguiente.
			  Nombre, Galaxia,Sistema,Planeta,Tipo
			*/
			$scarray = explode("\r\n",$user['fleet_shortcut']);
			$i=0;
			
			foreach($scarray as $a => $b){
				if($b!=""){
				$c = explode(',',$b);
				if($i==0){$page .= "<tr height=\"20\">";}
				$page .= "<th><a href=\"javascript:setTarget";
				$page .= "({$c[1]},{$c[2]},{$c[3]},{$c[4]}); shortInfo();\">";
				$page .= "{$c[0]} {$c[1]}:{$c[2]}:{$c[3]}";
				//Muestra un (L) si el destino pertenece a luna, lo mismo para escombros
				if($c[4]==2){$page .= " (E)";}elseif($c[4]==3){$page .= " (L)";}
				$page .= "</a></th>";
				if($i==1){$page .= "</tr>";}
				if($i==1){$i=0;}else{$i=1;}
				}
			}
			if($i==1){$page .= "<th></th></tr><tr height=\"20\">
			<td colspan=\"2\" class=\"c\">Porfavor revise sus accesos rapidos:</td>
		  </tr>";}
		
		}else{$page .= "<th colspan=\"2\">Revisar Accesos Rapidos.</th><tr height=\"20\">
			<td colspan=\"2\" class=\"c\">Distritos:</td>
		  </tr>";}

		if($user['fleet_short']){
			/*
			  Dentro de fleet_shortcut, se pueden almacenar las diferentes direcciones
			  de acceso directo, el formato es el siguiente.
			  Nombre, Galaxia,Sistema,Planeta,Tipo
			*/
			$scarray = explode("\r\n",$user['fleet_short']);
			$i=0;
			
			foreach($scarray as $a => $b){
				if($b!=""){
				$c = explode(',',$b);
				if($i==0){$page .= "<tr height=\"20\">";}
				$page .= "<th><a href=\"javascript:setTarget";
				$page .= "({$c[1]},{$c[2]},{$c[3]},{$c[4]}); shortInfo();\">";
				$page .= "{$c[0]} {$c[1]}:{$c[2]}:{$c[3]}";
				//Muestra un (L) si el destino pertenece a luna, lo mismo para escombros
				if($c[4]==2){$page .= " (E)";}elseif($c[4]==3){$page .= " (L)";}
				$page .= "</a></th>";
				if($i==1){$page .= "</tr>";}
				if($i==1){$i=0;}else{$i=1;}
				}
			}
			if($i==1){$page .= "<th></th></tr>";}
		
		}else{$page .= "<th colspan=\"2\">Sin Distritos.</th>";}

		$page .= '	  
		  </th>
		  
		  </tr>
		  
		  <tr height="20">
			<td colspan="2" class="c">Guardar
		  </tr>
		  <tr height="20">
			<th colspan="2">-</th>
		  </tr>
		  <tr height="20" >
			<th colspan="2"><input type="submit" value="Adelante" /></th>
			</form>
		  </tr>
		</table>
		  </center>
		</div>
';
	display($page,"Flota");
?>
  #6 (permalink)  
Antiguo 15/06/2010, 07:11
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

floten2.php ( aqui se calcula el tiempo y los recursos necesarios para la mision y se elige el objetivo ) parte 1
Código:
<?
define('INSIDE', true);
$ugamela_root_path = './';
include($ugamela_root_path . 'extension.inc');
include($ugamela_root_path . 'common.'.$phpEx);

if(!check_user()){ header("Location: login.php"); }

//
// Esta funcion permite cambiar el planeta actual.
//
include($ugamela_root_path . 'includes/planet_toggle.'.$phpEx);

$planetrow = doquery("SELECT * FROM {{table}} WHERE id={$user['current_planet']}",'planets',true);
$galaxyrow = doquery("SELECT * FROM {{table}} WHERE id_planet={$planetrow['id']}",'galaxy',true);
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
check_field_current($planetrow);

includeLang('fleet');
includeLang('tech');

{//info
if ($_POST['kolonizator'] == "1" && $_POST['sondeczka' ]== "1" && $_POST['Gwiazda' ]== "1" && $_POST['Recykler' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		5 => 'Destruir',
		6 => 'Espiar',
		9 => 'Negociar',
		8 => 'Recojer',
		);
	}elseif ($_POST['kolonizator'] == "1" && $_POST['sondeczka' ]== "1" && $_POST['Gwiazda' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		5 => 'Destruir',
		6 => 'Espiar',
		9 => 'Negociar',
		);
}elseif ($_POST['kolonizator'] == "1" && $_POST['sondeczka' ]== "1" && $_POST['Recykler' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		8 => 'Recojer',
		6 => 'Espiar',
		9 => 'Negociar',
		);
}elseif ($_POST['kolonizator'] == "1" && $_POST['sondeczka' ]== "1" && $_POST['Recykler' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		8 => 'Recojer',
		6 => 'Espiar',
		9 => 'Negociar',
		);
}elseif ($_POST['kolonizator'] == "1" && $_POST['sondeczka' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		9 => 'Negociar',
		6 => 'Espiar',
		);
}elseif ($_POST['kolonizator'] == "1" && $_POST['Recykler' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		9 => 'Negociar',
		8 => 'Recojer',
		);
}elseif ($_POST['kolonizator'] == "1" && $_POST['Gwiazda' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		9 => 'Negociar',
		5 => 'Destruir',
		);
}elseif ($_POST['sondeczka'] == "1" && $_POST['Recykler' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		8 => 'Recojer',
		6 => 'Espiar',
		);
}elseif ($_POST['sondeczka'] == "1" && $_POST['Gwiazda' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		5 => 'Destruir',
		6 => 'Espiar',
		);
}elseif ($_POST['Recykler'] == "1" && $_POST['Gwiazda' ]== "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		8 => 'Recojer',
		5 => 'Destruir',
		);
}elseif ($_POST['sondeczka'] == "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		6 => 'Espiar',
		);
}elseif ($_POST['Recykler'] == "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		8 => 'Recojer',
		);
}elseif ($_POST['Gwiazda'] == "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		5 => 'Destruir',
		);
}elseif ($_POST['kolonizator'] == "1")
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		9 => 'Negociar',
		);
}		
else
{
	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transportar',
		4 => 'Desplegar',
		);
}
	$speed = array(
		10 => 100,
		9 => 90,
		8 => 80,
		7 => 70,
		6 => 60,
		5 => 50,
		4 => 40,
		3 => 30,
		2 => 20,
		1 => 10,
		);
}
$g = $_POST['g'];
$s = $_POST['s'];
$p = $_POST['p'];
$t = $_POST['t'];
$galaxy = $_POST['galaxyend'];
$system = $_POST['systemend'];
$planet = $_POST['planetend'];
$t = $_POST['t'];



	
	if(!$g){$g = $planetrow['galaxy'];}
	if(!$s){$s = $planetrow['system'];}
	if(!$p){$p = $planetrow['planet'];}
	if(!$t){$t = $planetrow['planet_type'];}
$page ='	<table>
<form action="floten3.php" method="post">
		  <tr height="20">
			<th>Mission</th>
			<th></th>
			<th> <select name="mission" onChange="shortInfo()" onKeyUp="shortInfo()">';
  #7 (permalink)  
Antiguo 15/06/2010, 07:12
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

floten2.php parte 2
Código:
/*function distance() {
	var thisGalaxy;
	var thisSystem;
	var thisPlanet;

	var targetGalaxy;
	var targetSystem;
	var targetPlanet;

	var dist;

	thisGalaxy = document.getElementsByName("thisgalaxy")[0].value;
	thisSystem = document.getElementsByName("thissystem")[0].value;
	thisPlanet = document.getElementsByName("thisplanet")[0].value;

	targetGalaxy = document.getElementsByName("galaxy")[0].value;
	targetSystem = document.getElementsByName("system")[0].value;
	targetPlanet = document.getElementsByName("planet")[0].value;

	dist = 0;
	if ((targetGalaxy - thisGalaxy) != 0) {
		dist = Math.abs(targetGalaxy - thisGalaxy) * 20000;
	} else if ((targetSystem - thisSystem) != 0) {
		dist = Math.abs(targetSystem - thisSystem) * 5 * 19 + 2700;
	} else if ((targetPlanet - thisPlanet) != 0) {
		dist = Math.abs(targetPlanet - thisPlanet) * 5 + 1000;
	} else {
		dist = 5;
	}

	return(dist);
}*/

	
			foreach($missiontype as $a => $b){
				$page .= "<option value=\"$a\">$b</option>";
			}
$flota = unserialize(base64_decode($_POST["flota"]));
$consumption = 0;
if (($_POST['thisgalaxy'] - $_POST['galaxy']) != 0){
	$dista = abs($_POST['thisgalaxy'] - $_POST['galaxy']) * 20000;
}
elseif (($_POST['thissystem'] - $_POST['system']) != 0){
	$dista = abs($_POST['thissystem'] - $_POST['system']) * 95 + 2700;
}	
elseif (($_POST['thisplanet'] - $_POST['planet']) != 0){
	$dista = abs($_POST['thisplanet'] - $_POST['planet']) * 5 + 1000;
} else {
	$dista = 5;
}
$fleet['fly_time'] = round(35000 / $_POST['speed'] * sqrt($dista * 10 / $_POST['speedallsmin'] )) / ($game_config['fleet_speed']/2500);
foreach($flota as $a =>$b){
	$shipSpeed = $pricelist[$a]["speed"];
	$spd = 35000 / ($fleet['fly_time'] * ($game_config['fleet_speed']/2500) - 10) * sqrt($dista * 10 / $shipSpeed);
	$basicConsumption = $pricelist[$a]["consumption"] * $b ;
	$spidq = (($spd/10) + 1) * (($spd/10) + 1);
	$consumption = $consumption + $basicConsumption * $dista / 35000 * $spidq;
//	echo "dista: ".$dista." spd: ".$spd." spidq: ".$spidq." consumption: ".$basicConsumption." sumcons: ".$consumption."\n";
}
$consumption = round($consumption) + 1;

$page.='			 <table width="519" border="0" cellpadding="0" cellspacing="1">
		  
		  </th>
		  <tr height="20">
			<td colspan="3" class="c">Recursos</td>
		  </tr>
		   <tr height="20">
		  <th>Dolares</th>
		  <th><a href="javascript:maxResource(\'1\');">max</a></th>
		  <th width="50%"><input name="resource1" type="text" alt="Metal '.floor($planetrow["metal"]).'" size="21" onChange="calculateTransportCapacity();" /></th>

		 </tr>
		   <tr height="20">
		  <th>Marihuana</th>
		  <th><a href="javascript:maxResource(\'2\');">max</a></th>
		  <th width="50%"><input name="resource2" type="text" alt="Cristal '.floor($planetrow["crystal"]).'" size="21" onChange="calculateTransportCapacity();" /></th>
		 </tr>
		   <tr height="20">
		  <th>Cocaina</th>

		  <th><a href="javascript:maxResource(\'3\');">max</a></th>
		  <th width="50%"><input name="resource3" type="text" alt="Deuterio '.floor($planetrow["deuterium"]).'" size="21" onChange="calculateTransportCapacity();" /></th>
		 </tr>
		   <tr height="20">
	  <th>Espacio Libre</th>
		  <th colspan="2"><div id="remainingresources">-</div></th>
		 </tr>      
		 <tr height="20">
	  <th colspan="2"><a href="javascript:noResources()">Sin Carga</a></th>
	  <th><a href="javascript:maxResources()">Maxima Carga</a></th>
		 </tr>
		  <tr height="20" >
		  <input name="thisresource1" type="hidden" value="'.$planetrow["metal"].'" />
		  <input name="thisresource2" type="hidden" value="'.$planetrow["crystal"].'" />
		  <input name="thisresource3" type="hidden" value="'.$planetrow["deuterium"].'" />
		  <input name="consumption_php" type="hidden" value="'.$consumption.'" />

		  <input name="thisgalaxy" type="hidden" value="'.$_POST["thisgalaxy"].'" />
		  <input name="thissystem" type="hidden" value="'.$_POST["thissystem"].'" />
		  <input name="thisplanet" type="hidden" value="'.$_POST["thisplanet"].'" />
		  <input name="galaxy" type="hidden" value="'.$_POST["galaxy"].'" />
		  <input name="system" type="hidden" value="'.$_POST["system"].'" />
		  <input name="planet" type="hidden" value="'.$_POST["planet"].'" />
		   <input name="speedfactor" type="hidden" value="'.($game_config['fleet_speed']/2500).'" />
		  <input name="thisplanettype" type="hidden" value="'.$_POST["thisplanettype"].'" />
		  
		  <input name="planettype" type="hidden" value="'.$_POST["planettype"].'" />
		  
		<input type="hidden" name="speedallsmin" size="10" value="'.$_POST["speedallsmin"].'"/>
	<input name="pquery" type="hidden" value="'.$pquery.'" />
	<input name="fleetarray" type="hidden" value="'.$fleet['fleetarray'].'" />
	<input name="fleetlist" type="hidden" value="'.$fleet['fleetlist'].'" />
			<th colspan="2"><input type="submit" value="Adelante" /></th>

		  </tr>


		  </table>';

	foreach($reslist['fleet'] as $n => $i){


		if($planetrow[$resource[$i]] > 0){
$predkosc[$i] =	$pricelist[$i]['speed']	;
if ($_POST["ship$i"] > "0")
{		
	$page .= '

		    
			<input type="hidden" name="maxship'.$i.'" value="'.$planetrow[$resource[$i]].'"/>
			<input type="hidden" name="consumption'.$i.'" value="'.$pricelist[$i]['consumption'].'"/>
			<input type="hidden" name="speed'.$i.'" value="'.$pricelist[$i]['speed'].'" />
			<input type="hidden" name="capacity'.$i.'" value="'.$pricelist[$i]['capacity'].'" />
			<input type="hidden" name="ship'.$i.'" size="10" value="'.$_POST["ship$i"].'""/>';

			if ("ship$i" == "ship208" && $_POST["ship$i"] > "0")
			{
			$kolon = "1";
			}
			$page .='
			
			</tr>';
			$aaaaaaa = $pricelist[$i]['consumption'];
			$have_ships = true;
			}
		}

	}
 function rwAbs($liczba) {
      if ($liczba < 0)
            $liczba = -$liczba;
	        return $liczba;
		  }
$dist = "0";
if (($_POST['galaxy'] - $_POST['thisgalaxy']) != 0)
{
	$dist = rwAbs($_POST['galaxy'] - $_POST['thisgalaxy']) * 20000;
//	echo"{$_POST['galaxy']}";
}
elseif (($_POST['system'] - $_POST['thissystem']) != 0)
{
	$dist = rwAbs($_POST['system'] - $_POST['thissystem']) * 5 * 19 + 2700;
}
elseif (($_POST['planet'] - $_POST['thisplanet']) != 0)
{
	$dist = rwAbs($_POST['planet'] - $_POST['thisplanet']) * 5 + 1000;
} else {
	$dist ="5";
}

$page .='<input type="hidden" name="flota" size="10" value="'.$_POST["flota"].'"/>';
$page .='<input type="hidden" name="dist" size="10" value="'.$dist.'"/>';
$page .='<input type="hidden" name="speed" size="10" value="'.$_POST['speed'].'"/>';
$page .= '			</form>';
	display($page,'Flotas');
?>
  #8 (permalink)  
Antiguo 15/06/2010, 07:13
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

floten3.php ( aqui se envia la mision y se comprueba que el objetivo no tenga proteccion , o algo que inpida el ataque ) parte 1

Código:
<?
define('INSIDE', true);
$ugamela_root_path = './';
include($ugamela_root_path . 'extension.inc');
include($ugamela_root_path . 'common.'.$phpEx);
include('ban.php');
if(!check_user()){ header("Location: login.php"); }

//
// Esta funcion permite cambiar el planeta actual.
//
include($ugamela_root_path . 'includes/planet_toggle.'.$phpEx);

$planetrow = doquery("SELECT * FROM {{table}} WHERE id={$user['current_planet']}",'planets',true);
$enemyrow =doquery("SELECT * FROM {{table}} WHERE galaxy={$_POST['galaxy']} AND system={$_POST['system']} AND planet={$_POST['planet']}",'planets',true);
$galaxyrow = doquery("SELECT * FROM {{table}} WHERE id_planet={$planetrow['id']}",'galaxy',true);
$mnoznik = $game_config['resource_multiplier'];
$protection = $game_config['noobprotection'];
$protectiontime = $game_config['noobprotectiontime'];
$protectionmulti = $game_config['noobprotectionmulti'];

$proteccionsql = mysql_query("SELECT * FROM ugml_users WHERE id={$enemyrow['id_owner']}");
$proteccioncond = mysql_fetch_array($proteccionsql);
$proteccion=$proteccioncond['prot_fin'] - $proteccioncond['fecha_act'];
$vacaciones=$proteccioncond['vaca_fin'] - $proteccioncond['fecha_act'];
$panelvip=mysql_query("SELECT * FROM ugml_users WHERE (`id`='{$user['id']}')");
$conspanelvip=mysql_fetch_array($panelvip);
$protepropi = $conspanelvip['prot_fin'] - $conspanelvip['fecha_act'];

$galaxy = $_POST['galaxy'];
$system = $_POST['system'];
$planet = $_POST['planet'];
$flota = unserialize(base64_decode($_POST["flota"]));
foreach ($flota as $a => $b){
	if ($b > $planetrow[$resource[$a]]){
	message("<font color=\"red\"><b>Mision Fallida","error","fleet.".$phpEx,2);
	}
}
if($protectiontime < 1){
	$protectiontime = 9999999999999999;
}
check_field_current($planetrow);
//$flota = doquery("SELECT * FROM {{table}} WHERE fleet_owner={$user['id']}",'flota',true);
$dpath = (!$user["dpath"]) ? DEFAULT_SKINPATH : $user["dpath"];
$enemyrow =doquery("SELECT * FROM {{table}} WHERE galaxy={$_POST['galaxy']} AND system={$_POST['system']} AND planet={$_POST['planet']}",'planets',true);
$idja = doquery("SELECT * FROM {{table}} WHERE id={$user['id']}",'users',true);
if($enemyrow['id_owner'] == ''){
	$idty = $idja;
} elseif($enemyrow['id_owner'] != ''){
	$idty = doquery("SELECT * FROM {{table}} WHERE id={$enemyrow['id_owner']}",'users',true);
}
$noobja = $idja['points_points'];
$noobty = $idty['points_points'];
	

$ilosc_flot_w_powietrzu =mysql_fetch_assoc(doquery("SELECT COUNT(fleet_id) as ilosc FROM {{table}} WHERE `fleet_owner`='{$user['id']}'",'fleets'));
$ilosc_flot_w_powietrzu = $ilosc_flot_w_powietrzu["ilosc"];
if (($user[$resource[108]] + 1) <= $ilosc_flot_w_powietrzu){
	message("No tiene recursos para mandar la mision.","Mision Finalizada","fleet.".$phpEx,1);
}

if($noobja > ($noobty*$protectionmulti) and $enemyrow['id_owner'] != '' and $_POST['mission'] == 1 and $protection == 1 and $noobty < ($protectiontime*1000)){
	message("<font color=\"lime\"><b>Tiene proteccion de ataque de novato!!!","Ataque con proteccion de novato","fleet.".$phpEx,2);
}
if($_POST['mission'] > 0 and $protepropi > 0){
	message("<font color=\"lime\"><b>Su proteccion de ataques esta activada!!!","Desactivela primero","fleet.".$phpEx,2);
}	
if($enemyrow['id_owner'] != '' and $_POST['mission'] == 1 and $proteccion > 1){
	message("<font color=\"lime\"><b>Tiene proteccion contra ataques!!!","Ataque Imposible","fleet.".$phpEx,2);
}	

if($enemyrow['id_owner'] != '' and $_POST['mission'] == 4 and $proteccion > 1){
	message("<font color=\"lime\"><b>Tiene proteccion contra ataques!!!","Despliegue Imposible","fleet.".$phpEx,2);
}	

if($enemyrow['id_owner'] != '' and $_POST['mission'] == 5 and $proteccion > 1){
	message("<font color=\"lime\"><b>Tiene proteccion contra ataques!!!","Destruccion Imposible","fleet.".$phpEx,2);
}	

if($enemyrow['id_owner'] != '' and $_POST['mission'] == 9 and $proteccion > 1){
	message("<font color=\"lime\"><b>Tiene proteccion contra ataques!!!","Negociacion Imposible","fleet.".$phpEx,2);
}	

if($enemyrow['id_owner'] != '' and $_POST['mission'] == 1 and $vacaciones > 1){
	message("<font color=\"lime\"><b>Tiene modo vacaciones activado!!!","Ataque Imposible","fleet.".$phpEx,2);
}	

if($enemyrow['id_owner'] != '' and $_POST['mission'] == 4 and $vacaciones > 1){
	message("<font color=\"lime\"><b>Tiene modo vacaciones activado!!!","Despliegue Imposible","fleet.".$phpEx,2);
}	

if($enemyrow['id_owner'] != '' and $_POST['mission'] == 5 and $vacaciones > 1){
	message("<font color=\"lime\"><b>Tiene modo vacaciones activado!!!","Destruccion Imposible","fleet.".$phpEx,2);
}	

if($enemyrow['id_owner'] != '' and $_POST['mission'] == 9 and $vacaciones > 1){
	message("<font color=\"lime\"><b>Tiene modo vacaciones activado!!!","Negociacion Imposible","fleet.".$phpEx,2);
}
	
if($noobja > ($noobty*$protectionmulti) and $enemyrow['id_owner'] != '' and $_POST['mission'] == 5 and $proteccion > 1 and $noobty < ($protectiontime*1000))
{
	message("<font color=\"lime\"><b>Tiene proteccion de ataque de novato!!!","Ataque con proteccion de novato","fleet.".$phpEx,2);
}
	
if($noobja > ($noobty*$protectionmulti) and $enemyrow['id_owner'] != '' and $_POST['mission'] == 6 and $proteccion > 1 and $noobty < ($protectiontime*1000))
{
	message("<font color=\"lime\"><b>Tiene proteccion de ataque de novato!!!","Ataque con proteccion de novato","fleet.".$phpEx,2);
}

if($noobja > ($noobty*$protectionmulti) and $enemyrow['id_owner'] != '' and $_POST['mission'] == 6 and $vacaciones > 1 and $noobty < ($protectiontime*1000))
{
	message("<font color=\"lime\"><b>Tiene proteccion de ataque de novato!!!","Ataque con proteccion de novato","fleet.".$phpEx,2);
}
	
if(($noobja*$protectionmulti) < $noobty and $enemyrow['id_owner'] != '' and $_POST['mission'] == 1 and $protection == 1 and $noobja < ($protectiontime*1000))
{
	message("<font color=\"red\"><b>Tiene proteccion de ataque de novato!!!","Ataque con proteccion de novato","fleet.".$phpEx,2);
}

if(($noobja*$protectionmulti) < $noobty and $enemyrow['id_owner'] != '' and $_POST['mission'] == 5 and $protection == 1 and $noobja < ($protectiontime*1000))
{
	message("<font color=\"red\"><b>Tiene proteccion de ataque de novato!!!","Ataque con proteccion de novato","fleet.".$phpEx,2);
}

if(($noobja*$protectionmulti) < $noobty and $enemyrow['id_owner'] != '' and $_POST['mission'] == 6 and $protection == 1 and $noobja < ($protectiontime*1000))
{
	message("<font color=\"red\"><b>Tiene proteccion de ataque de novato!!!","Ataque con proteccion de novato","fleet.".$phpEx,10);
}

if ($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3'] < 1 and $_POST['mission'] == 3){
	message("No ha agregado recursos para transportar.","Transporte","fleet.".$phpEx,1);
}

if ($enemyrow['id_owner'] == '' and $_POST['mission'] < 9){
	message("No se enconro el objetivo.","error","fleet.".$phpEx,1);
}
		
if ($enemyrow['id_owner'] != '' and $_POST['mission'] == 9){
	message("No se encontro el Objetivo.","error","fleet.".$phpEx,1);
}
	
if($idty['ally_id'] != $idja['ally_id'] and $_POST['mission'] == 4){
	message("No puedes atacar a tus aliados.","","fleet.".$phpEx,1);
}

if($enemyrow['ally_deposit'] < 1 and $idty != $idja and $_POST['mission'] == 4){
	message("No puedes ayudar a un aliado que no tenga casa de clan.","","fleet.".$phpEx,1);
}
if (($enemyrow["id_owner"] == $planetrow["id_owner"]) and ($_POST["mission"] == 1)) {
	message("No puedes atacarte a ti mismo.","Error");
}
if (($enemyrow["id_owner"] == $planetrow["id_owner"]) and ($_POST["mission"] == 6)) {
	message("No puedes atacarte a ti mismo.","Error");
}
if (($enemyrow["id_owner"] != $planetrow["id_owner"]) and ($_POST["mission"] == 4)) {
	message("No puedes atacarte a ti mismo.","Error");
}

includeLang('fleet');
includeLang('tech');
  #9 (permalink)  
Antiguo 15/06/2010, 07:14
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

floten3.php parte 2


Código:
{//info

	$missiontype = array(
		1 => 'Atacar',
		3 => 'Transporte',
		4 => 'Despliegue',
		5 => 'Destruir',
		6 => 'Espionaje',
		8 => 'Recojer',
		9 => 'Negociar',
		);
		
	$speed = array(
		10 => 100,
		9 => 90,
		8 => 80,
		7 => 70,
		6 => 60,
		5 => 50,
		4 => 40,
		3 => 30,
		2 => 20,
		1 => 10,
		);
}


	if(!$g){$g = $planetrow['galaxy'];}
	if(!$s){$s = $planetrow['system'];}
	if(!$p){$p = $planetrow['planet'];}
	if(!$t){$t = $planetrow['planet_type'];}
	
	/*
	  UUURRRRGGGGGG!!!!
	*/
	//en caso de que no exista el tipo de planeta destino
	if(!$_POST['planettype']){message('Debes elegir el tipo de destino.'."Error");}

	//para las coordenadas del planeta destino
	if(!$_POST['galaxy']){$error++;$errorlist .= 'Debes elegir la Ciudad destino.';}
	if(!$_POST['system']){$error++;$errorlist .= 'Debes elegir el Estado destino.';}
	if(!$_POST['planet']){$error++;$errorlist .= 'Debes elegir el distrito destino.';}

	//Para comprobar de que la flota que se envia, sea la misma del planeta
    if($_POST['thisgalaxy'] != $planetrow['galaxy']|$_POST['thissystem'] != $planetrow['system']|$_POST['thisplanet'] != $planetrow['planet']|$_POST['thisplanettype'] != $planetrow['planet_type']){message('...',"WTF!");}
	//Se comprueba de que se tengan los recursos.
	/*
	  Ahora se debe obtener la lista de naves, para agregarlas a la array
	  Solo un megaloop comprobando si esta la nave, y cuantas.
	*/
/*	$pquery = str_replace("'","^",$pquery);
	$query = "`query`='{$pquery}',";
	doquery("INSERT INTO {{table}} SET
	$query
	`fleet_owner`='{$user['id']}',
	`fleet_amount`='{$fleet['amount']}',
	`fleet_array`='{$fleet['fleetlist']}'"
	,'flota');
	
*/
	
if(!isset($flota)){message("Gemi Sec.","Error");}

if (($_POST['thisgalaxy'] - $_POST['galaxy']) != 0){
	$dista = abs($_POST['thisgalaxy'] - $_POST['galaxy']) * 20000;
}
elseif (($_POST['thissystem'] - $_POST['system']) != 0){
	$dista = abs($_POST['thissystem'] - $_POST['system']) * 95 + 2700;
}	
elseif (($_POST['thisplanet'] - $_POST['planet']) != 0){
	$dista = abs($_POST['thisplanet'] - $_POST['planet']) * 5 + 1000;
} else {
	$dista = 5;
}
$fleet['fly_time'] = round(35000 / $_POST['speed'] * sqrt($dista * 10 / $_POST['speedallsmin'] )) / ($game_config['fleet_speed']/2500);
$fleet['start_time'] = round(35000 / $_POST['speed'] * sqrt($dista * 10 / $_POST['speedallsmin'] )) / ($game_config['fleet_speed']/2500) + time();
$fleet['end_time'] = 2*(round(35000 / $_POST['speed'] * sqrt($dista * 10 / $_POST['speedallsmin'] )) / ($game_config['fleet_speed']/2500) ) + time();
$consumption = 0;
$pojemosc = 0;
$ilosc_floty = 0;
$fleet_array="";
$pquery="";
foreach($flota as $a =>$b){
	$shipSpeed = $pricelist[$a]["speed"];
	$spd = 35000 / ($fleet['fly_time'] * ($game_config['fleet_speed']/2500) - 10) * sqrt($dista * 10 / $shipSpeed);
	$basicConsumption = $pricelist[$a]["consumption"] * $b ;
	$spidq = (($spd/10) + 1) * (($spd/10) + 1);
	$consumption = $consumption + $basicConsumption * $dista / 35000 * $spidq;
//	echo "dista: ".$dista." spd: ".$spd." spidq: ".$spidq." consumption: ".$basicConsumption." sumcons: ".$consumption."\n";
	$pojemosc = $pojemosc + $pricelist[$a]["capacity"]*$b;
	$ilosc_floty = $ilosc_floty + $b;
	$fleet_array .= $a.",".$b.";";
	$pquery .= $resource[$a]." = ".$resource[$a]." - ".$b." , ";
}
$consumption = round($consumption) + 1;

//echo $consumption."\n";
//die();

if($_POST['resource1'] > $planetrow['metal']|$_POST['resource2'] > $planetrow['crystal']|$_POST['resource3'] > ($planetrow['deuterium'] - $consumption)){
	message("Error.","Error");
}
if(($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3']) > ($pojemosc - $consumption)){
	message("Error.:".(($_POST['resource1'] + $_POST['resource2'] + $_POST['resource3']) - ($pojemosc - $consumption)),"Error");
}
//$fleetlist contiene la lista de flotas, Esta se colocara en una row
//dentro de la sql
doquery("INSERT INTO {{table}} SET
	`fleet_owner`='{$user['id']}',
	`fleet_mission`='{$_POST['mission']}',
	`fleet_amount`='{$ilosc_floty}',
	`fleet_array`='{$fleet_array}',
	`fleet_start_time`= '{$fleet['start_time']}',
	`fleet_start_galaxy`='{$_POST['thisgalaxy']}',
	`fleet_start_system`='{$_POST['thissystem']}',
	`fleet_start_planet`='{$_POST['thisplanet']}',
	`fleet_start_type`='{$_POST['planettype']}',
	`fleet_end_time`='{$fleet['end_time']}',
	`fleet_end_galaxy`='{$_POST['galaxy']}',
	`fleet_end_system`='{$_POST['system']}',
	`fleet_end_planet`='{$_POST['planet']}',
	`fleet_end_type`='{$_POST['thisplanettype']}',
	`fleet_resource_metal` = '{$_POST['resource1']}',
	`fleet_resource_crystal` = '{$_POST['resource2']}',
	`fleet_resource_deuterium` = '{$_POST['resource3']}',
	`fleet_ofiara`='{$enemyrow['id_owner']}'",'fleets');

	if ($_POST['resource1'] < 1){
		$transport["metal"] = 0;
	} else {
		$transport["metal"] = $_POST['resource1'];
	}
	if ($_POST['resource2'] < 1){
		$transport["crystal"] = 0;
	} else {
		$transport["crystal"] = $_POST['resource2'];
	}
	if ($_POST['resource3'] < 1){
		$transport["deuterium"] = 0 + $consumption;
	} else {
		$transport["deuterium"] = $_POST['resource3'] + $consumption;
	}
	$planetrow["metal"] = $planetrow["metal"] - $transport["metal"];
	$planetrow["crystal"] = $planetrow["crystal"] - $transport["crystal"];
	$planetrow["deuterium"] = $planetrow["deuterium"] - $transport["deuterium"];
	$query = "UPDATE {{table}} SET
	metal=metal - '{$transport["metal"]}',
	crystal=crystal - '{$transport["crystal"]}',
	deuterium=deuterium - '{$transport["deuterium"]}',
	$pquery
	id_owner='{$planetrow['id_owner']}'
	WHERE id={$planetrow['id']}";
	doquery($query,"planets");

	//ahora se deven quitar las naves correspondientes
	//o mejor dicho. actualizar el row del planet

	//$missiontype corresponde al tipo de accion a tomar.


	$page = '<table border="0" cellpadding="0" cellspacing="1" width="519"><br>';
	$page .= '<tr height="20"><td class="c" colspan="2">';
	$page .= '<span class="success">Detalles:</span>';
	$page .= '</td></tr>';
	$misja = $missiontype[$_POST['mission']]  ;
	$page .= "<tr height=20><th>Mision</th><th>{$misja}</th></tr>";
	$page .= "<tr height=20><th>Distancia</th><th>{$dista}</th></tr>";
	$page .= "<tr height=20><th>Velocidad</th><th>".$_POST['speedallsmin']."</th></tr>";
	$page .= "<tr height=20><th>Consumo Recursos</th><th>{$consumption}</th></tr>";
	$page .= "<tr height=20><th>Comienzo</th><th>{$_POST['thisgalaxy']}:{$_POST['thissystem']}:{$_POST['thisplanet']}</th></tr>";
	$page .= "<tr height=20><th>Objetivo.</th><th>{$_POST['galaxy']}:{$_POST['system']}:{$_POST['planet']}</th></tr>";
	$page .= "<tr height=20><th>Llegada</th><th>";
	//hora de lleada
	$page .= date("M D d H:i:s",$fleet['start_time']).'</th></tr>';
	$page .= '<tr height="20"><th>Volver</th><th>';
	//Hora de vuelta
	$page .= date("M D d H:i:s",$fleet['end_time']).'</th></tr>';
	$page .= '<tr height="20"><td class="c" colspan="2">Grupo</td></tr>';
	$page .= '</table>';
	display($page,'Flotas');

?>
  #10 (permalink)  
Antiguo 22/06/2010, 05:04
 
Fecha de Ingreso: noviembre-2009
Mensajes: 76
Antigüedad: 14 años, 5 meses
Puntos: 2
Respuesta: Ayuda Juego Browser

Veamos si modifico una de las lineas de floten1.php , consigo que las unidades que mandas se resten , pero sigue habiendo el problema de que algunas veces no vuelven , o vuelven las que no has mandado realmente. Alguna idea ?

Etiquetas: juegos, browsers
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:28.