From f428a8a56a146ef2e888e8395cce84de335cb8b4 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sat, 23 Jul 2016 18:07:56 -0400 Subject: [PATCH] Add a CastWhileInvis check and fix some issues --- common/spdat.cpp | 10 ++++++++++ common/spdat.h | 1 + zone/aa.cpp | 3 ++- zone/client_packet.cpp | 6 ++++-- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/common/spdat.cpp b/common/spdat.cpp index 695b11dab..2b6630dfa 100644 --- a/common/spdat.cpp +++ b/common/spdat.cpp @@ -1111,6 +1111,16 @@ bool IsStackableDot(uint16 spell_id) return IsEffectInSpell(spell_id, SE_CurrentHP) || IsEffectInSpell(spell_id, SE_GravityEffect); } +bool IsCastWhileInvis(uint16 spell_id) +{ + if (!IsValidSpell(spell_id)) + return false; + const auto &spell = spells[spell_id]; + if (spell.sneak) + return true; + return false; +} + uint32 GetNimbusEffect(uint16 spell_id) { if (IsValidSpell(spell_id)) diff --git a/common/spdat.h b/common/spdat.h index ae31f6817..e236d8fbe 100644 --- a/common/spdat.h +++ b/common/spdat.h @@ -903,6 +903,7 @@ uint32 GetPartialMeleeRuneAmount(uint32 spell_id); uint32 GetPartialMagicRuneAmount(uint32 spell_id); bool NoDetrimentalSpellAggro(uint16 spell_id); bool IsStackableDot(uint16 spell_id); +bool IsCastWhileInvis(uint16 spell_id); int CalcPetHp(int levelb, int classb, int STA = 75); const char *GetRandPetName(); diff --git a/zone/aa.cpp b/zone/aa.cpp index 2407286fa..d18936956 100644 --- a/zone/aa.cpp +++ b/zone/aa.cpp @@ -1179,7 +1179,8 @@ void Client::ActivateAlternateAdvancementAbility(int rank_id, int target_id) { cooldown = 0; } - CommonBreakInvisible(); + if (!IsCastWhileInvis(rank->spell)) + CommonBreakInvisible(); // Bards can cast instant cast AAs while they are casting another song if(spells[rank->spell].cast_time == 0 && GetClass() == BARD && IsBardSong(casting_spell_id)) { if(!SpellFinished(rank->spell, entity_list.GetMob(target_id), ALTERNATE_ABILITY_SPELL_SLOT, spells[rank->spell].mana, -1, spells[rank->spell].ResistDiff, false)) { diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 67d9d600b..4bf5b0968 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -8550,7 +8550,8 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (i == 0) { - CommonBreakInvisible(); // client can't do this for us :( + if (!IsCastWhileInvis(item->Click.Effect)) + CommonBreakInvisible(); // client can't do this for us :( CastSpell(item->Click.Effect, target_id, USE_ITEM_SPELL_SLOT, item->CastTime, 0, 0, slot_id); } } @@ -8578,7 +8579,8 @@ void Client::Handle_OP_ItemVerifyRequest(const EQApplicationPacket *app) } if (i == 0) { - CommonBreakInvisible(); // client can't do this for us :( + if (!IsCastWhileInvis(augitem->Click.Effect)) + CommonBreakInvisible(); // client can't do this for us :( CastSpell(augitem->Click.Effect, target_id, USE_ITEM_SPELL_SLOT, augitem->CastTime, 0, 0, slot_id); } }