diff options
author | mc_cameri <mc_cameri@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-21 20:52:27 +0000 |
---|---|---|
committer | mc_cameri <mc_cameri@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2004-12-21 20:52:27 +0000 |
commit | 39e8b5c44689ba92303be9b36a30d0ad08ddde45 (patch) | |
tree | b50af632d913901fe45a2bf0d2c55a6bf332384e /src | |
parent | 9709008e5343b2d749196976e713ec9556f02099 (diff) | |
download | hercules-39e8b5c44689ba92303be9b36a30d0ad08ddde45.tar.gz hercules-39e8b5c44689ba92303be9b36a30d0ad08ddde45.tar.bz2 hercules-39e8b5c44689ba92303be9b36a30d0ad08ddde45.tar.xz hercules-39e8b5c44689ba92303be9b36a30d0ad08ddde45.zip |
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@708 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 69 | ||||
-rw-r--r-- | src/map/charcommand.c | 70 | ||||
-rw-r--r-- | src/map/charcommand.h | 1 | ||||
-rw-r--r-- | src/map/npc.c | 7 | ||||
-rw-r--r-- | src/map/npc.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 2 |
6 files changed, 80 insertions, 71 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 7948b3c27..afc752d2e 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -41,7 +41,6 @@ char msg_table[1000][256]; // Server messages (0-499 reserved for GM commands, 5 #define ACMD_FUNC(x) int atcommand_ ## x (const int fd, struct map_session_data* sd, const char* command, const char* message) ACMD_FUNC(broadcast); ACMD_FUNC(localbroadcast); -ACMD_FUNC(rurap); ACMD_FUNC(rura); ACMD_FUNC(where); ACMD_FUNC(jumpto); @@ -254,8 +253,6 @@ ACMD_FUNC(charkillableid2); // by Dino9021 // First char of commands is configured in atcommand_athena.conf. Leave @ in this list for default value. // to set default level, read atcommand_athena.conf first please. static AtCommandInfo atcommand_info[] = { - { AtCommand_RuraP, "@rura+", 60, atcommand_rurap }, - { AtCommand_RuraP, "@charwarp", 60, atcommand_rurap }, { AtCommand_Rura, "@rura", 40, atcommand_rura }, { AtCommand_Warp, "@warp", 40, atcommand_rura }, { AtCommand_Where, "@where", 1, atcommand_where }, @@ -973,72 +970,6 @@ int atcommand_send( return 0; } -/*========================================== - * @rura+ - *------------------------------------------ - */ -int atcommand_rurap( - const int fd, struct map_session_data* sd, - const char* command, const char* message) -{ - char map_name[100]; - char character[100]; - int x = 0, y = 0; - struct map_session_data *pl_sd; - int m; - - nullpo_retr(-1, sd); - - memset(map_name, '\0', sizeof(map_name)); - memset(character, '\0', sizeof(character)); - - if (!message || !*message || sscanf(message, "%99s %d %d %99[^\n]", map_name, &x, &y, character) < 4) { - clif_displaymessage(fd, "Usage: @charwarp/@rura+ <mapname> <x> <y> <char name>"); - return -1; - } - - if (x <= 0) - x = rand() % 399 + 1; - if (y <= 0) - y = rand() % 399 + 1; - if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) - strcat(map_name, ".gat"); - - if ((pl_sd = map_nick2sd(character)) != NULL) { - if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level - if (x > 0 && x < 400 && y > 0 && y < 400) { - m = map_mapname2mapid(map_name); - if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp someone to this map."); - return -1; - } - if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { - clif_displaymessage(fd, "You are not authorised to warp this player from its actual map."); - return -1; - } - if (pc_setpos(pl_sd, map_name, x, y, 3) == 0) { - clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped. - clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too). - } else { - clif_displaymessage(fd, msg_table[1]); // Map not found. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[2]); // Coordinates out of range. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. - return -1; - } - } else { - clif_displaymessage(fd, msg_table[3]); // Character not found. - return -1; - } - - return 0; -} - // @rura /*========================================== * diff --git a/src/map/charcommand.c b/src/map/charcommand.c index 2db2c8e84..893266396 100644 --- a/src/map/charcommand.c +++ b/src/map/charcommand.c @@ -47,6 +47,7 @@ CCMD_FUNC(itemlist); CCMD_FUNC(effect); CCMD_FUNC(storagelist); CCMD_FUNC(item); +CCMD_FUNC(warp); #ifdef TXT_ONLY /* TXT_ONLY */ @@ -80,6 +81,9 @@ static CharCommandInfo charcommand_info[] = { { CharCommandEffect, "#effect", 40, charcommand_effect }, { CharCommandStorageList, "#storagelist", 40, charcommand_storagelist }, { CharCommandItem, "#item", 60, charcommand_item }, + { CharCommandWarp, "#warp", 60, charcommand_warp }, + { CharCommandWarp, "#rura", 60, charcommand_warp }, + { CharCommandWarp, "#rura+", 60, charcommand_warp }, #ifdef TXT_ONLY /* TXT_ONLY */ @@ -1061,3 +1065,69 @@ int charcommand_item( return 0; } + +/*========================================== + * #warp/#rura/#rura+ <mapname> <x> <y> <char name> + *------------------------------------------ + */ +int charcommand_warp( + const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + char map_name[100]; + char character[100]; + int x = 0, y = 0; + struct map_session_data *pl_sd; + int m; + + nullpo_retr(-1, sd); + + memset(map_name, '\0', sizeof(map_name)); + memset(character, '\0', sizeof(character)); + + if (!message || !*message || sscanf(message, "%99s %d %d %99[^\n]", map_name, &x, &y, character) < 4) { + clif_displaymessage(fd, "Usage: #warp/#rura/#rura+ <mapname> <x> <y> <char name>"); + return -1; + } + + if (x <= 0) + x = rand() % 399 + 1; + if (y <= 0) + y = rand() % 399 + 1; + if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < 13) // 16 - 4 (.gat) + strcat(map_name, ".gat"); + + if ((pl_sd = map_nick2sd(character)) != NULL) { + if (pc_isGM(sd) >= pc_isGM(pl_sd)) { // you can rura+ only lower or same GM level + if (x > 0 && x < 400 && y > 0 && y < 400) { + m = map_mapname2mapid(map_name); + if (m >= 0 && map[m].flag.nowarpto && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, "You are not authorised to warp someone to this map."); + return -1; + } + if (pl_sd->bl.m >= 0 && map[pl_sd->bl.m].flag.nowarp && battle_config.any_warp_GM_min_level > pc_isGM(sd)) { + clif_displaymessage(fd, "You are not authorised to warp this player from its actual map."); + return -1; + } + if (pc_setpos(pl_sd, map_name, x, y, 3) == 0) { + clif_displaymessage(pl_sd->fd, msg_table[0]); // Warped. + clif_displaymessage(fd, msg_table[15]); // Player warped (message sends to player too). + } else { + clif_displaymessage(fd, msg_table[1]); // Map not found. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[2]); // Coordinates out of range. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player. + return -1; + } + } else { + clif_displaymessage(fd, msg_table[3]); // Character not found. + return -1; + } + + return 0; +} diff --git a/src/map/charcommand.h b/src/map/charcommand.h index 0e4992c84..de7e83680 100644 --- a/src/map/charcommand.h +++ b/src/map/charcommand.h @@ -16,6 +16,7 @@ enum CharCommandType { CharCommandEffect, CharCommandStorageList, CharCommandItem, // by MC Cameri + CharCommandWarp, #ifdef TXT_ONLY /* TXT_ONLY */ diff --git a/src/map/npc.c b/src/map/npc.c index bb6b9138c..45e698676 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -1674,7 +1674,11 @@ static int npc_parse_script(char *w1,char *w2,char *w3,char *w4,char *first_line } } if(curly_count > 0) { - printf("warning: Missing right curly at line %d\n",*lines); + printf("\n"); + snprintf(tmp_output,sizeof(tmp_output),"Script skipped. Missing rig" + "ht curly brace at line '"CL_WHITE"%d"CL_RESET"' of file \n\t'" + CL_WHITE"%s"CL_RESET"'.\n",*lines,current_file); + ShowWarning(tmp_output); script=NULL; //exit(1); //Wtf? We do we exit? } else { @@ -2319,6 +2323,7 @@ int do_init_npc(void) free(nsl->prev); nsl->prev = NULL; } + strcpy(current_file,nsl->name); fp=fopen(nsl->name,"r"); if (fp==NULL) { printf("file not found : %s\n",nsl->name); diff --git a/src/map/npc.h b/src/map/npc.h index 4f0c43cba..b3b38e5e0 100644 --- a/src/map/npc.h +++ b/src/map/npc.h @@ -48,5 +48,7 @@ int npc_gettimerevent_tick(struct npc_data *nd); int npc_settimerevent_tick(struct npc_data *nd,int newtimer); int npc_delete(struct npc_data *nd); +char current_file[1024]; + #endif diff --git a/src/map/script.c b/src/map/script.c index 5d9d60385..1bcb118ee 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -1517,7 +1517,7 @@ int buildin_goto(struct script_state *st) int pos; if( st->stack->stack_data[st->start+2].type!=C_POS ){ - printf("script: goto: not label !\n"); + printf("script: goto: not label!\n"); st->state=END; return 0; } |