本文整理汇总了C++中Spell::GetDuration方法的典型用法代码示例。如果您正苦于以下问题:C++ Spell::GetDuration方法的具体用法?C++ Spell::GetDuration怎么用?C++ Spell::GetDuration使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Spell
的用法示例。
在下文中一共展示了Spell::GetDuration方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleAuraUpdateAdd
bool ChatHandler::HandleAuraUpdateAdd(const char* args, WorldSession* m_session)
{
if (!args)
return false;
uint32 SpellID = 0;
int Flags = 0;
int StackCount = 0;
if (sscanf(args, "%u 0x%X %i", &SpellID, &Flags, &StackCount) != 3 && sscanf(args, "%u %u %i", &SpellID, &Flags, &StackCount) != 3)
return false;
Player* Pl = m_session->GetPlayer();
if (Aura* AuraPtr = Pl->FindAura(SpellID))
{
uint8 VisualSlot = AuraPtr->m_visualSlot;
Pl->SendAuraUpdate(AuraPtr->m_auraSlot, false);
SystemMessage(m_session, "SMSG_AURA_UPDATE (update): VisualSlot %u - SpellID %u - Flags %i (0x%04X) - StackCount %i", VisualSlot, SpellID, Flags, Flags, StackCount);
}
else
{
SpellEntry* Sp = dbcSpell.LookupEntryForced(SpellID);
if (!Sp)
{
SystemMessage(m_session, "SpellID %u is invalid.", SpellID);
return true;
}
Spell* SpellPtr = sSpellFactoryMgr.NewSpell(Pl, Sp, false, NULL);
AuraPtr = sSpellFactoryMgr.NewAura(Sp, SpellPtr->GetDuration(), Pl, Pl);
Pl->AddAura(AuraPtr); // Serves purpose to just add the aura to our auraslots
SystemMessage(m_session, "SMSG_AURA_UPDATE (add): VisualSlot %u - SpellID %u - Flags %i (0x%04X) - StackCount %i", AuraPtr->m_visualSlot, SpellID, Flags, Flags, StackCount);
delete SpellPtr;
}
return true;
}
示例2: HandleAuraUpdateAdd
bool ChatHandler::HandleAuraUpdateAdd( const char *args, WorldSession *m_session )
{
if(!args)
return false;
uint32 SpellID = 0;
int Flags = 0;
int StackCount = 0;
if(sscanf(args, "%u 0x%X %i", &SpellID, &Flags, &StackCount) != 3 && sscanf(args, "%u %u %i", &SpellID, &Flags, &StackCount) != 3)
return false;
Player * Pl = m_session->GetPlayer();
if(Aura * AuraPtr = Pl->FindAura(SpellID))
{
uint8 VisualSlot = AuraPtr->m_visualSlot;
WorldPacket data(SMSG_AURA_UPDATE, 20);
FastGUIDPack(data, Pl->GetGUID());
data << (uint8)VisualSlot;
data << (uint32)SpellID;
data << (uint8)Flags;
data << (uint8)Pl->getLevel();
data << (uint8)StackCount;
if( !(Flags & AFLAG_NOT_CASTER) )
data << WoWGuid(Pl->GetSelection());
if(Flags & AFLAG_DURATION)
{
data << (uint32)AuraPtr->GetDuration();
data << (uint32)AuraPtr->GetTimeLeft();
}
m_session->SendPacket(&data);
SystemMessage(m_session, "SMSG_AURA_UPDATE (update): VisualSlot %u - SpellID %u - Flags %i (0x%04X) - StackCount %i", VisualSlot, SpellID, Flags, Flags, StackCount);
}
else
{
SpellEntry * Sp = dbcSpell.LookupEntryForced(SpellID);
if(!Sp)
{
SystemMessage(m_session, "SpellID %u is invalid.", SpellID);
return true;
}
Spell * SpellPtr = new Spell(Pl, Sp, false, NULL);
AuraPtr = new Aura(Sp, SpellPtr->GetDuration(), Pl, Pl);
Pl->AddAura(AuraPtr); // Serves purpose to just add the aura to our auraslots
uint8 VisualSlot = Pl->FindVisualSlot(SpellID, AuraPtr->IsPositive());
WorldPacket data(SMSG_AURA_UPDATE, 20);
FastGUIDPack(data, Pl->GetGUID());
data << (uint8)VisualSlot;
data << (uint32)SpellID;
data << (uint8)Flags;
data << (uint8)Pl->getLevel();
data << (uint8)StackCount;
if( !(Flags & AFLAG_NOT_CASTER) )
data << (uint8)0; // caster guid
if(Flags & AFLAG_DURATION)
{
data << (uint32)SpellPtr->GetDuration();
data << (uint32)SpellPtr->GetDuration();
}
m_session->SendPacket(&data);
SystemMessage(m_session, "SMSG_AURA_UPDATE (add): VisualSlot %u - SpellID %u - Flags %i (0x%04X) - StackCount %i", VisualSlot, SpellID, Flags, Flags, StackCount);
delete SpellPtr;
}
return true;
}