Noticias:

SMF - Just Installed!

Menú principal

SOURCE Custom Server Info

Publicado por Dakosmu, Jul 19, 2024, 05:09 PM

Tema anterior - Siguiente tema

Dakosmu

SOURCE Custom Server Info

Los visitantes no pueden visualizar imágenes en los mensajes, por favor Regístrate o Inicia Sesión

////////////////////// MAIN ///////////////////////

stdafx.h

#define Custom_ServerInfo            1


CustomServerInfo.cpp

#include "stdafx.h"
#if(Custom_ServerInfo)
#include "CustomServerInfo.h"
#include "Util.h"
#include "TMemory.h"
#include "Defines.h"
#include "Import.h"
#include "ReadScript.h"


CMSGServerInfo g_MSGServerInfo;

CMSGServerInfo::CMSGServerInfo()
{
    this->m_data.clear();
}

CMSGServerInfo::~CMSGServerInfo()
{
}

void CMSGServerInfo::Load()
{
    //00953CFC - hook
    this->m_data.clear();

    this->Read("Data/Custom/ServerListInfo.txt");

    SetOp((LPVOID)0x009540B8, this->ServerDrawTextHook, ASM::CALL); //1.04E
    SetOp((LPVOID)0x009540EE, this->ServerDrawTextHook, ASM::CALL); //1.04E
    SetOp((LPVOID)0x00954121, this->ServerDrawTextHook, ASM::CALL); //1.04E
    SetOp((LPVOID)0x00954154, this->ServerDrawTextHook, ASM::CALL); //1.04E
}

void CMSGServerInfo::Read(char* filename)
{
    SMDToken Token;

    SMDFile = fopen(filename, "r");

    if (!SMDFile)
    {
        return;
    }

    while (true)
    {
        Token = GetToken();

        if (Token == END || !strcmp(TokenString, "end"))
        {
            break;
        }

        SERVERINFO_DATA list;

        memcpy(list.ServerName, TokenString, sizeof(list.ServerName));

        Token = GetToken();
        list.SubServerNum = TokenNumber;

        Token = GetToken();
        memcpy(list.ServerText, TokenString, sizeof(list.ServerText));

        this->m_data.push_back(list);
    }

    fclose(SMDFile);
}

void CMSGServerInfo::ServerDrawTextHook(int a1, char* a2, char* ServerName, int SubServerNum, char* TextConnect)
{
    for (int i = 0; i < g_MSGServerInfo.m_data.size(); i++)
    {
        if (!strcmp(ServerName, g_MSGServerInfo.m_data[i].ServerName))
        {
            if (SubServerNum == g_MSGServerInfo.m_data[i].SubServerNum)
            {
                pSetItemTextLine(a1, g_MSGServerInfo.m_data[i].ServerText);
                return;
            }
        }
    }

    pSetItemTextLine(a1, a2, ServerName, SubServerNum, TextConnect);


}
#endif

CustomServerInfo.h

#pragma once

#include "stdafx.h"
#if(Custom_ServerInfo)
#include

#define sub_953620      ((LPVOID(__thiscall*)(LPVOID This)) 0x953620)
#define sub_9527D0      ((int(__thiscall*)(char* This)) 0x9527D0)
#define sub_402320      ((int(__stdcall*)(int a1)) 0x402320)
#define sub_9526C0      ((int(__thiscall*)(DWORD* This, char* a2)) 0x9526C0)
#define sub_9CF52A      ((int(*)(int a1, const char *a2, ...)) 0x9CF52A)

struct SERVERINFO_DATA
{
    char ServerName[20];
    int SubServerNum;
    char ServerText[256];
};

class CMSGServerInfo
{
public:
    CMSGServerInfo();
    ~CMSGServerInfo();

    void Load();
    void Read(char* filename);

    static void ServerDrawTextHook(int a1, char* a2, char* ServerName, int SubServerNum, char* TextConnect);

    std::vector m_data;
};
extern CMSGServerInfo g_MSGServerInfo;

#endif


Main.cpp


#if(Custom_ServerInfo)
#include "CustomServerInfo.h"
#endif

Agregar Dentro de extern "C" _declspec(dllexport) void EntryProc() // OK

#if(Custom_ServerInfo)
    g_MSGServerInfo.Load();
#endif


Agregar a tu Client\Data\Custom\ServerListInfo.txt


ServerListInfo.txt

// ----------------------------------------------------------------------------------
//    Server      SubServer  Server
//  Name      Number      Text
// ----------------------------------------------------------------------------------
  "Heavenly Emperor"  1      "Sub 1 - Transaction"
  "Heavenly Emperor"  2      "Sub 2 - NonPK-Train"
  "Heavenly Emperor"  3      "Sub 3 - PK-Train"
  "Heavenly Emperor"  4      "Sub 4 - Event-PK-Train"
  "Heavenly Emperor"  5      "Sub 5 - Vip"
  "Heavenly Emperor"  6      "Sub 6 - XXX"
  "Heavenly Emperor"  19    "Sub 20 - Siege War"
 
end

Bon Dia

🡱 🡳