本文整理汇总了C++中SpellCastTargets::getUnitTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ SpellCastTargets::getUnitTarget方法的具体用法?C++ SpellCastTargets::getUnitTarget怎么用?C++ SpellCastTargets::getUnitTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpellCastTargets
的用法示例。
在下文中一共展示了SpellCastTargets::getUnitTarget方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUse
bool OnUse (Player *pPlayer, Item *pItem, SpellCastTargets const& targets)
{
if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT && targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578))
return false;
pPlayer->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, pItem, NULL);
return true;
}
示例2: ItemUse_item_gor_dreks_ointment
bool ItemUse_item_gor_dreks_ointment(Player *player, Item* _Item, SpellCastTargets const& targets)
{
if( targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId()==TYPEID_UNIT &&
targets.getUnitTarget()->GetEntry() == 20748 && !targets.getUnitTarget()->HasAura(32578) )
return false;
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW,_Item,NULL);
return true;
}
示例3: ItemUse_item_attuned_crystal_cores
bool ItemUse_item_attuned_crystal_cores(Player* player, Item* _Item, SpellCastTargets const& targets)
{
if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT &&
targets.getUnitTarget()->GetEntry() == ERRATIC_SENTRY && targets.getUnitTarget()->isDead() &&
(player->GetQuestStatus(ERRATIC_BEHAVIOUR) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(FURTHER_CONVERSIONS) == QUEST_STATUS_INCOMPLETE))
return false;
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, _Item, NULL);
return true;
}
示例4: ItemUse_item_battery
bool ItemUse_item_battery(Player* player, Item* _Item, SpellCastTargets const& targets)
{
if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT &&
targets.getUnitTarget()->GetEntry() == 18879 && player->GetQuestStatus(10190) == QUEST_STATUS_INCOMPLETE &&
(targets.getUnitTarget()->GetHealthPct() <= 25))
return false;
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, _Item, NULL);
return true;
}
示例5: ItemUse_item_attuned_crystal_cores
bool ItemUse_item_attuned_crystal_cores(Player* player, Item* _Item, SpellCastTargets const& targets)
{
if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT &&
targets.getUnitTarget()->GetEntry() == 24972 && targets.getUnitTarget()->isDead() &&
(player->GetQuestStatus(11524) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(11525) == QUEST_STATUS_INCOMPLETE))
{
CAST_CRE(targets.getUnitTarget())->RemoveCorpse();
return false;
}
player->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, _Item, NULL);
return true;
}
示例6: ItemUse_item_alystrosAggro
bool ItemUse_item_alystrosAggro(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
if(pTargets.getUnitTarget()->GetEntry() == 27249)
{
pTargets.getUnitTarget()->AddThreat(pPlayer,20.0f);
}
else
{
Spell::SendCastResult(pPlayer, GetSpellStore()->LookupEntry(49566), 1, SPELL_FAILED_BAD_TARGETS);
return false;
}
return true;
}
示例7: ItemUse_item_Tillinghasts_Plague_Canister
bool ItemUse_item_Tillinghasts_Plague_Canister(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
if(pTargets.getUnitTarget()->GetEntry() == 23777)
{
pPlayer->CastSpell(pTargets.getUnitTarget(),43157,true);
pPlayer->DealDamage(pTargets.getUnitTarget(),pTargets.getUnitTarget()->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
}
else
{
Spell::SendCastResult(pPlayer, GetSpellStore()->LookupEntry(43157), 1, SPELL_FAILED_BAD_TARGETS);
return false;
}
return true;
}
示例8: ItemUse_item_gor_dreks_ointment
bool ItemUse_item_gor_dreks_ointment(Player* pPlayer, Item* pItem, const SpellCastTargets& pTargets)
{
if (pTargets.getUnitTarget() && pTargets.getUnitTarget()->GetTypeId() == TYPEID_UNIT && pTargets.getUnitTarget()->HasAura(SPELL_GORDREKS_OINTMENT))
{
pPlayer->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
if (const SpellEntry* pSpellInfo = GetSpellStore()->LookupEntry(SPELL_GORDREKS_OINTMENT))
Spell::SendCastResult(pPlayer, pSpellInfo, 1, SPELL_FAILED_TARGET_AURASTATE);
return true;
}
return false;
}
示例9: ItemUse_item_chest_of_containment_coffers
bool ItemUse_item_chest_of_containment_coffers(Player* player, Item* _Item, SpellCastTargets const& targets)
{
if (targets.getUnitTarget() && targets.getUnitTarget()->GetTypeId() == TYPEID_UNIT && targets.getUnitTarget()->IsAlive() &&
targets.getUnitTarget()->GetEntry() == MOB_RIFT_SPAWN && targets.getUnitTarget()->HasAura(SPELL_SELF_STUN_30SEC))
return false;
WorldPacket data(SMSG_CAST_FAILED, (4 + 2)); // prepare packet error message
data << uint32(_Item->GetEntry()); // itemId
data << uint8(SPELL_FAILED_NOT_READY); // reason
player->GetSession()->SendPacket(&data); // send message: Not ready yet
player->SendEquipError(EQUIP_ERR_NONE, _Item, NULL); // break spell
return true;
}
示例10: HandleCastSpellOpcode
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
{
uint32 spellId;
uint8 cast_count;
recvPacket >> spellId;
recvPacket >> cast_count;
DEBUG_LOG("WORLD: got cast spell packet, spellId - %u, cast_count: %u data length = %i",
spellId, cast_count, recvPacket.size());
SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellId);
if (!spellInfo)
{
sLog.outError("WORLD: unknown spell id %u", spellId);
return;
}
// not have spell or spell passive and not casted by client
if (!_player->HasSpell (spellId) || IsPassiveSpell(spellId))
{
//cheater? kick? ban?
return;
}
// can't use our own spells when we're in possession of another unit,
if (_player->isPossessing())
return;
// client provided targets
SpellCastTargets targets;
recvPacket >> targets.ReadForCaster(_player);
Unit* target = targets.getUnitTarget();
if (target) // auto-selection buff level base at target level (in spellInfo)
{
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
if (SpellEntry const* actualSpellInfo = sSpellMgr.SelectAuraRankForPlayerLevel(spellInfo, target->getLevel()))
spellInfo = actualSpellInfo;
}
if (spellInfo->AttributesEx2 & SPELL_ATTR2_AUTOREPEAT_FLAG)
{
if (_player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL) && _player->GetCurrentSpell(CURRENT_AUTOREPEAT_SPELL)->m_spellInfo->Id == spellInfo->Id)
return;
}
// When casting a combat spell the unit has to be flagged as initiating combat
// No need to check if spell is self-cast because combat spells can only be cast on self with commands
if (target && !IsNonCombatSpell(spellInfo))
_player->setInitiatingCombat(true);
Spell* spell = new Spell(_player, spellInfo, false);
spell->m_cast_count = cast_count; // set count of casts
spell->prepare(&targets);
}
示例11: Spell_seed_of_corruption_proc
bool Spell_seed_of_corruption_proc(Unit* pCaster, std::list<Unit*> &unitList, SpellCastTargets const& targets, SpellEntry const *pSpell, uint32 effect_index)
{
if (effect_index != 0)
return true;
if (unitList.empty())
return true;
unitList.remove(targets.getUnitTarget());
return true;
}
示例12: Spell_intimidating_shout_5246
bool Spell_intimidating_shout_5246(Unit* pCaster, std::list<Unit*> &unitList, SpellCastTargets const& targets, SpellEntry const *pSpell, uint32 effect_index)
{
if (effect_index == 0)
return true;
if (unitList.empty())
return true;
// remove current target from AOE Fear, AOE Speed aura our target gets stun effect provided by 1st effect
unitList.remove(targets.getUnitTarget());
return true;
}
示例13: ItemUse_item_RaeloraszSpear
bool ItemUse_item_RaeloraszSpear(Player* pPlayer, Item* pItem, const SpellCastTargets &pTargets)
{
if(pTargets.getUnitTarget()->GetEntry() == 26127)
{
// TODO : script de capture du dragon
}
else
{
Spell::SendCastResult(pPlayer, GetSpellStore()->LookupEntry(43157), 1, SPELL_FAILED_BAD_TARGETS);
return false;
}
return true;
}
示例14: HandleCastSpellOpcode
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
{
CHECK_PACKET_SIZE(recvPacket,1+4+1);
uint32 spellId;
uint8 cast_count, unk_flags;
recvPacket >> cast_count;
recvPacket >> spellId;
recvPacket >> unk_flags; // flags (if 0x02 - some additional data are received)
sLog.outDebug("WORLD: got cast spell packet, spellId - %u, cast_count: %u, unk_flags %u, data length = %i",
spellId, cast_count, unk_flags, recvPacket.size());
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
if(!spellInfo)
{
sLog.outError("WORLD: unknown spell id %u", spellId);
return;
}
// not have spell or spell passive and not casted by client
if ( !_player->HasSpell (spellId) || IsPassiveSpell(spellId) )
{
//cheater? kick? ban?
return;
}
// client provided targets
SpellCastTargets targets;
if(!targets.read(&recvPacket,_player))
return;
// auto-selection buff level base at target level (in spellInfo)
if(targets.getUnitTarget())
{
SpellEntry const *actualSpellInfo = spellmgr.SelectAuraRankForPlayerLevel(spellInfo,targets.getUnitTarget()->getLevel());
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
if(actualSpellInfo)
spellInfo = actualSpellInfo;
}
Spell *spell = new Spell(_player, spellInfo, false);
spell->m_cast_count = cast_count; // set count of casts
spell->prepare(&targets);
}
示例15: HandleCastSpellOpcode
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
{
uint32 spellId;
recvPacket >> spellId;
sLog.outDebug("WORLD: got cast spell packet, spellId - %u, data length = %i",
spellId, (uint32)recvPacket.size());
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
if(!spellInfo)
{
sLog.outError("WORLD: unknown spell id %u", spellId);
return;
}
// not have spell or spell passive and not casted by client
if ( !_player->HasSpell (spellId) || IsPassiveSpell(spellId) )
{
//cheater? kick? ban?
return;
}
// client provided targets
SpellCastTargets targets;
recvPacket >> targets.ReadForCaster(_player);
// auto-selection buff level base at target level (in spellInfo)
if(targets.getUnitTarget())
{
SpellEntry const *actualSpellInfo = sSpellMgr.SelectAuraRankForPlayerLevel(spellInfo,targets.getUnitTarget()->getLevel());
// if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message
if(actualSpellInfo)
spellInfo = actualSpellInfo;
}
Spell *spell = new Spell(_player, spellInfo, false);
spell->prepare(&targets);
}