Browse Source

1.16 - Changed [me] and [p0-5] to use player name instead of ID. Should fix follow issues. Changed name of memory mapped file to match version on it's own to prevent any collisions if user tries to load 2 different versions at once.

master
Thorny 5 years ago
parent
commit
8ae071b990
  1. BIN
      release/plugins/MultiSend.dll
  2. 8
      src/MultiSend/Main.cpp
  3. 14
      src/MultiSend/text_sanitizing.cpp

BIN
release/plugins/MultiSend.dll

Binary file not shown.

8
src/MultiSend/Main.cpp

@ -38,6 +38,10 @@ bool MultiSend::Initialize(IAshitaCore* core, ILogManager* log, uint32_t id)
Pointer += 25; Pointer += 25;
p_Follow = (sFollow*)(*((DWORD*)Pointer)); p_Follow = (sFollow*)(*((DWORD*)Pointer));
//Create name for memory mapped file using plugin version, to guarantee mismatched multisends don't collide if user loads two.
char buffer[256];
sprintf_s(buffer, 256, "FFXI_Multisend_%f", this->GetPluginInfo().PluginVersion);
//create a handle to the MMF, size matches the struct we're using for it //create a handle to the MMF, size matches the struct we're using for it
HANDLE hMapFile = CreateFileMapping( HANDLE hMapFile = CreateFileMapping(
INVALID_HANDLE_VALUE, INVALID_HANDLE_VALUE,
@ -45,7 +49,7 @@ bool MultiSend::Initialize(IAshitaCore* core, ILogManager* log, uint32_t id)
PAGE_READWRITE, PAGE_READWRITE,
0, // maximum object size (high-order DWORD) 0, // maximum object size (high-order DWORD)
sizeof(MMF_Global), // maximum object size (low-order DWORD) sizeof(MMF_Global), // maximum object size (low-order DWORD)
"FFXI_MultiSend_1_15"); buffer);
bool made = (GetLastError() == 0); bool made = (GetLastError() == 0);
@ -119,7 +123,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.15f; g_PluginInfo->PluginVersion = 1.16f;
g_PluginInfo->Priority = 0; g_PluginInfo->Priority = 0;
} }

14
src/MultiSend/text_sanitizing.cpp

@ -7,43 +7,43 @@ std::string MultiSend::SubValues(std::string 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]");

Loading…
Cancel
Save