* Added Global chat and Main chat logging

- lowered the priority of the 'logging off during gw' filter

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10580 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
ultramage 2007-05-19 13:26:02 +00:00
parent 90aab65815
commit 16671ef54f
13 changed files with 99 additions and 91 deletions

View File

@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2007/05/19 2007/05/19
* Added Global chat and Main chat logging
- lowered the priority of the 'logging off during gw' filter
* Fixed server crashes when you use long hostnames (/thx to Ancyker) * Fixed server crashes when you use long hostnames (/thx to Ancyker)
* Removed the wtf-y mmo_char_fromsql_short() from r2527 [ultramage] * Removed the wtf-y mmo_char_fromsql_short() from r2527 [ultramage]
* Fixed drops of Thanatos Dolor & Thanatos Odium regarding the quest. [SinSloth] * Fixed drops of Thanatos Dolor & Thanatos Odium regarding the quest. [SinSloth]

View File

@ -1,4 +1,8 @@
Date Added Date Added
2007/05/19
* Enhanced log_athena.conf with global/main chat support [ultramage]
- also changed the filter bit values, please reconfigure this option
2007/04/27 2007/04/27
* Can't teleport in kh_dun01 [Playtester] * Can't teleport in kh_dun01 [Playtester]
* You can now teleport in jupe_core [Playtester] * You can now teleport in jupe_core [Playtester]

View File

@ -79,22 +79,22 @@ log_gm: 40
// Log NPC 'logmes' commands // Log NPC 'logmes' commands
log_npc: 0 log_npc: 0
// Log CHAT (currently only: Party, Guild, Whisper) // Log CHAT (Global, Whisper, Party, Guild, Main chat)
// LOGGING FILTERS [Lupus] // LOGGING FILTERS [Lupus]
//============================================================= //=============================================================
//0 = Don't log at all //00 = Don't log at all
//1 = Log any chat messages
//Advanced Filter Bits: || //Advanced Filter Bits: ||
//2 - Log Whisper messages //01 - Log Global messages
//3 - Log Party messages //02 - Log Whisper messages
//4 - Log Guild messages //04 - Log Party messages
//5 - Log Common messages (not implemented) //08 - Log Guild messages
//6 - Don't log when WOE is on //16 - Log Main chat messages
//32 - Don't log anything when WOE is on
//Example: //Example:
//log_chat: 1 = logs ANY messages
//log_chat: 6 = logs both Whisper & Party messages //log_chat: 6 = logs both Whisper & Party messages
//log_chat: 8 = logs only Guild messages //log_chat: 8 = logs only Guild messages
//log_chat: 18 = logs only Whisper, when WOE is off //log_chat: 34 = logs only Whisper, when WOE is off
//log_chat: 31 = logs EVERYTHING
log_chat: 0 log_chat: 0

View File

