/
api.txt
304 lines (273 loc) · 10.2 KB
/
api.txt
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
POST http://triton.ironhelmet.com/grequest/order
Cookie: ???
Content-Type: application/x-www-form-urlencoded
Form data:
type: order
order: full_universe_report
game_number: GAME_NUMBER
Returns 200, JSON:
{
event: "order:full_universe",
report: {
admin: player index of game admin
fleet_speed: float, invariant. Ship movement speed in units/hr
fleets: {fleet_id: fleet object} (visible fleets only)
game_over: int (observed: 0 for running game. assumed: 1 for finished game)
name: string game name
now: int, believed to be epoch time in milliseconds
paused: bool, indicates if game is paused
player_uid: player index of player that requested this info
players: {player index: player object}
production_counter: int, unknown (hypothesis: number of ticks elapsed this production cycle)
production_rate: int, unknown (invariant?) (hypothesis: number of ticks per production cycle)
productions: int, hypothesis: number of complete production cycles
stars: {star_id: star object}
stars_for_victory: int. invariant. number of stars needed to win.
start_time: int, believed to be game start time in epoch time in milliseconds
started: bool. assumed to be true for started games, else false
starting_bonus: int, invariant. Cash bonus joining player gets per player already joined.
Is gone - presumedly because other stars are invisible until player joins.
tick: int. assumed to be tick number, ie. the number of completed ticks since game start.
tick_fragment: int. ???. Might be number of minutes currently through tick.
tick_rate: int. assumed to be invariant, minutes per tick
total_stars: int. invariant. total stars in galaxy.
trade_cost: int. assumed to be cash cost per tech level in tech trades
turn_based: int. assumed invariant, observed: 0. assumed: 1 for turn-based games.
turn_based_time_out: int. assumed to be hours (or minutes?) time out in a turn-based game.
war: int. unknown. observed: 0
}
}
Fleet object: {
lx: string float. Describes a point behind the ship (assume always 1ly behind?),
indicating direction of travel. If not travelling, equal to current position.
ly: string float. See lx.
x: string float. Current x coordinate.
y: string float. Current y coordinate.
n: string. fleet name.
p: list of star ids, describing planned path. Changed? (seems to be no longer present)
puid: player index of owner.
st: number of ships in fleet
uid: fleet id. int. appears sequential from game start, across all players.
w: int. unknown. observed: 0
ouid: star id of star fleet is currently orbiting. not present while fleet in transit.
l: Unknown. Observed: 0
o: Orders. List of tuples (delay, star_id, action, num_ships)
Appears to be 0 for all but star_id if not owned by calling player.
Observed actions:
0: "Do nothing"
1: "Collect All Ships"
2: "Drop All Ships"
3: "Collect N Ships"
4: "Drop N Ships"
5: "Collect all but N Ships"
6: "Drop all but N Ships"
7: "Garrison Star with N Ships"
}
Player object: {
alias: string, player name
avatar: int, identifies player avatar image
ai: int. observed: 0 (normal)
conceded: int. observed: 0 (normal), 2 (AFK), 3 (KO)
huid: int. seems to be uid + 1. might mean "human uid" ?
edit: observed (uid, huid) = (3, 7). So unknown.
karma_to_give: int. karma points not already given.
missed_turns: int. only observed so far as 0, may be related to turn-based games or to marking of AFK.
ready: int. assumed to be 0 for players not marked ready, 1 for players marked ready in turn-based games.
tech: {tech name: tech object}
total_economy: as expected.
total_fleets: as expected.
total_industry: as expected.
total_science: as expected.
total_stars: as expected. conceded players have 0 for this value.
total_strength: total ships.
uid: player index.
user_id: string. observed to be 21 characters and numeric, this seems to be a true unique id for a user.
ONLY PRESENT FOR THE PLAYER WHICH REQUESTED THE INFO:
cash: int. amount of cash available.
researching: name of tech currently researching
researching_next: name of tech to research next
New:
war: dict of {(0 to 7): 3}. No other values observed.
countdown_to_war: As war, but values are 0.
}
Tech names are as follows:
"banking", "manufacturing", "propulsion" (range), "research" (experiementation),
"scanning", "terraforming", "weapons"
Tech object: {
level: Player's current tech level in this tech
value: Seems related to tech level.
ONLY PRESENT FOR THE PLAYER WHICH REQUESTED THE INFO:
sv: unknown. Observed: 0
research: current number of research points in this tech
bv: unknown. might be "base value"? observed: 1
brr: number of research points needed to complete FIRST level. Actual points required = level * brr
}
Star object: {
n: string. Star name
puid: Owning player index. -1 if not owned.
uid: Star id. Numeric. First N stars are player homeworlds, in player index order.
v: string. Visible flag. "0" if not visible, "1" if visible.
x: string float. X coordinate of star
y: string float. Y coordinate of star
ONLY PRESENT IF STAR IS VISIBLE:
c: float. Might be number of carriers. (edit: It is not. Still 0 when orbiting carrier present)
e: Economy present. 0 if unoccupied.
g: Garrison value. 0 if unoccupied.
ga: ??? Might be "number of filled garrison spots"
i: industry present. 0 if unoccupied.
nr: Natural resources.
r: Total resources (after terraforming)
s: Science present. 0 if unoccupied.
st: Ships present. 0 if unoccupied.
v: Unknown. Observed: 1
}
A note on coordinates:
All coordinates are based on the galaxy map, with unknown origin, and unknown units.
edit: Observed scale based on comparing coord distance with in-game distance:
1u = 8ly (also interesting to note: in game figures are truncated, not rounded)
POST http://triton.ironhelmet.com/grequest/fetch_unread_count
Cookie: ???
Content-Type: application/x-www-form-urlencoded
Form data:
type: fetch_unread_count
game_number: GAME_NUMBER
Returns 200, JSON:
{
event: "message:unread_count"
report: {
diplomacy: string int, number of unread diplomacy messages
events: string int, number of unread game event messages
}
}
POST http://triton.ironhelmet.com/grequest/intel_data
Cookie: ???
Content-Type: application/x-www-form-urlencoded
Form data:
type: intel_data
game_number: GAME_NUMBER
Returns 200, JSON:
{
event: "order:intel_data"
report: {
stats: [data point object, in order from new to old]
}
}
data point object: {
tick: int tick number this data point represents
players: [player intel object, in order of player index]
}
player intel object: {
ts: Total stars
e: Total economy
i: Total industry
s: Total science
sh: Total ships
fl: Total fleets
wt: Weapons tech
bt: Banking tech
mt: Manufacturing tech
ht: Hyperspace (range) tech
st: Scanning tech
gt: General research (experimentation) tech
tt: Terraforming tech
uid: player index
}
POST http://triton.ironhelmet.com/grequest/fetch_game_messages
Cookie: ???
Content-Type: application/x-www-form-urlencoded
Form data:
type: fetch_game_message_comments
game_number: GAME_NUMBER
group: either "game_event" or "game_diplomacy"
count: number of messages to fetch (UI asks for 10)
offset: for fetching more messages past the first count
Returns 200, JSON:
{
event: "messages:new_messages"
report: {
group: as in form data
messages: [message object, ordered newest to oldest]
}
}
Common date format:
Like "Jun 11 2013 12:50:32 GMT+0000"
Seems it's always in GMT+0000
message object (only diplomacy message observed): {
activity: Date in common format, indicating last modified time of thread
comment_count: Number of comments
created: Date in common format, creation time of thread
group: "game_diplomacy"
key: string. Seems to be a unique id for the thread.
payload: {
body: string. Main message body. Special characters are html-escaped (eg. "'" for "'").
from_alias: Player name of sender
from_color: Player color of sender, as a html color code
subject: Message subject line.
to_aliases: string. Player names of players sent to. Multiple names are joined by ','.
to_colors: string. Color codes of players sent to, same order as to_aliases. Joined by ','.
to_uids: string. Player index of players sent to, same order as to_aliases. Joined by ','.
}
recipients: [user_id]. contains user_ids of all players that should see message (ie. sender+recievers). Appears sorted into player index order.
sender: user_id of sender.
status: One of "read", "unread". Indicates if calling player has read the message.
tags: []. No other values observed.
}
POST http://triton.ironhelmet.com/grequest/fetch_game_message_comments
Cookie: ???
Content-Type: application/x-www-form-urlencoded
Form data:
type: fetch_game_message_comments
message_key: key of message thread to fetch
count: number of comments to fetch
offset: for fetching more comments past the first count
game_number: GAME_NUMBER
Returns 200, JSON:
{
event: "message:new_comments"
report: {
message_key: The passed in message key
messages: [comment object, from newest to oldest]
}
}
comment object: {
body: string message text. html-escaped.
created: Comment creation time in common date format
key: The message key for the parent thread (same as passed in from form data)
sender: The user_id of the sender
}
POST http://triton.ironhelmet.com/grequest/fetch_game_message_comments
Cookie: ???
Content-Type: application/x-www-form-urlencoded
Form data:
type: create_game_message_comment
message_key: The message key to add the comment to.
body: The comment text.
game_number: GAME_NUMBER
Returns 200, JSON:
{
event: "message:comment_created"
}
POST http://triton.ironhelmet.com/grequest/order
Cookie: ???
Content-Type: application/x-www-form-urlencoded
Form data:
type: order
order: add_fleet_path,FLEET_ID,STAR_SPEC
game_number: GAME_NUMBER
action:
Modifies the given fleet as according to STAR_SPEC
STAR_SPEC should be a _ seperated list of star ids,
starting with the next one to go to (after the current in-progress leg)
and describing the waypoints from there.
If you wish to set NO path (beyond current destination), instead use:
order: clear_fleet_path,FLEET_ID
Other orders:
order: set_garrison_all,VALUE
Sets all stars garrison
order: set_garrison,STAR_ID,VALUE
Sets a star's garrison
Returns 200, JSON:
{
event: "order:ok"
report: {}
}