Ultimate eRose-EVO Code Changes

Status
Not open for further replies.
Socius Decennalis
Decennium
Joined
Sep 10, 2006
Messages
138
Reaction score
0
Hi !
To make this forum more readable and to have an overview over all fixes & updates , i decided to make this thread.I'll try to keep it up-to-date everyday, and would be happy if a mod could stickie this :)
Elndor said:
@"tehleechers"

Stop asking for a compiled pack... He won't do it and I don't want him to do it... If you can't add these fixes yourself then dont even have the source code on your computer... Please dont sit around these forums posting in EVERY fk'in thread for people to release their files... Everyone is sick of it so stop -_-;; I will be doing my work and PMing or telling the people worthy of having
DO NOT POST QUESTIONS HERE !!!
ONLY POST CODE YOU MADE/FOUND !!!
PLS FOLLOW THIS TO KEEP THIS POST READABLE !! DO NOT FORGET TO GIVE CREDITS, TOO :P

@MODS: PLS DELETE THE TOPICS WHERE IS NO CODE IN ! (and if the problems are solved)
would be kind of you :) ty in advance

@mods: i will post every new code of me in a NEW reply, so you can link to any reply you want, and people can see there are new updates when i post a new one :)

OK, lets start...

INDEX:
ill keep this index for better overview updated, and split it to categorys.
if you have another category, SEND ME A PM pls.

COMPILE GUIDE:
- BIG TY TO forsaken08


GameMaster-Commands:

-
/item command for GMs (ty to Caali)

- /weapon command for GMs (ty to rl2171)

- /kick command for GMs (ty to Caali)

- /ban command for GMs (ty to Caali)

- /zuly command for GMs (ty to Sander122)

- /level command for GMs (ty to Caali)

- /stat command for GMs (ty to Caali)

- /killinrange command for GMs (a GM-AoE)(ty to Caali)

- /class command for GMs (ty to Caali)

BugFixes:
- Make GM commands only useable for GMs (ty to Caali)

Snippets (small code pieces):
- Make an editable Welcome-Message (ty to Caali)

- Get the EXP-Rate from config.ini (ty to Caali)

Database (spawnzones, etc. ):
- Newest list_npc, list telegates, and a /tele file :) ty to rl2171