@ -1,4 +1,4 @@
#Pick_Log types (M)onsters Drop, (P)layers Drop/Take, Mobs Drop (L)oot Drop/Take, #PickLog types (M)onsters Drop, (P)layers Drop/Take, Mobs Drop (L)oot Drop/Take,
# Players (T)rade Give/Take, Players (V)ending Sell/Take, (S)hop Sell/Take, (N)PC Give/Take, # Players (T)rade Give/Take, Players (V)ending Sell/Take, (S)hop Sell/Take, (N)PC Give/Take,
# (C)onsumable Items, (A)dministrators Create/Delete, Sto(R)age, (G)uild Storage # (C)onsumable Items, (A)dministrators Create/Delete, Sto(R)age, (G)uild Storage
@ -93,11 +93,13 @@ CREATE TABLE `npclog` (
INDEX (`char_id`) INDEX (`char_id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ; ) TYPE=MyISAM AUTO_INCREMENT=1 ;
#ChatLOG #ChatLog types Gl(O)bal,(W)hisper,(P)arty,(G)uild,(M)ain chat
#Database: log
#Table: chatlog
CREATE TABLE `chatlog` ( CREATE TABLE `chatlog` (
`id` bigint(20) NOT NULL auto_increment, `id` bigint(20) NOT NULL auto_increment,
`time` datetime NOT NULL default '0000-00-00 00:00:00', `time` datetime NOT NULL default '0000-00-00 00:00:00',
`type` enum('W','P','G') NOT NULL default 'W', `type` enum('O','W','P','G','M') NOT NULL default 'O',
`type_id` int(11) NOT NULL default '0', `type_id` int(11) NOT NULL default '0',
`src_charid` int(11) NOT NULL default '0', `src_charid` int(11) NOT NULL default '0',
`src_accountid` int(11) NOT NULL default '0', `src_accountid` int(11) NOT NULL default '0',

View File

@ -472,7 +472,7 @@ CREATE TABLE `memo` (
DROP TABLE IF EXISTS `party`; DROP TABLE IF EXISTS `party`;
CREATE TABLE `party` ( CREATE TABLE `party` (
`party_id` int(11) unsigned NOT NULL auto_increment, `party_id` int(11) unsigned NOT NULL auto_increment,
`name` varchar(100) NOT NULL default '', `name` varchar(24) NOT NULL default '',
`exp` tinyint(11) unsigned NOT NULL default '0', `exp` tinyint(11) unsigned NOT NULL default '0',
`item` tinyint(11) unsigned NOT NULL default '0', `item` tinyint(11) unsigned NOT NULL default '0',
`leader_id` int(11) unsigned NOT NULL default '0', `leader_id` int(11) unsigned NOT NULL default '0',

View File

@ -0,0 +1 @@
ALTER TABLE `chatlog` CHANGE `type` `type` ENUM( 'O', 'W', 'P', 'G', 'M' ) NOT NULL DEFAULT 'O';

View File

@ -9487,8 +9487,7 @@ int atcommand_clone(const int fd, struct map_session_data* sd, const char* comma
/*=================================== /*===================================
* Main chat [LuzZza] * Main chat [LuzZza]
* Usage: @main <on|off|message> * Usage: @main <on|off|message>
*----------------------------------- *-----------------------------------*/
*/
int atcommand_main(const int fd, struct map_session_data* sd, const char* command, const char* message) int atcommand_main(const int fd, struct map_session_data* sd, const char* command, const char* message)
{ {
if(strlen(message) > 0) { if(strlen(message) > 0) {
@ -9521,6 +9520,10 @@ int atcommand_main(const int fd, struct map_session_data* sd, const char* comman
// main chat message. 0xFE000000 is invalid color, same using // main chat message. 0xFE000000 is invalid color, same using
// 0xFF000000 for simple (not colored) GM messages. [LuzZza] // 0xFF000000 for simple (not colored) GM messages. [LuzZza]
intif_announce(atcmd_output, strlen(atcmd_output) + 1, 0xFE000000, 0); intif_announce(atcmd_output, strlen(atcmd_output) + 1, 0xFE000000, 0);
// Chat logging type 'M' / Main Chat
if( log_config.chat&16 && !(agit_flag && log_config.chat&32) )
log_chat("M", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message);
} }
} else { } else {

View File

@ -8209,8 +8209,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(map[sd->bl.m].flag.pvp) { if(map[sd->bl.m].flag.pvp) {
if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris] if(!battle_config.pk_mode) { // remove pvp stuff for pk_mode [Valaris]
if (!map[sd->bl.m].flag.pvp_nocalcrank) if (!map[sd->bl.m].flag.pvp_nocalcrank)
sd->pvp_timer= add_timer(gettick()+200, sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0);
pc_calc_pvprank_timer,sd->bl.id,0);
sd->pvp_rank = 0; sd->pvp_rank = 0;
sd->pvp_lastusers = 0; sd->pvp_lastusers = 0;
sd->pvp_point = 5; sd->pvp_point = 5;
@ -8622,7 +8621,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
{ {
//Hacked message, or infamous "client desynch" issue where they pick one char while loading another. //Hacked message, or infamous "client desynch" issue where they pick one char while loading another.
clif_setwaitclose(fd); // Just kick them out to correct it. clif_setwaitclose(fd); // Just kick them out to correct it.
ShowWarning("clif_parse_GlobalMessage: Player '%.*s' sent a messsage using an incorrect name ('%s')! Forcing a relog...", namelen, sd->status.name, message); ShowWarning("clif_parse_GlobalMessage: Player '%.*s' sent a message using an incorrect name ('%s')! Forcing a relog...", namelen, sd->status.name, message);
return; return;
} }
@ -8656,27 +8655,29 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
WFIFOSET(fd, WFIFOW(fd,2)); WFIFOSET(fd, WFIFOW(fd,2));
#ifdef PCRE_SUPPORT #ifdef PCRE_SUPPORT
// trigger listening mobs/npcs
map_foreachinrange(npc_chat_sub, &sd->bl, AREA_SIZE, BL_NPC, message, strlen(message), &sd->bl); map_foreachinrange(npc_chat_sub, &sd->bl, AREA_SIZE, BL_NPC, message, strlen(message), &sd->bl);
map_foreachinrange(mob_chat_sub, &sd->bl, AREA_SIZE, BL_MOB, message, strlen(message), &sd->bl); map_foreachinrange(mob_chat_sub, &sd->bl, AREA_SIZE, BL_MOB, message, strlen(message), &sd->bl);
#endif #endif
// Celest // check for special supernovice phrase
if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { //Super Novice. if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) {
char buf[256];
int next = pc_nextbaseexp(sd); int next = pc_nextbaseexp(sd);
if (next > 0 && (sd->status.base_exp * 1000 / next)% 100 == 0) { if (next > 0 && (sd->status.base_exp * 1000 / next)% 100 == 0) { // 0%, 10%, 20%, ...
switch (sd->state.snovice_call_flag) { switch (sd->state.snovice_call_flag) {
case 0: case 0:
if (strstr(message, msg_txt(504))) if (strstr(message, msg_txt(504))) // "Guardian Angel, can you hear my voice? ^^;"
sd->state.snovice_call_flag++; sd->state.snovice_call_flag++;
break; break;
case 1: case 1: {
char buf[256];
sprintf(buf, msg_txt(505), sd->status.name); sprintf(buf, msg_txt(505), sd->status.name);
if (strstr(message, buf)) if (strstr(message, buf)) // "My name is %s, and I'm a Super Novice~"
sd->state.snovice_call_flag++; sd->state.snovice_call_flag++;
}
break; break;
case 2: case 2:
if (strstr(message, msg_txt(506))) if (strstr(message, msg_txt(506))) // "Please help me~ T.T"
sd->state.snovice_call_flag++; sd->state.snovice_call_flag++;
break; break;
case 3: case 3:
@ -8690,6 +8691,11 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
} }
} }
} }
// Chat logging type 'O' / Global Chat
if( log_config.chat&1 && !(agit_flag && log_config.chat&32) )
log_chat("O", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, message);
return; return;
} }
@ -9003,11 +9009,9 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
memcpy(&target,RFIFOP(fd, 4),NAME_LENGTH); memcpy(&target,RFIFOP(fd, 4),NAME_LENGTH);
target[NAME_LENGTH]='\0'; target[NAME_LENGTH]='\0';
//Chat Logging type 'W' / Whisper // Chat logging type 'W' / Whisper
if(log_config.chat&1 //we log everything then if( log_config.chat&2 && !(agit_flag && log_config.chat&32) )
|| ( log_config.chat&2 //if Whisper bit is on log_chat("W", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, msg);
&& ( !agit_flag || !(log_config.chat&16) ))) //if WOE ONLY flag is off or AGIT is OFF
log_chat("W", 0, sd->status.char_id, sd->status.account_id, (char*)mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, msg);
//-------------------------------------------------------// //-------------------------------------------------------//
// Lordalfa - Paperboy - To whisper NPC commands // // Lordalfa - Paperboy - To whisper NPC commands //

View File

@ -989,11 +989,9 @@ int guild_send_message(struct map_session_data *sd,char *mes,int len)
intif_guild_message(sd->status.guild_id,sd->status.account_id,mes,len); intif_guild_message(sd->status.guild_id,sd->status.account_id,mes,len);
guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len); guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len);
//Chatlogging type 'G' // Chat logging type 'G' / Guild Chat
if(log_config.chat&1 //we log everything then if( log_config.chat&8 && !(agit_flag && log_config.chat&32) )
|| ( log_config.chat&8 //if Guild bit is on log_chat("G", sd->status.guild_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
&& ( !agit_flag || !(log_config.chat&16) ))) //if WOE ONLY flag is off or AGIT is OFF
log_chat("G", sd->status.guild_id, sd->status.char_id, sd->status.account_id, (char*)mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
return 0; return 0;
} }

View File

@ -343,25 +343,21 @@ int log_npc(struct map_session_data *sd, const char *message)
return 1; return 1;
} }
//ChatLogging
// Log CHAT (currently only: Party, Guild, Whisper) int log_chat(const char* type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message)
{
// Log CHAT (Global, Whisper, Party, Guild, Main chat)
// LOGGING FILTERS [Lupus] // LOGGING FILTERS [Lupus]
//============================================================= //=============================================================
//0 = Don't log at all //00 = Don't log at all
//1 = Log any chat messages
//Advanced Filter Bits: || //Advanced Filter Bits: ||
//2 - Log Whisper messages //01 - Log Global messages
//3 - Log Party messages //02 - Log Whisper messages
//4 - Log Guild messages //04 - Log Party messages
//5 - Log Common messages (not implemented) //08 - Log Guild messages
//6 - Don't log when WOE is on //16 - Log Main chat messages
//Example: //32 - Don't log anything when WOE is on
//log_chat: 1 = logs ANY messages
//log_chat: 6 = logs both Whisper & Party messages
//log_chat: 8 = logs only Guild messages
//log_chat: 18 = logs only Whisper, when WOE is off
int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map, int x, int y, char *dst_charname, char *message){
FILE *logfp; FILE *logfp;
#ifndef TXT_ONLY #ifndef TXT_ONLY
char t_charname[NAME_LENGTH*2]; char t_charname[NAME_LENGTH*2];
@ -395,7 +391,6 @@ int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map,
return 0; return 0;
time(&curtime); time(&curtime);
strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime)); strftime(timestring, 254, "%m/%d/%Y %H:%M:%S", localtime(&curtime));
//DATE - type,type_id,src_charid,src_accountid,src_map,src_x,src_y,dst_charname,message
fprintf(logfp, "%s - %s,%d,%d,%d,%s,%d,%d,%s,%s%s", fprintf(logfp, "%s - %s,%d,%d,%d,%s,%d,%d,%s,%s%s",
timestring, type, type_id, src_charid, src_accid, map, x, y, dst_charname, message, RETCODE); timestring, type, type_id, src_charid, src_accid, map, x, y, dst_charname, message, RETCODE);
fclose(logfp); fclose(logfp);

View File

@ -18,7 +18,7 @@ int log_pick_mob(struct mob_data *md, const char *type, int nameid, int amount,
int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount); int log_zeny(struct map_session_data *sd, char *type, struct map_session_data *src_sd, int amount);
int log_npc(struct map_session_data *sd, const char *message); int log_npc(struct map_session_data *sd, const char *message);
int log_chat(char *type, int type_id, int src_charid, int src_accid, char *map, int x, int y, char *dst_charname, char *message); int log_chat(const char* type, int type_id, int src_charid, int src_accid, const char* map, int x, int y, const char* dst_charname, const char* message);
int log_atcommand(struct map_session_data *sd, const char *message); int log_atcommand(struct map_session_data *sd, const char *message);
//Old, but useful logs //Old, but useful logs

View File

@ -573,11 +573,10 @@ int party_send_message(struct map_session_data *sd,char *mes,int len)
return 0; return 0;
intif_party_message(sd->status.party_id,sd->status.account_id,mes,len); intif_party_message(sd->status.party_id,sd->status.account_id,mes,len);
party_recv_message(sd->status.party_id,sd->status.account_id,mes,len); party_recv_message(sd->status.party_id,sd->status.account_id,mes,len);
//Chat Logging support Type 'P'
if(log_config.chat&1 //we log everything then // Chat logging type 'P' / Party Chat
|| (log_config.chat&4 //if Party bit is on if( log_config.chat&4 && !(agit_flag && log_config.chat&32) )
&& ( !agit_flag || !(log_config.chat&16) ))) //if WOE ONLY flag is off or AGIT is OFF log_chat("P", sd->status.party_id, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
log_chat("P", sd->status.party_id, sd->status.char_id, sd->status.account_id, (char*)mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes);
return 0; return 0;
} }