summaryrefslogtreecommitdiff
path: root/src/map/clif.c
diff options
context:
space:
mode:
authorshennetsind <ind@henn.et>2013-10-24 06:45:48 -0200
committershennetsind <ind@henn.et>2013-10-24 07:03:30 -0200
commite08c05a0f73d6e6ea4fe64a9b91291bc0a002251 (patch)
treeefe8ae89989a63c008db2cf244c9ea1eb93b3711 /src/map/clif.c
parent8b07c677e351056b0d23fbc3726f80829ae4d253 (diff)
downloadhercules-e08c05a0f73d6e6ea4fe64a9b91291bc0a002251.tar.gz
hercules-e08c05a0f73d6e6ea4fe64a9b91291bc0a002251.tar.bz2
hercules-e08c05a0f73d6e6ea4fe64a9b91291bc0a002251.tar.xz
hercules-e08c05a0f73d6e6ea4fe64a9b91291bc0a002251.zip
Added idletime options
There have been requests for the extension of the feature, I was reluctant given more options would cause features relying on the feature to be easier to counter (less accurate), with the modification of the feature to employ options the feature is now configurable at the server owners discretion. Special Thanks to Haruna Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src/map/clif.c')
-rw-r--r--src/map/clif.c46
1 files changed, 42 insertions, 4 deletions
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);
}