aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/Language.h1
-rw-r--r--src/game/Level3.cpp5
-rw-r--r--src/game/Pet.h1
-rw-r--r--src/game/Player.cpp44
-rw-r--r--src/game/Player.h4
-rw-r--r--src/game/Spell.cpp1
-rw-r--r--src/game/SpellMgr.cpp1
-rw-r--r--src/game/Unit.cpp3
8 files changed, 59 insertions, 1 deletions
diff --git a/src/game/Language.h b/src/game/Language.h
index 9c85571c17e..d29fdaa179f 100644
--- a/src/game/Language.h
+++ b/src/game/Language.h
@@ -853,6 +853,7 @@ enum TrinityStrings
LANG_GM_BROADCAST = 6613,
LANG_GM_NOTIFY = 6614,
LANG_GM_ANNOUNCE_COLOR = 6615,
+ LANG_RESETALL_PET_SPELLS = 6616,
LANG_WORLD_CLOSED = 7523,
LANG_WORLD_OPENED = 7524,
diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index 4e0f39e2316..a0eadde9c4e 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -5390,6 +5390,11 @@ bool ChatHandler::HandleResetAllCommand(const char * args)
atLogin = AT_LOGIN_RESET_TALENTS;
sWorld.SendWorldText(LANG_RESETALL_TALENTS);
}
+ else if(casename=="pet_spells")
+ {
+ atLogin = AT_LOGIN_RESET_PET_SPELLS;
+ sWorld.SendWorldText(LANG_RESETALL_PET_SPELLS);
+ }
else
{
PSendSysMessage(LANG_RESETALL_UNKNOWN_CASE,args);
diff --git a/src/game/Pet.h b/src/game/Pet.h
index 2552b1c2c09..aaa4c786d10 100644
--- a/src/game/Pet.h
+++ b/src/game/Pet.h
@@ -195,6 +195,7 @@ class Pet : public Guardian
bool unlearnSpell(uint32 spell_id);
bool removeSpell(uint32 spell_id);
bool _removeSpell(uint32 spell_id);
+ void _resetSpells();
PetSpellMap m_spells;
TeachSpellMap m_teachspells;
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index aaea17ddd9e..1463a8ec877 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -14521,6 +14521,12 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
InitTalentForLevel();
learnDefaultSpells();
+ // must be done after aura loading for correct pet talent amount calculation
+ if(HasAtLoginFlag(AT_LOGIN_RESET_PET_SPELLS))
+ {
+ _resetAllPetSpells();
+ }
+
_LoadTutorials(holder->GetResult(PLAYER_LOGIN_QUERY_LOADTUTORIALS));
// must be before inventory (some items required reputation check)
@@ -18585,6 +18591,44 @@ void Player::resetSpells()
learnQuestRewardedSpells();
}
+void Player::_resetAllPetSpells()
+{
+ if(HasAtLoginFlag(AT_LOGIN_RESET_PET_SPELLS))
+ {
+ m_atLoginFlags = m_atLoginFlags & ~AT_LOGIN_RESET_PET_SPELLS;
+ CharacterDatabase.PExecute("UPDATE characters set at_login = at_login & ~ %u WHERE guid ='%u'", uint32(AT_LOGIN_RESET_PET_SPELLS), GetGUIDLow());
+ }
+
+ if (QueryResult * result = CharacterDatabase.PQuery("SELECT id, level, entry FROM character_pet WHERE owner = '%u'", GetGUIDLow()))
+ {
+ // Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS
+ uint32 pointMod = GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS);
+ do
+ {
+ Field *fields = result->Fetch();
+ uint32 petId = fields[0].GetUInt32();
+ uint32 level = fields[1].GetUInt32();
+ uint32 entry = fields[2].GetUInt32();
+ CreatureInfo const *ci = objmgr.GetCreatureTemplate(entry);
+ if (!ci)
+ sLog.outError("Unknown pet (id %d) type saved in character_pet!", petId);
+ CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family);
+ if (!pet_family)
+ sLog.outError("Unknown pet (id %d) type saved in character_pet!", petId);
+ if(pet_family && pet_family->petTalentType <= 0)
+ {
+ uint32 points = (level >= 20) ? ((level - 16) / 4) : 0;
+ CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE guid = '%u'", petId);
+ std::ostringstream ss;
+ ss << "UPDATE character_pet SET talentpoints = '"<<points + pointMod<<"' WHERE id = '"<<petId<<"'";
+ sLog.outDebug(ss.str().c_str());
+ CharacterDatabase.Execute(ss.str().c_str());
+ }
+ }
+ while( result->NextRow() );
+ }
+}
+
void Player::learnDefaultSpells()
{
// learn default race/class spells
diff --git a/src/game/Player.h b/src/game/Player.h
index 44a50080574..e5c3a80fc71 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -497,7 +497,8 @@ enum AtLoginFlags
AT_LOGIN_RENAME = 1,
AT_LOGIN_RESET_SPELLS = 2,
AT_LOGIN_RESET_TALENTS = 4,
- AT_LOGIN_CUSTOMIZE = 8
+ AT_LOGIN_CUSTOMIZE = 8,
+ AT_LOGIN_RESET_PET_SPELLS = 16
};
typedef std::map<uint32, QuestStatusData> QuestStatusMap;
@@ -1342,6 +1343,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void learnSpell(uint32 spell_id, bool dependent);
void removeSpell(uint32 spell_id, bool disabled = false, bool update_action_bar_for_low_rank = false);
void resetSpells();
+ void _resetAllPetSpells();
void learnDefaultSpells();
void learnQuestRewardedSpells();
void learnQuestRewardedSpells(Quest const* quest);
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index e28eaa7b46c..81ab3c9dd3c 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2636,6 +2636,7 @@ void Spell::update(uint32 difftime)
// check if there are alive targets left
if (!UpdateChanneledTargetList())
{
+ sLog.outDebug("Channeled spell %d is removed due to lack of targets", m_spellInfo->Id);
SendChannelUpdate(0);
finish();
}
diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index b00e9c95649..3e9992b6544 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -582,6 +582,7 @@ bool IsPositiveEffect(uint32 spellId, uint32 effIndex, bool deep)
}
case SPELL_AURA_ADD_TARGET_TRIGGER:
return true;
+ case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
if(!deep)
{
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 832e2e6fff4..fe89baacaf1 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -5524,6 +5524,9 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* trigger
// Glyph of Dispel Magic
case 55677:
{
+ // Dispel Magic shares spellfamilyflag with abolish disease
+ if (procSpell->SpellIconID!=74)
+ return false;
if(!target->IsFriendlyTo(this))
return false;