Functions (could help you at coding / are needed for my scripts):
- function bool IsMonInCircle(CWorldClient* thisclient, CMonster* thismon, float radius) (check if a monster (thismon) is in a circle with radius (radius) around a player (thisclient) (ty to Caali)

-function CWorldClient* GetClientByCharname( char* name ) (gets a client by its name; returns 0 if it cant find the name) (ty to Caali)

New Things (completely new features):
 
Last edited:
[FIX] Make GM commands only useable for GMs

OPEN: worldpackets.cpp

FIND:
Code:
 // -----------------------------------------------------------------------------------------
 // Normal chating
 // -----------------------------------------------------------------------------------------
 bool CWorldServer::pakNormalChat( CWorldClient* thisclient, CPacket* P )
IN THE FUNCTION, FIND:
Code:
 return pakGMCommand( thisclient, P );
BEFORE, ADD:
Code:
 if ( thisclient->accesslevel == 300 )
 
[SNIPPET] Make an editable Welcome Message

OPEN: worldpackets.cpp

FIND:
Code:
#include "worldsockets.h"
AFTER, ADD:
Code:
#include "../common/config.h"
FIND:
Code:
// -----------------------------------------------------------------------------------------
// Give the user an ID
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakDoID( CWorldClient* thisclient, CPacket* P )
{
IN THE FUNCTION, FIND:
Code:
RESETPACKET( pak, 0x702 );
    ADDSTRING( pak, "Welcome the test server. Have fun!" );
    ADDBYTE( pak, 0 );
    thisclient->SendPacket( &pak );
REPLACE WITH:
Code:
RESETPACKET( pak, 0x702 );
    ADDSTRING( pak, ConfigGetString("config.ini", "welcomemsg", "") );  //send welcomemsg from ini file
    ADDBYTE( pak, 0 );
    thisclient->SendPacket( &pak );
CLOSE: worldpackets.cpp

OPEN config.ini
AT THE END OF THE FILE, ADD:
Code:
welcomemsg=thewelcomemsg_you_want
CLOSE: config.ini

YOU'RE DONE !
 
i said in FAT letters no questions here... if you have a question, pm me man... oh and
i WONT compile this, because i neither want to share ALL my code(compiled) neither to make a new version just for the ones who cant compile...
 
i think u guys need complie and share too much ppl dunno complie
so pls guys if u can complie with all this Fix's and Change's thx ;)
 
/kick #name Command for GMs

OPEN: gmcmds.cpp
FIND:
Code:
 else if (strcmp(command, "ann")==0) 
    {
         return pakGMAnn(thisclient, P);
    }
AFTER, ADD:
Code:
    else if (strcmp(command, "kick")==0)
    {
        if ((tmp = strtok_s(NULL, " ", &next_token))==NULL) return true; char* name=tmp;
        return pakGMKick( thisclient, name );
    }
FIND:
Code:
 // -----------------------------------------------------------------------------------------
// GM: Announcment
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMAnn( CWorldClient* thisclient, CPacket* P )
{
    BEGINPACKET( pak, 0x702 );
    ADDSTRING( pak, thisclient->charname );
    ADDSTRING( pak, ": " );
    ADDSTRING( pak, (&P->Buffer[5]) );
    ADDBYTE( pak, 0 );
    SendToAll( &pak );

    return true;
}
AFTER, ADD:
Code:
// -----------------------------------------------------------------------------------------
// GM: Kick
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMKick( CWorldClient* thisclient, char* name )
{
    CWorldClient* otherclient = GetClientByCharName( name );

    BEGINPACKET( pak, 0x702 );
    ADDSTRING( pak, "You were kicked from the server !" );
    ADDBYTE( pak, 0 );
    otherclient->SendPacket( &pak );

    RESETPACKET( pak, 0x707 );
    ADDWORD( pak, 0 );
    otherclient->SendPacket( &pak );

    otherclient->isActive = false;

    return true;
}
CLOSE: gmcmds.cpp

OPEN: worldsockets.h
FIND:
Code:
 [LEFT]bool pakGMAnn            ( CWorldClient* thisclient, CPacket* P );[/LEFT]
AFTER, ADD:
Code:
    bool pakGMKick            ( CWorldClient* thisclient, char* name );
 
/level command for GMs

THIS NEEDS THE FUNCTION:
- GetClientByCharName (ty to Caali)

OPEN: gmcmds.cpp
FIND:
Code:
 else if (strcmp(command, "ann")==0) 
     {
          return pakGMAnn(thisclient, P);
     }

AFTER, ADD:
Code:
else if (strcmp(command, "level")==0) 
    {
        if ((tmp = strtok_s(NULL, " ", &next_token))==NULL) return true; unsigned level=atoi(tmp);
        return pakGMLevel( thisclient, level );
    }
FIND:
Code:
 // -----------------------------------------------------------------------------------------
 // GM: Announcment
 // -----------------------------------------------------------------------------------------
 bool CWorldServer::pakGMAnn( CWorldClient* thisclient, CPacket* P )
 {
     BEGINPACKET( pak, 0x702 );
     ADDSTRING( pak, thisclient->charname );
     ADDSTRING( pak, ": " );
     ADDSTRING( pak, (&P->Buffer[5]) );
     ADDBYTE( pak, 0 );
     SendToAll( &pak );
 
     return true;
 }
AFTER, ADD:
Code:
// -----------------------------------------------------------------------------------------
// GM: Level
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMLevel( CWorldClient* thisclient, unsigned level )
{
    thisclient->c_level = level;
    thisclient->c_exp = 0;
    thisclient->c_currenthp = thisclient->GetMaxHP();
    thisclient->c_currentmp = thisclient->GetMaxMP();

    BEGINPACKET( pak, 0x79e );
    ADDWORD( pak, thisclient->clientid );
    ADDWORD( pak, thisclient->c_level );
    ADDDWORD( pak, thisclient->c_statpoints );
    ADDDWORD( pak, thisclient->c_skillpoints );
    thisclient->SendPacket( &pak );

    RESETPACKET( pak, 0x79e );
    ADDWORD( pak, thisclient->clientid );
    SendToVisible( &pak, thisclient );
    return true;
}
CLOSE: gmcmds.cpp

OPEN: worldsockets.h
FIND:
Code:
  [LEFT]bool pakGMAnn            ( CWorldClient* thisclient, CPacket* P );[/LEFT]

AFTER, ADD:

Code:
    bool pakGMLevel            ( CWorldClient* thisclient, unsigned level );
 
Last edited:
CWorldClient* otherclient = GetClientByCharName( name );
I dont have the function GetClientByCharName?
C:\Documents and Settings\Sander\Bureaublad\*****\World Server\gmcmds.cpp(103): CWorldClient* otherclient = GetClientByCharName( name );

-Btw if you give me that function, I can update the zuly code with giving to another player :)
 
