[Spells] Invisibility updates and rework (#1991)

* updates pre merge

* update

* Update spell_effects.cpp

* Update mob.h

* test

* test

* updates

* updates

* save

* update

* working solid

* animal and undead start

* progress

* updates

* rename

* set invis appearance on bonus

* remove fade buff state check

* update IsViisble check

* optimizing

* don't break bots

* debug remover

* Update ruletypes.h

* perl adds

* Update client_packet.cpp

* update

* done

* remove debugs

* Update client_packet.cpp

* update

* [Spells] Invisibility updates and rework

lua support

* [Spells] Invisibility updates and rework

lua
This commit is contained in:
KayenEQ
2022-02-15 00:18:02 -05:00
committed by GitHub
parent 51c8771bd2
commit b938e6223c
18 changed files with 369 additions and 188 deletions
+21 -20
View File
@@ -682,8 +682,7 @@ void Client::CompleteConnect()
case SE_Invisibility2:
case SE_Invisibility:
{
invisible = true;
SendAppearancePacket(AT_Invis, 1);
SendAppearancePacket(AT_Invis, Invisibility::Invisible);
break;
}
case SE_Levitate:
@@ -707,17 +706,6 @@ void Client::CompleteConnect()
}
break;
}
case SE_InvisVsUndead2:
case SE_InvisVsUndead:
{
invisible_undead = true;
break;
}
case SE_InvisVsAnimals:
{
invisible_animals = true;
break;
}
case SE_AddMeleeProc:
case SE_WeaponProc:
{
@@ -3819,6 +3807,9 @@ void Client::Handle_OP_BoardBoat(const EQApplicationPacket *app)
void Client::Handle_OP_Buff(const EQApplicationPacket *app)
{
/*
Note: if invisibility is on client, this will force it to drop.
*/
if (app->size != sizeof(SpellBuffPacket_Struct))
{
LogError("Size mismatch in OP_Buff. expected [{}] got [{}]", sizeof(SpellBuffPacket_Struct), app->size);
@@ -3833,10 +3824,12 @@ void Client::Handle_OP_Buff(const EQApplicationPacket *app)
//something about IsDetrimentalSpell() crashes this portion of code..
//tbh we shouldn't use it anyway since this is a simple red vs blue buff check and
//isdetrimentalspell() is much more complex
if (spid == 0xFFFF || (IsValidSpell(spid) && (spells[spid].good_effect == 0)))
if (spid == 0xFFFF || (IsValidSpell(spid) && (spells[spid].good_effect == 0))) {
QueuePacket(app);
else
}
else {
BuffFadeBySpellID(spid);
}
return;
}
@@ -3990,12 +3983,20 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
return;
}
if (invisible) {
ZeroInvisibleVars(InvisType::T_INVISIBLE);
BuffFadeByEffect(SE_Invisibility);
BuffFadeByEffect(SE_Invisibility2);
}
// Hack for broken RoF2 which allows casting after a zoned IVU/IVA
if (invisible_undead || invisible_animals) {
BuffFadeByEffect(SE_InvisVsAnimals);
if (invisible_undead) {
BuffFadeByEffect(SE_InvisVsUndead);
BuffFadeByEffect(SE_InvisVsUndead2);
BuffFadeByEffect(SE_Invisibility); // Included per JJ for completeness - client handles this one atm
}
if (invisible_animals) {
BuffFadeByEffect(SE_InvisVsAnimals);
BuffFadeByEffect(SE_ImprovedInvisAnimals);
}
CastSpell_Struct* castspell = (CastSpell_Struct*)app->pBuffer;
@@ -4826,7 +4827,7 @@ void Client::Handle_OP_Consider(const EQApplicationPacket *app)
// this could be done better, but this is only called when you con so w/e
// Shroud of Stealth has a special message
if (improved_hidden && (!tmob->see_improved_hide && (tmob->see_invis || tmob->see_hide)))
if (improved_hidden && (!tmob->see_improved_hide && (tmob->SeeInvisible() || tmob->see_hide)))
MessageString(Chat::NPCQuestSay, SOS_KEEPS_HIDDEN);
// we are trying to hide but they can see us
else if ((invisible || invisible_undead || hidden || invisible_animals) && !IsInvisible(tmob))
@@ -13565,7 +13566,7 @@ void Client::Handle_OP_SpawnAppearance(const EQApplicationPacket *app)
}
return;
}
invisible = false;
ZeroInvisibleVars(InvisType::T_INVISIBLE);
hidden = false;
improved_hidden = false;
entity_list.QueueClients(this, app, true);