You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
84 lines
2.2 KiB
84 lines
2.2 KiB
#include "MultiSend.h" |
|
|
|
bool MultiSend::Direct3DInitialize(IDirect3DDevice8* lpDevice) |
|
{ |
|
this->m_Direct3DDevice = lpDevice; |
|
return true; |
|
} |
|
|
|
/** |
|
* @brief Direct3D prerender call to allow this plugin to prepare for rendering. |
|
* |
|
* @note This will only be called if you returned true in Direct3DInitialize! |
|
*/ |
|
void MultiSend::Direct3DPreRender(void) |
|
{ |
|
if (c_follow) |
|
{ |
|
if (p_MMF->Follow.target_process_id == ::GetCurrentProcessId()) return; |
|
|
|
if (p_MMF->Follow.target_process_id == 0) |
|
{ |
|
if (s_last_run_state) |
|
{ |
|
p_Follow->Autorun = 0; |
|
s_last_run_state = false; |
|
} |
|
} |
|
else if (p_MMF->Follow.zone == m_AshitaCore->GetDataManager()->GetParty()->GetMemberZone(0)) |
|
{ |
|
uint16_t myindex = m_AshitaCore->GetDataManager()->GetParty()->GetMemberTargetIndex(0); |
|
float my_pos_x = m_AshitaCore->GetDataManager()->GetEntity()->GetLocalX(myindex); |
|
float my_pos_z = m_AshitaCore->GetDataManager()->GetEntity()->GetLocalZ(myindex); |
|
s_vector_x = p_MMF->Follow.position_x - my_pos_x; |
|
s_vector_z = p_MMF->Follow.position_z - my_pos_z; |
|
double distance = sqrt(pow(s_vector_x, 2) + pow(s_vector_z, 2)); |
|
|
|
if ((distance > 0.4f) && (distance < c_maxdist)) |
|
{ |
|
p_Follow->FollowID = 0; |
|
p_Follow->FollowIndex = 0; |
|
p_Follow->DirX = s_vector_x; |
|
p_Follow->DirY = 0; |
|
p_Follow->DirZ = s_vector_z; |
|
p_Follow->Autorun = 1; |
|
s_last_run_state = true; |
|
} |
|
else if (s_last_run_state) |
|
{ |
|
p_Follow->Autorun = 0; |
|
s_last_run_state = false; |
|
} |
|
} |
|
else if (p_MMF->Follow.zone == 0) |
|
{ |
|
if ((c_attemptzone) |
|
&& (p_MMF->Follow.lastzone == m_AshitaCore->GetDataManager()->GetParty()->GetMemberZone(0)) |
|
&& (p_MMF->Follow.idle_count < 5000)) |
|
{ |
|
p_Follow->FollowID = 0; |
|
p_Follow->FollowIndex = 0; |
|
p_Follow->DirX = s_vector_x; |
|
p_Follow->DirY = 0; |
|
p_Follow->DirZ = s_vector_z; |
|
p_Follow->Autorun = 1; |
|
s_last_run_state = true; |
|
} |
|
else if (s_last_run_state) |
|
{ |
|
p_Follow->Autorun = 0; |
|
s_last_run_state = false; |
|
} |
|
} |
|
else if (s_last_run_state) |
|
{ |
|
p_Follow->Autorun = 0; |
|
s_last_run_state = false; |
|
} |
|
} |
|
else if (s_last_run_state) |
|
{ |
|
p_Follow->Autorun = 0; |
|
s_last_run_state = false; |
|
} |
|
} |