Anime-Game-Servers / Grasscutter-Quests

A server software implementation, ineroperable with a certain anime game client. The code in this repository is fully custom made for edyoucational purposes and future preservation, no copyrighted code is allowed in this repository.
https://grasscutters.xyz/grasscutter
GNU Affero General Public License v3.0
138 stars 31 forks source link

[Bug] Lock time needs to be implemented. #82

Open scooterboo opened 9 months ago

scooterboo commented 9 months ago

Describe the bug

Lock time needs to be (re?)implemented. Time should not pass if any of the following is happening:

  1. If the game is paused
  2. A quest has executed QUEST_EXEC_SET_IS_GAME_TIME_LOCKED with a param of 1 (disabled with a param of 0)
  3. The client has sent packet ClientLockGameTimeNotify with a value of "true" (disabled with a value of "false")

PlayerProperty.PROP_IS_GAME_TIME_LOCKED needs to be set for 2 and 3.

time locking is mainly handled with a variable we call isGameTimeLocked in World.java

Form observation of the resources and the reactions of the client: QUEST_EXEC_SET_IS_GAME_TIME_LOCKED is used by quests to make the sun not move between multiple quest lines. ClientLockGameTimeNotify seems to be used for dialogs where time passing might not make narrative sense. ClientLockGameTimeNotify DOES NOT override a QUEST_EXEC_SET_IS_GAME_TIME_LOCKED and vise versa. It seems that all locks have to be clear for time to pass.

Things to watch for when implementing: When time unlocks, it needs to not jump. If scene time is not unlocked by the time you enter Lisa's dungeon, the platforms in Lisa's dungeon will not work. a ClientLockGameTimeNotify packet should not make time pass if a QUEST_EXEC_SET_IS_GAME_TIME_LOCKED is currently being set to 1. QUEST_EXEC_SET_IS_GAME_TIME_LOCKED seems to save between logins (or maybe quests re-execute it on login? (probably not)). ClientLockGameTimeNotify it might make sense to not save. It typically happens at the start of a dialog, which you might be able to dodge triggering again with a relog? If PlayerProperty.PROP_IS_GAME_TIME_LOCKED is set, the Paimon clock will not work.

Which branch did you use? multi_proto Grasscutter version: 1.4.4-dev-59e2d2b4

Screenshots

When first spawning at the beach:

https://github.com/Anime-Game-Servers/Grasscutter-Quests/assets/1877986/6de9fd0d-df35-42aa-afbf-59c5416d8831

Hartie95 commented 9 months ago

The exec part should be implemented already, the start time should be handled in https://github.com/Anime-Game-Servers/Grasscutter-Quests/pull/81/commits/24f55cbd4e30dc60d7dec1786db61ff59997dddd temporary locks from the client for talks still needs to be implemented, as you suggested, it might be a separate lock, but it will require more research to be fully sure. But the client locking is more a small visual thing affecting talks, so it will be prioritized lower then breaking bugs.