Skip to content

Commit

Permalink
Implemented sitting set of script commands: sit(), stand(), issit() a…
Browse files Browse the repository at this point in the history
…s per suggested in topic #1204. See documentation for more information on these commands.

Also fixed leftover from db_use_sql split.

Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
  • Loading branch information
macabu committed Jul 4, 2013
1 parent 0f2899c commit e8adea6
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
18 changes: 17 additions & 1 deletion doc/script_commands.txt
Expand Up @@ -2493,7 +2493,23 @@ Examples:

// Outputs IP address of character "Silver".
mes "Silver's IP: " + getcharip("Silver");


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

*sit({"<character name>"})
*stand({"<character name>"})

This function will force a character to sit/stand if it is standing/sitting.
If no player is specified, the attached player will be used.

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

*issit({"<character name>"})

This function will return a number depending on the character's sitting state.
If the character is sitting, it will return 1, otherwise (standing) it will return 0.
In case no player is specified, the function will return the state of the attached player.

---------------------------------------
\\
2,2 Item-related commands
Expand Down
3 changes: 3 additions & 0 deletions src/map/mob.c
Expand Up @@ -4591,6 +4591,9 @@ static void mob_load(void)
if (iMap->db_use_sql_mob_db)
{
mob_read_sqldb();
}
if (iMap->db_use_sql_mob_skill_db)
{
mob_read_sqlskilldb();
}
else
Expand Down
59 changes: 59 additions & 0 deletions src/map/script.c
Expand Up @@ -16679,6 +16679,61 @@ BUILDIN(freeloop) {
return true;
}

BUILDIN(sit)
{
struct map_session_data *sd = NULL;

if (script_hasdata(st, 2))
sd = iMap->nick2sd(script_getstr(st, 2));

if (sd == NULL)
sd = script_rid2sd(st);

if (!pc_issit(sd))
{
pc_setsit(sd);
skill->sit(sd,1);
clif->sitting(&sd->bl);
}
return true;
}

BUILDIN(stand)
{
struct map_session_data *sd = NULL;

if (script_hasdata(st, 2))
sd = iMap->nick2sd(script_getstr(st, 2));

if (sd == NULL)
sd = script_rid2sd(st);

if (pc_issit(sd))
{
pc->setstand(sd);
skill->sit(sd,0);
clif->standing(&sd->bl);
}
return true;
}

BUILDIN(issit)
{
struct map_session_data *sd = NULL;

if (script_hasdata(st, 2))
sd = iMap->nick2sd(script_getstr(st, 2));

if (sd == NULL)
sd = script_rid2sd(st);

if (pc_issit(sd))
script_pushint(st, 1);
else
script_pushint(st, 0);
return true;
}

/**
* @commands (script based)
**/
Expand Down Expand Up @@ -17962,6 +18017,10 @@ void script_parse_builtin(void) {

BUILDIN_DEF(packageitem,"?"),

BUILDIN_DEF(sit, "?"),
BUILDIN_DEF(stand, "?"),
BUILDIN_DEF(issit, "?"),

/* New BG Commands [Hercules] */
BUILDIN_DEF(bg_create_team,"sii"),
BUILDIN_DEF(bg_join_team,"i?"),
Expand Down

0 comments on commit e8adea6

Please sign in to comment.