Translations:Implementation and Events/142/en

From DragonMineZ Wiki
Revision as of 05:26, 13 October 2026 by FuzzyBot (talk | contribs) (Importing a new version from external source)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
  • Objective classes extend QuestObjective and call the QuestObjective(String customType, int required) constructor; reward classes extend QuestReward, call QuestReward(String customType) and implement giveReward(ServerPlayer) and getDescription(). Objectives must also implement checkProgress(Object... params).
  • In quest JSON, use your key as the "type" (for example {"type": "MEDITATE", "seconds": 60}). Type keys are case-insensitive (stored in upper case). Treat them like registry names: don't rename them once quests use them.
  • The sync writer must write every field your factory reads, because the client parses the synced JSON again with your factory.
  • Unknown types are reported in the JSON load report (see Finding JSON mistakes) and the objective or reward is skipped.
  • Progress is server-authoritative and event-driven: listen to your own game events on the server and store progress with PlayerQuestData.setObjectiveProgress(questKey, objectiveIndex, progress), then sync with ProgressionSyncS2C. Use DMZEvent.QuestObjectiveProgressEvent and QuestCompletedEvent to react to built-in quests.