diff --git a/common/ruletypes.h b/common/ruletypes.h index 1b2688f53..fbb6f17bd 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -543,6 +543,16 @@ RULE_BOOL(TaskSystem, KeepOneRecordPerCompletedTask, true) RULE_BOOL(TaskSystem, EnableTaskProximity, true) RULE_CATEGORY_END() +RULE_CATEGORY(Range) +RULE_INT(Range, Say, 135) +RULE_INT(Range, Emote, 135) +RULE_INT(Range, BeginCast, 200) +RULE_INT(Range, Anims, 135) +RULE_INT(Range, DamageMessages, 50) +RULE_INT(Range, SpellMessages, 75) +RULE_INT(Range, SongMessages, 75) +RULE_CATEGORY_END() + #ifdef BOTS RULE_CATEGORY(Bots) RULE_INT(Bots, AAExpansion, 8) // Bots get AAs through this expansion diff --git a/utils/sql/git/optional/rule_values_range_update.sql b/utils/sql/git/optional/rule_values_range_update.sql new file mode 100644 index 000000000..080bf6423 --- /dev/null +++ b/utils/sql/git/optional/rule_values_range_update.sql @@ -0,0 +1,7 @@ +INSERT INTO `rule_values` VALUES (1, 'Range:SongMessages', '75', 'The packet range in which song messages are sent'); +INSERT INTO `rule_values` VALUES (1, 'Range:Emote', '135', 'The packet range in which emote messages are sent'); +INSERT INTO `rule_values` VALUES (1, 'Range:BeginCast', '200', 'The packet range in which begin cast messages are sent'); +INSERT INTO `rule_values` VALUES (1, 'Range:Anims', '135', 'The packet range in which animations are sent'); +INSERT INTO `rule_values` VALUES (1, 'Range:DamageMessages', '50', 'The packet range in which damage messages are sent (non-crit)'); +INSERT INTO `rule_values` VALUES (1, 'Range:SpellMessages', '75', 'The packet range in which spell damage messages are sent'); +INSERT INTO `rule_values` VALUES (1, 'Range:Say', '135', 'The range that is required before /say or hail messages will work to an NPC'); diff --git a/zone/attack.cpp b/zone/attack.cpp index c89f217bd..ee212ba78 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -3309,7 +3309,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const //fade mez if we are mezzed if (IsMezzed() && attacker) { Log.Out(Logs::Detail, Logs::Combat, "Breaking mez due to attack."); - entity_list.MessageClose_StringID(this, true, 100, MT_WornOff, + entity_list.MessageClose_StringID(this, true, RuleI(Range, SpellMessages), MT_WornOff, HAS_BEEN_AWAKENED, GetCleanName(), attacker->GetCleanName()); BuffFadeByEffect(SE_Mez); } @@ -3471,7 +3471,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const if (attacker->CastToClient()->GetFilter(FilterDamageShields) != FilterHide) attacker->Message_StringID(MT_DS,OTHER_HIT_NONMELEE, GetCleanName(), ConvertArray(damage, val1)); } else { - entity_list.MessageClose_StringID(this, true, 100, MT_NonMelee, HIT_NON_MELEE, attacker->GetCleanName(), GetCleanName(), ConvertArray(damage, val1)); + entity_list.MessageClose_StringID(this, true, RuleI(Range, SpellMessages), MT_NonMelee, HIT_NON_MELEE, attacker->GetCleanName(), GetCleanName(), ConvertArray(damage, val1)); } } else { if(damage > 0) { @@ -3505,7 +3505,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const // If this is Damage Shield damage, the correct OP_Damage packets will be sent from Mob::DamageShield, so // we don't send them here. if(!FromDamageShield) { - entity_list.QueueCloseClients(this, outapp, true, 200, skip, true, filter); + entity_list.QueueCloseClients(this, outapp, true, RuleI(Range, SpellMessages), skip, true, filter); //send the damage to ourself if we are a client if(IsClient()) { //I dont think any filters apply to damage affecting us @@ -3522,7 +3522,7 @@ void Mob::CommonDamage(Mob* attacker, int &damage, const uint16 spell_id, const attacker->FilteredMessage_StringID(attacker, MT_DoTDamage, FilterDOT, YOUR_HIT_DOT, GetCleanName(), itoa(damage), spells[spell_id].name); // older clients don't have the below String ID, but it will be filtered - entity_list.FilteredMessageClose_StringID(attacker, true, 200, + entity_list.FilteredMessageClose_StringID(attacker, true, RuleI(Range, SpellMessages), MT_DoTDamage, FilterDOT, OTHER_HIT_DOT, GetCleanName(), itoa(damage), attacker->GetCleanName(), spells[spell_id].name); } @@ -3853,7 +3853,7 @@ void Mob::TrySpellProc(const EQEmu::ItemInstance *inst, const EQEmu::ItemData *w begincast->spell_id = SpellProcs[i].spellID; begincast->cast_time = 0; outapp->priority = 3; - entity_list.QueueCloseClients(this, outapp, false, 200, 0, true); + entity_list.QueueCloseClients(this, outapp, false, RuleI(Range, SpellMessages), 0, true); safe_delete(outapp); ExecWeaponProc(nullptr, SpellProcs[i].spellID, on, SpellProcs[i].level_override); CheckNumHitsRemaining(NumHit::OffensiveSpellProcs, 0, diff --git a/zone/client.cpp b/zone/client.cpp index 0228b12f4..bf455a51f 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -1099,7 +1099,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s CheckLDoNHail(GetTarget()); CheckEmoteHail(GetTarget(), message); - if(DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) <= 200) { + if(DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) <= RuleI(Range, Say)) { NPC *tar = GetTarget()->CastToNPC(); parse->EventNPC(EVENT_SAY, tar->CastToNPC(), this, message, language); @@ -1111,7 +1111,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s } } else { - if (DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) <= 200) { + if (DistanceSquaredNoZ(m_Position, GetTarget()->GetPosition()) <= RuleI(Range, Say)) { parse->EventNPC(EVENT_AGGRO_SAY, GetTarget()->CastToNPC(), this, message, language); } } @@ -1140,7 +1140,7 @@ void Client::ChannelMessageReceived(uint8 chan_num, uint8 language, uint8 lang_s char *Buffer = (char *)es; Buffer += 4; snprintf(Buffer, sizeof(Emote_Struct) - 4, "%s %s", GetName(), message); - entity_list.QueueCloseClients(this, outapp, true, 100, 0, true, FilterSocials); + entity_list.QueueCloseClients(this, outapp, true, RuleI(Range, Emote), 0, true, FilterSocials); safe_delete(outapp); break; } diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index d4404247e..b214c477f 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -4606,9 +4606,9 @@ void Client::Handle_OP_ClientUpdate(const EQApplicationPacket *app) PlayerPositionUpdateServer_Struct* ppu = (PlayerPositionUpdateServer_Struct*)outapp->pBuffer; MakeSpawnUpdate(ppu); if (gmhideme) - entity_list.QueueClientsStatus(this,outapp,true,Admin(),250); + entity_list.QueueClientsStatus(this, outapp, true, Admin(), 250); else - entity_list.QueueCloseClients(this,outapp,true,300,nullptr,false); + entity_list.QueueCloseClients(this, outapp, true, 300, nullptr, false); safe_delete(outapp); } @@ -5488,7 +5488,7 @@ void Client::Handle_OP_Emote(const EQApplicationPacket *app) } else */ - entity_list.QueueCloseClients(this, outapp, true, 100, 0, true, FilterSocials); + entity_list.QueueCloseClients(this, outapp, true, RuleI(Range, Emote), 0, true, FilterSocials); safe_delete(outapp); return; diff --git a/zone/mob.cpp b/zone/mob.cpp index 119f32031..256f9f715 100644 --- a/zone/mob.cpp +++ b/zone/mob.cpp @@ -1537,7 +1537,7 @@ void Mob::DoAnim(const int animnum, int type, bool ackreq, eqFilterType filter) anim->action = animnum; anim->speed = type; } - entity_list.QueueCloseClients(this, outapp, false, 200, 0, ackreq, filter); + entity_list.QueueCloseClients(this, outapp, false, RuleI(Range, Anims), 0, ackreq, filter); safe_delete(outapp); } diff --git a/zone/spells.cpp b/zone/spells.cpp index 0961b3404..deec22b82 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -364,7 +364,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, Message_StringID(MT_SpellFailure, fizzle_msg); entity_list.FilteredMessageClose_StringID( - this, true, 200, MT_SpellFailure, IsClient() ? FilterPCSpells : FilterNPCSpells, + this, true, RuleI(Range, SpellMessages), MT_SpellFailure, IsClient() ? FilterPCSpells : FilterNPCSpells, fizzle_msg == MISS_NOTE ? MISSED_NOTE_OTHER : SPELL_FIZZLE_OTHER, GetName()); TryTriggerOnValueAmount(false, true); @@ -469,7 +469,7 @@ bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, CastingSlot slot, begincast->spell_id = spell_id; begincast->cast_time = orgcasttime; // client calculates reduced time by itself outapp->priority = 3; - entity_list.QueueCloseClients(this, outapp, false, 200, 0, true); //IsClient() ? FILTER_PCSPELLS : FILTER_NPCSPELLS); + entity_list.QueueCloseClients(this, outapp, false, RuleI(Range, BeginCast), 0, true); //IsClient() ? FILTER_PCSPELLS : FILTER_NPCSPELLS); safe_delete(outapp); } @@ -886,7 +886,7 @@ void Mob::InterruptSpell(uint16 message, uint16 color, uint16 spellid) ic->messageid = message_other; ic->spawnid = GetID(); strcpy(ic->message, GetCleanName()); - entity_list.QueueCloseClients(this, outapp, true, 200, 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); + entity_list.QueueCloseClients(this, outapp, true, RuleI(Range, SongMessages), 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); safe_delete(outapp); } @@ -1096,7 +1096,7 @@ void Mob::CastedSpellFinished(uint16 spell_id, uint32 target_id, CastingSlot slo // if we got here, we regained concentration regain_conc = true; Message_StringID(MT_Spells,REGAIN_AND_CONTINUE); - entity_list.MessageClose_StringID(this, true, 200, MT_Spells, OTHER_REGAIN_CAST, this->GetCleanName()); + entity_list.MessageClose_StringID(this, true, RuleI(Range, SpellMessages), MT_Spells, OTHER_REGAIN_CAST, this->GetCleanName()); } } @@ -2609,7 +2609,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { action->buff_unknown = 0; action->level = buffs[buffs_i].casterlevel; action->type = DamageTypeSpell; - entity_list.QueueCloseClients(this, packet, false, 200, 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); + entity_list.QueueCloseClients(this, packet, false, RuleI(Range, SongMessages), 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); action->buff_unknown = 4; @@ -2681,7 +2681,7 @@ void Mob::BardPulse(uint16 spell_id, Mob *caster) { cd->damage = 0; if(!IsEffectInSpell(spell_id, SE_BindAffinity)) { - entity_list.QueueCloseClients(this, message_packet, false, 200, 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); + entity_list.QueueCloseClients(this, message_packet, false, RuleI(Range, SongMessages), 0, true, IsClient() ? FilterPCSpells : FilterNPCSpells); } safe_delete(message_packet); safe_delete(packet); @@ -3484,8 +3484,9 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r spelltar->CastToClient()->QueuePacket(action_packet); if(IsClient()) // send to caster CastToClient()->QueuePacket(action_packet); + // send to people in the area, ignoring caster and target - entity_list.QueueCloseClients(spelltar, action_packet, true, 200, this, true, spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells); + entity_list.QueueCloseClients(spelltar, action_packet, true, RuleI(Range, SpellMessages), this, true, spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells); /* Send the EVENT_CAST_ON event */ if(spelltar->IsNPC()) @@ -3956,7 +3957,7 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob *spelltar, bool reflect, bool use_r cd->damage = 0; if(!IsEffectInSpell(spell_id, SE_BindAffinity)) { - entity_list.QueueCloseClients(spelltar, message_packet, false, 200, 0, true, spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells); + entity_list.QueueCloseClients(spelltar, message_packet, false, RuleI(Range, SpellMessages), 0, true, spelltar->IsClient() ? FilterPCSpells : FilterNPCSpells); } safe_delete(action_packet); safe_delete(message_packet); diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 16130f8e2..30dc4d81f 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -720,7 +720,7 @@ void Client::Gate(uint8 bindnum) { } void NPC::Gate(uint8 bindnum) { - entity_list.MessageClose_StringID(this, true, 200, MT_Spells, GATES, GetCleanName()); + entity_list.MessageClose_StringID(this, true, RuleI(Range, SpellMessages), MT_Spells, GATES, GetCleanName()); Mob::Gate(bindnum); }