39 sLog.Blue(
" PlanetDataMgr",
"Planet Data Manager Initialized.");
57 sLog.Cyan(
" PlanetDataMgr",
"%u planet data groups in %u buckets loaded in %.3fms.",\
64 for (
auto it = itr.first; it != itr.second; ++it)
65 typeIDs.push_back(it->second);
87 default:
return "UnknownCommandID";
99 sLog.Blue(
" PIDataMgr",
"Planet Interaction Data Manager Initialized.");
111 std::map<uint8, PI_Schematic>::iterator itr;
112 while (res->
GetRow(row)) {
114 itr = m_schematicData.find(row.
GetInt(0));
115 if (itr != m_schematicData.end()) {
119 itr->second.outputType = row.
GetInt(1);
120 itr->second.outputQty = row.
GetInt(2);
130 m_schematicData[row.
GetInt(0)] = data;
135 while (res->
GetRow(row)) {
137 itr = m_schematicData.find(row.
GetInt(0));
138 if (itr != m_schematicData.end())
139 itr->second.cycleTime = row.
GetInt(1);
144 sLog.Cyan(
" PIDataMgr",
"%u PI Schematic data groups loaded in %.3fms.", m_schematicData.size(), (
GetTimeMSeconds() - start));
149 std::map<uint8, PI_Schematic>::iterator itr = m_schematicData.find(schematicID);
150 if (itr != m_schematicData.end()) {
154 _log(PLANET__ERROR,
"PIDataMgr::GetSchematicData() - Data not found for schematic %u", schematicID);
217 double one = ((headRadius - 0.01f) /0.04);
218 length = one * 335 + 1;
219 double two = log2(length /25);
220 cycleTime =
EvE::max(floor(two) + 1);
221 cycleTime = 0.25 * (pow(2, cycleTime));
222 numCycles = (
uint16)(length / cycleTime);
225 uint32 qtyPerCycle = GetProgramOutput(iRef, iCycleTime);
228 _log(PLANET__TRACE,
"PlanetMgr::GetProgramResultInfo() - cycleTime:%.2f, iCycleTime:%li, length:%.2f, numCycles:%u, qtyPerCycle:%u, heads: %u, headRadius:%.4f", \
229 cycleTime, iCycleTime, length, numCycles, qtyPerCycle, heads->
size(), headRadius);
232 res->SetItem(0,
new PyInt(qtyPerCycle));
233 res->SetItem(1,
new PyLong(iCycleTime));
234 res->SetItem(2,
new PyInt(numCycles));
237 res->Dump(PLANET__RES_DUMP,
" ");
239 pColony->
SetProgramResults(pinID, typeID, numCycles, headRadius, cycleTime, qtyPerCycle);
270 if (currentTime == 0)
275 float t = (cycleNum + 0.5f) * barWidth;
291 return uint32(barWidth * 1000);
299 for (
int i=1; i <= numCycles; ++i)
300 val += GetProgramOutput(iRef, cycleTime, i * cycleTime);
306 if (qtyPerCycle == 0)
318 switch (programType) {
319 case 2268:
return 2409;
320 case 2267:
return 2430;
321 case 2270:
return 2435;
322 case 2073:
return 2449;
323 case 2288:
return 2459;
327 switch (programType) {
328 case 2268:
return 2416;
329 case 2309:
return 2424;
330 case 2310:
return 2426;
331 case 2311:
return 2427;
332 case 2267:
return 2433;
336 switch (programType) {
337 case 2268:
return 2415;
338 case 2310:
return 2423;
339 case 2073:
return 2432;
340 case 2286:
return 2438;
341 case 2272:
return 2441;
345 switch (programType) {
346 case 2308:
return 2418;
347 case 2267:
return 2428;
348 case 2272:
return 2439;
349 case 2306:
return 2442;
350 case 2307:
return 2448;
354 switch (programType) {
355 case 2268:
return 2414;
356 case 2287:
return 2458;
357 case 2286:
return 2452;
358 case 2288:
return 2461;
359 case 2073:
return 2451;
363 switch (programType) {
364 case 2308:
return 2417;
365 case 2267:
return 2429;
366 case 2270:
return 2434;
367 case 2272:
return 2440;
368 case 2306:
return 2443;
372 switch (programType) {
373 case 2268:
return 2413;
374 case 2308:
return 2419;
375 case 2309:
return 2422;
376 case 2310:
return 2425;
377 case 2267:
return 2431;
381 switch (programType) {
382 case 2268:
return 2412;
383 case 2073:
return 2450;
384 case 2287:
return 2453;
385 case 2288:
return 2460;
386 case 2305:
return 2462;
390 _log(PLANET__ERROR,
"PIDataMgr::GetHeadType() - Extractor typeID not found using ECU typeID: %u and Resource typeID: %u", ecuTypeID, programType);
495 _log(PLANET__ERROR,
"PIDataMgr::GetProductLevel() - Commodity product level not found for typeID: %u", typeID);
504 case 2267:
return "Base Metals";
505 case 2270:
return "Noble Metals";
506 case 2272:
return "Heavy Metals";
507 case 2306:
return "Non-CS Crystals";
508 case 2307:
return "Felsic Magma";
509 case 2268:
return "Aqueous Liquids";
510 case 2308:
return "Suspended Plasma";
511 case 2309:
return "Ionic Solutions";
512 case 2310:
return "Noble Gas";
513 case 2311:
return "Reactive Gas";
514 case 2073:
return "Microorganisms";
515 case 2286:
return "Planktic Colonies";
516 case 2287:
return "Complex Organisms";
517 case 2288:
return "Carbon Compounds";
518 case 2305:
return "Autotrophs";
520 case 2389:
return "Plasmoids";
521 case 2390:
return "Electrolytes";
522 case 2392:
return "Oxidizing Compound";
523 case 2393:
return "Bacteria";
524 case 2395:
return "Proteins";
525 case 2396:
return "Biofuels";
526 case 2397:
return "Industrial Fibers";
527 case 2398:
return "Reactive Metals";
528 case 2399:
return "Precious Metals";
529 case 2400:
return "Toxic Metals";
530 case 2401:
return "Chiral Structures";
531 case 3779:
return "Biomass";
532 case 9828:
return "Silicon";
533 case 3683:
return "Oxygen";
534 case 3645:
return "Water";
536 case 44:
return "Enriched Uranium";
537 case 2312:
return "Supertensile Plastics";
538 case 2317:
return "Oxides";
539 case 2319:
return "Test Cultures";
540 case 2321:
return "Polyaramids";
541 case 2327:
return "Microfiber Shielding";
542 case 2328:
return "Water-Cooled CPU";
543 case 2329:
return "Biocells";
544 case 2463:
return "Nanites";
545 case 3689:
return "Mechanical Parts";
546 case 3691:
return "Synthetic Oil";
547 case 3693:
return "Fertilizer";
548 case 3695:
return "Polytextiles";
549 case 3697:
return "Silicate Glass";
550 case 3725:
return "Livestock";
551 case 3775:
return "Viral Agent";
552 case 3828:
return "Construction Blocks";
553 case 9830:
return "Rocket Fuel";
554 case 9832:
return "Coolant";
555 case 9836:
return "Consumer Electronics";
556 case 9838:
return "Superconductors";
557 case 9840:
return "Transmitter";
558 case 9842:
return "Miniature Electronics";
559 case 15317:
return "Genetically Enhanced Livestock";
561 case 2344:
return "Condensates";
562 case 2345:
return "Camera Drones";
563 case 2346:
return "Synthetic Synapses";
564 case 2348:
return "Gel-Matrix Biopaste";
565 case 2349:
return "Supercomputers";
566 case 2351:
return "Smartfab Units";
567 case 2352:
return "Nuclear Reactors";
568 case 2354:
return "Neocoms";
569 case 2358:
return "Biotech Research Reports";
570 case 2360:
return "Industrial Explosives";
571 case 2361:
return "Hermetic Membranes";
572 case 2366:
return "Hazmat Detection Systems";
573 case 2367:
return "Cryoprotectant Solution";
574 case 9834:
return "Guidance Systems";
575 case 9846:
return "Planetary Vehicles";
576 case 9848:
return "Robotics";
577 case 12836:
return "Transcranial Microcontrollers";
578 case 17136:
return "Ukomi Superconductors";
579 case 17392:
return "Data Chips";
580 case 17898:
return "High-Tech Transmitters";
581 case 28974:
return "Vaccines";
583 case 2867:
return "Broadcast Node";
584 case 2868:
return "Integrity Response Drones";
585 case 2869:
return "Nano-Factory";
586 case 2870:
return "Organic Mortar Applicators";
587 case 2871:
return "Recursive Computing Module";
588 case 2872:
return "Self-Harmonizing Power Core";
589 case 2875:
return "Sterile Conduits";
590 case 2876:
return "Wetware Mainframe";
592 _log(PLANET__ERROR,
"PIDataMgr::GetProductName() - Commodity product not found for typeID: %u", typeID);
#define _log(type, fmt,...)
const char * GetProductName(uint16 typeID)
int32 GetInt(uint32 index) const
void GetSchematicData(DBQueryResult &res)
std::unordered_multimap< uint32, uint32 > m_planetData
uint32 GetMaxOutput(InventoryItemRef iRef, uint32 qtyPerCycle=0, int64 cycleTime=0)
uint8 GetProductLevel(uint16 typeID)
void SafeDelete(T *&p)
Deletes and nullifies a pointer.
bool GetRow(DBResultRow &into)
bool GetBool(uint32 index) const
std::map< uint16, uint16 > inputs
#define is_log_enabled(type)
#define sLog
Evaluates to a NewLog instance.
uint16 GetHeadType(uint16 ecuTypeID, uint16 programType)
const char * GetCommandName(int8 commandID)
uint32 GetProgramOutputPrediction(InventoryItemRef iRef, int64 cycleTime, uint32 numCycles=0)
void GetPlanetData(uint32 planetID, std::vector< uint16 > &typeIDs)
PyRep * GetProgramResultInfo(Colony *pColony, uint32 pinID, uint16 typeID, PyList *heads, float headRadius)
uint32 GetProgramOutput(InventoryItemRef iRef, int64 cycleTime, int64 startTime=0, int64 currentTime=0)
int64 max(int64 x, int64 y=0)
EvilNumber GetAttribute(const uint16 attrID) const
void GetSchematicData(uint8 schematicID, PI_Schematic &data)
void GetPlanetData(DBQueryResult &res)
void GetSchematicTimes(DBQueryResult &res)
void SetProgramResults(uint32 ecuID, uint16 typeID, uint16 numCycles, float headRadius, float cycleTime, uint32 qtyPerCycle)
static uint32 currentTime