About Global Color after use get disconnected *
SRO_DevKit
global color It became the normal thing there is a lot who did this and there is a lot of dll about this thing, and we would have wanted to do this in the source If there is someone who has a better code than this, does not skimp to share and thank you
Is there anyone who helps about this
SRO_DevKit
global color It became the normal thing there is a lot who did this and there is a lot of dll about this thing, and we would have wanted to do this in the source If there is someone who has a better code than this, does not skimp to share and thank you
Code:
#include "globalcolors.h"
#include "memhelp.h"
#include "chathelp.h"
std::vector<tGlobalIdColorPair> globalcolors::m_data;
const DWORD dwHookAddr = 0x0087703A; //we need EAX
const DWORD dwHookJmpback = 0x0087704C; // 0x00877046;
const DWORD dwHookMsgSend = 0x00790287;
const DWORD dwHookMsgSendJumpback = 0x007902A1;
const DWORD wOpcodeForEventGlobal = 0x1333;
const DWORD wOpcodeForNormalGlobal = 0x1334;
const WORD wEventGlobalRefItemID = 35592 + 1; //+1 from db
const WORD wNormalGlobalRefItemID = 3851 + 1; //+1 from db
//const DWORD dwJumpSendIfEq1= 0x0079035D; see __asm
const DWORD dwHookSendCall1 = 0x00841780; //call sro_clie.0x00841780
DWORD dwIsEvent = 0;
//nop 9 bytes, emulate movzx eax, byte
//movzx eax, byte ptr ss:[esp+230] == msg type (will spoof)
void globalcolors::AssignColorToId(uint8_t id, DWORD color)
{
m_data.push_back(tGlobalIdColorPair(id, color));
}
wchar_t* msgBuf;
void HandleCustomGlobalMsg()
{
std::wcout << msgBuf << std::endl;
std::cout << wcslen(msgBuf) << std::endl;
int lastIndex = wcslen(msgBuf) - 1;
DWORD color = globalcolors::GetColorByType(msgBuf[lastIndex]);
msgBuf[lastIndex] = 0x00;
}
DWORD globalcolors::GetColorByType(uint8_t id)
{
DWORD res = 0;
for(std::vector<tGlobalIdColorPair>::iterator iter = m_data.begin(); iter != m_data.end(); iter++)
{
if(iter->first == id)
{
res = iter->second;
break;
}
}
return res;
}
__declspec(naked) void globalcolors::OnGlobalMsg()
{
__asm
{
mov msgBuf, eax;
pushad;
call HandleCustomGlobalMsg;
popad;
movzx eax, byte ptr ss:[esp+0x230];
//add esp, 0x8;
jmp dwHookJmpback;
}
}
__declspec(naked) void ExecEvent()
{
__asm pop eax;
__asm push wOpcodeForEventGlobal;
__asm call dwHookSendCall1;
__asm add esp, 8;
__asm test eax, eax;
__asm je 0x0079035D;
__asm push wOpcodeForEventGlobal;
__asm jmp dwHookMsgSendJumpback;
}
__declspec(naked) void ExecNormal()
{
__asm pop eax;
__asm push wOpcodeForNormalGlobal;
__asm call dwHookSendCall1;
__asm add esp, 8;
__asm test eax, eax;
__asm je 0x0079035D;
__asm push wOpcodeForNormalGlobal;
__asm jmp dwHookMsgSendJumpback;
}
__declspec(naked) void OnGlobalItemUsed()
{
__asm push eax;
__asm mov ax, ss : [esp - 0x24];
__asm cmp ax, wEventGlobalRefItemID;
__asm je ExecEvent;
__asm jmp ExecNormal;
}
void globalcolors::Initialize()
{
memhelp::RenderNop((void*)dwHookAddr, 9);
memhelp::RenderDetour(ASM_JMP, (void*)dwHookAddr, globalcolors::OnGlobalMsg);
memhelp::RenderNop((void*)dwHookMsgSend, 26);
memhelp::RenderDetour(ASM_JMP, (void*)dwHookMsgSend, OnGlobalItemUsed);
}
Code:
#pragma once
#include "xlib.h"
typedef std::pair<uint8_t, DWORD> tGlobalIdColorPair;
class globalcolors
{
public:
static void Initialize();
static void AssignColorToId(uint8_t id, DWORD color);
static DWORD GetColorByType(uint8_t id);
private:
//__declspec(naked)
static void OnGlobalMsg();
static std::vector<tGlobalIdColorPair> m_data;
};
Code:
globalcolors::Initialize();
globalcolors::AssignColorToId(0x01, 0xFF33FF33);
globalcolors::AssignColorToId(0x02, 0xFF669911);