Skip to content

Don't copy mounts to characters without sufficient riding skill#19

Open
TRPB wants to merge 1 commit into
azerothcore:masterfrom
TRPB:check-riding-skill
Open

Don't copy mounts to characters without sufficient riding skill#19
TRPB wants to merge 1 commit into
azerothcore:masterfrom
TRPB:check-riding-skill

Conversation

@TRPB

@TRPB TRPB commented Nov 29, 2025

Copy link
Copy Markdown

Changes Proposed:

I don't know if something changed in azerothcore but today if a character learns the mount they can ride it. There is no check against riding skill when using the spell, only when learning it.

The result is that if you have a level 60 with a bunch of mounts then create a level 1 character on the same account, the mounts get copied to the level 1 character and the level 1 character can use them even if they don't have the sufficient riding skill to use the mount.

I can use a 100% mount at level 1 with this mod which breaks a fundamental game rule

Issues Addressed:

#18

Tests Performed:

Built and tested.

  1. Logged into character with sufficient riding skill and verified the mount is copied across as intended
  2. Logged into character without sufficient riding skill and verified the mount is no longer copied across

Comment thread src/mod_account_mount.cpp
{
QueryResult result2 = CharacterDatabase.Query("SELECT `spell` FROM `character_spell` WHERE `guid`={};", i);
QueryResult result2 = CharacterDatabase.Query("SELECT character_spell.`spell` FROM `character_spell`"
"INNER JOIN `acore_world`.`item_template` it ON it.`RequiredSkill` = {} AND it.`RequiredSkillRank`<={} AND it.`spellid_2`=character_spell.`spell`"

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea if this is the best way to handle the skill check. The spells themselves don't have a riding skill limitation so we need to go back to the item and cross reference the requirements needed to use the item that teaches the mount

The approach here also improves performance (A side effect and not the main goal of this pr) since we no longer have to loop through every single spell and can iterate over only the mounts

@TRPB

TRPB commented Jan 3, 2026

Copy link
Copy Markdown
Author

This works but the query is quite slow, we need to also add indexes on all the join fields. I'm not sure what the protocol is for modules adding indexes to AC. Adding it.class=15 speeds it up but that's still nearly 3000 records to search through without an index.

Anyone got any better suggestions for fixing it?

edit adding an index on spellid_2 is all we need but I don't know if that kind of db change is something a module should be doing. It should be harmless unless something else tries to add a similar index

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.

1 participant