Skip to content

Commit

Permalink
[8416] Fixed problem with double cast form passives at loading.
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
VladimirMangos committed Aug 25, 2009
1 parent 57073d6 commit f6a9b39
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 50 deletions.
21 changes: 1 addition & 20 deletions sql/mangos.sql
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`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';

--
Expand Down Expand Up @@ -17045,39 +17045,20 @@ CREATE TABLE `spell_learn_spell` (
LOCK TABLES `spell_learn_spell` WRITE;
/*!40000 ALTER TABLE `spell_learn_spell` DISABLE KEYS */;
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),
(9634,9635,0),
(9634,21178,0),
(13819,33388,1),
(17002,24867,0),
(23161,33391,1),
(23214,33391,1),
(24858,24905,0),
(24866,24864,0),
(33872,47179,0),
(33873,47180,0),
(33891,5420,0),
(33891,34123,0),
(33943,33948,0),
(33943,34090,1),
(33943,34764,0),
(34767,33391,1),
(34769,33388,1),
(40123,40121,0),
(40123,40122,0),
(53428,53341,1),
(53428,53343,1),
(58984,21009,1);


/*!40000 ALTER TABLE `spell_learn_spell` ENABLE KEYS */;
UNLOCK TABLES;

Expand Down
21 changes: 21 additions & 0 deletions sql/updates/8416_01_mangos_spell_learn_spell.sql
@@ -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) */
);
2 changes: 2 additions & 0 deletions sql/updates/Makefile.am
Expand Up @@ -94,6 +94,7 @@ pkgdata_DATA = \
8402_02_characters_guild_bank_eventlog.sql \
8409_01_characters_guild.sql \
8412_01_mangos_mangos_string.sql \
8416_01_mangos_spell_learn_spell.sql \
README

## Additional files to include when running 'make dist'
Expand Down Expand Up @@ -168,4 +169,5 @@ EXTRA_DIST = \
8402_02_characters_guild_bank_eventlog.sql \
8409_01_characters_guild.sql \
8412_01_mangos_mangos_string.sql \
8416_01_mangos_spell_learn_spell.sql \
README
21 changes: 3 additions & 18 deletions src/game/Player.cpp
Expand Up @@ -3116,24 +3116,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen

bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const
{
bool need_cast = false;

switch(spellInfo->Id)
{
// 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;
}
// 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
bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1)));

//Check CasterAuraStates
return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState)));
Expand Down
24 changes: 13 additions & 11 deletions src/game/SpellAuras.cpp
Expand Up @@ -5474,24 +5474,22 @@ void Aura::HandleShapeshiftBoosts(bool apply)
break;
case FORM_MOONKIN:
spellId1 = 24905;
// aura from effect trigger spell
spellId2 = 24907;
MasterShaperSpellId = 48421;
break;
case FORM_FLIGHT:
spellId1 = 33948;
spellId2 = 34764;
break;
case FORM_FLIGHT_EPIC:
spellId1 = 40122;
spellId1 = 40122;
spellId2 = 40121;
break;
case FORM_METAMORPHOSIS:
spellId1 = 54817;
spellId1 = 54817;
spellId2 = 54879;
break;
case FORM_SPIRITOFREDEMPTION:
spellId1 = 27792;
spellId1 = 27792;
spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation.
break;
case FORM_SHADOW:
Expand All @@ -5506,14 +5504,15 @@ void Aura::HandleShapeshiftBoosts(bool apply)
case FORM_STEALTH:
case FORM_CREATURECAT:
case FORM_CREATUREBEAR:
spellId1 = 0;
break;
}

if(apply)
{
if (spellId1) m_target->CastSpell(m_target, spellId1, true, NULL, this );
if (spellId2) m_target->CastSpell(m_target, spellId2, true, NULL, this);
if (spellId1)
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)
{
Expand Down Expand Up @@ -5604,9 +5603,12 @@ void Aura::HandleShapeshiftBoosts(bool apply)
}
else
{
m_target->RemoveAurasDueToSpell(spellId1);
m_target->RemoveAurasDueToSpell(spellId2);
m_target->RemoveAurasDueToSpell(MasterShaperSpellId);
if(spellId1)
m_target->RemoveAurasDueToSpell(spellId1);
if(spellId2)
m_target->RemoveAurasDueToSpell(spellId2);
if(MasterShaperSpellId)
m_target->RemoveAurasDueToSpell(MasterShaperSpellId);

Unit::AuraMap& tAuras = m_target->GetAuras();
for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8415"
#define REVISION_NR "8416"
#endif // __REVISION_NR_H__

0 comments on commit f6a9b39

Please sign in to comment.