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

[Creature Spell] creature_template_spell "index" = 0 will not appear and work #20149

Open
kissingers opened this issue Oct 6, 2024 · 5 comments

Comments

@kissingers
Copy link
Contributor

kissingers commented Oct 6, 2024

Current Behaviour

creature_template_spell "index" = 0 will not appear and work.
the creature 25653, if you try control the blue dragon and see the spell, the index 0 spell in Database will not appear
but if change index big than 0, such as 4, will appear. the bug about 2 month. and before all ok.

Expected Blizzlike Behaviour

N/A

Source

No response

Steps to reproduce the problem

.go c 55066
fight with the boss kljd and wait 2m, try control the blue dragon and see the spell, the index 0 spell in Database will not appear

Extra Notes

No response

AC rev. hash/commit

AzerothCore rev. 01b86ec 2024-10-04 11:01:36 -0300 (master branch) (Unix, RelWithDebInfo, Static)
Connected players: 1. Characters in world: 1.
Connection peak: 0.
服务器运行时间: 45 second(s)
Update time diff: 100ms. Last 38 diffs summary:
|- Mean: 101ms
|- Median: 100ms
|- Percentiles (95, 99, max): 101ms, 133ms, 152ms
Using SSL version: OpenSSL 3.0.14 4 Jun 2024 (library: OpenSSL 3.0.14 4 Jun 2024)
Using Boost version: 1.74.0
Using CMake version: 3.25.1
Using MySQL version: 80402
Found MySQL Executable: /usr/bin/mysql
Compiled on: Linux 6.8.12-1-pve
Worldserver listening connections on port %u
Realmlist (Realm Id: 3) configured in port 54347
VMAPs status: Enabled. LineOfSight: true, getHeight: true, indoorCheck: true
MMAPs status: Enabled
maps directory located in /root/wow3/bin/maps. Total size: 291014339 bytes
vmaps directory located in /root/wow3/bin/vmaps. Total size: 658130553 bytes
mmaps directory located in /root/wow3/bin/mmaps. Total size: 2192911264 bytes
Default DBC locale: zhCN.
All available DBC locales: zhCN
Using World DB: ACDB 335.12-dev
Latest LoginDatabase update: 2024_01_20_00.sql
Latest CharacterDatabase update: 2024_09_22_00.sql
Latest WorldDatabase update: mod-zone-difficult.sql
LoginDatabase queue size: 0
CharacterDatabase queue size: 0
WorldDatabase queue size: 0
List of enabled modules:
|- mod-difficult
|- mod-eluna

Operating system

Debian 12 with PVE

Custom changes or Modules

No response

@kissingers
Copy link
Contributor Author

I tested other creature, if control by player, will not appear index 0 spell and replaced will normal attack ico

@heyitsbench
Copy link
Contributor

I suspect a result of 8874953 in some manner.

@kissingers
Copy link
Contributor Author

Might index 0 even if AddSpellToActionBar(spellInfo, ACT_PASSIVE, 0), will always replace by client with normal meel attack?

@kissingers
Copy link
Contributor Author

or here ACT_DISABLED problem?
if (PetActionBar[i].IsActionBarForSpell() && sSpellMgr->GetFirstSpellInChain(action) == first_id)
{
SetActionBar(i, 0, ACT_DISABLED);
return true;
}

@Nefertumm
Copy link
Member

The following code initializes the command attack action in the index 0 always for most of the creatures (unless the ones you add in the switch you previously used) because that method is called multiple times throughout without a parameter (making the parameter true as default).

void CharmInfo::InitEmptyActionBar(bool withAttack)
{
if (withAttack)
SetActionBar(ACTION_BAR_INDEX_START, COMMAND_ATTACK, ACT_COMMAND);
else
SetActionBar(ACTION_BAR_INDEX_START, 0, ACT_PASSIVE);
for (uint32 x = ACTION_BAR_INDEX_START + 1; x < ACTION_BAR_INDEX_END; ++x)
SetActionBar(x, 0, ACT_PASSIVE);
}

Since now, the creatures have an action already in index 0, the following code will prevent the spell from being correctly added to the action bar:

if (i != index && index <= MAX_UNIT_ACTION_BAR_INDEX)
continue;

Also, the pr added a possible segmentation fault by dereferencing a null pointer here

SetActionBar(i, spell_id, newstate == ACT_DECIDE ? spellInfo->IsAutocastable() ? ACT_DISABLED : ACT_PASSIVE : newstate);

Maybe the solution is either initializing the empty action bar with the parameter withAttack = false for entries that have index = 0 or something like that.

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

No branches or pull requests

3 participants