summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorsketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-12-18 02:36:01 +0000
committersketchyphoenix <sketchyphoenix@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-12-18 02:36:01 +0000
commit1fe43024299ca9bbe18791a86080b459c96c3227 (patch)
treefb9ab94a9cf0d1ef48b126fa96d1eb27b4f2894c /src/map/script.c
parent25aa6a70d711dbc1da0d02ca5f7ec9f8bd9be54e (diff)
downloadhercules-1fe43024299ca9bbe18791a86080b459c96c3227.tar.gz
hercules-1fe43024299ca9bbe18791a86080b459c96c3227.tar.bz2
hercules-1fe43024299ca9bbe18791a86080b459c96c3227.tar.xz
hercules-1fe43024299ca9bbe18791a86080b459c96c3227.zip
Removed charcommand code while allowing atcommand code to support its functionality.
Charcommands still retain their '#' symbol but now looks for a character name as the first parameter instead of last. Atcommand configs now support charcommand level configurations by comma seperation (e.g. 60,99) As a result of this, all atcommands that don't affect multiple users already (@kickall, @doom, @mapexit) are capable of remote usage. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13403 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 4cc7f36a2..64047d46d 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -37,7 +37,6 @@
#include "party.h"
#include "guild.h"
#include "atcommand.h"
-#include "charcommand.h"
#include "log.h"
#include "unit.h"
#include "pet.h"
@@ -10686,7 +10685,7 @@ BUILDIN_FUNC(atcommand)
cmd++;
}
- is_atcommand_sub(fd, sd, cmd, 99);
+ is_atcommand_sub(fd, sd, cmd, 99, sd->status.name);
return 0;
}
@@ -10695,8 +10694,11 @@ BUILDIN_FUNC(charcommand)
{
TBL_PC dummy_sd;
TBL_PC* sd;
+ TBL_PC* temp_sd;
+ char output[200], temp[200], command[200], charname[NAME_LENGTH], param[200];
int fd;
const char* cmd;
+ const char* message;
cmd = script_getstr(st,2);
@@ -10717,15 +10719,24 @@ BUILDIN_FUNC(charcommand)
}
}
- // compatibility with previous implementation (deprecated!)
- if(cmd[0] != charcommand_symbol)
+ if (*cmd == charcommand_symbol)
{
- cmd += strlen(sd->status.name);
- while(*cmd != charcommand_symbol && *cmd != 0)
- cmd++;
+ if (sscanf(cmd, "%99s \"%23[^\"]\" %99[^\n]", command, charname, param) > 2
+ || sscanf(cmd, "%99s %23s %99[^\n]", command, charname, param) > 2)
+ {
+ if ( (temp_sd = map_nick2sd(charname)) != NULL )
+ {
+ sprintf(output, "%s %s", cmd, param);
+ memcpy(temp, output, sizeof(output));
+ message = temp;
+ is_atcommand_sub(fd,sd,message,99,sd->status.name);
+ }
+ }
+ }
+ else {
+ ShowWarning("script: buildin_charcommand: No '#' symbol!");
+ script_reportsrc(st);
}
-
- is_charcommand_sub(fd, sd, cmd, 99);
return 0;
}