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.
- empire_core/__init__.py +36 -0
- empire_core/_archive/actions.py +511 -0
- empire_core/_archive/automation/__init__.py +24 -0
- empire_core/_archive/automation/alliance_tools.py +266 -0
- empire_core/_archive/automation/battle_reports.py +196 -0
- empire_core/_archive/automation/building_queue.py +242 -0
- empire_core/_archive/automation/defense_manager.py +124 -0
- empire_core/_archive/automation/map_scanner.py +370 -0
- empire_core/_archive/automation/multi_account.py +296 -0
- empire_core/_archive/automation/quest_automation.py +94 -0
- empire_core/_archive/automation/resource_manager.py +380 -0
- empire_core/_archive/automation/target_finder.py +153 -0
- empire_core/_archive/automation/tasks.py +224 -0
- empire_core/_archive/automation/unit_production.py +719 -0
- empire_core/_archive/cli.py +68 -0
- empire_core/_archive/client_async.py +469 -0
- empire_core/_archive/commands.py +201 -0
- empire_core/_archive/connection_async.py +228 -0
- empire_core/_archive/defense.py +156 -0
- empire_core/_archive/events/__init__.py +35 -0
- empire_core/_archive/events/base.py +153 -0
- empire_core/_archive/events/manager.py +85 -0
- empire_core/accounts.py +190 -0
- empire_core/client/__init__.py +0 -0
- empire_core/client/client.py +459 -0
- empire_core/config.py +87 -0
- empire_core/exceptions.py +42 -0
- empire_core/network/__init__.py +0 -0
- empire_core/network/connection.py +378 -0
- empire_core/protocol/__init__.py +0 -0
- empire_core/protocol/models/__init__.py +339 -0
- empire_core/protocol/models/alliance.py +186 -0
- empire_core/protocol/models/army.py +444 -0
- empire_core/protocol/models/attack.py +229 -0
- empire_core/protocol/models/auth.py +216 -0
- empire_core/protocol/models/base.py +403 -0
- empire_core/protocol/models/building.py +455 -0
- empire_core/protocol/models/castle.py +317 -0
- empire_core/protocol/models/chat.py +150 -0
- empire_core/protocol/models/defense.py +300 -0
- empire_core/protocol/models/map.py +269 -0
- empire_core/protocol/packet.py +104 -0
- empire_core/services/__init__.py +31 -0
- empire_core/services/alliance.py +222 -0
- empire_core/services/base.py +107 -0
- empire_core/services/castle.py +221 -0
- empire_core/state/__init__.py +0 -0
- empire_core/state/manager.py +398 -0
- empire_core/state/models.py +215 -0
- empire_core/state/quest_models.py +60 -0
- empire_core/state/report_models.py +115 -0
- empire_core/state/unit_models.py +75 -0
- empire_core/state/world_models.py +269 -0
- empire_core/storage/__init__.py +1 -0
- empire_core/storage/database.py +237 -0
- empire_core/utils/__init__.py +0 -0
- empire_core/utils/battle_sim.py +172 -0
- empire_core/utils/calculations.py +170 -0
- empire_core/utils/crypto.py +8 -0
- empire_core/utils/decorators.py +69 -0
- empire_core/utils/enums.py +111 -0
- empire_core/utils/helpers.py +252 -0
- empire_core/utils/response_awaiter.py +153 -0
- empire_core/utils/troops.py +93 -0
- empire_core-0.7.3.dist-info/METADATA +197 -0
- empire_core-0.7.3.dist-info/RECORD +67 -0
- empire_core-0.7.3.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Alliance protocol models.
|
|
3
|
+
|
|
4
|
+
Commands:
|
|
5
|
+
- ahc: Help a specific member (heal/repair/recruit)
|
|
6
|
+
- aha: Help all members
|
|
7
|
+
- ahr: Request help from alliance
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
from pydantic import ConfigDict, Field
|
|
13
|
+
|
|
14
|
+
from .base import BaseRequest, BaseResponse, HelpType
|
|
15
|
+
|
|
16
|
+
# =============================================================================
|
|
17
|
+
# AHC - Help Member
|
|
18
|
+
# =============================================================================
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class HelpMemberRequest(BaseRequest):
|
|
22
|
+
"""
|
|
23
|
+
Help a specific alliance member.
|
|
24
|
+
|
|
25
|
+
Command: ahc
|
|
26
|
+
Payload: {"PID": player_id, "CID": castle_id, "HT": help_type}
|
|
27
|
+
|
|
28
|
+
Help types (HT):
|
|
29
|
+
- 2: Heal wounded soldiers
|
|
30
|
+
- 3: Repair building
|
|
31
|
+
- 6: Recruit soldiers
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
command = "ahc"
|
|
35
|
+
|
|
36
|
+
player_id: int = Field(alias="PID")
|
|
37
|
+
castle_id: int = Field(alias="CID")
|
|
38
|
+
help_type: int = Field(alias="HT")
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def heal(cls, player_id: int, castle_id: int) -> "HelpMemberRequest":
|
|
42
|
+
"""Create a heal help request."""
|
|
43
|
+
return cls(PID=player_id, CID=castle_id, HT=HelpType.HEAL)
|
|
44
|
+
|
|
45
|
+
@classmethod
|
|
46
|
+
def repair(cls, player_id: int, castle_id: int) -> "HelpMemberRequest":
|
|
47
|
+
"""Create a repair help request."""
|
|
48
|
+
return cls(PID=player_id, CID=castle_id, HT=HelpType.REPAIR)
|
|
49
|
+
|
|
50
|
+
@classmethod
|
|
51
|
+
def recruit(cls, player_id: int, castle_id: int) -> "HelpMemberRequest":
|
|
52
|
+
"""Create a recruit help request."""
|
|
53
|
+
return cls(PID=player_id, CID=castle_id, HT=HelpType.RECRUIT)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class HelpMemberResponse(BaseResponse):
|
|
57
|
+
"""
|
|
58
|
+
Response to helping a member.
|
|
59
|
+
|
|
60
|
+
Command: ahc
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
command = "ahc"
|
|
64
|
+
|
|
65
|
+
success: bool = Field(default=True)
|
|
66
|
+
error_code: int = Field(alias="E", default=0)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
# =============================================================================
|
|
70
|
+
# AHA - Help All
|
|
71
|
+
# =============================================================================
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
class HelpAllRequest(BaseRequest):
|
|
75
|
+
"""
|
|
76
|
+
Help all alliance members who need help.
|
|
77
|
+
|
|
78
|
+
Command: aha
|
|
79
|
+
Payload: {} (empty) or {"HT": help_type}
|
|
80
|
+
"""
|
|
81
|
+
|
|
82
|
+
command = "aha"
|
|
83
|
+
|
|
84
|
+
help_type: int | None = Field(alias="HT", default=None)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
class HelpAllResponse(BaseResponse):
|
|
88
|
+
"""
|
|
89
|
+
Response to helping all members.
|
|
90
|
+
|
|
91
|
+
Command: aha
|
|
92
|
+
"""
|
|
93
|
+
|
|
94
|
+
command = "aha"
|
|
95
|
+
|
|
96
|
+
helped_count: int = Field(alias="HC", default=0)
|
|
97
|
+
error_code: int = Field(alias="E", default=0)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
# =============================================================================
|
|
101
|
+
# AHR - Ask for Help
|
|
102
|
+
# =============================================================================
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class AskHelpRequest(BaseRequest):
|
|
106
|
+
"""
|
|
107
|
+
Request help from alliance members.
|
|
108
|
+
|
|
109
|
+
Command: ahr
|
|
110
|
+
Payload: {"CID": castle_id, "HT": help_type, "BID": building_id}
|
|
111
|
+
|
|
112
|
+
Help types (HT):
|
|
113
|
+
- 2: Heal wounded soldiers
|
|
114
|
+
- 3: Repair building (requires BID)
|
|
115
|
+
- 6: Recruit soldiers
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
command = "ahr"
|
|
119
|
+
|
|
120
|
+
castle_id: int = Field(alias="CID")
|
|
121
|
+
help_type: int = Field(alias="HT")
|
|
122
|
+
building_id: int | None = Field(alias="BID", default=None)
|
|
123
|
+
|
|
124
|
+
@classmethod
|
|
125
|
+
def heal(cls, castle_id: int) -> "AskHelpRequest":
|
|
126
|
+
"""Request heal help."""
|
|
127
|
+
return cls(CID=castle_id, HT=HelpType.HEAL)
|
|
128
|
+
|
|
129
|
+
@classmethod
|
|
130
|
+
def repair(cls, castle_id: int, building_id: int) -> "AskHelpRequest":
|
|
131
|
+
"""Request repair help for a building."""
|
|
132
|
+
return cls(CID=castle_id, HT=HelpType.REPAIR, BID=building_id)
|
|
133
|
+
|
|
134
|
+
@classmethod
|
|
135
|
+
def recruit(cls, castle_id: int) -> "AskHelpRequest":
|
|
136
|
+
"""Request recruit help."""
|
|
137
|
+
return cls(CID=castle_id, HT=HelpType.RECRUIT)
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
class AskHelpResponse(BaseResponse):
|
|
141
|
+
"""
|
|
142
|
+
Response to asking for help.
|
|
143
|
+
|
|
144
|
+
Command: ahr
|
|
145
|
+
"""
|
|
146
|
+
|
|
147
|
+
command = "ahr"
|
|
148
|
+
|
|
149
|
+
success: bool = Field(default=True)
|
|
150
|
+
error_code: int = Field(alias="E", default=0)
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
# =============================================================================
|
|
154
|
+
# Alliance Help Notification (received when someone asks for help)
|
|
155
|
+
# =============================================================================
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class HelpRequestNotification(BaseResponse):
|
|
159
|
+
"""
|
|
160
|
+
Notification received when an alliance member asks for help.
|
|
161
|
+
|
|
162
|
+
This is a push notification from the server.
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
166
|
+
|
|
167
|
+
player_id: int = Field(alias="PID")
|
|
168
|
+
player_name: str = Field(alias="PN")
|
|
169
|
+
castle_id: int = Field(alias="CID")
|
|
170
|
+
help_type: int = Field(alias="HT")
|
|
171
|
+
building_id: int | None = Field(alias="BID", default=None)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
__all__ = [
|
|
175
|
+
# AHC - Help Member
|
|
176
|
+
"HelpMemberRequest",
|
|
177
|
+
"HelpMemberResponse",
|
|
178
|
+
# AHA - Help All
|
|
179
|
+
"HelpAllRequest",
|
|
180
|
+
"HelpAllResponse",
|
|
181
|
+
# AHR - Ask Help
|
|
182
|
+
"AskHelpRequest",
|
|
183
|
+
"AskHelpResponse",
|
|
184
|
+
# Notifications
|
|
185
|
+
"HelpRequestNotification",
|
|
186
|
+
]
|
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Army and hospital protocol models.
|
|
3
|
+
|
|
4
|
+
Commands:
|
|
5
|
+
- bup: Build units / produce
|
|
6
|
+
- spl: Get production list/queue
|
|
7
|
+
- bou: Double production slot
|
|
8
|
+
- mcu: Cancel production
|
|
9
|
+
- gui: Get units inventory
|
|
10
|
+
- dup: Delete units
|
|
11
|
+
- hru: Heal units
|
|
12
|
+
- hcs: Cancel heal
|
|
13
|
+
- hss: Skip heal (rubies)
|
|
14
|
+
- hdu: Delete wounded
|
|
15
|
+
- hra: Heal all
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
from __future__ import annotations
|
|
19
|
+
|
|
20
|
+
from pydantic import ConfigDict, Field
|
|
21
|
+
|
|
22
|
+
from .base import BaseRequest, BaseResponse, UnitCount
|
|
23
|
+
|
|
24
|
+
# =============================================================================
|
|
25
|
+
# BUP - Build Units / Produce
|
|
26
|
+
# =============================================================================
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ProduceUnitsRequest(BaseRequest):
|
|
30
|
+
"""
|
|
31
|
+
Start production of units or tools.
|
|
32
|
+
|
|
33
|
+
Command: bup
|
|
34
|
+
Payload: {
|
|
35
|
+
"CID": castle_id,
|
|
36
|
+
"BID": building_id,
|
|
37
|
+
"UID": unit_type_id,
|
|
38
|
+
"C": count,
|
|
39
|
+
"LID": list_id # 0=soldiers, 1=tools
|
|
40
|
+
}
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
command = "bup"
|
|
44
|
+
|
|
45
|
+
castle_id: int = Field(alias="CID")
|
|
46
|
+
building_id: int = Field(alias="BID")
|
|
47
|
+
unit_id: int = Field(alias="UID")
|
|
48
|
+
count: int = Field(alias="C")
|
|
49
|
+
list_id: int = Field(alias="LID", default=0) # 0=soldiers, 1=tools
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class ProduceUnitsResponse(BaseResponse):
|
|
53
|
+
"""
|
|
54
|
+
Response to production request.
|
|
55
|
+
|
|
56
|
+
Command: bup
|
|
57
|
+
"""
|
|
58
|
+
|
|
59
|
+
command = "bup"
|
|
60
|
+
|
|
61
|
+
queue_id: int = Field(alias="QID", default=0)
|
|
62
|
+
completion_time: int = Field(alias="CT", default=0)
|
|
63
|
+
error_code: int = Field(alias="E", default=0)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
# =============================================================================
|
|
67
|
+
# SPL - Get Production List
|
|
68
|
+
# =============================================================================
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class GetProductionQueueRequest(BaseRequest):
|
|
72
|
+
"""
|
|
73
|
+
Get production queue for a building.
|
|
74
|
+
|
|
75
|
+
Command: spl
|
|
76
|
+
Payload: {"CID": castle_id, "BID": building_id, "LID": list_id}
|
|
77
|
+
|
|
78
|
+
List types (LID):
|
|
79
|
+
- 0: Soldiers
|
|
80
|
+
- 1: Tools
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
command = "spl"
|
|
84
|
+
|
|
85
|
+
castle_id: int = Field(alias="CID")
|
|
86
|
+
building_id: int = Field(alias="BID")
|
|
87
|
+
list_id: int = Field(alias="LID", default=0)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class ProductionQueueItem(BaseResponse):
|
|
91
|
+
"""An item in the production queue."""
|
|
92
|
+
|
|
93
|
+
model_config = ConfigDict(populate_by_name=True, extra="allow")
|
|
94
|
+
|
|
95
|
+
queue_id: int = Field(alias="QID")
|
|
96
|
+
unit_id: int = Field(alias="UID")
|
|
97
|
+
count: int = Field(alias="C")
|
|
98
|
+
remaining: int = Field(alias="R", default=0)
|
|
99
|
+
completion_time: int = Field(alias="CT", default=0)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class GetProductionQueueResponse(BaseResponse):
|
|
103
|
+
"""
|
|
104
|
+
Response containing production queue.
|
|
105
|
+
|
|
106
|
+
Command: spl
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
command = "spl"
|
|
110
|
+
|
|
111
|
+
queue: list[ProductionQueueItem] = Field(alias="Q", default_factory=list)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
# =============================================================================
|
|
115
|
+
# BOU - Double Production Slot
|
|
116
|
+
# =============================================================================
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
class DoubleProductionRequest(BaseRequest):
|
|
120
|
+
"""
|
|
121
|
+
Double a production slot (produce twice as fast).
|
|
122
|
+
|
|
123
|
+
Command: bou
|
|
124
|
+
Payload: {"CID": castle_id, "BID": building_id, "QID": queue_id}
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
command = "bou"
|
|
128
|
+
|
|
129
|
+
castle_id: int = Field(alias="CID")
|
|
130
|
+
building_id: int = Field(alias="BID")
|
|
131
|
+
queue_id: int = Field(alias="QID")
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class DoubleProductionResponse(BaseResponse):
|
|
135
|
+
"""
|
|
136
|
+
Response to doubling production.
|
|
137
|
+
|
|
138
|
+
Command: bou
|
|
139
|
+
"""
|
|
140
|
+
|
|
141
|
+
command = "bou"
|
|
142
|
+
|
|
143
|
+
success: bool = Field(default=True)
|
|
144
|
+
rubies_spent: int = Field(alias="RS", default=0)
|
|
145
|
+
error_code: int = Field(alias="E", default=0)
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
# =============================================================================
|
|
149
|
+
# MCU - Cancel Production
|
|
150
|
+
# =============================================================================
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class CancelProductionRequest(BaseRequest):
|
|
154
|
+
"""
|
|
155
|
+
Cancel a production queue item.
|
|
156
|
+
|
|
157
|
+
Command: mcu
|
|
158
|
+
Payload: {"CID": castle_id, "BID": building_id, "QID": queue_id}
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
command = "mcu"
|
|
162
|
+
|
|
163
|
+
castle_id: int = Field(alias="CID")
|
|
164
|
+
building_id: int = Field(alias="BID")
|
|
165
|
+
queue_id: int = Field(alias="QID")
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
class CancelProductionResponse(BaseResponse):
|
|
169
|
+
"""
|
|
170
|
+
Response to canceling production.
|
|
171
|
+
|
|
172
|
+
Command: mcu
|
|
173
|
+
"""
|
|
174
|
+
|
|
175
|
+
command = "mcu"
|
|
176
|
+
|
|
177
|
+
success: bool = Field(default=True)
|
|
178
|
+
error_code: int = Field(alias="E", default=0)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
# =============================================================================
|
|
182
|
+
# GUI - Get Units Inventory
|
|
183
|
+
# =============================================================================
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
class GetUnitsRequest(BaseRequest):
|
|
187
|
+
"""
|
|
188
|
+
Get units inventory for a castle.
|
|
189
|
+
|
|
190
|
+
Command: gui
|
|
191
|
+
Payload: {"CID": castle_id}
|
|
192
|
+
"""
|
|
193
|
+
|
|
194
|
+
command = "gui"
|
|
195
|
+
|
|
196
|
+
castle_id: int = Field(alias="CID")
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
class GetUnitsResponse(BaseResponse):
|
|
200
|
+
"""
|
|
201
|
+
Response containing units inventory.
|
|
202
|
+
|
|
203
|
+
Command: gui
|
|
204
|
+
"""
|
|
205
|
+
|
|
206
|
+
command = "gui"
|
|
207
|
+
|
|
208
|
+
units: list[UnitCount] = Field(alias="U", default_factory=list)
|
|
209
|
+
tools: list[UnitCount] = Field(alias="T", default_factory=list)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# =============================================================================
|
|
213
|
+
# DUP - Delete Units
|
|
214
|
+
# =============================================================================
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class DeleteUnitsRequest(BaseRequest):
|
|
218
|
+
"""
|
|
219
|
+
Delete units from inventory.
|
|
220
|
+
|
|
221
|
+
Command: dup
|
|
222
|
+
Payload: {"CID": castle_id, "UID": unit_id, "C": count}
|
|
223
|
+
"""
|
|
224
|
+
|
|
225
|
+
command = "dup"
|
|
226
|
+
|
|
227
|
+
castle_id: int = Field(alias="CID")
|
|
228
|
+
unit_id: int = Field(alias="UID")
|
|
229
|
+
count: int = Field(alias="C")
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
class DeleteUnitsResponse(BaseResponse):
|
|
233
|
+
"""
|
|
234
|
+
Response to deleting units.
|
|
235
|
+
|
|
236
|
+
Command: dup
|
|
237
|
+
"""
|
|
238
|
+
|
|
239
|
+
command = "dup"
|
|
240
|
+
|
|
241
|
+
success: bool = Field(default=True)
|
|
242
|
+
error_code: int = Field(alias="E", default=0)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
# =============================================================================
|
|
246
|
+
# HRU - Heal Units
|
|
247
|
+
# =============================================================================
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
class HealUnitsRequest(BaseRequest):
|
|
251
|
+
"""
|
|
252
|
+
Heal wounded units.
|
|
253
|
+
|
|
254
|
+
Command: hru
|
|
255
|
+
Payload: {"CID": castle_id, "UID": unit_id, "C": count}
|
|
256
|
+
"""
|
|
257
|
+
|
|
258
|
+
command = "hru"
|
|
259
|
+
|
|
260
|
+
castle_id: int = Field(alias="CID")
|
|
261
|
+
unit_id: int = Field(alias="UID")
|
|
262
|
+
count: int = Field(alias="C")
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
class HealUnitsResponse(BaseResponse):
|
|
266
|
+
"""
|
|
267
|
+
Response to healing units.
|
|
268
|
+
|
|
269
|
+
Command: hru
|
|
270
|
+
"""
|
|
271
|
+
|
|
272
|
+
command = "hru"
|
|
273
|
+
|
|
274
|
+
queue_id: int = Field(alias="QID", default=0)
|
|
275
|
+
completion_time: int = Field(alias="CT", default=0)
|
|
276
|
+
error_code: int = Field(alias="E", default=0)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
# =============================================================================
|
|
280
|
+
# HCS - Cancel Heal
|
|
281
|
+
# =============================================================================
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class CancelHealRequest(BaseRequest):
|
|
285
|
+
"""
|
|
286
|
+
Cancel healing queue item.
|
|
287
|
+
|
|
288
|
+
Command: hcs
|
|
289
|
+
Payload: {"CID": castle_id, "QID": queue_id}
|
|
290
|
+
"""
|
|
291
|
+
|
|
292
|
+
command = "hcs"
|
|
293
|
+
|
|
294
|
+
castle_id: int = Field(alias="CID")
|
|
295
|
+
queue_id: int = Field(alias="QID")
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
class CancelHealResponse(BaseResponse):
|
|
299
|
+
"""
|
|
300
|
+
Response to canceling heal.
|
|
301
|
+
|
|
302
|
+
Command: hcs
|
|
303
|
+
"""
|
|
304
|
+
|
|
305
|
+
command = "hcs"
|
|
306
|
+
|
|
307
|
+
success: bool = Field(default=True)
|
|
308
|
+
error_code: int = Field(alias="E", default=0)
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
# =============================================================================
|
|
312
|
+
# HSS - Skip Heal (Rubies)
|
|
313
|
+
# =============================================================================
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
class SkipHealRequest(BaseRequest):
|
|
317
|
+
"""
|
|
318
|
+
Skip healing time using rubies.
|
|
319
|
+
|
|
320
|
+
Command: hss
|
|
321
|
+
Payload: {"CID": castle_id, "QID": queue_id}
|
|
322
|
+
"""
|
|
323
|
+
|
|
324
|
+
command = "hss"
|
|
325
|
+
|
|
326
|
+
castle_id: int = Field(alias="CID")
|
|
327
|
+
queue_id: int = Field(alias="QID")
|
|
328
|
+
|
|
329
|
+
|
|
330
|
+
class SkipHealResponse(BaseResponse):
|
|
331
|
+
"""
|
|
332
|
+
Response to skipping heal.
|
|
333
|
+
|
|
334
|
+
Command: hss
|
|
335
|
+
"""
|
|
336
|
+
|
|
337
|
+
command = "hss"
|
|
338
|
+
|
|
339
|
+
success: bool = Field(default=True)
|
|
340
|
+
rubies_spent: int = Field(alias="RS", default=0)
|
|
341
|
+
error_code: int = Field(alias="E", default=0)
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
# =============================================================================
|
|
345
|
+
# HDU - Delete Wounded
|
|
346
|
+
# =============================================================================
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
class DeleteWoundedRequest(BaseRequest):
|
|
350
|
+
"""
|
|
351
|
+
Delete wounded units (don't heal them).
|
|
352
|
+
|
|
353
|
+
Command: hdu
|
|
354
|
+
Payload: {"CID": castle_id, "UID": unit_id, "C": count}
|
|
355
|
+
"""
|
|
356
|
+
|
|
357
|
+
command = "hdu"
|
|
358
|
+
|
|
359
|
+
castle_id: int = Field(alias="CID")
|
|
360
|
+
unit_id: int = Field(alias="UID")
|
|
361
|
+
count: int = Field(alias="C")
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
class DeleteWoundedResponse(BaseResponse):
|
|
365
|
+
"""
|
|
366
|
+
Response to deleting wounded.
|
|
367
|
+
|
|
368
|
+
Command: hdu
|
|
369
|
+
"""
|
|
370
|
+
|
|
371
|
+
command = "hdu"
|
|
372
|
+
|
|
373
|
+
success: bool = Field(default=True)
|
|
374
|
+
error_code: int = Field(alias="E", default=0)
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
# =============================================================================
|
|
378
|
+
# HRA - Heal All
|
|
379
|
+
# =============================================================================
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
class HealAllRequest(BaseRequest):
|
|
383
|
+
"""
|
|
384
|
+
Heal all wounded units.
|
|
385
|
+
|
|
386
|
+
Command: hra
|
|
387
|
+
Payload: {"CID": castle_id}
|
|
388
|
+
"""
|
|
389
|
+
|
|
390
|
+
command = "hra"
|
|
391
|
+
|
|
392
|
+
castle_id: int = Field(alias="CID")
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
class HealAllResponse(BaseResponse):
|
|
396
|
+
"""
|
|
397
|
+
Response to healing all.
|
|
398
|
+
|
|
399
|
+
Command: hra
|
|
400
|
+
"""
|
|
401
|
+
|
|
402
|
+
command = "hra"
|
|
403
|
+
|
|
404
|
+
units_healed: int = Field(alias="UH", default=0)
|
|
405
|
+
completion_time: int = Field(alias="CT", default=0)
|
|
406
|
+
error_code: int = Field(alias="E", default=0)
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
__all__ = [
|
|
410
|
+
# BUP - Produce Units
|
|
411
|
+
"ProduceUnitsRequest",
|
|
412
|
+
"ProduceUnitsResponse",
|
|
413
|
+
# SPL - Production Queue
|
|
414
|
+
"GetProductionQueueRequest",
|
|
415
|
+
"GetProductionQueueResponse",
|
|
416
|
+
"ProductionQueueItem",
|
|
417
|
+
# BOU - Double Production
|
|
418
|
+
"DoubleProductionRequest",
|
|
419
|
+
"DoubleProductionResponse",
|
|
420
|
+
# MCU - Cancel Production
|
|
421
|
+
"CancelProductionRequest",
|
|
422
|
+
"CancelProductionResponse",
|
|
423
|
+
# GUI - Get Units
|
|
424
|
+
"GetUnitsRequest",
|
|
425
|
+
"GetUnitsResponse",
|
|
426
|
+
# DUP - Delete Units
|
|
427
|
+
"DeleteUnitsRequest",
|
|
428
|
+
"DeleteUnitsResponse",
|
|
429
|
+
# HRU - Heal Units
|
|
430
|
+
"HealUnitsRequest",
|
|
431
|
+
"HealUnitsResponse",
|
|
432
|
+
# HCS - Cancel Heal
|
|
433
|
+
"CancelHealRequest",
|
|
434
|
+
"CancelHealResponse",
|
|
435
|
+
# HSS - Skip Heal
|
|
436
|
+
"SkipHealRequest",
|
|
437
|
+
"SkipHealResponse",
|
|
438
|
+
# HDU - Delete Wounded
|
|
439
|
+
"DeleteWoundedRequest",
|
|
440
|
+
"DeleteWoundedResponse",
|
|
441
|
+
# HRA - Heal All
|
|
442
|
+
"HealAllRequest",
|
|
443
|
+
"HealAllResponse",
|
|
444
|
+
]
|