* Edited atcommand and charcommand syntax. Now it doesn't need the useless character name and ":".
modified Changelog-Trunk.txt modified src/map/atcommand.c modified src/map/atcommand.h modified src/map/charcommand.c modified src/map/charcommand.h modified src/map/clif.c modified src/map/map.c modified src/map/script.c git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@9230 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
b1e1b423f6
commit
3e7a154f59
@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
|
||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||
|
||||
2006/11/16
|
||||
* Edited atcommand and charcommand syntax. Now it doesn't need the useless
|
||||
character name and ":". [Lance]
|
||||
* Shadow Jump and Kirikage won't "move" you if you use them in GvG grounds.
|
||||
Fixed Kirikage so it first warps you, and then you unhide. [Skotlex]
|
||||
* Corrected Zeny Nage so the Zeny spent on the attack is always the exact
|
||||
|
@ -776,37 +776,13 @@ int get_atcommand_level(const AtCommandType type) {
|
||||
return 100; // 100: command can not be used
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
*is_atcommand @コマンドに存在するかどうか確認する
|
||||
*------------------------------------------
|
||||
*/
|
||||
AtCommandType
|
||||
is_atcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl) {
|
||||
const char* str = message;
|
||||
int s_flag = 0;
|
||||
atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl) {
|
||||
AtCommandInfo info;
|
||||
AtCommandType type;
|
||||
|
||||
nullpo_retr(AtCommand_None, sd);
|
||||
|
||||
if (sd->sc.count && sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCOMMAND) {
|
||||
return AtCommand_Unknown;
|
||||
}
|
||||
|
||||
if (!message || !*message)
|
||||
return AtCommand_None;
|
||||
|
||||
malloc_set(&info, 0, sizeof(info));
|
||||
str += strlen(sd->status.name);
|
||||
while (*str && (isspace(*str) || (s_flag == 0 && *str == ':'))) {
|
||||
if (*str == ':')
|
||||
s_flag = 1;
|
||||
str++;
|
||||
}
|
||||
if (!*str)
|
||||
return AtCommand_None;
|
||||
|
||||
if (!gmlvl) gmlvl = pc_isGM(sd);
|
||||
type = atcommand(sd, gmlvl, str, &info);
|
||||
if (type != AtCommand_None) {
|
||||
char command[100];
|
||||
@ -847,6 +823,36 @@ is_atcommand(const int fd, struct map_session_data* sd, const char* message, int
|
||||
return AtCommand_None;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
*is_atcommand @コマンドに存在するかどうか確認する
|
||||
*------------------------------------------
|
||||
*/
|
||||
AtCommandType
|
||||
is_atcommand(const int fd, struct map_session_data* sd, const char* message) {
|
||||
const char* str = message;
|
||||
int s_flag = 0;
|
||||
|
||||
nullpo_retr(AtCommand_None, sd);
|
||||
|
||||
if (sd->sc.count && sd->sc.data[SC_NOCHAT].timer != -1 && sd->sc.data[SC_NOCHAT].val1&MANNER_NOCOMMAND) {
|
||||
return AtCommand_Unknown;
|
||||
}
|
||||
|
||||
if (!message || !*message)
|
||||
return AtCommand_None;
|
||||
|
||||
str += strlen(sd->status.name);
|
||||
while (*str && (isspace(*str) || (s_flag == 0 && *str == ':'))) {
|
||||
if (*str == ':')
|
||||
s_flag = 1;
|
||||
str++;
|
||||
}
|
||||
if (!*str)
|
||||
return AtCommand_None;
|
||||
|
||||
return atcommand_sub(fd,sd,str,pc_isGM(sd));
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------
|
||||
|
@ -299,7 +299,9 @@ typedef struct AtCommandInfo {
|
||||
} AtCommandInfo;
|
||||
|
||||
AtCommandType
|
||||
is_atcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl);
|
||||
is_atcommand(const int fd, struct map_session_data* sd, const char* message);
|
||||
AtCommandType
|
||||
atcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl);
|
||||
|
||||
AtCommandType atcommand(
|
||||
struct map_session_data *sd,
|
||||
|
@ -122,33 +122,13 @@ int get_charcommand_level(const CharCommandType type) {
|
||||
return 100; // 100: command can not be used
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
*is_charcommand @コマンドに存在するかどうか確認する
|
||||
*------------------------------------------
|
||||
*/
|
||||
CharCommandType
|
||||
is_charcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl) {
|
||||
const char* str = message;
|
||||
int s_flag = 0;
|
||||
CharCommandType
|
||||
charcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl) {
|
||||
CharCommandInfo info;
|
||||
CharCommandType type;
|
||||
|
||||
nullpo_retr(CharCommand_None, sd);
|
||||
|
||||
if (!message || !*message)
|
||||
return CharCommand_None;
|
||||
|
||||
malloc_set(&info, 0, sizeof(info));
|
||||
str += strlen(sd->status.name);
|
||||
while (*str && (isspace(*str) || (s_flag == 0 && *str == ':'))) {
|
||||
if (*str == ':')
|
||||
s_flag = 1;
|
||||
str++;
|
||||
}
|
||||
if (!*str)
|
||||
return CharCommand_None;
|
||||
|
||||
if (!gmlvl) gmlvl = pc_isGM(sd);
|
||||
type = charcommand(sd, gmlvl, str, &info);
|
||||
if (type != CharCommand_None) {
|
||||
char command[100];
|
||||
@ -190,6 +170,32 @@ is_charcommand(const int fd, struct map_session_data* sd, const char* message, i
|
||||
return CharCommand_None;
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
*is_charcommand @コマンドに存在するかどうか確認する
|
||||
*------------------------------------------
|
||||
*/
|
||||
CharCommandType
|
||||
is_charcommand(const int fd, struct map_session_data* sd, const char* message) {
|
||||
const char* str = message;
|
||||
int s_flag = 0;
|
||||
|
||||
nullpo_retr(CharCommand_None, sd);
|
||||
|
||||
if (!message || !*message)
|
||||
return CharCommand_None;
|
||||
|
||||
str += strlen(sd->status.name);
|
||||
while (*str && (isspace(*str) || (s_flag == 0 && *str == ':'))) {
|
||||
if (*str == ':')
|
||||
s_flag = 1;
|
||||
str++;
|
||||
}
|
||||
if (!*str)
|
||||
return CharCommand_None;
|
||||
|
||||
return charcommand_sub(fd,sd,str,pc_isGM(sd));
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------
|
||||
|
@ -60,7 +60,9 @@ typedef struct CharCommandInfo {
|
||||
} CharCommandInfo;
|
||||
|
||||
CharCommandType
|
||||
is_charcommand(const int fd, struct map_session_data* sd, const char* message, int gmlvl);
|
||||
is_charcommand(const int fd, struct map_session_data* sd, const char* message);
|
||||
CharCommandType
|
||||
charcommand_sub(const int fd, struct map_session_data* sd, const char* str, int gmlvl);
|
||||
|
||||
CharCommandType charcommand(
|
||||
struct map_session_data* sd, const int level, const char* message, CharCommandInfo* info);
|
||||
|
@ -8694,8 +8694,8 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data *sd) { // S 008c <
|
||||
return;
|
||||
}
|
||||
|
||||
if ((is_atcommand(fd, sd, message, 0) != AtCommand_None) ||
|
||||
(is_charcommand(fd, sd, message,0) != CharCommand_None))
|
||||
if ((is_atcommand(fd, sd, message) != AtCommand_None) ||
|
||||
(is_charcommand(fd, sd, message) != CharCommand_None))
|
||||
return;
|
||||
|
||||
if (sd->sc.count &&
|
||||
@ -9059,8 +9059,8 @@ void clif_parse_Wis(int fd, struct map_session_data *sd) { // S 0096 <len>.w <ni
|
||||
gm_command = (char*)aMallocA((strlen((const char*)RFIFOP(fd,28)) + 28)*sizeof(char)); // 24+3+(RFIFOW(fd,2)-28)+1 or 24+3+(strlen(RFIFOP(fd,28))+1 (size can be wrong with hacker)
|
||||
|
||||
sprintf(gm_command, "%s : %s", sd->status.name, RFIFOP(fd,28));
|
||||
if ((is_charcommand(fd, sd, gm_command, 0) != CharCommand_None) ||
|
||||
(is_atcommand(fd, sd, gm_command, 0) != AtCommand_None)) {
|
||||
if ((is_charcommand(fd, sd, gm_command) != CharCommand_None) ||
|
||||
(is_atcommand(fd, sd, gm_command) != AtCommand_None)) {
|
||||
if(gm_command) aFree(gm_command);
|
||||
return;
|
||||
}
|
||||
@ -10428,8 +10428,8 @@ void clif_parse_PartyChangeOption(int fd, struct map_session_data *sd) {
|
||||
void clif_parse_PartyMessage(int fd, struct map_session_data *sd) {
|
||||
RFIFOHEAD(fd);
|
||||
|
||||
if (is_charcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != CharCommand_None ||
|
||||
is_atcommand(fd, sd, (char*)RFIFOP(fd,4), 0) != AtCommand_None)
|
||||
if (is_charcommand(fd, sd, (char*)RFIFOP(fd,4)) != CharCommand_None ||
|
||||
is_atcommand(fd, sd, (char*)RFIFOP(fd,4)) != AtCommand_None)
|
||||
return;
|
||||
|
||||
if (sd->sc.count && (
|
||||
@ -10672,8 +10672,8 @@ void clif_parse_GuildExpulsion(int fd,struct map_session_data *sd) {
|
||||
void clif_parse_GuildMessage(int fd,struct map_session_data *sd) {
|
||||
RFIFOHEAD(fd);
|
||||
|
||||
if (is_charcommand(fd, sd, (char*)RFIFOP(fd, 4), 0) != CharCommand_None ||
|
||||
is_atcommand(fd, sd, (char*)RFIFOP(fd, 4), 0) != AtCommand_None)
|
||||
if (is_charcommand(fd, sd, (char*)RFIFOP(fd, 4)) != CharCommand_None ||
|
||||
is_atcommand(fd, sd, (char*)RFIFOP(fd, 4)) != AtCommand_None)
|
||||
return;
|
||||
|
||||
if (sd->sc.count && (
|
||||
@ -11427,7 +11427,7 @@ void clif_parse_GMKillAll(int fd,struct map_session_data *sd)
|
||||
char message[50];
|
||||
|
||||
strncpy(message,sd->status.name, NAME_LENGTH);
|
||||
is_atcommand(fd, sd, strcat(message," : @kickall"),0);
|
||||
is_atcommand(fd, sd, strcat(message," : @kickall"));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -3233,7 +3233,7 @@ static int char_ip_set = 0;
|
||||
*------------------------------------------
|
||||
*/
|
||||
int parse_console(char *buf) {
|
||||
char type[64],command[64],map[64], buf2[72];
|
||||
char type[64],command[64],map[64];
|
||||
int x = 0, y = 0;
|
||||
int m, n;
|
||||
struct map_session_data sd;
|
||||
@ -3263,8 +3263,7 @@ int parse_console(char *buf) {
|
||||
ShowInfo("Type of command: %s || Command: %s || Map: %s Coords: %d %d\n",type,command,map,x,y);
|
||||
|
||||
if ( strcmpi("admin",type) == 0 && n == 5 ) {
|
||||
sprintf(buf2,"console: %s",command);
|
||||
if( is_atcommand(sd.fd,&sd,buf2,99) == AtCommand_None )
|
||||
if( atcommand_sub(sd.fd,&sd,command,99) == AtCommand_None )
|
||||
printf("Console: not atcommand\n");
|
||||
} else if ( strcmpi("server",type) == 0 && n == 2 ) {
|
||||
if ( strcmpi("shutdown", command) == 0 || strcmpi("exit",command) == 0 || strcmpi("quit",command) == 0 ) {
|
||||
|
@ -10102,7 +10102,7 @@ int buildin_atcommand(struct script_state *st)
|
||||
if (st->rid)
|
||||
sd = script_rid2sd(st);
|
||||
|
||||
if (sd) is_atcommand(sd->fd, sd, cmd, 99);
|
||||
if (sd) atcommand_sub(sd->fd, sd, cmd, 99);
|
||||
else { //Use a dummy character.
|
||||
struct map_session_data dummy_sd;
|
||||
struct block_list *bl = NULL;
|
||||
@ -10113,7 +10113,7 @@ int buildin_atcommand(struct script_state *st)
|
||||
if (bl->type == BL_NPC)
|
||||
strncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
|
||||
}
|
||||
is_atcommand(0, &dummy_sd, cmd, 99);
|
||||
atcommand_sub(0, &dummy_sd, cmd, 99);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@ -10129,7 +10129,7 @@ int buildin_charcommand(struct script_state *st)
|
||||
if (st->rid)
|
||||
sd = script_rid2sd(st);
|
||||
|
||||
if (sd) is_charcommand(sd->fd, sd, cmd, 99);
|
||||
if (sd) charcommand_sub(sd->fd, sd, cmd,99);
|
||||
else { //Use a dummy character.
|
||||
struct map_session_data dummy_sd;
|
||||
struct block_list *bl = NULL;
|
||||
@ -10140,7 +10140,7 @@ int buildin_charcommand(struct script_state *st)
|
||||
if (bl->type == BL_NPC)
|
||||
strncpy(dummy_sd.status.name, ((TBL_NPC*)bl)->name, NAME_LENGTH);
|
||||
}
|
||||
is_charcommand(0, &dummy_sd, cmd, 99);
|
||||
charcommand_sub(0, &dummy_sd, cmd, 99);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user