GetClientByCharName( char* name )

OPEN: extrafunctions.cpp

FIND:
Code:
 // -----------------------------------------------------------------------------------------
// Get a client based on the clientID
// -----------------------------------------------------------------------------------------
CWorldClient* CWorldServer::GetClientByID( unsigned id )
{
    for(unsigned j=0; j<ClientList.size(); j++) {
        CWorldClient* thisclient = (CWorldClient*)ClientList.at( j );
        if (thisclient->clientid==id) return thisclient;
    }

    // Hmm, ****, couldent find it
    return 0;
}
AFTER, ADD:
Code:
// -----------------------------------------------------------------------------------------
// Get a client based on the CharName
// -----------------------------------------------------------------------------------------
CWorldClient* CWorldServer::GetClientByCharName( char* name )
{
    CWorldClient* otherclient;
    for(unsigned j=0; j<ClientList.size(); j++) 
    {
        otherclient = (CWorldClient*)ClientList.at( j );
        if (strcmp( otherclient->charname, name )==0) 
        {
            return otherclient;
        }
    }
    // Hmm, ****, couldent find it
    return 0;
}
CLOSE: extrafunctions.cpp

OPEN: worldsockets.h

FIND:
Code:
 CWorldClient* GetClientByID( unsigned id );
AFTER, ADD:
Code:
    CWorldClient* GetClientByCharName( char* name );
CLOSE: worldsockets.h

 
Last edited:
/ban #name command for GMs

THIS NEEDS THE FUNCTION:
- GetClientByCharName (ty to Caali) (Ultimate eRose-EVO Fix&Changes Database)

OPEN: gmcmds.cpp
FIND:

Code:
else if (strcmp(command, "ann")==0) 
     {
          return pakGMAnn(thisclient, P);
     }
AFTER, ADD:
Code:
    else if (strcmp(command, "ban")==0)
    {
        if ((tmp = strtok_s(NULL, " ", &next_token))==NULL) return true; char* name=tmp;
        return pakGMBan( thisclient, name );
    }
FIND:
Code:
 // -----------------------------------------------------------------------------------------
 // GM: Announcment
 // -----------------------------------------------------------------------------------------
 bool CWorldServer::pakGMAnn( CWorldClient* thisclient, CPacket* P )
 {
     BEGINPACKET( pak, 0x702 );
     ADDSTRING( pak, thisclient->charname );
     ADDSTRING( pak, ": " );
     ADDSTRING( pak, (&P->Buffer[5]) );
     ADDBYTE( pak, 0 );
     SendToAll( &pak );
 
     return true;
 }
AFTER, ADD:
Code:
// -----------------------------------------------------------------------------------------
// GM: Ban
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMBan( CWorldClient* thisclient, char* name )
{
    CWorldClient* otherclient = GetClientByCharName( name );

    otherclient->accesslevel = -1;
    DoSQL( "UPDATE accounts SET accesslevel='-1' WHERE id=%i", otherclient->userid);

    BEGINPACKET( pak, 0x702 );
    ADDSTRING( pak, "You were banned from the server !" );
    ADDBYTE( pak, 0 );
    otherclient->SendPacket( &pak );

    RESETPACKET( pak, 0x707 );
    ADDWORD( pak, 0 );
    otherclient->SendPacket( &pak );

    otherclient->isActive = false;

    return true;
}
CLOSE: gmcmds.cpp

