本文整理汇总了C++中SpellCastTargets::SetElevation方法的典型用法代码示例。如果您正苦于以下问题:C++ SpellCastTargets::SetElevation方法的具体用法?C++ SpellCastTargets::SetElevation怎么用?C++ SpellCastTargets::SetElevation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpellCastTargets
的用法示例。
在下文中一共展示了SpellCastTargets::SetElevation方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleClientCastFlags
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
{
// some spell cast packet including more data (for projectiles?)
if (castFlags & 0x02)
{
// not sure about these two
float elevation, speed;
recvPacket >> elevation;
recvPacket >> speed;
targets.SetElevation(elevation);
targets.SetSpeed(speed);
uint8 hasMovementData;
recvPacket >> hasMovementData;
if (hasMovementData)
{
recvPacket.rfinish();
// movement packet for caster of the spell
/*recvPacket.read_skip<uint32>(); // MSG_MOVE_STOP - hardcoded in client
uint64 guid;
recvPacket.readPackGUID(guid);
MovementInfo movementInfo;
movementInfo.guid = guid;
ReadMovementInfo(recvPacket, &movementInfo);*/
}
}
示例2: HandleClientCastFlags
void WorldSession::HandleClientCastFlags(WorldPacket& recvPacket, uint8 castFlags, SpellCastTargets& targets)
{
// some spell cast packet including more data (for projectiles?)
if (castFlags & 0x02)
{
// not sure about these two
float elevation, speed;
recvPacket >> elevation;
recvPacket >> speed;
targets.SetElevation(elevation);
targets.SetSpeed(speed);
uint8 hasMovementData;
recvPacket >> hasMovementData;
if (hasMovementData)
HandleMovementOpcodes(recvPacket);
}
示例3: HandlePetCastSpellOpcode
//.........这里部分代码省略.........
castCount = recvPacket.read<uint8>();
if (hasString)
recvPacket.ReadString(stringLenght);
if (hasSpeed)
speed = recvPacket.read<float>();
TC_LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, castCount: %u, spellId %u, targetFlags %u", castCount, spellID, targetFlags);
// This opcode is also sent from charmed and possessed units (players and creatures)
if (!_player->GetGuardianPet() && !_player->GetCharm())
return;
Unit* caster = ObjectAccessor::GetUnit(*_player, casterGUID);
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
{
TC_LOG_ERROR("network", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(casterGUID)), GetPlayer()->GetName().c_str());
return;
}
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID);
if (!spellInfo)
{
TC_LOG_ERROR("network", "WORLD: unknown PET spell id %i", spellID);
return;
}
if (spellInfo->StartRecoveryCategory > 0) // Check if spell is affected by GCD
if (caster->GetTypeId() == TYPEID_UNIT && caster->GetCharmInfo() && caster->GetCharmInfo()->GetGlobalCooldownMgr().HasGlobalCooldown(caster, spellInfo))
{
caster->SendPetCastFail(spellID, SPELL_FAILED_NOT_READY);
return;
}
// do not cast not learned spells
if (!caster->HasSpell(spellID) || spellInfo->IsPassive())
return;
SpellCastTargets targets;
targets.Initialize(targetFlags, targetGUID, unkGUID1, transportDstGUID, dstLoc, transportSrcGUID, srcLoc);
targets.SetElevation(elevation);
targets.SetSpeed(speed);
targets.Update(caster);
// Interrupt auto-cast if other spell is forced by player
if (caster->IsNonMeleeSpellCasted(false, true, true, false, true))
caster->InterruptNonMeleeSpells(false, 0, false);
caster->ClearUnitState(UNIT_STATE_FOLLOW);
Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE, 0, false, true);
spell->m_cast_count = castCount; // probably pending spell cast
spell->m_targets = targets;
// TODO: need to check victim?
SpellCastResult result;
if (caster->m_movedPlayer)
result = spell->CheckPetCast(caster->m_movedPlayer->GetSelectedUnit());
else
result = spell->CheckPetCast(NULL);
if (result == SPELL_CAST_OK)
{
if (caster->GetTypeId() == TYPEID_UNIT)
{
Creature* pet = caster->ToCreature();
pet->AddCreatureSpellCooldown(spellID);
if (pet->isPet())
{
Pet* p = (Pet*)pet;
// 10% chance to play special pet attack talk, else growl
// actually this only seems to happen on special spells, fire shield for imp, torment for voidwalker, but it's stupid to check every spell
if (p->getPetType() == SUMMON_PET && (urand(0, 100) < 10))
pet->SendPetTalk((uint32)PET_TALK_SPECIAL_SPELL);
else
pet->SendPetAIReaction(spellID);
}
}
spell->prepare(&(spell->m_targets));
}
else
{
caster->SendPetCastFail(spellID, result);
if (caster->GetTypeId() == TYPEID_PLAYER)
{
if (!caster->ToPlayer()->HasSpellCooldown(spellID))
GetPlayer()->SendClearCooldown(spellID, caster);
}
else
{
if (!caster->ToCreature()->HasSpellCooldown(spellID))
GetPlayer()->SendClearCooldown(spellID, caster);
}
spell->finish(false);
delete spell;
}
}