Name:
HP:
MP:
Stärke:
Verteidigung:
Geschwindigkeit:
Glück
Ausdauer:
Technik:

Schaden:
Technik:

Schaden:
'; echo '
'; echo '' . ''. ''; echo '
Der Fight existiert nicht oder hat noch nicht angefangen!
'; echo ''; } function displayFightIsOngoing($char1_name, $char2_name) { echo ''; echo '
'; echo '' . ''. ''; echo '' . ''. ''. ''. '' . ''; echo '
Der Fight läuft noch!
'.$char1_status.'???'.$char2_status.'???
'; echo ''; } function displaySummary($char1_name, $char2_name, $sieger, $exp_char1, $exp_char2, $money_char1, $money_char2, $arena_exp1 = NULL, $arena_exp2 = NULL, $loge = NULL, $sitz = NULL, $steh = NULL){ echo ''; echo '
'; if($sieger == $char1_name){ $char1_status = 'Sieger'; $char2_status = 'Verlierer'; } else{ $char1_status = 'Verlierer'; $char2_status = 'Sieger'; } echo '' . ''. ''. ''. '' . ''; if($exp_char1 !== NULL || $exp_char2 !== NULL) { echo '' . '' . '' . '' . ''. ''; } if($money_char1 !== NULL || $money_char2 !== NULL) { echo ''. ''. ''. ''. '' . ''; } if($arena_exp1 !== NULL || $arena_exp2 !== NULL) { echo ''. ''. ''. ''. '' . ''; } echo '
'.$char1_status.''.$char1_name.''.$char2_status.''.$char2_name.'
Exp +'.$exp_char1.'Exp +'.$exp_char2.'
Geld +'.$money_char1.'Geld +'.$money_char2.'
Arena Exp +'.$arena_exp1.'Arena Exp +'.$arena_exp2.'
'; if($loge !== NULL || $steh !== NULL || $sitz !== NULL) { ?>
Zuschauer
Stehplätze
Sitzplätze
Logenplätze
'; } } function displayFinalResult($items, $exp, $money, $final_result){ echo '
' . ''; echo ''; if($final_result == 'lost') { echo ''; } echo '' . '' . ''. ''; echo '' . '' . ''. ''; echo '' . '' . ''; echo '
Zusammenfassung
Ihr müsst euch selbst eingestehen, dass diese Monster zu stark waren. Der Zweifel der euch plagt verringert eure Erfahrung und Diebe den Betrag in eurem Geldbeutel.
Exp +'.$exp.'
Geld +'.$money.'
Items'; // Letze Eintrag von Items ist false!! if(!$items[0]){ echo ' '; } else{ for($i=0;$items[$i];$i++){ echo $items[$i]['name'].'
'; } } echo'
' . '
'; } function displaySchatzSuche($char){ include_once(ROOT_PATH.'/include/schatz.inc.php'); // Erstmal die Schatzsuche-stammdaten laden! $sql = 'Select * from quests where charid ='.$char['id'].' and dauer < now()'; $quest = mysqli_fetch_assoc(db_query($sql)); // echo $sql.'
'; if(!$quest){ return 'Schatzsuche noch nicht beendet!!'; } // Uberschreibe die Char-Daten mit den Daten aus der Datenbank $char['starke'] = $quest['st']; $char['verteidigung'] = $quest['ver']; $char['speed'] = $quest['sp']; $char['glueck'] = $quest['gl']; $char['ausdauer'] = $quest['aus']; $char['hp_max'] = $quest['hp']; $char['mp_max'] = $quest['mp']; $std = $quest['std']; // Erstmal die Seite starten echo ''; // Einfach mal ne dicke Ueberschrift $ort = mysqli_fetch_assoc(db_query('select * from quest_ort where id = '.$quest['ortid'])); echo ''; // Hole die Ergebnisse die auch in die Datenbank eingetragen werden muessen! $row = mysqli_fetch_assoc(db_query('Select sum(exp) as exp, sum(geld) as geld, count(*) as anzahl from quest_fights where charid = '.$char['id'])); // Ermittle den Endzustand des Chars $end_qf = mysqli_fetch_assoc(db_query('select max(fightnr) as mf from quest_fights where charid = '.$char['id'])); $end_qr = mysqli_fetch_assoc(db_query('select max(roundnr) as mr from quest_rounds where fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); $last_round = mysqli_fetch_assoc(db_query('Select * from quest_rounds where roundnr = '.$end_qr['mr'].' and fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); $last_fight = mysqli_fetch_assoc(db_query('Select * from quest_fights where fightnr = '.$end_qf['mf'].' and charid = '.$char['id'])); // Ermittle die Reqs des Chars! $sql = 'SELECT c_attack as a_name, count(*) as anzahl FROM quest_rounds q where roundnr > 0 and charid = '.$char['id'].' group by c_attack'; // echo $sql.'
'; $reqs = db_query($sql); while($row_r = mysqli_fetch_assoc($reqs)){ $c_attacken[] = $row_r; // print_r($c_attacken); // echo '
'; } if($last_fight['sieger'] == $char['id']){ $final_result = 'won'; // Nur wer gewinnt bekommt was! $items = getSchatzItems($row['anzahl']); for($i=0;$items[$i];$i++){ $res = db_query('Update quest_item_stats set anzahl = anzahl + 1 WHERE monster = '.$row['anzahl'].' and id = '.$items[$i]['id']); if(db_affected_rows() == 0){ // entry not yet present db_query('INSERT INTO quest_item_stats (monster, id, anzahl) values('.$row['anzahl'].', '.$items[$i]['id'].', 1)'); } } } else{ $final_result = 'lost'; $lose_rate = mt_random_wrapper(25,60)/100; $row['exp'] = round($row['exp'] * $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 = db_query('Update quest_stats set anzahl = anzahl + 1 WHERE zeit = '.$std.' AND monster = '.$row['anzahl'].' AND status = '.($final_result=='won'?1:0)); if(db_affected_rows() == 0){ db_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); // Lade nun die Fights runter $sql = 'Select * from quest_fights where charid = '.$char['id'].' ORDER BY fightnr ASC'; $qry = db_query($sql); while($fight = mysqli_fetch_assoc($qry)){ displaySchatzSucheFight($quest, $char, $fight); } submitCharChanges($char['id'], $items, $row['exp'], $row['geld'], $quest['ortid'], array($last_round['c_hp']) , array($last_round['c_mp']), $c_attacken); echo '
Schatzsuche in '.$ort['stadt'].'
'; return null; } function displaySchatzSucheFight($quest, $char, $fight){ // Lade das Monster aus der Datenbank $sql = 'select * from quest_monster where id = '.$fight['monsterid']; $monster = mysqli_fetch_assoc(db_query($sql)); if($monster['bild'] == null || $monster['bild'] == ''){ $monster['bild'] = 'design/bilder/avatare/noavart.gif'; } // Platziere den Table-Header echo ''.$char['name'].' Vs '.$monster['name'].''; $sql = 'Select * from quest_rounds where charid = '.$char['id']. ' and fightnr = '.$fight['fightnr']; // echo $sql.'
'; $qry = db_query($sql); while($round = mysqli_fetch_assoc($qry)){ displaySchatzSucheFightRound($char, $monster, $fight, $round); } displaySummary($char['name'], $monster['name'], $fight['sieger']==$char['id']?$char['name']:$monster['name'], $fight['exp'], 0, $fight['geld'], 0); // Und dann halt immer noch etwas platz nach unten lassen echo ' '; } function displaySchatzSucheFightRound($char, $monster, $fight, $round){ // Rundennummer: if($round['roundnr'] == 0){ $runde = 'Start:'; } else{ $runde = 'Runde: '.$round['roundnr']; } echo ''.$runde.''; // Bild + Avantarinfo | Attacken + Schaden | Bild + Avantarinfo // In einer Reihe allerdings echo ''; displayCharTable($char['bild'], $char['name'], $round['c_st'], $round['c_ver'], $round['c_sp'], $round['c_aus'], $round['c_gl'], $round['c_hp'], $char['hp_max'], $round['c_mp'], $char['mp_max'] ); echo ''; if($round['roundnr'] != 0){ displayAttacks($round['c_attack'], $round['c_dmg'], $round['m_attack'], $round['m_dmg']); } else{ echo ' '; } echo ''; displayCharTable($monster['bild'], $monster['name'], $round['m_st'], $round['m_ver'], $round['m_sp'], $round['m_aus'], $round['m_gl'], $round['m_hp'], $monster['hp'], $round['m_mp'], $monster['mp'] ); echo ''; } function displayEventFight($event_id, $event_fight_id) { include_once(ROOT_PATH.'/include/event.inc.php'); // for the defines :) // Erstmal die Seite starten echo ''; // :D // first readout the required event data $sql = 'SELECT *, visible <= now() as passed FROM event_fights WHERE event_id = ' . $event_id . ' AND event_fight_id = ' . $event_fight_id . ' AND `starting` <= now()'; //echo $sql . '
'; $event_fight_data = mysqli_fetch_assoc(db_query($sql)); if(!$event_fight_data){ displayFightNotAvailable(); echo '
'; return; } // Okay and now get the data of the chars ;) $sql = 'SELECT * FROM event_chars e where event_id = '.$event_id.' and event_char_id IN (SELECT event_char_id from event_fight_rounds where event_id = '.$event_id.' and event_fight_id = '.$event_fight_id.' and `round` = 0)'; // echo $sql . '
'; $qry = db_query($sql); while($row = mysqli_fetch_assoc($qry)) { if($row['char_bild'] == null || $row['char_bild'] == ''){ $row['char_bild'] = 'design/bilder/avatare/noavart.gif'; } if($event_fight_data['host'] == $row['event_char_id']) { $char1 = $row; } else { $char2 = $row; } } // Platziere den Table-Header echo ''.$char1['char_name'].' Vs '.$char2['char_name'].''; // now get the round data :D $sql = 'SELECT * from event_fight_rounds WHERE event_id = ' .$event_id . ' AND event_fight_id = ' .$event_fight_id . ' and visible <= now()'; $qry = db_query($sql); $char1_rounds = array(); $char2_rounds = array(); while($row = mysqli_fetch_assoc($qry)) { if($event_fight_data['host'] == $row['event_char_id']) { $char1_rounds[$row['round']] = $row; } else { $char2_rounds[$row['round']] = $row; } } for($i=0;$i '; echo ''; return null; } function displayEventFightRound(array $char1_data, array $char2_data, array $char1_round_data, array $char2_round_data, $roundnr) { // xD if($roundnr == 0){ $runde = 'Start:'; } else{ $runde = 'Runde: '.$roundnr; } echo ''.$runde.''; $c1_str = $char1_round_data['strength']; $c1_def = $char1_round_data['defense']; $c1_spd = $char1_round_data['speed']; $c1_stm = $char1_round_data['stamina']; $c1_lck = $char1_round_data['luck']; $c1_hp = $char1_round_data['hp']; $c1_hpMax = $char1_data['hp']; $c1_mp = $char1_round_data['mp']; $c1_mpMax = $char1_data['mp']; $c2_str = $char2_round_data['strength']; $c2_def = $char2_round_data['defense']; $c2_spd = $char2_round_data['speed']; $c2_stm = $char2_round_data['stamina']; $c2_lck = $char2_round_data['luck']; $c2_hp = $char2_round_data['hp']; $c2_hpMax = $char2_data['hp']; $c2_mp = $char2_round_data['mp']; $c2_mpMax = $char2_data['mp']; // Bild + Avantarinfo | Attacken + Schaden | Bild + Avantarinfo // In einer Reihe allerdings echo ''; displayCharTable($char1_data['char_bild'], $char1_data['char_name'], $c1_str, $c1_def, $c1_spd, $c1_stm, $c1_lck, $c1_hp, $c1_hpMax, $c1_mp, $c1_mpMax ); echo ''; if($roundnr != 0){ displayAttacks($char1_round_data['attack'], $char1_round_data['damage'], $char2_round_data['attack'], $char2_round_data['damage']); } else{ echo ' '; } echo ''; displayCharTable($char2_data['char_bild'], $char2_data['char_name'], $c2_str, $c2_def, $c2_spd, $c2_stm, $c2_lck, $c2_hp, $c2_hpMax, $c2_mp, $c2_mpMax ); echo ''; } ?>