|
|
@ -156,10 +156,11 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime
|
|
|
|
// first persist char1
|
|
|
|
// first persist char1
|
|
|
|
$chara_1 = $roundsArray[$round]['char1_array'];
|
|
|
|
$chara_1 = $roundsArray[$round]['char1_array'];
|
|
|
|
|
|
|
|
|
|
|
|
$visible_ts = date("Y-m-d H:i:s", ($startTimestamp + ($endTimestamp - $startTimestamp) / 10) * $round);
|
|
|
|
$visible_ts_value = $startTimestamp + (($endTimestamp - $startTimestamp) / 10) * $round;
|
|
|
|
|
|
|
|
$visible_ts = date("Y-m-d H:i:s", $visible_ts_value);
|
|
|
|
|
|
|
|
|
|
|
|
$sql = 'INSERT INTO event_fight_rounds(event_id, event_fight_id, round, event_char_id, hp, mp, strength, speed, defense, luck, stamina, attack, damage, visible)';
|
|
|
|
$sql = 'INSERT INTO event_fight_rounds(event_id, event_fight_id, round, event_char_id, hp, mp, strength, speed, defense, luck, stamina, attack, damage, visible)';
|
|
|
|
$sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_1['id'].',\''. $chara_1['hp'].'\', \''. $chara_1['mp'].'\', '. $chara_1['starke'].', '. $chara_1['speed'].', '. $chara_1['verteidigung'].', '. $chara_1['glueck'].', '. $chara_1['ausdauer'].', '. ($roundsArray[$round]['atk_char1']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char1'].'\'' ).', '. ($roundsArray[$round]['dmg_char1']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char1'].'\'' ).', \''.date("Y-m-d H:i:s", $visible_ts).'\')';
|
|
|
|
$sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_1['id'].',\''. $chara_1['hp'].'\', \''. $chara_1['mp'].'\', '. $chara_1['starke'].', '. $chara_1['speed'].', '. $chara_1['verteidigung'].', '. $chara_1['glueck'].', '. $chara_1['ausdauer'].', '. ($roundsArray[$round]['atk_char1']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char1'].'\'' ).', '. ($roundsArray[$round]['dmg_char1']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char1'].'\'' ).', \''.$visible_ts.'\')';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$res = db_query($sql);
|
|
|
|
$res = db_query($sql);
|
|
|
@ -169,7 +170,7 @@ function persistFight($event_id, array $combinedArray, $startTimestamp, $endTime
|
|
|
|
$chara_2 = $roundsArray[$round]['char2_array'];
|
|
|
|
$chara_2 = $roundsArray[$round]['char2_array'];
|
|
|
|
|
|
|
|
|
|
|
|
$sql = 'INSERT INTO event_fight_rounds(event_id, event_fight_id, round, event_char_id, hp, mp, strength, speed, defense, luck, stamina, attack, damage, visible)';
|
|
|
|
$sql = 'INSERT INTO event_fight_rounds(event_id, event_fight_id, round, event_char_id, hp, mp, strength, speed, defense, luck, stamina, attack, damage, visible)';
|
|
|
|
$sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_2['id'].',\''. $chara_2['hp'].'\', \''. $chara_2['mp'].'\', '. $chara_2['starke'].', '. $chara_2['speed'].', '. $chara_2['verteidigung'].', '. $chara_2['glueck'].', '. $chara_2['ausdauer'].', '. ($roundsArray[$round]['atk_char2']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char2'].'\'' ).', '. ($roundsArray[$round]['dmg_char2']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char2'].'\'' ).', \''.date("Y-m-d H:i:s", $visible_ts).'\')';
|
|
|
|
$sql .= ' values('.$event_id.','.$event_fight_id.','.$round.',' .$chara_2['id'].',\''. $chara_2['hp'].'\', \''. $chara_2['mp'].'\', '. $chara_2['starke'].', '. $chara_2['speed'].', '. $chara_2['verteidigung'].', '. $chara_2['glueck'].', '. $chara_2['ausdauer'].', '. ($roundsArray[$round]['atk_char2']===NULL?'NULL': '\''.$roundsArray[$round]['atk_char2'].'\'' ).', '. ($roundsArray[$round]['dmg_char2']===NULL?'NULL': '\''.$roundsArray[$round]['dmg_char2'].'\'' ).', \''.$visible_ts.'\')';
|
|
|
|
|
|
|
|
|
|
|
|
$res = db_query($sql);
|
|
|
|
$res = db_query($sql);
|
|
|
|
if(!$res)
|
|
|
|
if(!$res)
|
|
|
|