Merge commit 'origin/master' into 310

Conflicts:
	src/game/Player.cpp
	src/game/SpellAuras.cpp
This commit is contained in:
tomrus88 2009-06-02 15:01:26 +04:00
commit cffbb8661b
44 changed files with 389 additions and 181 deletions

View file

@ -239,14 +239,9 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
CharacterDatabase.CommitTransaction();
}
// load action bar, if data broken will fill later by default spells.
if (!is_temporary_summoned)
{
if(!m_charmInfo->LoadActionBar(fields[13].GetCppString()))
{
delete result;
return false;
}
}
m_charmInfo->LoadPetActionBar(fields[13].GetCppString());
// since last save (in seconds)
uint32 timediff = (time(NULL) - fields[14].GetUInt32());
@ -411,7 +406,8 @@ void Pet::SavePetToDB(PetSaveMode mode)
<< curmana << ", "
<< GetPower(POWER_HAPPINESS) << ", '";
for(uint32 i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
// save only spell slots from action bar
for(uint32 i = ACTION_BAR_INDEX_PET_SPELL_START; i < ACTION_BAR_INDEX_PET_SPELL_END; ++i)
{
ss << uint32(m_charmInfo->GetActionBarEntry(i)->Type) << " "
<< uint32(m_charmInfo->GetActionBarEntry(i)->SpellOrAction) << " ";
@ -1093,17 +1089,7 @@ void Pet::_LoadSpells()
{
Field *fields = result->Fetch();
uint32 spell_id = fields[0].GetUInt32();
// load only pet talents, other spell types auto-learned
if(GetTalentSpellCost(spell_id)==0)
{
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'",spell_id);
sLog.outError("Table `pet_spell` have non-talent spell %u , spell removed from table for all pets.",spell_id);
continue;
}
addSpell(spell_id, ActiveStates(fields[1].GetUInt16()), PETSPELL_UNCHANGED,PETSPELL_TALENT);
addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt16()), PETSPELL_UNCHANGED);
}
while( result->NextRow() );
@ -1117,8 +1103,8 @@ void Pet::_SaveSpells()
{
++next;
// save only talent spells for pets, other spells auto-applied
if (itr->second.type != PETSPELL_TALENT)
// prevent saving family passives to DB
if (itr->second.type == PETSPELL_FAMILY)
continue;
switch(itr->second.state)
@ -1329,9 +1315,6 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel
// talent: unlearn all other talent ranks (high and low)
if(TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
{
// propertly mark spell for allow save
newspell.type = PETSPELL_TALENT;
if(TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id ))
{
for(int i=0; i < MAX_TALENT_RANK; ++i)