-
Notifications
You must be signed in to change notification settings - Fork 2
/
MiningScanner.cpp
141 lines (125 loc) · 4.45 KB
/
MiningScanner.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include "stdafx.h"
#include "MiningScanner.h"
#include "ScanMenu.h"
using namespace Simulator;
MiningScanner::MiningScanner(int john)
{
power = john;
}
MiningScanner::~MiningScanner()
{
}
bool MiningScanner::OnHit(cSpaceToolData* pTool, const Vector3& position, SpaceToolHit hitType, int) {
return false;
}
bool MiningScanner::Update(cSpaceToolData* pTool, bool showErrors, const char16_t** ppFailText)
{
if (pTool->mRechargeTimer.IsRunning() == true)
{
if (pTool->mRechargeTimer.GetElapsed().LowPart >= pTool->mRechargeRate * 1000)
{
ScanMenuA.CloseScan(true);
pTool->mRechargeTimer.Stop();
}
}
if ((GetCurrentContext() == SpaceContext::Planet || GetCurrentContext() == SpaceContext::SolarSystem) && pTool->mRechargeTimer.IsRunning() == false && GetActivePlanetRecord() != nullptr) {
return true;
}
else {
return false;
}
}
bool MiningScanner::OnSelect(cSpaceToolData* pTool)
{
vector<uint32_t> gaksterrific;
if ((GetActivePlanetRecord()->mTemperatureScore) >= 0.75) { //Kamacite
gaksterrific.push_back(id("spice_drt_kamacite"));
/// App::ConsolePrintF("your dirt is: kamacite");
}
else if ((GetActivePlanetRecord()->mAtmosphereScore) >= 0.90) { //Sulphide
gaksterrific.push_back(id("spice_drt_sulphide"));
/// App::ConsolePrintF("your dirt is: sulphide");
}
else if ((GetActivePlanetRecord()->mTemperatureScore) <= 0.25) { //Ice
gaksterrific.push_back(id("spice_drt_ice"));
// App::ConsolePrintF("your dirt is: ice");
}
else if ((GetActivePlanetRecord()->mAtmosphereScore) <= 0.20) { //Silica
gaksterrific.push_back(id("spice_drt_silica"));
// App::ConsolePrintF("your dirt is: silica");
}
else { //Carbon
gaksterrific.push_back(id("spice_drt_carbon"));
// App::ConsolePrintF("your dirt is: carbon");
}
const PlanetID mario = GetActivePlanetRecord()->GetID();
uint32_t greg = mario.internalValue;
Math::RandomNumberGenerator rng(greg);
int chud = rng.RandomInt(16);
if (chud >= 0 && chud <= 4) { //Copper
// App::ConsolePrintF("your mineral is: copper");
gaksterrific.push_back(id("spice_mat_copper"));
}
else if (chud >= 5 && chud <= 8) { //Titanium
// App::ConsolePrintF("your mineral is: titanium");
gaksterrific.push_back(id("spice_mat_titanium"));
}
else if (chud >= 9 && chud <= 13) { //Gold
// App::ConsolePrintF("your mineral is: gold");
gaksterrific.push_back(id("spice_mat_gold"));
}
else { //Latticine (le epic roomroot mineral :trolling:)
// App::ConsolePrintF("your mineral is: roomroot");
gaksterrific.push_back(id("spice_mat_latticine"));
}
if (power > 1) {
Math::RandomNumberGenerator rng(greg);
chud = rng.RandomInt(37);
if (chud >= 0 && chud <= 15) {
gaksterrific.push_back(id("spice_mat_crude"));
}
else if (chud >= 16 && chud <= 22) {
gaksterrific.push_back(id("spice_mat_lithium"));
}
else if (chud >= 23 && chud <= 29) {
gaksterrific.push_back(id("spice_mat_cobalt"));
}
else if (chud >= 30 && chud <= 32) {
gaksterrific.push_back(id("spice_mat_serenidite"));
}
else if (chud >= 33 && chud <= 34) {
gaksterrific.push_back(id("spice_mat_quartz"));
}
else if (chud >= 35 && chud <= 35) {
gaksterrific.push_back(id("spice_mat_amethyst"));
}
else {
gaksterrific.push_back(id("spice_mat_obsidian"));
}
}
if (power > 2) {
Math::RandomNumberGenerator rng(greg);
chud = rng.RandomInt(5);
if (chud == 0) {
gaksterrific.push_back(id("spice_mat_uranium"));
}
else if (chud == 1) {
gaksterrific.push_back(id("spice_mat_nvidium"));
}
else if (chud == 2) {
gaksterrific.push_back(id("spice_mat_diamond"));
}
else if (chud == 3) {
gaksterrific.push_back(id("spice_mat_zurg"));
}
else {
gaksterrific.push_back(id("spice_mat_flesh"));
}
}
ScanMenuA.OpenScan(true);
ScanMenuA.AddResources(gaksterrific);
pTool->mbIsActive = false;
pTool->mbIsInUse = false;
pTool->mRechargeTimer.Start();
return false;
}