summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c511
1 files changed, 252 insertions, 259 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 9e33f3c68..e22e2101c 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -2,55 +2,59 @@
// See the LICENSE file
// Portions Copyright (c) Athena Dev Teams
-#include "../common/cbasetypes.h"
-#include "../common/mmo.h"
-#include "../common/timer.h"
-#include "../common/nullpo.h"
-#include "../common/core.h"
-#include "../common/showmsg.h"
-#include "../common/malloc.h"
-#include "../common/random.h"
-#include "../common/socket.h"
-#include "../common/strlib.h"
-#include "../common/utils.h"
-#include "../common/conf.h"
+#define HERCULES_CORE
+#include "../config/core.h" // AUTOLOOTITEM_SIZE, AUTOTRADE_PERSISTENCY, MAX_SUGGESTIONS, MOB_FLEE(), MOB_HIT(), RENEWAL, RENEWAL_DROP, RENEWAL_EXP
#include "atcommand.h"
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "HPMmap.h"
#include "battle.h"
#include "chat.h"
-#include "clif.h"
#include "chrif.h"
+#include "clif.h"
#include "duel.h"
+#include "elemental.h"
+#include "guild.h"
+#include "homunculus.h"
#include "intif.h"
#include "itemdb.h"
#include "log.h"
+#include "mail.h"
#include "map.h"
-#include "pc.h"
-#include "pc_groups.h" // groupid2name
-#include "status.h"
-#include "skill.h"
+#include "mapreg.h"
+#include "mercenary.h"
#include "mob.h"
#include "npc.h"
-#include "pet.h"
-#include "homunculus.h"
-#include "mail.h"
-#include "mercenary.h"
-#include "elemental.h"
#include "party.h"
-#include "guild.h"
+#include "pc.h"
+#include "pc_groups.h" // groupid2name
+#include "pet.h"
+#include "quest.h"
#include "script.h"
+#include "searchstore.h"
+#include "skill.h"
+#include "status.h"
#include "storage.h"
#include "trade.h"
#include "unit.h"
-#include "mapreg.h"
-#include "quest.h"
-#include "searchstore.h"
-#include "HPMmap.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <math.h>
+#include "../common/cbasetypes.h"
+#include "../common/conf.h"
+#include "../common/core.h"
+#include "../common/malloc.h"
+#include "../common/mmo.h" // MAX_CARTS
+#include "../common/nullpo.h"
+#include "../common/random.h"
+#include "../common/showmsg.h"
+#include "../common/socket.h"
+#include "../common/strlib.h"
+#include "../common/sysinfo.h"
+#include "../common/timer.h"
+#include "../common/utils.h"
struct atcommand_interface atcommand_s;
@@ -403,6 +407,11 @@ ACMD(mapmove) {
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
+
+ if( sd->bl.m == m && sd->bl.x == x && sd->bl.y == y ) {
+ clif->message(fd, msg_txt(253)); // You already are at your destination!
+ return false;
+ }
if ((x || y) && map->getcell(m, x, y, CELL_CHKNOPASS) && pc_get_group_level(sd) < battle_config.gm_ignore_warpable_area) {
//This is to prevent the pc->setpos call from printing an error.
@@ -460,12 +469,22 @@ ACMD(where) {
*------------------------------------------*/
ACMD(jumpto) {
struct map_session_data *pl_sd = NULL;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(911)); // Please enter a player name (usage: @jumpto/@warpto/@goto <char name/ID>).
return false;
}
-
+
+ if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
+ clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map.
+ return false;
+ }
+
+ if( pc_isdead(sd) ) {
+ clif->message(fd, msg_txt(864)); // "You cannot use this command when dead."
+ return false;
+ }
+
if((pl_sd=map->nick2sd((char *)message)) == NULL && (pl_sd=map->charid2sd(atoi(message))) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
@@ -475,21 +494,16 @@ ACMD(jumpto) {
clif->message(fd, msg_txt(247)); // You are not authorized to warp to this map.
return false;
}
-
- if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarp && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
- clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map.
- return false;
- }
-
- if( pc_isdead(sd) ) {
- clif->message(fd, msg_txt(864)); // "You cannot use this command when dead."
+
+ if( pl_sd->bl.m == sd->bl.m && pl_sd->bl.x == sd->bl.x && pl_sd->bl.y == sd->bl.y ) {
+ clif->message(fd, msg_txt(253)); // You already are at your destination!
return false;
}
-
+
pc->setpos(sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(4), pl_sd->status.name); // Jumped to %s
- clif->message(fd, atcmd_output);
-
+ clif->message(fd, atcmd_output);
+
return true;
}
@@ -520,6 +534,11 @@ ACMD(jump)
if (!map->search_freecell(NULL, sd->bl.m, &x, &y, 10, 10, 1))
x = y = 0; //Invalid cell, use random spot.
}
+
+ if( x && y && sd->bl.x == x && sd->bl.y == y ) {
+ clif->message(fd, msg_txt(253)); // You already are at your destination!
+ return false;
+ }
pc->setpos(sd, sd->mapindex, x, y, CLR_TELEPORT);
sprintf(atcmd_output, msg_txt(5), sd->bl.x, sd->bl.y); // Jumped to %d %d
@@ -824,7 +843,11 @@ ACMD(guildstorage)
return false;
}
- gstorage->open(sd);
+ if( gstorage->open(sd) ) {
+ clif->message(fd, msg_txt(1201)); // Your guild's storage has already been opened by another member, try again later.
+ return false;
+ }
+
clif->message(fd, msg_txt(920)); // Guild storage opened.
return true;
}
@@ -924,7 +947,7 @@ ACMD(jobchange) {
}
}
- // High Jobs, Babys and Third
+ // High Jobs, Babies and Third
for( i = JOB_NOVICE_HIGH; i < JOB_MAX && !found; i++ ){
if (strncmpi(message, pc->job_name(i), 16) == 0) {
job = i;
@@ -1100,14 +1123,14 @@ ACMD(item)
memset(item_name, '\0', sizeof(item_name));
if (!strcmpi(info->command,"itembound") && (!message || !*message || (
- sscanf(message, "\"%99[^\"]\" %d %d", item_name, &number, &bound) < 2 &&
- sscanf(message, "%99s %d %d", item_name, &number, &bound) < 2
+ sscanf(message, "\"%99[^\"]\" %d %d", item_name, &number, &bound) < 2 &&
+ sscanf(message, "%99s %d %d", item_name, &number, &bound) < 2
))) {
clif->message(fd, msg_txt(295)); // Please enter an item name or ID (usage: @itembound <item name/ID> <quantity> <bound_type>).
return false;
} else if (!message || !*message || (
- sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 &&
- sscanf(message, "%99s %d", item_name, &number) < 1 ))
+ sscanf(message, "\"%99[^\"]\" %d", item_name, &number) < 1 &&
+ sscanf(message, "%99s %d", item_name, &number) < 1 ))
{
clif->message(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>).
return false;
@@ -1306,7 +1329,7 @@ ACMD(baselevelup)
clif->message(fd, msg_txt(47)); // Base level can't go any higher.
return false;
} // End Addition
- if ((unsigned int)level > pc->maxbaselv(sd) || (unsigned int)level > pc->maxbaselv(sd) - sd->status.base_level) // fix positiv overflow
+ if ((unsigned int)level > pc->maxbaselv(sd) || (unsigned int)level > pc->maxbaselv(sd) - sd->status.base_level) // fix positive overflow
level = pc->maxbaselv(sd) - sd->status.base_level;
for (i = 0; i < level; i++)
status_point += pc->gets_status_point(sd->status.base_level + i);
@@ -1366,7 +1389,7 @@ ACMD(joblevelup)
clif->message(fd, msg_txt(23)); // Job level can't go any higher.
return false;
}
- if ((unsigned int)level > pc->maxjoblv(sd) || (unsigned int)level > pc->maxjoblv(sd) - sd->status.job_level) // fix positiv overflow
+ if ((unsigned int)level > pc->maxjoblv(sd) || (unsigned int)level > pc->maxjoblv(sd) - sd->status.job_level) // fix positive overflow
level = pc->maxjoblv(sd) - sd->status.job_level;
sd->status.job_level += (unsigned int)level;
sd->status.skill_point += level;
@@ -1378,11 +1401,11 @@ ACMD(joblevelup)
return false;
}
level *=-1;
- if ((unsigned int)level >= sd->status.job_level) // fix negativ overflow
+ if ((unsigned int)level >= sd->status.job_level) // fix negative overflow
level = sd->status.job_level-1;
sd->status.job_level -= (unsigned int)level;
if (sd->status.skill_point < level)
- pc->resetskill(sd,0); //Reset skills since we need to substract more points.
+ pc->resetskill(sd,0); //Reset skills since we need to subtract more points.
if (sd->status.skill_point < level)
sd->status.skill_point = 0;
else
@@ -1608,7 +1631,7 @@ ACMD(model)
pc->changelook(sd, LOOK_HAIR, hair_style);
pc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
pc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
- clif->message(fd, msg_txt(36)); // Appearence changed.
+ clif->message(fd, msg_txt(36)); // Appearance changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
@@ -1634,7 +1657,7 @@ ACMD(dye)
if (cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
pc->changelook(sd, LOOK_CLOTHES_COLOR, cloth_color);
- clif->message(fd, msg_txt(36)); // Appearence changed.
+ clif->message(fd, msg_txt(36)); // Appearance changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
@@ -1660,7 +1683,7 @@ ACMD(hair_style)
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) {
pc->changelook(sd, LOOK_HAIR, hair_style);
- clif->message(fd, msg_txt(36)); // Appearence changed.
+ clif->message(fd, msg_txt(36)); // Appearance changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
@@ -1686,7 +1709,7 @@ ACMD(hair_color)
if (hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR) {
pc->changelook(sd, LOOK_HAIR_COLOR, hair_color);
- clif->message(fd, msg_txt(36)); // Appearence changed.
+ clif->message(fd, msg_txt(36)); // Appearance changed.
} else {
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
@@ -1698,67 +1721,63 @@ ACMD(hair_color)
/*==========================================
* @go [city_number or city_name] - Updated by Harbin
*------------------------------------------*/
-ACMD(go)
-{
+ACMD(go) {
int i;
- int town;
+ int town = INT_MAX; // Initialized to INT_MAX instead of -1 to avoid conflicts with those who map [-3:-1] to @memo locations.
char map_name[MAP_NAME_LENGTH];
- int16 m;
const struct {
char map[MAP_NAME_LENGTH];
int x, y;
+ int min_match; ///< Minimum string length to match
} data[] = {
- { MAP_PRONTERA, 156, 191 }, // 0=Prontera
- { MAP_MORROC, 156, 93 }, // 1=Morroc
- { MAP_GEFFEN, 119, 59 }, // 2=Geffen
- { MAP_PAYON, 162, 233 }, // 3=Payon
- { MAP_ALBERTA, 192, 147 }, // 4=Alberta
+ { MAP_PRONTERA, 156, 191, 3 }, // 0 = Prontera
+ { MAP_MORROC, 156, 93, 4 }, // 1 = Morroc
+ { MAP_GEFFEN, 119, 59, 3 }, // 2 = Geffen
+ { MAP_PAYON, 162, 233, 3 }, // 3 = Payon
+ { MAP_ALBERTA, 192, 147, 3 }, // 4 = Alberta
#ifdef RENEWAL
- { MAP_IZLUDE, 128, 146 }, // 5=Izlude (Renewal)
+ { MAP_IZLUDE, 128, 146, 3 }, // 5 = Izlude (Renewal)
#else
- { MAP_IZLUDE, 128, 114 }, // 5=Izlude
+ { MAP_IZLUDE, 128, 114, 3 }, // 5 = Izlude
#endif
- { MAP_ALDEBARAN, 140, 131 }, // 6=Al de Baran
- { MAP_LUTIE, 147, 134 }, // 7=Lutie
- { MAP_COMODO, 209, 143 }, // 8=Comodo
- { MAP_YUNO, 157, 51 }, // 9=Yuno
- { MAP_AMATSU, 198, 84 }, // 10=Amatsu
- { MAP_GONRYUN, 160, 120 }, // 11=Gonryun
- { MAP_UMBALA, 89, 157 }, // 12=Umbala
- { MAP_NIFLHEIM, 21, 153 }, // 13=Niflheim
- { MAP_LOUYANG, 217, 40 }, // 14=Louyang
- { MAP_NOVICE, 53, 111 }, // 15=Training Grounds
- { MAP_JAIL, 23, 61 }, // 16=Prison
- { MAP_JAWAII, 249, 127 }, // 17=Jawaii
- { MAP_AYOTHAYA, 151, 117 }, // 18=Ayothaya
- { MAP_EINBROCH, 64, 200 }, // 19=Einbroch
- { MAP_LIGHTHALZEN, 158, 92 }, // 20=Lighthalzen
- { MAP_EINBECH, 70, 95 }, // 21=Einbech
- { MAP_HUGEL, 96, 145 }, // 22=Hugel
- { MAP_RACHEL, 130, 110 }, // 23=Rachel
- { MAP_VEINS, 216, 123 }, // 24=Veins
- { MAP_MOSCOVIA, 223, 184 }, // 25=Moscovia
- { MAP_MIDCAMP, 180, 240 }, // 26=Midgard Camp
- { MAP_MANUK, 282, 138 }, // 27=Manuk
- { MAP_SPLENDIDE, 197, 176 }, // 28=Splendide
- { MAP_BRASILIS, 182, 239 }, // 29=Brasilis
- { MAP_DICASTES, 198, 187 }, // 30=El Dicastes
- { MAP_MORA, 44, 151 }, // 31=Mora
- { MAP_DEWATA, 200, 180 }, // 32=Dewata
- { MAP_MALANGDO, 140, 114 }, // 33=Malangdo Island
- { MAP_MALAYA, 242, 211 }, // 34=Malaya Port
- { MAP_ECLAGE, 110, 39 }, // 35=Eclage
+ { MAP_ALDEBARAN, 140, 131, 3 }, // 6 = Aldebaran
+ { MAP_LUTIE, 147, 134, 3 }, // 7 = Lutie
+ { MAP_COMODO, 209, 143, 3 }, // 8 = Comodo
+ { MAP_YUNO, 157, 51, 3 }, // 9 = Juno
+ { MAP_AMATSU, 198, 84, 3 }, // 10 = Amatsu
+ { MAP_GONRYUN, 160, 120, 3 }, // 11 = Kunlun
+ { MAP_UMBALA, 89, 157, 3 }, // 12 = Umbala
+ { MAP_NIFLHEIM, 21, 153, 3 }, // 13 = Niflheim
+ { MAP_LOUYANG, 217, 40, 3 }, // 14 = Luoyang
+ { MAP_NOVICE, 53, 111, 3 }, // 15 = Training Grounds
+ { MAP_JAIL, 23, 61, 3 }, // 16 = Prison
+ { MAP_JAWAII, 249, 127, 3 }, // 17 = Jawaii
+ { MAP_AYOTHAYA, 151, 117, 3 }, // 18 = Ayothaya
+ { MAP_EINBROCH, 64, 200, 5 }, // 19 = Einbroch
+ { MAP_LIGHTHALZEN, 158, 92, 3 }, // 20 = Lighthalzen
+ { MAP_EINBECH, 70, 95, 5 }, // 21 = Einbech
+ { MAP_HUGEL, 96, 145, 3 }, // 22 = Hugel
+ { MAP_RACHEL, 130, 110, 3 }, // 23 = Rachel
+ { MAP_VEINS, 216, 123, 3 }, // 24 = Veins
+ { MAP_MOSCOVIA, 223, 184, 3 }, // 25 = Moscovia
+ { MAP_MIDCAMP, 180, 240, 3 }, // 26 = Midgard Camp
+ { MAP_MANUK, 282, 138, 3 }, // 27 = Manuk
+ { MAP_SPLENDIDE, 197, 176, 3 }, // 28 = Splendide
+ { MAP_BRASILIS, 182, 239, 3 }, // 29 = Brasilis
+ { MAP_DICASTES, 198, 187, 3 }, // 30 = El Dicastes
+ { MAP_MORA, 44, 151, 4 }, // 31 = Mora
+ { MAP_DEWATA, 200, 180, 3 }, // 32 = Dewata
+ { MAP_MALANGDO, 140, 114, 5 }, // 33 = Malangdo Island
+ { MAP_MALAYA, 242, 211, 5 }, // 34 = Malaya Port
+ { MAP_ECLAGE, 110, 39, 3 }, // 35 = Eclage
};
memset(map_name, '\0', sizeof(map_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
- // get the number
- town = atoi(message);
-
- if (!message || !*message || sscanf(message, "%11s", map_name) < 1 || town < 0 || town >= ARRAYLENGTH(data))
- {// no value matched so send the list of locations
+ if (!message || !*message || sscanf(message, "%11s", map_name) < 1) {
+ // no value matched so send the list of locations
const char* text;
// attempt to find the text help string
@@ -1772,98 +1791,49 @@ ACMD(go)
return false;
}
-
- // get possible name of the city
- map_name[MAP_NAME_LENGTH-1] = '\0';
- for (i = 0; map_name[i]; i++)
- map_name[i] = TOLOWER(map_name[i]);
- // try to identify the map name
- if (strncmp(map_name, "prontera", 3) == 0) {
- town = 0;
- } else if (strncmp(map_name, "morocc", 4) == 0 ||
- strncmp(map_name, "morroc", 4) == 0) {
- town = 1;
- } else if (strncmp(map_name, "geffen", 3) == 0) {
- town = 2;
- } else if (strncmp(map_name, "payon", 3) == 0) {
- town = 3;
- } else if (strncmp(map_name, "alberta", 3) == 0) {
- town = 4;
- } else if (strncmp(map_name, "izlude", 3) == 0) {
- town = 5;
- } else if (strncmp(map_name, "aldebaran", 3) == 0) {
- town = 6;
- } else if (strncmp(map_name, "lutie", 3) == 0 ||
- strcmp(map_name, "christmas") == 0 ||
- strncmp(map_name, "xmas", 3) == 0 ||
- strncmp(map_name, "x-mas", 3) == 0) {
- town = 7;
- } else if (strncmp(map_name, "comodo", 3) == 0) {
- town = 8;
- } else if (strncmp(map_name, "juno", 3) == 0 ||
- strncmp(map_name, "yuno", 3) == 0) {
- town = 9;
- } else if (strncmp(map_name, "amatsu", 3) == 0) {
- town = 10;
- } else if (strncmp(map_name, "kunlun", 3) == 0 ||
- strncmp(map_name, "gonryun", 3) == 0) {
- town = 11;
- } else if (strncmp(map_name, "umbala", 3) == 0) {
- town = 12;
- } else if (strncmp(map_name, "niflheim", 3) == 0) {
- town = 13;
- } else if (strncmp(map_name, "louyang", 3) == 0) {
- town = 14;
- } else if (strncmp(map_name, "new_1-1", 3) == 0 ||
- strncmp(map_name, "startpoint", 3) == 0 ||
- strncmp(map_name, "beginning", 3) == 0) {
- town = 15;
- } else if (strncmp(map_name, "sec_pri", 3) == 0 ||
- strncmp(map_name, "prison", 3) == 0 ||
- strncmp(map_name, "jail", 3) == 0) {
- town = 16;
- } else if (strncmp(map_name, "jawaii", 3) == 0) {
- town = 17;
- } else if (strncmp(map_name, "ayothaya", 3) == 0) {
- town = 18;
- } else if (strncmp(map_name, "einbroch", 5) == 0) {
- town = 19;
- } else if (strncmp(map_name, "lighthalzen", 3) == 0) {
- town = 20;
- } else if (strncmp(map_name, "einbech", 5) == 0) {
- town = 21;
- } else if (strncmp(map_name, "hugel", 3) == 0) {
- town = 22;
- } else if (strncmp(map_name, "rachel", 3) == 0) {
- town = 23;
- } else if (strncmp(map_name, "veins", 3) == 0) {
- town = 24;
- } else if (strncmp(map_name, "moscovia", 3) == 0) {
- town = 25;
- } else if (strncmp(map_name, "mid_camp", 3) == 0) {
- town = 26;
- } else if (strncmp(map_name, "manuk", 3) == 0) {
- town = 27;
- } else if (strncmp(map_name, "splendide", 3) == 0) {
- town = 28;
- } else if (strncmp(map_name, "brasilis", 3) == 0) {
- town = 29;
- } else if (strncmp(map_name, "dicastes01", 3) == 0) {
- town = 30;
- } else if (strcmp(map_name, "mora") == 0) {
- town = 31;
- } else if (strncmp(map_name, "dewata", 3) == 0) {
- town = 32;
- } else if (strncmp(map_name, "malangdo", 5) == 0) {
- town = 33;
- } else if (strncmp(map_name, "malaya", 5) == 0) {
- town = 34;
- } else if (strncmp(map_name, "eclage", 3) == 0) {
- town = 35;
+
+ // Numeric entry
+ if (ISDIGIT(*message) || (message[0] == '-' && ISDIGIT(message[1]))) {
+ town = atoi(message);
}
-
+
+ if (town < 0 || town >= ARRAYLENGTH(data)) {
+ map_name[MAP_NAME_LENGTH-1] = '\0';
+
+ // Match maps on the list
+ for (i = 0; i < ARRAYLENGTH(data); i++) {
+ if (strncmpi(map_name, data[i].map, data[i].min_match) == 0) {
+ town = i;
+ break;
+ }
+ }
+ }
+
+ if (town < 0 || town >= ARRAYLENGTH(data)) {
+ // Alternate spellings
+ if (strncmpi(map_name, "morroc", 4) == 0) { // Correct town name for 'morocc'
+ town = 1;
+ } else if (strncmpi(map_name, "lutie", 3) == 0) { // Correct town name for 'xmas'
+ town = 7;
+ } else if (strncmpi(map_name, "juno", 3) == 0) { // Correct town name for 'yuno'
+ town = 9;
+ } else if (strncmpi(map_name, "kunlun", 3) == 0) { // Original town name for 'gonryun'
+ town = 11;
+ } else if (strncmpi(map_name, "luoyang", 3) == 0) { // Original town name for 'louyang'
+ town = 14;
+ } else if (strncmpi(map_name, "startpoint", 3) == 0 // Easy to remember alternatives to 'new_1-1'
+ || strncmpi(map_name, "beginning", 3) == 0) {
+ town = 15;
+ } else if (strncmpi(map_name, "prison", 3) == 0 // Easy to remember alternatives to 'sec_pri'
+ || strncmpi(map_name, "jail", 3) == 0) {
+ town = 16;
+ } else if (strncmpi(map_name, "rael", 3) == 0) { // Original town name for 'rachel'
+ town = 23;
+ }
+ }
+
if (town >= 0 && town < ARRAYLENGTH(data)) {
- m = map->mapname2mapid(data[town].map);
+ int16 m = map->mapname2mapid(data[town].map);
if (m >= 0 && map->list[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(247));
return false;
@@ -1878,7 +1848,7 @@ ACMD(go)
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
- } else { // if you arrive here, you have an error in town variable when reading of names
+ } else {
clif->message(fd, msg_txt(38)); // Invalid location number or name.
return false;
}
@@ -1926,7 +1896,7 @@ ACMD(monster)
return false;
}
- if ((mob_id = mob->db_searchname(monster)) == 0) // check name first (to avoid possible name begining by a number)
+ if ((mob_id = mob->db_searchname(monster)) == 0) // check name first (to avoid possible name beginning by a number)
mob_id = mob->db_checkid(atoi(monster));
if (mob_id == 0) {
@@ -2353,7 +2323,11 @@ ACMD(zeny)
if((ret=pc->payzeny(sd,-zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
- if(!ret) clif->message(fd, msg_txt(176)); //ret=0 mean cmd success
+
+ if( ret ) //ret != 0 means cmd failure
+ return false;
+
+ clif->message(fd, msg_txt(176));
return true;
}
@@ -2737,7 +2711,7 @@ ACMD(char_block)
* mn: minute
* s: second
* <example> @ban +1m-2mn1s-6y test_player
- * this example adds 1 month and 1 second, and substracts 2 minutes and 6 years at the same time.
+ * this example adds 1 month and 1 second, and subtracts 2 minutes and 6 years at the same time.
*------------------------------------------*/
ACMD(char_ban)
{
@@ -2905,12 +2879,12 @@ ACMD(doom)
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
- clif->message(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgement.
+ clif->message(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgment.
}
}
mapit->free(iter);
- clif->message(fd, msg_txt(62)); // Judgement was made.
+ clif->message(fd, msg_txt(62)); // Judgment was made.
return true;
}
@@ -2930,12 +2904,12 @@ ACMD(doommap)
{
status_kill(&pl_sd->bl);
clif->specialeffect(&pl_sd->bl,450,AREA);
- clif->message(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgement.
+ clif->message(pl_sd->fd, msg_txt(61)); // The holy messenger has given judgment.
}
}
mapit->free(iter);
- clif->message(fd, msg_txt(62)); // Judgement was made.
+ clif->message(fd, msg_txt(62)); // Judgment was made.
return true;
}
@@ -3010,7 +2984,7 @@ ACMD(kick)
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
- clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
+ clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
@@ -3313,7 +3287,7 @@ ACMD(mapexit) {
}
/*==========================================
- * idsearch <part_of_name>: revrited by [Yor]
+ * idsearch <part_of_name>: rewrite by [Yor]
*------------------------------------------*/
ACMD(idsearch)
{
@@ -3359,7 +3333,7 @@ ACMD(recallall)
memset(atcmd_output, '\0', sizeof(atcmd_output));
if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
- clif->message(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map.
+ clif->message(fd, msg_txt(1032)); // You are not authorized to warp someone to your current map.
return false;
}
@@ -3411,7 +3385,7 @@ ACMD(guildrecall)
}
if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
- clif->message(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map.
+ clif->message(fd, msg_txt(1032)); // You are not authorized to warp someone to your current map.
return false;
}
@@ -3468,7 +3442,7 @@ ACMD(partyrecall)
}
if (sd->bl.m >= 0 && map->list[sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
- clif->message(fd, msg_txt(1032)); // You are not authorized to warp somenone to your current map.
+ clif->message(fd, msg_txt(1032)); // You are not authorized to warp someone to your current map.
return false;
}
@@ -3943,7 +3917,12 @@ ACMD(mount_peco)
return false;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT && pc->checkskill(sd,RK_DRAGONTRAINING) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT ) {
+ if( !pc->checkskill(sd,RK_DRAGONTRAINING) ) {
+ sprintf(atcmd_output, msg_txt(213), skill->get_desc(RK_DRAGONTRAINING)); // You need %s to mount!
+ clif->message(fd, atcmd_output);
+ return false;
+ }
if( !(sd->sc.option&OPTION_DRAGON1) ) {
clif->message(sd->fd,msg_txt(1119)); // You have mounted your Dragon.
pc->setoption(sd, sd->sc.option|OPTION_DRAGON1);
@@ -3953,7 +3932,12 @@ ACMD(mount_peco)
}
return true;
}
- if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER && pc->checkskill(sd,RA_WUGRIDER) > 0 ) {
+ if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER ) {
+ if( !pc->checkskill(sd,RA_WUGRIDER) ) {
+ sprintf(atcmd_output, msg_txt(213), skill->get_desc(RA_WUGRIDER)); // You need %s to mount!
+ clif->message(fd, atcmd_output);
+ return false;
+ }
if( !pc_isridingwug(sd) ) {
clif->message(sd->fd,msg_txt(1121)); // You have mounted your Warg.
pc->setoption(sd, sd->sc.option|OPTION_WUGRIDER);
@@ -3973,21 +3957,23 @@ ACMD(mount_peco)
}
return true;
}
- if (!pc_isriding(sd)) { // if actually no peco
-
- if (!pc->checkskill(sd, KN_RIDING)) {
- clif->message(fd, msg_txt(213)); // You can not mount a Peco Peco with your current job.
- return false;
+ if( sd->class_&MAPID_SWORDMAN && sd->class_&JOBL_2 ) {
+ if( !pc_isriding(sd) ) { // if actually no peco
+ if (!pc->checkskill(sd, KN_RIDING)) {
+ sprintf(atcmd_output, msg_txt(213), skill->get_desc(KN_RIDING)); // You need %s to mount!
+ clif->message(fd, atcmd_output);
+ return false;
+ }
+ pc->setoption(sd, sd->sc.option | OPTION_RIDING);
+ clif->message(fd, msg_txt(102)); // You have mounted a Peco Peco.
+ } else {//Dismount
+ pc->setoption(sd, sd->sc.option & ~OPTION_RIDING);
+ clif->message(fd, msg_txt(214)); // You have released your Peco Peco.
}
-
- pc->setoption(sd, sd->sc.option | OPTION_RIDING);
- clif->message(fd, msg_txt(102)); // You have mounted a Peco Peco.
- } else {//Dismount
- pc->setoption(sd, sd->sc.option & ~OPTION_RIDING);
- clif->message(fd, msg_txt(214)); // You have released your Peco Peco.
+ return true;
}
-
- return true;
+ clif->message(fd, msg_txt(215)); // Your class can't mount!
+ return false;
}
/*==========================================
@@ -4115,7 +4101,7 @@ ACMD(nuke) {
skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, timer->gettick(), 0);
clif->message(fd, msg_txt(109)); // Player has been nuked!
} else {
- clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
+ clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
} else {
@@ -4312,7 +4298,7 @@ ACMD(servertime) {
const struct TimerData * timer_data2 = timer->get(pc->day_timer_tid);
if (map->night_flag == 0) {
- sprintf(temp, msg_txt(235), // Game time: The game is actualy in daylight for %s.
+ sprintf(temp, msg_txt(235), // Game time: The game is actually in daylight for %s.
txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
@@ -4323,7 +4309,7 @@ ACMD(servertime) {
txt_time((unsigned int)(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)));
clif->message(fd, temp);
} else {
- sprintf(temp, msg_txt(233), // Game time: The game is actualy in night for %s.
+ sprintf(temp, msg_txt(233), // Game time: The game is actually in night for %s.
txt_time((unsigned int)(DIFF_TICK(timer_data2->tick,timer->gettick()) / 1000)));
clif->message(fd, temp);
if (DIFF_TICK(timer_data2->tick,timer_data->tick) > 0)
@@ -4397,7 +4383,7 @@ ACMD(jail) {
if (pc_get_group_level(sd) < pc_get_group_level(pl_sd))
{ // you can jail only lower or same GM
- clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
+ clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
@@ -4448,7 +4434,7 @@ ACMD(unjail) {
if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) { // you can jail only lower or same GM
- clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
+ clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
@@ -4525,7 +4511,7 @@ ACMD(jailfor) {
}
if (pc_get_group_level(pl_sd) > pc_get_group_level(sd)) {
- clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
+ clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
@@ -5183,9 +5169,10 @@ ACMD(clearcart)
return false;
}
- if (sd->state.vending == 1) { //Somehow...
- return false;
- }
+ if( sd->state.vending == 1 ) {
+ clif->message(fd, msg_txt(548)); // You can't clean a cart while vending!
+ return false;
+ }
for( i = 0; i < MAX_CART; i++ )
if(sd->status.cart[i].nameid > 0)
@@ -5270,7 +5257,7 @@ ACMD(useskill) {
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
- clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
+ clif->message(fd, msg_txt(81)); // Your GM level don't authorized you to do this action on this player.
return false;
}
@@ -5485,7 +5472,7 @@ ACMD(autotrade) {
status->change_start(NULL,&sd->bl, SC_AUTOTRADE, 10000, 0, 0, 0, 0, ((timeout > 0) ? min(timeout,battle_config.at_timeout) : battle_config.at_timeout) * 60000, 0);
}
- /* currently standalones are not supporting buyingstores, so we rely on the previous method */
+ /* currently standalone is not supporting buyingstores, so we rely on the previous method */
if( sd->state.buyingstore ) {
clif->authfail_fd(fd, 15);
return true;
@@ -6410,7 +6397,7 @@ ACMD(changesex)
int i;
pc->resetskill(sd,4);
- // to avoid any problem with equipment and invalid sex, equipment is unequiped.
+ // to avoid any problem with equipment and invalid sex, equipment is unequipped.
for( i=0; i<EQI_MAX; i++ )
if( sd->equip_index[i] >= 0 ) pc->unequipitem(sd, sd->equip_index[i], 3);
chrif->changesex(sd);
@@ -6436,7 +6423,7 @@ ACMD(mute) {
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
- clif->message(fd, msg_txt(81)); // Your GM level don't authorise you to do this action on this player.
+ clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
@@ -6673,20 +6660,29 @@ ACMD(showmobs)
int number = 0;
struct s_mapiterator* it;
- if(sscanf(message, "%99[^\n]", mob_name) < 0)
+ if( sscanf(message, "%99[^\n]", mob_name) < 0 ) {
+ clif->message(fd, msg_txt(546)); // Please enter a mob name/id (usage: @showmobs <mob name/id>)
return false;
-
- if((mob_id = atoi(mob_name)) == 0)
+ }
+
+ if( (mob_id = atoi(mob_name)) == 0 )
mob_id = mob->db_searchname(mob_name);
+
+ if( mob_id == 0 ) {
+ snprintf(atcmd_output, sizeof atcmd_output, msg_txt(547), mob_name); // Invalid mob name %s!
+ clif->message(fd, atcmd_output);
+ return false;
+ }
+
if(mob_id > 0 && mob->db_checkid(mob_id) == 0){
snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1250),mob_name); // Invalid mob id %s!
clif->message(fd, atcmd_output);
- return true;
+ return false;
}
if(mob->db(mob_id)->status.mode&MD_BOSS && !pc_has_permission(sd, PC_PERM_SHOW_BOSS)){ // If player group does not have access to boss mobs.
clif->message(fd, msg_txt(1251)); // Can't show boss mobs!
- return true;
+ return false;
}
if(mob_id == atoi(mob_name) && mob->db(mob_id)->jname)
@@ -7208,18 +7204,11 @@ ACMD(whereis)
}
ACMD(version) {
- const char *git = get_git_hash();
- const char *svn = get_svn_revision();
-
- if ( git[0] != HERC_UNKNOWN_VER ) {
- sprintf(atcmd_output,msg_txt(1295),git); // Git Hash '%s'
- clif->message(fd,atcmd_output);
- } else if ( svn[0] != HERC_UNKNOWN_VER ) {
- sprintf(atcmd_output,msg_txt(1294),git); // SVN r%s
- clif->message(fd,atcmd_output);
- } else
- clif->message(fd,msg_txt(1296)); // Cannot determine version
-
+ sprintf(atcmd_output, msg_txt(1296), sysinfo->is64bit() ? 64 : 32, sysinfo->platform()); // Hercules %d-bit for %s
+ clif->message(fd, atcmd_output);
+ sprintf(atcmd_output, msg_txt(1295), sysinfo->vcstype(), sysinfo->vcsrevision_src(), sysinfo->vcsrevision_scripts()); // %s revision '%s' (src) / '%s' (scripts)
+ clif->message(fd, atcmd_output);
+
return true;
}
@@ -7438,6 +7427,8 @@ ACMD(fakename){
{
sd->fakename[0] = '\0';
clif->charnameack(0, &sd->bl);
+ if( sd->disguise )
+ clif->charnameack(sd->fd, &sd->bl);
clif->message(sd->fd, msg_txt(1307)); // Returned to real name.
return true;
}
@@ -7454,6 +7445,8 @@ ACMD(fakename){
safestrncpy(sd->fakename, message, sizeof(sd->fakename));
clif->charnameack(0, &sd->bl);
+ if( sd->disguise ) // Another packet should be sent so the client updates the name for sd
+ clif->charnameack(sd->fd, &sd->bl);
clif->message(sd->fd, msg_txt(1310)); // Fake name enabled.
return true;
@@ -7723,7 +7716,7 @@ ACMD(accept) {
}
if(sd->duel_invite <= 0) {
- // "Duel: @accept without invititation."
+ // "Duel: @accept without invitation."
clif->message(fd, msg_txt(360));
return false;
}
@@ -7743,7 +7736,7 @@ ACMD(accept) {
ACMD(reject) {
if(sd->duel_invite <= 0) {
- // "Duel: @reject without invititation."
+ // "Duel: @reject without invitation."
clif->message(fd, msg_txt(362));
return false;
}
@@ -8441,7 +8434,7 @@ ACMD(set) {
if( is_str )
script->set_var(sd, reg, (void*) val);
else
- script->set_var(sd, reg, (void*)__64BPTRSIZE((atoi(val))));
+ script->set_var(sd, reg, (void*)h64BPTRSIZE((atoi(val))));
}
@@ -8655,7 +8648,7 @@ ACMD(join) {
if( hChSys.local && strcmpi(name + 1, hChSys.local_name) == 0 ) {
if( !map->list[sd->bl.m].channel ) {
clif->chsys_mjoin(sd);
- if( map->list[sd->bl.m].channel ) /* mjoin might have refused, map has chatting capabilities disabled */
+ if( map->list[sd->bl.m].channel ) /* join might have refused, map has chatting capabilities disabled */
return true;
} else
channel = map->list[sd->bl.m].channel;
@@ -10058,7 +10051,7 @@ void atcommand_config_read(const char* config_filename) {
}
commandinfo->log = false;
}
- }
+ }
// Commands help
// We only check if all commands exist
@@ -10105,7 +10098,7 @@ static inline int AtCommandType2idx(AtCommandType type) { return (type-1); }
/**
* Loads permissions for groups to use commands.
- *
+ *
*/
void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **commands_, size_t sz)
{