Skip to content

fix: resolve action ID collisions, spell retention on login, and hook registration - #77

Merged
Helias merged 3 commits into
azerothcore:masterfrom
striker30345:master
May 11, 2026
Merged

fix: resolve action ID collisions, spell retention on login, and hook registration#77
Helias merged 3 commits into
azerothcore:masterfrom
striker30345:master

Conversation

@striker30345

@striker30345 striker30345 commented May 11, 2026

Copy link
Copy Markdown
Contributor

closes #75

Overview

This PR addresses several critical issues in the mod-npc-beastmaster module that caused creature spawning failures and the loss of hunter abilities for non-hunter classes upon re-logging.

Changes Made

1. Resolved Action ID Collision for Spawning

  • Issue: The module used a small offset (PET_PAGE_MAX = 901) to generate Action IDs for spawning pets. This caused a collision with the "Tracked Pets" menu system (reserved range 1000–4999), causing spawn requests to fail or be misinterpreted as pet management commands.
  • Fix: Introduced PET_CREATE_OFFSET = 100000. This ensures that dynamically generated Action IDs for pet creation remain well outside the range of static menu actions.

2. Fixed Spell Retention & Database Integrity

  • Issue: Non-hunter classes had their pet-related spells (e.g., Call Pet, Feed Pet) stripped by the core's spell validation during login. Subsequent attempts to re-teach these spells caused [1062] Duplicate entry SQL errors in the character_spell table because old entries were not being properly cleared.
  • Fix: Updated the login logic to manually clear existing hunter spell entries from the database before re-teaching them, ensuring a clean state and preventing crashes/errors in the ac-worldserver logs.

3. Corrected Script Hook Registration

  • Issue: The module was using an outdated/incorrect function signature OnLogin(Player* player). Because it lacked the override keyword, it failed silently and was never actually executed by the AzerothCore engine.
  • Fix: Renamed the function to the modern OnPlayerLogin signature and properly registered the PLAYERHOOK_ON_LOGIN hook. Added the override keyword to prevent future regressions.

Testing Performed

  • Spawning: Verified that all creatures in the NPC list now spawn correctly without being blocked by menu collisions.
  • Persistence: Confirmed that non-hunter classes (specifically tested on Rogue) retain all necessary pet management abilities after logging out and back in.
  • Stability: Verified that the [1062] Duplicate entry SQL errors no longer appear in the server console during logout.
  • Compilation: The module now compiles successfully at 100% with the correct function overrides.

Note to Maintainer

Included in this PR is a detailed chat transcript (Beastmaster Mod Fix - Chat.md) documenting the AI-assisted debugging process used to identify the logic collisions and the modernization of the PlayerScript hooks.

Beastmaster Mod Fix - Chat.md

@Helias
Helias merged commit 99dbd9b into azerothcore:master May 11, 2026
1 check passed
@Helias

Helias commented May 11, 2026

Copy link
Copy Markdown
Member

thanks for the PR

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.

Most pets on list are not spawnable

2 participants