[Messages] Convert messages from Spells to FocusEffect where necessary. (#2243)

* [Messages] Convert messages from Spells to FocusEffect where necessary.
https://github.com/EQEmu/Server/issues/837 from 2019 notes a couple places that should use Focus Effect chat type instead of Spells chat type.

* Add rule for item cast messages.
This commit is contained in:
Kinglykrab 2022-06-08 19:09:33 -04:00 committed by GitHub
parent 63ba5dc3ab
commit 8586cdc47e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 29 deletions

View File

@ -416,6 +416,7 @@ RULE_BOOL(Spells, FixBeaconHeading, false, "Beacon spells use casters heading to
RULE_BOOL(Spells, UseSpellImpliedTargeting, false, "Replicates EQ2-style targeting behavior for spells. Spells will 'pass through' inappropriate targets to target's target if it is appropriate.") RULE_BOOL(Spells, UseSpellImpliedTargeting, false, "Replicates EQ2-style targeting behavior for spells. Spells will 'pass through' inappropriate targets to target's target if it is appropriate.")
RULE_BOOL(Spells, BuffsFadeOnDeath, true, "Disable to keep buffs from fading on death") RULE_BOOL(Spells, BuffsFadeOnDeath, true, "Disable to keep buffs from fading on death")
RULE_BOOL(Spells, IllusionsAlwaysPersist, false, "Allows Illusions to persist beyond death and zoning always.") RULE_BOOL(Spells, IllusionsAlwaysPersist, false, "Allows Illusions to persist beyond death and zoning always.")
RULE_BOOL(Spells, UseItemCastMessage, false, "Enable to use the \"item begins to glow\" messages when casting from an item.")
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY(Combat) RULE_CATEGORY(Combat)

View File

@ -2616,7 +2616,7 @@ int64 Merc::GetFocusEffect(focusType type, uint16 spell_id, bool from_buff_tic)
realTotal = CalcFocusEffect(type, UsedFocusID, spell_id); realTotal = CalcFocusEffect(type, UsedFocusID, spell_id);
if (realTotal != 0 && UsedItem) if (realTotal != 0 && UsedItem)
MessageString(Chat::Spells, BEGINS_TO_GLOW, UsedItem->Name); MessageString(Chat::FocusEffect, BEGINS_TO_GLOW, UsedItem->Name);
} }
//Check if spell focus effect exists for the client. //Check if spell focus effect exists for the client.

View File

@ -180,7 +180,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQ::skills::SkillType skill, int32 bas
auto fbash = GetFuriousBash(itm->Focus.Effect); auto fbash = GetFuriousBash(itm->Focus.Effect);
hate = hate * (100 + fbash) / 100; hate = hate * (100 + fbash) / 100;
if (fbash) if (fbash)
MessageString(Chat::Spells, GLOWS_RED, itm->Name); MessageString(Chat::FocusEffect, GLOWS_RED, itm->Name);
} }
} }
} }

View File

@ -6497,7 +6497,7 @@ int64 Client::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool
default: default:
break; break;
} }
MessageString(Chat::Spells, string_id, UsedItem->Name); MessageString(Chat::FocusEffect, string_id, UsedItem->Name);
} }
} }

View File

