added stats gathering for quests

main
hecht 9 years ago
parent 640426adfa
commit 035b22fde1

@ -14,33 +14,17 @@ function displayCharTable($charbild, $charname, $starke, $ver, $speed, $ausdauer
?> ?>
<table class="stylish"> <table class="stylish">
<tr> <tr>
<td> <td><img src="<?php echo $charbild; ?>" width="75" height="75"></td>
<img src="<?php echo $charbild; ?>" width="75" height="75"> <td class="stats"><span class="stats">Name:</span> <span
</td> class="statvals"><?php echo $charname; ?></span> <br> <span
<td class="stats"> class="stats">HP:</span> <span class="statvals"><?php echo $hp_akt.' / '.$hp_max; ?></span>
<span class="stats">Name:</span> <br> <span class="stats">MP:</span> <span class="statvals"><?php echo $mp_akt.' / '.$mp_max; ?></span>
<span class="statvals"><?php echo $charname; ?></span> <br> <span class="stats">St&auml;rke:</span> <span class="statvals"><?php echo round($starke); ?></span>
<br> <br> <span class="stats">Verteidigung:</span> <span class="statvals"><?php echo round($ver); ?></span>
<span class="stats">HP:</span> <br> <span class="stats">Geschwindigkeit:</span> <span
<span class="statvals"><?php echo $hp_akt.' / '.$hp_max; ?></span> class="statvals"><?php echo round($speed); ?></span> <br> <span
<br> class="stats">Gl&uuml;ck</span> <span class="statvals"><?php echo round($glueck); ?></span>
<span class="stats">MP:</span> <br> <span class="stats">Ausdauer:</span> <span class="statvals"><?php echo round($ausdauer); ?></span>
<span class="statvals"><?php echo $mp_akt.' / '.$mp_max; ?></span>
<br>
<span class="stats">St&auml;rke:</span>
<span class="statvals"><?php echo round($starke); ?></span>
<br>
<span class="stats">Verteidigung:</span>
<span class="statvals"><?php echo round($ver); ?></span>
<br>
<span class="stats">Geschwindigkeit:</span>
<span class="statvals"><?php echo round($speed); ?></span>
<br>
<span class="stats">Gl&uuml;ck</span>
<span class="statvals"><?php echo round($glueck); ?></span>
<br>
<span class="stats">Ausdauer:</span>
<span class="statvals"><?php echo round($ausdauer); ?></span>
</td> </td>
</tr> </tr>
</table> </table>
@ -51,33 +35,27 @@ function displayAttacks($attacke1, $schaden1, $attacke2, $schaden2){
?> ?>
<table border="0" width="100%"> <table border="0" width="100%">
<tr> <tr>
<td width="50%"> <td width="50%"><span class="stats">Technik:</span> <span
<span class="stats">Technik:</span> class="statvals"><?php
<span class="statvals"><?php
if(is_numeric($attacke1) || $attacke1 === NULL) { if(is_numeric($attacke1) || $attacke1 === NULL) {
$atk = getAttack($attacke1); $atk = getAttack($attacke1);
echo $atk['name']; echo $atk['name'];
} else { } else {
echo $attacke1; echo $attacke1;
} }
?></span> ?></span> <br>
<br><br> <br> <span class="stats">Schaden:</span> <span class="statvals"><?php echo $schaden1; ?></span>
<span class="stats">Schaden:</span>
<span class="statvals"><?php echo $schaden1; ?></span>
</td> </td>
<td width="50%"> <td width="50%"><span class="stats">Technik:</span> <span
<span class="stats">Technik:</span> class="statvals"><?php
<span class="statvals"><?php
if(is_numeric($attacke2)|| $attacke2 === NULL) { if(is_numeric($attacke2)|| $attacke2 === NULL) {
$atk = getAttack($attacke2); $atk = getAttack($attacke2);
echo $atk['name']; echo $atk['name'];
} else { } else {
echo $attacke2; echo $attacke2;
} }
?></span> ?></span> <br>
<br><br> <br> <span class="stats">Schaden:</span> <span class="statvals"><?php echo $schaden2; ?></span>
<span class="stats">Schaden:</span>
<span class="statvals"><?php echo $schaden2; ?></span>
</td> </td>
</tr> </tr>
</table> </table>
@ -174,31 +152,31 @@ echo '</table>';
if($loge !== NULL || $steh !== NULL || $sitz !== NULL) { if($loge !== NULL || $steh !== NULL || $sitz !== NULL) {
?> ?>
<table class="stylish" width="50%""> <table class="stylish" width="50%"">
<tr> <tr>
<td> <td>
<table width="100%"> <table width="100%">
<tr> <tr>
<td class="greenstats">Zuschauer</td> <td class="greenstats">Zuschauer</td>
<td class="bold"><?php echo $loge+$steh+$sitz; ?></td> <td class="bold"><?php echo $loge+$steh+$sitz; ?></td>
</tr> </tr>
<tr> <tr>
<td class="greenstats">Stehpl&auml;tze</td> <td class="greenstats">Stehpl&auml;tze</td>
<td class="bold"><?php echo $steh; ?></td> <td class="bold"><?php echo $steh; ?></td>
</tr> </tr>
<tr> <tr>
<td class="greenstats">Sitzpl&auml;tze</td> <td class="greenstats">Sitzpl&auml;tze</td>
<td class="bold"><?php echo $sitz; ?></td> <td class="bold"><?php echo $sitz; ?></td>
</tr> </tr>
<tr> <tr>
<td class="greenstats">Logenpl&auml;tze</td> <td class="greenstats">Logenpl&auml;tze</td>
<td class="bold"><?php echo $loge; ?></td> <td class="bold"><?php echo $loge; ?></td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
</table> </table>
<?php <?php
echo '</td></tr>'; echo '</td></tr>';
} }
@ -255,6 +233,8 @@ function displaySchatzSuche($char){
$char['ausdauer'] = $quest['aus']; $char['ausdauer'] = $quest['aus'];
$char['hp_max'] = $quest['hp']; $char['hp_max'] = $quest['hp'];
$char['mp_max'] = $quest['mp']; $char['mp_max'] = $quest['mp'];
$std = $quest['std'];
// Erstmal die Seite starten // Erstmal die Seite starten
echo '<html><head><link rel="stylesheet" type="text/css" href="design/FightStyle.css"></head><body><table width="100%">'; echo '<html><head><link rel="stylesheet" type="text/css" href="design/FightStyle.css"></head><body><table width="100%">';
@ -286,16 +266,28 @@ function displaySchatzSuche($char){
$final_result = 'won'; $final_result = 'won';
// Nur wer gewinnt bekommt was! // Nur wer gewinnt bekommt was!
$items = getSchatzItems($row['anzahl']); $items = getSchatzItems($row['anzahl']);
for($i=0;$items[$i];$i++){
$res = mysql_query('Update quest_item_stats set anzahl = anzahl + 1 WHERE monster = '.$row['anzahl'].' and id = '.$items[i]['id']);
if(mysql_affected_rows() == 0){
// entry not yet present
mysql_query('INSERT INTO quest_item_stats (monster, id, anzahl) values('.$row['anzahl'].', '.$items[i]['id'].', 1)');
}
}
} else{ } else{
$final_result = 'lost'; $final_result = 'lost';
$lose_rate = mt_rand(25,60)/100; $lose_rate = mt_rand(25,60)/100;
$row['exp'] = round($row['exp'] * $lose_rate); $row['exp'] = round($row['exp'] * $lose_rate);
$row['geld'] = round($row['geld'] * $lose_rate); $row['geld'] = round ( $row ['geld'] * $lose_rate );
for($i = 0;$i< count($row_r); $i++){ for($i = 0;$i< count($row_r); $i++){
$c_attacken[$i]['anzahl'] = floor($c_attacken[$i]['anzahl'] * $lose_rate); $c_attacken[$i]['anzahl'] = floor($c_attacken[$i]['anzahl'] * $lose_rate);
} }
} }
$res = mysql_query('Update quest_stats set anzahl = anzahl + 1 WHERE zeit = '.$std.' AND monster = '.$row['anzahl'].' AND status = '.($final_result=='won'?1:0));
if(mysql_affected_rows() == 0){
mysql_query('INSERT INTO quest_stats (monster, zeit, anzahl, status) values('.$row['anzahl'].', '.$std.', 1, '.($final_result=='won'?1:0).')');
}
// Zeige als erstes die Zusammenfassung an! // Zeige als erstes die Zusammenfassung an!
displayFinalResult($items, $row['exp'], $row['geld'], $final_result); displayFinalResult($items, $row['exp'], $row['geld'], $final_result);

@ -10,6 +10,7 @@ include_once(ROOT_PATH.'/include/char.inc.php');
include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php'); include_once(ROOT_PATH.'/include/fehlerausgabe.inc.php');
include_once(ROOT_PATH.'/include/designfunctions.inc.php'); include_once(ROOT_PATH.'/include/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/exp.inc.php'); include_once(ROOT_PATH.'/include/exp.inc.php');
include_once(ROOT_PATH.'/include/sqlwrapper.inc.php');
function interruptSchatzSuche($charid){ function interruptSchatzSuche($charid){
@ -109,9 +110,10 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
$k_hp1[1] = $in_hp_max; // Fuer Heal wichtig!! $k_hp1[1] = $in_hp_max; // Fuer Heal wichtig!!
$k_mp1[1] = $in_mp_max; // Fuer Heal wichtig!! $k_mp1[1] = $in_mp_max; // Fuer Heal wichtig!!
// Hinzufuegen Quest // Hinzufuegen Quest
$sql = 'Insert into quests(charid, dauer, ortid, st, sp, ver, gl, aus, hp, mp)' . $sql = 'Insert into quests(charid, dauer, std, ortid, st, sp, ver, gl, aus, hp, mp)' .
' values('.$chara_1['id'].', ' . ' values('.$chara_1['id'].', ' .
'TIMESTAMPADD(HOUR, '.$std.', now()), ' . 'TIMESTAMPADD(HOUR, '.$std.', now()), ' .
$std.', '.
$ort.', '. $ort.', '.
$in_starke.', '. $in_starke.', '.
$in_speed.', '. $in_speed.', '.
@ -301,6 +303,7 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
for(;$i<count($fight_monster);$i++){ for(;$i<count($fight_monster);$i++){
usleep(mt_rand(200000,500000)); // sleep 0.2-0.5 sec/monster usleep(mt_rand(200000,500000)); // sleep 0.2-0.5 sec/monster
} }
#### ####
} }

Loading…
Cancel
Save