Skip to content

Instantly share code, notes, and snippets.

@ddavaham
Created November 25, 2018 16:41
Show Gist options
  • Save ddavaham/49f5c0c0d7c9c40ef61c05708a205b40 to your computer and use it in GitHub Desktop.
Save ddavaham/49f5c0c0d7c9c40ef61c05708a205b40 to your computer and use it in GitHub Desktop.
foreach ($killmails as $killId=>$kill) {
$bpk = 0;
if ($adjustments->has('character')) {
if ($adjustments->get('character')->has($kill->character_id)) {
$bpk += $adjustments->get('character')->get($kill->character_id);
}
}
if ($adjustments->has('corporation')) {
if ($adjustments->get('corporation')->has($kill->corporation_id)) {
$bpk += $adjustments->get('corporation')->get($kill->corporation_id);
}
}
if ($adjustments->has('alliance')) {
if ($adjustments->get('alliance')->has($kill->alliance_id)) {
$bpk += $adjustments->get('alliance')->get($kill->alliance_id);
}
}
if ($adjustments->has('solar_system')) {
if ($adjustments->get('solar_system')->has($kill->solar_system_id)) {
$bpk += $adjustments->get('solar_system')->get($kill->solar_system_id);
}
}
if ($adjustments->has('constellation')) {
if ($adjustments->get('constellation')->has($kill->constellation_id)) {
$bpk += $adjustments->get('constellation')->get($kill->constellation_id);
}
}
if ($adjustments->has('region')) {
if ($adjustments->get('region')->has($kill->region_id)) {
$bpk += $adjustments->get('region')->get($kill->region_id);
}
}
if ($adjustments->has('inventory_type')) {
if ($adjustments->get('inventory_type')->has($kill->ship_type_id)) {
$bpk += $adjustments->get('inventory_type')->get($kill->ship_type_id);
}
}
if ($bpk == 0) {
$bpk = $report->bpk;
}
foreach ($kill->attackers as $attacker) {
if (!is_null($attacker->character_id) && !$payouts->has($attacker->character_id)) {
$payouts->put($attacker->character_id, collect(['payout' => 0, 'kills' => 0]));
}
$payouts->get($attacker->character_id)->put('payout', $payouts->get($attacker->character_id)->get('payout') + $bpk);
$payouts->get($attacker->character_id)->put('kills', $payouts->get($attacker->character_id)->get('kills') + 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment