From 035b22fde13e03fe2aab22cbdefbde4ba48b6424 Mon Sep 17 00:00:00 2001 From: hecht Date: Tue, 21 Jul 2015 18:26:28 +0000 Subject: [PATCH] added stats gathering for quests --- ag/include/kampf_anzeige.inc.php | 126 +++++++++++++++---------------- ag/include/schatz.inc.php | 5 +- 2 files changed, 63 insertions(+), 68 deletions(-) diff --git a/ag/include/kampf_anzeige.inc.php b/ag/include/kampf_anzeige.inc.php index cc0e60d..852c652 100644 --- a/ag/include/kampf_anzeige.inc.php +++ b/ag/include/kampf_anzeige.inc.php @@ -14,33 +14,17 @@ function displayCharTable($charbild, $charname, $starke, $ver, $speed, $ausdauer ?> - - +
- - - Name: - -
- HP: - -
- MP: - -
- Stärke: - -
- Verteidigung: - -
- Geschwindigkeit: - -
- Glück - -
- Ausdauer: - +
Name:
HP: +
MP: +
Stärke: +
Verteidigung: +
Geschwindigkeit:
Glück +
Ausdauer:
@@ -51,33 +35,27 @@ function displayAttacks($attacke1, $schaden1, $attacke2, $schaden2){ ?> - -
- Technik: - Technik: -

- Schaden: - + ?>

+
Schaden:
- Technik: - Technik: -

- Schaden: - + ?>

+
Schaden:
@@ -174,31 +152,31 @@ echo ''; if($loge !== NULL || $steh !== NULL || $sitz !== NULL) { ?> - - - - -
- - - - - - - - - - - - - - - - - -
Zuschauer
Stehplätze
Sitzplätze
Logenplätze
-
- + + + + + + + + + + + + + + + + + + + +
Zuschauer
Stehplätze
Sitzplätze
Logenplätze
+ + + +'; } @@ -255,6 +233,8 @@ function displaySchatzSuche($char){ $char['ausdauer'] = $quest['aus']; $char['hp_max'] = $quest['hp']; $char['mp_max'] = $quest['mp']; + + $std = $quest['std']; // Erstmal die Seite starten echo ''; @@ -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); diff --git a/ag/include/schatz.inc.php b/ag/include/schatz.inc.php index 8f98554..38cca64 100644 --- a/ag/include/schatz.inc.php +++ b/ag/include/schatz.inc.php @@ -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