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.c125
1 files changed, 96 insertions, 29 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index bedb58478..c8cca2aea 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -1131,7 +1131,7 @@ ACMD(heal)
}
if ( hp > 0 && sp >= 0 ) {
- if(!status->heal(&sd->bl, hp, sp, 0))
+ if (status->heal(&sd->bl, hp, sp, STATUS_HEAL_DEFAULT) == 0)
clif->message(fd, msg_fd(fd,157)); // HP and SP are already with the good value.
else
clif->message(fd, msg_fd(fd,17)); // HP, SP recovered.
@@ -1148,7 +1148,7 @@ ACMD(heal)
//Opposing signs.
if ( hp ) {
if (hp > 0)
- status->heal(&sd->bl, hp, 0, 0);
+ status->heal(&sd->bl, hp, 0, STATUS_HEAL_DEFAULT);
else {
status->damage(NULL, &sd->bl, -hp, 0, 0, 0);
clif->damage(&sd->bl,&sd->bl, 0, 0, -hp, 0, BDT_ENDURE, 0);
@@ -1157,7 +1157,7 @@ ACMD(heal)
if ( sp ) {
if (sp > 0)
- status->heal(&sd->bl, 0, sp, 0);
+ status->heal(&sd->bl, 0, sp, STATUS_HEAL_DEFAULT);
else
status->damage(NULL, &sd->bl, 0, -sp, 0, 0);
}
@@ -1776,18 +1776,7 @@ ACMD(bodystyle)
memset(atcmd_output, '\0', sizeof(atcmd_output));
- if ((sd->job & MAPID_THIRDMASK) != MAPID_GUILLOTINE_CROSS
- && (sd->job & MAPID_THIRDMASK) != MAPID_GENETIC
- && (sd->job & MAPID_THIRDMASK) != MAPID_MECHANIC
- && (sd->job & MAPID_THIRDMASK) != MAPID_ROYAL_GUARD
- && (sd->job & MAPID_THIRDMASK) != MAPID_ARCH_BISHOP
- && (sd->job & MAPID_THIRDMASK) != MAPID_RANGER
- && (sd->job & MAPID_THIRDMASK) != MAPID_WARLOCK
- && (sd->job & MAPID_THIRDMASK) != MAPID_SHADOW_CHASER
- && (sd->job & MAPID_THIRDMASK) != MAPID_MINSTRELWANDERER
- && (sd->job & MAPID_THIRDMASK) != MAPID_SORCERER
- && (sd->job & MAPID_THIRDMASK) != MAPID_SURA
- ) {
+ if (!pc->has_second_costume(sd)) {
clif->message(fd, msg_fd(fd, 35)); // This job has no alternate body styles.
return false;
}
@@ -1887,6 +1876,63 @@ ACMD(hair_color)
return true;
}
+ACMD(setzone)
+{
+ char zone_name[MAP_ZONE_MAPFLAG_LENGTH];
+ memset(zone_name, '\0', sizeof(zone_name));
+
+ char fmt_str[8] = "";
+ safesnprintf(fmt_str, 8, "%%%ds", MAP_ZONE_MAPFLAG_LENGTH - 1);
+
+ if (*message == '\0' || sscanf(message, fmt_str, zone_name) < 1) {
+ clif->message(fd, msg_fd(fd, 924)); // usage info
+ return false;
+ }
+
+ struct map_zone_data *zone = strdb_get(map->zone_db, zone_name);
+ const char *prev_zone_name = map->list[sd->bl.m].zone->name;
+
+ // handle special zones:
+ if (zone == NULL && strcmp(zone_name, MAP_ZONE_NORMAL_NAME) == 0) {
+ zone = &map->zone_all;
+ } else if (zone == NULL && strcmp(zone_name, MAP_ZONE_PK_NAME) == 0) {
+ zone = &map->zone_pk;
+ }
+
+ if (zone != NULL) {
+ if (map->list[sd->bl.m].zone != zone) {
+ if (strcmp(prev_zone_name, MAP_ZONE_PVP_NAME) == 0) {
+ atcommand_pvpoff(fd, sd, command, message, info);
+ } else if (strcmp(prev_zone_name, MAP_ZONE_GVG_NAME) == 0) {
+ atcommand_gvgoff(fd, sd, command, message, info);
+ } else if (strcmp(prev_zone_name, MAP_ZONE_CVC_NAME) == 0) {
+ atcommand_cvcoff(fd, sd, command, message, info);
+ }
+ } else {
+ safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 925), zone_name);
+ clif->message(fd, atcmd_output); // nothing to do
+ return false;
+ }
+
+ if (strcmp(zone_name, MAP_ZONE_PVP_NAME) == 0) {
+ atcommand_pvpon(fd, sd, command, message, info);
+ } else if (strcmp(zone_name, MAP_ZONE_GVG_NAME) == 0) {
+ atcommand_gvgon(fd, sd, command, message, info);
+ } else if (strcmp(zone_name, MAP_ZONE_CVC_NAME) == 0) {
+ atcommand_cvcon(fd, sd, command, message, info);
+ } else {
+ map->zone_change2(sd->bl.m, zone);
+ }
+ } else {
+ clif->message(fd, msg_fd(fd, 926)); // zone not found
+ return false;
+ }
+
+ safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 927), prev_zone_name, zone_name);
+ clif->message(fd, atcmd_output); // changed successfully
+ return true;
+}
+
/*==========================================
* @go [city_number or city_name] - Updated by Harbin
*------------------------------------------*/
@@ -4240,7 +4286,7 @@ ACMD(repairall)
if (count > 0) {
clif->misceffect(&sd->bl, 3);
- clif->equiplist(sd);
+ clif->equipList(sd);
clif->message(fd, msg_fd(fd,107)); // All items have been repaired.
} else {
clif->message(fd, msg_fd(fd,108)); // No item need to be repaired.
@@ -7688,7 +7734,7 @@ ACMD(mapflag)
CHECKFLAG(nojobexp); CHECKFLAG(nomobloot); CHECKFLAG(nomvploot); CHECKFLAG(nightenabled);
CHECKFLAG(nodrop); CHECKFLAG(novending); CHECKFLAG(loadevent);
CHECKFLAG(nochat); CHECKFLAG(partylock); CHECKFLAG(guildlock); CHECKFLAG(src4instance);
- CHECKFLAG(notomb); CHECKFLAG(nocashshop); CHECKFLAG(noviewid);
+ CHECKFLAG(notomb); CHECKFLAG(nocashshop); CHECKFLAG(noviewid); CHECKFLAG(town);
clif->message(sd->fd," ");
clif->message(sd->fd,msg_fd(fd,1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
clif->message(sd->fd,msg_fd(fd,1313)); // Type "@mapflag available" to list the available mapflags.
@@ -7730,6 +7776,7 @@ ACMD(mapflag)
SETFLAG(nomvploot); SETFLAG(nightenabled); SETFLAG(nodrop); SETFLAG(novending);
SETFLAG(loadevent); SETFLAG(nochat); SETFLAG(partylock); SETFLAG(guildlock);
SETFLAG(src4instance); SETFLAG(notomb); SETFLAG(nocashshop); SETFLAG(noviewid);
+ SETFLAG(town);
clif->message(sd->fd, msg_fd(fd, 1314)); // Invalid flag name or flag.
@@ -8680,19 +8727,19 @@ ACMD(set)
const char *str = NULL;
switch (reg[0]) {
case '@':
- str = pc->readregstr(sd, script->add_str(reg));
+ str = pc->readregstr(sd, script->add_variable(reg));
break;
case '$':
- str = mapreg->readregstr(script->add_str(reg));
+ str = mapreg->readregstr(script->add_variable(reg));
break;
case '#':
if (reg[1] == '#')
- str = pc_readaccountreg2str(sd, script->add_str(reg));// global
+ str = pc_readaccountreg2str(sd, script->add_variable(reg));// global
else
- str = pc_readaccountregstr(sd, script->add_str(reg));// local
+ str = pc_readaccountregstr(sd, script->add_variable(reg));// local
break;
default:
- str = pc_readglobalreg_str(sd, script->add_str(reg));
+ str = pc_readglobalreg_str(sd, script->add_variable(reg));
break;
}
if (str == NULL || str[0] == '\0') {
@@ -8708,19 +8755,19 @@ ACMD(set)
data->type = C_INT;
switch( reg[0] ) {
case '@':
- data->u.num = pc->readreg(sd, script->add_str(reg));
+ data->u.num = pc->readreg(sd, script->add_variable(reg));
break;
case '$':
- data->u.num = mapreg->readreg(script->add_str(reg));
+ data->u.num = mapreg->readreg(script->add_variable(reg));
break;
case '#':
if( reg[1] == '#' )
- data->u.num = pc_readaccountreg2(sd, script->add_str(reg));// global
+ data->u.num = pc_readaccountreg2(sd, script->add_variable(reg));// global
else
- data->u.num = pc_readaccountreg(sd, script->add_str(reg));// local
+ data->u.num = pc_readaccountreg(sd, script->add_variable(reg));// local
break;
default:
- data->u.num = pc_readglobalreg(sd, script->add_str(reg));
+ data->u.num = pc_readglobalreg(sd, script->add_variable(reg));
break;
}
}
@@ -9340,8 +9387,8 @@ ACMD(channel)
} else {
int v = atoi(sub3);
if (k == HCS_OPT_MSG_DELAY) {
- if (v < 0 || v > 10) {
- safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd,1451), v, opt_str[k]);// value '%d' for option '%s' is out of range (limit is 0-10)
+ if (v < 0 || v > channel->config->channel_opt_msg_delay) {
+ safesnprintf(atcmd_output, sizeof(atcmd_output), msg_fd(fd, 1451), v, opt_str[k], channel->config->channel_opt_msg_delay);// value '%d' for option '%s' is out of range (limit is 0-%d)
clif->message(fd, atcmd_output);
return false;
}
@@ -9752,6 +9799,24 @@ ACMD(reloadclans)
return true;
}
+// show camera window or change camera parameters
+ACMD(camerainfo)
+{
+ if (*message == '\0') {
+ clif->camera_showWindow(sd);
+ return true;
+ }
+ float range = 0;
+ float rotation = 0;
+ float latitude = 0;
+ if (sscanf(message, "%15f %15f %15f", &range, &rotation, &latitude) < 3) {
+ clif->message(fd, msg_fd(fd, 452)); // usage @camerainfo range rotation latitude
+ return false;
+ }
+ clif->camera_change(sd, range, rotation, latitude, SELF);
+ return true;
+}
+
/**
* Fills the reference of available commands in atcommand DBMap
**/
@@ -10033,6 +10098,8 @@ static void atcommand_basecommands(void)
ACMD_DEF(joinclan),
ACMD_DEF(leaveclan),
ACMD_DEF(reloadclans),
+ ACMD_DEF(setzone),
+ ACMD_DEF(camerainfo),
};
int i;