From 7448aaa37e22e65e0435ee67b6fbe78bf6ec27cd Mon Sep 17 00:00:00 2001 From: hunuza Date: Sun, 21 Jun 2009 10:32:59 +0200 Subject: [PATCH] [8060] Fix 56314 and ranks. Signed-off-by: hunuza --- sql/mangos.sql | 83 +++++++++++-------- .../8060_01_mangos_spell_pet_auras.sql | 17 ++++ sql/updates/Makefile.am | 2 + src/game/Player.cpp | 5 +- src/game/SpellAuras.cpp | 2 +- src/game/SpellEffects.cpp | 2 +- src/game/SpellMgr.cpp | 25 +++--- src/game/SpellMgr.h | 6 +- src/shared/revision_nr.h | 2 +- 9 files changed, 86 insertions(+), 58 deletions(-) create mode 100644 sql/updates/8060_01_mangos_spell_pet_auras.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index f713432a0..67501aa42 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`; CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, - `required_8053_01_mangos_command` bit(1) default NULL + `required_8060_01_mangos_spell_pet_auras` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -16707,9 +16707,10 @@ UNLOCK TABLES; DROP TABLE IF EXISTS `spell_pet_auras`; CREATE TABLE `spell_pet_auras` ( `spell` mediumint(8) unsigned NOT NULL COMMENT 'dummy spell id', + `effectId` tinyint(3) unsigned NOT NULL default '0', `pet` mediumint(8) unsigned NOT NULL default '0' COMMENT 'pet id; 0 = all', `aura` mediumint(8) unsigned NOT NULL COMMENT 'pet aura id', - PRIMARY KEY (`spell`,`pet`) + PRIMARY KEY (`spell`,`effectId`,`pet`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- @@ -16719,40 +16720,50 @@ CREATE TABLE `spell_pet_auras` ( LOCK TABLES `spell_pet_auras` WRITE; /*!40000 ALTER TABLE `spell_pet_auras` DISABLE KEYS */; INSERT INTO `spell_pet_auras` VALUES -(19028, 0, 25228), -(19578, 0, 19579), -(20895, 0, 24529), -(28757, 0, 28758), -(35029, 0, 35060), -(35030, 0, 35061), -(35691, 0, 35696), -(35692, 0, 35696), -(35693, 0, 35696), -(23785, 416, 23759), -(23822, 416, 23826), -(23823, 416, 23827), -(23824, 416, 23828), -(23825, 416, 23829), -(23785, 417, 23762), -(23822, 417, 23837), -(23823, 417, 23838), -(23824, 417, 23839), -(23825, 417, 23840), -(23785, 1860, 23760), -(23822, 1860, 23841), -(23823, 1860, 23842), -(23824, 1860, 23843), -(23825, 1860, 23844), -(23785, 1863, 23761), -(23822, 1863, 23833), -(23823, 1863, 23834), -(23824, 1863, 23835), -(23825, 1863, 23836), -(23785, 17252, 35702), -(23822, 17252, 35703), -(23823, 17252, 35704), -(23824, 17252, 35705), -(23825, 17252, 35706); +(19028, 0, 0, 25228), +(19578, 0, 0, 19579), +(20895, 0, 0, 24529), +(28757, 0, 0, 28758), +(35029, 0, 0, 35060), +(35030, 0, 0, 35061), +(35691, 0, 0, 35696), +(35692, 0, 0, 35696), +(35693, 0, 0, 35696), +(56314, 0, 0, 57447), +(56314, 1, 0, 57485), +(56315, 0, 0, 57452), +(56315, 1, 0, 57484), +(56316, 0, 0, 57453), +(56316, 1, 0, 57483), +(56317, 0, 0, 57457), +(56317, 1, 0, 57482), +(56318, 0, 0, 57458), +(56318, 1, 0, 57475), +(23785, 0, 416, 23759), +(23822, 0, 416, 23826), +(23823, 0, 416, 23827), +(23824, 0, 416, 23828), +(23825, 0, 416, 23829), +(23785, 0, 417, 23762), +(23822, 0, 417, 23837), +(23823, 0, 417, 23838), +(23824, 0, 417, 23839), +(23825, 0, 417, 23840), +(23785, 0, 1860, 23760), +(23822, 0, 1860, 23841), +(23823, 0, 1860, 23842), +(23824, 0, 1860, 23843), +(23825, 0, 1860, 23844), +(23785, 0, 1863, 23761), +(23822, 0, 1863, 23833), +(23823, 0, 1863, 23834), +(23824, 0, 1863, 23835), +(23825, 0, 1863, 23836), +(23785, 0, 17252, 35702), +(23822, 0, 17252, 35703), +(23823, 0, 17252, 35704), +(23824, 0, 17252, 35705), +(23825, 0, 17252, 35706); /*!40000 ALTER TABLE `spell_pet_auras` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/updates/8060_01_mangos_spell_pet_auras.sql b/sql/updates/8060_01_mangos_spell_pet_auras.sql new file mode 100644 index 000000000..f637bbf1b --- /dev/null +++ b/sql/updates/8060_01_mangos_spell_pet_auras.sql @@ -0,0 +1,17 @@ +ALTER TABLE db_version CHANGE COLUMN required_8053_01_mangos_command required_8060_01_mangos_spell_pet_auras bit; + +ALTER TABLE spell_pet_auras ADD effectId TINYINT( 3 ) UNSIGNED NOT NULL AFTER spell; + +ALTER TABLE spell_pet_auras DROP PRIMARY KEY, ADD PRIMARY KEY(spell,effectId,pet); + +INSERT INTO spell_pet_auras VALUES +(56314, 0, 0, 57447), +(56314, 1, 0, 57485), +(56315, 0, 0, 57452), +(56315, 1, 0, 57484), +(56316, 0, 0, 57453), +(56316, 1, 0, 57483), +(56317, 0, 0, 57457), +(56317, 1, 0, 57482), +(56318, 0, 0, 57458), +(56318, 1, 0, 57475); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index f7f603367..53e2d6d78 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -229,6 +229,7 @@ pkgdata_DATA = \ 8050_01_mangos_spell_proc_event.sql \ 8050_02_mangos_spell_bonus_data.sql \ 8053_01_mangos_command.sql \ + 8060_01_mangos_spell_pet_auras.sql \ README ## Additional files to include when running 'make dist' @@ -438,4 +439,5 @@ EXTRA_DIST = \ 8050_01_mangos_spell_proc_event.sql \ 8050_02_mangos_spell_bonus_data.sql \ 8053_01_mangos_command.sql \ + 8060_01_mangos_spell_pet_auras.sql \ README diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 669ebcd61..41a870108 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3107,8 +3107,9 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool update_action_bar_ RemoveAurasDueToSpell(spell_id); // remove pet auras - if(PetAura const* petSpell = spellmgr.GetPetAura(spell_id)) - RemovePetAura(petSpell); + for(int i = 0; i < 3; ++i) + if(PetAura const* petSpell = spellmgr.GetPetAura(spell_id, i)) + RemovePetAura(petSpell); // free talent points uint32 talentCosts = GetTalentSpellCost(spell_id); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index b8fe5b45d..2caa8b881 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2429,7 +2429,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) } // pet auras - if(PetAura const* petSpell = spellmgr.GetPetAura(GetId())) + if(PetAura const* petSpell = spellmgr.GetPetAura(GetId(), m_effIndex)) { if(apply) m_target->AddPetAura(petSpell); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 6f49c8289..206dd8951 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1769,7 +1769,7 @@ void Spell::EffectDummy(uint32 i) } // pet auras - if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id)) + if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id, i)) { m_caster->AddPetAura(petSpell); return; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index 99e98062a..b388651d2 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -2064,8 +2064,8 @@ void SpellMgr::LoadSpellPetAuras() uint32 count = 0; - // 0 1 2 - QueryResult *result = WorldDatabase.Query("SELECT spell, pet, aura FROM spell_pet_auras"); + // 0 1 2 3 + QueryResult *result = WorldDatabase.Query("SELECT spell, effectId, pet, aura FROM spell_pet_auras"); if( !result ) { @@ -2087,10 +2087,11 @@ void SpellMgr::LoadSpellPetAuras() bar.step(); uint16 spell = fields[0].GetUInt16(); - uint16 pet = fields[1].GetUInt16(); - uint16 aura = fields[2].GetUInt16(); + uint8 eff = fields[1].GetUInt8(); + uint16 pet = fields[2].GetUInt16(); + uint16 aura = fields[3].GetUInt16(); - SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find(spell); + SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find((spell<<8) + eff); if(itr != mSpellPetAuraMap.end()) { itr->second.AddAura(pet, aura); @@ -2103,14 +2104,10 @@ void SpellMgr::LoadSpellPetAuras() sLog.outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell); continue; } - int i = 0; - for(; i < 3; ++i) - if((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA && - spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DUMMY) || - spellInfo->Effect[i] == SPELL_EFFECT_DUMMY) - break; - if(i == 3) + if (spellInfo->Effect[eff] != SPELL_EFFECT_DUMMY && + (spellInfo->Effect[eff] != SPELL_EFFECT_APPLY_AURA || + spellInfo->EffectApplyAuraName[eff] != SPELL_AURA_DUMMY)) { sLog.outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); continue; @@ -2123,8 +2120,8 @@ void SpellMgr::LoadSpellPetAuras() continue; } - PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->CalculateSimpleValue(i)); - mSpellPetAuraMap[spell] = pa; + PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[eff] == TARGET_PET, spellInfo->CalculateSimpleValue(eff)); + mSpellPetAuraMap[(spell<<8) + eff] = pa; } ++count; diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 64e4c6acd..b19ba4b4d 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -528,7 +528,7 @@ class PetAura bool removeOnChangePet; int32 damage; }; -typedef std::map SpellPetAuraMap; +typedef std::map SpellPetAuraMap; struct SpellArea { @@ -833,9 +833,9 @@ class SpellMgr return mSkillLineAbilityMap.upper_bound(spell_id); } - PetAura const* GetPetAura(uint16 spell_id) + PetAura const* GetPetAura(uint16 spell_id, uint8 eff) { - SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find(spell_id); + SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id<<8) + eff); if(itr != mSpellPetAuraMap.end()) return &itr->second; else diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 40f47c09f..bbe0ce7df 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8059" + #define REVISION_NR "8060" #endif // __REVISION_NR_H__