summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-05-19 13:26:02 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-05-19 13:26:02 +0000
commit3bd682b3cb3507c8a57fa6930475808981fd0663 (patch)
treebfcc3b1a81389c080f43778de9e9a2a3285bf9c5 /src/map
parent35874a560ee89397e14eac3e7f40fc0251d67053 (diff)
downloadhercules-3bd682b3cb3507c8a57fa6930475808981fd0663.tar.gz
hercules-3bd682b3cb3507c8a57fa6930475808981fd0663.tar.bz2
hercules-3bd682b3cb3507c8a57fa6930475808981fd0663.tar.xz
hercules-3bd682b3cb3507c8a57fa6930475808981fd0663.zip
* Added Global chat and Main chat logging
- lowered the priority of the 'logging off during gw' filter git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@10580 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c7
-rw-r--r--src/map/clif.c88
-rw-r--r--src/map/guild.c8
-rw-r--r--src/map/log.c35
-rw-r--r--src/map/log.h2
-rw-r--r--src/map/party.c9
-rw-r--r--src/map/script.c2
7 files changed, 75 insertions, 76 deletions
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;