Skill Handler Definitions #332
Labels
enhancement
This issue is about improving the quality of code or a feature.
refactoring
This issue relates to the refactoring of the code.
Our skill handlers currently take only the information that we really need, such as the skill in use, the caster, and the target, but there are more parameters sent by the client that we might need inside a skill handler. One example is a
direction
, which, so far, we handled inside the packet handler, before the skill handler was called.Now we finally encountered a skill that doesn't want the character to be pre-turned though, so we either have to semi-hardcode skill checks into the packet handlers, or we have to give control over this to the handlers, for which they need the direction parameter.
Since this might not be the last time we find a new parameter we need, and because we don't want to throw a dozens parameters at a skill handler, half of which may be unknowns, we should bite the bullet and redesign our skill handlers to take a usage parameters object that contains any additional information that might be required. Or rather one usage parameters object per skill type, so we don't end up with unused fields.
For this, we need to decide how we're going to change the skill handlers though. One option would be to only use that parameters object, but then we might end up with a pattern where we're constantly extracting information into variables for simpler use.
Another option might be to keep the current arguments, but add the object at the end for the remaining parameters. But that seems like a bit of a weird mix.
Not yet sure what the best strategy is here. If you have any thoughts, feel free to share them. Note that this affects not only the ground handlers though, but force and target handlers too, as they receive currently unused parameters as well.
The text was updated successfully, but these errors were encountered: