[10733] Implement defencive guardians pet type for creatures like 28120

This commit is contained in:
VladimirMangos 2010-11-18 21:21:53 +03:00
parent 10273fa38a
commit 9c0076181b
5 changed files with 18 additions and 7 deletions

View file

@ -33,6 +33,7 @@ char const* petTypeSuffix[MAX_PET_TYPE] =
"'s Minion", // SUMMON_PET "'s Minion", // SUMMON_PET
"'s Pet", // HUNTER_PET "'s Pet", // HUNTER_PET
"'s Guardian", // GUARDIAN_PET "'s Guardian", // GUARDIAN_PET
"'s Companion", // PROTECTOR_PET
"'s Companion" // MINI_PET "'s Companion" // MINI_PET
}; };
@ -51,6 +52,8 @@ m_declinedname(NULL), m_petModeFlags(PET_MODE_DEFAULT)
if(type == MINI_PET) // always passive if(type == MINI_PET) // always passive
charmInfo->SetReactState(REACT_PASSIVE); charmInfo->SetReactState(REACT_PASSIVE);
else if(type == PROTECTOR_PET) // always defensive
charmInfo->SetReactState(REACT_DEFENSIVE);
else if(type == GUARDIAN_PET) // always aggressive else if(type == GUARDIAN_PET) // always aggressive
charmInfo->SetReactState(REACT_AGGRESSIVE); charmInfo->SetReactState(REACT_AGGRESSIVE);
} }
@ -960,6 +963,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel, Unit* owner)
break; break;
} }
case GUARDIAN_PET: case GUARDIAN_PET:
case PROTECTOR_PET:
SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0);
SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000);

View file

@ -30,7 +30,8 @@ enum PetType
HUNTER_PET = 1, HUNTER_PET = 1,
GUARDIAN_PET = 2, GUARDIAN_PET = 2,
MINI_PET = 3, 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]; extern char const* petTypeSuffix[MAX_PET_TYPE];

View file

@ -17816,6 +17816,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
case MINI_PET: case MINI_PET:
m_miniPet = 0; m_miniPet = 0;
break; break;
case PROTECTOR_PET:
case GUARDIAN_PET: case GUARDIAN_PET:
RemoveGuardian(pet); RemoveGuardian(pet);
break; break;

View file

@ -4105,10 +4105,11 @@ void Spell::EffectSummonType(SpellEffectIndex eff_idx)
DoSummonTotem(eff_idx, summon_prop->Slot); DoSummonTotem(eff_idx, summon_prop->Slot);
break; break;
case SUMMON_PROP_TYPE_CRITTER: case SUMMON_PROP_TYPE_CRITTER:
DoSummonCritter(eff_idx, summon_prop->FactionId); // slot 6 set for critters that can help to player in fighting
// TODO: differenciate between regular 'critter' types and 'critter' that are fighting. if (summon_prop->Slot == 6)
// prop_id == 387 are expected to be fighting (but they have postfix 'companion'). DoSummonGuardian(eff_idx, summon_prop->FactionId);
// Note: summon_prop->Slot==6 may be related to how selection are done for this type (need more research) else
DoSummonCritter(eff_idx, summon_prop->FactionId);
break; break;
case SUMMON_PROP_TYPE_PHASING: case SUMMON_PROP_TYPE_PHASING:
case SUMMON_PROP_TYPE_LIGHTWELL: case SUMMON_PROP_TYPE_LIGHTWELL:
@ -4592,6 +4593,10 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
if (!pet_entry) if (!pet_entry)
return; return;
SummonPropertiesEntry const* propEntry = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[eff_idx]);
if (!propEntry)
return;
// in another case summon new // in another case summon new
uint32 level = m_caster->getLevel(); uint32 level = m_caster->getLevel();
@ -4623,7 +4628,7 @@ void Spell::DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction)
for(int32 count = 0; count < amount; ++count) 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(); Map *map = m_caster->GetMap();
uint32 pet_number = sObjectMgr.GeneratePetNumber(); uint32 pet_number = sObjectMgr.GeneratePetNumber();

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10732" #define REVISION_NR "10733"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__