Browse Source

1.02 - Now supports [p0] and similar as character name in /ms sendto

pull/1/head
Lolwutt 7 years ago
parent
commit
921802f443
  1. BIN
      release/plugins/MultiSend.dll
  2. 6
      src/MultiSend/Commands.cpp
  3. 2
      src/MultiSend/Main.cpp
  4. 1
      src/MultiSend/MultiSend.h
  5. 23
      src/MultiSend/Substitute.cpp

BIN
release/plugins/MultiSend.dll

Binary file not shown.

6
src/MultiSend/Commands.cpp

@ -32,6 +32,8 @@ bool MultiSend::HandleCommand(const char* command, int32_t type)
com++; com++;
com += GetArg(com, &arg); com += GetArg(com, &arg);
arg = SubValues(arg);
Claim(&(MMF_Pointer->Name.ProcessID), 0); Claim(&(MMF_Pointer->Name.ProcessID), 0);
for (int x = 0; x < 100; x++) for (int x = 0; x < 100; x++)
{ {
@ -174,13 +176,13 @@ bool MultiSend::HandleCommand(const char* command, int32_t type)
if (_stricmp(arg.c_str(), "on") == 0) if (_stricmp(arg.c_str(), "on") == 0)
{ {
IgnoreSelf = true; _Debug = true;
m_AshitaCore->GetChatManager()->Write("MultiSend: Debug prints enabled."); m_AshitaCore->GetChatManager()->Write("MultiSend: Debug prints enabled.");
} }
else if (_stricmp(arg.c_str(), "off") == 0) else if (_stricmp(arg.c_str(), "off") == 0)
{ {
IgnoreSelf = false; _Debug = false;
m_AshitaCore->GetChatManager()->Write("MultiSend: Debug prints disabled."); m_AshitaCore->GetChatManager()->Write("MultiSend: Debug prints disabled.");
} }

2
src/MultiSend/Main.cpp

@ -116,7 +116,7 @@ __declspec(dllexport) void __stdcall CreatePluginInfo(plugininfo_t* lpBuffer)
strcpy_s(g_PluginInfo->Author, sizeof(g_PluginInfo->Author), "Thorny"); strcpy_s(g_PluginInfo->Author, sizeof(g_PluginInfo->Author), "Thorny");
g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION; g_PluginInfo->InterfaceVersion = ASHITA_INTERFACE_VERSION;
g_PluginInfo->PluginVersion = 1.01f; g_PluginInfo->PluginVersion = 1.02f;
g_PluginInfo->Priority = 0; g_PluginInfo->Priority = 0;
} }

1
src/MultiSend/MultiSend.h

@ -91,6 +91,7 @@ public:
bool ReadCommand(); bool ReadCommand();
void SetFollow(bool Active); void SetFollow(bool Active);
void SendCommand(uint32_t ID, const char* Command); void SendCommand(uint32_t ID, const char* Command);
std::string SubValues(std::string Input);
void SubValues(char* Input); void SubValues(char* Input);
void UpdateName(std::string Name); void UpdateName(std::string Name);
void Claim(uint32_t* Target, uint32_t Mod); void Claim(uint32_t* Target, uint32_t Mod);

23
src/MultiSend/Substitute.cpp

@ -1,49 +1,49 @@
#include "MultiSend.h" #include "MultiSend.h"
void MultiSend::SubValues(char* Input) std::string MultiSend::SubValues(std::string Input)
{ {
std::string Working(Input); std::string Working = Input;
size_t find = Working.find("[me]"); size_t find = Working.find("[me]");
if (find != string::npos) if (find != string::npos)
{ {
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(0))); Working.replace(find, 4, std::string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(0)));
} }
find = Working.find("[p0]"); find = Working.find("[p0]");
if (find != string::npos) if (find != string::npos)
{ {
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(0))); Working.replace(find, 4, std::string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(0)));
} }
find = Working.find("[p1]"); find = Working.find("[p1]");
if (find != string::npos) if (find != string::npos)
{ {
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(1))); Working.replace(find, 4, std::string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(1)));
} }
find = Working.find("[p2]"); find = Working.find("[p2]");
if (find != string::npos) if (find != string::npos)
{ {
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(2))); Working.replace(find, 4, std::string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(2)));
} }
find = Working.find("[p3]"); find = Working.find("[p3]");
if (find != string::npos) if (find != string::npos)
{ {
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(3))); Working.replace(find, 4, std::string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(3)));
} }
find = Working.find("[p4]"); find = Working.find("[p4]");
if (find != string::npos) if (find != string::npos)
{ {
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(4))); Working.replace(find, 4, std::string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(4)));
} }
find = Working.find("[p5]"); find = Working.find("[p5]");
if (find != string::npos) if (find != string::npos)
{ {
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(5))); Working.replace(find, 4, std::string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberName(5)));
} }
find = Working.find("[t]"); find = Working.find("[t]");
@ -56,7 +56,12 @@ void MultiSend::SubValues(char* Input)
} }
Working.replace(find, 3, std::to_string(m_AshitaCore->GetDataManager()->GetEntity()->GetServerId(TargetIndex))); Working.replace(find, 3, std::to_string(m_AshitaCore->GetDataManager()->GetEntity()->GetServerId(TargetIndex)));
} }
return Working;
}
void MultiSend::SubValues(char* Input)
{
std::string Working = SubValues(std::string(Input));
const char* base = Working.c_str(); const char* base = Working.c_str();
memset(Input, 0, 248); memset(Input, 0, 248);
memcpy(Input, base, strlen(base)); memcpy(Input, base, strlen(base));

Loading…
Cancel
Save