Skip to content

Commit

Permalink
[10733] Implement defencive guardians pet type for creatures like 28120
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirMangos committed Nov 18, 2010
1 parent 8ccea41 commit 055493b
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
4 changes: 4 additions & 0 deletions src/game/Pet.cpp
Expand Up @@ -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
};

Expand All @@ -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);
}
Expand Down Expand Up @@ -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);

Expand Down
3 changes: 2 additions & 1 deletion src/game/Pet.h
Expand Up @@ -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];
Expand Down
1 change: 1 addition & 0 deletions src/game/Player.cpp
Expand Up @@ -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;
Expand Down
15 changes: 10 additions & 5 deletions src/game/SpellEffects.cpp
Expand Up @@ -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:
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 055493b

Please sign in to comment.