[7831] Prevent have hunter pet with level greater player levels at level changes. Propertly set hunter pet xp values at level update. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
+7
-1
@@ -23,7 +23,7 @@ DROP TABLE IF EXISTS `db_version`;
|
|||||||
CREATE TABLE `db_version` (
|
CREATE TABLE `db_version` (
|
||||||
`version` varchar(120) default NULL,
|
`version` varchar(120) default NULL,
|
||||||
`creature_ai_version` varchar(120) default NULL,
|
`creature_ai_version` varchar(120) default NULL,
|
||||||
`required_7823_01_mangos_item_template` bit(1) default NULL
|
`required_7830_01_mangos_spell_chain` bit(1) default NULL
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';
|
||||||
|
|
||||||
--
|
--
|
||||||
@@ -14504,6 +14504,12 @@ INSERT INTO spell_chain VALUES
|
|||||||
(27276,19736,19505,5,0),
|
(27276,19736,19505,5,0),
|
||||||
(27277,27276,19505,6,0),
|
(27277,27276,19505,6,0),
|
||||||
(48011,27277,19505,7,0),
|
(48011,27277,19505,7,0),
|
||||||
|
/*Fel Intelligence*/
|
||||||
|
(54424,0,54424,1,0),
|
||||||
|
(57564,54424,54424,2,0),
|
||||||
|
(57565,57564,54424,3,0),
|
||||||
|
(57566,57565,54424,4,0),
|
||||||
|
(57567,57566,54424,5,0),
|
||||||
/*Shadow Bite*/
|
/*Shadow Bite*/
|
||||||
(54049,0,54049,1,0),
|
(54049,0,54049,1,0),
|
||||||
(54050,54049,54049,2,0),
|
(54050,54049,54049,2,0),
|
||||||
|
|||||||
@@ -1329,6 +1329,11 @@ bool ChatHandler::HandleNpcChangeLevelCommand(const char* args)
|
|||||||
|
|
||||||
if(pCreature->isPet())
|
if(pCreature->isPet())
|
||||||
{
|
{
|
||||||
|
if(((Pet*)pCreature)->getPetType()==HUNTER_PET)
|
||||||
|
{
|
||||||
|
pCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(lvl)/4);
|
||||||
|
pCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
|
||||||
|
}
|
||||||
((Pet*)pCreature)->GivePetLevel(lvl);
|
((Pet*)pCreature)->GivePetLevel(lvl);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
+29
-2
@@ -362,6 +362,8 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_loading = false;
|
m_loading = false;
|
||||||
|
|
||||||
|
SynchronizeLevelWithOwner();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,12 +729,11 @@ void Pet::GivePetXP(uint32 xp)
|
|||||||
{
|
{
|
||||||
newXP -= nextLvlXP;
|
newXP -= nextLvlXP;
|
||||||
|
|
||||||
SetLevel( level + 1 );
|
GivePetLevel(level+1);
|
||||||
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(level+1)*PET_XP_FACTOR);
|
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(level+1)*PET_XP_FACTOR);
|
||||||
|
|
||||||
level = getLevel();
|
level = getLevel();
|
||||||
nextLvlXP = GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP);
|
nextLvlXP = GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP);
|
||||||
GivePetLevel(level);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, newXP);
|
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, newXP);
|
||||||
@@ -1793,3 +1794,29 @@ void Pet::learnSpellHighRank(uint32 spellid)
|
|||||||
if(uint32 next = spellmgr.GetNextSpellInChain(spellid))
|
if(uint32 next = spellmgr.GetNextSpellInChain(spellid))
|
||||||
learnSpellHighRank(next);
|
learnSpellHighRank(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Pet::SynchronizeLevelWithOwner()
|
||||||
|
{
|
||||||
|
Unit* owner = GetOwner();
|
||||||
|
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(getPetType())
|
||||||
|
{
|
||||||
|
// always same level
|
||||||
|
case SUMMON_PET:
|
||||||
|
GivePetLevel(owner->getLevel());
|
||||||
|
break;
|
||||||
|
// can't be greater owner level
|
||||||
|
case HUNTER_PET:
|
||||||
|
if(getLevel() > owner->getLevel())
|
||||||
|
{
|
||||||
|
GivePetLevel(owner->getLevel());
|
||||||
|
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, objmgr.GetXPForLevel(owner->getLevel())/4);
|
||||||
|
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, GetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP)-1);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ class Pet : public Guardian
|
|||||||
HappinessState GetHappinessState();
|
HappinessState GetHappinessState();
|
||||||
void GivePetXP(uint32 xp);
|
void GivePetXP(uint32 xp);
|
||||||
void GivePetLevel(uint32 level);
|
void GivePetLevel(uint32 level);
|
||||||
|
void SynchronizeLevelWithOwner();
|
||||||
bool HaveInDiet(ItemPrototype const* item) const;
|
bool HaveInDiet(ItemPrototype const* item) const;
|
||||||
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel);
|
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel);
|
||||||
void SetDuration(int32 dur) { m_duration = dur; }
|
void SetDuration(int32 dur) { m_duration = dur; }
|
||||||
|
|||||||
+7
-5
@@ -2370,10 +2370,9 @@ void Player::GiveLevel(uint32 level)
|
|||||||
SetPower(POWER_FOCUS, 0);
|
SetPower(POWER_FOCUS, 0);
|
||||||
SetPower(POWER_HAPPINESS, 0);
|
SetPower(POWER_HAPPINESS, 0);
|
||||||
|
|
||||||
// give level to summoned pet
|
// update level to hunter/summon pet
|
||||||
Pet* pet = GetPet();
|
if (Pet* pet = GetPet())
|
||||||
if(pet && pet->getPetType()==SUMMON_PET)
|
pet->SynchronizeLevelWithOwner();
|
||||||
pet->GivePetLevel(level);
|
|
||||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
|
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_REACH_LEVEL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2559,6 +2558,10 @@ void Player::InitStatsForLevel(bool reapplyMods)
|
|||||||
SetPower(POWER_FOCUS, 0);
|
SetPower(POWER_FOCUS, 0);
|
||||||
SetPower(POWER_HAPPINESS, 0);
|
SetPower(POWER_HAPPINESS, 0);
|
||||||
SetPower(POWER_RUNIC_POWER, 0);
|
SetPower(POWER_RUNIC_POWER, 0);
|
||||||
|
|
||||||
|
// update level to hunter/summon pet
|
||||||
|
if (Pet* pet = GetPet())
|
||||||
|
pet->SynchronizeLevelWithOwner();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::SendInitialSpells()
|
void Player::SendInitialSpells()
|
||||||
@@ -20653,4 +20656,3 @@ bool Player::canSeeSpellClickOn(Creature const *c) const
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -884,6 +884,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
|||||||
|
|
||||||
void GiveXP(uint32 xp, Unit* victim);
|
void GiveXP(uint32 xp, Unit* victim);
|
||||||
void GiveLevel(uint32 level);
|
void GiveLevel(uint32 level);
|
||||||
|
|
||||||
void InitStatsForLevel(bool reapplyMods = false);
|
void InitStatsForLevel(bool reapplyMods = false);
|
||||||
|
|
||||||
// Played Time Stuff
|
// Played Time Stuff
|
||||||
|
|||||||
Reference in New Issue
Block a user