mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 23:20:25 +00:00
[Messages] Add GM Status and Invulnerability Messages (#4266)
* [Messages] Add GM Status and Invulnerability Messages * Update zoning.cpp * Finalize. * Update corpse.cpp * Update message --------- Co-authored-by: Akkadius <akkadius1@gmail.com>
This commit is contained in:
+76
-16
@@ -682,16 +682,34 @@ bool Mob::DoCastingChecksZoneRestrictions(bool check_on_casting, int32 spell_id)
|
||||
If the spell is a initiated from SpellFinished, then check at start of SpellFinished.
|
||||
*/
|
||||
|
||||
bool ignore_if_npc_or_gm = false;
|
||||
if (!IsClient() || (IsClient() && CastToClient()->GetGM())) {
|
||||
ignore_if_npc_or_gm = true;
|
||||
bool bypass_casting_restrictions = false;
|
||||
|
||||
if (!IsClient()) {
|
||||
bypass_casting_restrictions = true;
|
||||
}
|
||||
|
||||
if (IsClient() && CastToClient()->GetGM()) {
|
||||
bypass_casting_restrictions = true;
|
||||
Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Your GM Flag allows you to bypass zone casting restrictions and cast {} in this zone.",
|
||||
Saylink::Silent(
|
||||
fmt::format(
|
||||
"#castspell {}",
|
||||
spell_id
|
||||
),
|
||||
GetSpellName(spell_id)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
Zone ares that prevent blocked spells from being cast.
|
||||
If on cast iniated then check any mob casting, if on spellfinished only check if is from client.
|
||||
*/
|
||||
if ((check_on_casting && !ignore_if_npc_or_gm) || (!check_on_casting && IsClient())) {
|
||||
if ((check_on_casting && !bypass_casting_restrictions) || (!check_on_casting && IsClient())) {
|
||||
if (zone->IsSpellBlocked(spell_id, glm::vec3(GetPosition()))) {
|
||||
if (IsClient()) {
|
||||
if (!CastToClient()->GetGM()) {
|
||||
@@ -707,6 +725,19 @@ bool Mob::DoCastingChecksZoneRestrictions(bool check_on_casting, int32 spell_id)
|
||||
LogSpells("Spell casting canceled [{}] : can not cast in this zone location blocked spell.", spell_id);
|
||||
}
|
||||
else {
|
||||
Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Your GM Flag allows you to bypass zone blocked spells and cast {} in this zone.",
|
||||
Saylink::Silent(
|
||||
fmt::format(
|
||||
"#castspell {}",
|
||||
spell_id
|
||||
),
|
||||
GetSpellName(spell_id)
|
||||
)
|
||||
).c_str()
|
||||
);
|
||||
LogSpells("GM Cast Blocked Spell: [{}] (ID [{}])", GetSpellName(spell_id), spell_id);
|
||||
}
|
||||
}
|
||||
@@ -716,7 +747,7 @@ bool Mob::DoCastingChecksZoneRestrictions(bool check_on_casting, int32 spell_id)
|
||||
/*
|
||||
Zones where you can not use levitate spells.
|
||||
*/
|
||||
if (!ignore_if_npc_or_gm && !zone->CanLevitate() && IsEffectInSpell(spell_id, SE_Levitate)) { //check on spellfinished.
|
||||
if (!bypass_casting_restrictions && !zone->CanLevitate() && IsEffectInSpell(spell_id, SE_Levitate)) { //check on spellfinished.
|
||||
Message(Chat::Red, "You have entered an area where levitation effects do not function.");
|
||||
LogSpells("Spell casting canceled [{}] : can not cast levitation in this zone.", spell_id);
|
||||
return false;
|
||||
@@ -745,11 +776,15 @@ bool Mob::DoCastingChecksZoneRestrictions(bool check_on_casting, int32 spell_id)
|
||||
/*
|
||||
Zones where you can not cast out door only spells. This is only checked when casting is completed.
|
||||
*/
|
||||
if (!ignore_if_npc_or_gm && spells[spell_id].zone_type == 1 && !zone->CanCastOutdoor()) {
|
||||
if (IsClient() && !CastToClient()->GetGM()) {
|
||||
MessageString(Chat::Red, CAST_OUTDOORS);
|
||||
LogSpells("Spell casting canceled [{}] : can not cast outdoors.", spell_id);
|
||||
return false;
|
||||
if (!bypass_casting_restrictions && spells[spell_id].zone_type == 1 && !zone->CanCastOutdoor()) {
|
||||
if (IsClient()) {
|
||||
if (!CastToClient()->GetGM()) {
|
||||
MessageString(Chat::Red, CAST_OUTDOORS);
|
||||
LogSpells("Spell casting canceled [{}] : can not cast outdoors.", spell_id);
|
||||
return false;
|
||||
} else {
|
||||
Message(Chat::White, "Your GM Flag allows you to cast outdoor spells when indoors.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1066,6 +1101,7 @@ bool Client::CheckFizzle(uint16 spell_id)
|
||||
{
|
||||
// GMs don't fizzle
|
||||
if (GetGM()) {
|
||||
Message(Chat::White, "Your GM Flag prevents you from fizzling.");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1648,9 +1684,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
|
||||
|
||||
if(!HasInstrument) { // if the instrument is missing, log it and interrupt the song
|
||||
LogSpells("Song [{}]: Canceled. Missing required instrument [{}]", spell_id, component);
|
||||
if(c->GetGM())
|
||||
c->Message(Chat::White, "Your GM status allows you to finish casting even though you're missing a required instrument.");
|
||||
else {
|
||||
if (c->GetGM()) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
"Your GM Flag allows you to finish casting even though you're missing a required instrument."
|
||||
);
|
||||
} else {
|
||||
InterruptSpell();
|
||||
return;
|
||||
}
|
||||
@@ -1686,9 +1725,12 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo
|
||||
} // end reagent loop
|
||||
|
||||
if (missingreags) {
|
||||
if(c->GetGM())
|
||||
c->Message(Chat::White, "Your GM status allows you to finish casting even though you're missing required components.");
|
||||
else {
|
||||
if (c->GetGM()) {
|
||||
c->Message(
|
||||
Chat::White,
|
||||
"Your GM Flag allows you to finish casting even though you're missing required components."
|
||||
);
|
||||
} else {
|
||||
InterruptSpell();
|
||||
return;
|
||||
}
|
||||
@@ -4050,6 +4092,24 @@ bool Mob::SpellOnTarget(
|
||||
(spelltar != this && spelltar->DivineAura()) ||
|
||||
(spelltar == this && spelltar->DivineAura() && !IsCastNotStandingSpell(spell_id))
|
||||
) {
|
||||
if (IsClient()) {
|
||||
Message(
|
||||
Chat::White,
|
||||
fmt::format(
|
||||
"Your spell {} has failed to land on {} because {} are invulnerable.",
|
||||
Saylink::Silent(
|
||||
fmt::format(
|
||||
"#castspell {}",
|
||||
spell_id
|
||||
),
|
||||
spells[spell_id].name
|
||||
),
|
||||
GetTargetDescription(spelltar),
|
||||
spelltar == this ? "you" : "they"
|
||||
).c_str()
|
||||
);
|
||||
}
|
||||
|
||||
LogSpells("Casting spell [{}] on [{}] aborted: they are invulnerable", spell_id, spelltar->GetName());
|
||||
safe_delete(action_packet);
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user