Multisend is a replacement for servo. No synchronization is needed, just load and go.
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.
 
 

85 lines
2.4 KiB

#include "MultiSend.h"
uint32_t MultiSend::ThreadEntry(void)
{
while (!this->IsTerminated())
{
if (m_AshitaCore->GetDataManager()->GetParty()->GetMemberActive(0))
{
if (Zoning == 2) Zoning = 0;
}
else if (Zoning == 1)
{
Zoning = 2;
}
if (MMF_Pointer->Follow.Follow)
{
if (((MMF_Global*)MMF_Pointer)->Follow.FollowID == GetCurrentProcessId())
{
if (!Zoning)
{
Following = false;
uint16_t myindex = m_AshitaCore->GetDataManager()->GetParty()->GetMemberTargetIndex(0);
int32_t mPosX = (int32_t)floor(m_AshitaCore->GetDataManager()->GetEntity()->GetLocalX(myindex) * 100);
int32_t mPosZ = (int32_t)floor(m_AshitaCore->GetDataManager()->GetEntity()->GetLocalZ(myindex) * 100);
MMF_Pointer->Follow.PosX = mPosX;
MMF_Pointer->Follow.PosZ = mPosZ;
MMF_Pointer->Follow.Follow = 1;
MMF_Pointer->Follow.Zone = m_AshitaCore->GetDataManager()->GetParty()->GetMemberZone(0);
}
else
{
Following = false;
MMF_Pointer->Follow.Follow = 2;
}
}
else if (MMF_Pointer->Follow.Follow != 3)
{
if (m_AshitaCore->GetDataManager()->GetParty()->GetMemberActive(0))
{
if (MMF_Pointer->Follow.Follow == 2)
{
if (!ZoneExtra)
{
Following = false;
uint16_t myindex = m_AshitaCore->GetDataManager()->GetParty()->GetMemberTargetIndex(0);
float MyX = m_AshitaCore->GetDataManager()->GetEntity()->GetLocalX(myindex);
float MyZ = m_AshitaCore->GetDataManager()->GetEntity()->GetLocalZ(myindex);
PositionX = (float)MMF_Pointer->Follow.PosX / 100.0f;
PositionZ = (float)MMF_Pointer->Follow.PosZ / 100.0f;
float Scale = 1.0f + (8.0f / sqrt(pow(PositionX - MyX, 2) + pow(PositionZ - MyZ, 2)));
PositionX = (PositionX * Scale) + MyX;
PositionZ = (PositionZ * Scale) + MyZ;
ZoneExtra = true;
Following = true;
}
}
else
{
ZoneExtra = false;
PositionX = (float)MMF_Pointer->Follow.PosX / 100.0f;
PositionZ = (float)MMF_Pointer->Follow.PosZ / 100.0f;
Following = true;
}
}
}
else
{
if (Following) StopFollow = true;
Following = false;
}
}
else
{
if (Following) StopFollow = true;
Following = false;
}
while (ReadCommand()) {}
::Sleep(1);
}
return 0;
}