LegionCore-7.3.5 icon indicating copy to clipboard operation
LegionCore-7.3.5 copied to clipboard

Hearthstone // Itemspell

Open slash-design opened this issue 1 year ago • 1 comments

If you use the hearthstone, other players will not see the spell. Does not only affect the hearthstone. It affects all items with spells.

slash-design avatar Feb 18 '24 11:02 slash-design

I think the error is in the Player.cpp at CastItemUseSpell The triggerdatas are the problem

slash-design avatar Feb 18 '24 15:02 slash-design

I think the error is in the Player.cpp at CastItemUseSpell The triggerdatas are the problem

Have you been able to fix it?

randiel123 avatar Apr 30 '24 17:04 randiel123

Well, unfortunately not quite yet. I have managed to get the spells to be displayed for all other players, but the items are no longer scored. This means that if you drink water, for example, and you have 20 of it, the counter doesn't go down any further. Instead of 19 items, the item remains at 20 items.

By the way. The fact that the spells are not displayed does not only apply to Hearthstone, but to all magic items. Items in quests... etc.

Does anyone have an idea to fix it correctly ?

slash-design avatar Apr 30 '24 18:04 slash-design

Well, unfortunately not quite yet. I have managed to get the spells to be displayed for all other players, but the items are no longer scored. This means that if you drink water, for example, and you have 20 of it, the counter doesn't go down any further. Instead of 19 items, the item remains at 20 items.

By the way. The fact that the spells are not displayed does not only apply to Hearthstone, but to all magic items. Items in quests... etc.

Does anyone have an idea to fix it correctly ?

Ok, now I'll check to see what I can do and pass solution. You had said that the problem was in the TriggerData right?

randiel123 avatar May 01 '24 02:05 randiel123

Well, at least I think so. I looked it up on TrinityCore. From there I got the ServerCastId and ClientCastId. This can be found in the Player.cpp under

void Player::CastItemUseSpell

The CastId must also be added to the ScriptMgr.

Then it has at least shown the spell for all players, but unfortunately the items are no longer counted -.-

slash-design avatar May 01 '24 04:05 slash-design

Well, at least I think so. I looked it up on TrinityCore. From there I got the ServerCastId and ClientCastId. This can be found in the Player.cpp under

void Player::CastItemUseSpell

The CastId must also be added to the ScriptMgr.

Then it has at least shown the spell for all players, but unfortunately the items are no longer counted -.-

Ok, well I'll check that out and see how I fix it, I already have an idea of ​​how I can fix it. When I solve it, I'll send you the solution here.

randiel123 avatar May 01 '24 05:05 randiel123

That would of course be super nice of you :-)

slash-design avatar May 01 '24 06:05 slash-design

Well, I've tried several times and I still haven't found the solution. I have compiled the TrinityCore server and deleted its ServerCastId and ClientCastId lines but still in Trinitycore, even if you delete those lines, the item's ability is still visible in the others. I don't know whether to give up or continue xd

randiel123 avatar May 02 '24 02:05 randiel123

I currently feel the same way :-) I'll have another look when I've finished with the garrisons. But maybe you or someone else has an idea for a solution :-) As I said, I suspect it's the TriggerDatas. It's just very annoying because you can never see what another player is currently doing :-)

slash-design avatar May 02 '24 04:05 slash-design

@dufernst Do you have any idea where the problem could be?

slash-design avatar May 21 '24 20:05 slash-design

HandleUseItemOpcode

ReyDonovan avatar May 22 '24 19:05 ReyDonovan

And what do you think is the error there?

slash-design avatar May 22 '24 19:05 slash-design

you need to look towards the handler

ReyDonovan avatar May 22 '24 19:05 ReyDonovan

I've already tried that too. I have changed everything there to “TrinityCore-Like”. No success.

grafik

slash-design avatar May 22 '24 20:05 slash-design

Update: It has something to do with the m_SpellVisual in the Spell.cpp.

The following code is stored there under Spell::prepare:

if (!m_SpellVisual)
    m_SpellVisual = m_spellInfo->GetSpellXSpellVisualId(m_caster, m_targets.GetUnitTarget() ? m_targets.GetUnitTarget() : m_caster);

If you remove this code, no spell appears at all. If you type in .cast 8690 (Hearthstone) then it starts the spell, but does not display the visual. If you click on the hearthstone (item 6948) in your bag, it also casts the spell, but does not display anything. So the error must have something to do with the SpellVisual......

slash-design avatar May 27 '24 11:05 slash-design

Hm seems like old bug tc

ReyDonovan avatar May 27 '24 13:05 ReyDonovan

@ReyDonovan You don't happen to know how TC fixed it?

Unfortunately I can't find the commit of the fix -.-

slash-design avatar May 27 '24 13:05 slash-design

I looked at the problem a little. If you set the combat log to full logging, then the second client (observer) will not even receive a message in the combat log that someone has started casting a spell. Therefore, the issue is not in the visual part, but in general in the fact that other clients do not receive information that someone has started casting a spell when using an item.

Fragrus avatar May 28 '24 01:05 Fragrus

Yes, sir. I researched this topic. I have no idea why there are so many such small schools in this core, but they appear here and there. As I expected, the other client was receiving incorrect data. This is due to spellCastData and the SMSG_SPELL_START package. The GUID order is mixed up there. In fact, I have no idea why this even worked for all the other spells, but here we are. In this core we have this: https://github.com/dufernst/LegionCore-7.3.5/blob/bf7199a73c99b4e62f5444aa862ba864cd553dbb/src/server/game/Server/Packets/SpellPackets.cpp#L486 In TC it is: https://github.com/TrinityCore/TrinityCore/blob/31f6ba5a92b0f88f328e0e6adcf33bd4820599c2/src/server/game/Server/Packets/SpellPackets.cpp#L360 I think comments are unnecessary.

 data << spellCastData.CasterUnit;
 data << spellCastData.CasterGUID;

change to:

 data << spellCastData.CasterGUID;
 data << spellCastData.CasterUnit;

I was already assembling the core in Debug mode, but I was lucky that I thought of running the sniffer and climbed in to see how the package was being formed. If you're not too lazy, please make a pull request for this issue.

изображение

Fragrus avatar May 28 '24 03:05 Fragrus

@Fragrus

I have exactly one more thing to say.... I love you :-)

Thank you 1000 times for this fix :-)

slash-design avatar May 29 '24 05:05 slash-design

@Fragrus thanks again for the fix :+1: And @slash-design thanks for confirming. :+1:

dufernst avatar May 29 '24 06:05 dufernst