Core/Entities: Ensure that pets retain their XP-points when dismissed in any form or way (outrunning/riding/mounting/flying)
Also clean up the logic a bit - pet stats initialization initializes hp/mana/powers on pets, while they should only be initialized/changed on pet call/creation. Fixes issues 4284 --HG-- branch : trunk
This commit is contained in:
@@ -228,18 +228,17 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
|
|||||||
}
|
}
|
||||||
|
|
||||||
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here
|
SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, uint32(time(NULL))); // cast can't be helped here
|
||||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
|
|
||||||
SetCreatorGUID(owner->GetGUID());
|
SetCreatorGUID(owner->GetGUID());
|
||||||
|
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, fields[5].GetUInt32());
|
||||||
|
SynchronizeLevelWithOwner();
|
||||||
|
|
||||||
SetReactState(ReactStates(fields[6].GetUInt8()));
|
SetReactState(ReactStates(fields[6].GetUInt8()));
|
||||||
|
|
||||||
SetCanModifyStats(true);
|
SetCanModifyStats(true);
|
||||||
SynchronizeLevelWithOwner();
|
|
||||||
InitStatsForLevel(petlevel);
|
|
||||||
|
|
||||||
if (getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current
|
if (getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current
|
||||||
{
|
{
|
||||||
SetFullHealth();
|
InitStatsForLevel(petlevel);
|
||||||
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
|
SetPower(POWER_MANA, GetMaxPower(POWER_MANA));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1197,7 +1196,6 @@ void Pet::_SaveSpells(SQLTransaction& trans)
|
|||||||
case PETSPELL_UNCHANGED:
|
case PETSPELL_UNCHANGED:
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
itr->second.state = PETSPELL_UNCHANGED;
|
itr->second.state = PETSPELL_UNCHANGED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
#undef VERSION
|
#undef VERSION
|
||||||
#endif //VERSION
|
#endif //VERSION
|
||||||
|
|
||||||
# include "config.h"
|
# include "Config.h"
|
||||||
|
|
||||||
#undef PACKAGE
|
#undef PACKAGE
|
||||||
#undef PACKAGE_BUGREPORT
|
#undef PACKAGE_BUGREPORT
|
||||||
|
|||||||
Reference in New Issue
Block a user