empire-core 0.7.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. empire_core/__init__.py +36 -0
  2. empire_core/_archive/actions.py +511 -0
  3. empire_core/_archive/automation/__init__.py +24 -0
  4. empire_core/_archive/automation/alliance_tools.py +266 -0
  5. empire_core/_archive/automation/battle_reports.py +196 -0
  6. empire_core/_archive/automation/building_queue.py +242 -0
  7. empire_core/_archive/automation/defense_manager.py +124 -0
  8. empire_core/_archive/automation/map_scanner.py +370 -0
  9. empire_core/_archive/automation/multi_account.py +296 -0
  10. empire_core/_archive/automation/quest_automation.py +94 -0
  11. empire_core/_archive/automation/resource_manager.py +380 -0
  12. empire_core/_archive/automation/target_finder.py +153 -0
  13. empire_core/_archive/automation/tasks.py +224 -0
  14. empire_core/_archive/automation/unit_production.py +719 -0
  15. empire_core/_archive/cli.py +68 -0
  16. empire_core/_archive/client_async.py +469 -0
  17. empire_core/_archive/commands.py +201 -0
  18. empire_core/_archive/connection_async.py +228 -0
  19. empire_core/_archive/defense.py +156 -0
  20. empire_core/_archive/events/__init__.py +35 -0
  21. empire_core/_archive/events/base.py +153 -0
  22. empire_core/_archive/events/manager.py +85 -0
  23. empire_core/accounts.py +190 -0
  24. empire_core/client/__init__.py +0 -0
  25. empire_core/client/client.py +459 -0
  26. empire_core/config.py +87 -0
  27. empire_core/exceptions.py +42 -0
  28. empire_core/network/__init__.py +0 -0
  29. empire_core/network/connection.py +378 -0
  30. empire_core/protocol/__init__.py +0 -0
  31. empire_core/protocol/models/__init__.py +339 -0
  32. empire_core/protocol/models/alliance.py +186 -0
  33. empire_core/protocol/models/army.py +444 -0
  34. empire_core/protocol/models/attack.py +229 -0
  35. empire_core/protocol/models/auth.py +216 -0
  36. empire_core/protocol/models/base.py +403 -0
  37. empire_core/protocol/models/building.py +455 -0
  38. empire_core/protocol/models/castle.py +317 -0
  39. empire_core/protocol/models/chat.py +150 -0
  40. empire_core/protocol/models/defense.py +300 -0
  41. empire_core/protocol/models/map.py +269 -0
  42. empire_core/protocol/packet.py +104 -0
  43. empire_core/services/__init__.py +31 -0
  44. empire_core/services/alliance.py +222 -0
  45. empire_core/services/base.py +107 -0
  46. empire_core/services/castle.py +221 -0
  47. empire_core/state/__init__.py +0 -0
  48. empire_core/state/manager.py +398 -0
  49. empire_core/state/models.py +215 -0
  50. empire_core/state/quest_models.py +60 -0
  51. empire_core/state/report_models.py +115 -0
  52. empire_core/state/unit_models.py +75 -0
  53. empire_core/state/world_models.py +269 -0
  54. empire_core/storage/__init__.py +1 -0
  55. empire_core/storage/database.py +237 -0
  56. empire_core/utils/__init__.py +0 -0
  57. empire_core/utils/battle_sim.py +172 -0
  58. empire_core/utils/calculations.py +170 -0
  59. empire_core/utils/crypto.py +8 -0
  60. empire_core/utils/decorators.py +69 -0
  61. empire_core/utils/enums.py +111 -0
  62. empire_core/utils/helpers.py +252 -0
  63. empire_core/utils/response_awaiter.py +153 -0
  64. empire_core/utils/troops.py +93 -0
  65. empire_core-0.7.3.dist-info/METADATA +197 -0
  66. empire_core-0.7.3.dist-info/RECORD +67 -0
  67. empire_core-0.7.3.dist-info/WHEEL +4 -0