OPEN: worldsockets.h
FIND:
Code:
bool pakGMAnn            ( CWorldClient* thisclient, CPacket* P );
AFTER, ADD:
Code:
bool pakGMBan            ( CWorldClient* thisclient, char* name );
 
Last edited:
/stat #statname #value command for GMs !

NOTE: THE PARAMS FOR THIS COMMAND ARE LIKE:
/stat Str 999 ! look at the code for name of the other stats !

OPEN: gmcmds.cpp
FIND:
Code:
 [LEFT] else if (strcmp(command, "ann")==0) 
    {
         return pakGMAnn(thisclient, P);
    }[/LEFT]
AFTER, ADD:
Code:
    else if (strcmp(command, "stat")==0)
    {
        if ((tmp = strtok_s(NULL, " ", &next_token))==NULL) return true; char* statname =(char*)tmp;
        if ((tmp = strtok_s(NULL, " ", &next_token))==NULL) return true; int statvalue    = atoi(tmp);
        return pakGMStat( thisclient , statname , statvalue);
    }
FIND:
Code:
// -----------------------------------------------------------------------------------------
// GM: Announcment
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMAnn( CWorldClient* thisclient, CPacket* P )
{
    BEGINPACKET( pak, 0x702 );
    ADDSTRING( pak, thisclient->charname );
    ADDSTRING( pak, ": " );
    ADDSTRING( pak, (&P->Buffer[5]) );
    ADDBYTE( pak, 0 );
    SendToAll( &pak );

    return true;
}
AFTER, ADD:
Code:
// -----------------------------------------------------------------------------------------
// GM: Stats
// -----------------------------------------------------------------------------------------
bool CWorldServer::pakGMStat( CWorldClient* thisclient, char* statname, int statvalue )
{
    int statid;
    if (strcmp( statname, "Str" )==0) 
    {
        thisclient->c_str = statvalue;
        statid = 0;
    }
    else if (strcmp( statname, "Dex" )==0) 
    {
        thisclient->c_dex = statvalue;
        statid = 1;
    }
    else if (strcmp( statname, "Int" )==0) 
    {
        thisclient->c_int = statvalue;
        statid = 2;
    }
    else if (strcmp( statname, "Con" )==0) 
    {
        thisclient->c_con = statvalue;
        statid = 3;
    }
    else if (strcmp( statname, "Cha" )==0) 
    {
        thisclient->c_cha = statvalue;
        statid = 4;
    }
    else if (strcmp( statname, "Sen" )==0) 
    {
        thisclient->c_sen = statvalue;
        statid = 5;
    }
    else
    {
        return true;
    }
    BEGINPACKET( pak, 0x7a9 );
    ADDBYTE( pak, statid );
    ADDWORD( pak, (unsigned short)statvalue );
    thisclient->SendPacket( &pak );

    return true;
}
CLOSE: gmcmds.cpp

OPEN: worldsockets.h
FIND:
Code:
 [LEFT][LEFT]bool pakGMAnn            ( CWorldClient* thisclient, CPacket* P );[/LEFT]
[/LEFT]
AFTER, ADD:
Code:
    bool pakGMStat            ( CWorldClient* thisclient, char* statname, int statvalue );
 
[SNIPPET] Change EXP-Rate to config.ini

OPEN: worldserver.cpp

FIND:
Code:
#include "worldsockets.h"

AFTER, ADD:
Code:
#include "../common/config.h"

FIND:
Code:
    // -------------- GIVE OUT EXP/ITEMS/RESPAWN --------------

AFTER, ADD:
Code:
   int exprate  = ConfigGetInt ( "config.ini" , "exprate"  , 1 );

FIND:
Code:
 thisclient->c_exp += STB_NPC.rows[thismon->montype][17] * EXPRATE;

REPLACE WITH:
Code:
thisclient->c_exp += STB_NPC.rows[thismon->montype][17] * exprate;

CLOSE: worldserver.cpp

OPEN: worldsockets.h

FIND AND REMOVE:
Code:
#define EXPRATE 25

CLOSE: worldsockets.h

YOU'RE DONE !








 
lol :D i'm just posting mine. i got like 20 or so at all :P like /teletoplayer /teleplayertome etc...
ill post the rest later :P well, k ill post some changes to the main game :P
 
Status
Not open for further replies.
Back