/** * Delete one loot * @param int $item_id * @return boolean */ public function deleteloot($item_id) { global $config; $this->loot = new \bbdkp\controller\loot\Loot($item_id); $this->loot->delete_loot(); $raid = new \bbdkp\controller\raids\Raids($this->loot->raid_id); $PointsController = new \bbdkp\controller\points\PointsController($raid->event_dkpid); $PointsController->removeloot_update_dkprecord($this->loot); if ($config['bbdkp_zerosum'] == 1) { $PointsController->zero_balance_delete($this->loot); } $log_action = array('header' => 'L_ACTION_ITEM_DELETED', 'L_NAME' => $this->loot->item_name, 'L_BUYER' => $this->loot->member_name, 'L_RAID_ID' => $this->loot->raid_id, 'L_VALUE' => $this->loot->item_value); $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action)); return true; }
/** * integrates raid in bbDKP * */ private function raid_insert() { global $db, $user, $config, $phpEx, $phpbb_root_path; $RaidController = new \bbdkp\controller\raids\RaidController(); $raidinfo = array('raid_note' => $this->globalcomments[$this->batchid], 'raid_event' => $this->globalcomments[$this->batchid], 'raid_start' => $this->raidbegin, 'raid_end' => $this->raidend, 'event_id' => $this->event); foreach ($this->allplayerinfo as $playerid => $attendee) { if ($attendee['skipped'] == false) { $timebonus = 0; if (isset($this->timebonuses[$this->batchid][$attendee['playername']])) { $timebonus = (double) $this->timebonuses[$this->batchid][$attendee['playername']]; } $raiddetail[] = array('member_id' => $attendee['member_id'], 'raid_value' => (double) $this->raid_value[$this->batchid], 'time_bonus' => (double) $timebonus); } } //fill raid and raiddetail table $raid_id = $RaidController->add_raid($raidinfo, $raiddetail); //fill dkp points table with earned $PointsController = new \bbdkp\controller\points\PointsController(); $PointsController->add_points($raid_id); $log_action = array('header' => 'L_ACTION_RAID_ADDED', 'id' => $raid_id, 'L_EVENT' => $this->eventname[$this->batchid], 'L_ATTENDEES' => $this->allattendees[$this->batchid], 'L_NOTE' => $this->globalcomments[$this->batchid], 'L_VALUE' => $this->raid_value[$this->batchid], 'L_ADDED_BY' => $user->data['username']); $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action)); // commit $db->sql_transaction('commit'); return $raid_id; }