@ -302,8 +302,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
casting_spell_id = spell_id; casting_spell_id = spell_id;
casting_spell_slot = slot; casting_spell_slot = slot;
casting_spell_inventory_slot = item_slot; casting_spell_inventory_slot = item_slot;
if(casting_spell_timer != 0xFFFFFFFF) if (casting_spell_timer != 0xFFFFFFFF) {
{
casting_spell_timer = timer; casting_spell_timer = timer;
casting_spell_timer_duration = timer_duration; casting_spell_timer_duration = timer_duration;
} }
@ -352,13 +351,16 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
// if this spell doesn't require a target, or if it's an optional target // if this spell doesn't require a target, or if it's an optional target
// and a target wasn't provided, then it's us; unless TGB is on and this // and a target wasn't provided, then it's us; unless TGB is on and this
// is a TGB compatible spell. // is a TGB compatible spell.
if((IsGroupSpell(spell_id) || if (
spell.target_type == ST_AEClientV1 || (
spell.target_type == ST_Self || IsGroupSpell(spell_id) ||
spell.target_type == ST_AECaster || spell.target_type == ST_AEClientV1 ||
spell.target_type == ST_Ring || spell.target_type == ST_Self ||
spell.target_type == ST_Beam) && target_id == 0) spell.target_type == ST_AECaster ||
{ spell.target_type == ST_Ring ||
spell.target_type == ST_Beam
) && target_id == 0
) {
LogSpells("Spell [{}] auto-targeted the caster. Group? [{}], target type [{}]", spell_id, IsGroupSpell(spell_id), spell.target_type); LogSpells("Spell [{}] auto-targeted the caster. Group? [{}], target type [{}]", spell_id, IsGroupSpell(spell_id), spell.target_type);
target_id = GetID(); target_id = GetID();
} }
@ -377,8 +379,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
if (cast_time) { if (cast_time) {
cast_time = GetActSpellCasttime(spell_id, cast_time); cast_time = GetActSpellCasttime(spell_id, cast_time);
} }
} } else {
else {
orgcasttime = cast_time; orgcasttime = cast_time;
} }
@ -408,23 +409,21 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
// If you're at full mana, let it cast even if you dont have enough mana // If you're at full mana, let it cast even if you dont have enough mana
// we calculated this above, now enforce it // we calculated this above, now enforce it
if(mana_cost > 0 && slot != CastingSlot::Item) { if (mana_cost > 0 && slot != CastingSlot::Item) {
int my_curmana = GetMana(); int my_curmana = GetMana();
int my_maxmana = GetMaxMana(); int my_maxmana = GetMaxMana();
if(my_curmana < mana_cost) {// not enough mana if (my_curmana < mana_cost) {// not enough mana
//this is a special case for NPCs with no mana... //this is a special case for NPCs with no mana...
if(IsNPC() && my_curmana == my_maxmana){ if (IsNPC() && my_curmana == my_maxmana){
mana_cost = 0; mana_cost = 0;
} } else {
else {
//The client will prevent spell casting if insufficient mana, this is only for serverside enforcement. //The client will prevent spell casting if insufficient mana, this is only for serverside enforcement.
LogSpells("Spell Error not enough mana spell=[{}] mymana=[{}] cost=[{}]\n", spell_id, my_curmana, mana_cost); LogSpells("Spell Error not enough mana spell=[{}] mymana=[{}] cost=[{}]\n", spell_id, my_curmana, mana_cost);
if(IsClient()) { if (IsClient()) {
//clients produce messages... npcs should not for this case //clients produce messages... npcs should not for this case
MessageString(Chat::Red, INSUFFICIENT_MANA); MessageString(Chat::Red, INSUFFICIENT_MANA);
InterruptSpell(); InterruptSpell();
} } else {
else {
InterruptSpell(0, 0, 0); //the 0 args should cause no messages InterruptSpell(0, 0, 0); //the 0 args should cause no messages
} }
ZeroCastingVars(); ZeroCastingVars();
@ -463,22 +462,24 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
// ok we know it has a cast time so we can start the timer now // ok we know it has a cast time so we can start the timer now
spellend_timer.Start(cast_time); spellend_timer.Start(cast_time);
if (IsAIControlled()) if (IsAIControlled()) {
{
SetRunAnimSpeed(0); SetRunAnimSpeed(0);
pMob = entity_list.GetMob(target_id); pMob = entity_list.GetMob(target_id);
if (pMob && this != pMob) if (pMob && this != pMob) {
FaceTarget(pMob); FaceTarget(pMob);
}
} }
// if we got here we didn't fizzle, and are starting our cast // if we got here we didn't fizzle, and are starting our cast
if (oSpellWillFinish) if (oSpellWillFinish) {
*oSpellWillFinish = Timer::GetCurrentTime() + cast_time + 100; *oSpellWillFinish = Timer::GetCurrentTime() + cast_time + 100;
}
if (IsClient() && slot == CastingSlot::Item && item_slot != 0xFFFFFFFF) { if (RuleB(Spells, UseItemCastMessage) && IsClient() && slot == CastingSlot::Item && item_slot != 0xFFFFFFFF) {
auto item = CastToClient()->GetInv().GetItem(item_slot); auto item = CastToClient()->GetInv().GetItem(item_slot);
if (item && item->GetItem()) if (item && item->GetItem()) {
MessageString(Chat::Spells, BEGINS_TO_GLOW, item->GetItem()->Name); MessageString(Chat::FocusEffect, BEGINS_TO_GLOW, item->GetItem()->Name);
}
} }
return(true); return(true);