From dc1430d52e0f60807787282e65129d125a63ed1f Mon Sep 17 00:00:00 2001 From: Emagi Date: Sat, 28 Sep 2024 09:00:42 -0400 Subject: [PATCH] updates - runback now primarily uses nav even with line of sight with destination due to falling off bridges - NPC stop attacking each other - Can't add to encounter when part of spawn group, can't add hate. - WS_EnterCombat omitted for KoS and earlier clients not a packet --- source/WorldServer/Combat.cpp | 5 ++++- source/WorldServer/NPC.cpp | 2 +- source/WorldServer/Spawn.cpp | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/source/WorldServer/Combat.cpp b/source/WorldServer/Combat.cpp index 4ea3f18..aee4c92 100644 --- a/source/WorldServer/Combat.cpp +++ b/source/WorldServer/Combat.cpp @@ -1297,6 +1297,9 @@ void Entity::AddHate(Entity* attacker, sint32 hate) { if(!attacker || GetHP() <= 0 || attacker->GetHP() <= 0) return; + if(IsInSpawnGroup(attacker)) + return; // can't aggro your own members + // If a players pet and protect self is off if (IsPet() && ((NPC*)this)->GetOwner() && ((NPC*)this)->GetOwner()->IsPlayer() && ((((Player*)((NPC*)this)->GetOwner())->GetInfoStruct()->get_pet_behavior() & 2) == 0)) return; @@ -1414,7 +1417,7 @@ void Entity::KillSpawn(Spawn* dead, int8 type, int8 damage_type, int16 kill_blow if(!dead) return; - if (IsPlayer()) { + if (IsPlayer() && GetVersion() > 561) { // old clients do not support WS_EnterCombat, uses activity_status in spawn info Client* client = ((Player*)this)->GetClient(); if(client) { PacketStruct* packet = configReader.getStruct("WS_EnterCombat", client->GetVersion()); diff --git a/source/WorldServer/NPC.cpp b/source/WorldServer/NPC.cpp index 912cd46..c892840 100644 --- a/source/WorldServer/NPC.cpp +++ b/source/WorldServer/NPC.cpp @@ -263,7 +263,7 @@ void NPC::Runback(float distance, bool stopFollowing){ m_runningBack = true; SetSpeed(GetMaxSpeed()*2); - if (CheckLoS(glm::vec3(runback->x, runback->z, runback->y + 1.0f), glm::vec3(GetX(), GetZ(), GetY() + 1.0f))) + if (distance <= 5.0f && CheckLoS(glm::vec3(runback->x, runback->z, runback->y + 1.0f), glm::vec3(GetX(), GetZ(), GetY() + 1.0f))) { FaceTarget(runback->x, runback->z); ClearRunningLocations(); diff --git a/source/WorldServer/Spawn.cpp b/source/WorldServer/Spawn.cpp index afdff3d..bf54dbd 100644 --- a/source/WorldServer/Spawn.cpp +++ b/source/WorldServer/Spawn.cpp @@ -3889,6 +3889,8 @@ void Spawn::CheckEncounterState(Entity* victim, bool test_auto_lock) { Entity* ent = ((Entity*)this); if (victim->GetLockedNoLoot() == ENCOUNTER_STATE_AVAILABLE) { + if(IsInSpawnGroup(victim)) + return; // can't aggro your own members Entity* attacker = nullptr; if (ent->GetOwner())