/** * Load Relics this T3Blueprint can be reverse-engineered from. * * @param \iveeCore\SDE $sde the SDE object * * @return void * @throws \iveeCore\Exceptions\TypeIdNotFoundException if expected data is not found for this typeId */ protected function loadOriginatingBlueprints(SDE $sde) { $res = $sde->query("SELECT typeID\n FROM industryActivityProducts\n WHERE activityID = 8\n AND productTypeID = " . $this->id . ';'); if ($res->num_rows < 1) { self::throwException('TypeIdNotFoundException', "Reverse Engineering data for T3Blueprint ID=" . $this->id . " not found"); } $this->inventedFrom = []; while ($row = $res->fetch_assoc()) { $this->inventedFrom[] = (int) $row['typeID']; } }
/** * Gets timestamps for latest price data generation, history data generation and most recent date with history data * from the DB. * * @param int $typeID the ID of the item * @param int $regionID the ID of the region * * @return \ArrayObject with two elements, carrying the UNIX timestamps */ protected function getTimestampsDB($typeID, $regionID) { $timestamps = array(); $res = $this->sde->query("SELECT\n UNIX_TIMESTAMP(atp.lastPriceUpdate) as lastPriceDataTS,\n UNIX_TIMESTAMP(atp.lastHistUpdate) as lastHistDataTS\n FROM iveeTrackedPrices as atp\n WHERE atp.typeID = " . (int) $typeID . " AND atp.regionID = " . (int) $regionID . ";"); if ($res->num_rows == 1) { $tmp = $res->fetch_assoc(); $timestamps[0] = (int) ($tmp['lastPriceDataTS'] > 0 ? $tmp['lastPriceDataTS'] : 0); $timestamps[1] = (int) ($tmp['lastHistDataTS'] > 0 ? $tmp['lastHistDataTS'] : 0); } else { $timestamps[0] = 0; $timestamps[1] = 0; } return new \ArrayObject($timestamps); }
/** * Loads activity times. * * @param \iveeCore\SDE $sde the SDE object * * @return void */ protected function loadActivityTimes(SDE $sde) { $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']; } }
/** * Loads stationIds in system. * * @param \iveeCore\SDE $sde the SDE object * * @return void */ protected function loadStations(SDE $sde) { $res = $sde->query("SELECT stationID\n FROM staStations\n WHERE solarSystemID = " . $this->id . " UNION DISTINCT\n SELECT facilityID as stationID\n FROM " . Config::getIveeDbName() . ".outposts\n WHERE solarSystemID = " . $this->id . ";"); while ($row = $res->fetch_assoc()) { $this->stationIds[] = $row['stationID']; } }
/** * Loads the mapping for skills to datacore or interface. * * @param \iveeCore\SDE $sde the SDE object * * @return void */ protected function loadSkillToDatacoreInterface(SDE $sde) { $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_INVENTING)->getSkills())) . ");"); $this->datacoreSkillIds = []; while ($row = $res->fetch_assoc()) { if ($row['groupID'] == 333) { $this->datacoreSkillIds[] = $row['skillID']; } elseif ($row['groupID'] == 716) { $this->encryptionSkillId = $row['skillID']; } } }