Allows you to send commands to multiple other characters on the local computer from a single character.
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.
 
 

97 lines
2.5 KiB

#ifndef __ASHITA_SERVO_H_INCLUDED__
#define __ASHITA_SERVO_H_INCLUDED__
#if defined (_MSC_VER) && (_MSC_VER >= 1020)
#pragma once
#endif
#include <deque>
#include <atomic>
#include <thread>
#include <mutex>
#include "zmq.hpp"
#include "G:/Code/git.ashita.atom0s.com/Ashita v3/Ashita-src/build/plugins/ADK/Ashita.h"
#include "CommandParser.h"
#include "Chat.hpp"
plugininfo_t* g_PluginInfo = NULL;
#pragma comment(lib,"libzmq.lib")
struct auto_follow
{
unsigned int unknown_ptr;
unsigned int TargetIndex;
unsigned int TargetID;
float DirectionX;
float DirectionY;
float DirectionZ;
float unknown_float; // 1 -- Deals with collision (CXiCollisionActor)
unsigned int unknown_ptr2;
unsigned int FollowIndex;
unsigned int FollowID;
unsigned char CameraMode; // 0 = third-person - 1 = first-person
unsigned char AutoRun;
};
namespace ServoMode {
enum Mode { Standby, Server, Client };
};
class Servo : IPlugin
{
private:
IAshitaCore* m_AshitaCore;
Chat::Log log;
std::string me;
auto_follow* StructPointer;
zmq::context_t zContext;
std::mutex lock;
std::atomic_bool connected;
std::atomic_bool follow;
std::atomic_bool zoning;
std::vector<std::string> groups;
std::thread conn;
std::thread pos;
std::deque<std::string> buffer;
std::atomic<ServoMode::Mode> state;
std::string servAddr;
std::mutex lservAddr;
std::string StringSub(std::string, std::string, std::string);
CommandParser* cmdParse;
void formatCommand(std::string* command);
void SendCommand(std::string command);
void RecvCommand(std::string* command);
void SetState(ServoMode::Mode mode);
void Sync(std::string host);
void WalkTo(float x, float y);
//Threads
void Serv();
void ServPos();
void Client();
void Follow();
public:
Servo() {}
~Servo() {}
plugininfo_t GetPluginInfo(void) override;
bool Initialize(IAshitaCore* ashitaCore, ILogManager* log, uint32_t dwPluginId) override;
void Release(void) override;
bool HandleCommand(const char* pszCommand, int nCommandType) override;
bool Direct3DInitialize(IDirect3DDevice8* lpDevice) override;
void Direct3DRender(void) override;
bool HandleIncomingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) override;
bool HandleOutgoingPacket(uint16_t id, uint32_t size, void* data, void* modified, bool blocked) override;
};
#endif //__ASHITA_SERVO_H_INCLUDED__