Jump to content

[Zero] Question about fixing spells


namreeb

Recommended Posts

Greetings.

I am working with Mangos Zero. I am using the database found here: https://github.com/TheLuda/mangos-zero-database. It has been brought to my attention that Warlock's Shadow Mastery does not affect DoTs such as Curse of Agony. After some debugging, I believe this is because there is no corresponding spell_affect entry in the database. I don't have much knowledge of mangos, nor of the database structure (both SQL and DBC) it uses. I do however have a fairly strong programming background, which means I think I know the problem but I cannot explain my reasoning :).

I had thought that to solve the problem I need only add the following to the SQL db:

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18275, 1, 12884993161);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18274, 1, 12884993161);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18273, 1, 12884993161);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18272, 1, 12884993161);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18271, 1, 12884993161);

This would cause the family mask value of 12884993161 (the same mask used by effect 0, which is the effect value used by Shadow Bolt) to be set for effect 1, which is the effect value used by Curse of Agony. Note that when I attach a debugger to the mangosd process and modify these values manually internally, the talent IS applied to Curse of Agony.

Now, when I did this and issued a reload spell_affect command in the mangosd console, I received the following error:

Re-Loading SpellAffect definitions...

[1 ms] SQL: SELECT entry, effectId, SpellFamilyMask FROM spell_affect

=Spell 18271 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped.

Spell 18272 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped.

Spell 18273 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped.

Spell 18274 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped.

=Spell 18275 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped.

Looking at the code, I see that the value retrieved from the database is compared to the value retrieved from the Spells.dbc file. Specifically, the "EffectItemType" fields. Note that the error log is base one, so EffectItemType2 refers to the second EffectItemType[] value. I modified the above output to show me the read values of the SQL database as well as the DBC file. My amended output is as follows (where the first value is the value from the DBC, and the second is the value from the SQL DB):

Loading SpellAffect definitions...

[0 ms] SQL: SELECT entry, effectId, SpellFamilyMask FROM spell_affect

=Spell 18271 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped. (2 != 91273)

Spell 18272 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped. (2 != 91273)

Spell 18273 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped. (2 != 91273)

Spell 18274 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped. (2 != 91273)

=Spell 18275 listed in `spell_affect` have different low part from EffectItemType2 for effect index (1) and not needed, skipped. (2 != 91273)

Note that 12884993161 cast to a 32 bit integer yields a value of 91273.

So, this leads me to conclude that simply inserting the previously mentioned rows into the SQL db is NOT the proper solution, as there is a sanity check in place to ensure these values conform to the DBC. So my question is...

What is the proper solution?

Edit: As requested by Vladimir on IRC, the proper mask value to insert into the DB is obtained as follows:

Corruption = 0x000000002

Curse of Agony = 0x000000400

Death Coil = 0x000080000

Drain Life = 0x000000008

Siphon Life = 0x100000000

The composition of these yields a value of (I believe) 0x10008040A.

Edit 2: The updated inserts are as follows (4295492618 is the decimal equivalent of 0x10008040A):

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18275, 1, 4295492618);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18274, 1, 4295492618);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18273, 1, 4295492618);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18272, 1, 4295492618);

INSERT INTO `world`.`spell_affect` (`entry`, `effectId`, `SpellFamilyMask`) VALUES

(18271, 1, 4295492618);

Link to comment
Share on other sites

it also in One. If you can see Master have note like "it can be good maybe restore spell_affect" note in SpellMod add function.

Before we think that with classfamilyMask fields it will not used and ~1 year it really not has been used but now we have some examples when dbc field values wrong and possible will be more like cases. I just not found time restore table that need also check later code changes for compatibility with old remove-time state. So at this moment like exceptions added directly to code. :/

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use