[Help] I need to know what software i need for this coding

DaRkiv

New Member
Joined
Aug 1, 2009
Messages
194
Reaction score
117
MoveReq.cpp
#include <stdio.h>
#include <windows.h>
#include "MoveReq.h"

//Structures
MOVEREQ MoveReqInfo[255];
int MoveReqCount;

//Move Req
bool MoveReqLoad(char *FileName)
{
FILE *fp;
BOOL bRead = FALSE;
DWORD dwArgv = 0;
char sLineTxt[255] = {0};
int MoveReqCount = 1;

fp = fopen(FileName,"r");

if(!fp)
{
MessageBoxA(NULL, "MoveReq Failed!", "Error!", MB_OK);
::ExitProcess ;
}

rewind(fp);
int leestatus=-1;

while(fgets(sLineTxt, 255, fp) != NULL)
{
if(sLineTxt[0] == '/')continue;
if(sLineTxt[0] == ';')continue;

int n[4];

sscanf(sLineTxt, "%d %*s %*s %d %d %d", &n[0], &n[1], &n[2], &n[3]);

MoveReqInfo[MoveReqCount].Index = n[0];
MoveReqInfo[MoveReqCount].Zen = n[1];
MoveReqInfo[MoveReqCount].Level = n[2];
MoveReqInfo[MoveReqCount].Gate = n[3];
MoveReqCount++;
}

rewind(fp);
fclose(fp);

return TRUE;
}
MoveReq.h
#include <windows.h>

typedef struct MoveReq
{
int Index;
int Zen;
int Level;
int Gate;
}MOVEREQ;

//Structures
extern MOVEREQ MoveReqInfo[255];
extern int MoveReqCount;

//Defines
bool MoveReqLoad(char *FileName);



If u can upload the Software i need or send me a Link to it i be very Greatful

Thank you in Advance.
 
I am useing Visual Studio but when i open GameServer.exe in Visual C nothing comes up

i haven't Really coded much before i am going to collage for this in 6 months

Just trying to code all this codeing for Season 5 Move M, Map List and when i load it up in Visual C nothing comes up at all unless i open Dat. files.
 
You also need MoveReq.h (or you need to write it, it depends on your GS)
You need to compile a dll from this cpp and at the end -> hook it in your GS...
Sounds easy, wright? :D
Good Luck
 
its not so hard if you have all the .h and .cpp files .. then u just need to compile and hook
 
MoveReq.cpp
#include <stdio.h>
#include <windows.h>
#include "MoveReq.h"

//Structures
MOVEREQ MoveReqInfo[255];
int MoveReqCount;

//Move Req
bool MoveReqLoad(char *FileName)
{
FILE *fp;
BOOL bRead = FALSE;
DWORD dwArgv = 0;
char sLineTxt[255] = {0};
int MoveReqCount = 1;

fp = fopen(FileName,"r");

if(!fp)
{
MessageBoxA(NULL, "MoveReq Failed!", "Error!", MB_OK);
::ExitProcess ;
}

rewind(fp);
int leestatus=-1;

while(fgets(sLineTxt, 255, fp) != NULL)
{
if(sLineTxt[0] == '/')continue;
if(sLineTxt[0] == ';')continue;

int n[4];

sscanf(sLineTxt, "%d %*s %*s %d %d %d", &n[0], &n[1], &n[2], &n[3]);

MoveReqInfo[MoveReqCount].Index = n[0];
MoveReqInfo[MoveReqCount].Zen = n[1];
MoveReqInfo[MoveReqCount].Level = n[2];
MoveReqInfo[MoveReqCount].Gate = n[3];
MoveReqCount++;
}

rewind(fp);
fclose(fp);

return TRUE;
}
MoveReq.h
#include <windows.h>

typedef struct MoveReq
{
int Index;
int Zen;
int Level;
int Gate;
}MOVEREQ;

//Structures
extern MOVEREQ MoveReqInfo[255];
extern int MoveReqCount;

//Defines
bool MoveReqLoad(char *FileName);



If u can upload the Software i need or send me a Link to it i be very Greatful

Thank you in Advance.

iam using Dev C++ :) ... more easy ^^... but you need realy all .h and .cpp files :) ... GooD LucK
 
Dam so where do i find the .h and .cpp files ^^^
 
Can 1 of u help me do this coding for season 5 Map List when i open the MuServer folder to put the coding in i cannot find the .cpp files or the .h files this my first time.

