Added additional idle options (#5284)

Previously no NPC interaction was taken into account.
This will be fixed and enabled by default now.
This commit is contained in:
Lemongrass3110 2020-08-08 12:36:28 +02:00 committed by GitHub
parent 9efe3bb534
commit 2d9ef842e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 23 deletions

View File

@ -256,20 +256,25 @@ fame_pharmacy_7: 10
fame_pharmacy_10: 50 fame_pharmacy_10: 50
// How the server should measure the character's idle time? (Note 3) // How the server should measure the character's idle time? (Note 3)
// 0x001 - Walk Request // 0x0001 - Walk Request
// 0x002 - UseSkillToID Request (Targetted skill use attempt) // 0x0002 - UseSkillToID Request (Targetted skill use attempt)
// 0x004 - UseSkillToPos Request (AoE skill use attempt) // 0x0004 - UseSkillToPos Request (AoE skill use attempt)
// 0x008 - UseItem Request (Including equip/unequip) // 0x0008 - UseItem Request (Including equip/unequip)
// 0x010 - Attack Request // 0x0010 - Attack Request
// 0x020 - Chat Request (Whisper, Party, Guild, Battlegrounds, etc) // 0x0020 - Chat Request (Whisper, Party, Guild, Battlegrounds, etc)
// 0x040 - Sit/Standup Request // 0x0040 - Sit/Standup Request
// 0x080 - Emotion Request // 0x0080 - Emotion Request
// 0x100 - DropItem Request // 0x0100 - DropItem Request
// 0x200 - @/#Command Request // 0x0200 - @/#Command Request
// 0x0400 - Closing a NPC window
// 0x0800 - Providing input to a NPC
// 0x1000 - Choosing a NPC menu option
// 0x2000 - Clicking the next button of a NPC
// 0x4000 - Finishing for a NPC progress bar
// Please note that at least 1 option has to be enabled. // 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()). // 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) = 0x1F // Default: walk (0x1) + useskilltoid (0x2) + useskilltopos (0x4) + useitem (0x8) + attack (0x10) + any npc interaction(0x400,0x800,0x1000,0x2000,0x4000) = 0x7C1F
idletime_option: 0x1F idletime_option: 0x7C1F
// Adjust the summoner class' special traits. // Adjust the summoner class' special traits.
// - Summoners belong to brute race category. They have their own race RC_PLAYER_DORAM (11) to be differentiated from monster race RC_BRUTE (2). // - Summoners belong to brute race category. They have their own race RC_PLAYER_DORAM (11) to be differentiated from monster race RC_BRUTE (2).

View File

@ -8923,7 +8923,7 @@ static const struct _battle_data {
{ "fame_pharmacy_10", &battle_config.fame_pharmacy_10, 50, 0, INT_MAX, }, { "fame_pharmacy_10", &battle_config.fame_pharmacy_10, 50, 0, INT_MAX, },
{ "mail_delay", &battle_config.mail_delay, 1000, 1000, INT_MAX, }, { "mail_delay", &battle_config.mail_delay, 1000, 1000, INT_MAX, },
{ "at_monsterignore", &battle_config.autotrade_monsterignore, 0, 0, 1, }, { "at_monsterignore", &battle_config.autotrade_monsterignore, 0, 0, 1, },
{ "idletime_option", &battle_config.idletime_option, 0x1F, 0x1, 0xFFF, }, { "idletime_option", &battle_config.idletime_option, 0x7C1F, 1, 0xFFFF, },
{ "spawn_direction", &battle_config.spawn_direction, 0, 0, 1, }, { "spawn_direction", &battle_config.spawn_direction, 0, 0, 1, },
{ "arrow_shower_knockback", &battle_config.arrow_shower_knockback, 1, 0, 1, }, { "arrow_shower_knockback", &battle_config.arrow_shower_knockback, 1, 0, 1, },
{ "devotion_rdamage_skill_only", &battle_config.devotion_rdamage_skill_only, 1, 0, 1, }, { "devotion_rdamage_skill_only", &battle_config.devotion_rdamage_skill_only, 1, 0, 1, },

View File

@ -11075,6 +11075,11 @@ void clif_parse_progressbar(int fd, struct map_session_data * sd){
sd->progressbar.npc_id = 0; sd->progressbar.npc_id = 0;
sd->progressbar.timeout = 0; sd->progressbar.timeout = 0;
sd->state.workinprogress = WIP_DISABLE_NONE; sd->state.workinprogress = WIP_DISABLE_NONE;
if( battle_config.idletime_option&IDLE_NPC_PROGRESS ){
sd->idletime = last_tick;
}
npc_scriptcont(sd, npc_id, closing); npc_scriptcont(sd, npc_id, closing);
} }
@ -12927,6 +12932,11 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd){
} }
sd->npc_menu = select; sd->npc_menu = select;
if( battle_config.idletime_option&IDLE_NPC_MENU ){
sd->idletime = last_tick;
}
npc_scriptcont(sd,npc_id, false); npc_scriptcont(sd,npc_id, false);
} }
@ -12935,6 +12945,10 @@ void clif_parse_NpcSelectMenu(int fd,struct map_session_data *sd){
/// 00b9 <npc id>.L /// 00b9 <npc id>.L
void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd) void clif_parse_NpcNextClicked(int fd,struct map_session_data *sd)
{ {
if( battle_config.idletime_option&IDLE_NPC_NEXT ){
sd->idletime = last_tick;
}
npc_scriptcont(sd,RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), false); npc_scriptcont(sd,RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), false);
} }
@ -12947,6 +12961,11 @@ void clif_parse_NpcAmountInput(int fd,struct map_session_data *sd){
int amount = (int)RFIFOL(fd,info->pos[1]); int amount = (int)RFIFOL(fd,info->pos[1]);
sd->npc_amount = amount; sd->npc_amount = amount;
if( battle_config.idletime_option&IDLE_NPC_INPUT ){
sd->idletime = last_tick;
}
npc_scriptcont(sd, npcid, false); npc_scriptcont(sd, npcid, false);
} }
@ -12967,6 +12986,11 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd){
#endif #endif
safestrncpy(sd->npc_str, message, min(message_len,CHATBOX_SIZE)); safestrncpy(sd->npc_str, message, min(message_len,CHATBOX_SIZE));
if( battle_config.idletime_option&IDLE_NPC_INPUT ){
sd->idletime = last_tick;
}
npc_scriptcont(sd, npcid, false); npc_scriptcont(sd, npcid, false);
} }
@ -12977,6 +13001,11 @@ void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd)
{ {
if (!sd->npc_id) //Avoid parsing anything when the script was done with. [Skotlex] if (!sd->npc_id) //Avoid parsing anything when the script was done with. [Skotlex]
return; return;
if( battle_config.idletime_option&IDLE_NPC_CLOSE ){
sd->idletime = last_tick;
}
npc_scriptcont(sd, RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), true); npc_scriptcont(sd, RFIFOL(fd,packet_db[RFIFOW(fd,0)].pos[0]), true);
} }

