Core/Players: Cast Summon Pet on first login, relocate created pets

*Casts a proper Summon Pet spell on a hunter logging in for the first
time (depending on his race).
*Relocates created tamed pets before they're added to map.
This commit is contained in:
Mihapro committed 2013-05-11 22:12:11 +02:00
1 parent f04bddcbd0
commit 090951ba71
2 files changed
+28

No files matched your search

@@ -1089,8 +1089,31 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder* holder)
}
if (pCurrChar->HasAtLoginFlag(AT_LOGIN_FIRST))
{
pCurrChar->RemoveAtLoginFlag(AT_LOGIN_FIRST);
if (pCurrChar->getClass() == CLASS_HUNTER)
{
static uint32 const HunterCreatePetSpells[MAX_RACES] =
{
0, /* None */ 79597, /* Human - Young Wolf */
79598, /* Orc - Young Boar */ 79593, /* Dwarf - Young Bear */
79602, /* Night Elf - Young Cat */ 79600, /* Undead - Young Widow */
79603, /* Tauren - Young Tallstrider */ 0, /* Gnome */
79599, /* Troll - Young Raptor */ 79595, /* Goblin - Young Crab */
79594, /* Blood Elf - Young Dragonhawk */ 79601, /* Draenei - Young Moth */
0, /* Fel Orc */ 0, /* Naga */
0, /* Broken */ 0, /* Skeleton */
0, /* Vrykul */ 0, /* Tuskarr */
0, /* Forest Troll */ 0, /* Taunka */
0, /* Northrend Skeleton */ 0, /* Ice Troll */
79596, /* Worgen - Young Mastiff */
};
pCurrChar->CastSpell(pCurrChar, HunterCreatePetSpells[pCurrChar->getRace()], true);
}
}
// show time before shutdown if shutdown planned.
if (sWorld->IsShuttingDown())
sWorld->ShutdownMsg(true, pCurrChar);
+5
View File
@@ -5460,6 +5460,11 @@ void Spell::EffectCreateTamedPet(SpellEffIndex effIndex)
if (!pet)
return;
// relocate
float px, py, pz;
unitTarget->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle());
pet->Relocate(px, py, pz, unitTarget->GetOrientation());
// add to world
pet->GetMap()->AddToMap(pet->ToCreature());