mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 04:37:00 +00:00
[7941] Restore autocast pet spell state at load/resummon
* Revert partly "[7903] Load and save for pets only talents." * Avoid use enum with bit size limit field (with unexpected work in cases use values negative for related biz size int type)
This commit is contained in:
parent
9166cd9ef3
commit
65657533ab
3 changed files with 5 additions and 19 deletions
|
|
@ -1089,17 +1089,7 @@ void Pet::_LoadSpells()
|
||||||
{
|
{
|
||||||
Field *fields = result->Fetch();
|
Field *fields = result->Fetch();
|
||||||
|
|
||||||
uint32 spell_id = fields[0].GetUInt32();
|
addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt16()), PETSPELL_UNCHANGED);
|
||||||
|
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
while( result->NextRow() );
|
while( result->NextRow() );
|
||||||
|
|
||||||
|
|
@ -1113,8 +1103,8 @@ void Pet::_SaveSpells()
|
||||||
{
|
{
|
||||||
++next;
|
++next;
|
||||||
|
|
||||||
// save only talent spells for pets, other spells auto-applied
|
// prevent saving family passives to DB
|
||||||
if (itr->second.type != PETSPELL_TALENT)
|
if (itr->second.type == PETSPELL_FAMILY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
switch(itr->second.state)
|
switch(itr->second.state)
|
||||||
|
|
@ -1325,9 +1315,6 @@ bool Pet::addSpell(uint32 spell_id,ActiveStates active /*= ACT_DECIDE*/, PetSpel
|
||||||
// talent: unlearn all other talent ranks (high and low)
|
// talent: unlearn all other talent ranks (high and low)
|
||||||
if(TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
|
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 ))
|
if(TalentEntry const *talentInfo = sTalentStore.LookupEntry( talentPos->talent_id ))
|
||||||
{
|
{
|
||||||
for(int i=0; i < MAX_TALENT_RANK; ++i)
|
for(int i=0; i < MAX_TALENT_RANK; ++i)
|
||||||
|
|
|
||||||
|
|
@ -65,12 +65,11 @@ enum PetSpellType
|
||||||
{
|
{
|
||||||
PETSPELL_NORMAL = 0,
|
PETSPELL_NORMAL = 0,
|
||||||
PETSPELL_FAMILY = 1,
|
PETSPELL_FAMILY = 1,
|
||||||
PETSPELL_TALENT = 2,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PetSpell
|
struct PetSpell
|
||||||
{
|
{
|
||||||
ActiveStates active : 16;
|
uint16 active; // use instead enum (not good use *uint16* limited enum in case when value in enum not possitive in *int16*)
|
||||||
|
|
||||||
PetSpellState state : 8;
|
PetSpellState state : 8;
|
||||||
PetSpellType type : 8;
|
PetSpellType type : 8;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7940"
|
#define REVISION_NR "7941"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue