[8416] Fixed problem with double cast form passives at loading.

* Drop learning form passives at form psell learning, and cast it explictly from code in all cases.
* Drop cast form passives at learning.
* Note: talents that have dependent form time passives still work in original way: learned and casted at learn if need.
* Drop hack for spell 24907 casting at form apply: it casted fines as result normal triggered effect in related form spell.

Original patch provided by nos4r2zod.
This commit is contained in:
VladimirMangos 2009-08-25 08:19:58 +04:00
parent bee8a0ddce
commit 208c84556e
6 changed files with 41 additions and 50 deletions

View file

@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL, `version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0', `cache_id` int(10) default '0',
`required_8412_01_mangos_mangos_string` bit(1) default NULL `required_8416_01_mangos_spell_learn_spell` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
-- --
@ -17045,39 +17045,20 @@ CREATE TABLE `spell_learn_spell` (
LOCK TABLES `spell_learn_spell` WRITE; LOCK TABLES `spell_learn_spell` WRITE;
/*!40000 ALTER TABLE `spell_learn_spell` DISABLE KEYS */; /*!40000 ALTER TABLE `spell_learn_spell` DISABLE KEYS */;
INSERT INTO `spell_learn_spell` VALUES INSERT INTO `spell_learn_spell` VALUES
(71,7376,0),
(768,3025,0),
(783,5419,0),
(1066,5421,0),
(2457,21156,0),
(2458,7381,0),
(5487,1178,0),
(5487,21178,0),
(5784,33388,1), (5784,33388,1),
(9634,9635,0),
(9634,21178,0),
(13819,33388,1), (13819,33388,1),
(17002,24867,0), (17002,24867,0),
(23161,33391,1), (23161,33391,1),
(23214,33391,1), (23214,33391,1),
(24858,24905,0),
(24866,24864,0), (24866,24864,0),
(33872,47179,0), (33872,47179,0),
(33873,47180,0), (33873,47180,0),
(33891,5420,0),
(33891,34123,0),
(33943,33948,0),
(33943,34090,1), (33943,34090,1),
(33943,34764,0),
(34767,33391,1), (34767,33391,1),
(34769,33388,1), (34769,33388,1),
(40123,40121,0),
(40123,40122,0),
(53428,53341,1), (53428,53341,1),
(53428,53343,1), (53428,53343,1),
(58984,21009,1); (58984,21009,1);
/*!40000 ALTER TABLE `spell_learn_spell` ENABLE KEYS */; /*!40000 ALTER TABLE `spell_learn_spell` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;

View file

@ -0,0 +1,21 @@
ALTER TABLE db_version CHANGE COLUMN required_8412_01_mangos_mangos_string required_8416_01_mangos_spell_learn_spell bit;
/* All form passives */
DELETE FROM spell_learn_spell WHERE SpellID in (
1178, /* Bear Form (Passive) */
3025, /* Cat Form (Passive) */
5419, /* Travel Form (Passive) */
5420, /* Tree of Life _passive_ */
5421, /* Aquatic Form (Passive) */
7376, /* Defensive Stance Passive */
7381, /* Berserker Stance Passive */
9635, /* Dire Bear Form (Passive) */
21156, /* Battle Stance Passive */
21178, /* Bear Form (Passive2) */
24905, /* Moonkin Form (Passive) */
34123, /* Tree of Life _pasive_ */
33948, /* Flight Form (Passive) */
34764, /* Flight Form (Passive) */
40121, /* Swift Flight Form (Passive) */
40122 /* Swift Flight Form (Passive) */
);

View file

@ -94,6 +94,7 @@ pkgdata_DATA = \
8402_02_characters_guild_bank_eventlog.sql \ 8402_02_characters_guild_bank_eventlog.sql \
8409_01_characters_guild.sql \ 8409_01_characters_guild.sql \
8412_01_mangos_mangos_string.sql \ 8412_01_mangos_mangos_string.sql \
8416_01_mangos_spell_learn_spell.sql \
README README
## Additional files to include when running 'make dist' ## Additional files to include when running 'make dist'
@ -168,4 +169,5 @@ EXTRA_DIST = \
8402_02_characters_guild_bank_eventlog.sql \ 8402_02_characters_guild_bank_eventlog.sql \
8409_01_characters_guild.sql \ 8409_01_characters_guild.sql \
8412_01_mangos_mangos_string.sql \ 8412_01_mangos_mangos_string.sql \
8416_01_mangos_spell_learn_spell.sql \
README README

View file

@ -3116,24 +3116,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen
bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
{ {
bool need_cast = false; // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell
// talent dependent passives activated at form apply have proper stance data
switch(spellInfo->Id) bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)));
{
// some spells not have stance data expected cast at form change or present
case 5420: need_cast = (m_form == FORM_TREE); break;
case 5419: need_cast = (m_form == FORM_TRAVEL); break;
case 7376: need_cast = (m_form == FORM_DEFENSIVESTANCE); break;
case 7381: need_cast = (m_form == FORM_BERSERKERSTANCE); break;
case 21156: need_cast = (m_form == FORM_BATTLESTANCE); break;
case 21178: need_cast = (m_form == FORM_BEAR || m_form == FORM_DIREBEAR); break;
case 33948: need_cast = (m_form == FORM_FLIGHT); break;
case 34764: need_cast = (m_form == FORM_FLIGHT); break;
case 40121: need_cast = (m_form == FORM_FLIGHT_EPIC); break;
case 40122: need_cast = (m_form == FORM_FLIGHT_EPIC); break;
// another spells have proper stance data
default: need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); break;
}
//Check CasterAuraStates //Check CasterAuraStates
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));

View file

@ -5474,8 +5474,6 @@ void Aura::HandleShapeshiftBoosts(bool apply)
break; break;
case FORM_MOONKIN: case FORM_MOONKIN:
spellId1 = 24905; spellId1 = 24905;
// aura from effect trigger spell
spellId2 = 24907;
MasterShaperSpellId = 48421; MasterShaperSpellId = 48421;
break; break;
case FORM_FLIGHT: case FORM_FLIGHT:
@ -5483,15 +5481,15 @@ void Aura::HandleShapeshiftBoosts(bool apply)
spellId2 = 34764; spellId2 = 34764;
break; break;
case FORM_FLIGHT_EPIC: case FORM_FLIGHT_EPIC:
spellId1 = 40122; spellId1 = 40122;
spellId2 = 40121; spellId2 = 40121;
break; break;
case FORM_METAMORPHOSIS: case FORM_METAMORPHOSIS:
spellId1 = 54817; spellId1 = 54817;
spellId2 = 54879; spellId2 = 54879;
break; break;
case FORM_SPIRITOFREDEMPTION: case FORM_SPIRITOFREDEMPTION:
spellId1 = 27792; spellId1 = 27792;
spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation. spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
break; break;
case FORM_SHADOW: case FORM_SHADOW:
@ -5506,14 +5504,15 @@ void Aura::HandleShapeshiftBoosts(bool apply)
case FORM_STEALTH: case FORM_STEALTH:
case FORM_CREATURECAT: case FORM_CREATURECAT:
case FORM_CREATUREBEAR: case FORM_CREATUREBEAR:
spellId1 = 0;
break; break;
} }
if(apply) if(apply)
{ {
if (spellId1) m_target->CastSpell(m_target, spellId1, true, NULL, this ); if (spellId1)
if (spellId2) m_target->CastSpell(m_target, spellId2, true, NULL, this); m_target->CastSpell(m_target, spellId1, true, NULL, this );
if (spellId2)
m_target->CastSpell(m_target, spellId2, true, NULL, this);
if (m_target->GetTypeId() == TYPEID_PLAYER) if (m_target->GetTypeId() == TYPEID_PLAYER)
{ {
@ -5604,9 +5603,12 @@ void Aura::HandleShapeshiftBoosts(bool apply)
} }
else else
{ {
m_target->RemoveAurasDueToSpell(spellId1); if(spellId1)
m_target->RemoveAurasDueToSpell(spellId2); m_target->RemoveAurasDueToSpell(spellId1);
m_target->RemoveAurasDueToSpell(MasterShaperSpellId); if(spellId2)
m_target->RemoveAurasDueToSpell(spellId2);
if(MasterShaperSpellId)
m_target->RemoveAurasDueToSpell(MasterShaperSpellId);
Unit::AuraMap& tAuras = m_target->GetAuras(); Unit::AuraMap& tAuras = m_target->GetAuras();
for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();) for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8415" #define REVISION_NR "8416"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__