[7886] Drop use table petcreateinfo_spell

This is first commit in chain for remove oudated and not used pet functionality.

    * Use instead dropped table CreatureSpellData.dbc if creature_template.PetSpellDataId set (mostly hunter pets)
    * Use creature_template.spellN if not set creature_template.PetSpellDataId (mostly different summon creatures)
    * Fixed bug with not removing from action bar spell icon for not ranked unlearned spells.

    Note: summoned controllable creatures without PetSpellDataId must have expected spells in spellN feilds for creature_template.

[7887] Drop pet spell teaching code, including field in character_pet.

Author: VladimirMangos

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-24 12:16:12 -05:00
parent aa67033cc7
commit 09b386a786
20 changed files with 236 additions and 263 deletions

View File

@@ -3747,90 +3747,6 @@ void ObjectMgr::LoadQuestLocales()
sLog.outString( ">> Loaded %lu Quest locale strings", (unsigned long)mQuestLocaleMap.size() );
}
void ObjectMgr::LoadPetCreateSpells()
{
QueryResult *result = WorldDatabase.Query("SELECT entry, Spell1, Spell2, Spell3, Spell4 FROM petcreateinfo_spell");
if(!result)
{
barGoLink bar( 1 );
bar.step();
sLog.outString();
sLog.outString( ">> Loaded 0 pet create spells" );
sLog.outErrorDb("`petcreateinfo_spell` table is empty!");
return;
}
uint32 count = 0;
barGoLink bar( result->GetRowCount() );
mPetCreateSpell.clear();
do
{
Field *fields = result->Fetch();
bar.step();
uint32 creature_id = fields[0].GetUInt32();
if(!creature_id)
{
sLog.outErrorDb("Creature id %u listed in `petcreateinfo_spell` not exist.",creature_id);
continue;
}
CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(creature_id);
if(!cInfo)
{
sLog.outErrorDb("Creature id %u listed in `petcreateinfo_spell` not exist.",creature_id);
continue;
}
PetCreateSpellEntry PetCreateSpell;
bool have_spell = false;
bool have_spell_db = false;
for(int i = 0; i < 4; i++)
{
PetCreateSpell.spellid[i] = fields[i + 1].GetUInt32();
if(!PetCreateSpell.spellid[i])
continue;
have_spell_db = true;
SpellEntry const* i_spell = sSpellStore.LookupEntry(PetCreateSpell.spellid[i]);
if(!i_spell)
{
sLog.outErrorDb("Spell %u listed in `petcreateinfo_spell` does not exist",PetCreateSpell.spellid[i]);
PetCreateSpell.spellid[i] = 0;
continue;
}
have_spell = true;
}
if(!have_spell_db)
{
sLog.outErrorDb("Creature %u listed in `petcreateinfo_spell` have only 0 spell data, why it listed?",creature_id);
continue;
}
if(!have_spell)
continue;
mPetCreateSpell[creature_id] = PetCreateSpell;
++count;
}
while (result->NextRow());
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u pet create spells", count );
}
void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
{
if(sWorld.IsScriptScheduled()) // function don't must be called in time scripts use.