Skip to content

Commit

Permalink
Better handling of adjustments for complete raidattendance
Browse files Browse the repository at this point in the history
  • Loading branch information
GodMod committed Oct 17, 2019
1 parent ff7f065 commit 2a76abf
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 10 deletions.
22 changes: 16 additions & 6 deletions includes/rli_member.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,22 @@ public function load_members() {
}
}

if($this->config('attendance_all') && $this->raid->count_bosses($raid_id) && $this->raid->count_bosses($raid_id) === $bosscount){
$akey = $this->adj->check_adj_exists($member['name'], $this->user->lang('rli_all_bosses'), $raid_id);
if($akey !== false) {
$this->adj->update($akey, array('value' => (float)$this->config('attendance_all')));
} else {
$this->adj->add($this->user->lang('rli_all_bosses'), $member['name'], (float)$this->config('attendance_all'), $raid['event'], $raid['begin'], $raid_id);
if($this->config('attendance_all') && $this->raid->count_bosses($raid_id) && $this->raid->count_bosses($raid_id) !== $bosscount){
//Does already an adjustment exists?
$a2key = $this->adj->check_adj_exists($member['name'], $this->user->lang('rli_partial_raid'), $raid_id);
if($a2key !== false){
$arrExistingAdj = $this->adj->adjs[$a2key];
$val = $arrExistingAdj['value'];
$val -= (float)$this->config('attendance_all');
$this->adj->update($a2key, array('value' => $val));

} else {
$akey = $this->adj->check_adj_exists($member['name'], $this->user->lang('rli_missing_bosses'), $raid_id);
if($akey !== false) {
$this->adj->update($akey, array('value' => -(float)$this->config('attendance_all')));
} else {
$this->adj->add($this->user->lang('rli_missing_bosses'), $member['name'], -(float)$this->config('attendance_all'), $raid['event'], $raid['begin'], $raid_id);
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions includes/rli_raid.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ public function get_value($key, $times=false, $attdkp_force=array(-1,-1)) {
$eventdkp = $this->get_eventdkp($key, $times);
#$itemdkp = $this->get_itemdkp($key, $times);
$attdkp = $this->get_attdkp($key, $times, $attdkp_force);

if($this->config('attendance_all') && $this->count_bosses($key)){
$attdkp += (float)$this->config('attendance_all');
}

$dkp = $timedkp + $bossdkp + $eventdkp + $attdkp;
return $dkp;
}
Expand Down
4 changes: 2 additions & 2 deletions language/english/lang_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"rli_insert" => 'Insert DKP',
"rli_adjs" => 'Adjustments',
"rli_partial_raid" => 'Partial Raidattendance',
"rli_all_bosses" => 'Complete Raidattendance',
"rli_missing_bosses" => 'Partial Raidattendance (missing Bosses)',
"rli_add_raid" => 'Add raid',
"rli_add_raids" => 'Add raids',
"rli_delete_raids_warning" => 'Do you really want to delete the raid/boss?',
Expand Down Expand Up @@ -177,7 +177,7 @@
"wrong_settings_3" => '<i class="fa fa-exclamation-triangle fa-2x"></i> Wrong Settings! You cannot combine One raid per hour and per boss with no Boss- and/or Time-DKP.',
"attendance_begin" => 'Bonus for attendance during raidbegin',
"attendance_end" => 'Bonus for attendance during raidend',
"attendance_end" => 'Bonus for complete attendance (all bosskills)',
"attendance_all" => 'Bonus for complete attendance (all bosskills)',
"config_success" => 'Configuration Success',
"event_boss" => 'Exists an event for each boss?',
"event_boss_1" => 'Yes',
Expand Down
2 changes: 1 addition & 1 deletion language/german/lang_main.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
$lang['rli_insert'] = 'Raid(s) Einfügen';
$lang['rli_adjs'] = 'Korrekturen';
$lang['rli_partial_raid'] = 'Teilweise Raidteilnahme';
$lang['rli_all_bosses'] = 'Vollständige Raidteilnahme';
$lang['rli_missing_bosses'] = 'Unvollständige Raidteilnahme (fehlende Bosskills)';
$lang['rli_add_raid'] = 'Raid hinzufügen';
$lang['rli_add_raids'] = 'Raids hinzufügen';
$lang['rli_delete_raids_warning'] = 'Soll der Raid/Boss wirklich gelöscht werden?';
Expand Down
2 changes: 1 addition & 1 deletion raidlogimport_plugin_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public static function __shortcuts() {

public $vstatus = 'Stable';

public $version = '0.7.3.2'; //Version for EQdkp Plus 2.3
public $version = '0.7.3.3'; //Version for EQdkp Plus 2.3

protected static $apiLevel = 23;

Expand Down

0 comments on commit 2a76abf

Please sign in to comment.