View File

@ -853,16 +853,21 @@ enum ammo_type {
}; };
enum idletime_option { enum idletime_option {
IDLE_WALK = 0x001, IDLE_WALK = 0x0001,
IDLE_USESKILLTOID = 0x002, IDLE_USESKILLTOID = 0x0002,
IDLE_USESKILLTOPOS = 0x004, IDLE_USESKILLTOPOS = 0x0004,
IDLE_USEITEM = 0x008, IDLE_USEITEM = 0x0008,
IDLE_ATTACK = 0x010, IDLE_ATTACK = 0x0010,
IDLE_CHAT = 0x020, IDLE_CHAT = 0x0020,
IDLE_SIT = 0x040, IDLE_SIT = 0x0040,
IDLE_EMOTION = 0x080, IDLE_EMOTION = 0x0080,
IDLE_DROPITEM = 0x100, IDLE_DROPITEM = 0x0100,
IDLE_ATCOMMAND = 0x200, IDLE_ATCOMMAND = 0x0200,
IDLE_NPC_CLOSE = 0x0400,
IDLE_NPC_INPUT = 0x0800,
IDLE_NPC_MENU = 0x1000,
IDLE_NPC_NEXT = 0x2000,
IDLE_NPC_PROGRESS = 0x4000,
}; };
enum adopt_responses { enum adopt_responses {