I have coded this sort of stuff before. I going to collage in 6 months for this i think i heard i am suppose to convert files into a .ccp file or a .h file but not sure.

God i sound dum here ^^^
 
Can 1 of u help me do this coding for season 5 Map List when i open the MuServer folder to put the coding in i cannot find the .cpp files or the .h files this my first time.

I have coded this sort of stuff before. I going to collage in 6 months for this i think i heard i am suppose to convert files into a .ccp file or a .h file but not sure.

God i sound dum here ^^^

Ahah, you can't "convert" them :) ! You must write them :) .... you need to code all .h and .cpp files and then you must join them to .dll file :)....... Not so easy :D
 
Ahhhh i c ty i get it now so i just got to Hook it to the .dll files how do i know what .dll

files i hook it to in the GS folder there are usally 3 or 4 .dll files.
 
MoveReq.cpp
Code:
#include <stdio.h>
#include <time.h>
#include <windows.h>
#include "Log.h"
#include "GameServer.h"
#include "Utils.h"
#include "MoveReq.h"
#include "SMDToken.h"
#include "User.h"


CMoveSystem MoveReq;

void CMoveSystem::Init()
{
    for(int i=0;i<MAX_MOVES;i++)
    {
        this->m_MoveData[i].iIndex = 0;
        this->m_MoveData[i].iMoney = 0;
        this->m_MoveData[i].iLevel = 0;
        this->m_MoveData[i].iGate = 0;
    }
}

void CMoveSystem::InitGate()
{
    for(int i=0;i<MAX_GATES;i++)
    {
        this->m_GateData[i].iIndex = 0;
        this->m_GateData[i].iType = 0;
        this->m_GateData[i].iMapNum = 0;
        this->m_GateData[i].iX1 = 0;
        this->m_GateData[i].iY1 = 0;
        this->m_GateData[i].iX2 = 0;
        this->m_GateData[i].iY2 = 0;
        this->m_GateData[i].iTarget = 0;
        this->m_GateData[i].iDir = 0;
        this->m_GateData[i].iLevel = 0;
    }
}

void CMoveSystem::LoadFile(char *filename)
{
    this->Init();
    
    if((SMDFile = fopen(filename, "r")) == NULL)
    {
        MessageBoxA(0,"CMoveManager::LoadFile() error","CRITICAL ERROR",0);
        ExitProcess(1);
        return;
    }

    SMDToken Token;
    int iIndex;
    char szMoveKor[40] = {0};
    char szMoveEng[40] = {0};
    int iMoney = 0;
    int iLevel = 0;
    int iGate = 0;
    int MoveReqs = 0;

    while(true)
    {
        Token = GetToken();

        if(MoveReqs == 255)
            break;

        iIndex = TokenNumber;
        
        Token = GetToken();
        memcpy(szMoveKor,TokenString,sizeof(szMoveKor));

        Token = GetToken();
        memcpy(szMoveEng,TokenString,sizeof(szMoveEng));

        Token = GetToken();
        iMoney = TokenNumber;

        Token = GetToken();
        iLevel = TokenNumber;

        Token = GetToken();
        iGate = TokenNumber;
        //Log.outInfo("%d '%s' '%s' %d %d %d",iIndex,szMoveKor,szMoveEng,iMoney,iLevel,iGate);

        this->Insert(iIndex,szMoveKor,szMoveEng,iMoney,iLevel,iGate);    
        MoveReqs++;
    }

    fclose(SMDFile);
    return;
}

void CMoveSystem::LoadGate(char *filename)
{
    this->InitGate();
    
    if((SMDFile = fopen(filename, "r")) == NULL)
    {
        MessageBoxA(0,"CMoveManager::LoadGate() error","CRITICAL ERROR",0);
        ExitProcess(1);
        return;
    }

    SMDToken Token;
    int iIndex;
    int iType = 0;
    int iMapNum = 0;
    int iX1 = 0;
    int iY1 = 0;
    int iX2 = 0;
    int iY2 = 0;
    int iTarget = 0;
    int iDir = 0;
    int iLevel = 0;
    int GateReqs = 0;

    while(true)
    {
        Token = GetToken();

        if(GateReqs == 290)
            break;

        iIndex = TokenNumber;

        Token = GetToken();
        iType = TokenNumber;

        Token = GetToken();
        iMapNum = TokenNumber;

        Token = GetToken();
        iX1 = TokenNumber;
        
        Token = GetToken();
        iY1 = TokenNumber;

        Token = GetToken();
        iX2 = TokenNumber;

        Token = GetToken();
        iY2 = TokenNumber;

        Token = GetToken();
        iTarget = TokenNumber;

        Token = GetToken();
        iDir = TokenNumber;

        Token = GetToken();
        iLevel = TokenNumber;

        //Log.outInfo("%d %d %d %d %d %d %d %d %d %d",iIndex,iType,iMapNum,iX1,iY1,iX2,iY2,iTarget,iDir,iLevel);

        this->InsertGate(iIndex,iType,iMapNum,iX1,iY1,iX2,iY2,iTarget,iDir,iLevel);    
        GateReqs++;
    }

    fclose(SMDFile);
    return;
}

void CMoveSystem::InsertGate(int iIndex,int iType,int iMapNum,int iX1,int iY1,int iX2,int iY2,int iTarget,int iDir,int iLevel)
{
    this->m_GateData[iIndex].iIndex = iIndex;
    this->m_GateData[iIndex].iType = iType;
    this->m_GateData[iIndex].iMapNum = iMapNum;
    this->m_GateData[iIndex].iX1 = iX1;
    this->m_GateData[iIndex].iY1 = iY1;
    this->m_GateData[iIndex].iX2 = iX2;
    this->m_GateData[iIndex].iY2 = iY2;
    this->m_GateData[iIndex].iTarget = iTarget;
    this->m_GateData[iIndex].iDir = iDir;
    this->m_GateData[iIndex].iLevel = iLevel;
}

void CMoveSystem::Insert(int iIndex,char *szMoveKor,char *szMoveEng, int iMoney,int iLevel,int iGate)
{
    this->m_MoveData[iIndex].iIndex = iIndex;
    strcpy(this->m_MoveData[iIndex].szMoveKor,szMoveKor);
    strcpy(this->m_MoveData[iIndex].szMoveEng,szMoveEng);
    this->m_MoveData[iIndex].iMoney = iMoney;
    this->m_MoveData[iIndex].iLevel = iLevel;
    this->m_MoveData[iIndex].iGate = iGate;
}

void CMoveSystem::Teleport(int aIndex, int MovNum)
{    
    OBJECTSTRUCT *gObj = (OBJECTSTRUCT*)OBJECT_POINTER(aIndex);

    int TeleportMap;

    if(this->m_GateData[this->m_MoveData[MovNum].iGate].iX1 == this->m_GateData[this->m_MoveData[MovNum].iGate].iX2)
        this->m_GateData[this->m_MoveData[MovNum].iGate].iX2++;
    if(this->m_GateData[this->m_MoveData[MovNum].iGate].iY1 == this->m_GateData[this->m_MoveData[MovNum].iGate].iY2)
        this->m_GateData[this->m_MoveData[MovNum].iGate].iY2++;
    
    int FinalX = min(this->m_GateData[this->m_MoveData[MovNum].iGate].iX1,this->m_GateData[this->m_MoveData[MovNum].iGate].iX2)+rand()%(max(this->m_GateData[this->m_MoveData[MovNum].iGate].iX1,this->m_GateData[this->m_MoveData[MovNum].iGate].iX2)-min(this->m_GateData[this->m_MoveData[MovNum].iGate].iX1,this->m_GateData[this->m_MoveData[MovNum].iGate].iX2));
    int FinalY = min(this->m_GateData[this->m_MoveData[MovNum].iGate].iY1,this->m_GateData[this->m_MoveData[MovNum].iGate].iY2)+rand()%(max(this->m_GateData[this->m_MoveData[MovNum].iGate].iY1,this->m_GateData[this->m_MoveData[MovNum].iGate].iY2)-min(this->m_GateData[this->m_MoveData[MovNum].iGate].iY1,this->m_GateData[this->m_MoveData[MovNum].iGate].iY2));

/*    if(gObj->m_PK_Level > 3)
    {
        Messages.outNormal(aIndex,"PK can't use warp menu");
        return;
    }*/

/*    if(IsExistWingItem(aIndex) == 65535 && this->m_GateData[this->m_MoveData[MovNum].iGate].iMapNum == 10)
    {
        //return no wings
        Messages.outNormal(aIndex,"You are currently not able to warp.");
        gObjTeleport(aIndex, gObj->MapNumber, gObj->X,gObj->Y);
        return;
    }*/

    TeleportMap = this->m_GateData[this->m_MoveData[MovNum].iGate].iMapNum;
    gObjTeleport(aIndex, TeleportMap, FinalX,FinalY);
}
MoveReq.h

Code:
#include <windows.h>

