diff options
-rw-r--r-- | Changelog-Trunk.txt | 2 | ||||
-rw-r--r-- | conf-tmpl/Changelog.txt | 4 | ||||
-rw-r--r-- | conf-tmpl/log_athena.conf | 24 | ||||
-rw-r--r-- | sql-files/logs.sql | 8 | ||||
-rw-r--r-- | sql-files/main.sql | 2 | ||||
-rw-r--r-- | sql-files/upgrade_svn10580.sql | 1 | ||||
-rw-r--r-- | src/map/atcommand.c | 7 | ||||
-rw-r--r-- | src/map/clif.c | 88 | ||||
-rw-r--r-- | src/map/guild.c | 8 | ||||
-rw-r--r-- | src/map/log.c | 35 | ||||
-rw-r--r-- | src/map/log.h | 2 | ||||
-rw-r--r-- | src/map/party.c | 9 | ||||
-rw-r--r-- | src/map/script.c | 2 |
13 files changed, 100 insertions, 92 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index c98275df3..799c92717 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -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. 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) * Removed the wtf-y mmo_char_fromsql_short() from r2527 [ultramage] * Fixed drops of Thanatos Dolor & Thanatos Odium regarding the quest. [SinSloth] diff --git a/conf-tmpl/Changelog.txt b/conf-tmpl/Changelog.txt index 3f589dfe5..51c0aca9b 100644 --- a/conf-tmpl/Changelog.txt +++ b/conf-tmpl/Changelog.txt @@ -1,4 +1,8 @@ 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 * Can't teleport in kh_dun01 [Playtester] * You can now teleport in jupe_core [Playtester] diff --git a/conf-tmpl/log_athena.conf b/conf-tmpl/log_athena.conf index 67f145718..9edc77b55 100644 --- a/conf-tmpl/log_athena.conf +++ b/conf-tmpl/log_athena.conf @@ -79,22 +79,22 @@ log_gm: 40 // Log NPC 'logmes' commands log_npc: 0 -// Log CHAT (currently only: Party, Guild, Whisper) +// Log CHAT (Global, Whisper, Party, Guild, Main chat) // LOGGING FILTERS [Lupus] //============================================================= -//0 = Don't log at all -//1 = Log any chat messages +//00 = Don't log at all //Advanced Filter Bits: || -//2 - Log Whisper messages -//3 - Log Party messages -//4 - Log Guild messages -//5 - Log Common messages (not implemented) -//6 - Don't log when WOE is on +//01 - Log Global messages +//02 - Log Whisper messages +//04 - Log Party messages +//08 - Log Guild messages +//16 - Log Main chat messages +//32 - Don't log anything when WOE is on //Example: -//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 +//log_chat: 6 = logs both Whisper & Party messages +//log_chat: 8 = logs only Guild messages +//log_chat: 34 = logs only Whisper, when WOE is off +//log_chat: 31 = logs EVERYTHING log_chat: 0 diff --git a/sql-files/logs.sql b/sql-files/logs.sql index 1c7e535c8..e6efe7438 100644 --- a/sql-files/logs.sql +++ b/sql-files/logs.sql @@ -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, # (C)onsumable Items, (A)dministrators Create/Delete, Sto(R)age, (G)uild Storage @@ -93,11 +93,13 @@ CREATE TABLE `npclog` ( INDEX (`char_id`) ) 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` ( `id` bigint(20) NOT NULL auto_increment, `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', `src_charid` int(11) NOT NULL default '0', `src_accountid` int(11) NOT NULL default '0', diff --git a/sql-files/main.sql b/sql-files/main.sql index e86d36e7b..d77b8fb42 100644 --- a/sql-files/main.sql +++ b/sql-files/main.sql @@ -472,7 +472,7 @@ CREATE TABLE `memo` ( DROP TABLE IF EXISTS `party`; CREATE TABLE `party` ( `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', `item` tinyint(11) unsigned NOT NULL default '0', `leader_id` int(11) unsigned NOT NULL default '0', diff --git a/sql-files/upgrade_svn10580.sql b/sql-files/upgrade_svn10580.sql new file mode 100644 index 000000000..65ba0709f --- /dev/null +++ b/sql-files/upgrade_svn10580.sql @@ -0,0 +1 @@ +ALTER TABLE `chatlog` CHANGE `type` `type` ENUM( 'O', 'W', 'P', 'G', 'M' ) NOT NULL DEFAULT 'O'; diff --git a/src/map/atcommand.c b/src/map/atcommand.c index b824774c7..6a903bccf 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -9487,8 +9487,7 @@ int atcommand_clone(const int fd, struct map_session_data* sd, const char* comma /*=================================== * Main chat [LuzZza] * Usage: @main <on|off|message> - *----------------------------------- - */ + *-----------------------------------*/ int atcommand_main(const int fd, struct map_session_data* sd, const char* command, const char* message) { 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 // 0xFF000000 for simple (not colored) GM messages. [LuzZza] 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 { diff --git a/src/map/clif.c b/src/map/clif.c index ce70feaf9..f4dfb0522 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8158,7 +8158,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if (sd->state.rewarp) { //Rewarp player. sd->state.rewarp = 0; - clif_changemap(sd,sd->mapindex,sd->bl.x,sd->bl.y); + clif_changemap(sd, sd->mapindex, sd->bl.x, sd->bl.y); return; } @@ -8178,12 +8178,12 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) clif_inventorylist(sd); // cart - if(pc_iscarton(sd)){ + if(pc_iscarton(sd)) { clif_cartlist(sd); clif_updatestatus(sd,SP_CARTINFO); } - // weight max , now + // weight max, now clif_updatestatus(sd,SP_MAXWEIGHT); clif_updatestatus(sd,SP_WEIGHT); @@ -8206,40 +8206,39 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(sd->status.guild_id) guild_send_memberinfoshort(sd,1); - 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 (!map[sd->bl.m].flag.pvp_nocalcrank) - sd->pvp_timer= add_timer(gettick()+200, - pc_calc_pvprank_timer,sd->bl.id,0); - sd->pvp_rank=0; - sd->pvp_lastusers=0; - sd->pvp_point=5; - sd->pvp_won=0; - sd->pvp_lost=0; + sd->pvp_timer = add_timer(gettick()+200, pc_calc_pvprank_timer, sd->bl.id, 0); + sd->pvp_rank = 0; + sd->pvp_lastusers = 0; + sd->pvp_point = 5; + sd->pvp_won = 0; + sd->pvp_lost = 0; } clif_set0199(fd,1); } else // set flag, if it's a duel [LuzZza] if(sd->duel_group) - clif_set0199(fd, 1); + clif_set0199(fd,1); if (map[sd->bl.m].flag.gvg_dungeon) { - clif_set0199(fd, 1); //TODO: Figure out the real packet to send here. + clif_set0199(fd,1); //TODO: Figure out the real packet to send here. if (!sd->pvp_point) { - sd->pvp_point=5; //Need to die twice to be warped out. - sd->pvp_won=0; - sd->pvp_lost=0; + sd->pvp_point = 5; //Need to die twice to be warped out. + sd->pvp_won = 0; + sd->pvp_lost = 0; } } if(map_flag_gvg(sd->bl.m)) clif_set0199(fd,3); - map_foreachinarea(clif_getareachar,sd->bl.m, - sd->bl.x-AREA_SIZE,sd->bl.y-AREA_SIZE,sd->bl.x+AREA_SIZE,sd->bl.y+AREA_SIZE, - BL_ALL,sd); + map_foreachinarea(clif_getareachar, sd->bl.m, + sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, + BL_ALL, sd); // pet if(sd->pd) { @@ -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. 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; } @@ -8656,40 +8655,47 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) WFIFOSET(fd, WFIFOW(fd,2)); #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(mob_chat_sub, &sd->bl, AREA_SIZE, BL_MOB, message, strlen(message), &sd->bl); #endif - // Celest - if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { //Super Novice. - char buf[256]; + // check for special supernovice phrase + if ((sd->class_&MAPID_UPPERMASK) == MAPID_SUPER_NOVICE) { 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) { case 0: - if (strstr(message, msg_txt(504))) - sd->state.snovice_call_flag++; - break; - case 1: - sprintf(buf, msg_txt(505), sd->status.name); - if (strstr(message, buf)) - sd->state.snovice_call_flag++; - break; + if (strstr(message, msg_txt(504))) // "Guardian Angel, can you hear my voice? ^^;" + sd->state.snovice_call_flag++; + break; + case 1: { + char buf[256]; + sprintf(buf, msg_txt(505), sd->status.name); + if (strstr(message, buf)) // "My name is %s, and I'm a Super Novice~" + sd->state.snovice_call_flag++; + } + break; case 2: - if (strstr(message, msg_txt(506))) - sd->state.snovice_call_flag++; - break; + if (strstr(message, msg_txt(506))) // "Please help me~ T.T" + sd->state.snovice_call_flag++; + break; case 3: if (skillnotok(MO_EXPLOSIONSPIRITS,sd)) break; //Do not override the noskill mapflag. [Skotlex] clif_skill_nodamage(&sd->bl,&sd->bl,MO_EXPLOSIONSPIRITS,-1, sc_start(&sd->bl,SkillStatusChangeTable(MO_EXPLOSIONSPIRITS),100, 17,skill_get_time(MO_EXPLOSIONSPIRITS,1))); //Lv17-> +50 critical (noted by Poki) [Skotlex] - sd->state.snovice_call_flag= 0; - break; + sd->state.snovice_call_flag = 0; + break; } } } + + // 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; } @@ -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); target[NAME_LENGTH]='\0'; - //Chat Logging type 'W' / Whisper - if(log_config.chat&1 //we log everything then - || ( log_config.chat&2 //if Whisper bit is on - && ( !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); + // Chat logging type 'W' / Whisper + if( log_config.chat&2 && !(agit_flag && log_config.chat&32) ) + log_chat("W", 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, msg); //-------------------------------------------------------// // Lordalfa - Paperboy - To whisper NPC commands // diff --git a/src/map/guild.c b/src/map/guild.c index 6b7dcbf65..c5ce246b1 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -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); guild_recv_message(sd->status.guild_id,sd->status.account_id,mes,len); - //Chatlogging type 'G' - if(log_config.chat&1 //we log everything then - || ( log_config.chat&8 //if Guild bit is on - && ( !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); + // Chat logging type 'G' / Guild Chat + if( log_config.chat&8 && !(agit_flag && log_config.chat&32) ) + 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); return 0; } diff --git a/src/map/log.c b/src/map/log.c index 7147d5aed..55124ddca 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -343,25 +343,21 @@ int log_npc(struct map_session_data *sd, const char *message) return 1; } -//ChatLogging -// Log CHAT (currently only: Party, Guild, Whisper) -// LOGGING FILTERS [Lupus] -//============================================================= -//0 = Don't log at all -//1 = Log any chat messages -//Advanced Filter Bits: || -//2 - Log Whisper messages -//3 - Log Party messages -//4 - Log Guild messages -//5 - Log Common messages (not implemented) -//6 - Don't log when WOE is on -//Example: -//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){ + +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] + //============================================================= + //00 = Don't log at all + //Advanced Filter Bits: || + //01 - Log Global messages + //02 - Log Whisper messages + //04 - Log Party messages + //08 - Log Guild messages + //16 - Log Main chat messages + //32 - Don't log anything when WOE is on + FILE *logfp; #ifndef TXT_ONLY 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; time(&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", timestring, type, type_id, src_charid, src_accid, map, x, y, dst_charname, message, RETCODE); fclose(logfp); diff --git a/src/map/log.h b/src/map/log.h index 9f82f61a2..753ec9812 100644 --- a/src/map/log.h +++ b/src/map/log.h @@ -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_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); //Old, but useful logs diff --git a/src/map/party.c b/src/map/party.c index eae29138a..87f75633b 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -573,11 +573,10 @@ int party_send_message(struct map_session_data *sd,char *mes,int len) return 0; 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); - //Chat Logging support Type 'P' - if(log_config.chat&1 //we log everything then - || (log_config.chat&4 //if Party bit is on - && ( !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, (char*)mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, NULL, mes); + + // Chat logging type 'P' / Party Chat + if( log_config.chat&4 && !(agit_flag && log_config.chat&32) ) + 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); return 0; } diff --git a/src/map/script.c b/src/map/script.c index 6f956e9e8..ca5f9bc2d 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -5572,7 +5572,7 @@ BUILDIN_FUNC(countitem2) sd->status.inventory[i].amount > 0 && sd->status.inventory[i].nameid == nameid && sd->status.inventory[i].identify == iden && sd->status.inventory[i].refine == ref && sd->status.inventory[i].attribute == attr && sd->status.inventory[i].card[0] == c1 && - sd->status.inventory[i].card[1] == c2 && sd->status.inventory[i].card[2] ==c3 && + sd->status.inventory[i].card[1] == c2 && sd->status.inventory[i].card[2] == c3 && sd->status.inventory[i].card[3] == c4 ) count += sd->status.inventory[i].amount; |