mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Merge commit 'origin/master' into 303
Conflicts: src/game/SpellEffects.cpp src/game/World.cpp
This commit is contained in:
commit
cffc766fb6
31 changed files with 415 additions and 168 deletions
|
|
@ -3890,59 +3890,38 @@ void Spell::EffectTameCreature(uint32 /*i*/)
|
|||
if(creatureTarget->isPet())
|
||||
return;
|
||||
|
||||
if(m_caster->getClass() == CLASS_HUNTER)
|
||||
if(m_caster->getClass() != CLASS_HUNTER)
|
||||
return;
|
||||
|
||||
// cast finish successfully
|
||||
//SendChannelUpdate(0);
|
||||
finish();
|
||||
|
||||
Pet* pet = m_caster->CreateTamedPetFrom(creatureTarget,m_spellInfo->Id);
|
||||
|
||||
// kill original creature
|
||||
creatureTarget->setDeathState(JUST_DIED);
|
||||
creatureTarget->RemoveCorpse();
|
||||
creatureTarget->SetHealth(0); // just for nice GM-mode view
|
||||
|
||||
uint32 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel();
|
||||
|
||||
// prepare visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
|
||||
|
||||
// add to world
|
||||
MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
|
||||
|
||||
// visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
|
||||
|
||||
// caster have pet now
|
||||
m_caster->SetPet(pet);
|
||||
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
// cast finish successfully
|
||||
//SendChannelUpdate(0);
|
||||
finish();
|
||||
|
||||
Pet* pet = new Pet(HUNTER_PET);
|
||||
|
||||
if(!pet->CreateBaseAtCreature(creatureTarget))
|
||||
{
|
||||
delete pet;
|
||||
return;
|
||||
}
|
||||
|
||||
creatureTarget->setDeathState(JUST_DIED);
|
||||
creatureTarget->RemoveCorpse();
|
||||
creatureTarget->SetHealth(0); // just for nice GM-mode view
|
||||
|
||||
pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID());
|
||||
pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID());
|
||||
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction());
|
||||
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||
|
||||
uint32 level = (creatureTarget->getLevel() < (m_caster->getLevel() - 5)) ? (m_caster->getLevel() - 5) : creatureTarget->getLevel();
|
||||
pet->SetFreeTalentPoints(pet->GetMaxTalentPointsForLevel(level));
|
||||
|
||||
if(!pet->InitStatsForLevel(level))
|
||||
{
|
||||
sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted.");
|
||||
delete pet;
|
||||
return;
|
||||
}
|
||||
|
||||
// prepare visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level - 1);
|
||||
|
||||
pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true);
|
||||
// this enables pet details window (Shift+P)
|
||||
pet->AIM_Initialize();
|
||||
pet->InitPetCreateSpells();
|
||||
pet->SetHealth(pet->GetMaxHealth());
|
||||
|
||||
MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet);
|
||||
|
||||
// visual effect for levelup
|
||||
pet->SetUInt32Value(UNIT_FIELD_LEVEL, level);
|
||||
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
m_caster->SetPet(pet);
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||
((Player*)m_caster)->PetSpellInitialize();
|
||||
}
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
|
||||
((Player*)m_caster)->PetSpellInitialize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -5584,13 +5563,7 @@ void Spell::EffectSkinning(uint32 /*i*/)
|
|||
Creature* creature = (Creature*) unitTarget;
|
||||
int32 targetLevel = creature->getLevel();
|
||||
|
||||
uint32 skill;
|
||||
if(creature->GetCreatureInfo()->flag1 & 256)
|
||||
skill = SKILL_HERBALISM; // special case
|
||||
else if(creature->GetCreatureInfo()->flag1 & 512)
|
||||
skill = SKILL_MINING; // special case
|
||||
else
|
||||
skill = SKILL_SKINNING; // normal case
|
||||
uint32 skill = creature->GetCreatureInfo()->GetRequiredLootSkill();
|
||||
|
||||
((Player*)m_caster)->SendLoot(creature->GetGUID(),LOOT_SKINNING);
|
||||
creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue