[Help] News Board MUEMU

Results 1 to 4 of 4
  1. #1
    Member Gendrixon is offline
    MemberRank
    Jun 2014 Join Date
    84Posts

    [Help] News Board MUEMU

    Good afternoon. Who can share the source code of the news board for MUEMU S6 like zTeam server/client?
    Last edited by Gendrixon; 24-08-18 at 02:34 PM.


  2. #2
    Valued Member Pyke is offline
    MemberRank
    Sep 2007 Join Date
    PolandLocation
    104Posts

    Re: [Help] News Board MUEMU

    I can...
    GameServer
    NewsBoard.cpp
    Code:
    #include "StdAfx.h"#if (GAMESERVER_UPDATE == 603)#include "NewsBoard.h"#include "Path.h"#include "MemScript.h"#include "Util.h"// -------------------------------------------------------------------------------NewsBoard gNewsBoard;// -------------------------------------------------------------------------------NewsBoard::NewsBoard(){	this->Init();}// -------------------------------------------------------------------------------NewsBoard::~NewsBoard(){}// -------------------------------------------------------------------------------void NewsBoard::Init(){	this->m_LoadedCount = 0;	this->m_ShowOnLogin	= false;	// ----	for( int i = 0; i < MAX_NEWS_LIST; i++ )	{		this->m_Data[i].Title.Date[0]	= 0;		this->m_Data[i].Title.Time[0]	= 0;		this->m_Data[i].Title.Text[0]	= 0;		this->m_Data[i].Text[0]			= 0;	}}// -------------------------------------------------------------------------------void NewsBoard::ReadListData(char * path){	CMemScript* lpMemScript = new CMemScript;	if(lpMemScript == 0)	{		ErrorMessageBox(MEM_SCRIPT_ALLOC_ERROR,path);		return;	}	if(lpMemScript->SetBuffer(path) == 0)	{		ErrorMessageBox(lpMemScript->GetLastError());		delete lpMemScript;		return;	}	//this->m_Teleports.clear();	try	{		while(true)		{			if(lpMemScript->GetToken() == TOKEN_END)			{				break;			}			if(strcmp("end",lpMemScript->GetString()) == 0)			{				break;			}			memcpy(this->m_Data[this->m_LoadedCount].Title.Date, lpMemScript->GetString(), sizeof(this->m_Data[this->m_LoadedCount].Title.Date));			memcpy(this->m_Data[this->m_LoadedCount].Title.Time, lpMemScript->GetAsString(), sizeof(this->m_Data[this->m_LoadedCount].Title.Time));			memcpy(this->m_Data[this->m_LoadedCount].Title.Text, lpMemScript->GetAsString(), sizeof(this->m_Data[this->m_LoadedCount].Title.Text));			memcpy(this->m_Data[this->m_LoadedCount].Text, lpMemScript->GetAsString(), sizeof(this->m_Data[this->m_LoadedCount].Text));			// ----			this->m_LoadedCount++;		}	}	catch(...)	{		ErrorMessageBox(lpMemScript->GetLastError());	}	delete lpMemScript;	LogAdd(LOG_BLACK, "[NewsBoard] [%d] Item loaded from list", this->m_LoadedCount);}// -------------------------------------------------------------------------------void NewsBoard::ReadMainData(char * File){	this->m_ShowOnLogin	= GetPrivateProfileIntA("Common", "ShowOnLogin", 0, File);}// -------------------------------------------------------------------------------void NewsBoard::Load(){	//if (!IsLicenseChecked)	//{	//	return;	//}	this->Init();	this->ReadListData(gPath.GetFullPath("..\\MUData\\NewsList.txt"));	this->ReadMainData(gPath.GetFullPath("..\\MUData\\NewsMain.ini"));}// -------------------------------------------------------------------------------void NewsBoard::OpenMain(LPOBJ lpUser){	if( lpUser->Connected != OBJECT_ONLINE )	{		return;	}	// ----	NEWS_ANS_TITLES pAnswer = { 0 };	//PHeadSetW((LPBYTE)&pAnswer, 0xFD, sizeof(NEWS_ANS_TITLES));	pAnswer.h.set(0xFE, sizeof(NEWS_ANS_TITLES));	// ----	pAnswer.RealCount = this->m_LoadedCount;	// ----	for( int i = 0; i < this->m_LoadedCount; i++ )	{		strcpy(pAnswer.Titles[i].Date, this->m_Data[i].Title.Date);		strcpy(pAnswer.Titles[i].Time, this->m_Data[i].Title.Time);		strcpy(pAnswer.Titles[i].Text, this->m_Data[i].Title.Text);	}	// ----	DataSend(lpUser->Index, (LPBYTE)&pAnswer, sizeof(NEWS_ANS_TITLES));}// -------------------------------------------------------------------------------void NewsBoard::OpenItem(LPOBJ lpUser, NEWS_REQ_NEWS * Request){	if( lpUser->Connected != OBJECT_ONLINE )	{		return;	}	// ----	if( Request->ID < 0 || Request->ID >= MAX_NEWS_LIST )	{		return;	}	// ----	NEWS_ANS_NEWS pAnswer = { 0 };	//PHeadSetW((LPBYTE)&pAnswer, 0xFE, sizeof(NEWS_ANS_TITLES));	pAnswer.h.set(0xFF, sizeof(NEWS_ANS_NEWS));	// ----	pAnswer.ID = Request->ID;	// ----	strcpy(pAnswer.News.Title.Date, this->m_Data[Request->ID].Title.Date);	strcpy(pAnswer.News.Title.Time, this->m_Data[Request->ID].Title.Time);	strcpy(pAnswer.News.Title.Text, this->m_Data[Request->ID].Title.Text);	strcpy(pAnswer.News.Text, this->m_Data[Request->ID].Text);	// ----	DataSend(lpUser->Index, (LPBYTE)&pAnswer, sizeof(NEWS_ANS_NEWS));}// -------------------------------------------------------------------------------#endif
    NewsBoard.h

    Code:
    #pragma once// -------------------------------------------------------------------------------#if (GAMESERVER_UPDATE == 603)#define MAX_NEWS_LIST	12// -------------------------------------------------------------------------------#include "User.h"#include "Protocol.h"#pragma pack(push, 1)struct NEWS_TITLE{	char	Date[12];	char	Time[7];	char	Text[70];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_DATA{	NEWS_TITLE Title;	char	Text[700];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_TITLES{	PWMSG_HEAD h;	BYTE	RealCount;	NEWS_TITLE Titles[MAX_NEWS_LIST];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_REQ_NEWS{	PBMSG_HEAD	h;	BYTE		ID;};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_NEWS{	PWMSG_HEAD h;	BYTE	ID;	NEWS_DATA News;};#pragma pack(pop)// -------------------------------------------------------------------------------class NewsBoard{public:			NewsBoard();			~NewsBoard();	// ----	void	Init();	void	ReadListData(char * File);	void	ReadMainData(char * File);	void	Load();	// ----	void	OpenMain(LPOBJ lpUser);	void	OpenItem(LPOBJ lpUser, NEWS_REQ_NEWS * Request);	// ----	bool	m_ShowOnLogin;	// ----private:	int		m_LoadedCount;	NEWS_DATA m_Data[MAX_NEWS_LIST];	// ----}; extern NewsBoard gNewsBoard;// -------------------------------------------------------------------------------#endif

    Main
    NewsBoard.cpp

    Code:
    #include "stdafx.h"#include "NewsBoard.h"#include "Interface.h"#include "Protocol.h"// -------------------------------------------------------------------------------NewsBoard gNewsBoard;// -------------------------------------------------------------------------------NewsBoard::NewsBoard(){	this->m_LoadedCount		= 0;	this->m_LastRefreshTick = 0;	this->m_LastRefreshMin	= 0;	// ----	for( int i = 0; i < MAX_NEWS_LIST; i++ )	{		this->m_Data[i].Title.Date[0]	= 0;		this->m_Data[i].Title.Time[0]	= 0;		this->m_Data[i].Title.Text[0]	= 0;		this->m_Data[i].Text[0]			= 0;		this->m_Data[i].LastRefreshTick	= 0;		this->m_Data[i].LastRefreshMin	= 0;	}}// -------------------------------------------------------------------------------NewsBoard::~NewsBoard(){}// -------------------------------------------------------------------------------void NewsBoard::Init(BYTE ID){	ZeroMemory(this->m_Data[ID].Title.Date, sizeof(this->m_Data[ID].Title.Date)-1);	ZeroMemory(this->m_Data[ID].Title.Time, sizeof(this->m_Data[ID].Title.Time)-1);	ZeroMemory(this->m_Data[ID].Title.Text, sizeof(this->m_Data[ID].Title.Text)-1);	ZeroMemory(this->m_Data[ID].Text, sizeof(this->m_Data[ID].Text)-1);}// -------------------------------------------------------------------------------void NewsBoard::ReqOpenMain(){	DWORD CurrentTick		= GetTickCount();	this->m_LastRefreshMin	= (CurrentTick - this->m_LastRefreshTick) / 60000;	//console.Log("", "tick = %d RefteshTick = %d RefreshMin = %d", CurrentTick, this->m_LastRefreshTick, this->m_LastRefreshMin);	// ----	if( this->m_LastRefreshMin <= MIN_NEWS_REFRESH )	{		gInterface.Data[eNEWS_MAIN].Open();		return;	}	// ----	NEWS_REQ_NEWS pRequest;	pRequest.h.set(0xFD, sizeof(pRequest));	DataSend((LPBYTE)&pRequest, pRequest.h.size);}// -------------------------------------------------------------------------------void NewsBoard::OpenMain(NEWS_ANS_TITLES * Answer){	//console.Log("", "OpenMain [%d]", Answer->RealCount);	if( Answer->RealCount < 0 || Answer->RealCount > MAX_NEWS_LIST )	{		return;	}	// ----	this->m_LastRefreshTick = GetTickCount();	this->m_LastRefreshMin	= 0;	this->m_LoadedCount		= Answer->RealCount;	// ----	for( int i = 0; i < Answer->RealCount; i++ )	{		ZeroMemory(this->m_Data[i].Title.Date, sizeof(this->m_Data[i].Title.Date)-1);		ZeroMemory(this->m_Data[i].Title.Time, sizeof(this->m_Data[i].Title.Time)-1);		ZeroMemory(this->m_Data[i].Title.Text, sizeof(this->m_Data[i].Title.Text)-1);		// ----		strcpy(this->m_Data[i].Title.Date, Answer->Titles[i].Date);		strcpy(this->m_Data[i].Title.Time, Answer->Titles[i].Time);		strcpy(this->m_Data[i].Title.Text, Answer->Titles[i].Text);	}	// ----	gInterface.Data[eNEWS_MAIN].Open();}// -------------------------------------------------------------------------------void NewsBoard::ReqOpenItem(BYTE ID){	DWORD CurrentTick				= GetTickCount();	this->m_Data[ID].LastRefreshMin	= (CurrentTick - this->m_Data[ID].LastRefreshTick) / 60000;	// ----	if( this->m_Data[ID].LastRefreshMin <= MIN_NEWS_REFRESH_PAGE )	{		//console.Log("", "RETURN! [%d] [%d]", this->m_Data[ID].LastRefreshMin, this->m_Data[ID].LastRefreshTick);		return;	}	NEWS_REQ_NEWS pRequest;	pRequest.h.set(0xFE, sizeof(pRequest));	pRequest.ID = ID;	DataSend((LPBYTE)&pRequest, pRequest.h.size);}// -------------------------------------------------------------------------------void NewsBoard::OpenItem(NEWS_ANS_NEWS * Answer){	////console.Log("", Answer->News.Text);	if( Answer->ID < 0 || Answer->ID > MAX_NEWS_LIST )	{		return;	}	// ----	this->Init(Answer->ID);	// ----	strcpy(this->m_Data[Answer->ID].Title.Date, Answer->News.Title.Date);	strcpy(this->m_Data[Answer->ID].Title.Time, Answer->News.Title.Time);	strcpy(this->m_Data[Answer->ID].Title.Text, Answer->News.Title.Text);	strcpy(this->m_Data[Answer->ID].Text, Answer->News.Text);	this->m_Data[Answer->ID].LastRefreshTick	= GetTickCount();	this->m_Data[Answer->ID].LastRefreshMin		= 0;}// -------------------------------------------------------------------------------
    NewsBoard.h
    Code:
    #pragma once// -------------------------------------------------------------------------------#include "Protocol.h"// -------------------------------------------------------------------------------#define MAX_NEWS_LIST			12#define	MIN_NEWS_REFRESH		10#define	MIN_NEWS_REFRESH_PAGE	60// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_TITLE{	char	Date[12];	char	Time[7];	char	Text[70];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_DATA{	NEWS_TITLE Title;	char	Text[700];	DWORD	LastRefreshTick;	int		LastRefreshMin;};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_TITLES{	PWMSG_HEAD h;	BYTE	RealCount;	NEWS_TITLE Titles[MAX_NEWS_LIST];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_REQ_NEWS{	PBMSG_HEAD	h;	BYTE		ID;};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_NEWS{	PWMSG_HEAD h;	BYTE	ID;	NEWS_DATA News;};#pragma pack(pop)// -------------------------------------------------------------------------------class NewsBoard{public:			NewsBoard();			~NewsBoard();	// ----	void	Init(BYTE ID);	// ----	void	ReqOpenMain();	void	OpenMain(NEWS_ANS_TITLES * Answer);	void	ReqOpenItem(BYTE ID);	void	OpenItem(NEWS_ANS_NEWS * Answer);	// ----	int		m_LoadedCount;	NEWS_DATA m_Data[MAX_NEWS_LIST];	DWORD	m_LastRefreshTick;	int		m_LastRefreshMin;	// ----}; extern NewsBoard gNewsBoard;// -------------------------------------------------------------------------------
    about rest of code like interface.h i think you can do it by own :D

  3. #3
    Member Gendrixon is offline
    MemberRank
    Jun 2014 Join Date
    84Posts

    Re: [Help] News Board MUEMU

    hmm.

    Protocol client:
    case 0xFD: gNewsBoard.OpenMain((NEWS_ANS_TITLES*)lpMsg); break; // -- case 0xFE: gNewsBoard.OpenItem((NEWS_ANS_NEWS*)lpMsg); break;

    Protocol server:
    case 0xFD: gNewsBoard.OpenMain(&gObj[aIndex]); break; // -- case 0xFE: gNewsBoard.OpenItem(&gObj[aIndex], (NEWS_REQ_NEWS*)lpMsg); break;

    ServerInfo.cpp
    gNewsBoard.Load();

    Interface.cpp/.h in zTeam

    Result: Screenshot by Lightshot

  4. #4
    Enthusiast Martins Iury is offline
    MemberRank
    Jul 2013 Join Date
    49Posts

    Re: [Help] News Board MUEMU

    Quote Originally Posted by Pyke View Post
    I can...
    GameServer
    NewsBoard.cpp
    Code:
    #include "StdAfx.h"#if (GAMESERVER_UPDATE == 603)#include "NewsBoard.h"#include "Path.h"#include "MemScript.h"#include "Util.h"// -------------------------------------------------------------------------------NewsBoard gNewsBoard;// -------------------------------------------------------------------------------NewsBoard::NewsBoard(){    this->Init();}// -------------------------------------------------------------------------------NewsBoard::~NewsBoard(){}// -------------------------------------------------------------------------------void NewsBoard::Init(){    this->m_LoadedCount = 0;    this->m_ShowOnLogin    = false;    // ----    for( int i = 0; i < MAX_NEWS_LIST; i++ )    {        this->m_Data[i].Title.Date[0]    = 0;        this->m_Data[i].Title.Time[0]    = 0;        this->m_Data[i].Title.Text[0]    = 0;        this->m_Data[i].Text[0]            = 0;    }}// -------------------------------------------------------------------------------void NewsBoard::ReadListData(char * path){    CMemScript* lpMemScript = new CMemScript;    if(lpMemScript == 0)    {        ErrorMessageBox(MEM_SCRIPT_ALLOC_ERROR,path);        return;    }    if(lpMemScript->SetBuffer(path) == 0)    {        ErrorMessageBox(lpMemScript->GetLastError());        delete lpMemScript;        return;    }    //this->m_Teleports.clear();    try    {        while(true)        {            if(lpMemScript->GetToken() == TOKEN_END)            {                break;            }            if(strcmp("end",lpMemScript->GetString()) == 0)            {                break;            }            memcpy(this->m_Data[this->m_LoadedCount].Title.Date, lpMemScript->GetString(), sizeof(this->m_Data[this->m_LoadedCount].Title.Date));            memcpy(this->m_Data[this->m_LoadedCount].Title.Time, lpMemScript->GetAsString(), sizeof(this->m_Data[this->m_LoadedCount].Title.Time));            memcpy(this->m_Data[this->m_LoadedCount].Title.Text, lpMemScript->GetAsString(), sizeof(this->m_Data[this->m_LoadedCount].Title.Text));            memcpy(this->m_Data[this->m_LoadedCount].Text, lpMemScript->GetAsString(), sizeof(this->m_Data[this->m_LoadedCount].Text));            // ----            this->m_LoadedCount++;        }    }    catch(...)    {        ErrorMessageBox(lpMemScript->GetLastError());    }    delete lpMemScript;    LogAdd(LOG_BLACK, "[NewsBoard] [%d] Item loaded from list", this->m_LoadedCount);}// -------------------------------------------------------------------------------void NewsBoard::ReadMainData(char * File){    this->m_ShowOnLogin    = GetPrivateProfileIntA("Common", "ShowOnLogin", 0, File);}// -------------------------------------------------------------------------------void NewsBoard::Load(){    //if (!IsLicenseChecked)    //{    //    return;    //}    this->Init();    this->ReadListData(gPath.GetFullPath("..\\MUData\\NewsList.txt"));    this->ReadMainData(gPath.GetFullPath("..\\MUData\\NewsMain.ini"));}// -------------------------------------------------------------------------------void NewsBoard::OpenMain(LPOBJ lpUser){    if( lpUser->Connected != OBJECT_ONLINE )    {        return;    }    // ----    NEWS_ANS_TITLES pAnswer = { 0 };    //PHeadSetW((LPBYTE)&pAnswer, 0xFD, sizeof(NEWS_ANS_TITLES));    pAnswer.h.set(0xFE, sizeof(NEWS_ANS_TITLES));    // ----    pAnswer.RealCount = this->m_LoadedCount;    // ----    for( int i = 0; i < this->m_LoadedCount; i++ )    {        strcpy(pAnswer.Titles[i].Date, this->m_Data[i].Title.Date);        strcpy(pAnswer.Titles[i].Time, this->m_Data[i].Title.Time);        strcpy(pAnswer.Titles[i].Text, this->m_Data[i].Title.Text);    }    // ----    DataSend(lpUser->Index, (LPBYTE)&pAnswer, sizeof(NEWS_ANS_TITLES));}// -------------------------------------------------------------------------------void NewsBoard::OpenItem(LPOBJ lpUser, NEWS_REQ_NEWS * Request){    if( lpUser->Connected != OBJECT_ONLINE )    {        return;    }    // ----    if( Request->ID < 0 || Request->ID >= MAX_NEWS_LIST )    {        return;    }    // ----    NEWS_ANS_NEWS pAnswer = { 0 };    //PHeadSetW((LPBYTE)&pAnswer, 0xFE, sizeof(NEWS_ANS_TITLES));    pAnswer.h.set(0xFF, sizeof(NEWS_ANS_NEWS));    // ----    pAnswer.ID = Request->ID;    // ----    strcpy(pAnswer.News.Title.Date, this->m_Data[Request->ID].Title.Date);    strcpy(pAnswer.News.Title.Time, this->m_Data[Request->ID].Title.Time);    strcpy(pAnswer.News.Title.Text, this->m_Data[Request->ID].Title.Text);    strcpy(pAnswer.News.Text, this->m_Data[Request->ID].Text);    // ----    DataSend(lpUser->Index, (LPBYTE)&pAnswer, sizeof(NEWS_ANS_NEWS));}// -------------------------------------------------------------------------------#endif
    NewsBoard.h

    Code:
    #pragma once// -------------------------------------------------------------------------------#if (GAMESERVER_UPDATE == 603)#define MAX_NEWS_LIST    12// -------------------------------------------------------------------------------#include "User.h"#include "Protocol.h"#pragma pack(push, 1)struct NEWS_TITLE{    char    Date[12];    char    Time[7];    char    Text[70];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_DATA{    NEWS_TITLE Title;    char    Text[700];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_TITLES{    PWMSG_HEAD h;    BYTE    RealCount;    NEWS_TITLE Titles[MAX_NEWS_LIST];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_REQ_NEWS{    PBMSG_HEAD    h;    BYTE        ID;};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_NEWS{    PWMSG_HEAD h;    BYTE    ID;    NEWS_DATA News;};#pragma pack(pop)// -------------------------------------------------------------------------------class NewsBoard{public:            NewsBoard();            ~NewsBoard();    // ----    void    Init();    void    ReadListData(char * File);    void    ReadMainData(char * File);    void    Load();    // ----    void    OpenMain(LPOBJ lpUser);    void    OpenItem(LPOBJ lpUser, NEWS_REQ_NEWS * Request);    // ----    bool    m_ShowOnLogin;    // ----private:    int        m_LoadedCount;    NEWS_DATA m_Data[MAX_NEWS_LIST];    // ----}; extern NewsBoard gNewsBoard;// -------------------------------------------------------------------------------#endif

    Main
    NewsBoard.cpp

    Code:
    #include "stdafx.h"#include "NewsBoard.h"#include "Interface.h"#include "Protocol.h"// -------------------------------------------------------------------------------NewsBoard gNewsBoard;// -------------------------------------------------------------------------------NewsBoard::NewsBoard(){    this->m_LoadedCount        = 0;    this->m_LastRefreshTick = 0;    this->m_LastRefreshMin    = 0;    // ----    for( int i = 0; i < MAX_NEWS_LIST; i++ )    {        this->m_Data[i].Title.Date[0]    = 0;        this->m_Data[i].Title.Time[0]    = 0;        this->m_Data[i].Title.Text[0]    = 0;        this->m_Data[i].Text[0]            = 0;        this->m_Data[i].LastRefreshTick    = 0;        this->m_Data[i].LastRefreshMin    = 0;    }}// -------------------------------------------------------------------------------NewsBoard::~NewsBoard(){}// -------------------------------------------------------------------------------void NewsBoard::Init(BYTE ID){    ZeroMemory(this->m_Data[ID].Title.Date, sizeof(this->m_Data[ID].Title.Date)-1);    ZeroMemory(this->m_Data[ID].Title.Time, sizeof(this->m_Data[ID].Title.Time)-1);    ZeroMemory(this->m_Data[ID].Title.Text, sizeof(this->m_Data[ID].Title.Text)-1);    ZeroMemory(this->m_Data[ID].Text, sizeof(this->m_Data[ID].Text)-1);}// -------------------------------------------------------------------------------void NewsBoard::ReqOpenMain(){    DWORD CurrentTick        = GetTickCount();    this->m_LastRefreshMin    = (CurrentTick - this->m_LastRefreshTick) / 60000;    //console.Log("", "tick = %d RefteshTick = %d RefreshMin = %d", CurrentTick, this->m_LastRefreshTick, this->m_LastRefreshMin);    // ----    if( this->m_LastRefreshMin <= MIN_NEWS_REFRESH )    {        gInterface.Data[eNEWS_MAIN].Open();        return;    }    // ----    NEWS_REQ_NEWS pRequest;    pRequest.h.set(0xFD, sizeof(pRequest));    DataSend((LPBYTE)&pRequest, pRequest.h.size);}// -------------------------------------------------------------------------------void NewsBoard::OpenMain(NEWS_ANS_TITLES * Answer){    //console.Log("", "OpenMain [%d]", Answer->RealCount);    if( Answer->RealCount < 0 || Answer->RealCount > MAX_NEWS_LIST )    {        return;    }    // ----    this->m_LastRefreshTick = GetTickCount();    this->m_LastRefreshMin    = 0;    this->m_LoadedCount        = Answer->RealCount;    // ----    for( int i = 0; i < Answer->RealCount; i++ )    {        ZeroMemory(this->m_Data[i].Title.Date, sizeof(this->m_Data[i].Title.Date)-1);        ZeroMemory(this->m_Data[i].Title.Time, sizeof(this->m_Data[i].Title.Time)-1);        ZeroMemory(this->m_Data[i].Title.Text, sizeof(this->m_Data[i].Title.Text)-1);        // ----        strcpy(this->m_Data[i].Title.Date, Answer->Titles[i].Date);        strcpy(this->m_Data[i].Title.Time, Answer->Titles[i].Time);        strcpy(this->m_Data[i].Title.Text, Answer->Titles[i].Text);    }    // ----    gInterface.Data[eNEWS_MAIN].Open();}// -------------------------------------------------------------------------------void NewsBoard::ReqOpenItem(BYTE ID){    DWORD CurrentTick                = GetTickCount();    this->m_Data[ID].LastRefreshMin    = (CurrentTick - this->m_Data[ID].LastRefreshTick) / 60000;    // ----    if( this->m_Data[ID].LastRefreshMin <= MIN_NEWS_REFRESH_PAGE )    {        //console.Log("", "RETURN! [%d] [%d]", this->m_Data[ID].LastRefreshMin, this->m_Data[ID].LastRefreshTick);        return;    }    NEWS_REQ_NEWS pRequest;    pRequest.h.set(0xFE, sizeof(pRequest));    pRequest.ID = ID;    DataSend((LPBYTE)&pRequest, pRequest.h.size);}// -------------------------------------------------------------------------------void NewsBoard::OpenItem(NEWS_ANS_NEWS * Answer){    ////console.Log("", Answer->News.Text);    if( Answer->ID < 0 || Answer->ID > MAX_NEWS_LIST )    {        return;    }    // ----    this->Init(Answer->ID);    // ----    strcpy(this->m_Data[Answer->ID].Title.Date, Answer->News.Title.Date);    strcpy(this->m_Data[Answer->ID].Title.Time, Answer->News.Title.Time);    strcpy(this->m_Data[Answer->ID].Title.Text, Answer->News.Title.Text);    strcpy(this->m_Data[Answer->ID].Text, Answer->News.Text);    this->m_Data[Answer->ID].LastRefreshTick    = GetTickCount();    this->m_Data[Answer->ID].LastRefreshMin        = 0;}// -------------------------------------------------------------------------------
    NewsBoard.h
    Code:
    #pragma once// -------------------------------------------------------------------------------#include "Protocol.h"// -------------------------------------------------------------------------------#define MAX_NEWS_LIST            12#define    MIN_NEWS_REFRESH        10#define    MIN_NEWS_REFRESH_PAGE    60// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_TITLE{    char    Date[12];    char    Time[7];    char    Text[70];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_DATA{    NEWS_TITLE Title;    char    Text[700];    DWORD    LastRefreshTick;    int        LastRefreshMin;};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_TITLES{    PWMSG_HEAD h;    BYTE    RealCount;    NEWS_TITLE Titles[MAX_NEWS_LIST];};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_REQ_NEWS{    PBMSG_HEAD    h;    BYTE        ID;};#pragma pack(pop)// -------------------------------------------------------------------------------#pragma pack(push, 1)struct NEWS_ANS_NEWS{    PWMSG_HEAD h;    BYTE    ID;    NEWS_DATA News;};#pragma pack(pop)// -------------------------------------------------------------------------------class NewsBoard{public:            NewsBoard();            ~NewsBoard();    // ----    void    Init(BYTE ID);    // ----    void    ReqOpenMain();    void    OpenMain(NEWS_ANS_TITLES * Answer);    void    ReqOpenItem(BYTE ID);    void    OpenItem(NEWS_ANS_NEWS * Answer);    // ----    int        m_LoadedCount;    NEWS_DATA m_Data[MAX_NEWS_LIST];    DWORD    m_LastRefreshTick;    int        m_LastRefreshMin;    // ----}; extern NewsBoard gNewsBoard;// -------------------------------------------------------------------------------
    about rest of code like interface.h i think you can do it by own :D
    download , please of this files , because is not organized help :)



Advertisement