mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 19:37:03 +00:00
[7980] Implement item use target requirements store and check (new table item_required_target).
Signed-off-by: VladimirMangos <vladimir@getmangos.com> * Also implement this table reload * Static Spell::SendCastResult function for call not from spell code. Can be also used in scripts where need send explicitly spell cast error to client.
This commit is contained in:
parent
6d8867d0fc
commit
6a1b4e5729
18 changed files with 279 additions and 36 deletions
|
|
@ -119,9 +119,30 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
|||
}
|
||||
|
||||
SpellCastTargets targets;
|
||||
if(!targets.read(&recvPacket, pUser))
|
||||
if (!targets.read(&recvPacket, pUser))
|
||||
return;
|
||||
|
||||
targets.Update(pUser);
|
||||
|
||||
if (!pItem->IsTargetValidForItemUse(targets.getUnitTarget()))
|
||||
{
|
||||
// free greay item aftre use faul
|
||||
pUser->SendEquipError(EQUIP_ERR_NONE, pItem, NULL);
|
||||
|
||||
// send spell error
|
||||
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(spellid))
|
||||
{
|
||||
// for implicit area/coord target spells
|
||||
if (IsPointEffectTarget(Targets(spellInfo->EffectImplicitTargetA[0])) ||
|
||||
IsAreaEffectTarget(Targets(spellInfo->EffectImplicitTargetA[0])))
|
||||
Spell::SendCastResult(_player,spellInfo,cast_count,SPELL_FAILED_NO_VALID_TARGETS);
|
||||
// for explicit target spells
|
||||
else
|
||||
Spell::SendCastResult(_player,spellInfo,cast_count,SPELL_FAILED_BAD_TARGETS);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
//Note: If script stop casting it must send appropriate data to client to prevent stuck item in gray state.
|
||||
if(!Script->ItemUse(pUser,pItem,targets))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue