|
|
@ -45,8 +45,6 @@ static inline std::string trimmed(std::string s) { |
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
std::string Servo::StringSub(std::string instring, std::string subin, std::string subout) |
|
|
|
std::string Servo::StringSub(std::string instring, std::string subin, std::string subout) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (instring.find(subin) != std::string::npos) |
|
|
|
if (instring.find(subin) != std::string::npos) |
|
|
@ -140,7 +138,7 @@ void Servo::SetState(ServoMode::Mode mode) |
|
|
|
void Servo::Sync(std::string host) |
|
|
|
void Servo::Sync(std::string host) |
|
|
|
{ |
|
|
|
{ |
|
|
|
me = m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(0); |
|
|
|
me = m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(0); |
|
|
|
log << Chat::Format::RoyalBlue << "Servo started in client mode, connected to: "; |
|
|
|
log << Chat::Format::RoyalBlue << "[Servo] Servo started in client mode, connected to: "; |
|
|
|
while (!lservAddr.try_lock()) |
|
|
|
while (!lservAddr.try_lock()) |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
|
|
|
if (host != "") |
|
|
|
if (host != "") |
|
|
@ -171,17 +169,16 @@ bool Servo::Initialize(IAshitaCore* ashitaCore, ILogManager* logManager, uint32_ |
|
|
|
if (!::GetModuleInformation(::GetCurrentProcess(), ::GetModuleHandle("FFXiMain.dll"), &mod, sizeof(MODULEINFO))) |
|
|
|
if (!::GetModuleInformation(::GetCurrentProcess(), ::GetModuleHandle("FFXiMain.dll"), &mod, sizeof(MODULEINFO))) |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
// Cast the data and scan for the pattern..
|
|
|
|
auto Pointer = (unsigned char*)Ashita::Memory::FindPattern((uintptr_t)mod.lpBaseOfDll, mod.SizeOfImage, "8BCFE8????????8B0D????????E8????????8BE885??750CB9", 0, 0); |
|
|
|
std::vector<uint8_t> data((uint8_t*)(uintptr_t)mod.lpBaseOfDll, (uint8_t*)(uintptr_t)mod.lpBaseOfDll + mod.SizeOfImage); |
|
|
|
StructPointer = nullptr; |
|
|
|
|
|
|
|
if (Pointer != nullptr) |
|
|
|
unsigned char* Pointer = (unsigned char*)Ashita::Memory::FindPattern(std::ref(data), (uintptr_t)mod.lpBaseOfDll, "8BCDE87F7????F8B0D7F7F7F7FE87F7F7F7F8BF885??750CB9", 0, 0); |
|
|
|
|
|
|
|
StructPointer = NULL; |
|
|
|
|
|
|
|
if (Pointer != NULL) |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
Pointer += 25; |
|
|
|
Pointer += 25; |
|
|
|
StructPointer = (auto_follow*)(*((DWORD*)Pointer)); |
|
|
|
StructPointer = (auto_follow*)(*((DWORD*)Pointer)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
ashitaCore->GetChatManager()->Write("[Servo] Failed to locate required signature for autofollow!"); |
|
|
|
|
|
|
|
|
|
|
|
if (StructPointer) |
|
|
|
if (StructPointer) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -221,7 +218,14 @@ void Servo::Serv() |
|
|
|
hostmask.append("127.0.0.1"); |
|
|
|
hostmask.append("127.0.0.1"); |
|
|
|
lservAddr.unlock(); |
|
|
|
lservAddr.unlock(); |
|
|
|
hostmask.append(":56556"); |
|
|
|
hostmask.append(":56556"); |
|
|
|
|
|
|
|
try { |
|
|
|
publisher.bind(hostmask.c_str()); |
|
|
|
publisher.bind(hostmask.c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (...) { |
|
|
|
|
|
|
|
this->m_AshitaCore->GetChatManager()->Write("[Servo] Failed to bind to socket."); |
|
|
|
|
|
|
|
publisher.close(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
connected = true; |
|
|
|
connected = true; |
|
|
|
|
|
|
|
|
|
|
@ -256,7 +260,15 @@ void Servo::ServPos() |
|
|
|
hostmask.append("127.0.0.1"); |
|
|
|
hostmask.append("127.0.0.1"); |
|
|
|
lservAddr.unlock(); |
|
|
|
lservAddr.unlock(); |
|
|
|
hostmask.append(":56557"); |
|
|
|
hostmask.append(":56557"); |
|
|
|
|
|
|
|
try { |
|
|
|
publisher.bind(hostmask.c_str()); |
|
|
|
publisher.bind(hostmask.c_str()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (...) { |
|
|
|
|
|
|
|
this->m_AshitaCore->GetChatManager()->Write("[Servo] Failed to bind to socket."); |
|
|
|
|
|
|
|
publisher.close(); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!connected) |
|
|
|
if (!connected) |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(100)); |
|
|
@ -418,7 +430,7 @@ bool Servo::HandleCommand(const char* szCommand, int iType) |
|
|
|
cmdParse->GetNextCommand(&arg); |
|
|
|
cmdParse->GetNextCommand(&arg); |
|
|
|
if (arg == "on") |
|
|
|
if (arg == "on") |
|
|
|
{ |
|
|
|
{ |
|
|
|
log << Chat::Format::RoyalBlue << "Servo started in server mode, with a hostmask of: "; |
|
|
|
log << Chat::Format::RoyalBlue << "[Servo] Servo started in server mode, with a hostmask of: "; |
|
|
|
while (!lservAddr.try_lock()) |
|
|
|
while (!lservAddr.try_lock()) |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
|
|
|
std::this_thread::sleep_for(std::chrono::milliseconds(50)); |
|
|
|
if (cmdParse->GetNextCommand(&arg)) |
|
|
|
if (cmdParse->GetNextCommand(&arg)) |
|
|
@ -447,7 +459,7 @@ bool Servo::HandleCommand(const char* szCommand, int iType) |
|
|
|
else if (arg == "off") |
|
|
|
else if (arg == "off") |
|
|
|
{ |
|
|
|
{ |
|
|
|
SetState(ServoMode::Mode::Standby); |
|
|
|
SetState(ServoMode::Mode::Standby); |
|
|
|
log << Chat::Format::RoyalBlue << "Servo set to standy!" << Chat::Control::flush; |
|
|
|
log << Chat::Format::RoyalBlue << "[Servo] Servo set to standy!" << Chat::Control::flush; |
|
|
|
} |
|
|
|
} |
|
|
|
else if (arg == "command" || arg == "send") |
|
|
|
else if (arg == "command" || arg == "send") |
|
|
|
{ |
|
|
|
{ |
|
|
@ -588,10 +600,10 @@ __declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpBuffer) |
|
|
|
g_PluginInfo = lpBuffer; |
|
|
|
g_PluginInfo = lpBuffer; |
|
|
|
|
|
|
|
|
|
|
|
strcpy_s(g_PluginInfo->Name, sizeof(g_PluginInfo->Name), "Servo"); |
|
|
|
strcpy_s(g_PluginInfo->Name, sizeof(g_PluginInfo->Name), "Servo"); |
|
|
|
strcpy_s(g_PluginInfo->Author, sizeof(g_PluginInfo->Author), "bluekirby0"); |
|
|
|
strcpy_s(g_PluginInfo->Author, sizeof(g_PluginInfo->Author), "bluekirby0 & atom0s"); |
|
|
|
|
|
|
|
|
|
|
|
g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION; |
|
|
|
g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION; |
|
|
|
g_PluginInfo->PluginVersion = 3.00f; |
|
|
|
g_PluginInfo->PluginVersion = 3.01f; |
|
|
|
g_PluginInfo->Priority = 0; |
|
|
|
g_PluginInfo->Priority = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|