Jump to content

C++ EXP Table


Go to solution Solved by flygun,

Recommended Posts

exp_table with text file

	char* tmp2 = new char[64];
	sprintf(tmp2, "locale/%s/exp_table.txt", temp_locale.c_str());
	if ((fp = fopen(tmp2, "r")))
	{
		fprintf(stderr, "~~~> exp_table section begins <~~~n");
		int x = 0;
		while (fgets(buf, 256, fp))
		{
			if(strlen(buf)>0)
			{
				if(*buf == '#')
					continue;
				char lv[32], exp_blank[32];
				two_arguments(buf, lv, sizeof(lv), exp_blank, sizeof(exp_blank));
				long int level = atol(lv);
				long long int exp = atoll(exp_blank);
				if(level > PLAYER_EXP_TABLE_MAX)
					sys_err("Error with reading exp_table.txt! level is bigger than exp table!!!");
				else
				{
					exp_table_common[level - 1] = exp;
					fprintf(stderr, "exp_table override: level %ld exp -> %lldn", level, exp);
				}
				x++;
			}
		}
		fclose(fp);
		fprintf(stderr, "~~~> exp_table section ends <~~~n");
	}
	else
	{
		sys_log(0, "exp_table does not exist: %s", tmp2);
	}
	delete[] tmp2;

exp_table.txt

#This table is incremental! You just can add the values you want to change!
#The structure:
#level exp
#If you want to change something, just add a new line, write down the level you want to modify and then with a space the exp you need at this level.
#1 200000
#6 250000
#4 220000

Source Vanilla :)

  • Love 1
Link to comment
Share on other sites

  • Former Staff
  • Solution

you can do it as following

 

open main.cpp and add 

#include "fstream"

search for
 
PanamaLoad();
 
and add this after it

// START_OF_EXP_TABLE_LOADING
std::string temp_exp_line;
std::ifstream exp_table_open("locale/%s/exptable.txt",g_stServiceName);
  
if (!exp_table_open.is_open())
sys_err("Error:Unable to read exp table/Unable to find it")
    return 0;
  
int exp_table_counter = 0;
while (!exp_table_open.eof())
{
    exp_table_open >> temp_exp_line;
    str_to_number(exp_table_common[exp_table_counter], temp_exp_line.c_str());
    exp_table_counter++;
}
// END_OF_EXP_TABLE_LOADING

go to constants.cpp

 
replace this

const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1] =

{
   ...

};

with this
 

DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1];

go to constants.h
and search for this

extern const DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1];

and replace it with this

extern DWORD exp_table_common[PLAYER_EXP_TABLE_MAX + 1];

0

300
800
1500
2500
4300
7200
11000
17000
24000
33000
43000
58000
76000
100000
130000
169000
219000
283000
365000
472000
610000
705000
813000
937000
1077000
1237000
1418000
1624000
1857000
2122000
2421000
2761000
3145000
3580000
4073000
4632000
5194000
5717000
6264000
6837000
7600000
8274000
8990000
9753000
10560000
11410000
12320000
13270000
14280000
15340000
16870000
18960000
19980000
21420000
22930000
24530000
26200000
27960000
29800000
32780000
36060000
39670000
43640000
48000000
52800000
58080000
63890000
70280000
77310000
85040000
93540000
102900000
113200000
124500000
137000000
150700000
165700000
236990000
260650000
286780000
315380000
346970000
381680000
419770000
461760000
508040000
558740000
614640000
676130000
743730000
1041222000
1145344200
1259878620
1385866482
1524453130
1676898443
1844588288
2029047116
2050000000
2150000000
2210000000
2250000000
2280000000
2310000000
2330000000
2350000000
2370000000
2390000000
2400000000
2410000000
2420000000
2430000000
2440000000
2450000000
2460000000
2470000000
2480000000
2490000000
2490000000
2500000000

 

best regards

  Flygun :)

  • Love 2
