Skip to content

Commit

Permalink
Missing flags and byte values for pets
Browse files Browse the repository at this point in the history
Now pets can be bandaged

And sync the code between cores; only warlocks ever reach this in any
version of the core, so..

Ported and fitted for wrath; Wrath is getting its own pet patch; it's somewhat behind in some areas,
also some of the flags are guessed wrong...
  • Loading branch information
Phatcat committed Jul 26, 2016
1 parent d5b7377 commit 08443e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/game/Pet.cpp
Expand Up @@ -179,6 +179,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
SetName(fields[8].GetString());

SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_UNK4 | UNIT_BYTE2_FLAG_UNK5);
SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);

if (getPetType() == HUNTER_PET)
{
SetByteFlag(UNIT_FIELD_BYTES_2, 2, fields[9].GetBool() ? UNIT_CAN_BE_ABANDONED : UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED);
Expand Down Expand Up @@ -807,9 +810,12 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
SetByteValue(UNIT_FIELD_BYTES_0, 3, POWER_FOCUS);
SetSheath(SHEATH_STATE_MELEE);

SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_UNK4 | UNIT_BYTE2_FLAG_UNK5);
SetByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED | UNIT_CAN_BE_ABANDONED);

SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE | UNIT_FLAG_RENAME);


// this enables popup window
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);

SetUInt32Value(UNIT_MOD_CAST_SPEED, creature->GetUInt32Value(UNIT_MOD_CAST_SPEED));
Expand Down
10 changes: 10 additions & 0 deletions src/game/SpellEffects.cpp
Expand Up @@ -6794,6 +6794,16 @@ void Spell::EffectSummonPet(SpellEffectIndex eff_idx)

if (m_caster->GetTypeId() == TYPEID_PLAYER && NewSummon->getPetType() == SUMMON_PET)
{
NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);

// This is done for hunters pets, so now we do it for other controlled pets as well, why not? they're all unknowns anyway.
// I very much doubt this flag has anything to do with sanctuaries as this flag is needed to be able to bandage pet in classic and tbc
NewSummon->SetByteValue(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY | UNIT_BYTE2_FLAG_UNK4 | UNIT_BYTE2_FLAG_UNK5);

// this enables popup window (pet dismiss, cancel)
NewSummon->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
NewSummon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);

// generate new name for summon pet
std::string new_name = sObjectMgr.GeneratePetName(petentry);
if (!new_name.empty())
Expand Down

0 comments on commit 08443e6

Please sign in to comment.