@@ -0,0 +1,455 @@
1
+ """
2
+ Building protocol models.
3
+
4
+ Commands:
5
+ - ebu: Build (erect building)
6
+ - eup: Upgrade building
7
+ - emo: Move building
8
+ - sbd: Sell building
9
+ - edo: Destroy building
10
+ - fco: Fast complete (skip construction with rubies)
11
+ - msb: Time skip building
12
+ - eud: Upgrade wall/defense
13
+ - rbu: Repair building
14
+ - ira: Repair all buildings
15
+ - ebe: Buy castle extension
16
+ - etc: Collect extension gift
17
+ """
18
+
19
+ from __future__ import annotations
20
+
21
+ from pydantic import Field
22
+
23
+ from .base import BaseRequest, BaseResponse
24
+
25
+ # =============================================================================
26
+ # EBU - Build (Erect Building)
27
+ # =============================================================================
28
+
29
+
30
+ class BuildRequest(BaseRequest):
31
+ """
32
+ Build a new building.
33
+
34
+ Command: ebu
35
+ Payload: {"CID": castle_id, "BT": building_type, "X": x, "Y": y}
36
+ """
37
+
38
+ command = "ebu"
39
+
40
+ castle_id: int = Field(alias="CID")
41
+ building_type: int = Field(alias="BT")
42
+ x: int = Field(alias="X")
43
+ y: int = Field(alias="Y")
44
+
45
+
46
+ class BuildResponse(BaseResponse):
47
+ """
48
+ Response to building construction.
49
+
50
+ Command: ebu
51
+ """
52
+
53
+ command = "ebu"
54
+
55
+ building_id: int = Field(alias="BID", default=0)
56
+ completion_time: int = Field(alias="CT", default=0) # Unix timestamp
57
+ error_code: int = Field(alias="E", default=0)
58
+
59
+
60
+ # =============================================================================
61
+ # EUP - Upgrade Building
62
+ # =============================================================================
63
+
64
+
65
+ class UpgradeBuildingRequest(BaseRequest):
66
+ """
67
+ Upgrade an existing building.
68
+
69
+ Command: eup
70
+ Payload: {"CID": castle_id, "BID": building_id}
71
+ """
72
+
73
+ command = "eup"
74
+
75
+ castle_id: int = Field(alias="CID")
76
+ building_id: int = Field(alias="BID")
77
+
78
+
79
+ class UpgradeBuildingResponse(BaseResponse):
80
+ """
81
+ Response to building upgrade.
82
+
83
+ Command: eup
84
+ """
85
+
86
+ command = "eup"
87
+
88
+ new_level: int = Field(alias="L", default=0)
89
+ completion_time: int = Field(alias="CT", default=0)
90
+ error_code: int = Field(alias="E", default=0)
91
+
92
+
93
+ # =============================================================================
94
+ # EMO - Move Building
95
+ # =============================================================================
96
+
97
+
98
+ class MoveBuildingRequest(BaseRequest):
99
+ """
100
+ Move a building to a new position.
101
+
102
+ Command: emo
103
+ Payload: {"CID": castle_id, "BID": building_id, "X": x, "Y": y}
104
+ """
105
+
106
+ command = "emo"
107
+
108
+ castle_id: int = Field(alias="CID")
109
+ building_id: int = Field(alias="BID")
110
+ x: int = Field(alias="X")
111
+ y: int = Field(alias="Y")
112
+
113
+
114
+ class MoveBuildingResponse(BaseResponse):
115
+ """
116
+ Response to building move.
117
+
118
+ Command: emo
119
+ """
120
+
121
+ command = "emo"
122
+
123
+ success: bool = Field(default=True)
124
+ error_code: int = Field(alias="E", default=0)
125
+
126
+
127
+ # =============================================================================
128
+ # SBD - Sell Building
129
+ # =============================================================================
130
+
131
+
132
+ class SellBuildingRequest(BaseRequest):
133
+ """
134
+ Sell a building for resources.
135
+
136
+ Command: sbd
137
+ Payload: {"CID": castle_id, "BID": building_id}
138
+ """
139
+
140
+ command = "sbd"
141
+
142
+ castle_id: int = Field(alias="CID")
143
+ building_id: int = Field(alias="BID")
144
+
145
+
146
+ class SellBuildingResponse(BaseResponse):
147
+ """
148
+ Response to selling a building.
149
+
150
+ Command: sbd
151
+ """
152
+
153
+ command = "sbd"
154
+
155
+ resources_gained: int = Field(alias="RG", default=0)
156
+ error_code: int = Field(alias="E", default=0)
157
+
158
+
159
+ # =============================================================================
160
+ # EDO - Destroy Building
161
+ # =============================================================================
162
+
163
+
164
+ class DestroyBuildingRequest(BaseRequest):
165
+ """
166
+ Destroy a building (no resources returned).
167
+
168
+ Command: edo
169
+ Payload: {"CID": castle_id, "BID": building_id}
170
+ """
171
+
172
+ command = "edo"
173
+
174
+ castle_id: int = Field(alias="CID")
175
+ building_id: int = Field(alias="BID")
176
+
177
+
178
+ class DestroyBuildingResponse(BaseResponse):
179
+ """
180
+ Response to destroying a building.
181
+
182
+ Command: edo
183
+ """
184
+
185
+ command = "edo"
186
+
187
+ success: bool = Field(default=True)
188
+ error_code: int = Field(alias="E", default=0)
189
+
190
+
191
+ # =============================================================================
192
+ # FCO - Fast Complete (Skip Construction)
193
+ # =============================================================================
194
+
195
+
196
+ class FastCompleteRequest(BaseRequest):
197
+ """
198
+ Complete construction instantly using rubies.
199
+
200
+ Command: fco
201
+ Payload: {"CID": castle_id, "BID": building_id}
202
+ """
203
+
204
+ command = "fco"
205
+
206
+ castle_id: int = Field(alias="CID")
207
+ building_id: int = Field(alias="BID")
208
+
209
+
210
+ class FastCompleteResponse(BaseResponse):
211
+ """
212
+ Response to fast completion.
213
+
214
+ Command: fco
215
+ """
216
+
217
+ command = "fco"
218
+
219
+ success: bool = Field(default=True)
220
+ rubies_spent: int = Field(alias="RS", default=0)
221
+ error_code: int = Field(alias="E", default=0)
222
+
223
+
224
+ # =============================================================================
225
+ # MSB - Time Skip Building
226
+ # =============================================================================
227
+
228
+
229
+ class TimeSkipBuildingRequest(BaseRequest):
230
+ """
231
+ Skip some construction time using an item.
232
+
233
+ Command: msb
234
+ Payload: {"CID": castle_id, "BID": building_id, "IID": item_id}
235
+ """
236
+
237
+ command = "msb"
238
+
239
+ castle_id: int = Field(alias="CID")
240
+ building_id: int = Field(alias="BID")
241
+ item_id: int = Field(alias="IID")
242
+
243
+
244
+ class TimeSkipBuildingResponse(BaseResponse):
245
+ """
246
+ Response to time skip.
247
+
248
+ Command: msb
249
+ """
250
+
251
+ command = "msb"
252
+
253
+ new_completion_time: int = Field(alias="CT", default=0)
254
+ error_code: int = Field(alias="E", default=0)
255
+
256
+
257
+ # =============================================================================
258
+ # EUD - Upgrade Wall/Defense
259
+ # =============================================================================
260
+
261
+
262
+ class UpgradeWallRequest(BaseRequest):
263
+ """
264
+ Upgrade castle wall/defense level.
265
+
266
+ Command: eud
267
+ Payload: {"CID": castle_id, "WT": wall_type}
268
+ """
269
+
270
+ command = "eud"
271
+
272
+ castle_id: int = Field(alias="CID")
273
+ wall_type: int = Field(alias="WT", default=0)
274
+
275
+
276
+ class UpgradeWallResponse(BaseResponse):
277
+ """
278
+ Response to wall upgrade.
279
+
280
+ Command: eud
281
+ """
282
+
283
+ command = "eud"
284
+
285
+ new_level: int = Field(alias="L", default=0)
286
+ completion_time: int = Field(alias="CT", default=0)
287
+ error_code: int = Field(alias="E", default=0)
288
+
289
+
290
+ # =============================================================================
291
+ # RBU - Repair Building
292
+ # =============================================================================
293
+
294
+
295
+ class RepairBuildingRequest(BaseRequest):
296
+ """
297
+ Repair a damaged building.
298
+
299
+ Command: rbu
300
+ Payload: {"CID": castle_id, "BID": building_id}
301
+ """
302
+
303
+ command = "rbu"
304
+
305
+ castle_id: int = Field(alias="CID")
306
+ building_id: int = Field(alias="BID")
307
+
308
+
309
+ class RepairBuildingResponse(BaseResponse):
310
+ """
311
+ Response to building repair.
312
+
313
+ Command: rbu
314
+ """
315
+
316
+ command = "rbu"
317
+
318
+ completion_time: int = Field(alias="CT", default=0)
319
+ error_code: int = Field(alias="E", default=0)
320
+
321
+
322
+ # =============================================================================
323
+ # IRA - Repair All Buildings
324
+ # =============================================================================
325
+
326
+
327
+ class RepairAllRequest(BaseRequest):
328
+ """
329
+ Repair all damaged buildings in a castle.
330
+
331
+ Command: ira
332
+ Payload: {"CID": castle_id}
333
+ """
334
+
335
+ command = "ira"
336
+
337
+ castle_id: int = Field(alias="CID")
338
+
339
+
340
+ class RepairAllResponse(BaseResponse):
341
+ """
342
+ Response to repairing all buildings.
343
+
344
+ Command: ira
345
+ """
346
+
347
+ command = "ira"
348
+
349
+ buildings_repaired: int = Field(alias="BR", default=0)
350
+ error_code: int = Field(alias="E", default=0)
351
+
352
+
353
+ # =============================================================================
354
+ # EBE - Buy Extension
355
+ # =============================================================================
356
+
357
+
358
+ class BuyExtensionRequest(BaseRequest):
359
+ """
360
+ Buy a castle extension (more building space).
361
+
362
+ Command: ebe
363
+ Payload: {"CID": castle_id, "ET": extension_type}
364
+ """
365
+
366
+ command = "ebe"
367
+
368
+ castle_id: int = Field(alias="CID")
369
+ extension_type: int = Field(alias="ET")
370
+
371
+
372
+ class BuyExtensionResponse(BaseResponse):
373
+ """
374
+ Response to buying extension.
375
+
376
+ Command: ebe
377
+ """
378
+
379
+ command = "ebe"
380
+
381
+ success: bool = Field(default=True)
382
+ rubies_spent: int = Field(alias="RS", default=0)
383
+ error_code: int = Field(alias="E", default=0)
384
+
385
+
386
+ # =============================================================================
387
+ # ETC - Collect Extension Gift
388
+ # =============================================================================
389
+
390
+
391
+ class CollectExtensionGiftRequest(BaseRequest):
392
+ """
393
+ Collect gift from extension.
394
+
395
+ Command: etc
396
+ Payload: {"CID": castle_id, "EID": extension_id}
397
+ """
398
+
399
+ command = "etc"
400
+
401
+ castle_id: int = Field(alias="CID")
402
+ extension_id: int = Field(alias="EID")
403
+
404
+
405
+ class CollectExtensionGiftResponse(BaseResponse):
406
+ """
407
+ Response to collecting extension gift.
408
+
409
+ Command: etc
410
+ """
411
+
412
+ command = "etc"
413
+
414
+ success: bool = Field(default=True)
415
+ error_code: int = Field(alias="E", default=0)
416
+
417
+
418
+ __all__ = [
419
+ # EBU - Build
420
+ "BuildRequest",
421
+ "BuildResponse",
422
+ # EUP - Upgrade
423
+ "UpgradeBuildingRequest",
424
+ "UpgradeBuildingResponse",
425
+ # EMO - Move
426
+ "MoveBuildingRequest",
427
+ "MoveBuildingResponse",
428
+ # SBD - Sell
429
+ "SellBuildingRequest",
430
+ "SellBuildingResponse",
431
+ # EDO - Destroy
432
+ "DestroyBuildingRequest",
433
+ "DestroyBuildingResponse",
434
+ # FCO - Fast Complete
435
+ "FastCompleteRequest",
436
+ "FastCompleteResponse",
437
+ # MSB - Time Skip
438
+ "TimeSkipBuildingRequest",
439
+ "TimeSkipBuildingResponse",
440
+ # EUD - Upgrade Wall
441
+ "UpgradeWallRequest",
442
+ "UpgradeWallResponse",
443
+ # RBU - Repair
444
+ "RepairBuildingRequest",
445
+ "RepairBuildingResponse",
446
+ # IRA - Repair All
447
+ "RepairAllRequest",
448
+ "RepairAllResponse",
449
+ # EBE - Buy Extension
450
+ "BuyExtensionRequest",
451
+ "BuyExtensionResponse",
452
+ # ETC - Collect Extension Gift
453
+ "CollectExtensionGiftRequest",
454
+ "CollectExtensionGiftResponse",
455
+ ]