From 055493bcd03cfea60f4f20511839836c2c73cd7c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 18 Nov 2010 21:21:53 +0300 Subject: [PATCH] [10733] Implement defencive guardians pet type for creatures like 28120 --- src/game/Pet.cpp | 4 ++++ src/game/Pet.h | 3 ++- src/game/Player.cpp | 1 + src/game/SpellEffects.cpp | 15 ++++++++++----- src/shared/revision_nr.h | 2 +- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index bece0c1b56f..b8c08c4ac05 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -33,6 +33,7 @@ char const* petTypeSuffix[MAX_PET_TYPE] = "'s Minion", // SUMMON_PET "'s Pet", // HUNTER_PET "'s Guardian", // GUARDIAN_PET + "'s Companion", // PROTECTOR_PET "'s Companion" // MINI_PET }; @@ -51,6 +52,8 @@ m_declinedname(NULL), m_petModeFlags(PET_MODE_DEFAULT) if(type == MINI_PET) // always passive charmInfo->SetReactState(REACT_PASSIVE); + else if(type == PROTECTOR_PET) // always defensive + charmInfo->SetReactState(REACT_DEFENSIVE); else if(type == GUARDIAN_PET) // always aggressive charmInfo->SetReactState(REACT_AGGRESSIVE); } @@ -960,6 +963,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner) break; } case GUARDIAN_PET: + case PROTECTOR_PET: SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); diff --git a/src/game/Pet.h b/src/game/Pet.h index 15d3a6e8dd3..9b1663e620e 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -30,7 +30,8 @@ enum PetType HUNTER_PET = 1, GUARDIAN_PET = 2, MINI_PET = 3, - MAX_PET_TYPE = 4 + PROTECTOR_PET = 4, // work as defensive guardian with mini pet suffix in name + MAX_PET_TYPE = 5 }; extern char const* petTypeSuffix[MAX_PET_TYPE]; diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 0c50c56b216..1abf3e3ffba 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17816,6 +17816,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) case MINI_PET: m_miniPet = 0; break; + case PROTECTOR_PET: case GUARDIAN_PET: RemoveGuardian(pet); break; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c7d9c24d7c4..8d9de562c95 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4105,10 +4105,11 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx) DoSummonTotem(eff_idx, summon_prop->Slot); break; case SUMMON_PROP_TYPE_CRITTER: - DoSummonCritter(eff_idx, summon_prop->FactionId); - // TODO: differenciate between regular 'critter' types and 'critter' that are fighting. - // prop_id == 387 are expected to be fighting (but they have postfix 'companion'). - // Note: summon_prop->Slot==6 may be related to how selection are done for this type (need more research) + // slot 6 set for critters that can help to player in fighting + if (summon_prop->Slot == 6) + DoSummonGuardian(eff_idx, summon_prop->FactionId); + else + DoSummonCritter(eff_idx, summon_prop->FactionId); break; case SUMMON_PROP_TYPE_PHASING: case SUMMON_PROP_TYPE_LIGHTWELL: @@ -4592,6 +4593,10 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction) if (!pet_entry) return; + SummonPropertiesEntry const* propEntry = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[eff_idx]); + if (!propEntry) + return; + // in another case summon new uint32 level = m_caster->getLevel(); @@ -4623,7 +4628,7 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction) for(int32 count = 0; count < amount; ++count) { - Pet* spawnCreature = new Pet(GUARDIAN_PET); + Pet* spawnCreature = new Pet(propEntry->Type == SUMMON_PROP_TYPE_CRITTER ? PROTECTOR_PET : GUARDIAN_PET); Map *map = m_caster->GetMap(); uint32 pet_number = sObjectMgr.GeneratePetNumber(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 57c6181e68e..0b302093453 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10732" + #define REVISION_NR "10733" #endif // __REVISION_NR_H__