[SAMMELTHREAD] Game Source Changes

01/02/2014 09:29 RaiN..#91
im feeling like the fifth wheel right now but meh..go on
we got a bunch of crappy code lines and this doenst help..this wont.
why are you even trying?
you're bitching on each other like you're getting something back..isnt worth at all.
No one gonna post a serious mod..not even remotely.
So why are you complaining each other with some mixed languages

(it's so fucking bad, in order to do something that last..you gotta focus on a language since we aren't all german and we "can't" understand...well..
if you have the need to speak in nazist make your own topic ..
this was started and stated as english one)


just one moar thought:
why should you/we help others?
i mean...some people here can't even compile the source but they're still claiming help.
what gonna happen once they'll have 1 or more problems?
these guys are the one who open "garbage-servers" which most likely end up in a week or two, making metin2-private server dirty.
that's pretty much everything i guess... just got up so i could have missed something.
01/02/2014 10:03 Adasaurus#92
Quote:
Originally Posted by Zonni View Post
This little enhancement can be use to record every whisper in game (useful stuff for GameMasters).

Firstly include db.h in input_main.cpp.

Secondly find 502 line in input_main.cpp (shown under)
Code:
if (LC_IsEurope() != true)
{
	sys_log(0, "WHISPER: %s -> %s : %s", ch->GetName(), pinfo->szNameTo, buf);
}
And simply replace with this:
Code:
if (LC_IsEurope() == true) {
	char szQuery_WLog[1024+1];
	snprintf(szQuery_WLog, sizeof(szQuery_WLog), "INSERT INTO whispers (from_msg, to_msg, msg_text) VALUES ('%s', '%s', '%s');", ch->GetName(), pinfo->szNameTo, buf);
	std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery_WLog));
}

Finally execute this query in player database:
Code:
CREATE TABLE `whispers` (
`id`  int(20) NOT NULL AUTO_INCREMENT ,
`from`  varchar(24) NOT NULL DEFAULT 'error' ,
`to`  varchar(24) NOT NULL DEFAULT 'error' ,
`msg`  varchar(250) NOT NULL DEFAULT 'empty_msg_error' ,
PRIMARY KEY (`id`)
);
CHANGE COLUMN `from` `from_msg`  varchar(24) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'error' AFTER `id`,
CHANGE COLUMN `to` `to_msg`  varchar(24) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'error' AFTER `from_msg`,
CHANGE COLUMN `msg` `msg_text`  varchar(250) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT 'empty_msg_error' AFTER `to_msg`;



Well done, you have Whisper log in your server (i'm not sure it right works, because i dont know what collation i must set in mysql so - MARKED AS UNTESTED but should work without any problem.)

Or change the line
Code:
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery_WLog));
with
Code:
std::auto_ptr<SQLMsg> pmsg(LogManager::instance().Query(szQuery_WLog));
To the table 'whispers' in log database?
01/02/2014 14:17 Zonni#93
Quote:
Originally Posted by Adasaurus View Post
Or change the line
Code:
std::auto_ptr<SQLMsg> pmsg(DBManager::instance().DirectQuery(szQuery_WLog));
with
Code:
std::auto_ptr<SQLMsg> pmsg(LogManager::instance().Query(szQuery_WLog));
To the table 'whispers' in log database?
I'm not sure, try ;)

BTW. If your mysql user which is set in config file have access to the log and player databases, simply change "INSERT INTO whispers" to "INSERT INTO log.whispers" and should work & save in log database ;)
01/02/2014 15:05 RageAtMeBros#94
Quote:
Originally Posted by Zonni View Post
I'm not sure, try ;)

BTW. If your mysql user which is set in config file have access to the log and player databases, simply change "INSERT INTO whispers" to "INSERT INTO log.whispers" and should work & save in log database ;)
I added a special function at log.cpp calling it, that way you can do the MySQL escape string, or else I could use SQL Injection or other stuff right with PM system.

After ShoutLog add this: (at log.cpp)

Code:
//NEWTHATGUYPT - Whisper Logging Function
void LogManager::WhisperLog(const char * from, const char * to, const char * message)
{
	m_sql.EscapeString(__escape_hint, sizeof(__escape_hint), message, strlen(message));

	Query("INSERT INTO whisper_log (from_msg, to_msg, msg_text) VALUES ('%s', '%s', '%s')", from, to, __escape_hint);
}
At log.h this virtual method:
Code:
//NEWTHATGUYPT - Whisper Logging Function
void		WhisperLog(const char * from, const char * to, const char * message);

And at input main replace:
Code:
if (LC_IsEurope() != true)
{
	sys_log(0, "WHISPER: %s -> %s : %s", ch->GetName(), pinfo->szNameTo, buf);
}
with:
Code:
//NEWTHATGUYPT - Adds Whispers to Log Database
LogManager::instance().WhisperLog(ch->GetName(), pinfo->szNameTo, buf)
;

