protected function _runFit(fit $fit) { if (in_array($fit->getPointCategoryName(), array('Tech 1 Support Cruiser', 'Logistics Cruiser'))) { return $fit->getQuantity() <= 1; } if ($fit->getPointCategoryName() == 'Tech 1 support frigate') { return $fit->getQuantity() <= 2; } return true; }
public function updateFit($EFTFit, $desc, $quantity, $setupId, $fitId) { $fitModel = $this->model->getModel('fit'); $fitRow = $fitModel->getFit($fitId); $fit = new fit($fitRow['typeName'], $fitRow['name'], $fitRow['shiptypeId'], $fitRow['groupName'], $this->user->getId(), $desc, $fitRow['id'], $fitRow['publishDate'], $fitRow['updateDate']); $fit->setQuantity($quantity); $fit->parseEFT($EFTFit, $this->model); $fit->setNeedsSave(true); $this->getSetup($setupId)->replaceFit($fitId, $fit); $this->save(); }
protected function _runFit(fit $fit) { $fitSlots = $fit->getSlots(); if (!isset($fitSlots['Rig'])) { return true; } foreach ($fitSlots['Rig'] as $rig) { if (strstr($rig->getName(), ' II')) { return false; } } return true; }
protected function _runFit(fit $fit) { $fitModules = $fit->getModuleNames(); $items = array(); if (isset($this->options['moduleGroup'])) { $moduleGroup = $this->options['moduleGroup']; $rows = $this->model->getModel('item')->getItemsByGroup($moduleGroup); foreach ($rows as $row) { $items[] = $row['typeName']; } } foreach ($fitModules as $module) { if (in_array($module, $items)) { return false; } } return true; }
protected function _runFit(fit $fit) { $found = array(); $fitModules = $fit->getModuleNames(); if (isset($this->options['moduleGroup'])) { $moduleGroup = $this->options['moduleGroup']; $rows = $this->model->getModel('item')->getItemsByGroup($moduleGroup); foreach ($rows as $row) { $items[] = $row['typeName']; } foreach ($fitModules as $moduleName) { if (in_array($moduleName, $items)) { $found[$moduleName]++; } } foreach ($found as $qty) { if ($qty > 1) { return false; } } } if (isset($this->options['modules'])) { foreach ($this->options['modules']['module'] as $module) { $found[$module] = 0; foreach ($fitModules as $moduleName) { if ($moduleName == $module) { $found[$module]++; } } if ($found[$module] > 1) { return false; } } } return true; }
protected function getPointCategory(fit $fit) { foreach ($this->points as $pointGroup) { if (isset($pointGroup['ships'][$fit->getTypeId()])) { return $pointGroup; } } return -1; }
/** * Retrieves fits from the database or session depending on if the user is loggedin * @return array */ public function getSetups() { $setups = array(); if ($this->loggedin) { // Get setups /** @var setupModel $setupModel */ $setupModel = $this->model->getModel('setup'); $setupRows = $setupModel->getSetups(); foreach ($setupRows as $setupRow) { $setups[$setupRow['id']] = new setup((int) $setupRow['id'], $setupRow['name'], $setupRow['description'], $setupRow['userId'], $setupRow['username'], $setupRow['publishDate'], $setupRow['updateDate']); } // Get fits and assign them to the correct setup /** @var fitModel $fitModel */ $fitModel = $this->model->getModel('fit'); $fitRows = $fitModel->getFits(); foreach ($fitRows as $fitRow) { $fit = new fit($fitRow['typeName'], $fitRow['name'], $fitRow['shiptypeId'], $fitRow['groupName'], $this->getId(), $fitRow['description'], $fitRow['id'], $fitRow['publishDate'], $fitRow['updateDate']); $fit->setQuantity($fitRow['qty']); $fit->parseEFT($fitRow['EFTData'], $this->model); if (isset($setups[$fitRow['setupId']])) { $setups[$fitRow['setupId']]->addFit($fit); } } } return $setups; }