mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 23:20:25 +00:00
[Feature] Add Water Line of Sight Checks (#3408)
* [Feature] Add Water Line of Sight Checks This adds rules to enable or disable checks for spells and autofire to prevent casting or autofire from landing if the player or bot do not match their targets plane in regards to water. Currently players and bots can cast or autofire if they are not in the water but their target is and vice versa, this should not be possible. RuleB(Combat, WaterMatchRequiredForAutoFireLoS) set to True (default) checks that both parties are in or out of the water for AutoFire to work. RuleB(Spells, WaterMatchRequiredForLoS) set to True (default) checks that both parties are in or out of the water for spells to land. * Cleanup. * Cleanup. * Cleanup. --------- Co-authored-by: Kinglykrab <kinglykrab@gmail.com>
This commit is contained in:
+18
-2
@@ -51,6 +51,7 @@
|
||||
#include "zone.h"
|
||||
#include "zonedb.h"
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "water_map.h"
|
||||
|
||||
extern QueryServ* QServ;
|
||||
extern Zone* zone;
|
||||
@@ -336,7 +337,7 @@ bool Client::Process() {
|
||||
if (ranged_timer.Check(false)) {
|
||||
if (GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient()) && IsAttackAllowed(GetTarget())) {
|
||||
if (GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())) {
|
||||
if (CheckLosFN(GetTarget())) {
|
||||
if (CheckLosFN(GetTarget()) && CheckWaterAutoFireLoS(GetTarget())) {
|
||||
//client has built in los check, but auto fire does not.. done last.
|
||||
RangedAttack(GetTarget());
|
||||
if (CheckDoubleRangedAttack())
|
||||
@@ -356,7 +357,7 @@ bool Client::Process() {
|
||||
if (ranged_timer.Check(false)) {
|
||||
if (GetTarget() && (GetTarget()->IsNPC() || GetTarget()->IsClient()) && IsAttackAllowed(GetTarget())) {
|
||||
if (GetTarget()->InFrontMob(this, GetTarget()->GetX(), GetTarget()->GetY())) {
|
||||
if (CheckLosFN(GetTarget())) {
|
||||
if (CheckLosFN(GetTarget()) && CheckWaterAutoFireLoS(GetTarget())) {
|
||||
//client has built in los check, but auto fire does not.. done last.
|
||||
ThrowingAttack(GetTarget());
|
||||
}
|
||||
@@ -2401,3 +2402,18 @@ void Client::SendGuildLFGuildStatus()
|
||||
worldserver.SendPacket(pack);
|
||||
safe_delete(pack);
|
||||
}
|
||||
|
||||
bool Client::CheckWaterAutoFireLoS(Mob* m)
|
||||
{
|
||||
if (
|
||||
!RuleB(Combat, WaterMatchRequiredForAutoFireLoS) ||
|
||||
!zone->watermap
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (
|
||||
zone->watermap->InLiquid(GetPosition()) &&
|
||||
zone->watermap->InLiquid(m->GetPosition())
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user