aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Entities
diff options
context:
space:
mode:
authorMeji <alvaromegias_46@hotmail.com>2021-12-25 15:27:58 +0100
committerGitHub <noreply@github.com>2021-12-25 15:27:58 +0100
commit924182f692bde38d8fed85d5dbe7531a09790501 (patch)
treeec5b5c5842315ad391d1da9cd236952159a03fd4 /src/server/game/Entities
parent8ac0388870519a085115454783dafed873c1535f (diff)
Core/BattlePets: Misc fixes (#27446)
* Added script for "Summon Battle Pet" spell (118301). * Set the saved display of the battle pet when summoning it. * If a summon has SummonPropertiesFlags::SummonFromBattlePetJournal it will remove NpcFlag UNIT_NPC_FLAG_WILD_BATTLE_PET (Wild battle pets). * When a creature is summoned with SummonTitle::Companion, it will check to see if it has SummonPropertiesFlags::SummonFromBattlePetJournal before updating the battle pet's update fields. (If you have a summoned battle pet and summon a creature with that SummonTitle, it will incorrectly update the battle pet's update fields with the summoned battle pet's data). * Implemented SummonPropertiesFlags::UseCreatureLevel. If a summon has this flag, it will use the owner's level (If the summon doesn't have SummonProperties it will always use the selected level).
Diffstat (limited to 'src/server/game/Entities')
-rw-r--r--src/server/game/Entities/Creature/TemporarySummon.cpp17
-rw-r--r--src/server/game/Entities/Totem/Totem.cpp2
-rw-r--r--src/server/game/Entities/Unit/Unit.cpp20
3 files changed, 24 insertions, 15 deletions
diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
index 27409d0209c..666145e0b04 100644
--- a/src/server/game/Entities/Creature/TemporarySummon.cpp
+++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
@@ -187,11 +187,8 @@ void TempSummon::InitStats(uint32 duration)
Unit* owner = GetSummonerUnit();
if (owner && IsTrigger() && m_spells[0])
- {
- SetLevel(owner->GetLevel());
if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
- }
if (!m_Properties)
return;
@@ -209,15 +206,20 @@ void TempSummon::InitStats(uint32 duration)
}
owner->m_SummonSlot[slot] = GetGUID();
}
+
+ if (!m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::UseCreatureLevel))
+ SetLevel(owner->GetLevel());
}
uint32 faction = m_Properties->Faction;
- if (m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::UseSummonerFaction)) // TODO: Determine priority between faction and flag
- if (owner)
- faction = owner->GetFaction();
+ if (owner && m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::UseSummonerFaction)) // TODO: Determine priority between faction and flag
+ faction = owner->GetFaction();
if (faction)
- SetFaction(faction);
+ SetFaction(faction);
+
+ if (m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::SummonFromBattlePetJournal))
+ RemoveNpcFlag(UNIT_NPC_FLAG_WILD_BATTLE_PET);
}
void TempSummon::InitSummon()
@@ -434,7 +436,6 @@ Puppet::Puppet(SummonPropertiesEntry const* properties, Unit* owner)
void Puppet::InitStats(uint32 duration)
{
Minion::InitStats(duration);
- SetLevel(GetOwner()->GetLevel());
SetReactState(REACT_PASSIVE);
}
diff --git a/src/server/game/Entities/Totem/Totem.cpp b/src/server/game/Entities/Totem/Totem.cpp
index a0ccd833b37..d649a2a6be6 100644
--- a/src/server/game/Entities/Totem/Totem.cpp
+++ b/src/server/game/Entities/Totem/Totem.cpp
@@ -82,8 +82,6 @@ void Totem::InitStats(uint32 duration)
m_type = TOTEM_ACTIVE;
m_duration = duration;
-
- SetLevel(GetOwner()->GetLevel());
}
void Totem::InitSummon()
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 76dadac3885..ad6ed3ec293 100644
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -5827,16 +5827,26 @@ void Unit::SetMinion(Minion *minion, bool apply)
SetMinionGUID(minion->GetGUID());
}
- if (minion->m_Properties && SummonTitle(minion->m_Properties->Title) == SummonTitle::Companion)
+ SummonPropertiesEntry const* properties = minion->m_Properties;
+ if (properties && SummonTitle(properties->Title) == SummonTitle::Companion)
{
SetCritterGUID(minion->GetGUID());
if (Player const* thisPlayer = ToPlayer())
{
- if (BattlePets::BattlePet const* pet = thisPlayer->GetSession()->GetBattlePetMgr()->GetPet(thisPlayer->GetSummonedBattlePetGUID()))
+ if (properties->GetFlags().HasFlag(SummonPropertiesFlags::SummonFromBattlePetJournal))
{
- minion->SetBattlePetCompanionGUID(thisPlayer->GetSummonedBattlePetGUID());
- minion->SetBattlePetCompanionNameTimestamp(pet->NameTimestamp);
- minion->SetWildBattlePetLevel(pet->PacketInfo.Level);
+ if (BattlePets::BattlePet const* pet = thisPlayer->GetSession()->GetBattlePetMgr()->GetPet(thisPlayer->GetSummonedBattlePetGUID()))
+ {
+ minion->SetBattlePetCompanionGUID(thisPlayer->GetSummonedBattlePetGUID());
+ minion->SetBattlePetCompanionNameTimestamp(pet->NameTimestamp);
+ minion->SetWildBattlePetLevel(pet->PacketInfo.Level);
+
+ if (uint32 display = pet->PacketInfo.DisplayID)
+ {
+ minion->SetDisplayId(display);
+ minion->SetNativeDisplayId(display);
+ }
+ }
}
}
}