diff options
| author | Spp <spp@jorge.gr> | 2011-12-27 10:05:49 +0100 |
|---|---|---|
| committer | Spp <spp@jorge.gr> | 2011-12-27 10:15:27 +0100 |
| commit | fa9daaf95b9f09f3a442087cbc59abc782814c63 (patch) | |
| tree | c24fe99837993c101de77df1416fde629c993817 /src/server/game/Entities/Pet | |
| parent | 8323027e0c15e97e5da5ec0948c447273321d43f (diff) | |
| parent | 317628902462c371dc29ec984803fbfb6412402c (diff) | |
Merge branch 'master' into 4.x and some warning fixes
Diffstat (limited to 'src/server/game/Entities/Pet')
| -rwxr-xr-x | src/server/game/Entities/Pet/Pet.cpp | 31 | ||||
| -rwxr-xr-x | src/server/game/Entities/Pet/Pet.h | 2 |
2 files changed, 18 insertions, 15 deletions
diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index afc94880812..6a42a0e4b3a 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -33,7 +33,7 @@ #define PET_XP_FACTOR 0.05f -Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner), +Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner, true), m_usedTalentCount(0), m_removed(false), m_owner(owner), m_petType(type), m_duration(0), m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL) @@ -50,8 +50,6 @@ m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL) m_name = "Pet"; m_regenTimer = PET_FOCUS_REGEN_INTERVAL; - - m_isWorldObject = true; } Pet::~Pet() @@ -1205,24 +1203,29 @@ void Pet::_SaveAuras(SQLTransaction& trans) } } -bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/) +bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/) { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { // do pet spell book cleanup if (state == PETSPELL_UNCHANGED) // spell load case { - sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spell_id); - CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id); + sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request, deleting for all pets in `pet_spell`.", spellId); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_PET_SPELL); + + stmt->setUInt32(0, spellId); + + CharacterDatabase.Execute(stmt); } else - sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spell_id); + sLog->outError("Pet::addSpell: Non-existed in SpellStore spell #%u request.", spellId); return false; } - PetSpellMap::iterator itr = m_spells.find(spell_id); + PetSpellMap::iterator itr = m_spells.find(spellId); if (itr != m_spells.end()) { if (itr->second.state == PETSPELL_REMOVED) @@ -1261,7 +1264,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe newspell.active = active; // talent: unlearn all other talent ranks (high and low) - if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id)) + if (TalentSpellPos const* talentPos = GetTalentSpellPos(spellId)) { if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { @@ -1269,7 +1272,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe { // skip learning spell and no rank spell case uint32 rankSpellId = talentInfo->RankID[i]; - if (!rankSpellId || rankSpellId == spell_id) + if (!rankSpellId || rankSpellId == spellId) continue; // skip unknown ranks @@ -1310,17 +1313,17 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe } } - m_spells[spell_id] = newspell; + m_spells[spellId] = newspell; if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState)))) - CastSpell(this, spell_id, true); + CastSpell(this, spellId, true); else m_charmInfo->AddSpellToActionBar(spellInfo); if (newspell.active == ACT_ENABLED) ToggleAutocast(spellInfo, true); - uint32 talentCost = GetTalentSpellCost(spell_id); + uint32 talentCost = GetTalentSpellCost(spellId); if (talentCost) { int32 free_points = GetMaxTalentPointsForLevel(getLevel()); diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 96ff2835604..18ce1221178 100755 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -181,7 +181,7 @@ class Pet : public Guardian void _LoadSpells(); void _SaveSpells(SQLTransaction& trans); - bool addSpell(uint32 spell_id, ActiveStates active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL); + bool addSpell(uint32 spellId, ActiveStates active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, PetSpellType type = PETSPELL_NORMAL); bool learnSpell(uint32 spell_id); void learnSpellHighRank(uint32 spellid); void InitLevelupSpellsForLevel(); |
