Skip to content

Commit

Permalink
Add has_autoloot script command (rathena#7972)
Browse files Browse the repository at this point in the history
* Adds the has_autoloot script command to check if a player is autolooting items.
  • Loading branch information
Emistry authored Nov 6, 2023
1 parent 2cfafe4 commit a161690
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
8 changes: 8 additions & 0 deletions doc/script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11359,3 +11359,11 @@ Note: Only works with classes that use the ranking system.
Returns true if the player is dead else false.

---------------------------------------

*has_autoloot({<char_id>});

This command checks whether a player configured autoloot.
Returns current autoloot value on success.

---------------------------------------

19 changes: 19 additions & 0 deletions src/map/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26939,6 +26939,24 @@ BUILDIN_FUNC(macro_detector) {
return SCRIPT_CMD_SUCCESS;
}

// ===================================
// *has_autoloot({<char_id>});
// This command checks whether a player configured autoloot.
// Returns current autoloot value on success.
// ===================================
BUILDIN_FUNC(has_autoloot) {
map_session_data *sd;

if (!script_charid2sd(2, sd)) {
script_pushint(st, 0);
return SCRIPT_CMD_FAILURE;
}

script_pushint(st, sd->state.autoloot);

return SCRIPT_CMD_SUCCESS;
}

#include <custom/script.inc>

// declarations that were supposed to be exported from npc_chat.cpp
Expand Down Expand Up @@ -27694,6 +27712,7 @@ struct script_function buildin_func[] = {
BUILDIN_DEF(getfamerank, "?"),
BUILDIN_DEF(isdead, "?"),
BUILDIN_DEF(macro_detector, "?"),
BUILDIN_DEF(has_autoloot,"?"),

#include <custom/script_def.inc>

Expand Down

0 comments on commit a161690

Please sign in to comment.