Link to comment
Share on other sites

 
compile main.cpp
In file included from main.cpp:63:
SpeedServer.h: In member function 'bool HME::operator<(const HME&) const':
SpeedServer.h:43: warning: suggest parentheses around && within ||
SpeedServer.h: In member function 'bool Date::operator<(const Date&) const':
SpeedServer.h:68: warning: suggest parentheses around && within ||
SpeedServer.h:69: warning: suggest parentheses around && within ||
main.cpp: In function 'int main(int, char**)':
main.cpp:459: error: 'g_stServiceName' was not declared in this scope
main.cpp:463: error: expected `;' before 'return'
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = std::string]':
../../../Extern/include/cryptopp/cryptlib.h:277:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = int]':
../../../Extern/include/cryptopp/cryptlib.h:283:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/gtest/internal/gtest-port.h: In function 'Derived* testing::internal::CheckedDowncastToActualType(Base*) [with Derived = const testing::internal::ValuesInIteratorRangeGenerator<bool>::Iterator, Base = const testing::internal::ParamIteratorInterface<bool>]':
../../../Extern/include/gtest/internal/gtest-param-util.h:321:   instantiated from 'bool testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator::Equals(const testing::internal::ParamIteratorInterface<T>&) const [with T = bool]'
main.cpp:1035:   instantiated from here
../../../Extern/include/gtest/internal/gtest-port.h:1031: warning: dereferencing type-punned pointer will break strict-aliasing rules
Makefile:130: recipe for target 'OBJDIR/main.o' failed
gmake: *** [OBJDIR/main.o] Error 1
Link to comment
Share on other sites

 

g_stServiceName isn't declared.

 

Do this:

std::ifstream exp_table_open("%s/exptable.txt",LocaleService_GetBasePath().c_str());

I have replace it with  std::ifstream exp_table_open("locale/%s/exptable.txt",g_stServiceName); but it come this :

 

 

 
 
compile main.cpp
In file included from main.cpp:64:
SpeedServer.h: In member function 'bool HME::operator<(const HME&) const':
SpeedServer.h:43: warning: suggest parentheses around && within ||
SpeedServer.h: In member function 'bool Date::operator<(const Date&) const':
SpeedServer.h:68: warning: suggest parentheses around && within ||
SpeedServer.h:69: warning: suggest parentheses around && within ||
In file included from main.cpp:95:
check_server.h: In static member function 'static bool CheckServer::CheckIp(const char*)':
check_server.h:24: warning: comparison between signed and unsigned integer expressions
main.cpp: In function 'int main(int, char**)':
main.cpp:554: error: no matching function for call to 'std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(const char [16], const char*)'
/usr/include/c++/4.2/fstream:464: note: candidates are: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2/fstream:450: note:                 std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2/iosfwd:89: note:                 std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(const std::basic_ifstream<char, std::char_traits<char> >&)
main.cpp:558: error: expected `;' before 'return'
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = std::string]':
../../../Extern/include/cryptopp/cryptlib.h:277:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = int]':
../../../Extern/include/cryptopp/cryptlib.h:283:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/gtest/internal/gtest-port.h: In function 'Derived* testing::internal::CheckedDowncastToActualType(Base*) [with Derived = const testing::internal::ValuesInIteratorRangeGenerator<bool>::Iterator, Base = const testing::internal::ParamIteratorInterface<bool>]':
../../../Extern/include/gtest/internal/gtest-param-util.h:321:   instantiated from 'bool testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator::Equals(const testing::internal::ParamIteratorInterface<T>&) const [with T = bool]'
main.cpp:1151:   instantiated from here
../../../Extern/include/gtest/internal/gtest-port.h:1031: warning: dereferencing type-punned pointer will break strict-aliasing rules
Makefile:130: recipe for target 'OBJDIR/main.o' failed
gmake: *** [OBJDIR/main.o] Error 1
Link to comment
Share on other sites

  • Active Member

this

 

if (!exp_table_open.is_open())
sys_err("Error:Unable to read exp table/Unable to find it")
    return 0;
to this:

if (!exp_table_open.is_open())
{
    sys_err("Error:Unable to read exp table/Unable to find it")
    return 0;
}

if (!exp_table_open.is_open())

{

sys_err("Error:Unable to read exp table/Unable to find it");

    return 0;

}

  • Love 1
