Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues with Auto Shadow Spell #3292

Merged
merged 7 commits into from
Apr 30, 2024

Conversation

guilherme-gm
Copy link
Member

@guilherme-gm guilherme-gm commented Apr 28, 2024

Pull Request Prelude

Changes Proposed

Fixes a few issues with Auto Shadow Spell.

  1. When casting Auto Shadow Spell, we now properly check if there are skills copied with Intimidade/Reproduce before trying to get the skill_id
    This prevents assertion failures due to the skill id being "0" (no skill)
    In current code, this would still work, but cause a log about bad skill handling

  2. Fixed a check that prevented you from switching an active shadow spell to another when their Skill ID was smaller (due to sc val1)

  3. Fix assertion error when clicking "cance" or clicking "ok" in Auto Spell list without selecting a skill
    As far as I could analyze, the client is not cleaning up the field that stores the current selected skill, so when you click "ok" it just sends a garbage id that may (or may not) be a valid skill. We now validate before running the skill code.
    For cancel, it sends id "0", which is also fixed now since 0 is not a valid skill id.

As a bonus, I've converted both packets related to that flow to use structs.

Issues addressed: Closes #3286

the code was not taking into account cases where the player simply
didn't had a skill in reproduce or clone slot.
Due to the skill id being stored in val1, the default logic for SCs is
that lower val1 values doesn't replace higher ones, so recasting Auto
Shadow Spell to use another skill which has a smaller skill_id was
failing, while it should be allowed.
src/map/packets_struct.h Outdated Show resolved Hide resolved
…g error reporting

Sometimes you want to check whether the skill exists, but its
non-existance is not an error for Herc
older clients allows you to click "ok" even when you have not selected a
skill for Auto Shadow Spell.

In those cases, the client sends a random SkillID which Hercules reports
as an internal error (unexpected skill). This is outside our control,
but they generate noise and confusion.

Checking if the received skill_id is valid before going forward allows
us to only let valid skills get into the actuall skill code.
it should always be 1 (meaning auto shadow spell) and not the number of
skills in the list
@MishimaHaruna MishimaHaruna added this to the Release v2024.04 milestone Apr 30, 2024
@MishimaHaruna MishimaHaruna changed the base branch from stable to master April 30, 2024 13:59
@MishimaHaruna MishimaHaruna merged commit 1a0d4a4 into HerculesWS:master Apr 30, 2024
346 checks passed
@guilherme-gm guilherme-gm deleted the fix-shadow-spell branch May 1, 2024 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auto Shadow Spell Nullpo Error
3 participants