本文整理汇总了C++中GetSummoner函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSummoner函数的具体用法?C++ GetSummoner怎么用?C++ GetSummoner使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetSummoner函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ForcedUnsummonDelayEvent
void TempSummon::UnSummon(uint32 msTime)
{
if (msTime)
{
ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));
return;
}
//ASSERT(!IsPet());
if (IsPet())
{
((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
//npcbot
if (GetIAmABot() || GetIAmABotsPet())
{
//TC_LOG_ERROR("entities.player", "TempSummon::UnSummon(): Trying to unsummon Bot %s (guidLow: %u owner: %s)", GetName().c_str(), GetGUIDLow(), GetBotOwner()->GetName().c_str());
if (IsTempBot())
AI()->JustDied(NULL);
return;
}
//end npcbots
AddObjectToRemoveList();
}
示例2: ForcedUnsummonDelayEvent
void TempSummon::UnSummon(uint32 msTime)
{
if (msTime)
{
ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));
return;
}
//ASSERT(!isPet());
if (isPet())
{
((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && GetEntry() == 30230) // Risen ally
{
owner->RemoveAurasDueToSpell(62218);
owner->RemoveAurasDueToSpell(46619);
}
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
}
示例3: ForcedUnsummonDelayEvent
void TempSummon::UnSummon(uint32 msTime)
{
if (msTime)
{
ForcedUnsummonDelayEvent *pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));
return;
}
//ASSERT(!isPet());
if (isPet())
{
if(((Pet*)this)->getPetType() == HUNTER_PET)
((Pet*)this)->Remove(PET_SAVE_AS_CURRENT);
else
((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
}
示例4: ForcedUnsummonDelayEvent
void TempSummon::UnSummon(uint32 msTime)
{
if (msTime)
{
ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));
return;
}
//ASSERT(!isPet());
if (isPet())
{
if (ToPet()->getPetType() == HUNTER_PET)
ToPet()->Remove(PET_SLOT_ACTUAL_PET_SLOT, false, ToPet()->m_Stampeded);
else
ToPet()->Remove(PET_SLOT_OTHER_PET, false, ToPet()->m_Stampeded);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
}
示例5: ForcedUnsummonDelayEvent
void TempSummon::UnSummon(uint32 msTime)
{
if (msTime)
{
ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));
return;
}
// Dont allow to call this function twice (possible)
if (m_type == TEMPSUMMON_DESPAWNED)
return;
SetTempSummonType(TEMPSUMMON_DESPAWNED);
//ASSERT(!IsPet());
if (IsPet())
{
((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
}
示例6: ASSERT
void TempSummon::UnSummon()
{
//ASSERT(!isPet());
if (isPet())
{
if (((Pet*)this)->getPetType() == HUNTER_PET)
((Pet*)this)->Remove(PET_SLOT_ACTUAL_PET_SLOT);
else
((Pet*)this)->Remove(PET_SLOT_OTHER_PET);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
if (owner &&
owner->GetTypeId() == TYPEID_PLAYER &&
((Player*)owner)->HaveBot() &&
((Player*)owner)->GetBot()->GetGUID()==this->GetGUID() &&
this->isDead()) { // dont unsummon corpse if a bot
return;
}
AddObjectToRemoveList();
}
示例7: GetSummoner
void TempSummon::InitSummon() {
Unit* owner = GetSummoner();
if (owner) {
if (owner->GetTypeId() == TYPEID_UNIT
&& owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->JustSummoned(this);
if (IsAIEnabled)
AI()->IsSummonedBy(owner);
}
}
示例8: GetSummoner
void TempSummon::InitSummon()
{
Unit* owner = GetSummoner();
if (owner)
{
if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->JustSummoned(this);
}
// Xinef: Allow to call this hook when npc is summoned by gameobject, in this case pass this as summoner to avoid possible null checks
if (IsAIEnabled)
AI()->IsSummonedBy(owner);
}
示例9: ASSERT
void TempSummon::UnSummon()
{
if (isPet())
{
((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
}
示例10: RemoveFromWorld
void TempSummon::RemoveFromWorld() {
if (!IsInWorld())
return;
if (m_Properties)
if (uint32 slot = m_Properties->Slot)
if (Unit* owner = GetSummoner())
if (owner->m_SummonSlot[slot] == GetGUID())
owner->m_SummonSlot[slot] = 0;
//if (GetOwnerGUID())
// sLog->outError("Unit %u has owner guid when removed from world", GetEntry());
Creature::RemoveFromWorld();
}
示例11: RemoveFromWorld
void TempSummon::RemoveFromWorld()
{
if (!IsInWorld())
return;
if (m_Properties)
if (uint32 slot = m_Properties->Slot)
if (Unit* owner = GetSummoner())
if (owner->m_SummonSlot[slot] == GetGUID())
owner->m_SummonSlot[slot].Clear();
//if (GetOwnerGUID())
// TC_LOG_ERROR("entities.unit", "Unit %u has owner guid when removed from world", GetEntry());
Creature::RemoveFromWorld();
}
示例12: ASSERT
void TempSummon::InitStats(uint32 duration)
{
ASSERT(!IsPet());
m_timer = duration;
m_lifetime = duration;
if (m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Unit* owner = GetSummoner();
if (owner)
{
if (IsTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
}
if (owner->GetTypeId() == TYPEID_PLAYER)
m_CreatedByPlayer = true;
}
if (!m_Properties)
return;
if (owner)
{
if (uint32 slot = m_Properties->Slot)
{
if (owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
{
Creature* oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
if (oldSummon && oldSummon->IsSummon())
oldSummon->ToTempSummon()->UnSummon();
}
owner->m_SummonSlot[slot] = GetGUID();
}
}
if (m_Properties->Faction)
setFaction(m_Properties->Faction);
else if (IsVehicle() && owner) // properties should be vehicle
setFaction(owner->getFaction());
}
示例13: ASSERT
void TempSummon::UnSummon()
{
//ASSERT(!isPet());
if (isPet())
{
if (((Pet*)this)->getPetType() == HUNTER_PET)
((Pet*)this)->Remove(PET_SLOT_ACTUAL_PET_SLOT);
else
((Pet*)this)->Remove(PET_SLOT_OTHER_PET);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
}
示例14: ForcedUnsummonDelayEvent
void TempSummon::UnSummon(uint32 msTime)
{
if (msTime)
{
ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this);
m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime));
return;
}
// Custom operations
switch(GetEntry())
{
// Force of Nature
case 36070:
// If not it's directly handled in JustDied
if(IsAIEnabled && isAlive())
{
AI()->JustDied(this);
}
break;
}
//ASSERT(!isPet());
if (isPet())
{
((Pet*)this)->Remove(PET_SAVE_NOT_IN_SLOT);
ASSERT(!IsInWorld());
return;
}
Unit* owner = GetSummoner();
if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
AddObjectToRemoveList();
}
示例15: ASSERT
void TempSummon::InitStats(uint32 duration)
{
ASSERT(!isPet());
m_timer = duration;
m_lifetime = duration;
if (m_type == TEMPSUMMON_MANUAL_DESPAWN)
m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
Unit* owner = GetSummoner();
if (owner && isTrigger() && m_spells[0])
{
setFaction(owner->getFaction());
SetLevel(owner->getLevel());
if (owner->GetTypeId() == TYPEID_PLAYER)
m_ControlledByPlayer = true;
}
if (!m_Properties)
return;
// Fix Force of Nature treants stats
if (owner && owner->getClass() == CLASS_DRUID && owner->HasSpell(106737))
{
float damage = 0.0f;
switch (GetEntry())
{
case ENTRY_TREANT_RESTO:
case ENTRY_TREANT_BALANCE:
SetMaxHealth(owner->CountPctFromMaxHealth(40));
break;
case ENTRY_TREANT_GUARDIAN:
SetMaxHealth(owner->CountPctFromMaxHealth(40));
// (Attack power / 14 * 2 * 0.75) * 0.2f
damage = ((owner->GetTotalAttackPowerValue(BASE_ATTACK) / 14.0f) * 2.0f * 0.75f) * 0.2f;
SetStatFloatValue(UNIT_FIELD_MINDAMAGE, damage);
SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, damage);
case ENTRY_TREANT_FERAL:
SetMaxHealth(owner->CountPctFromMaxHealth(40));
// Attack power / 14 * 2 * 0.75
damage = (owner->GetTotalAttackPowerValue(BASE_ATTACK) / 14.0f) * 2.0f * 0.75f;
SetStatFloatValue(UNIT_FIELD_MINDAMAGE, damage);
SetStatFloatValue(UNIT_FIELD_MAXDAMAGE, damage);
default:
break;
}
}
if (owner)
{
if (uint32 slot = m_Properties->Slot)
{
if (owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID())
{
Creature* oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]);
if (oldSummon && oldSummon->IsSummon())
oldSummon->ToTempSummon()->UnSummon();
}
owner->m_SummonSlot[slot] = GetGUID();
}
}
if (m_Properties->Faction)
setFaction(m_Properties->Faction);
else if (IsVehicle() && owner) // properties should be vehicle
setFaction(owner->getFaction());
}