Link to comment
Share on other sites

New error :

 

compile main.cpp
In file included from main.cpp:64:
SpeedServer.h: In member function 'bool HME::operator<(const HME&) const':
SpeedServer.h:43: warning: suggest parentheses around && within ||
SpeedServer.h: In member function 'bool Date::operator<(const Date&) const':
SpeedServer.h:68: warning: suggest parentheses around && within ||
SpeedServer.h:69: warning: suggest parentheses around && within ||
In file included from main.cpp:95:
check_server.h: In static member function 'static bool CheckServer::CheckIp(const char*)':
check_server.h:24: warning: comparison between signed and unsigned integer expressions
main.cpp: In function 'int main(int, char**)':
main.cpp:554: error: no matching function for call to 'std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(const char [16], const char*)'
/usr/include/c++/4.2/fstream:464: note: candidates are: std::basic_ifstream<_CharT, _Traits>::basic_ifstream(const char*, std::_Ios_Openmode) [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2/fstream:450: note:                 std::basic_ifstream<_CharT, _Traits>::basic_ifstream() [with _CharT = char, _Traits = std::char_traits<char>]
/usr/include/c++/4.2/iosfwd:89: note:                 std::basic_ifstream<char, std::char_traits<char> >::basic_ifstream(const std::basic_ifstream<char, std::char_traits<char> >&)
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = std::string]':
../../../Extern/include/cryptopp/cryptlib.h:277:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = int]':
../../../Extern/include/cryptopp/cryptlib.h:283:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/gtest/internal/gtest-port.h: In function 'Derived* testing::internal::CheckedDowncastToActualType(Base*) [with Derived = const testing::internal::ValuesInIteratorRangeGenerator<bool>::Iterator, Base = const testing::internal::ParamIteratorInterface<bool>]':
../../../Extern/include/gtest/internal/gtest-param-util.h:321:   instantiated from 'bool testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator::Equals(const testing::internal::ParamIteratorInterface<T>&) const [with T = bool]'
main.cpp:1155:   instantiated from here
../../../Extern/include/gtest/internal/gtest-port.h:1031: warning: dereferencing type-punned pointer will break strict-aliasing rules
Makefile:130: recipe for target 'OBJDIR/main.o' failed
gmake: *** [OBJDIR/main.o] Error 1
 
Link to comment
Share on other sites

  • Former Staff

change it for this :)

	// START_OF_Player_EXP_TABLE_LOADING
	string temp_exp_line;
	char szExpTable[256];
	snprintf(szExpTable, sizeof(szExpTable), "%s/Player_Exptable.txt", LocaleService_GetBasePath().c_str());
	ifstream exp_table_open(szExpTable);
	if (!exp_table_open.is_open()) {
		sys_err("Failed to Load ExpTable from %s/Player_Exptable.txt", LocaleService_GetBasePath().c_str());
		return 0;
	}
	int exp_table_counter = 0;
	while (!exp_table_open.eof())
	{
		exp_table_open >> temp_exp_line;
		str_to_number(exp_table_common[exp_table_counter], temp_exp_line.c_str());
		exp_table_counter++;
	}
	sys_log(0, "EXP Table Loaded succsefully from %s", LocaleService_GetBasePath().c_str());
	// END_OF_Player_EXP_TABLE_LOADING
  • Love 1
Link to comment
Share on other sites

 

change it for this :)

	// START_OF_Player_EXP_TABLE_LOADING
	string temp_exp_line;
	char szExpTable[256];
	snprintf(szExpTable, sizeof(szExpTable), "%s/Player_Exptable.txt", LocaleService_GetBasePath().c_str());
	ifstream exp_table_open(szExpTable);
	if (!exp_table_open.is_open()) {
		sys_err("Failed to Load ExpTable from %s/Player_Exptable.txt", LocaleService_GetBasePath().c_str());
		return 0;
	}
	int exp_table_counter = 0;
	while (!exp_table_open.eof())
	{
		exp_table_open >> temp_exp_line;
		str_to_number(exp_table_common[exp_table_counter], temp_exp_line.c_str());
		exp_table_counter++;
	}
	sys_log(0, "EXP Table Loaded succsefully from %s", LocaleService_GetBasePath().c_str());
	// END_OF_Player_EXP_TABLE_LOADING

 

 

