*Summon all creatures by summon properties.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-03-25 16:20:30 -06:00
parent 2106e9f257
commit ebf53a4820
7 changed files with 39 additions and 96 deletions

View File

@@ -68,7 +68,7 @@ namespace FactorySelector
ai_factory = ai_registry.GetRegistryItem("NullCreatureAI");
else if(creature->isSummon() && ((TempSummon*)creature)->m_Properties)
{
if(((TempSummon*)creature)->m_Properties->Category == SUMMON_CATEGORY_GUARDIAN
if(((TempSummon*)creature)->m_Properties->Category == SUMMON_CATEGORY_PET
|| ((TempSummon*)creature)->m_Properties->Type == SUMMON_TYPE_GUARDIAN
|| ((TempSummon*)creature)->m_Properties->Type == SUMMON_TYPE_MINION)
ai_factory = ai_registry.GetRegistryItem("PetAI");

View File

@@ -1650,7 +1650,7 @@ TempSummon *Map::SummonCreature(uint32 entry, float x, float y, float z, float a
uint32 mask = SUMMON_MASK_SUMMON;
if(properties)
{
if(properties->Category == SUMMON_CATEGORY_GUARDIAN
if(properties->Category == SUMMON_CATEGORY_PET
|| properties->Type == SUMMON_TYPE_GUARDIAN
|| properties->Type == SUMMON_TYPE_MINION)
mask = SUMMON_MASK_GUARDIAN;

View File

@@ -2378,7 +2378,7 @@ enum SummonCategory
{
SUMMON_CATEGORY_WILD = 0,
SUMMON_CATEGORY_ALLY = 1,
SUMMON_CATEGORY_GUARDIAN = 2,
SUMMON_CATEGORY_PET = 2,
SUMMON_CATEGORY_POSSESSED = 3,
SUMMON_CATEGORY_VEHICLE = 4,
};
@@ -2386,7 +2386,7 @@ enum SummonCategory
enum SummonType
{
SUMMON_TYPE_NONE = 0,
SUMMON_TYPE_WILD1 = 1,
SUMMON_TYPE_PET = 1,
SUMMON_TYPE_GUARDIAN = 2,
SUMMON_TYPE_MINION = 3,
SUMMON_TYPE_TOTEM = 4,

View File

@@ -270,7 +270,6 @@ class Spell
void EffectProficiency(uint32 i);
void EffectApplyAreaAura(uint32 i);
void EffectSummonType(uint32 i);
void EffectSummon(uint32 i);
void EffectLearnSpell(uint32 i);
void EffectDispel(uint32 i);
void EffectDualWield(uint32 i);

View File

@@ -3285,108 +3285,49 @@ void Spell::EffectSummonType(uint32 i)
if(!entry)
return;
switch(m_spellInfo->EffectMiscValueB[i])
SummonPropertiesEntry const *properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]);
if(!properties)
{
sLog.outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->EffectMiscValueB[i]);
return;
}
switch(properties->Category)
{
case SUMMON_TYPE_WILD:
case SUMMON_TYPE_FROZEN_EARTH:
case SUMMON_TYPE_LIGHTWELL:
EffectSummonWild(i);
break;
case SUMMON_TYPE_DEMON:
EffectSummonDemon(i);
break;
case SUMMON_TYPE_SUMMON:
EffectSummon(i);
break;
default:
{
SummonPropertiesEntry const *properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->EffectMiscValueB[i]);
if(!properties)
switch(properties->Type)
{
sLog.outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->EffectMiscValueB[i]);
return;
}
switch(properties->Category)
{
default:
switch(properties->Type)
{
case SUMMON_TYPE_GUARDIAN:
case SUMMON_TYPE_MINION:
SummonGuardian(entry, properties);
break;
case SUMMON_TYPE_VEHICLE:
SummonVehicle(entry, properties);
break;
case SUMMON_TYPE_TOTEM:
SummonTotem(entry, properties);
break;
case SUMMON_TYPE_MINIPET:
EffectSummonCritter(i);
break;
default:
EffectSummonWild(i);
break;
}
break;
case SUMMON_CATEGORY_GUARDIAN:
case SUMMON_TYPE_PET:
case SUMMON_TYPE_GUARDIAN:
case SUMMON_TYPE_MINION:
SummonGuardian(entry, properties);
break;
case SUMMON_CATEGORY_POSSESSED:
SummonPossessed(entry, properties);
break;
case SUMMON_CATEGORY_VEHICLE:
case SUMMON_TYPE_VEHICLE:
SummonVehicle(entry, properties);
break;
case SUMMON_TYPE_TOTEM:
SummonTotem(entry, properties);
break;
case SUMMON_TYPE_MINIPET:
EffectSummonCritter(i);
break;
default:
EffectSummonWild(i);
break;
}
break;
}
case SUMMON_CATEGORY_PET:
SummonGuardian(entry, properties);
break;
case SUMMON_CATEGORY_POSSESSED:
SummonPossessed(entry, properties);
break;
case SUMMON_CATEGORY_VEHICLE:
SummonVehicle(entry, properties);
break;
}
}
void Spell::EffectSummon(uint32 i)
{
uint32 pet_entry = m_spellInfo->EffectMiscValue[i];
if(!pet_entry)
return;
if(!m_originalCaster || m_originalCaster->GetTypeId() != TYPEID_PLAYER)
{
EffectSummonWild(i);
return;
}
Player *owner = (Player*)m_originalCaster;
if(owner->GetPetGUID())
return;
// Summon in dest location
float x,y,z;
if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
{
x = m_targets.m_destX;
y = m_targets.m_destY;
z = m_targets.m_destZ;
}
else
m_caster->GetClosePoint(x,y,z,owner->GetObjectSize());
Pet *spawnCreature = owner->SummonPet(pet_entry, x, y, z, m_caster->GetOrientation(), SUMMON_PET, GetSpellDuration(m_spellInfo));
if(!spawnCreature)
return;
spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0);
spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0);
spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
std::string name = owner->GetName();
name.append(petTypeSuffix[spawnCreature->getPetType()]);
spawnCreature->SetName( name );
spawnCreature->SetReactState( REACT_DEFENSIVE );
}
void Spell::EffectLearnSpell(uint32 i)
{
if(!unitTarget)

View File

@@ -189,6 +189,9 @@ void TempSummon::InitSummon(uint32 duration)
owner->m_TotemSlot[slot] = GetGUID();
}
}
if(m_Properties->Faction)
setFaction(m_Properties->Faction);
}
void TempSummon::SetTempSummonType(TempSummonType type)

View File

@@ -1426,7 +1426,7 @@ struct SummonPropertiesEntry
{
uint32 Id; // 0
uint32 Category; // 1, 0 - can't be controlled?, 1 - something guardian?, 2 - pet?, 3 - something controllable?, 4 - taxi/mount?
uint32 Unk2; // 2, 14 rows > 0
uint32 Faction; // 2, 14 rows > 0
uint32 Type; // 3, see enum
uint32 Slot; // 4, 0-6
uint32 Flags; // 5