summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--conf/battle/player.conf17
-rw-r--r--src/map/atcommand.c3
-rw-r--r--src/map/battle.c1
-rw-r--r--src/map/battle.h16
-rw-r--r--src/map/clif.c46
-rw-r--r--src/map/unit.c2
6 files changed, 79 insertions, 6 deletions
diff --git a/conf/battle/player.conf b/conf/battle/player.conf
index 436399469..5e6c9afda 100644
--- a/conf/battle/player.conf
+++ b/conf/battle/player.conf
@@ -5,6 +5,7 @@
//--------------------------------------------------------------
// Note 1: Value is a config switch (on/off, yes/no or 1/0)
// Note 2: Value is in percents (100 means 100%)
+// Note 3: Value is a bit field.
//--------------------------------------------------------------
// Players' maximum HP rate? (Default is 100)
@@ -148,3 +149,19 @@ min_npc_vendchat_distance: 3
// Changing snovice_call_type config to 1 enables its use at 0%, for maxed super novices.
// default: 0
snovice_call_type: 0
+
+// How the server should measure the character's idle time? (Note 3)
+// 0x001 - Walk Request
+// 0x002 - UseSkillToID Request ( targetted skill use attempt )
+// 0x004 - UseSkillToPos Request ( aoe skill use attempt )
+// 0x008 - UseItem Request ( including equip/unequip )
+// 0x010 - Attack Request
+// 0x020 - Chat Request ( whisper, party, guild, bg, etca )
+// 0x040 - Sit/Standup Request
+// 0x080 - Emotion Request
+// 0x100 - DropItem Request
+// 0x200 - @/#Command Request
+// Please note that at least 1 option has to be enabled.
+// Be mindful that the more options used, the easier it becomes to cheat features that rely on idletime (e.g. checkidle()).
+// Default: walk ( 0x1 ) + useskilltoid ( 0x2 ) + useskilltopos ( 0x4 ) + useitem ( 0x8 ) + attack ( 0x10 ) = 0x25
+idletime_criteria: 0x25
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 19128083d..27fbb7218 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -9664,6 +9664,9 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
sprintf(atcmd_msg, "%s", message);
}
+ if( battle_config.idletime_criteria & BCIDLE_ATCOMMAND )
+ sd->idletime = last_tick;
+
//Clearing these to be used once more.
memset(command, '\0', sizeof(command));
memset(params, '\0', sizeof(params));
diff --git a/src/map/battle.c b/src/map/battle.c
index 0406500b7..050f3f26e 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -6470,6 +6470,7 @@ static const struct _battle_data {
{ "guild_notice_changemap", &battle_config.guild_notice_changemap, 2, 0, 2, },
{ "feature.banking", &battle_config.feature_banking, 1, 0, 1, },
{ "feature.auction", &battle_config.feature_auction, 0, 0, 2, },
+ { "idletime_criteria", &battle_config.idletime_criteria, 0x25, 1, INT_MAX, },
{ "mon_trans_disable_in_gvg", &battle_config.mon_trans_disable_in_gvg, 0, 0, 1, },
};
diff --git a/src/map/battle.h b/src/map/battle.h
index 1aa07b2be..a2212a647 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -454,7 +454,7 @@ struct Battle_Config {
int max_walk_path;
int item_enabled_npc;
int packet_obfuscation;
-
+ int idletime_criteria;
int gm_ignore_warpable_area;
int client_accept_chatdori; // [Ai4rei/Mirei]
@@ -467,6 +467,20 @@ struct Battle_Config {
int mon_trans_disable_in_gvg;
} battle_config;
+/* criteria for battle_config.idletime_critera */
+enum e_battle_config_idletime {
+ BCIDLE_WALK = 0x001,
+ BCIDLE_USESKILLTOID = 0x002,
+ BCIDLE_USESKILLTOPOS = 0x004,
+ BCIDLE_USEITEM = 0x008,
+ BCIDLE_ATTACK = 0x010,
+ BCIDLE_CHAT = 0x020,
+ BCIDLE_SIT = 0x040,
+ BCIDLE_EMOTION = 0x080,
+ BCIDLE_DROPITEM = 0x100,
+ BCIDLE_ATCOMMAND = 0x200,
+};
+
// Dammage delayed info
struct delay_damage {
int src_id;
diff --git a/src/map/clif.c b/src/map/clif.c
index 7aacd8e90..9c740d607 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -9917,6 +9917,9 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd)
}
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
if( sd->gcbind ) {
clif->chsys_send(sd->gcbind,sd,message);
return;
@@ -10077,6 +10080,9 @@ void clif_parse_Emotion(int fd, struct map_session_data *sd)
return;
}
sd->emotionlasttime = time(NULL);
+
+ if( battle_config.idletime_criteria & BCIDLE_EMOTION )
+ sd->idletime = last_tick;
if(battle_config.client_reshuffle_dice && emoticon>=E_DICE1 && emoticon<=E_DICE6) {// re-roll dice
emoticon = rnd()%6+E_DICE1;
@@ -10151,7 +10157,8 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
}
pc->delinvincibletimer(sd);
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_ATTACK )
+ sd->idletime = last_tick;
unit->attack(&sd->bl, target_id, action_type != 0);
break;
case 0x02: // sitdown
@@ -10175,6 +10182,9 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
)) //No sitting during these states either.
break;
+ if( battle_config.idletime_criteria & BCIDLE_SIT )
+ sd->idletime = last_tick;
+
pc_setsit(sd);
skill->sit(sd,1);
clif->sitting(&sd->bl);
@@ -10185,6 +10195,10 @@ void clif_parse_ActionRequest_sub(struct map_session_data *sd, int action_type,
clif->standing(&sd->bl);
return;
}
+
+ if( battle_config.idletime_criteria & BCIDLE_SIT )
+ sd->idletime = last_tick;
+
pc->setstand(sd);
skill->sit(sd,0);
clif->standing(&sd->bl);
@@ -10376,6 +10390,9 @@ void clif_parse_WisMessage(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
// Chat logging type 'W' / Whisper
logs->chat(LOG_CHAT_WHISPER, 0, sd->status.char_id, sd->status.account_id, mapindex_id2name(sd->mapindex), sd->bl.x, sd->bl.y, target, message);
@@ -10594,6 +10611,9 @@ void clif_parse_DropItem(int fd, struct map_session_data *sd)
if (!pc->dropitem(sd, item_index, item_amount))
break;
+ if( battle_config.idletime_criteria & BCIDLE_DROPITEM )
+ sd->idletime = last_tick;
+
return;
}
@@ -10619,7 +10639,8 @@ void clif_parse_UseItem(int fd, struct map_session_data *sd)
return;
//Whether the item is used or not is irrelevant, the char ain't idle. [Skotlex]
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_USEITEM )
+ sd->idletime = last_tick;
n = RFIFOW(fd,packet_db[RFIFOW(fd,0)].pos[0])-2;
if(n <0 || n >= MAX_INVENTORY)
@@ -10664,6 +10685,9 @@ void clif_parse_EquipItem(int fd,struct map_session_data *sd)
return;
}
+ if( battle_config.idletime_criteria & BCIDLE_USEITEM )
+ sd->idletime = last_tick;
+
//Client doesn't send the position for ammo.
if(sd->inventory_data[index]->type == IT_AMMO)
pc->equipitem(sd,index,EQP_AMMO);
@@ -10781,6 +10805,9 @@ void clif_parse_UnequipItem(int fd,struct map_session_data *sd)
index = RFIFOW(fd,2)-2;
+ if( battle_config.idletime_criteria & BCIDLE_USEITEM )
+ sd->idletime = last_tick;
+
pc->unequipitem(sd,index,1);
}
@@ -11330,7 +11357,8 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd)
}
// Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_USESKILLTOID )
+ sd->idletime = last_tick;
if( sd->npc_id || sd->state.workinprogress&1 ){
#ifdef RENEWAL
@@ -11430,7 +11458,8 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski
#endif
//Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex]
- sd->idletime = last_tick;
+ if( battle_config.idletime_criteria & BCIDLE_USESKILLTOPOS )
+ sd->idletime = last_tick;
if( skill->not_ok(skill_id, sd) )
return;
@@ -12185,6 +12214,9 @@ void clif_parse_PartyMessage(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
party->send_message(sd, text, textlen);
}
@@ -13140,6 +13172,9 @@ void clif_parse_GuildMessage(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
if( sd->bg_id )
bg->send_message(sd, text, textlen);
else
@@ -16077,6 +16112,9 @@ void clif_parse_BattleChat(int fd, struct map_session_data* sd)
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
+ if( battle_config.idletime_criteria & BCIDLE_CHAT )
+ sd->idletime = last_tick;
+
bg->send_message(sd, text, textlen);
}
diff --git a/src/map/unit.c b/src/map/unit.c
index a7aca10b9..a9cbd605e 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1915,7 +1915,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, unsigned int tick)
}
if(ud->state.attack_continue) {
- if( src->type == BL_PC )
+ if( src->type == BL_PC && battle_config.idletime_criteria & BCIDLE_ATTACK )
((TBL_PC*)src)->idletime = last_tick;
ud->attacktimer = timer->add(ud->attackabletime,unit->attack_timer,src->id,0);
}