Put #include "fstream" at the top.

After include stdafx.h

#done but

 

 
compile main.cpp
In file included from main.cpp:64:
SpeedServer.h: In member function 'bool HME::operator<(const HME&) const':
SpeedServer.h:43: warning: suggest parentheses around && within ||
SpeedServer.h: In member function 'bool Date::operator<(const Date&) const':
SpeedServer.h:68: warning: suggest parentheses around && within ||
SpeedServer.h:69: warning: suggest parentheses around && within ||
In file included from main.cpp:95:
check_server.h: In static member function 'static bool CheckServer::CheckIp(const char*)':
check_server.h:24: warning: comparison between signed and unsigned integer expressions
main.cpp: In function 'int main(int, char**)':
main.cpp:577: error: 'string' was not declared in this scope
main.cpp:577: error: expected `;' before 'temp_exp_line'
main.cpp:580: error: 'ifstream' was not declared in this scope
main.cpp:580: error: expected `;' before 'exp_table_open'
main.cpp:581: error: 'exp_table_open' was not declared in this scope
main.cpp:586: error: 'exp_table_open' was not declared in this scope
main.cpp:588: error: 'temp_exp_line' was not declared in this scope
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = std::string]':
../../../Extern/include/cryptopp/cryptlib.h:277:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = int]':
../../../Extern/include/cryptopp/cryptlib.h:283:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/gtest/internal/gtest-port.h: In function 'Derived* testing::internal::CheckedDowncastToActualType(Base*) [with Derived = const testing::internal::ValuesInIteratorRangeGenerator<bool>::Iterator, Base = const testing::internal::ParamIteratorInterface<bool>]':
../../../Extern/include/gtest/internal/gtest-param-util.h:321:   instantiated from 'bool testing::internal::ValuesInIteratorRangeGenerator<T>::Iterator::Equals(const testing::internal::ParamIteratorInterface<T>&) const [with T = bool]'
main.cpp:1177:   instantiated from here
../../../Extern/include/gtest/internal/gtest-port.h:1031: warning: dereferencing type-punned pointer will break strict-aliasing rules
Makefile:130: recipe for target 'OBJDIR/main.o' failed
gmake: *** [OBJDIR/main.o] Error 1
Link to comment
Share on other sites

  • 1 year later...
On 2.6.2015 at 4:50 PM, flygun said:

after the includes(#include "etcccc.....")

type

 

using namespace std;

can show me someone like me have to do this exactly ... can not well englsich

Spoiler


root@root597430:~/workspace/Server/game/src # gmake -j2
compile BattleArena.cpp
compile OXEvent.cpp
OXEvent.cpp:220:19: warning: null character(s) preserved in literal
In file included from BattleArena.cpp:2:
constants.h:184: error: conflicting declaration 'DWORD exp_table_common [121]'
constants.h:101: error: 'exp_table_common' has a previous declaration as 'const DWORD exp_table_common [121]'
In file included from OXEvent.cpp:2:
constants.h:184: error: conflicting declaration 'DWORD exp_table_common [121]'
constants.h:101: error: 'exp_table_common' has a previous declaration as 'const DWORD exp_table_common [121]'
gmake: *** [Makefile:119: OBJDIR/BattleArena.o] Error 1
gmake: *** Waiting for unfinished jobs....
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = std::string]':
../../../Extern/include/cryptopp/cryptlib.h:277:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
../../../Extern/include/cryptopp/cryptlib.h: In member function 'bool CryptoPP::NameValuePairs::GetValue(const char*, T&) const [with T = int]':
../../../Extern/include/cryptopp/cryptlib.h:283:   instantiated from here
../../../Extern/include/cryptopp/cryptlib.h:264: warning: dereferencing type-punned pointer will break strict-aliasing rules
gmake: *** [Makefile:119: OBJDIR/OXEvent.o] Error 1
root@root597430:~/workspace/Server/game/src #
 

 

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.