mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[8671] Correctly send SMSG_PET_TAME_FAILED with appropriate value when taming fail instead of spell fail.
I also removed conditions from Spell::EffectTameCreature which are checked in Spell::CheckCast. Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
906b2784a2
commit
0e1854a936
7 changed files with 80 additions and 37 deletions
|
|
@ -4097,35 +4097,23 @@ void Spell::EffectEnchantItemTmp(uint32 i)
|
|||
|
||||
void Spell::EffectTameCreature(uint32 /*i*/)
|
||||
{
|
||||
if(m_caster->GetPetGUID())
|
||||
return;
|
||||
|
||||
if(!unitTarget)
|
||||
return;
|
||||
|
||||
if(unitTarget->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
// Caster must be player, checked in Spell::CheckCast
|
||||
Player* plr = (Player*)m_caster;
|
||||
|
||||
Creature* creatureTarget = (Creature*)unitTarget;
|
||||
|
||||
if(creatureTarget->isPet())
|
||||
return;
|
||||
|
||||
if(m_caster->getClass() != CLASS_HUNTER)
|
||||
return;
|
||||
|
||||
// cast finish successfully
|
||||
//SendChannelUpdate(0);
|
||||
finish();
|
||||
|
||||
Pet* pet = m_caster->CreateTamedPetFrom(creatureTarget,m_spellInfo->Id);
|
||||
Pet* pet = plr->CreateTamedPetFrom(creatureTarget, m_spellInfo->Id);
|
||||
if(!pet) // in versy specific state like near world end/etc.
|
||||
return;
|
||||
|
||||
// "kill" original creature
|
||||
creatureTarget->ForcedDespawn();
|
||||
|
||||
uint32 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel();
|
||||
uint32 level = (creatureTarget->getLevel() < (plr->getLevel() - 5)) ? (plr->getLevel() - 5) : creatureTarget->getLevel();
|
||||
|
||||
// prepare visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
|
||||
|
|
@ -4137,13 +4125,10 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
|||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
|
||||
|
||||
// caster have pet now
|
||||
m_caster->SetPet(pet);
|
||||
plr->SetPet(pet);
|
||||
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||
((Player*)m_caster)->PetSpellInitialize();
|
||||
}
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||
plr->PetSpellInitialize();
|
||||
}
|
||||
|
||||
void Spell::EffectSummonPet(uint32 i)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue