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.
87 lines
2.4 KiB
87 lines
2.4 KiB
#include "MultiSend.h" |
|
|
|
std::string MultiSend::SubValues(std::string Input) |
|
{ |
|
std::string Working = Input; |
|
|
|
size_t find = Working.find("[me]"); |
|
if (find != string::npos) |
|
{ |
|
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(0))); |
|
} |
|
|
|
find = Working.find("[p0]"); |
|
if (find != string::npos) |
|
{ |
|
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(0))); |
|
} |
|
|
|
find = Working.find("[p1]"); |
|
if (find != string::npos) |
|
{ |
|
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(1))); |
|
} |
|
|
|
find = Working.find("[p2]"); |
|
if (find != string::npos) |
|
{ |
|
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(2))); |
|
} |
|
|
|
find = Working.find("[p3]"); |
|
if (find != string::npos) |
|
{ |
|
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(3))); |
|
} |
|
|
|
find = Working.find("[p4]"); |
|
if (find != string::npos) |
|
{ |
|
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(4))); |
|
} |
|
|
|
find = Working.find("[p5]"); |
|
if (find != string::npos) |
|
{ |
|
Working.replace(find, 4, std::to_string(m_AshitaCore->GetDataManager()->GetParty()->GetMemberServerId(5))); |
|
} |
|
|
|
find = Working.find("[t]"); |
|
if (find != string::npos) |
|
{ |
|
unsigned int TargetIndex = m_AshitaCore->GetDataManager()->GetTarget()->GetTargetIndex(); |
|
if (m_AshitaCore->GetDataManager()->GetTarget()->GetSubTargetActive()) |
|
{ |
|
TargetIndex = m_AshitaCore->GetDataManager()->GetTarget()->GetSubTargetIndex(); |
|
} |
|
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(); |
|
memset(Input, 0, 248); |
|
memcpy(Input, base, strlen(base)); |
|
} |
|
|
|
void MultiSend::SanitizeCommand(char* Input) |
|
{ |
|
if (Input[0] != '/') |
|
{ |
|
if (c_debug) |
|
m_AshitaCore->GetChatManager()->Write("Detected command without leading '/'. Prepending '/echo'..."); |
|
char* prepend = "/echo "; |
|
size_t plen = strlen(prepend); |
|
memmove(Input + plen, Input, strlen(Input) + 1); |
|
memcpy(Input, prepend, strlen(prepend)); |
|
} |
|
else |
|
{ |
|
if (c_debug) |
|
m_AshitaCore->GetChatManager()->Write("No Sanitization Needed."); |
|
} |
|
|
|
}
|
|
|