本文整理汇总了C++中UnitPointer::IsInRangeOppFactSet方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPointer::IsInRangeOppFactSet方法的具体用法?C++ UnitPointer::IsInRangeOppFactSet怎么用?C++ UnitPointer::IsInRangeOppFactSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPointer
的用法示例。
在下文中一共展示了UnitPointer::IsInRangeOppFactSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleCastSpellOpcode
//.........这里部分代码省略.........
if (GetPlayer()->GetOnMeleeSpell() != spellId)
{
//autoshot 75
if((spellInfo->Flags3 & FLAGS3_ACTIVATE_AUTO_SHOT) /*spellInfo->Attributes == 327698*/) // auto shot..
{
//sLog.outString( "HandleSpellCast: Auto Shot-type spell cast (id %u, name %s)" , spellInfo->Id , spellInfo->Name );
ItemPointer weapon = GetPlayer()->GetItemInterface()->GetInventoryItem(EQUIPMENT_SLOT_RANGED);
if(!weapon)
return;
uint32 spellid;
switch(weapon->GetProto()->SubClass)
{
case 2: // bows
case 3: // guns
case 18: // crossbow
spellid = SPELL_RANGED_GENERAL;
break;
case 16: // thrown
spellid = SPELL_RANGED_THROW;
break;
case 19: // wands
spellid = SPELL_RANGED_WAND;
break;
default:
spellid = 0;
break;
}
if(!spellid)
spellid = spellInfo->Id;
if(!_player->m_onAutoShot)
{
_player->m_AutoShotTarget = _player->GetSelection();
uint32 duration = _player->GetUInt32Value(UNIT_FIELD_RANGEDATTACKTIME);
SpellCastTargets targets(recvPacket,GetPlayer()->GetGUID());
if(!targets.m_unitTarget)
{
sLog.outString( "Cancelling auto-shot cast because targets.m_unitTarget is null!" );
return;
}
SpellEntry *sp = dbcSpell.LookupEntry(spellid);
_player->m_AutoShotSpell = sp;
_player->m_AutoShotDuration = duration;
//This will fix fast clicks
if(_player->m_AutoShotAttackTimer < 500)
_player->m_AutoShotAttackTimer = 500;
_player->m_onAutoShot = true;
}
return;
}
if(_player->m_currentSpell)
{
if( _player->m_currentSpell->getState() == SPELL_STATE_CASTING )
{
// cancel the existing channel spell, cast this one
_player->m_currentSpell->cancel();
}
else
{
// send the error message
_player->SendCastResult(spellInfo->Id, SPELL_FAILED_SPELL_IN_PROGRESS, cn, 0);
return;
}
}
SpellCastTargets targets(recvPacket,GetPlayer()->GetGUID());
// some anticheat stuff
if( spellInfo->self_cast_only )
{
if( targets.m_unitTarget && targets.m_unitTarget != _player->GetGUID() )
{
// send the error message
_player->SendCastResult(spellInfo->Id, SPELL_FAILED_BAD_TARGETS, cn, 0);
return;
}
}
if( targets.m_unitTarget && GetPlayer()->GetMapMgr() && spellInfo->c_is_flags & SPELL_FLAG_IS_DAMAGING )
{
UnitPointer pUnit = GetPlayer()->GetMapMgr()->GetUnit( targets.m_unitTarget );
if( pUnit && pUnit != GetPlayer() && !isAttackable( GetPlayer(), pUnit, false ) && !pUnit->IsInRangeOppFactSet(GetPlayer()) && !pUnit->CombatStatus.DidDamageTo(GetPlayer()->GetGUID()))
{
//GetPlayer()->BroadcastMessage("Faction exploit detected. You will be disconnected in 5 seconds.");
//GetPlayer()->Kick(5000);
// Just cancel the cast
_player->SendCastResult(spellInfo->Id, SPELL_FAILED_BAD_TARGETS, cn, 0);
return;
}
}
SpellPointer spell(new Spell(GetPlayer(), spellInfo, false, NULLAURA));
spell->extra_cast_number=cn;
spell->prepare(&targets);
}
}