mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 22:01:30 +00:00
[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:
parent
63ba5dc3ab
commit
8586cdc47e
@ -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, 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, UseItemCastMessage, false, "Enable to use the \"item begins to glow\" messages when casting from an item.")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Combat)
|
||||
|
||||
@ -2616,7 +2616,7 @@ int64 Merc::GetFocusEffect(focusType type, uint16 spell_id, bool from_buff_tic)
|
||||
realTotal = CalcFocusEffect(type, UsedFocusID, spell_id);
|
||||
|
||||
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.
|
||||
|
||||
@ -180,7 +180,7 @@ void Mob::DoSpecialAttackDamage(Mob *who, EQ::skills::SkillType skill, int32 bas
|
||||
auto fbash = GetFuriousBash(itm->Focus.Effect);
|
||||
hate = hate * (100 + fbash) / 100;
|
||||
if (fbash)
|
||||
MessageString(Chat::Spells, GLOWS_RED, itm->Name);
|
||||
MessageString(Chat::FocusEffect, GLOWS_RED, itm->Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -6497,7 +6497,7 @@ int64 Client::GetFocusEffect(focusType type, uint16 spell_id, Mob *caster, bool
|
||||
default:
|
||||
break;
|
||||
}
|
||||
MessageString(Chat::Spells, string_id, UsedItem->Name);
|
||||
MessageString(Chat::FocusEffect, string_id, UsedItem->Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -302,8 +302,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
||||
casting_spell_id = spell_id;
|
||||
casting_spell_slot = slot;
|
||||
casting_spell_inventory_slot = item_slot;
|
||||
if(casting_spell_timer != 0xFFFFFFFF)
|
||||
{
|
||||
if (casting_spell_timer != 0xFFFFFFFF) {
|
||||
casting_spell_timer = timer;
|
||||
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
|
||||
// and a target wasn't provided, then it's us; unless TGB is on and this
|
||||
// is a TGB compatible spell.
|
||||
if((IsGroupSpell(spell_id) ||
|
||||
spell.target_type == ST_AEClientV1 ||
|
||||
spell.target_type == ST_Self ||
|
||||
spell.target_type == ST_AECaster ||
|
||||
spell.target_type == ST_Ring ||
|
||||
spell.target_type == ST_Beam) && target_id == 0)
|
||||
{
|
||||
if (
|
||||
(
|
||||
IsGroupSpell(spell_id) ||
|
||||
spell.target_type == ST_AEClientV1 ||
|
||||
spell.target_type == ST_Self ||
|
||||
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);
|
||||
target_id = GetID();
|
||||
}
|
||||
@ -377,8 +379,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot,
|
||||
if (cast_time) {
|
||||
cast_time = GetActSpellCasttime(spell_id, cast_time);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
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
|
||||
|
||||
// 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_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...
|
||||
if(IsNPC() && my_curmana == my_maxmana){
|
||||
if (IsNPC() && my_curmana == my_maxmana){
|
||||
mana_cost = 0;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
//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);
|
||||
if(IsClient()) {
|
||||
if (IsClient()) {
|
||||
//clients produce messages... npcs should not for this case
|
||||
MessageString(Chat::Red, INSUFFICIENT_MANA);
|
||||
InterruptSpell();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
InterruptSpell(0, 0, 0); //the 0 args should cause no messages
|
||||
}
|
||||
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
|
||||
spellend_timer.Start(cast_time);
|
||||
|
||||
if (IsAIControlled())
|
||||
{
|
||||
if (IsAIControlled()) {
|
||||
SetRunAnimSpeed(0);
|
||||
pMob = entity_list.GetMob(target_id);
|
||||
if (pMob && this != pMob)
|
||||
if (pMob && this != pMob) {
|
||||
FaceTarget(pMob);
|
||||
}
|
||||
}
|
||||
|
||||
// if we got here we didn't fizzle, and are starting our cast
|
||||
if (oSpellWillFinish)
|
||||
if (oSpellWillFinish) {
|
||||
*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);
|
||||
if (item && item->GetItem())
|
||||
MessageString(Chat::Spells, BEGINS_TO_GLOW, item->GetItem()->Name);
|
||||
if (item && item->GetItem()) {
|
||||
MessageString(Chat::FocusEffect, BEGINS_TO_GLOW, item->GetItem()->Name);
|
||||
}
|
||||
}
|
||||
|
||||
return(true);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user