rendered paste bodyIndex: src/game/Creature.h
===================================================================
--- src/game/Creature.h (revision 4096)
+++ src/game/Creature.h (working copy)
@@ -218,6 +218,7 @@
char const* AIName;
uint32 MovementType;
uint32 InhabitType;
+ uint32 SpellDataId;
char const* ScriptName;
uint32 randomDisplayID() const;
Index: src/game/ObjectMgr.cpp
===================================================================
--- src/game/ObjectMgr.cpp (revision 4096)
+++ src/game/ObjectMgr.cpp (working copy)
@@ -1971,9 +1971,9 @@
if(db_node)
{
- if(db_node->skill != dbc_node.skill)
+ if(db_node->skill == dbc_node.skill)
sLog.outErrorDb("Spell %u auto-learn skill %u in spell.dbc but learn skill %u in `spell_learn_skill`, fix DB.",
- spell,dbc_node.skill,db_node->skill);
+ spell,dbc_node.skill,db_node->skill);
continue; // skip already added spell-skill pair
}
@@ -2091,6 +2091,7 @@
void ObjectMgr::LoadPetCreateSpells()
{
+ /*
QueryResult *result = sDatabase.PQuery("SELECT `entry`, `Spell1`, `Spell2`, `Spell3`, `Spell4`,`FamilyPassive` FROM `petcreateinfo_spell`");
if(!result)
{
@@ -2140,7 +2141,7 @@
delete result;
sLog.outString( "" );
- sLog.outString( ">> Loaded %u pet create spells", count );
+ sLog.outString( ">> Loaded %u pet create spells", count );*/
}
void ObjectMgr::LoadScripts(ScriptMapMap& scripts, char const* tablename)
Index: src/game/Pet.cpp
===================================================================
--- src/game/Pet.cpp (revision 4096)
+++ src/game/Pet.cpp (working copy)
@@ -405,36 +405,6 @@
}
}
-/*void Pet::SendPetQuery()
-{
- Unit *player = GetOwner();
- if(player->GetTypeId() != TYPEID_PLAYER)
- return;
- char *subname = "Pet";
- CreatureInfo *ci = objmgr.GetCreatureTemplate(GetEntry());
-
- WorldPacket data( SMSG_CREATURE_QUERY_RESPONSE, 4+m_name.size()+1+3+strlen(subname)+1+4+4+4+4+4+4+4+2);
- data << (uint32)GetEntry();
- data << m_name.c_str();
- data << uint8(0) << uint8(0) << uint8(0);
- data << subname;
-
- uint32 wdbFeild11=0,wdbFeild12=0;
-
- data << ci->flag1; //flags wdbFeild7=wad flags1
- data << uint32(ci->type); //creatureType wdbFeild8
- data << (uint32)ci->family; //family wdbFeild9
- data << (uint32)ci->rank; //rank wdbFeild10
- data << (uint32)wdbFeild11; //unknow wdbFeild11
- data << (uint32)wdbFeild12; //unknow wdbFeild12
- data << ci->DisplayID; //DisplayID wdbFeild13
-
- data << (uint16)ci->civilian; //wdbFeild14
-
- player->GetSession()->SendPacket( &data );
-}
-*/
-
void Pet::setDeathState(DeathState s) // overwrite virtual Creature::setDeathState and Unit::setDeathState
{
Creature::setDeathState(s);
@@ -1508,44 +1478,53 @@
m_spells.clear();
int32 usedtrainpoints = 0, petspellid;
- PetCreateSpellEntry const* CreateSpells = objmgr.GetPetCreateSpellEntry(GetEntry());
+ /*PetCreateSpellEntry const* CreateSpells = objmgr.GetPetCreateSpellEntry(GetEntry());
if(CreateSpells)
- {
- for(uint8 i = 0; i < 4; i++)
- {
- if(!CreateSpells->spellid[i])
- break;
+ {*/
+ CreatureInfo const* cInfo = sCreatureStorage.LookupEntry<CreatureInfo>(GetEntry());
+ if(cInfo)
+ {
+ CreatureSpellDataEntry const* CreateSpells = sCreatureSpellDataStore.LookupEntry(cInfo->SpellDataId);
+ if (CreateSpells)
+ {
+ for(uint8 i = 0; i < 4; i++)
+ {
+ /*if(!CreateSpells->spellid[i])
+ break;*/
- SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(CreateSpells->spellid[i]);
- if(!learn_spellproto)
- continue;
+ SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(CreateSpells->spellid[i]);
+ if(!learn_spellproto)
+ continue;
- if(learn_spellproto->Effect[0] == SPELL_EFFECT_LEARN_SPELL || learn_spellproto->Effect[0] == SPELL_EFFECT_LEARN_PET_SPELL)
- {
- petspellid = learn_spellproto->EffectTriggerSpell[0];
- if(GetOwner()->GetTypeId() == TYPEID_PLAYER && !((Player*)GetOwner())->HasSpell(learn_spellproto->Id))
- {
- if(IsPassiveSpell(petspellid)) //learn passive skills when tamed, not sure if thats right
- ((Player*)GetOwner())->learnSpell(learn_spellproto->Id);
- else
- AddTeachSpell(learn_spellproto->EffectTriggerSpell[0], learn_spellproto->Id);
- }
- }
- else
- petspellid = learn_spellproto->Id;
+ /*if(learn_spellproto->Effect[0] == SPELL_EFFECT_LEARN_SPELL || learn_spellproto->Effect[0] == SPELL_EFFECT_LEARN_PET_SPELL)
+ {*/
+ petspellid = learn_spellproto->Id;
+ if(GetOwner()->GetTypeId() == TYPEID_PLAYER && !((Player*)GetOwner())->HasSpell(petspellid))
+ {
+ /*if(IsPassiveSpell(petspellid)) //learn passive skills when tamed, not sure if thats right
+ ((Player*)GetOwner())->learnSpell(learn_spellproto->Id);
+ else*/
+ AddTeachSpell(learn_spellproto->Id, CreateSpells->spellid[i]);
+ }
+ /*}
+ else
+ petspellid = CreateSpells->spellid[i];*/
- addSpell(petspellid);
+ addSpell(petspellid);
- SkillLineAbilityEntry const *Ability = sSkillLineAbilityStore.LookupEntry(learn_spellproto->EffectTriggerSpell[0]);
- if(Ability)
- usedtrainpoints += Ability->reqtrainpoints;
- }
-
- //family passive
- SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(CreateSpells->familypassive);
- if(learn_spellproto)
- addSpell(CreateSpells->familypassive);
- }
+ SkillLineAbilityEntry const *Ability = sSkillLineAbilityStore.LookupEntry(petspellid);
+ if(Ability)
+ usedtrainpoints += Ability->reqtrainpoints;
+ }
+
+ //family passive
+ uint32 familypassive = FamilyToPassiveSpell(cInfo->family);
+ SpellEntry const *learn_spellproto = sSpellStore.LookupEntry(familypassive);
+ if(learn_spellproto)
+ addSpell(familypassive);
+ //}
+ }
+ }
SetTP(-usedtrainpoints);
}
Index: src/game/Pet.h
===================================================================
--- src/game/Pet.h (revision 4096)
+++ src/game/Pet.h (working copy)
@@ -112,6 +112,44 @@
PET_TALK_ATTACK = 1
};
+inline uint32 FamilyToPassiveSpell(uint8 family)
+{
+ switch(family)
+ {
+ case CREATURE_FAMILY_WOLF: return 17223;
+ case CREATURE_FAMILY_CAT: return 17210;
+ case CREATURE_FAMILY_SPIDER: return 17219;
+ case CREATURE_FAMILY_BEAR: return 17208;
+ case CREATURE_FAMILY_BOAR: return 7000;
+ case CREATURE_FAMILY_CROCILISK: return 17212;
+ case CREATURE_FAMILY_CARRION_BIRD: return 17209;
+ case CREATURE_FAMILY_CRAB: return 17211;
+ case CREATURE_FAMILY_GORILLA: return 17214;
+ case CREATURE_FAMILY_RAPTOR: return 17217;
+ case CREATURE_FAMILY_TALLSTRIDER: return 17220;
+ case CREATURE_FAMILY_FELHUNTER: return 0;
+ case CREATURE_FAMILY_VOIDWALKER: return 0;
+ case CREATURE_FAMILY_SUCCUBUS: return 0;
+ case CREATURE_FAMILY_DOOMGUARD: return 0;
+ case CREATURE_FAMILY_SCORPID: return 17218;
+ case CREATURE_FAMILY_TURTLE: return 17221;
+ case CREATURE_FAMILY_IMP: return 0;
+ case CREATURE_FAMILY_BAT: return 17206;
+ case CREATURE_FAMILY_HYENA: return 17215;
+ case CREATURE_FAMILY_OWL: return 17216;
+ case CREATURE_FAMILY_WIND_SERPENT: return 17222;
+ case CREATURE_FAMILY_REMOTE_CONTROL: return 0;
+ case CREATURE_FAMILY_FELGUARD: return 0;
+ case CREATURE_FAMILY_DRAGONHAWK: return 34887;
+ case CREATURE_FAMILY_RAVAGER: return 35257;
+ case CREATURE_FAMILY_WARP_STALKER: return 35254;
+ case CREATURE_FAMILY_SPOREBAT: return 35258;
+ case CREATURE_FAMILY_NETHER_RAY: return 35253;
+ case CREATURE_FAMILY_SERPENT: return 35386;
+ }
+ return 0;
+}
+
typedef HM_NAMESPACE::hash_map<uint16, PetSpell*> PetSpellMap;
typedef std::map<uint32,uint32> TeachSpellMap;
typedef std::set<uint32> AutoSpellList;
Index: src/game/QueryHandler.cpp
===================================================================
--- src/game/QueryHandler.cpp (revision 4096)
+++ src/game/QueryHandler.cpp (working copy)
@@ -148,13 +148,15 @@
data << (uint32)ci->family; // family wdbFeild9
data << (uint32)(unit && unit->isPet() ? 0 : ci->rank); // rank wdbFeild10
data << uint32(0); // unknown wdbFeild11
- data << uint32(0); // unknown wdbFeild12
+ data << (uint32)ci->SpellDataId; // SpellDataId wdbFeild12
+ data << (uint32)ci->DisplayID_f; //DisplayID wdbFeild13
+ /*wrong: in offi creaturecache.wdb DisplayID == ci->DisplayID_f
if (unit)
data << unit->GetUInt32Value(UNIT_FIELD_DISPLAYID); //DisplayID wdbFeild13
else
- data << (uint32)ci->randomDisplayID();
-
+ data << (uint32)ci->randomDisplayID();*/
+
data << (float)1; // unk
data << (float)1; // unk
data << uint8(ci->civilian);
Index: src/shared/Database/DBCfmt.cpp
===================================================================
--- src/shared/Database/DBCfmt.cpp (revision 4096)
+++ src/shared/Database/DBCfmt.cpp (working copy)
@@ -23,6 +23,7 @@
const char ChrClassesEntryfmt[]="nxixxxxxxxxxxxxxxxxxxxxx";
const char ChrRacesEntryfmt[]="nxixiixxixxxxissssssssssssssssxxxxx";
const char CreatureFamilyfmt[]="nxxxxxiissssssssssssssssxx";
+const char CreatureSpellDatafmt[]="niiiixxxx";
const char DurabilityCostsfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiii";
const char DurabilityQualityfmt[]="nf";
const char EmoteEntryfmt[]="nxixxxxxxxxxxxxxxxx";
Index: src/shared/Database/DBCStores.cpp
===================================================================
--- src/shared/Database/DBCStores.cpp (revision 4096)
+++ src/shared/Database/DBCStores.cpp (working copy)
@@ -39,6 +39,7 @@
DBCStorage <ChrClassesEntry> sChrClassesStore(ChrClassesEntryfmt);
DBCStorage <ChrRacesEntry> sChrRacesStore(ChrRacesEntryfmt);
DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore(CreatureFamilyfmt);
+DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore(CreatureSpellDatafmt);
DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore(DurabilityQualityfmt);
DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore(DurabilityCostsfmt);
@@ -145,7 +146,7 @@
{
std::string tmpPath="";
- const uint32 DBCFilesCount = 35;
+ const uint32 DBCFilesCount = 36;
barGoLink bar( DBCFilesCount );
@@ -158,6 +159,7 @@
LoadDBC(bar,bad_dbc_files,sChrClassesStore, dataPath+"dbc/ChrClasses.dbc");
LoadDBC(bar,bad_dbc_files,sChrRacesStore, dataPath+"dbc/ChrRaces.dbc");
LoadDBC(bar,bad_dbc_files,sCreatureFamilyStore, dataPath+"dbc/CreatureFamily.dbc");
+ LoadDBC(bar,bad_dbc_files,sCreatureSpellDataStore, dataPath+"dbc/CreatureSpellData.dbc");
LoadDBC(bar,bad_dbc_files,sDurabilityCostsStore, dataPath+"dbc/DurabilityCosts.dbc");
LoadDBC(bar,bad_dbc_files,sDurabilityQualityStore, dataPath+"dbc/DurabilityQuality.dbc");
LoadDBC(bar,bad_dbc_files,sEmotesTextStore, dataPath+"dbc/EmotesText.dbc");
Index: src/shared/Database/DBCStores.h
===================================================================
--- src/shared/Database/DBCStores.h (revision 4096)
+++ src/shared/Database/DBCStores.h (working copy)
@@ -140,6 +140,7 @@
extern DBCStorage <ChrClassesEntry> sChrClassesStore;
extern DBCStorage <ChrRacesEntry> sChrRacesStore;
extern DBCStorage <CreatureFamilyEntry> sCreatureFamilyStore;
+extern DBCStorage <CreatureSpellDataEntry> sCreatureSpellDataStore;
extern DBCStorage <DurabilityCostsEntry> sDurabilityCostsStore;
extern DBCStorage <DurabilityQualityEntry> sDurabilityQualityStore;
extern DBCStorage <SpellCastTimesEntry> sCastTimesStore;
Index: src/shared/Database/DBCStructure.h
===================================================================
--- src/shared/Database/DBCStructure.h (revision 4096)
+++ src/shared/Database/DBCStructure.h (working copy)
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (C) 2005,2006,2007 MaNGOS <http://www.mangosproject.org/>
*
* This program is free software; you can redistribute it and/or modify
@@ -116,6 +116,12 @@
// 24 string flags, unused
};
+struct CreatureSpellDataEntry
+{
+ uint32 ID; // 0
+ uint32 spellid[4]; // 1-4 spells
+ // 4-7 unused
+};
struct DurabilityCostsEntry
{
uint32 Itemlvl; // 0
Index: src/shared/Database/SQLStorage.cpp
===================================================================
--- src/shared/Database/SQLStorage.cpp (revision 4096)
+++ src/shared/Database/SQLStorage.cpp (working copy)
@@ -23,7 +23,7 @@
extern DatabaseMysql sDatabase;
-const char CreatureInfofmt[]="iiissiiiiiiiiififfiiiiififiiiiffifiiiiiiiiiiiiiiiiiiiiiiiiiiisiis";
+const char CreatureInfofmt[]="iiissiiiiiiiiififfiiiiififiiiiffifiiiiiiiiiiiiiiiiiiiiiiiiiiisiiis";
const char CreatureDataAddonInfofmt[]="iiiiiiiiiiii";
const char GameObjectInfofmt[]="iiisiifiiiiiiiiiiiiiiiiiiiiiiiis";
const char ItemPrototypefmt[]="iiiisiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiffiffiffiffiffiiiiiiiiiifiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiisiiiiiiiiiiiiiiiiiiiiiiiiiifsi";