/** * Constructor. Use \iveeCore\Type::getById() to instantiate Decryptor objects instead. * * @param int $id of the Decryptor object * * @return \iveeCore\Decryptor * @throws \iveeCore\Exceptions\UnexpectedDataException when loading Decryptor data fails */ protected function __construct($id) { //call parent constructor parent::__construct($id); //lookup SDE class $sdeClass = Config::getIveeClassName('SDE'); //fetch decryptor modifiers from DB $res = $sdeClass::instance()->query("SELECT\n attributeID,\n valueFloat\n FROM dgmTypeAttributes\n WHERE\n typeID = " . $this->id . "\n AND attributeID IN (1112, 1113, 1114, 1124);"); //set modifiers to object while ($row = $res->fetch_assoc()) { switch ($row['attributeID']) { case 1112: $this->probabilityModifier = (double) $row['valueFloat']; break; case 1113: $this->meModifier = (int) $row['valueFloat']; break; case 1114: $this->teModifier = (int) $row['valueFloat']; break; case 1124: $this->runModifier = (int) $row['valueFloat']; break; default: self::throwException('UnexpectedDataException', "Error loading data for Decryptor ID=" . $this->id); } } }
/** * Constructor. Use \iveeCore\Type::getById() to instantiate Reaction objects. * * @param int $id of the Reaction object * * @return Reaction * @throws Exception if typeID is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); //get data from SQL $row = $this->queryAttributes(); //set data to object attributes $this->setAttributes($row); $sdeClass = Config::getIveeClassName('SDE'); $typeClass = Config::getIveeClassName('Type'); //get reaction materials $res = $sdeClass::instance()->query('SELECT itr.input, itr.typeID, itr.quantity * IFNULL(COALESCE(dta.valueInt, dta.valueFloat), 1) as quantity FROM invTypeReactions as itr JOIN invTypes as it ON itr.typeID = it.typeID LEFT JOIN dgmTypeAttributes as dta ON itr.typeID = dta.typeID WHERE it.published = 1 AND (dta.attributeID = 726 OR dta.attributeID IS NULL) AND itr.reactionTypeID = ' . $this->id . ';'); while ($row = $res->fetch_assoc()) { if ($row['input'] == 1) { $this->cycleInputMaterials[$row['typeID']] = $row['quantity']; } else { $this->cycleOutputMaterials[$row['typeID']] = $row['quantity']; if ($typeClass::getById($row['typeID'])->isReprocessable()) { $this->isAlchemy = true; } } } }
/** * Constructor. Use \iveeCore\Type::getById() to instantiate ReactionProduct objects instead. * * @param int $id of the ReactionProduct object * * @return ReactionProduct * @throws Exception if typeID is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); $sdeClass = Config::getIveeClassName('SDE'); //fetch reactions this type can result from $res = $sdeClass::instance()->query("(SELECT reactionTypeID\n FROM invTypeReactions as itr\n JOIN invTypes as it ON it.typeID = itr.reactionTypeID\n WHERE itr.typeID = " . $this->id . "\n AND itr.input = 0\n AND it.published = 1)\n UNION\n (SELECT itr.reactionTypeID\n FROM invTypes as it\n JOIN invTypeMaterials as itm ON itm.typeID = it.typeID\n JOIN invTypeReactions as itr ON itr.typeID = it.typeID\n WHERE it.groupID = 428\n AND it.published = 1\n AND materialTypeID = " . $this->id . "\n AND itr.input = 0);"); while ($row = $res->fetch_assoc()) { $this->productOfReactionIDs[] = (int) $row['reactionTypeID']; } }
/** * Constructor. Use \iveeCore\Type::getById() to instantiate Blueprint objects instead. * * @param int $id of the Blueprint object * * @return \iveeCore\Blueprint * @throws \iveeCore\Exceptions\TypeIdNotFoundException if the typeID is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); //lookup SDE class $sdeClass = Config::getIveeClassName('SDE'); $sde = $sdeClass::instance(); //get activity material requirements, if any $res = $sde->query('SELECT activityID, materialTypeID, quantity, consume FROM industryActivityMaterials WHERE typeID = ' . $this->id . ';'); //add materials to the array if ($res->num_rows > 0) { while ($row = $res->fetch_assoc()) { $this->activityMaterials[(int) $row['activityID']][(int) $row['materialTypeID']]['q'] = (int) $row['quantity']; //to reduce memory usage the consume flag is only explicitly stored if != 1 if ($row['consume'] != 1) { $this->activityMaterials[(int) $row['activityID']][(int) $row['materialTypeID']]['c'] = (int) $row['consume']; } } } //get activity skills $res = $sde->query('SELECT activityID, skillID, level FROM industryActivitySkills WHERE typeID = ' . $this->id . ';'); //set skill data to array while ($row = $res->fetch_assoc()) { if (!isset($this->activitySkills[(int) $row['activityID']])) { $skillMapClass = Config::getIveeClassName('SkillMap'); $this->activitySkills[(int) $row['activityID']] = new $skillMapClass(); } $this->activitySkills[(int) $row['activityID']]->addSkill((int) $row['skillID'], (int) $row['level']); } //get activity times $res = $sde->query('SELECT activityID, time FROM industryActivity WHERE typeID = ' . $this->id . ';'); //set time data to array while ($row = $res->fetch_assoc()) { $this->activityTimes[(int) $row['activityID']] = (int) $row['time']; } }
/** * Constructor. Use \iveeCore\Type::getById() to instantiate Relic objects instead. * * @param int $id of the Relic object * * @return \iveeCore\Relic * @throws \iveeCore\Exceptions\TypeIdNotFoundException if the typeID is not found */ protected function __construct($id) { //call parent constructor parent::__construct($id); $sdeClass = Config::getIveeClassName('SDE'); $sde = $sdeClass::instance(); //get activity material requirements, if any $res = $sde->query('SELECT activityID, materialTypeID, quantity, consume FROM industryActivityMaterials WHERE typeID = ' . $this->id . ';'); //add materials to the array if ($res->num_rows > 0) { while ($row = $res->fetch_assoc()) { $this->activityMaterials[(int) $row['activityID']][(int) $row['materialTypeID']]['q'] = (int) $row['quantity']; //to reduce memory usage the consume flag is only explicitly stored if != 1 if ($row['consume'] != 1) { $this->activityMaterials[(int) $row['activityID']][(int) $row['materialTypeID']]['c'] = (int) $row['consume']; } } } //get activity skills $res = $sde->query('SELECT activityID, skillID, level FROM industryActivitySkills WHERE typeID = ' . $this->id . ';'); //set skill data to array while ($row = $res->fetch_assoc()) { if (!isset($this->activitySkills[(int) $row['activityID']])) { $skillMapClass = Config::getIveeClassName('SkillMap'); $this->activitySkills[(int) $row['activityID']] = new $skillMapClass(); } $this->activitySkills[(int) $row['activityID']]->addSkill((int) $row['skillID'], (int) $row['level']); } //get activity times $res = $sde->query('SELECT activityID, time FROM industryActivity WHERE typeID = ' . $this->id . ';'); //set time data to array while ($row = $res->fetch_assoc()) { $this->activityTimes[(int) $row['activityID']] = (int) $row['time']; } //get REBlueprint that can be reverse-engineered from this Relic, probabilities, result runs, decryptorGroupID //and t3 product raceID $res = $sde->query("SELECT relicProd.productTypeID as resultBpID, proba.probability,\n COALESCE(dta.valueInt, dta.valueFloat) as decryptorGroupID, relicProd.quantity, t3.raceID\n FROM dgmTypeAttributes as dta\n JOIN industryActivityMaterials as iam ON iam.materialTypeID = dta.typeID\n JOIN industryActivityProbabilities as proba ON proba.typeID = iam.typeID\n JOIN industryActivityProducts as relicProd ON relicProd.productTypeID = proba.productTypeID\n JOIN industryActivityProducts as t3BPprod ON t3BPprod.typeID = relicProd.productTypeID\n JOIN invTypes as t3 ON t3.typeID = t3BPprod.productTypeID\n WHERE attributeID = 1115\n AND iam.activityID = 7\n AND proba.activityID = 7\n AND t3BPprod.activityID = 1\n AND iam.typeID = " . $this->id . "\n AND relicProd.typeID = " . $this->id . ';'); if ($res->num_rows < 1) { self::throwException('TypeIdNotFoundException', "ReverseEngineering data for Relic ID=" . $this->id . " not found"); } while ($row = $res->fetch_assoc()) { $this->reverseEngineersBlueprintIDs[(int) $row['resultBpID']] = 1; $this->reverseEngineersBlueprintIDsByRaceID[(int) $row['raceID']][] = $row['resultBpID']; $this->reverseEngineerProbability = (double) $row['probability']; $this->decryptorGroupID = (int) $row['decryptorGroupID']; $this->reverseEngineerOutputRuns = (int) $row['quantity']; } //get the mapping for skills to datacore or interface $res = $sde->query("SELECT COALESCE(valueInt, valueFloat) as skillID, it.groupID\n FROM dgmTypeAttributes as dta\n JOIN invTypes as it ON it.typeID = dta.typeID\n WHERE dta.attributeID = 182\n AND groupID IN (333, 716)\n AND COALESCE(valueInt, valueFloat) IN (" . implode(', ', array_keys($this->getSkillMapForActivity(ProcessData::ACTIVITY_REVERSE_ENGINEERING)->getSkills())) . ");"); $this->datacoreSkillIDs = array(); while ($row = $res->fetch_assoc()) { if ($row['groupID'] == 333) { $this->datacoreSkillIDs[] = $row['skillID']; } elseif ($row['groupID'] == 716) { $this->encryptionSkillID = $row['skillID']; } } }