Validate interaction NPCs for refine and cube
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "stdafx.h"
|
||||
#include "char.h"
|
||||
#include "utils.h"
|
||||
#include "item.h"
|
||||
#include "desc.h"
|
||||
#include "DragonSoul.h"
|
||||
@@ -150,5 +151,41 @@ bool CHARACTER::DragonSoul_RefineWindow_Close()
|
||||
|
||||
bool CHARACTER::DragonSoul_RefineWindow_CanRefine()
|
||||
{
|
||||
return NULL != m_pointsInstant.m_pDragonSoulRefineWindowOpener;
|
||||
}
|
||||
if (NULL == m_pointsInstant.m_pDragonSoulRefineWindowOpener)
|
||||
return false;
|
||||
|
||||
LPENTITY pOpener = m_pointsInstant.m_pDragonSoulRefineWindowOpener;
|
||||
if (!pOpener->IsType(ENTITY_CHARACTER))
|
||||
{
|
||||
RecordAntiCheatViolation("DRAGON_SOUL_REFINE", 6, "state=invalid_opener", true);
|
||||
m_pointsInstant.m_pDragonSoulRefineWindowOpener = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
LPCHARACTER npc = (LPCHARACTER)pOpener;
|
||||
if (!npc->IsNPC() || npc == this || npc->GetMapIndex() != GetMapIndex())
|
||||
{
|
||||
char szDetail[160];
|
||||
snprintf(szDetail,
|
||||
sizeof(szDetail),
|
||||
"npc=%u map=%ld npc_map=%ld",
|
||||
npc->GetVID(),
|
||||
static_cast<long>(GetMapIndex()),
|
||||
static_cast<long>(npc->GetMapIndex()));
|
||||
RecordAntiCheatViolation("DRAGON_SOUL_REFINE", 8, szDetail, true);
|
||||
m_pointsInstant.m_pDragonSoulRefineWindowOpener = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
const int iDistance = DISTANCE_APPROX(GetX() - npc->GetX(), GetY() - npc->GetY());
|
||||
if (iDistance > 2000)
|
||||
{
|
||||
char szDetail[160];
|
||||
snprintf(szDetail, sizeof(szDetail), "npc=%u distance=%d max=%d", npc->GetVID(), iDistance, 2000);
|
||||
RecordAntiCheatViolation("DRAGON_SOUL_REFINE", iDistance > 2800 ? 12 : 4, szDetail, iDistance > 2800);
|
||||
m_pointsInstant.m_pDragonSoulRefineWindowOpener = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user