Add this at the database "log":
Code:
DROP TABLE IF EXISTS `whisper_log`;
CREATE TABLE `whisper_log` (
  `id` int(20) NOT NULL AUTO_INCREMENT,
  `time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `from_msg` varchar(24) NOT NULL DEFAULT 'error',
  `to_msg` varchar(24) NOT NULL DEFAULT 'error',
  `msg_text` varchar(250) NOT NULL DEFAULT 'empty_msg_error',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

This way the text will get past by the function that cleans eventual SQL Injection vulnerabilities and other vulnerabilities so you can not do things like:
UPDATE INTO PLAYERS WHERE NAME='MY NAME' GOLD=9999999999


Thanks to Zonni for the idea, this one is completly safe to use guys, enjoy.

Result:
[Only registered and activated users can see links. Click Here To Register...]
01/02/2014 15:39 TheMarv :<#95
You should make sure to remove the calls to the ymir server, or they'll get your ip, or idk what from your computer ;)

Quote:
Originally Posted by xCPx View Post
Das konnte man davor auch schon...
war sogar relativ einfach...

Nur die modelle hätte jemand neu machen müssen
hätte man nicht O.o
man hätte die nur exportieren müssen, würden aber trotzdem gleich aussehen xD
01/02/2014 16:04 RageAtMeBros#96
Quote:
Originally Posted by TheMarv :< View Post
You should make sure to remove the calls to the ymir server, or they'll get your ip, or idk what from your computer ;)



hätte man nicht O.o
man hätte die nur exportieren müssen, würden aber trotzdem gleich aussehen xD
I already posted the bypass to this.

Well, just a quick update with a proof of concept of my brand new quest function named "pc.getlang".

Hope you enjoy and can figure out the infinite aplications of this whole new function:
[Only registered and activated users can see links. Click Here To Register...]


For example, using this and setting the .when files of the quests of the server I could translate the whole NPCs into infinite languages, including the options which I think that is whole new (I have not been much deep into metin2 stuff tho).

I could also for the Missions concatenate the lang + name of the arrays from the gameforge translate.lua to translate the whole server.

Aditionally and recoding part of the client-server architecture I could easily let the NPC names, mob names and so long, aswell as the mob messages and npc messages (the ones who show on top of them), and item_proto messages (like "You recieved Sword+0") at the client side, having a complete multi-language server.
01/02/2014 19:43 TheMarv :<#97
Quote:
Originally Posted by RageAtMeBros View Post
I already posted the bypass to this.

Well, just a quick update with a proof of concept of my brand new quest function named "pc.getlang".

Hope you enjoy and can figure out the infinite aplications of this whole new function:
[Only registered and activated users can see links. Click Here To Register...]


For example, using this and setting the .when files of the quests of the server I could translate the whole NPCs into infinite languages, including the options which I think that is whole new (I have not been much deep into metin2 stuff tho).

I could also for the Missions concatenate the lang + name of the arrays from the gameforge translate.lua to translate the whole server.

Aditionally and recoding part of the client-server architecture I could easily let the NPC names, mob names and so long, aswell as the mob messages and npc messages (the ones who show on top of them), and item_proto messages (like "You recieved Sword+0") at the client side, having a complete multi-language server.
just for the license server, not the rest :)
01/02/2014 19:52 czxx1234#98
When compiling game, pop up errors ;/ :
[Only registered and activated users can see links. Click Here To Register...]
01/02/2014 20:16 RageAtMeBros#99
Quote:
Originally Posted by TheMarv :< View Post
just for the license server, not the rest :)
Tell me exactly where they are please.
01/02/2014 20:24 Läuft bei uns#100
Wie wäre es mal damit den Startpost zu updateb?
01/02/2014 21:08 TheMarv :<#101
Quote:
Originally Posted by RageAtMeBros View Post
Tell me exactly where they are please.
i dont know about the other places, somebody told me that there are more(and I think there are more)
01/02/2014 21:32 ƬheGame#102
The ip from ymir it connects to is "202.31.178.251" but its down (It's not just you! [Only registered and activated users can see links. Click Here To Register...] looks down from here. also no answer to ping.
01/02/2014 21:34 Legend2007#103
Notepad++ and RegEx are your friend.
01/02/2014 21:34 .Inya#104
Quote:
Originally Posted by ƬheGame View Post
The ip from ymir it connects to is "202.31.178.251" but its down (It's not just you! [Only registered and activated users can see links. Click Here To Register...] looks down from here. also no answer to ping.
try the right port ;)
01/02/2014 21:38 lolor2#105
Quote:
Originally Posted by ƬheGame View Post
The ip from ymir it connects to is "202.31.178.251" but its down (It's not just you! [Only registered and activated users can see links. Click Here To Register...] looks down from here. also no answer to ping.
it doesnt connect to ymir because
_SERVER_CHECK_
is not defined ....
so dont worry about that ip