#define MAX_MOVES 255
#define MAX_GATES 300

struct MOVEINFODATA
{
    int iIndex;
    char szMoveKor[40];
    char szMoveEng[40];
    int iMoney;
    int iLevel;
    int iGate;
};

struct GATEINFODATA
{
    int iIndex;
    int iType;
    int iMapNum;
    int iX1;
    int iY1;
    int iX2;
    int iY2;
    int iTarget;
    int iDir;
    int iLevel;
};

class CMoveSystem
{
public:
void Init();
void LoadFile(char *filename);
void Insert(int iIndex,char *szMoveKor,char *szMoveEng, int iMoney,int iLevel,int iGate);
MOVEINFODATA m_MoveData[MAX_MOVES];

void InitGate();
void LoadGate(char *filename);
void InsertGate(int iIndex,int iType,int iMapNum, int iX1,int iY1,int iX2,int iY2, int iTarget, int iDir,int iLevel);
GATEINFODATA m_GateData[MAX_GATES];

void Teleport(int aIndex, int MovNum);
}; extern CMoveSystem MoveReq;
SMDToken.h
Code:
#include "StdAfx.h"

static enum SMDToken  
{ 
    NAME,  
    NUMBER,  
    END,  
    COMMAND = '#', 
    LP = '{', 
    RP = '}', 
    COMMA = ',', 
    SEMICOLON = ';', 
    SMD_ERROR 
}; 
 
static FILE     *SMDFile; 
static int    TokenNumber; 
static char     TokenString[100]; 
static SMDToken CurrentToken; 

static SMDToken GetToken() 
{ 
    char ch; 
    TokenString[0] = '\0'; 
 
    do 
    { 
        //X3
        if( (ch = (char)fgetc(SMDFile)) == EOF ) 
            return END; 
 
        //X3
        if( ch == '/' && ( ch = (char)fgetc(SMDFile) ) == '/' )     
        { 
            while( (ch = (char)fgetc(SMDFile)) != '\n' ); 
        } 
    } while( isspace(ch) ); 
     
    char *p, TempString[100]; 
 
    switch(ch) 
    {     
    case '#': 
        p = TokenString; 
        while ( ( (ch = getc(SMDFile) ) != EOF) && (ch!='#'))// || isalnum(ch)) ) 
            *p++ = ch; 
        if (ch!='#') 
            ungetc(ch,SMDFile); 
        *p = 0; 
        return CurrentToken = COMMAND; 
    case ';': 
        return CurrentToken = SEMICOLON; 
    case ',': 
        return CurrentToken = COMMA; 
    case '{': 
        return CurrentToken = LP; 
    case '}': 
        return CurrentToken = RP; 
    case '0':    case '1':    case '2':    case '3':    case '4': 
    case '5':    case '6':    case '7':    case '8':    case '9': 
    case '.':    case '-': 
        ungetc(ch,SMDFile); 
        p = TempString; 
        while ( (  (ch = getc(SMDFile) ) !=EOF) && (ch=='.' || isdigit(ch) || ch=='-') ) 
            *p++ = ch; 
        *p = 0; 
        TokenNumber = (int)atof(TempString); 
        //            sscanf(TempString," %f ",&TokenNumber); 
        return CurrentToken = NUMBER; 
    case '"': 
        p = TokenString; 
        while ( (  (ch = getc(SMDFile) ) !=EOF) && (ch!='"'))// || isalnum(ch)) ) 
            *p++ = ch; 
        if (ch!='"') 
            ungetc(ch,SMDFile); 
        *p = 0; 
        return CurrentToken = NAME; 
    default: 
        if (isalpha(ch))     
        { 
            p = TokenString; 
            *p++ = ch; 
            while ( (  (ch = getc(SMDFile) ) !=EOF) && (ch=='.' || ch=='_' || isalnum(ch)) ) 
                *p++ = ch; 
            ungetc(ch,SMDFile); 
            *p = 0; 
            return CurrentToken = NAME; 
        } 
        return CurrentToken = SMD_ERROR; 
    } 
}
Protocol.cpp
Code:
case 0x8E: //S5 Warp Menu Fix
            MoveReq.Teleport(aIndex,aRecv[8]);
            return true;
DLLMain.cpp
Code:
MoveReq.LoadFile("..//Data//Lang//Kor//Movereq(kor).txt");
MoveReq.LoadGate("..//Data//Gate.txt");
Credits:
DrakeLV - for loading file function
SmallHabit - for making this all working
Google - for SMDToken.h