$is_action = in_array($parser->type_id, $v->combat_actions); //Starting condition to get us in combat. if (!$v->combat && $is_action) { $v->combat = true; $encounter = new Encounter($v->timestamp, $v->line, $encounter, $v->killed_bosses); } //Handle mid-combat events. if ($v->combat) { if ($is_action && $encounter->actor($parser)) { $encounter->last_active = $v->timestamp; $encounter->last_line = $v->line; continue; } //Somebody died! if ($parser->type_id == 11) { $encounter->kill($parser->target_id); } elseif ($parser->type_id == 12) { $encounter->kill($parser->origin_id); } //Hostile action didn't happen, check for expiration of combat. if ($v->timestamp - $encounter->last_active >= 6) { $boss_id = $encounter->get_boss(); //We have met the condition to end combat. $encounter->end_combat(); //Check if we have a boss of importance. if ($boss_id !== false) { //Is this boss even alive? $alive = $encounter->is_alive($boss_id); //Snag his name. $boss_name = $encounter->get_name($boss_id); $boss_data = array('s' => $encounter->get_line(true), 'e' => $encounter->get_line(false), 'l' => $encounter->get_length(), 'w' => $alive);