mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-02-20 18:10:02 +01:00
fix trinket (#1429)
This commit is contained in:
parent
86390f90fd
commit
51ed9c4649
@ -332,7 +332,25 @@ bool UseTrinketAction::UseTrinket(Item* item)
|
|||||||
if (item->GetTemplate()->Spells[i].SpellId > 0 && item->GetTemplate()->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
|
if (item->GetTemplate()->Spells[i].SpellId > 0 && item->GetTemplate()->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
|
||||||
{
|
{
|
||||||
spellId = item->GetTemplate()->Spells[i].SpellId;
|
spellId = item->GetTemplate()->Spells[i].SpellId;
|
||||||
uint32 spellProcFlag = sSpellMgr->GetSpellInfo(spellId)->ProcFlags;
|
const SpellInfo* spellInfo = sSpellMgr->GetSpellInfo(spellId);
|
||||||
|
|
||||||
|
if (!spellInfo || !spellInfo->IsPositive())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bool applyAura = false;
|
||||||
|
for (int i = 0; i < MAX_SPELL_EFFECTS; i++)
|
||||||
|
{
|
||||||
|
const SpellEffectInfo& effectInfo = spellInfo->Effects[i];
|
||||||
|
if (effectInfo.Effect == SPELL_EFFECT_APPLY_AURA) {
|
||||||
|
applyAura = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!applyAura)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
uint32 spellProcFlag = spellInfo->ProcFlags;
|
||||||
|
|
||||||
// Handle items with procflag "if you kill a target that grants honor or experience"
|
// Handle items with procflag "if you kill a target that grants honor or experience"
|
||||||
// Bots will "learn" the trinket proc, so CanCastSpell() will be true
|
// Bots will "learn" the trinket proc, so CanCastSpell() will be true
|
||||||
@ -353,17 +371,8 @@ bool UseTrinketAction::UseTrinket(Item* item)
|
|||||||
WorldPacket packet(CMSG_USE_ITEM);
|
WorldPacket packet(CMSG_USE_ITEM);
|
||||||
packet << bagIndex << slot << cast_count << spellId << item_guid << glyphIndex << castFlags;
|
packet << bagIndex << slot << cast_count << spellId << item_guid << glyphIndex << castFlags;
|
||||||
|
|
||||||
Unit* target = AI_VALUE(Unit*, "current target");
|
|
||||||
if (target)
|
|
||||||
{
|
|
||||||
targetFlag = TARGET_FLAG_UNIT;
|
|
||||||
packet << targetFlag << target->GetGUID().WriteAsPacked();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
targetFlag = TARGET_FLAG_NONE;
|
targetFlag = TARGET_FLAG_NONE;
|
||||||
packet << targetFlag << bot->GetPackGUID();
|
packet << targetFlag << bot->GetPackGUID();
|
||||||
}
|
|
||||||
bot->GetSession()->HandleUseItemOpcode(packet);
|
bot->GetSession()->HandleUseItemOpcode(packet);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user