12 #include "gb/GB_server.h" 13 #include "gb/buffers.h" 16 #include "gb/shlmisc.h" 17 #include "gb/shootblast.h" 18 #include "gb/tweakables.h" 24 void whois(
const command_t &argv, GameObj &g) {
25 player_t Playernum = g.player;
26 governor_t Governor = g.governor;
32 if (argv.size() <= 1) {
33 whois({
"whois", std::to_string(Playernum)}, g);
38 for (size_t i = 1; i <= argv.size() - 1; i++) {
39 j = std::stoi(argv[i]);
40 if (!(j < 1 || j > numraces)) {
43 sprintf(buf,
"[%2d, %d] %s \"%s\"\n", j, Governor, Race->name,
44 Race->governor[Governor].name);
46 sprintf(buf,
"[%2d] %s\n", j, Race->name);
48 sprintf(buf,
"Identify: Invalid player number #%d. Try again.\n", j);
50 notify(Playernum, Governor, buf);
55 player_t Playernum = g.player;
56 governor_t Governor = g.governor;
60 Race = races[Playernum - 1];
63 buf,
"Income last update was: %ld\t\tCosts last update was: %ld\n",
64 Race->governor[Governor].income + Race->governor[Governor].profit_market,
65 Race->governor[Governor].maintain + Race->governor[Governor].cost_tech +
66 Race->governor[Governor].cost_market);
67 notify(Playernum, Governor, buf);
68 sprintf(buf,
" Market: %5ld\t\t\t Market: %5ld\n",
69 Race->governor[Governor].profit_market,
70 Race->governor[Governor].cost_market);
71 notify(Playernum, Governor, buf);
72 sprintf(buf,
" Taxes: %5ld\t\t\t Tech: %5ld\n",
73 Race->governor[Governor].income, Race->governor[Governor].cost_tech);
74 notify(Playernum, Governor, buf);
76 sprintf(buf,
"\t\t\t\t\t Maint: %5ld\n",
77 Race->governor[Governor].maintain);
78 notify(Playernum, Governor, buf);
79 sprintf(buf,
"You have: %ld\n", Race->governor[Governor].money);
80 notify(Playernum, Governor, buf);
83 void profile(
const command_t &argv, GameObj &g) {
84 player_t Playernum = g.player;
85 governor_t Governor = g.governor;
91 Race = races[Playernum - 1];
93 if (argv.size() == 1) {
94 sprintf(buf,
"--==** Racial profile for %s (player %d) **==--\n",
95 Race->name, Race->Playernum);
96 notify(Playernum, Governor, buf);
98 sprintf(buf,
"*** Diety Status ***\n");
99 notify(Playernum, Governor, buf);
101 sprintf(buf,
"Personal: %s\n", Race->info);
102 notify(Playernum, Governor, buf);
103 sprintf(buf,
"Default Scope: /%s/%s\n",
104 Stars[Race->governor[Governor].homesystem]->name,
105 Stars[Race->governor[Governor].homesystem]
106 ->pnames[Race->governor[Governor].homeplanetnum]);
107 notify(Playernum, Governor, buf);
108 if (Race->Gov_ship == 0)
109 sprintf(buf,
"NO DESIGNATED CAPITAL!!");
111 sprintf(buf,
"Designated Capital: #%-8lu", Race->Gov_ship);
112 notify(Playernum, Governor, buf);
113 sprintf(buf,
"\t\tRanges: guns: %5.0f\n",
115 notify(Playernum, Governor, buf);
116 sprintf(buf,
"Morale: %5ld\t\t\t\t\t space: %5.0f\n", Race->morale,
118 notify(Playernum, Governor, buf);
119 sprintf(buf,
"Updates active: %d\t\t\t\t ground: %5.0f\n\n", Race->turn,
121 notify(Playernum, Governor, buf);
122 sprintf(buf,
"%s Planet Conditions\t Sector Preferences\n",
123 Race->Metamorph ?
"Metamorphic Race\t" :
"Normal Race\t\t");
124 notify(Playernum, Governor, buf);
125 sprintf(buf,
"Fert: %3d%%\t\t Temp:\t%d\n", Race->fertilize,
127 notify(Playernum, Governor, buf);
129 "Rate: %3.1f\t\t methane %5d%%\t %-8.8s %c %3.0f%%\n",
130 Race->birthrate, Race->conditions[
METHANE],
131 Desnames[SectorType::SEC_SEA], CHAR_SEA,
132 Race->likes[SectorType::SEC_SEA] * 100.);
133 notify(Playernum, Governor, buf);
135 "Mass: %4.2f\t\t oxygen %5d%%\t %-8.8s %c %3.0f%%\n",
136 Race->mass, Race->conditions[
OXYGEN], Desnames[SectorType::SEC_GAS],
137 CHAR_GAS, Race->likes[SectorType::SEC_GAS] * 100.);
138 notify(Playernum, Governor, buf);
139 sprintf(buf,
"Fight: %d\t\t helium %5d%%\t %-8.8s %c %3.0f%%\n",
140 Race->fighters, Race->conditions[
HELIUM],
141 Desnames[SectorType::SEC_ICE], CHAR_ICE,
142 Race->likes[SectorType::SEC_ICE] * 100.);
143 notify(Playernum, Governor, buf);
145 "Metab: %4.2f\t\t nitrogen %5d%%\t %-8.8s %c %3.0f%%\n",
146 Race->metabolism, Race->conditions[
NITROGEN],
147 Desnames[SectorType::SEC_MOUNT], CHAR_MOUNT,
148 Race->likes[SectorType::SEC_MOUNT] * 100.);
149 notify(Playernum, Governor, buf);
150 sprintf(buf,
"Sexes: %1d\t\t CO2 %5d%%\t %-8.8s %c %3.0f%%\n",
151 Race->number_sexes, Race->conditions[
CO2],
152 Desnames[SectorType::SEC_LAND], CHAR_LAND,
153 Race->likes[SectorType::SEC_LAND] * 100.);
154 notify(Playernum, Governor, buf);
156 "Explore: %-3.0f%%\t\t hydrogen %5d%%\t %-8.8s %c %3.0f%%\n",
157 Race->adventurism * 100.0, Race->conditions[
HYDROGEN],
158 Desnames[SectorType::SEC_DESERT], CHAR_DESERT,
159 Race->likes[SectorType::SEC_DESERT] * 100.);
160 notify(Playernum, Governor, buf);
161 sprintf(buf,
"Avg Int: %3d\t\t sulfer %5d%%\t %-8.8s %c %3.0f%%\n",
162 Race->IQ, Race->conditions[
SULFUR],
163 Desnames[SectorType::SEC_FOREST], CHAR_FOREST,
164 Race->likes[SectorType::SEC_FOREST] * 100.);
165 notify(Playernum, Governor, buf);
167 buf,
"Tech: %-6.2f\t\t other %5d%%\t %-8.8s %c %3.0f%%\n",
168 Race->tech, Race->conditions[
OTHER], Desnames[SectorType::SEC_PLATED],
169 CHAR_PLATED, Race->likes[SectorType::SEC_PLATED] * 100.);
170 notify(Playernum, Governor, buf);
172 g.out <<
"Discoveries:";
173 if (
Crystal(Race)) g.out <<
" Crystals";
175 if (
Laser(Race)) g.out <<
" Combat Lasers";
176 if (
Cew(Race)) g.out <<
" Confined Energy Weapons";
177 if (
Vn(Race)) g.out <<
" Von Neumann Machines";
180 if (
Avpm(Race)) g.out <<
" AVPM";
181 if (
Cloak(Race)) g.out <<
" Cloaking";
182 if (
Wormhole(Race)) g.out <<
" Wormhole";
185 if (!(p = get_player(argv[1]))) {
186 sprintf(buf,
"Player does not exist.\n");
187 notify(Playernum, Governor, buf);
191 sprintf(buf,
"------ Race report on %s (%d) ------\n", r->name, p);
192 notify(Playernum, Governor, buf);
195 sprintf(buf,
"*** Deity Status ***\n");
196 notify(Playernum, Governor, buf);
199 sprintf(buf,
"Personal: %s\n", r->info);
200 notify(Playernum, Governor, buf);
201 sprintf(buf,
"%%Know: %3d%%\n", Race->translate[p - 1]);
202 notify(Playernum, Governor, buf);
203 if (Race->translate[p - 1] > 50) {
204 sprintf(buf,
"%s\t Planet Conditions\n",
205 r->Metamorph ?
"Metamorphic Race" :
"Normal Race\t");
206 notify(Playernum, Governor, buf);
207 sprintf(buf,
"Fert: %s",
Estimate_i((
int)(r->fertilize)
, Race
, p
));
208 notify(Playernum, Governor, buf);
209 sprintf(buf,
"\t\t Temp:\t%s\n",
211 notify(Playernum, Governor, buf);
212 sprintf(buf,
"Rate: %s%%",
Estimate_f(r->birthrate * 100.0
, Race
, p
));
213 notify(Playernum, Governor, buf);
215 sprintf(buf,
"Unknown Race\t\t Planet Conditions\n");
216 notify(Playernum, Governor, buf);
217 sprintf(buf,
"Fert: %s",
Estimate_i((
int)(r->fertilize)
, Race
, p
));
218 notify(Playernum, Governor, buf);
219 sprintf(buf,
"\t\t Temp:\t%s\n",
221 notify(Playernum, Governor, buf);
223 notify(Playernum, Governor, buf);
225 sprintf(buf,
"\t\t methane %4s%%\t\tRanges:\n",
227 notify(Playernum, Governor, buf);
229 notify(Playernum, Governor, buf);
230 sprintf(buf,
"\t\t oxygen %4s%%",
232 notify(Playernum, Governor, buf);
233 sprintf(buf,
"\t\t guns: %6s\n",
235 notify(Playernum, Governor, buf);
236 sprintf(buf,
"Fight: %s",
Estimate_i((
int)(r->fighters)
, Race
, p
));
237 notify(Playernum, Governor, buf);
238 sprintf(buf,
"\t\t helium %4s%%",
240 notify(Playernum, Governor, buf);
241 sprintf(buf,
"\t\t space: %6s\n",
243 notify(Playernum, Governor, buf);
245 notify(Playernum, Governor, buf);
246 sprintf(buf,
"\t\t nitrogen %4s%%",
248 notify(Playernum, Governor, buf);
249 sprintf(buf,
"\t\t ground: %6s\n",
251 notify(Playernum, Governor, buf);
252 sprintf(buf,
"Sexes: %s",
Estimate_i((
int)(r->number_sexes)
, Race
, p
));
253 notify(Playernum, Governor, buf);
254 sprintf(buf,
"\t\t CO2 %4s%%\n",
256 notify(Playernum, Governor, buf);
257 sprintf(buf,
"Explore: %s%%",
Estimate_f(r->adventurism * 100.0
, Race
, p
));
258 notify(Playernum, Governor, buf);
259 sprintf(buf,
"\t\t hydrogen %4s%%\n",
261 notify(Playernum, Governor, buf);
263 notify(Playernum, Governor, buf);
264 sprintf(buf,
"\t\t sulfer %4s%%\n",
266 notify(Playernum, Governor, buf);
268 notify(Playernum, Governor, buf);
269 sprintf(buf,
"\t\t other %4s%%",
271 notify(Playernum, Governor, buf);
272 sprintf(buf,
"\t\tMorale: %6s\n",
Estimate_i((
int)(r->morale)
, Race
, p
));
273 notify(Playernum, Governor, buf);
274 sprintf(buf,
"Sector type preference : %s\n",
275 Race->translate[p - 1] > 80 ? Desnames[r->likesbest] :
" ? ");
276 notify(Playernum, Governor, buf);
287 if (r->translate[p - 1] > 10) {
291 else if (est < 10000)
292 sprintf(
est_buf,
"%.1fK", (
double)est / 1000.);
293 else if (est < 1000000)
294 sprintf(
est_buf,
"%.0fK", (
double)est / 1000.);
296 sprintf(
est_buf,
"%.1fM", (
double)est / 1000000.);
306 if (r->translate[p - 1] > 10) {
308 if ((
int)abs(est) < 1000)
310 else if ((
int)abs(est) < 10000)
311 sprintf(
est_buf,
"%.1fK", (
double)est / 1000.);
312 else if ((
int)abs(est) < 1000000)
313 sprintf(
est_buf,
"%.0fK", (
double)est / 1000.);
315 sprintf(
est_buf,
"%.1fM", (
double)est / 1000000.);
323 k = 101 -
MIN(r->translate[p - 1], 100);
324 return ((data / k) * k);
void treasury(const command_t &, GameObj &g)
void whois(const command_t &argv, GameObj &g)
static char * Estimate_f(double, Race *, int)
void profile(const command_t &argv, GameObj &g)
double gun_range(Race *, Ship *, int)
double tele_range(int, double)
static int round_perc(int, Race *, int)
char * Estimate_i(int data, Race *r, int p)