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">
<tr>
<td>
<img src="<?php echo $charbild; ?>" width="75" height="75">
</td>
<td class="stats">
<span class="stats">Name:</span>
<span class="statvals"><?php echo $charname; ?></span>
<br>
<span class="stats">HP:</span>
<span class="statvals"><?php echo $hp_akt.' / '.$hp_max; ?></span>
<br>
<span class="stats">MP:</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><img src="<?php echo $charbild; ?>" width="75" height="75"></td>
<td class="stats"><span class="stats">Name:</span> <span
class="statvals"><?php echo $charname; ?></span> <br> <span
class="stats">HP:</span> <span class="statvals"><?php echo $hp_akt.' / '.$hp_max; ?></span>
<br> <span class="stats">MP:</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>
</tr>
</table>
@ -51,33 +35,27 @@ function displayAttacks($attacke1, $schaden1, $attacke2, $schaden2){
?>
<table border="0" width="100%">
<tr>
<td width="50%">
<span class="stats">Technik:</span>
<span class="statvals"><?php
<td width="50%"><span class="stats">Technik:</span> <span
class="statvals"><?php
if(is_numeric($attacke1) || $attacke1 === NULL) {
$atk = getAttack($attacke1);
echo $atk['name'];
} else {
echo $attacke1;
}
?></span>
<br><br>
<span class="stats">Schaden:</span>
<span class="statvals"><?php echo $schaden1; ?></span>
?></span> <br>
<br> <span class="stats">Schaden:</span> <span class="statvals"><?php echo $schaden1; ?></span>
</td>
<td width="50%">
<span class="stats">Technik:</span>
<span class="statvals"><?php
<td width="50%"><span class="stats">Technik:</span> <span
class="statvals"><?php
if(is_numeric($attacke2)|| $attacke2 === NULL) {
$atk = getAttack($attacke2);
echo $atk['name'];
} else {
echo $attacke2;
}
?></span>
<br><br>
<span class="stats">Schaden:</span>
<span class="statvals"><?php echo $schaden2; ?></span>
?></span> <br>
<br> <span class="stats">Schaden:</span> <span class="statvals"><?php echo $schaden2; ?></span>
</td>
</tr>
</table>
@ -174,31 +152,31 @@ echo '</table>';
if($loge !== NULL || $steh !== NULL || $sitz !== NULL) {
?>
<table class="stylish" width="50%"">
<tr>
<td>
<table width="100%">
<tr>
<td class="greenstats">Zuschauer</td>
<td class="bold"><?php echo $loge+$steh+$sitz; ?></td>
</tr>
<tr>
<td class="greenstats">Stehpl&auml;tze</td>
<td class="bold"><?php echo $steh; ?></td>
</tr>
<tr>
<td class="greenstats">Sitzpl&auml;tze</td>
<td class="bold"><?php echo $sitz; ?></td>
</tr>
<tr>
<td class="greenstats">Logenpl&auml;tze</td>
<td class="bold"><?php echo $loge; ?></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
<table class="stylish" width="50%"">
<tr>
<td>
<table width="100%">
<tr>
<td class="greenstats">Zuschauer</td>
<td class="bold"><?php echo $loge+$steh+$sitz; ?></td>
</tr>
<tr>
<td class="greenstats">Stehpl&auml;tze</td>
<td class="bold"><?php echo $steh; ?></td>
</tr>
<tr>
<td class="greenstats">Sitzpl&auml;tze</td>
<td class="bold"><?php echo $sitz; ?></td>
</tr>
<tr>
<td class="greenstats">Logenpl&auml;tze</td>
<td class="bold"><?php echo $loge; ?></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
echo '</td></tr>';
}
@ -256,6 +234,8 @@ function displaySchatzSuche($char){
$char['hp_max'] = $quest['hp'];
$char['mp_max'] = $quest['mp'];
$std = $quest['std'];
// Erstmal die Seite starten
echo '<html><head><link rel="stylesheet" type="text/css" href="design/FightStyle.css"></head><body><table width="100%">';
// Einfach mal ne dicke Ueberschrift
@ -286,16 +266,28 @@ function displaySchatzSuche($char){
$final_result = 'won';
// Nur wer gewinnt bekommt was!
$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{
$final_result = 'lost';
$lose_rate = mt_rand(25,60)/100;
$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++){
$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!
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/designfunctions.inc.php');
include_once(ROOT_PATH.'/include/exp.inc.php');
include_once(ROOT_PATH.'/include/sqlwrapper.inc.php');
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_mp1[1] = $in_mp_max; // Fuer Heal wichtig!!
// 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'].', ' .
'TIMESTAMPADD(HOUR, '.$std.', now()), ' .
$std.', '.
$ort.', '.
$in_starke.', '.
$in_speed.', '.
@ -301,6 +303,7 @@ function monsterfight_neu($chara_1, $fight_monster, $std, $ort){
for(;$i<count($fight_monster);$i++){
usleep(mt_rand(200000,500000)); // sleep 0.2-0.5 sec/monster
}
####
}

Loading…
Cancel
Save