EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PlanetMgr.h
Go to the documentation of this file.
1 
10 #ifndef EVEMU_PLANET_PLANETMGR_H_
11 #define EVEMU_PLANET_PLANETMGR_H_
12 
13 #include "planet/PlanetDB.h"
14 #include "planet/PlanetDataMgr.h"
15 
16 
17 class Client;
18 class Colony;
19 class PlanetSE;
20 class UUNCommand;
21 class UUNCommandList;
22 class PyServiceMgr;
23 class PlanetMgr
24 {
25 public:
26  PlanetMgr(PyServiceMgr *mgr, Client* pClient, PlanetSE* pPlanet, Colony* pColony);
27  virtual ~PlanetMgr() { /* do nothing here */ }
28 
29  PyRep* UpdateNetwork(UUNCommandList& uuncl);
30 
31 protected:
32  bool CreatePin(UUNCommand& nc);
33  void RemovePin(UUNCommand& nc);
34  void CreateLink(UUNCommand& nc);
35  void RemoveLink(UUNCommand& nc);
36  void SetLinkLevel(UUNCommand& nc);
37  void CreateRoute(UUNCommand& nc);
38  void RemoveRoute(UUNCommand& nc);
39  void SetSchematic(UUNCommand& nc);
40  bool UpgradeCommandCenter(UUNCommand& nc);
41  void AddExtractorHead(UUNCommand& nc);
42  void KillExtractorHead(UUNCommand& nc);
43  void MoveExtractorHead(UUNCommand& nc);
44  void InstallProgram(UUNCommand& nc);
45  void PrioritizeRoute(UUNCommand& nc);
46 
47 private:
52 
54 };
55 
56 
57 #endif // EVEMU_PLANET_PLANETMGR_H_
58 
59 /*
60  * qtyToDistribute, cycleTime, numCycles = self.remoteHandler.GetProgramResultInfo(pinID, typeID, pin.heads, headRadius)
61  * qtyToRoute = pin.GetMaxOutput(qtyToDistribute, cycleTime)
62  *
63  * def GetMaxOutput(self, baseOutput = None, cycleTime = None):
64  * if baseOutput is None:
65  * baseOutput = self.qtyPerCycle
66  * if cycleTime is None:
67  * cycleTime = self.cycleTime
68  * scalar = self.GetAttribute(const.attributeEcuNoiseFactor) + 1
69  * return int(scalar * baseOutput) * cycleTime / SEC / 900.0
70  *
71  *
72  *
73  outputVals = GetProgramOutputPrediction(maxValue, cycleTime, numCycles)
74  totalOutput = sum(outputVals)
75  perHourOutput = float(totalOutput) * HOUR / (numCycles * cycleTime)
76 
77  * def GetProgramOutput(self, currentTime, baseValue = None, cycleTime = None, startTime = None):
78  * if baseValue is None:
79  * baseValue = self.qtyPerCycle
80  * if cycleTime is None:
81  * cycleTime = self.cycleTime
82  * if startTime is None:
83  * startTime = self.installTime
84  * decayFactor = self.GetAttribute(const.attributeEcuDecayFactor)
85  * noiseFactor = self.GetAttribute(const.attributeEcuNoiseFactor)
86  * timeDiff = currentTime - startTime
87  * cycleNum = max((timeDiff + const.SEC) / cycleTime - 1, 0)
88  * barWidth = cycleTime / SEC / 900.0
89  * t = (cycleNum + 0.5) * barWidth
90  * decayValue = baseValue / (1 + t * decayFactor)
91  * f1 = 1.0 / 12
92  * f2 = 1.0 / 5
93  * f3 = 1.0 / 2
94  * phaseShift = baseValue ** 0.7
95  * sinA = math.cos(phaseShift + t * f1)
96  * sinB = math.cos(phaseShift / 2 + t * f2)
97  * sinC = math.cos(t * f3)
98  * sinStuff = (sinA + sinB + sinC) / 3
99  * sinStuff = max(0, sinStuff)
100  * barHeight = decayValue * (1 + noiseFactor * sinStuff)
101  * return int(barWidth * barHeight)
102  *
103  * def GetProgramOutputPrediction(self, baseValue, cycleTime, length):
104  * vals = [] (python list)
105  * startTime = 0
106  * for i in xrange(length):
107  * currentTime = (i + 1) * cycleTime
108  * vals.append(self.GetProgramOutput(currentTime, baseValue, cycleTime, startTime))
109  *
110  * return vals
111  */
Base Python wire object.
Definition: PyRep.h:66
void InstallProgram(UUNCommand &nc)
Definition: PlanetMgr.cpp:397
PlanetSE * m_planet
Definition: PlanetMgr.h:51
Client * m_client
Definition: PlanetMgr.h:49
void SetSchematic(UUNCommand &nc)
Definition: PlanetMgr.cpp:360
bool CreatePin(UUNCommand &nc)
Definition: PlanetMgr.cpp:115
void AddExtractorHead(UUNCommand &nc)
Definition: PlanetMgr.cpp:371
PyRep * UpdateNetwork(UUNCommandList &uuncl)
Definition: PlanetMgr.cpp:37
void KillExtractorHead(UUNCommand &nc)
Definition: PlanetMgr.cpp:410
void SetLinkLevel(UUNCommand &nc)
Definition: PlanetMgr.cpp:353
virtual ~PlanetMgr()
Definition: PlanetMgr.h:27
void CreateRoute(UUNCommand &nc)
Definition: PlanetMgr.cpp:297
void CreateLink(UUNCommand &nc)
Definition: PlanetMgr.cpp:250
Definition: Colony.h:38
Colony * m_colony
Definition: PlanetMgr.h:50
PlanetDB m_db
Definition: PlanetMgr.h:53
void PrioritizeRoute(UUNCommand &nc)
Definition: PlanetMgr.cpp:415
void RemoveLink(UUNCommand &nc)
Definition: PlanetMgr.cpp:328
Definition: Client.h:66
void RemovePin(UUNCommand &nc)
Definition: PlanetMgr.cpp:311
void RemoveRoute(UUNCommand &nc)
Definition: PlanetMgr.cpp:336
PlanetMgr(PyServiceMgr *mgr, Client *pClient, PlanetSE *pPlanet, Colony *pColony)
Definition: PlanetMgr.cpp:29
bool UpgradeCommandCenter(UUNCommand &nc)
Definition: PlanetMgr.cpp:78
PyServiceMgr * m_svcMgr
Definition: PlanetMgr.h:48
void MoveExtractorHead(UUNCommand &nc)
Definition: PlanetMgr.cpp:384