Quests¶
Your active quests, the quest book and your daily quests behind client.quests.
quests.service¶
Your active quests, the quest book's main quests and your daily quests; donating for a quest, and the quest conditions and starters only the client sees done.
Classes:
| Name | Description |
|---|---|
QuestsService |
Your quests as the login data and the quest pushes left them, which send nothing, |
QuestsService
¶
Bases: BaseService
Your quests as the login data and the quest pushes left them, which send nothing, and the requests that donate for a quest, finish a condition or a quest starter.
Reached as client.quests.
Methods:
| Name | Description |
|---|---|
quest |
An active quest, or None when it is not active. |
starter_quest |
The starter quest an event's icon opens before its dialog, or None when it opens none. |
donate |
Donate what the quest's donate condition asks for, the whole amount at once, without rubies. |
finish_condition |
Report a quest condition done that only the client sees done. The client has no handler for an |
finish_starter |
Report a quest's starter seen through, as the client does when the dialog that introduces |
Attributes:
| Name | Type | Description |
|---|---|---|
active |
dict[int, Quest]
|
Your active quests by id, in id order, as the last |
book |
QuestBook | None
|
The quest book's main quests, from the last |
daily |
DailyQuests
|
Your daily quests, from the last |
active
property
¶
Your active quests by id, in id order, as the last qli and the quest pushes since left them; a copy.
book
property
¶
book: QuestBook | None
The quest book's main quests, from the last qli that had them; None until one did.
daily
property
¶
daily: DailyQuests
Your daily quests, from the last dql (the login data has one).
Raises:
| Type | Description |
|---|---|
StateNotLoadedError
|
No login has brought it |
quest
¶
An active quest, or None when it is not active.
starter_quest
¶
The starter quest an event's icon opens before its dialog, or None when it opens none.
The first active quest, in id order, whose game data row belongs to the event and has a
starter condition; None as well when that quest needs another quest first.
Raises:
| Type | Description |
|---|---|
GameDataNotLoadedError
|
The game data cannot be loaded |
Client: StatusIconTemporaryServerEvent.onClick (bundle line 106330) and
StatusIconAllianceBattleGroundEvent.onClick (bundle line 105359) over
CastleQuestData.getActiveStarterQuestByEventID (bundle line 20344) and
CastleQuestVO.isStarterQuest (bundle line 52499); the rows are read by
CastleQuestVO.fillFromParamXML (bundle line 52475) and the active quests sorted by id in
CastleQuestData.updateActiveQuests (bundle line 20244)
donate
¶
Donate what the quest's donate condition asks for, the whole amount at once, without rubies.
The quest's first donate condition in the game data picks the request: a resource is
sent with qdr in its field, khan medals and samurai tokens with qdc. A quest the
donation finishes is reported as any other, through client.state.on_quest_finished.
Raises:
| Type | Description |
|---|---|
ValueError
|
The game data has no such quest, or the quest has no donate condition |
GameDataNotLoadedError
|
The game data cannot be loaded |
CommandError / EmpireTimeoutError / ConnectionClosedError
|
see |
Client: DonateForQuestCommand.performAction (bundle line 101001), which sends the
condition's conditionMaxCounter (ABasicQuestConditionVO.loadFromParamArray, bundle line 52833)
finish_condition
¶
finish_condition(condition_type: QuestConditionType, target_id: int = -1) -> None
Report a quest condition done that only the client sees done. The client has no handler for an answer, so none is waited for.
The client sends it only for the two visit conditions of the generals introduction:
VISIT_GENERALS_OVERVIEW when the generals overview opens while the active introduction
quest's first condition is that type, and VISIT_GENERALS_INN with the current condition's
target id after the inn's introduction cinematic. What the server checks is unverified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
condition_type
|
QuestConditionType
|
The condition done |
required |
target_id
|
int
|
The condition's target, -1 for none as the client defaults it |
-1
|
Client: C2SFinishQuestConditionVO (bundle line 41691), sent by GeneralsOverviewDialog.showLoaded
(bundle line 15812) and GeneralHubIntroductionHandler (bundle lines 74775, 74778)
finish_starter
¶
Report a quest's starter seen through, as the client does when the dialog that introduces the quest is closed or the tutorial step that triggered it is done. The client has no handler for an answer, so none is waited for; what the server does with it is unverified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
quest_id
|
QuestId | int
|
The quest the starter introduces |
required |
Client: C2SQuestStarterClickVO (bundle line 37187), sent by CastleStartQuestDialog.finishQuestStarter
(bundle line 17052) and TutorialBasicActionCommand.finishTriggerQuest (bundle line 9024)
quests.models¶
Your quests as client.state keeps them: the active quests (qli), the quest book's main
quests, and the daily quests (dql); and the requests that donate for a quest (qdr, qdc)
and finish a condition the client counts itself (fcq) or a quest starter (qsc); and the ruby
purchases of a time-limited campaign's quest (bcq) and end reward (bcr).
The state has no game data, so a quest is its id (a QuestId or DailyQuestId) and the
progress the server sent; its conditions, rewards and texts are in the items' quests and
dailyactivities rows (GameData.record).
Classes:
| Name | Description |
|---|---|
Quest |
One of your active quests, or a time-limited campaign's quest. |
QuestBook |
The quest book's main quests, its chapters: those announced, running and finished. |
QuestListResponse |
Your active quests, replacing the ones held, and the quest book's main quests when all three lists are sent. |
QuestsStartedResponse |
Quests that started: each becomes active, without progress. |
QuestProgressResponse |
A quest made progress: only the quest is named; its counters come with the next |
QuestFinishedResponse |
A quest is finished: it is no longer active, and its random equipment rewards are shown. |
CampaignQuestStatusResponse |
The time-limited campaign's quests and end reward, read over the running campaign event. |
Popup |
One popup of an |
PopupsResponse |
Popups the server asks the client to show. |
DailyQuest |
One of today's daily quests. |
DailyQuests |
Your daily quests: your daily quest level, today's quests and the reward thresholds. |
QuestDonateResourcesRequest |
Donate resources for a quest's donate condition. |
QuestDonateResourcesResponse |
The answer to a resource donation; the client reads nothing from it. |
QuestDonateCurrencyRequest |
Donate a currency, khan medals or samurai tokens, for a quest's donate condition. |
QuestDonateCurrencyResponse |
The answer to a currency donation; the client reads nothing from it. |
FinishQuestConditionRequest |
Report a quest condition done that only the client sees done, such as visiting a screen. |
QuestStarterClickRequest |
Report a quest starter seen through: the dialog or tutorial step that introduces a quest is done. |
BuyCampaignQuestRequest |
Buy a time-limited campaign's quest done, with rubies. |
BuyCampaignQuestResponse |
The acknowledgement of a |
BuyCampaignRewardRequest |
Buy a time-limited campaign's end reward, with rubies. |
BuyCampaignRewardResponse |
Your coins and rubies after buying a campaign's end reward. |
Quest
pydantic-model
¶
Bases: EmpireModel
One of your active quests, or a time-limited campaign's quest.
progress holds one counter per condition, in the order of the quest's conditions
in the items; the client keeps the counters as sent, the library reads them through int().
The client also counts a quest whose time has run out, and is not done, as failed.
Client: CastleQuestVO.fillFromParams (bundle line 52463), remainingSeconds and
isFailed (bundle lines 52592, 52583)
Fields:
-
quest_id(EnumOrInt['QuestId']) -
progress(tuple[int, ...]) -
end_time(float | None) -
completed(bool) -
failed(bool) -
locked(bool) -
campaign_quest_id(int) -
campaign_timestamp(int | None)
model_config
class-attribute
¶
model_config: ConfigDict = ConfigDict(frozen=True, populate_by_name=True)
end_time
pydantic-field
¶
end_time: float | None = None
Wire key RS
When the quest runs out, in time.monotonic() seconds; None without RS or for a negative one
campaign_quest_id
pydantic-field
¶
campaign_quest_id: int = 0
Wire key CQID
The quest's place in a campaign
campaign_timestamp
pydantic-field
¶
campaign_timestamp: int | None = None
Wire key ST
When a campaign quest opens, as sent; None without one
from_entry
classmethod
¶
A quest read from its entry.
S decides done or failed (1 or 0) and wins over QCS ("C" done, "F" failed,
"N" locked); without either the quest is neither.
QuestBook
pydantic-model
¶
Bases: EmpireModel
The quest book's main quests, its chapters: those announced, running and finished.
Client: CastleQuestBookMainQuestListVO.parseListsFromParamObject (bundle line 52419). An id is a
main quest's mainQuestID: the book and the main quest dialog load the same Quest_<id><status>
picture (bundle lines 52435, 93389)
Fields:
-
announced_quest_ids(tuple[EnumOrInt['MainQuest'], ...]) -
running_quest_ids(tuple[EnumOrInt['MainQuest'], ...]) -
finished_quest_ids(tuple[EnumOrInt['MainQuest'], ...])
model_config
class-attribute
¶
model_config: ConfigDict = ConfigDict(frozen=True, populate_by_name=True)
announced_quest_ids
pydantic-field
¶
Wire key ANN
The main quests announced
running_quest_ids
pydantic-field
¶
Wire key R
The main quests running
finished_quest_ids
pydantic-field
¶
Wire key D
The main quests finished
QuestListResponse
pydantic-model
¶
Bases: BaseResponse
Your active quests, replacing the ones held, and the quest book's main quests when all three lists are sent.
Command: qli, a push and the reply to a quest list request.
Client: QLICommand.exec (bundle line 126625), CastleQuestData.parseActiveQuestList (bundle line
20256), which empties the list first, and CastleQuestBookMainQuestListVO.parseListsFromParamObject
(bundle line 52442), which reads ANN, R and D only when all three are truthy
Fields:
Validators:
-
_book -
_quests→quests
QuestsStartedResponse
pydantic-model
¶
Bases: BaseResponse
Quests that started: each becomes active, without progress.
Command: qst, a push.
Client: QSTCommand.exec (bundle line 126657) calls CastleQuestData.startQuest (bundle line 20241)
for each truthy id of QIDS
Fields:
-
error_code(int) -
quest_ids(tuple[EnumOrInt['QuestId'], ...])
Validators:
-
_truthy_ids→quest_ids
QuestProgressResponse
pydantic-model
¶
Bases: BaseResponse
A quest made progress: only the quest is named; its counters come with the next qli.
Command: qpg, a push.
Client: QPGCommand.exec (bundle line 126641), CastleQuestData.parseQuestProgress (bundle line
20251), which reads int(P[0]) and nothing else of P
Fields:
-
error_code(int) -
quest_id(EnumOrInt['QuestId'] | None)
Validators:
-
_first→quest_id
QuestFinishedResponse
pydantic-model
¶
Bases: BaseResponse
A quest is finished: it is no longer active, and its random equipment rewards are shown.
Command: qfi, a push.
Client: QFICommand.exec (bundle line 126604) reads int(QID) for the quest's prototype and
CastleQuestData.finishQuest (bundle line 20254) drops the active quest; GEQ goes to
CastleQuestCompletedDialogProperties (bundle line 54013) as a collectable list
Fields:
-
error_code(int) -
quest_id(EnumOrInt['QuestId']) -
random_equipment_rewards(CollectableRows)
Validators:
-
_int→quest_id
random_equipment_rewards
pydantic-field
¶
random_equipment_rewards: CollectableRows = ()
Wire key GEQ
The random equipment the quest gave, if any
CampaignQuestStatusResponse
pydantic-model
¶
Bases: BaseResponse
The time-limited campaign's quests and end reward, read over the running campaign event.
Command: cqs, a push.
Client: CQSCommand.exec (bundle line 126533) does nothing without the campaign running;
TimeLimitedCampaignEventEventVO.parseCQS (bundle line 118593) and parseParamObject (bundle
line 118574), which sort the quests by ST and then CQID; CommKeys.END_REWARD_VALUE is
ERV (dll)
Fields:
-
error_code(int) -
reward_ids(tuple[RewardId, ...]) -
reward_collected(bool) -
end_reward_value(int) -
quests(tuple[Quest, ...])
Validators:
-
_ids→reward_ids -
_collected→reward_collected -
_value→end_reward_value -
_campaign_order→quests
reward_ids
pydantic-field
¶
Wire key RIDS
The campaign's rewards; GameData.reward_list gives what they hold
reward_collected
pydantic-field
¶
reward_collected: bool = False
Wire key COL
You collected the end reward (1 == COL)
Popup
pydantic-model
¶
Bases: EmpireModel
One popup of an msp: which, and the value its dialog reads.
Client: CastlePopUpHelper.displayPopUps (bundle line 12922) reads int(POP) and hands VAL to
displayPopUp (bundle line 12928), whose dialog reads what it needs of it
Fields:
Validators:
-
_quest -
_int→popup_id
PopupsResponse
pydantic-model
¶
Bases: BaseResponse
Popups the server asks the client to show.
Command: msp, a push.
Client: MSPCommand.exec (bundle line 125476), CastlePopUpHelper.displayPopUps (bundle line
12922), which reads every entry of P
Fields:
-
error_code(int) -
popups(tuple[Popup, ...])
Validators:
-
_entries→popups
DailyQuest
pydantic-model
¶
Bases: EmpireModel
One of today's daily quests.
Client: DailyQuestVO.setProgress and setFinished (bundle lines 134132, 134135)
Fields:
model_config
class-attribute
¶
model_config: ConfigDict = ConfigDict(frozen=True, populate_by_name=True)
progress
pydantic-field
¶
Wire key P
Each condition's counter, read through int(); empty for a finished quest, whose counters are full
DailyQuests
pydantic-model
¶
Bases: BaseResponse
Your daily quests: your daily quest level, today's quests and the reward thresholds.
Command: dql, as a login section of gbd and a push; the client has no request for it.
Payload: {"PQL": level, "FDQ": [finished quest id, ...], "RDQ": [{"QID": id, "P": [counter, ...]}, ...],
"RS": [threshold rewards, ...]}
The client drops the ids its items lack; the library keeps every one. A falsy RS leaves the
thresholds unset, so over keeps the earlier ones.
Client: DQLCommand.exec (split.js line 640563), CastleDailyQuestData.parse_DQL (split.js line 669180),
parse_RDQ, parse_FDQ and parseThresholdRewardList (split.js lines 669195, 669205, 669215)
Fields:
-
error_code(int) -
level(int) -
quests(tuple[DailyQuest, ...]) -
threshold_rewards(tuple[tuple[Collectable, ...], ...])
Validators:
-
_quest_lists -
_level→level -
_thresholds→threshold_rewards
quests
pydantic-field
¶
quests: tuple[DailyQuest, ...] = ()
The finished (FDQ) and running (RDQ) quests, by quest id
threshold_rewards
pydantic-field
¶
threshold_rewards: tuple[tuple[Collectable, ...], ...] = ()
Wire key RS
Each reward threshold's rewards, in threshold order; empty when none were sent
over
¶
over(previous: DailyQuests | None) -> DailyQuests
These daily quests applied over previous: without thresholds of their own, they keep its.
QuestDonateResourcesRequest
pydantic-model
¶
Bases: BaseRequest
Donate resources for a quest's donate condition.
Command: qdr Payload: {"QID": quest_id, "F": food, "W": wood, "S": stone, "C1": coins, "O": oil, "C": coal, "I": iron, "G": glass, "PWR": 0, "PO": -1}
DonateForQuestCommand.performAction puts the condition's amount in the one field of its
resource and leaves the rest 0. PWR 1 with a merchant in PO buys missing resources
with rubies, which only the resource wait dialog sends (bundle line 35225).
Client: C2SQuestDonateRessourcesVO (bundle line 47687), sent by
DonateForQuestCommand.performAction (bundle lines 101001-101021)
Fields:
-
quest_id(EnumOrInt['QuestId']) -
food(int) -
wood(int) -
stone(int) -
coins(int) -
oil(int) -
coal(int) -
iron(int) -
glass(int) -
pay_with_rubies(int) -
private_offer(int)
QuestDonateResourcesResponse
pydantic-model
¶
Bases: BaseResponse
The answer to a resource donation; the client reads nothing from it.
Command: qdr
Client: QDRCommand.executeCommand (bundle line 126553)
Fields:
QuestDonateCurrencyRequest
pydantic-model
¶
Bases: BaseRequest
Donate a currency, khan medals or samurai tokens, for a quest's donate condition.
Command: qdc Payload: {"QID": quest_id, "CID": currency_id, "A": amount}
Client: C2SQuestDonateCurrencyVO (bundle line 101033), sent by
DonateForQuestCommand.performAction (bundle lines 101019-101021)
Fields:
-
quest_id(EnumOrInt['QuestId']) -
currency_id(CurrencyId) -
amount(int)
QuestDonateCurrencyResponse
pydantic-model
¶
Bases: BaseResponse
The answer to a currency donation; the client reads nothing from it.
Command: qdc
Client: QDCCommand.executeCommand (bundle line 126540)
Fields:
FinishQuestConditionRequest
pydantic-model
¶
Bases: BaseRequest
Report a quest condition done that only the client sees done, such as visiting a screen.
Command: fcq Payload: {"QC": condition_type, "QTID": target_id}
The client has no handler for an answer.
Client: C2SFinishQuestConditionVO (bundle line 41691)
Fields:
QuestStarterClickRequest
pydantic-model
¶
Bases: BaseRequest
Report a quest starter seen through: the dialog or tutorial step that introduces a quest is done.
Command: qsc Payload: {"QID": quest_id}
The client has no handler for an answer.
Client: C2SQuestStarterClickVO (bundle line 37187), sent by CastleStartQuestDialog.finishQuestStarter
(bundle line 17052), TutorialBasicActionCommand.finishTriggerQuest (bundle line 9024) and
TutorialAttackRobberBaronCommand.onPlayernameSelected (bundle line 143104)
Fields:
BuyCampaignQuestRequest
pydantic-model
¶
Bases: BaseRequest
Buy a time-limited campaign's quest done, with rubies.
Command: bcq Payload: {"CQID": campaign_quest_id}
Client: C2SBuyCampaignQuestVO (bundle line 458364), sent by CastleQuestBuyRewardDialog.onClick
(bundle line 270612) with the quest's campaignQuestID
Fields:
BuyCampaignQuestResponse
pydantic-model
¶
Bases: BaseResponse
The acknowledgement of a bcq; it carries nothing.
Command: bcq
Client: BCQCommand.exec (bundle line 640412)
Fields:
BuyCampaignRewardRequest
pydantic-model
¶
Bases: BaseRequest
Buy a time-limited campaign's end reward, with rubies.
Command: bcr Payload: {}
Client: C2SBuyCampaignRewardVO (bundle line 458390), sent by CastleQuestBuyRewardDialog.onClick
(bundle line 270612) when it shows no quest
BuyCampaignRewardResponse
pydantic-model
¶
Bases: BaseResponse
Your coins and rubies after buying a campaign's end reward.
Command: bcr
Client: BCRCommand.exec (bundle line 640456) hands gcu to parseGCU
Fields: