Fluggeschwindigkeiten

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Fluggeschwindigkeiten

    Hallo zusammen

    Ic könnte bei einem java script ein wenig hilfe gebrauchen. Java kann ich überhaupt nicht. Aber Vieleicht einer von euch.

    Undzwar habe ich das Problem das ich das die schiffe trozdem immer nur 100% fliegen wähle ich 30% aus fliegen Sie trozdem auf 100%. Kann mir da vieleicht jemand helfen? Da ich kein Java kann wüsste ich nichteinmal wo ich da anfangen müsste.

    Hier mal der Code

    Quellcode

    1. <html>
    2. <head>
    3. <meta name="generator" content="HTML Tidy, see www.w3.org">
    4. <title></title>
    5. <link rel="stylesheet" type="text/css" href="n/gw.css">
    6. <meta http-equiv="content-type" content=
    7. "text/html; charset=ISO-8859-1">
    8. </head>
    9. <body text="#FFFFFF" onload="y()" bgcolor="black">
    10. <center>
    11. <br>
    12. {include file="res_bar.thtml"}
    13. <br>
    14. <form action="flotten.php" method="post" name="aa">
    15. <input type="hidden" name="x" value="2">
    16. <input type="hidden" name="sprit" value="0">
    17. <input type="hidden" name="load" value="{$fleet.load}">
    18. <input type="hidden" name="h2need" value="{$fleet.h2need}">
    19. <input type="hidden" name="entf" value="0">
    20. {foreach from=$ships item=ship}
    21. <input type="hidden" name="c{$ship.id}" value="{$ship.count}">
    22. {/foreach}
    23. <table width="519">
    24. <tr>
    25. <td class="c" colspan="2">Flotte verschicken</td>
    26. </tr>
    27. {if $err}
    28. <tr>
    29. </tr>
    30. <tr>
    31. <th colspan=2><font color=red>{$err}</font></th>
    32. </tr>
    33. <tr>
    34. <td>
    35. <br>
    36. </td>
    37. </tr>
    38. {/if}
    39. <tr>
    40. <th>Ziel</th>
    41. <th>
    42. <input size="5" maxlength="3" onkeyup="y()" type="text" name="ft1" value="{$startcoords.gal}"> :
    43. <input size="5" maxlength="3" onkeyup="y()" type="text" name="ft2" value="{$startcoords.sys}"> :
    44. <input size="5" maxlength="3" onkeyup="y()" type="text" name="ft3" value="{$startcoords.plan}">
    45. </th>
    46. </tr>
    47. <tr>
    48. <th>Geschwindigkeit</th>
    49. <th>
    50. <select name="s" size="1" onchange="y()">
    51. <option selected value="10">
    52. 100%
    53. </option>
    54. <option value="9">
    55. 90%
    56. </option>
    57. <option value="8">
    58. 80%
    59. </option>
    60. <option value="7">
    61. 70%
    62. </option>
    63. <option value="6">
    64. 60%
    65. </option>
    66. <option value="5">
    67. 50%
    68. </option>
    69. <option value="4">
    70. 40%
    71. </option>
    72. <option value="3">
    73. 30%
    74. </option>
    75. <option value="2">
    76. 20%
    77. </option>
    78. <option value="1">
    79. 10%
    80. </option>
    81. </select>
    82. </th>
    83. </tr>
    84. <tr>
    85. <th>Entfernung</th>
    86. <th>
    87. <div id="w">
    88. -
    89. </div>
    90. </th>
    91. </tr>
    92. <tr>
    93. <th>Dauer (eine Strecke)</th>
    94. <th>
    95. <div id="t">
    96. -
    97. </div>
    98. </th>
    99. </tr>
    100. <tr>
    101. <th>Wasserstoffverbrauch</th>
    102. <th>
    103. <div id="z">
    104. -
    105. </div>
    106. </th>
    107. </tr>
    108. <tr>
    109. <th>Max. Geschwindigkeit</th>
    110. <th>{$fleet.maxspeed}</th>
    111. </tr>
    112. <tr>
    113. <th>Ladekapazit&auml;t</th>
    114. <th>{$fleet.load} Einheiten</th>
    115. </tr>
    116. <tr>
    117. <th colspan="2">{*<input type="submit" name="cha" value=
    118. "Zur Auswahl">*}<input type="submit" value="Weiter" name=
    119. "dr"></th>
    120. </tr>
    121. </table>
    122. {literal}
    123. <script type="text/javascript">
    124. function tp(ac)
    125. {
    126. ei=ac+"";
    127. au="";
    128. while(ei.length>3)
    129. {
    130. au="."+ei.substring(ei.length-3,ei.length)+au;
    131. ei=ei.substring(0,ei.length-3);
    132. }
    133. au=ei+au;
    134. return au;
    135. }
    136. function y()
    137. {
    138. a=document.getElementsByName("ft1")[0].value;
    139. b=document.getElementsByName("ft2")[0].value;
    140. c=document.getElementsByName("ft3")[0].value;
    141. p=document.getElementsByName("s")[0].value;
    142. m=0;
    143. h=0;
    144. d="-";
    145. en="";
    146. if(a!={/literal}{$startcoords.gal}{literal})
    147. {
    148. d=Math.abs((a-{/literal}{$startcoords.gal}{literal})*263000);
    149. }
    150. else if(b!={/literal}{$startcoords.sys}{literal})
    151. {
    152. d=Math.abs((b-{/literal}{$startcoords.sys}{literal})*1340);
    153. }
    154. else if(c!={/literal}{$startcoords.plan}{literal})
    155. {
    156. d=1000+Math.abs((c-{/literal}{$startcoords.plan}{literal})*1000);
    157. }
    158. if(a<1|a>255|b<1|b>999|c<0|c>12)
    159. {
    160. d="-";
    161. }
    162. e=Math.round({/literal}{$fleet.h2need}{literal}*d/35000*((p/10)+1)*((p/10)+1))+1;
    163. s=Math.round(35000/p*Math.sqrt(d*10/{/literal}{$fleet.maxspeed}{literal}));
    164. if(s>59)
    165. {
    166. m=Math.floor(s/60);
    167. s=s-m*60;
    168. }
    169. if(m>59)
    170. {
    171. h=Math.floor(m/60);
    172. m=m-h*60;
    173. }
    174. if(s<10)
    175. {
    176. s="0"+s;
    177. }
    178. if(m<10)
    179. {
    180. m="0"+m;
    181. }
    182. u="00FF";
    183. if(e>{/literal}{$fleet.h2max}{literal})
    184. {
    185. u="FF00";
    186. }
    187. if(e>1)
    188. {
    189. en="en";
    190. }
    191. if(d=="-")
    192. {
    193. document.aa.entf.value=0;
    194. document.getElementById("w").innerHTML=d;
    195. document.getElementById("t").innerHTML=d;
    196. document.getElementById("z").innerHTML=d;
    197. document.aa.sprit.value=0;
    198. }
    199. else
    200. {
    201. document.aa.entf.value=d;
    202. document.getElementById("w").innerHTML=tp(d)+".000 km";
    203. document.getElementById("t").innerHTML=tp(h)+":"+m+":"+s;
    204. document.getElementById("z").innerHTML="<font color="+u+"00>"+tp(e)+" Einheit"+en+"<\/font>";
    205. document.aa.sprit.value=e;
    206. }
    207. }
    208. </script>
    209. {/literal}
    210. </form>
    211. <br>
    212. <a href="sim.php?u=y&a10=6">Zum Simulator</a>
    213. </center>
    214. </body>
    215. </html>
    Alles anzeigen




    Hier noch der dazugehörige php code

    Quellcode

    1. // flotten geschwindigkeit
    2. function formula_transfer($fcoords, $tcoords, $speed, $h2need)
    3. {
    4. global $CONFIG;
    5. $a = $tcoords['gal'];
    6. $b = $tcoords['sys'];
    7. $c = $tcoords['plan'];
    8. $p = 100;
    9. $d = -1;
    10. $en = "";
    11. $fa = $fcoords['gal'];
    12. $fb = $fcoords['sys'];
    13. $fc = $fcoords['plan'];
    14. $a2 = $CONFIG["planets"]["max_gal"];
    15. $b2 = $CONFIG["planets"]["max_sys"];
    16. $c2 = $CONFIG["planets"]["max_plan"];
    17. if ($a != $fa)
    18. {
    19. $d = abs(($a - $fa) * 210000);
    20. }
    21. else if ($b != $fb)
    22. {
    23. $d = abs(($b - $fb) * 1000);
    24. }
    25. else if ($c != $fc)
    26. {
    27. $d = 1000 + abs(($c - $fc) * 1000);
    28. }
    29. if($a < 1 | $a > $a2 | $b<1 | $b > $b2 | $c < 0 | $c > $c2)
    30. {
    31. $d = -1;
    32. }
    33. $e = round($h2need * $d / 35000 * (($p / 10) + 1) * (($p / 10) + 1)) + 1;
    34. $s = round(35000 / $p * sqrt($d * 50000 / $speed));
    35. // $s is time ind secounds
    36. // $e is h2 needed...
    37. // $d is distance in Mm (Mega meters) ($d000 km)
    38. $ret['h2need'] = $e;
    39. $ret['time'] = $s;
    40. $ret['dist'] = $d;
    41. return $ret;
    42. }
    Alles anzeigen



    Auf 100 % stimmen die zeiten so gut wie überein

    Gruss
    Dragon
  • Hallo,

    wie willst du mit den vielen Zeichen zurecht kommen.
    Ich denke mal das muß man gelernt haben.
    Da habe ich jetzt eine Schule gefunden, im Internet.
    gibt doch in die Suchmaschine live Seminar ein.
    Ich hab erst auch ganz doooof geschaut, dann habe ich eine kostenfreie Probestunde oder wie die das nennen mitgemacht.
    Und jetzt bin ich fleißig am lernen und das zu hause an meinem PC.

    Geh doch mal auf die Seite, mir hilft es, evtl. hilft es dir ja auch.

    Also nur Mut.
  • Wie meinst du das jetzt? weil die mysql.inc.php wo die ganzen funktionen drine sind hat 8000 zeilen. Hab dir daher da oben die direkten code gepostet die dafür zuständg sind.

    Genauso wie ich noch ein zweites Problem habe. Versuche das wenn ich eine flotte loschicke und die 5 h und 30 min braucht das diese automatisch runter leüft. Habs auch soweit hin bekommen jedoch sobald ich eine 2 flotte los schicke kommen die sich ins gehäge und zeigen aufeinmal beide die slebe zeit un und der oberste leüft runter.


    Hier mal der code


    Quellcode

    1. <html>
    2. <head>
    3. <meta name="generator" content="HTML Tidy, see www.w3.org">
    4. <title></title>
    5. <link rel="stylesheet" type="text/css" href="n/gw.css">
    6. <meta http-equiv="content-type" content=
    7. "text/html; charset=ISO-8859-1">
    8. </head>
    9. <script language="JavaScript" src="wz_tooltip.js"></script>
    10. <script language="JavaScript" src="utilities.js"></script>
    11. <body text="#FFFFFF">
    12. <center>
    13. <br>
    14. {include file="res_bar.thtml"}
    15. <table width="519">
    16. <tr>
    17. <td class="c" colspan="3">Planet '{$planetname}' (Besitzer: {$username})</td>
    18. </tr>
    19. {if $new_msg == 1}
    20. <tr><th colspan="3">
    21. <a href="nachrichten.php?o=newmsgs">Sie haben neue Nachrichten</a>
    22. </th></tr>
    23. {/if}
    24. <tr>
    25. <th colspan="2">Serverzeit</th>
    26. <th>{$servertime_str}</th>
    27. </tr>
    28. {if $cnt_transferlist > 0}
    29. <tr>
    30. <td colspan="3" class="c">Ereignisse</td>
    31. </tr>
    32. {/if}
    33. {foreach from=$transferlist item=trans}
    34. <tr>
    35. <th></th>
    36. <th>
    37. <div id="bx" class="z">{$trans.str_time}</div>
    38. {literal}
    39. <script type="text/javascript">
    40. v=new Date();
    41. var bx=document.getElementById('bx');
    42. function t()
    43. {
    44. n=new Date();
    45. s={/literal}{$trans.time}{literal}-Math.round((n.getTime()-v.getTime())/1000.);
    46. m=0;
    47. h=0;
    48. if(s<0)
    49. {
    50. bx.innerHTML=""
    51. }
    52. else
    53. {
    54. if(s>59)
    55. {
    56. m=Math.floor(s/60);
    57. s=s-m*60;
    58. }
    59. if(m>59)
    60. {
    61. h=Math.floor(m/60);
    62. m=m-h*60;
    63. }
    64. if(s<10)
    65. {
    66. s="0"+s
    67. }
    68. if(m<10)
    69. {
    70. m="0"+m
    71. }
    72. bx.innerHTML=h+":"+m+":"+s+"";
    73. }
    74. window.setTimeout("t();",999)
    75. }
    76. window.onload=t;
    77. </script>
    78. {/literal}
    79. <th>{$trans.msg}</th>
    80. <th>
    81. <a href='flotten.php?x=5&tid={$trans.id}'>Infos</a>
    82. </th>
    83. </tr>
    84. {/foreach}
    85. <tr>
    86. <th colspan="2">Verwarnungen:</th>
    87. <th>{if $warnings>0}<b><font color="#ff0000">{$warnings} Verwarnung</font></b>{else}Keine Verwarnungen{/if}</th>
    88. </tr>
    89. {if $admin == 1}
    90. <tr>
    91. <th colspan="2">ACP:</th>
    92. <th><a href="index_acp.php">Login</a></th>
    93. </tr>
    94. {/if}
    95. {if $entw == 1}
    96. <tr>
    97. <th colspan="2">Style-Sheet:</th>
    98. <th><a href="n/gw{$style}.css">gw{$style}.css</a></th>
    99. </tr>
    100. {/if}
    101. <th colspan="3">
    102. <img src="n/{$pimage}"><br>
    103. </th>
    104. <!-- <a href="upload.php">[Upload]</a></th> -->
    105. </tr>
    106. <tr>
    107. <th colspan="2">Durchmesser</th>
    108. <th>{$diameter} km</th>
    109. </tr>
    110. <tr>
    111. <th colspan="2">Temperatur</th>
    112. <th>ca. {$temp_lo}&deg;C bis {$temp_hi}&deg;C</th>
    113. </tr>
    114. <tr>
    115. <th colspan="2">Position</th>
    116. <th>{$coords_str}</th>
    117. </tr>
    118. <tr>
    119. <th colspan="2">Punkte</th>
    120. <th>{$planet_points}</th>
    121. </tr>
    122. <tr>
    123. <td class="c" colspan="3">Account '{$username}'</td>
    124. </tr>
    125. <tr>
    126. <th colspan="2">Planeten</th>
    127. <th>{$planet_count}</th>
    128. </tr>
    129. <tr>
    130. <th colspan="2">Punkte aller Planeten</th>
    131. <th>{$build_points}</th>
    132. </tr>
    133. <tr>
    134. <th colspan="2">Forschungspunkte</th>
    135. <th>{$sci_points}</th>
    136. </tr>
    137. <tr>
    138. <th colspan="2">Flottenpunkte</th>
    139. <th>{$fleet_points}</th>
    140. </tr>
    141. <tr>
    142. <td class="c" colspan="3">Punkte Gesamt: {$all_points}</td>
    143. </tr>
    144. </table>
    145. </center>
    146. </body>
    147. </html>
    Alles anzeigen



    Und hier der php code die funktion ein teil davon

    Quellcode

    1. // angriff
    2. $ret[$ptr]['msg'] = "<font color='#FF0000'>Eine angreifende Flotten vom Planeten $fgal:$fsys:$fplan nähert sich ihrem Planete. Der Auftrag lautet Angreifen</font>";
    3. $ret[$ptr]['time'] = ($row['tthere'] - $now);
    4. $ret[$ptr]['str_time'] = $owndb->format_time($ret[$ptr]['time']);
    5. $ret[$ptr]['id'] = $row['id'];
    6. {$ret[$ptr]['id'] }
    7. }
    8. else if ($row['option'] == 1)
    9. {
    10. // transport
    11. $ret[$ptr]['msg'] = "<font color='#00FF00'>Eine Flotte vom Planeten $fgal:$fsys:$fplan nähert sich Ihrem Planeten $tgal:$tsys:$tplan. Der Autrag lautet Transport.</font>";
    12. $ret[$ptr]['time'] = ($row['tthere'] - $now);
    13. $ret[$ptr]['str_time'] = $owndb->format_time($ret[$ptr]['time']);
    14. $ret[$ptr]['id'] = $row['id'];
    15. }
    16. else if ($row['option'] == 2)
    17. {
    Alles anzeigen



    Könnte mir vorstellen das die selbe funktion vom javascript aufgerufen wird, so das sie sich deswegen is gehege kommen. Jedoch weiss ich nicht wie ich das beheben könnte.

    Gruss Dragon
  • Nadann versuchen wirs mal


    Quellcode

    1. <html>
    2. <head>
    3. <meta name="generator" content="HTML Tidy, see www.w3.org">
    4. <title></title>
    5. <link rel="stylesheet" type="text/css" href="n/gw.css">
    6. <meta http-equiv="content-type" content=
    7. "text/html; charset=ISO-8859-1">
    8. </head>
    9. <script language="JavaScript" src="wz_tooltip.js"></script>
    10. <script language="JavaScript" src="utilities.js"></script>
    11. <body text="#FFFFFF">
    12. <center>
    13. <br>
    14. <b>Aktuelle Rohstoffe</b>
    15. <table border="0" cellspacing="0" cellpadding="0" width="401" height="81">
    16. <tr>
    17. <td width="116" height="81" background="n/h.gif">
    18. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    19. <tr>
    20. <td height="5">
    21. <img src="n/b.gif" width="1" height="1"></td>
    22. </tr>
    23. <tr>
    24. <td height="10" align="center" class="g">Metall:</td>
    25. </tr>
    26. <tr>
    27. <td height="10" align="center" class="g">5.771.438</td>
    28. </tr>
    29. <tr>
    30. <td height="10">&nbsp;</td>
    31. </tr>
    32. </table>
    33. </td>
    34. <td background="n/i.gif" width="100">
    35. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    36. <tr>
    37. <td height="5"><img src="n/b.gif" width="1" height="1"></td>
    38. </tr>
    39. <tr>
    40. <td height="10" align="center" class="g">Kristall:</td>
    41. </tr>
    42. <tr>
    43. <td height="10" align="center" class="g">3.909.773</td>
    44. </tr>
    45. <tr>
    46. <td height="10">&nbsp;</td>
    47. </tr>
    48. </table>
    49. </td>
    50. <td background="n/i.gif" width="100">
    51. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    52. <tr>
    53. <td height="5"><img src="n/b.gif" width="1" height="1"></td>
    54. </tr>
    55. <tr>
    56. <td height="10" align="center" class="g">Deuterium:</td>
    57. </tr>
    58. <tr>
    59. <td height="10" align="center" class="g">3.452.188</td>
    60. </tr>
    61. <tr>
    62. <td height="10">&nbsp;</td>
    63. </tr>
    64. </table>
    65. </td>
    66. <td width="125" height="81" background="n/j.gif">
    67. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    68. <tr>
    69. <td height="5"><img src="n/b.gif" width="1" height="1"></td>
    70. </tr>
    71. <tr>
    72. <td height="10" align="center" class="g">Wasserstoff:</td>
    73. </tr>
    74. <tr>
    75. <td height="10" align="center" class="g">10.991.061</td>
    76. </tr>
    77. <tr>
    78. <td height="10">&nbsp;</td>
    79. </tr>
    80. </table>
    81. </td>
    82. </tr>
    83. </table>
    84. <font color="#FFFFFF"><b>Das Spiel befindet sich derzeit noch in der Betafase.
    85. Bei Problemen oder verbesserungsvorschlägen einfach eine PM an Dragon.</b></font><br><br>
    86. <table width="519">
    87. <tr>
    88. <td class="c" colspan="3">Planet 'Stargate 1' (Besitzer: Dragon)</td>
    89. </tr>
    90. <tr>
    91. <th colspan="2">Serverzeit</th>
    92. <th>Thu, 17.5.2007 - 12:51:10</th>
    93. </tr>
    94. <tr>
    95. <td colspan="3" class="c">Ereignisse</td>
    96. </tr>
    97. <tr>
    98. <th></th>
    99. <th>
    100. <div id="bx" class="z">04:56:13</div>
    101. <script type="text/javascript">
    102. v=new Date();
    103. var bx=document.getElementById('bx');
    104. function t()
    105. {
    106. n=new Date();
    107. s=17773-Math.round((n.getTime()-v.getTime())/1000.);
    108. m=0;
    109. h=0;
    110. if(s<0)
    111. {
    112. bx.innerHTML=""
    113. }
    114. else
    115. {
    116. if(s>59)
    117. {
    118. m=Math.floor(s/60);
    119. s=s-m*60;
    120. }
    121. if(m>59)
    122. {
    123. h=Math.floor(m/60);
    124. m=m-h*60;
    125. }
    126. if(s<10)
    127. {
    128. s="0"+s
    129. }
    130. if(m<10)
    131. {
    132. m="0"+m
    133. }
    134. bx.innerHTML=h+":"+m+":"+s+"";
    135. }
    136. window.setTimeout("t();",999)
    137. }
    138. window.onload=t;
    139. </script>
    140. <th><font color='#FFFF00'>Ihre angreifende Flotte erreicht 1:245:4</font></th>
    141. <th>
    142. <a href='flotten.php?x=5&tid=303'>Infos</a>
    143. </th>
    144. </tr>
    145. <tr>
    146. <th colspan="2">Verwarnungen:</th>
    147. <th>Keine Verwarnungen</th>
    148. </tr>
    149. <tr>
    150. <th colspan="2">ACP:</th>
    151. <th><a href="index_acp.php">Login</a></th>
    152. </tr>
    153. <th colspan="3">
    154. <img src="n/planet8.jpg"><br>
    155. </th>
    156. <!-- <a href="upload.php">[Upload]</a></th> -->
    157. </tr>
    158. <tr>
    159. <th colspan="2">Durchmesser</th>
    160. <th>6640 km</th>
    161. </tr>
    162. <tr>
    163. <th colspan="2">Temperatur</th>
    164. <th>ca. 103&deg;C bis 116&deg;C</th>
    165. </tr>
    166. <tr>
    167. <th colspan="2">Position</th>
    168. <th>3:245:4</th>
    169. </tr>
    170. <tr>
    171. <th colspan="2">Punkte</th>
    172. <th>3653</th>
    173. </tr>
    174. <tr>
    175. <td class="c" colspan="3">Account 'Dragon'</td>
    176. </tr>
    177. <tr>
    178. <th colspan="2">Planeten</th>
    179. <th>4</th>
    180. </tr>
    181. <tr>
    182. <th colspan="2">Punkte aller Planeten</th>
    183. <th>5781</th>
    184. </tr>
    185. <tr>
    186. <th colspan="2">Forschungspunkte</th>
    187. <th>3773</th>
    188. </tr>
    189. <tr>
    190. <th colspan="2">Flottenpunkte</th>
    191. <th>408052</th>
    192. </tr>
    193. <tr>
    194. <td class="c" colspan="3">Punkte Gesamt: 417606</td>
    195. </tr>
    196. </table>
    197. </center>
    198. </body>
    199. </html>
    Alles anzeigen
  • ja ist der Quelltext

    Jedoch zeigt ein qulltext meist ja so an was wiedergegen wird

    Weiss einfach nicht wie ich das machen soll mit dem zeit ticker wennn du den ersten beotrag von oben meintes ist das der Quelltex



    Quellcode

    1. <html>
    2. <head>
    3. <meta name="generator" content="HTML Tidy, see www.w3.org">
    4. <title></title>
    5. <link rel="stylesheet" type="text/css" href="n/gw.css">
    6. <meta http-equiv="content-type" content=
    7. "text/html; charset=ISO-8859-1">
    8. </head>
    9. <body text="#FFFFFF" onload="y()" bgcolor="black">
    10. <center>
    11. <br>
    12. <b>Aktuelle Rohstoffe</b>
    13. <table border="0" cellspacing="0" cellpadding="0" width="401" height="81">
    14. <tr>
    15. <td width="116" height="81" background="n/h.gif">
    16. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    17. <tr>
    18. <td height="5">
    19. <img src="n/b.gif" width="1" height="1"></td>
    20. </tr>
    21. <tr>
    22. <td height="10" align="center" class="g">Metall:</td>
    23. </tr>
    24. <tr>
    25. <td height="10" align="center" class="g">5.957.230</td>
    26. </tr>
    27. <tr>
    28. <td height="10">&nbsp;</td>
    29. </tr>
    30. </table>
    31. </td>
    32. <td background="n/i.gif" width="100">
    33. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    34. <tr>
    35. <td height="5"><img src="n/b.gif" width="1" height="1"></td>
    36. </tr>
    37. <tr>
    38. <td height="10" align="center" class="g">Kristall:</td>
    39. </tr>
    40. <tr>
    41. <td height="10" align="center" class="g">4.034.343</td>
    42. </tr>
    43. <tr>
    44. <td height="10">&nbsp;</td>
    45. </tr>
    46. </table>
    47. </td>
    48. <td background="n/i.gif" width="100">
    49. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    50. <tr>
    51. <td height="5"><img src="n/b.gif" width="1" height="1"></td>
    52. </tr>
    53. <tr>
    54. <td height="10" align="center" class="g">Deuterium:</td>
    55. </tr>
    56. <tr>
    57. <td height="10" align="center" class="g">3.459.961</td>
    58. </tr>
    59. <tr>
    60. <td height="10">&nbsp;</td>
    61. </tr>
    62. </table>
    63. </td>
    64. <td width="125" height="81" background="n/j.gif">
    65. <table width="100%" border="0" cellspacing="0" cellpadding="0">
    66. <tr>
    67. <td height="5"><img src="n/b.gif" width="1" height="1"></td>
    68. </tr>
    69. <tr>
    70. <td height="10" align="center" class="g">Wasserstoff:</td>
    71. </tr>
    72. <tr>
    73. <td height="10" align="center" class="g">11.046.063</td>
    74. </tr>
    75. <tr>
    76. <td height="10">&nbsp;</td>
    77. </tr>
    78. </table>
    79. </td>
    80. </tr>
    81. </table>
    82. <font color="#FFFFFF"><b>Das Spiel befindet sich derzeit noch in der Betafase.
    83. Bei Problemen oder verbesserungsvorschlägen einfach eine PM an Dragon.</b></font><br><br>
    84. <br>
    85. <form action="flotten.php" method="post" name="aa">
    86. <input type="hidden" name="x" value="2">
    87. <input type="hidden" name="sprit" value="0">
    88. <input type="hidden" name="load" value="10700000">
    89. <input type="hidden" name="h2need" value="6420">
    90. <input type="hidden" name="entf" value="0">
    91. <input type="hidden" name="c113" value="214">
    92. <table width="519">
    93. <tr>
    94. <td class="c" colspan="2">Flotte verschicken</td>
    95. </tr>
    96. <tr>
    97. <th>Ziel</th>
    98. <th>
    99. <input size="5" maxlength="3" onkeyup="y()" type="text" name="ft1" value="3"> :
    100. <input size="5" maxlength="3" onkeyup="y()" type="text" name="ft2" value="245"> :
    101. <input size="5" maxlength="3" onkeyup="y()" type="text" name="ft3" value="4">
    102. </th>
    103. </tr>
    104. <tr>
    105. <th>Geschwindigkeit</th>
    106. <th>
    107. <select name="s" size="1" onchange="y()">
    108. <option selected value="10">
    109. 100%
    110. </option>
    111. <option value="9">
    112. 90%
    113. </option>
    114. <option value="8">
    115. 80%
    116. </option>
    117. <option value="7">
    118. 70%
    119. </option>
    120. <option value="6">
    121. 60%
    122. </option>
    123. <option value="5">
    124. 50%
    125. </option>
    126. <option value="4">
    127. 40%
    128. </option>
    129. <option value="3">
    130. 30%
    131. </option>
    132. <option value="2">
    133. 20%
    134. </option>
    135. <option value="1">
    136. 10%
    137. </option>
    138. </select>
    139. </th>
    140. </tr>
    141. <tr>
    142. <th>Entfernung</th>
    143. <th>
    144. <div id="w">
    145. -
    146. </div>
    147. </th>
    148. </tr>
    149. <tr>
    150. <th>Dauer (eine Strecke)</th>
    151. <th>
    152. <div id="t">
    153. -
    154. </div>
    155. </th>
    156. </tr>
    157. <tr>
    158. <th>Wasserstoffverbrauch</th>
    159. <th>
    160. <div id="z">
    161. -
    162. </div>
    163. </th>
    164. </tr>
    165. <tr>
    166. <th>Max. Geschwindigkeit</th>
    167. <th>180000</th>
    168. </tr>
    169. <tr>
    170. <th>Ladekapazit&auml;t</th>
    171. <th>10700000 Einheiten</th>
    172. </tr>
    173. <tr>
    174. <th colspan="2"><input type="submit" value="Weiter" name=
    175. "dr"></th>
    176. </tr>
    177. </table>
    178. <script type="text/javascript">
    179. function tp(ac)
    180. {
    181. ei=ac+"";
    182. au="";
    183. while(ei.length>3)
    184. {
    185. au="."+ei.substring(ei.length-3,ei.length)+au;
    186. ei=ei.substring(0,ei.length-3);
    187. }
    188. au=ei+au;
    189. return au;
    190. }
    191. function y()
    192. {
    193. a=document.getElementsByName("ft1")[0].value;
    194. b=document.getElementsByName("ft2")[0].value;
    195. c=document.getElementsByName("ft3")[0].value;
    196. p=document.getElementsByName("s")[0].value;
    197. m=0;
    198. h=0;
    199. d="-";
    200. en="";
    201. if(a!=3)
    202. {
    203. d=Math.abs((a-3)*263000);
    204. }
    205. else if(b!=245)
    206. {
    207. d=Math.abs((b-245)*1340);
    208. }
    209. else if(c!=4)
    210. {
    211. d=1000+Math.abs((c-4)*1000);
    212. }
    213. if(a<1|a>255|b<1|b>999|c<0|c>12)
    214. {
    215. d="-";
    216. }
    217. e=Math.round(6420*d/35000*((p/10)+1)*((p/10)+1))+1;
    218. s=Math.round(35000/p*Math.sqrt(d*10/180000));
    219. if(s>59)
    220. {
    221. m=Math.floor(s/60);
    222. s=s-m*60;
    223. }
    224. if(m>59)
    225. {
    226. h=Math.floor(m/60);
    227. m=m-h*60;
    228. }
    229. if(s<10)
    230. {
    231. s="0"+s;
    232. }
    233. if(m<10)
    234. {
    235. m="0"+m;
    236. }
    237. u="00FF";
    238. if(e>10700000)
    239. {
    240. u="FF00";
    241. }
    242. if(e>1)
    243. {
    244. en="en";
    245. }
    246. if(d=="-")
    247. {
    248. document.aa.entf.value=0;
    249. document.getElementById("w").innerHTML=d;
    250. document.getElementById("t").innerHTML=d;
    251. document.getElementById("z").innerHTML=d;
    252. document.aa.sprit.value=0;
    253. }
    254. else
    255. {
    256. document.aa.entf.value=d;
    257. document.getElementById("w").innerHTML=tp(d)+".000 km";
    258. document.getElementById("t").innerHTML=tp(h)+":"+m+":"+s;
    259. document.getElementById("z").innerHTML="<font color="+u+"00>"+tp(e)+" Einheit"+en+"<\/font>";
    260. document.aa.sprit.value=e;
    261. }
    262. }
    263. </script>
    264. </form>
    265. <br>
    266. <a href="sim.php?u=y&a10=6">Zum Simulator</a>
    267. </center>
    268. </body>
    269. </html>
    Alles anzeigen
  • Hier mal die flotten php

    Quellcode

    1. <?php
    2. error_reporting(E_ALL);
    3. require("config.inc.php");
    4. $PATH = $CONFIG['internal']['path'];
    5. require("$PATH/mysql.inc.php");
    6. require("$PATH/config.inc.php");
    7. define('SMARTY_DIR', $CONFIG['internal']['smarty_dir']);
    8. require(SMARTY_DIR . 'Smarty.class.php');
    9. $smarty = new Smarty;
    10. $smarty->assign("CONFIG_game_name", $CONFIG["game"]["name"]);
    11. $smarty->assign("CONFIG_internal_serverpath", $CONFIG["internal"]["serverpath"]);
    12. session_start();
    13. // print_r($_SESSION);
    14. $db = new cl_extended_database;
    15. $err = '';
    16. if (isset($_SESSION['id']))
    17. {
    18. if (!isset($_SESSION['coords']))
    19. {
    20. $_SESSION['coords'] = $db->planets_get_coords($id);
    21. }
    22. require('resbar.inc.php'); //Refresh Task, Res & display resbar
    23. // print_r($_POST);
    24. if (isset($_POST['x']) or isset($_GET['x']))
    25. {
    26. if(isset($_POST['x']))
    27. {
    28. $x = $_POST['x'];
    29. }
    30. else
    31. {
    32. $x = $_GET['x'];
    33. }
    34. // Flotten-Info anzeigen:
    35. if($x == 5)
    36. {
    37. $fleet_ships = array();
    38. $tid = $_GET['tid'];
    39. $query = "select fleetid from transfer where id='$tid'";
    40. $db->query($query);
    41. $db->err();
    42. if($row = $db->fetch())
    43. {
    44. $fleet_ships = $db->get_fleet_info($row['fleetid']);
    45. }
    46. $x = 0;
    47. $smarty->assign("transferlist", $db->fleetmenu_list($_SESSION['coords']));
    48. $smarty->assign("fleet_ships", $fleet_ships);
    49. $smarty->display("fleet_info.thtml");
    50. }
    51. // Abbruch einer Flotte:
    52. if($x == 4)
    53. {
    54. $tid = $_GET['tid'];
    55. $query = "select * from transfer where id='$tid'";
    56. $db->query($query);
    57. $db->err();
    58. $row = $db->fetch();
    59. if($row['processed'] == '0')
    60. {
    61. $now = time();
    62. $dauer = $now - $row['tstart'];
    63. $new_there = $now;
    64. $new_back = $now + $dauer;
    65. $option = $row['option'];
    66. $db->reinit();
    67. $db->flotten_abbruch($tid, $new_there, $new_back, 999, 1);
    68. }
    69. $x = 0;
    70. $smarty->assign("transferlist", $db->fleetmenu_list($_SESSION['coords']));
    71. $smarty->assign("orbitlist", $db->ship_orbit_list($_SESSION['coords']));
    72. $smarty->display("fleets1.thtml");
    73. }
    74. if($x == 3 && isset($_POST['opt']))
    75. {
    76. if($_POST['opt'] == 'a') //Angriff?
    77. {
    78. // ft1,ft2,ft3 prüfen...
    79. $checkpos['gal'] = $_POST['ft1'];
    80. $checkpos['sys'] = $_POST['ft2'];
    81. $checkpos['plan'] = $_POST['ft3'];
    82. if($db->get_planet_userid($checkpos) == $_SESSION['id'])
    83. {
    84. $x = 1;
    85. $err = "Sie versuchten einen eigenen Planeten anzugreifen!<br>-> Auftrag abgebrochen!";
    86. $smarty->assign("err", $err);
    87. }
    88. }
    89. if($_POST['opt'] == 's' && $CONFIG['game']['begrenzte_Stationierung']=='ein') //Stationierung?
    90. {
    91. // ft1,ft2,ft3 prüfen...
    92. $checkpos['gal'] = $_POST['ft1'];
    93. $checkpos['sys'] = $_POST['ft2'];
    94. $checkpos['plan'] = $_POST['ft3'];
    95. if($db->get_planet_userid($checkpos) != $_SESSION['id'])
    96. {
    97. $x = 1;
    98. $err = "Sie versuchten Flotten auf einen fremden Planeten zu stationieren!<br>-> Auftrag abgebrochen!";
    99. $smarty->assign("err", $err);
    100. }
    101. }
    102. }
    103. if($x == 2)
    104. {
    105. // ft1,ft2,ft3 prüfen...
    106. $checkpos['gal'] = $_POST['ft1'];
    107. $checkpos['sys'] = $_POST['ft2'];
    108. $checkpos['plan'] = $_POST['ft3'];
    109. if($db->check_valid_planet($checkpos) == '-1')
    110. {
    111. $x = 1;
    112. $err = "Der angegebene Zielplanet existiert nicht!";
    113. $smarty->assign("err", $err);
    114. }
    115. }
    116. if ($x == 1) {
    117. $db->reinit();
    118. $homefid = $db->get_fleetid($_SESSION['coords']);
    119. $db->reinit();
    120. $fleet = 0;
    121. $neg = 0;
    122. for($i = 0;$i < 500;$i++) {
    123. if (isset($_POST['c' . $i])) {
    124. if ($_POST['c' . $i] > 0) {
    125. $fleet = true;
    126. if ($db->fleet_count_ships($homefid, $i) < $_POST['c' . $i]) {
    127. $neg = 1;
    128. }
    129. $db->reinit();
    130. }
    131. if ($_POST['c' . $i] < 0) {
    132. $neg = 1;
    133. // $fleet=0;
    134. }
    135. }
    136. if ($neg == 1)
    137. break;
    138. }
    139. // echo "DBUG: fleet: $fleet, neg: $neg<br>";
    140. if ($fleet == 0 || $neg == 1) {
    141. $db->reinit();
    142. $smarty->assign("err", 1);
    143. $smarty->assign("transferlist", $db->fleetmenu_list($_SESSION['coords']));
    144. $smarty->assign("orbitlist", $db->ship_orbit_list($_SESSION['coords']));
    145. $smarty->display("fleets1.thtml");
    146. die();
    147. }
    148. $smarty->assign("startcoords", $_SESSION['coords']);
    149. $ar = $db->fleet_disp2($_POST);
    150. $smarty->assign("fleet", $ar['a_fleet']);
    151. $smarty->assign("ships", $ar['a_ships']);
    152. //print_r($ar);
    153. $smarty->display("fleets2.thtml");
    154. die();
    155. }
    156. else if ($x == 2)
    157. {
    158. $data = $db->fleet_disp3($_POST);
    159. $sprit = $_POST['sprit'];
    160. if($sprit <= 0)
    161. {
    162. $sprit = round(($_POST['h2need']*$_POST['entf']/35000*(($_POST['s']/10)+1)*(($_POST['s']/10)+1)),0)+1;
    163. }
    164. $smarty->assign("to", $data['to']);
    165. $smarty->assign("ships", $data['ships']);
    166. $smarty->assign("sprit", $sprit);
    167. $smarty->assign("load", $_POST['load']);
    168. //print_r($data);
    169. //Kolonisationsschiff dabei?
    170. if (isset($_POST['c107']) && $_POST['c107'] > 0) {
    171. $smarty->assign("kolo", 1);
    172. }
    173. //Recycler dabei?
    174. if (isset($_POST['c102']) && $_POST['c102'] > 0) {
    175. $smarty->assign("recycler", 1);
    176. }
    177. //Sonde dabei?
    178. if (isset($_POST['c103']) && $_POST['c103'] > 0) {
    179. $smarty->assign("spy", 1);
    180. }
    181. //Invasionseinheit dabei?
    182. if (isset($_POST['c108']) && $_POST['c108'] > 0) {
    183. $smarty->assign("invasion", 1);
    184. }
    185. $smarty->display("fleets3.thtml");
    186. //}
    187. }
    188. else if ($x == 3)
    189. {
    190. // Check und losschicken...
    191. // echo "Starting fleet...<br>";
    192. if(isset($_POST['opt']))
    193. {
    194. $msg = $db->start_fleet($_SESSION['coords'], $_POST);
    195. }
    196. else
    197. {
    198. $msg = "Es wurde keine Aktion ausgewählt!";
    199. }
    200. $db->reinit();
    201. $smarty->assign("msg", $msg);
    202. $smarty->assign("transferlist", $db->fleetmenu_list($_SESSION['coords']));
    203. $smarty->assign("orbitlist", $db->ship_orbit_list($_SESSION['coords']));
    204. $smarty->display("fleets1.thtml");
    205. die();
    206. }
    207. else if ($x == 0)
    208. {
    209. }
    210. else
    211. {
    212. echo "Don't know Value '$x' for \$x. You are cheating, or this is a BUG!<br>";
    213. }
    214. }
    215. else
    216. {
    217. $db->reinit();
    218. $db->clear_planet_orbit($_SESSION['coords']);
    219. $smarty->assign("transferlist", $db->fleetmenu_list($_SESSION['coords']));
    220. $smarty->assign("orbitlist", $db->ship_orbit_list($_SESSION['coords']));
    221. $smarty->display("fleets1.thtml");
    222. }
    223. }
    224. else
    225. {
    226. session_destroy();
    227. $smarty->display("login_warning.thtml");
    228. }
    229. ?>
    Alles anzeigen
  • hatte dadrunter noch ein 2 Problem gepostet was um das zeit ablaufen geht wennn ich eine flotte los schicke dann leüft da vor ne zeit ab jedoch muss ich dann immer aktualiesieren. Hab dann mitels java das schonmal soweit hn bekommen, das die zeit so runterleüft ohne ständig zu aktualisieren. Das Problem ist nun schicke ich eine 2 flotte los und sag ich mal die erste braucht 1 h und die 2 5 dann steht bei beiden 5 h aufeinmal und nur die oberste leüft ab.


    ps 2 beitrag
    Riek-Media.com - Webhosting riek-media.com