summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-11-16 06:35:51 +0100
committerHaru <haru@dotalux.com>2014-11-16 07:16:23 +0100
commit02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f (patch)
tree3161fd5786bb563c32059068eb3b4876d2ae11ca /src/map/atcommand.c
parent31bff051ee3c353fb7ee5e544d68feeaefd4941f (diff)
downloadhercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.gz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.bz2
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.xz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.zip
Whitespace cleanup (no code changes)
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c2289
1 files changed, 1112 insertions, 1177 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index dac51d153..254da5c5b 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -162,15 +162,15 @@ ACMD(send)
{
int len=0,off,end,type;
long num;
-
+
// read message type as hex number (without the 0x)
if(!message || !*message ||
!((sscanf(message, "len %x", &type)==1 && (len=1))
|| sscanf(message, "%x", &type)==1) ) {
clif->message(fd, msg_txt(900)); // Usage:
- clif->message(fd, msg_txt(901)); // @send len <packet hex number>
- clif->message(fd, msg_txt(902)); // @send <packet hex number> {<value>}*
- clif->message(fd, msg_txt(903)); // Value: <type=B(default),W,L><number> or S<length>"<string>"
+ clif->message(fd, msg_txt(901)); // @send len <packet hex number>
+ clif->message(fd, msg_txt(902)); // @send <packet hex number> {<value>}*
+ clif->message(fd, msg_txt(903)); // Value: <type=B(default),W,L><number> or S<length>"<string>"
return false;
}
@@ -200,14 +200,13 @@ ACMD(send)
} while(0) //define GET_VALUE
if (type > 0 && type < MAX_PACKET_DB) {
-
if(len)
{// show packet length
sprintf(atcmd_output, msg_txt(904), type, packet_db[type].len); // Packet 0x%x length: %d
clif->message(fd, atcmd_output);
return true;
}
-
+
len=packet_db[type].len;
off=2;
if(len == 0)
@@ -222,7 +221,7 @@ ACMD(send)
}
WFIFOHEAD(sd->fd, len);
WFIFOW(sd->fd,0)=TOW(type);
-
+
// parse packet contents
SKIP_VALUE(message);
while(*message != 0 && off < len){
@@ -266,7 +265,7 @@ ACMD(send)
++message;
}
}
-
+
// parse string
++message;
CHECK_EOS(message);
@@ -344,7 +343,7 @@ ACMD(send)
++message;
CHECK_EOS(message);
}
-
+
// terminate the string
if(off < end)
{// fill the rest with 0's
@@ -358,7 +357,7 @@ ACMD(send)
}
SKIP_VALUE(message);
}
-
+
if(packet_db[type].len == -1) {// send dynamic packet
WFIFOW(sd->fd,2)=TOW(off);
WFIFOSET(sd->fd,off);
@@ -388,21 +387,20 @@ ACMD(mapmove) {
unsigned short map_index;
short x = 0, y = 0;
int16 m = -1;
-
+
memset(map_name, '\0', sizeof(map_name));
-
+
if (!message || !*message ||
(sscanf(message, "%15s %hd %hd", map_name, &x, &y) < 3 &&
sscanf(message, "%15[^,],%hd,%hd", map_name, &x, &y) < 1)) {
-
clif->message(fd, msg_txt(909)); // Please enter a map (usage: @warp/@rura/@mapmove <mapname> <x> <y>).
return false;
}
-
+
map_index = mapindex->name2id(map_name);
if (map_index)
m = map->mapindex2mapid(map_index);
-
+
if (!map_index || m < 0) { // m < 0 means on different server or that map is disabled! [Kevin]
clif->message(fd, msg_txt(1)); // Map not found.
return false;
@@ -412,7 +410,7 @@ ACMD(mapmove) {
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.
clif->message(fd, msg_txt(2));
@@ -431,7 +429,7 @@ ACMD(mapmove) {
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
-
+
clif->message(fd, msg_txt(0)); // Warped.
return true;
}
@@ -441,14 +439,14 @@ ACMD(mapmove) {
*------------------------------------------*/
ACMD(where) {
struct map_session_data* pl_sd;
-
+
memset(atcmd_player_name, '\0', sizeof atcmd_player_name);
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif->message(fd, msg_txt(910)); // Please enter a player name (usage: @where <char name>).
return false;
}
-
+
pl_sd = map->nick2sd(atcmd_player_name);
if (pl_sd == NULL ||
strncmp(pl_sd->status.name, atcmd_player_name, NAME_LENGTH) != 0 ||
@@ -457,10 +455,10 @@ ACMD(where) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
snprintf(atcmd_output, sizeof atcmd_output, "%s %s %d %d", pl_sd->status.name, mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y);
clif->message(fd, atcmd_output);
-
+
return true;
}
@@ -489,7 +487,7 @@ ACMD(jumpto) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
if (pl_sd->bl.m >= 0 && map->list[pl_sd->bl.m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(247)); // You are not authorized to warp to this map.
return false;
@@ -513,21 +511,21 @@ ACMD(jumpto) {
ACMD(jump)
{
short x = 0, y = 0;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
sscanf(message, "%hd %hd", &x, &y);
-
+
if (map->list[sd->bl.m].flag.noteleport && !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 ((x || y) && map->getcell(sd->bl.m, x, y, CELL_CHKNOPASS)) {
//This is to prevent the pc->setpos call from printing an error.
clif->message(fd, msg_txt(2));
@@ -539,7 +537,7 @@ ACMD(jump)
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
clif->message(fd, atcmd_output);
@@ -565,24 +563,24 @@ ACMD(who) {
*/
int display_type = 1;
int map_id = -1;
-
+
if (stristr(info->command, "map") != NULL) {
if (sscanf(message, "%15s %23s", map_name, player_name) < 1 || (map_id = map->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
} else {
sscanf(message, "%23s", player_name);
}
-
+
if (stristr(info->command, "2") != NULL)
display_type = 2;
else if (stristr(info->command, "3") != NULL)
display_type = 3;
-
+
level = pc_get_group_level(sd);
StrBuf->Init(&buf);
-
+
iter = mapit_getallusers();
- for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) {
+ for (pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter)) {
if (!((pc_has_permission(pl_sd, PC_PERM_HIDE_SESSION) || pc_isinvisible(pl_sd)) && pc_get_group_level(pl_sd) > level)) { // you can look only lower or same level
if (stristr(pl_sd->status.name, player_name) == NULL // search with no case sensitive
|| (map_id >= 0 && pl_sd->bl.m != map_id))
@@ -598,7 +596,7 @@ ACMD(who) {
}
case 3: {
if (pc_has_permission(sd, PC_PERM_WHO_DISPLAY_AID))
- StrBuf->Printf(&buf, msg_txt(912), pl_sd->status.char_id, pl_sd->status.account_id); // "(CID:%d/AID:%d) "
+ StrBuf->Printf(&buf, msg_txt(912), pl_sd->status.char_id, pl_sd->status.account_id); // "(CID:%d/AID:%d) "
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
StrBuf->Printf(&buf, msg_txt(344), pcg->get_name(pl_sd->group)); // "(%s) "
@@ -608,7 +606,7 @@ ACMD(who) {
default: {
struct party_data *p = party->search(pl_sd->status.party_id);
struct guild *g = pl_sd->guild;
-
+
StrBuf->Printf(&buf, msg_txt(343), pl_sd->status.name); // "Name: %s "
if (pc_get_group_id(pl_sd) > 0) // Player title, if exists
StrBuf->Printf(&buf, msg_txt(344), pcg->get_name(pl_sd->group)); // "(%s) "
@@ -625,7 +623,7 @@ ACMD(who) {
}
}
mapit->free(iter);
-
+
if (map_id < 0) {
if (count == 0)
StrBuf->Printf(&buf, msg_txt(28)); // No player found.
@@ -659,32 +657,32 @@ ACMD(whogm)
char player_name[NAME_LENGTH];
struct guild *g;
struct party_data *p;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(match_text, '\0', sizeof(match_text));
memset(player_name, '\0', sizeof(player_name));
-
+
if (sscanf(message, "%199[^\n]", match_text) < 1)
strcpy(match_text, "");
for (j = 0; match_text[j]; j++)
match_text[j] = TOLOWER(match_text[j]);
-
+
count = 0;
level = pc_get_group_level(sd);
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
pl_level = pc_get_group_level(pl_sd);
if (!pl_level)
continue;
-
+
if (match_text[0])
{
memcpy(player_name, pl_sd->status.name, NAME_LENGTH);
for (j = 0; player_name[j]; j++)
player_name[j] = TOLOWER(player_name[j]);
- // search with no case sensitive
+ // search with no case sensitive
if (strstr(player_name, match_text) == NULL)
continue;
}
@@ -696,28 +694,28 @@ ACMD(whogm)
count++;
continue;
}
-
+
sprintf(atcmd_output, msg_txt(914), // Name: %s (GM:%d) | Location: %s %d %d
pl_sd->status.name, pl_level,
mapindex_id2name(pl_sd->mapindex), pl_sd->bl.x, pl_sd->bl.y);
clif->message(fd, atcmd_output);
-
+
sprintf(atcmd_output, msg_txt(915), // BLvl: %d | Job: %s (Lvl: %d)
pl_sd->status.base_level,
pc->job_name(pl_sd->status.class_), pl_sd->status.job_level);
clif->message(fd, atcmd_output);
-
+
p = party->search(pl_sd->status.party_id);
g = pl_sd->guild;
-
- sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s'
- p?p->party.name:msg_txt(917), g?g->name:msg_txt(917)); // None.
-
+
+ sprintf(atcmd_output,msg_txt(916), // Party: '%s' | Guild: '%s'
+ p?p->party.name:msg_txt(917), g?g->name:msg_txt(917)); // None.
+
clif->message(fd, atcmd_output);
count++;
}
mapit->free(iter);
-
+
if (count == 0)
clif->message(fd, msg_txt(150)); // No GM found.
else if (count == 1)
@@ -726,23 +724,23 @@ ACMD(whogm)
sprintf(atcmd_output, msg_txt(152), count); // %d GMs found.
clif->message(fd, atcmd_output);
}
-
+
return true;
}
/*==========================================
*
*------------------------------------------*/
-ACMD(save) {
-
+ACMD(save)
+{
pc->setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
if (sd->status.pet_id > 0 && sd->pd)
intif->save_petdata(sd->status.account_id, &sd->pd->pet);
-
+
chrif->save(sd,0);
-
+
clif->message(fd, msg_txt(6)); // Your save point has been changed.
-
+
return true;
}
@@ -751,7 +749,7 @@ ACMD(save) {
*------------------------------------------*/
ACMD(load) {
int16 m;
-
+
m = map->mapindex2mapid(sd->status.save_point.map);
if (m >= 0 && map->list[m].flag.nowarpto && !pc_has_permission(sd, PC_PERM_WARP_ANYWHERE)) {
clif->message(fd, msg_txt(249)); // You are not authorized to warp to your save map.
@@ -761,10 +759,10 @@ ACMD(load) {
clif->message(fd, msg_txt(248)); // You are not authorized to warp from your current map.
return false;
}
-
+
pc->setpos(sd, sd->status.save_point.map, sd->status.save_point.x, sd->status.save_point.y, CLR_OUTSIGHT);
clif->message(fd, msg_txt(7)); // Warping to save point..
-
+
return true;
}
@@ -774,30 +772,30 @@ ACMD(load) {
ACMD(speed)
{
int speed;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%d", &speed) < 1) {
sprintf(atcmd_output, msg_txt(918), MIN_WALK_SPEED, MAX_WALK_SPEED); // Please enter a speed value (usage: @speed <%d-%d>).
clif->message(fd, atcmd_output);
return false;
}
-
+
sd->state.permanent_speed = 0;
-
+
if (speed < 0)
sd->base_status.speed = DEFAULT_WALK_SPEED;
else
sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
-
+
if( sd->base_status.speed != DEFAULT_WALK_SPEED ) {
sd->state.permanent_speed = 1; // Set lock when set to non-default speed.
clif->message(fd, msg_txt(8)); // Speed changed.
} else
clif->message(fd, msg_txt(172)); //Speed returned to normal.
-
+
status_calc_bl(&sd->bl, SCB_SPEED);
-
+
return true;
}
@@ -808,14 +806,14 @@ ACMD(storage)
{
if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag)
return false;
-
+
if (storage->open(sd) == 1) { //Already open.
clif->message(fd, msg_txt(250));
return false;
}
-
+
clif->message(fd, msg_txt(919)); // Storage opened.
-
+
return true;
}
@@ -829,20 +827,20 @@ ACMD(guildstorage)
clif->message(fd, msg_txt(252));
return false;
}
-
+
if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading)
return false;
-
+
if (sd->state.storage_flag == 1) {
clif->message(fd, msg_txt(250));
return false;
}
-
+
if (sd->state.storage_flag == 2) {
clif->message(fd, msg_txt(251));
return false;
}
-
+
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;
@@ -858,30 +856,30 @@ ACMD(guildstorage)
ACMD(option)
{
int param1 = 0, param2 = 0, param3 = 0;
-
+
if (!message || !*message || sscanf(message, "%d %d %d", &param1, &param2, &param3) < 1 || param1 < 0 || param2 < 0 || param3 < 0)
{// failed to match the parameters so inform the user of the options
const char* text;
-
+
// attempt to find the setting information for this command
text = atcommand_help_string( info );
-
+
// notify the user of the requirement to enter an option
clif->message(fd, msg_txt(921)); // Please enter at least one option.
-
+
if( text ) {// send the help text associated with this command
clif->messageln( fd, text );
}
-
+
return false;
}
-
+
sd->sc.opt1 = param1;
sd->sc.opt2 = param2;
pc->setoption(sd, param3);
-
+
clif->message(fd, msg_txt(9)); // Options changed.
-
+
return true;
}
@@ -896,10 +894,10 @@ ACMD(hide) {
else
status->set_viewdata(&sd->bl, sd->status.class_);
clif->message(fd, msg_txt(10)); // Invisible: Off
-
+
// increment the number of pvp players on the map
map->list[sd->bl.m].users_pvp++;
-
+
if( map->list[sd->bl.m].flag.pvp && !map->list[sd->bl.m].flag.pvp_nocalcrank ) {
// register the player for ranking calculations
sd->pvp_timer = timer->add( timer->gettick() + 200, pc->calc_pvprank_timer, sd->bl.id, 0 );
@@ -910,10 +908,10 @@ ACMD(hide) {
sd->sc.option |= OPTION_INVISIBLE;
sd->vd.class_ = INVISIBLE_CLASS;
clif->message(fd, msg_txt(11)); // Invisible: On
-
+
// decrement the number of pvp players on the map
map->list[sd->bl.m].users_pvp--;
-
+
if( map->list[sd->bl.m].flag.pvp && !map->list[sd->bl.m].flag.pvp_nocalcrank && sd->pvp_timer != INVALID_TIMER ) {
// unregister the player for ranking
timer->delete( sd->pvp_timer, pc->calc_pvprank_timer );
@@ -921,7 +919,7 @@ ACMD(hide) {
}
}
clif->changeoption(&sd->bl);
-
+
return true;
}
@@ -931,11 +929,11 @@ ACMD(hide) {
ACMD(jobchange) {
int job = 0, upper = 0;
const char* text;
-
+
if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) {
upper = 0;
-
- if( message ) {
+
+ if( message ) {
int i;
bool found = false;
@@ -946,7 +944,7 @@ ACMD(jobchange) {
found = true;
}
}
-
+
// High Jobs, Babies and Third
for( i = JOB_NOVICE_HIGH; i < JOB_MAX && !found; i++ ){
if (strncmpi(message, pc->job_name(i), 16) == 0) {
@@ -954,7 +952,7 @@ ACMD(jobchange) {
found = true;
}
}
-
+
if (!found) {
text = atcommand_help_string(info);
if (text)
@@ -965,14 +963,14 @@ ACMD(jobchange) {
}
/* WHY DO WE LIST THEM THEN? */
// Deny direct transformation into dummy jobs
- if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER
- || job == JOB_LORD_KNIGHT2 || job == JOB_PALADIN2 || job == JOB_BABY_KNIGHT2 || job == JOB_BABY_CRUSADER2 || job == JOB_STAR_GLADIATOR2
- || (job >= JOB_RUNE_KNIGHT2 && job <= JOB_MECHANIC_T2) || (job >= JOB_BABY_RUNE2 && job <= JOB_BABY_MECHANIC2)
- ) {
+ if (job == JOB_KNIGHT2 || job == JOB_CRUSADER2 || job == JOB_WEDDING || job == JOB_XMAS || job == JOB_SUMMER
+ || job == JOB_LORD_KNIGHT2 || job == JOB_PALADIN2 || job == JOB_BABY_KNIGHT2 || job == JOB_BABY_CRUSADER2 || job == JOB_STAR_GLADIATOR2
+ || (job >= JOB_RUNE_KNIGHT2 && job <= JOB_MECHANIC_T2) || (job >= JOB_BABY_RUNE2 && job <= JOB_BABY_MECHANIC2)
+ ) {
clif->message(fd, msg_txt(923)); //"You can not change to this job by command."
return true;
}
-
+
if (pcdb_checkid(job)) {
if (pc->jobchange(sd, job, upper) == 0)
clif->message(fd, msg_txt(12)); // Your job has been changed.
@@ -982,11 +980,11 @@ ACMD(jobchange) {
}
} else {
text = atcommand_help_string(info);
- if (text)
- clif->messageln(fd, text);
+ if (text)
+ clif->messageln(fd, text);
return false;
}
-
+
return true;
}
@@ -1022,15 +1020,15 @@ ACMD(alive)
ACMD(kami)
{
unsigned int color=0;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if(*(info->command + 4) != 'c' && *(info->command + 4) != 'C') {
if (!message || !*message) {
clif->message(fd, msg_txt(980)); // Please enter a message (usage: @kami <message>).
return false;
}
-
+
sscanf(message, "%199[^\n]", atcmd_output);
if (stristr(info->command, "l") != NULL)
clif->broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
@@ -1041,7 +1039,7 @@ ACMD(kami)
clif->message(fd, msg_txt(981)); // Please enter color and message (usage: @kamic <color> <message>).
return false;
}
-
+
if(color > 0xFFFFFF) {
clif->message(fd, msg_txt(982)); // Invalid color.
return false;
@@ -1057,13 +1055,13 @@ ACMD(kami)
ACMD(heal)
{
int hp = 0, sp = 0; // [Valaris] thanks to fov
-
+
sscanf(message, "%d %d", &hp, &sp);
-
+
// some overflow checks
if( hp == INT_MIN ) hp++;
if( sp == INT_MIN ) sp++;
-
+
if ( hp == 0 && sp == 0 ) {
if (!status_percent_heal(&sd->bl, 100, 100))
clif->message(fd, msg_txt(157)); // HP and SP have already been recovered.
@@ -1071,7 +1069,7 @@ ACMD(heal)
clif->message(fd, msg_txt(17)); // HP, SP recovered.
return true;
}
-
+
if ( hp > 0 && sp >= 0 ) {
if(!status->heal(&sd->bl, hp, sp, 0))
clif->message(fd, msg_txt(157)); // HP and SP are already with the good value.
@@ -1079,14 +1077,14 @@ ACMD(heal)
clif->message(fd, msg_txt(17)); // HP, SP recovered.
return true;
}
-
+
if ( hp < 0 && sp <= 0 ) {
status->damage(NULL, &sd->bl, -hp, -sp, 0, 0);
clif->damage(&sd->bl,&sd->bl, 0, 0, -hp, 0, 4, 0);
clif->message(fd, msg_txt(156)); // HP or/and SP modified.
return true;
}
-
+
//Opposing signs.
if ( hp ) {
if (hp > 0)
@@ -1096,14 +1094,14 @@ ACMD(heal)
clif->damage(&sd->bl,&sd->bl, 0, 0, -hp, 0, 4, 0);
}
}
-
+
if ( sp ) {
if (sp > 0)
status->heal(&sd->bl, 0, sp, 0);
else
status->damage(NULL, &sd->bl, 0, -sp, 0, 0);
}
-
+
clif->message(fd, msg_txt(156)); // HP or/and SP modified.
return true;
}
@@ -1119,7 +1117,7 @@ ACMD(item)
struct item item_tmp;
struct item_data *item_data;
int get_count, i;
-
+
memset(item_name, '\0', sizeof(item_name));
if (!strcmpi(info->command,"itembound") && (!message || !*message || (
@@ -1128,24 +1126,24 @@ ACMD(item)
))) {
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 ))
- {
- clif->message(fd, msg_txt(983)); // Please enter an item name or ID (usage: @item <item name/ID> <quantity>).
+ } else if (!message || !*message
+ || ( 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;
}
-
+
if (number <= 0)
number = 1;
-
+
if ((item_data = itemdb->search_name(item_name)) == NULL &&
(item_data = itemdb->exists(atoi(item_name))) == NULL)
{
clif->message(fd, msg_txt(19)); // Invalid item ID or name.
return false;
}
-
+
if(!strcmpi(info->command,"itembound") ) {
if( !(bound >= IBT_MIN && bound <= IBT_MAX) ) {
clif->message(fd, msg_txt(298)); // Invalid bound type
@@ -1178,9 +1176,9 @@ ACMD(item)
clif->message(fd, msg_txt(498)); // Cannot create bounded pet eggs or pet armors.
return false;
}
- get_count = 1;
+ get_count = 1;
}
-
+
for (i = 0; i < number; i += get_count) {
// if not pet egg
if (!pet->create_egg(sd, item_id)) {
@@ -1188,12 +1186,12 @@ ACMD(item)
item_tmp.nameid = item_id;
item_tmp.identify = 1;
item_tmp.bound = (unsigned char)bound;
-
+
if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
}
-
+
if (flag == 0)
clif->message(fd, msg_txt(18)); // Item created.
return true;
@@ -1210,24 +1208,24 @@ ACMD(item2)
int item_id, number = 0, bound = 0;
int identify = 0, refine = 0, attr = 0;
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
-
+
memset(item_name, '\0', sizeof(item_name));
-
+
if (!strcmpi(info->command,"itembound2") && (!message || !*message || (
sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 &&
sscanf(message, "%99s %d %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4, &bound) < 10 ))) {
clif->message(fd, msg_txt(296)); // Please enter all parameters (usage: @itembound2 <item name/ID> <quantity>
clif->message(fd, msg_txt(297)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4> <bound_type>).
return false;
- } else if ( !message || !*message || (
- sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9 &&
- sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9
- )) {
+ } else if ( !message || !*message
+ || ( sscanf(message, "\"%99[^\"]\" %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9
+ && sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number, &identify, &refine, &attr, &c1, &c2, &c3, &c4) < 9
+ )) {
clif->message(fd, msg_txt(984)); // Please enter all parameters (usage: @item2 <item name/ID> <quantity>
clif->message(fd, msg_txt(985)); // <identify_flag> <refine> <attribute> <card1> <card2> <card3> <card4>).
return false;
}
-
+
if (number <= 0)
number = 1;
@@ -1240,7 +1238,7 @@ ACMD(item2)
if ((item_data = itemdb->search_name(item_name)) != NULL ||
(item_data = itemdb->exists(atoi(item_name))) != NULL)
item_id = item_data->nameid;
-
+
if (item_id > 500) {
int flag = 0;
int loop, get_count, i;
@@ -1253,7 +1251,7 @@ ACMD(item2)
clif->message(fd, msg_txt(498)); // Cannot create bounded pet eggs or pet armors.
return false;
}
- loop = number;
+ loop = number;
get_count = 1;
if (item_data->type == IT_PETEGG) {
identify = 1;
@@ -1278,18 +1276,18 @@ ACMD(item2)
item_tmp.card[1] = c2;
item_tmp.card[2] = c3;
item_tmp.card[3] = c4;
-
+
if ((flag = pc->additem(sd, &item_tmp, get_count, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
}
-
+
if (flag == 0)
clif->message(fd, msg_txt(18)); // Item created.
} else {
clif->message(fd, msg_txt(19)); // Invalid item ID or name.
return false;
}
-
+
return true;
}
@@ -1299,14 +1297,14 @@ ACMD(item2)
ACMD(itemreset)
{
int i;
-
+
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
pc->delitem(sd, i, sd->status.inventory[i].amount, 0, 0, LOG_TYPE_COMMAND);
}
}
clif->message(fd, msg_txt(20)); // All of your items have been removed.
-
+
return true;
}
@@ -1318,12 +1316,12 @@ ACMD(baselevelup)
int level=0, i=0, status_point=0;
level = atoi(message);
-
+
if (!message || !*message || !level) {
clif->message(fd, msg_txt(986)); // Please enter a level adjustment (usage: @lvup/@blevel/@baselvlup <number of levels>).
return false;
}
-
+
if (level > 0) {
if (sd->status.base_level >= pc->maxbaselv(sd)) { // check for max level by Valaris
clif->message(fd, msg_txt(47)); // Base level can't go any higher.
@@ -1333,7 +1331,7 @@ ACMD(baselevelup)
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);
-
+
sd->status.status_point += status_point;
sd->status.base_level += (unsigned int)level;
status_calc_pc(sd, SCO_FORCE);
@@ -1377,9 +1375,9 @@ ACMD(baselevelup)
ACMD(joblevelup)
{
int level=0;
-
+
level = atoi(message);
-
+
if (!message || !*message || !level) {
clif->message(fd, msg_txt(987)); // Please enter a level adjustment (usage: @joblvup/@jlevel/@joblvlup <number of levels>).
return false;
@@ -1405,7 +1403,7 @@ ACMD(joblevelup)
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 subtract 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
@@ -1418,7 +1416,7 @@ ACMD(joblevelup)
clif->updatestatus(sd, SP_NEXTJOBEXP);
clif->updatestatus(sd, SP_SKILLPOINT);
status_calc_pc(sd, SCO_FORCE);
-
+
return true;
}
@@ -1429,7 +1427,7 @@ ACMD(help) {
const char *command_name = NULL;
char *default_command = "help";
AtCommandInfo *tinfo = NULL;
-
+
if (!message || !*message) {
command_name = default_command; // If no command_name specified, display help for @help.
} else {
@@ -1437,33 +1435,33 @@ ACMD(help) {
++message;
command_name = atcommand->check_alias(message);
}
-
+
if (!atcommand->can_use2(sd, command_name, COMMAND_ATCOMMAND)) {
sprintf(atcmd_output, msg_txt(153), message); // "%s is Unknown Command"
clif->message(fd, atcmd_output);
atcommand->get_suggestions(sd, command_name, true);
return false;
}
-
+
tinfo = atcommand->get_info_byname(atcommand->check_alias(command_name));
-
+
if ( !tinfo || tinfo->help == NULL ) {
sprintf(atcmd_output, msg_txt(988), atcommand->at_symbol, command_name); // There is no help for %c%s.
clif->message(fd, atcmd_output);
atcommand->get_suggestions(sd, command_name, true);
return false;
}
-
+
sprintf(atcmd_output, msg_txt(989), atcommand->at_symbol, command_name); // Help for command %c%s:
clif->message(fd, atcmd_output);
-
+
{ // Display aliases
DBIterator* iter;
AtCommandInfo *command_info;
AliasInfo *alias_info = NULL;
StringBuf buf;
bool has_aliases = false;
-
+
StrBuf->Init(&buf);
StrBuf->AppendStr(&buf, msg_txt(990)); // Available aliases:
command_info = atcommand->get_info_byname(command_name);
@@ -1479,7 +1477,7 @@ ACMD(help) {
clif->message(fd, StrBuf->Value(&buf));
StrBuf->Destroy(&buf);
}
-
+
// Display help contents
clif->message(fd, tinfo->help);
return true;
@@ -1512,16 +1510,16 @@ int atcommand_pvpoff_sub(struct block_list *bl,va_list ap)
return 0;
}
-ACMD(pvpoff) {
-
+ACMD(pvpoff)
+{
if (!map->list[sd->bl.m].flag.pvp) {
clif->message(fd, msg_txt(160)); // PvP is already Off.
return false;
}
-
+
map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone);
map->list[sd->bl.m].flag.pvp = 0;
-
+
if (!battle_config.pk_mode) {
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
@@ -1549,24 +1547,24 @@ int atcommand_pvpon_sub(struct block_list *bl,va_list ap)
return 0;
}
-ACMD(pvpon) {
-
+ACMD(pvpon)
+{
if (map->list[sd->bl.m].flag.pvp) {
clif->message(fd, msg_txt(161)); // PvP is already On.
return false;
}
-
+
map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_PVP_NAME));
map->list[sd->bl.m].flag.pvp = 1;
-
+
if (!battle_config.pk_mode) {// display pvp circle and rank
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_FREEPVPZONE);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
map->foreachinmap(atcommand->pvpon_sub,sd->bl.m, BL_PC);
}
-
+
clif->message(fd, msg_txt(32)); // PvP: On.
-
+
return true;
}
@@ -1574,38 +1572,38 @@ ACMD(pvpon) {
*
*------------------------------------------*/
ACMD(gvgoff) {
-
+
if (!map->list[sd->bl.m].flag.gvg) {
clif->message(fd, msg_txt(162)); // GvG is already Off.
return false;
}
-
+
map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone);
map->list[sd->bl.m].flag.gvg = 0;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
map->foreachinmap(atcommand->stopattack,sd->bl.m, BL_CHAR, 0);
clif->message(fd, msg_txt(33)); // GvG: Off.
-
+
return true;
}
/*==========================================
*
*------------------------------------------*/
-ACMD(gvgon) {
-
+ACMD(gvgon)
+{
if (map->list[sd->bl.m].flag.gvg) {
clif->message(fd, msg_txt(163)); // GvG is already On.
return false;
}
-
+
map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_GVG_NAME));
map->list[sd->bl.m].flag.gvg = 1;
clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE);
clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP);
clif->message(fd, msg_txt(34)); // GvG: On.
-
+
return true;
}
@@ -1615,16 +1613,16 @@ ACMD(gvgon) {
ACMD(model)
{
int hair_style = 0, hair_color = 0, cloth_color = 0;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%d %d %d", &hair_style, &hair_color, &cloth_color) < 1) {
sprintf(atcmd_output, msg_txt(991), // Please enter at least one value (usage: @model <hair ID: %d-%d> <hair color: %d-%d> <clothes color: %d-%d>).
MIN_HAIR_STYLE, MAX_HAIR_STYLE, MIN_HAIR_COLOR, MAX_HAIR_COLOR, MIN_CLOTH_COLOR, MAX_CLOTH_COLOR);
clif->message(fd, atcmd_output);
return false;
}
-
+
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE &&
hair_color >= MIN_HAIR_COLOR && hair_color <= MAX_HAIR_COLOR &&
cloth_color >= MIN_CLOTH_COLOR && cloth_color <= MAX_CLOTH_COLOR) {
@@ -1636,7 +1634,7 @@ ACMD(model)
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
}
-
+
return true;
}
@@ -1646,15 +1644,15 @@ ACMD(model)
ACMD(dye)
{
int cloth_color = 0;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%d", &cloth_color) < 1) {
sprintf(atcmd_output, msg_txt(992), MIN_CLOTH_COLOR, MAX_CLOTH_COLOR); // Please enter a clothes color (usage: @dye/@ccolor <clothes color: %d-%d>).
clif->message(fd, atcmd_output);
return false;
}
-
+
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)); // Appearance changed.
@@ -1662,7 +1660,7 @@ ACMD(dye)
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
}
-
+
return true;
}
@@ -1672,15 +1670,15 @@ ACMD(dye)
ACMD(hair_style)
{
int hair_style = 0;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%d", &hair_style) < 1) {
sprintf(atcmd_output, msg_txt(993), MIN_HAIR_STYLE, MAX_HAIR_STYLE); // Please enter a hair style (usage: @hairstyle/@hstyle <hair ID: %d-%d>).
clif->message(fd, atcmd_output);
return false;
}
-
+
if (hair_style >= MIN_HAIR_STYLE && hair_style <= MAX_HAIR_STYLE) {
pc->changelook(sd, LOOK_HAIR, hair_style);
clif->message(fd, msg_txt(36)); // Appearance changed.
@@ -1688,7 +1686,7 @@ ACMD(hair_style)
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
}
-
+
return true;
}
@@ -1698,15 +1696,15 @@ ACMD(hair_style)
ACMD(hair_color)
{
int hair_color = 0;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%d", &hair_color) < 1) {
sprintf(atcmd_output, msg_txt(994), MIN_HAIR_COLOR, MAX_HAIR_COLOR); // Please enter a hair color (usage: @haircolor/@hcolor <hair color: %d-%d>).
clif->message(fd, atcmd_output);
return false;
}
-
+
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)); // Appearance changed.
@@ -1714,7 +1712,7 @@ ACMD(hair_color)
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
}
-
+
return true;
}
@@ -1725,7 +1723,7 @@ ACMD(go) {
int i;
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];
-
+
const struct {
char map[MAP_NAME_LENGTH];
int x, y;
@@ -1772,23 +1770,23 @@ ACMD(go) {
{ 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));
-
+
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
text = atcommand_help_string( info );
-
+
clif->message(fd, msg_txt(38)); // Invalid location number, or name.
-
+
if( text ) {// send the text to the client
clif->messageln( fd, text );
}
-
+
return false;
}
@@ -1852,7 +1850,7 @@ ACMD(go) {
clif->message(fd, msg_txt(38)); // Invalid location number or name.
return false;
}
-
+
return true;
}
@@ -1870,11 +1868,11 @@ ACMD(monster)
int i, k, range;
short mx, my;
unsigned int size;
-
+
memset(name, '\0', sizeof(name));
memset(monster, '\0', sizeof(monster));
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(80)); // Please specify a display name or monster name/id.
return false;
@@ -1895,35 +1893,35 @@ ACMD(monster)
clif->message(fd, msg_txt(80)); // Give a display name and monster name/id please.
return false;
}
-
+
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) {
clif->message(fd, msg_txt(40)); // Invalid monster ID or name.
return false;
}
-
+
if (number <= 0)
number = 1;
-
+
if( !name[0] )
strcpy(name, "--ja--");
-
+
// If value of atcommand_spawn_quantity_limit directive is greater than or equal to 1 and quantity of monsters is greater than value of the directive
if (battle_config.atc_spawn_quantity_limit && number > battle_config.atc_spawn_quantity_limit)
number = battle_config.atc_spawn_quantity_limit;
-
+
if (strcmpi(info->command, "monstersmall") == 0)
size = SZ_MEDIUM;
else if (strcmpi(info->command, "monsterbig") == 0)
size = SZ_BIG;
else
size = SZ_SMALL;
-
+
if (battle_config.etc_log)
ShowInfo("%s monster='%s' name='%s' id=%d count=%d (%d,%d)\n", command, monster, name, mob_id, number, sd->bl.x, sd->bl.y);
-
+
count = 0;
range = (int)sqrt((float)number) +2; // calculation of an odd number (+ 4 area around)
for (i = 0; i < number; i++) {
@@ -1931,7 +1929,7 @@ ACMD(monster)
k = mob->once_spawn(sd, sd->bl.m, mx, my, name, mob_id, 1, eventname, size, AI_NONE|(mob_id == MOBID_EMPERIUM?0x200:0x0));
count += (k != 0) ? 1 : 0;
}
-
+
if (count != 0)
if (number == count)
clif->message(fd, msg_txt(39)); // All monster summoned!
@@ -1943,7 +1941,7 @@ ACMD(monster)
clif->message(fd, msg_txt(40)); // Invalid monster ID or name.
return false;
}
-
+
return true;
}
@@ -1954,13 +1952,13 @@ int atkillmonster_sub(struct block_list *bl, va_list ap)
{
struct mob_data *md;
int flag;
-
+
nullpo_ret(md=(struct mob_data *)bl);
flag = va_arg(ap, int);
-
+
if (md->guardian_data)
return 0; //Do not touch WoE mobs!
-
+
if (flag)
status_zap(bl,md->status.hp, 0);
else
@@ -1971,22 +1969,22 @@ int atkillmonster_sub(struct block_list *bl, va_list ap)
ACMD(killmonster) {
int map_id, drop_flag;
char map_name[MAP_NAME_LENGTH_EXT];
-
+
memset(map_name, '\0', sizeof(map_name));
-
+
if (!message || !*message || sscanf(message, "%15s", map_name) < 1)
map_id = sd->bl.m;
else {
if ((map_id = map->mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
-
+
drop_flag = strcmpi(info->command, "killmonster2");
-
+
map->foreachinmap(atcommand->atkillmonster_sub, map_id, BL_MOB, -drop_flag);
-
+
clif->message(fd, msg_txt(165)); // All monsters killed!
-
+
return true;
}
@@ -1997,9 +1995,9 @@ ACMD(refine)
{
int i,j, position = 0, refine = 0, current_position, final_refine;
int count;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%d %d", &position, &refine) < 2) {
clif->message(fd, msg_txt(996)); // Please enter a position and an amount (usage: @refine <equip position> <+/- amount>).
sprintf(atcmd_output, msg_txt(997), EQP_HEAD_LOW); // %d: Lower Headgear
@@ -2024,9 +2022,9 @@ ACMD(refine)
clif->message(fd, atcmd_output);
return false;
}
-
+
refine = cap_value(refine, -MAX_REFINE, MAX_REFINE);
-
+
count = 0;
for (j = 0; j < EQI_MAX; j++) {
if ((i = sd->equip_index[j]) < 0)
@@ -2038,10 +2036,10 @@ ACMD(refine)
continue;
if(j == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == i || sd->equip_index[EQI_HEAD_LOW] == i))
continue;
-
+
if(position && !(sd->status.inventory[i].equip & position))
continue;
-
+
final_refine = cap_value(sd->status.inventory[i].refine + refine, 0, MAX_REFINE);
if (sd->status.inventory[i].refine != final_refine) {
sd->status.inventory[i].refine = final_refine;
@@ -2055,7 +2053,7 @@ ACMD(refine)
count++;
}
}
-
+
if (count == 0)
clif->message(fd, msg_txt(166)); // No item has been refined.
else if (count == 1)
@@ -2064,7 +2062,7 @@ ACMD(refine)
sprintf(atcmd_output, msg_txt(168), count); // %d items have been refined.
clif->message(fd, atcmd_output);
}
-
+
return true;
}
@@ -2077,10 +2075,10 @@ ACMD(produce)
int item_id, attribute = 0, star = 0;
struct item_data *item_data;
struct item tmp_item;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(item_name, '\0', sizeof(item_name));
-
+
if (!message || !*message || (
sscanf(message, "\"%99[^\"]\" %d %d", item_name, &attribute, &star) < 1 &&
sscanf(message, "%99s %d %d", item_name, &attribute, &star) < 1
@@ -2088,15 +2086,15 @@ ACMD(produce)
clif->message(fd, msg_txt(1007)); // Please enter at least one item name/ID (usage: @produce <equip name/ID> <element> <# of very's>).
return false;
}
-
+
if ( (item_data = itemdb->search_name(item_name)) == NULL &&
(item_data = itemdb->exists(atoi(item_name))) == NULL ) {
clif->message(fd, msg_txt(170)); //This item is not an equipment.
return false;
}
-
+
item_id = item_data->nameid;
-
+
if (itemdb->isequip2(item_data)) {
int flag = 0;
if (attribute < MIN_ATTRIBUTE || attribute > MAX_ATTRIBUTE)
@@ -2114,7 +2112,7 @@ ACMD(produce)
tmp_item.card[3] = GetWord(sd->status.char_id, 1);
clif->produce_effect(sd, 0, item_id);
clif->misceffect(&sd->bl, 3);
-
+
if ((flag = pc->additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
clif->additem(sd, 0, 0, flag);
} else {
@@ -2122,7 +2120,7 @@ ACMD(produce)
clif->message(fd, atcmd_output);
return false;
}
-
+
return true;
}
@@ -2132,9 +2130,9 @@ ACMD(produce)
ACMD(memo)
{
int position = 0;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if( !message || !*message || sscanf(message, "%d", &position) < 1 )
{
int i;
@@ -2146,17 +2144,17 @@ ACMD(memo)
else
sprintf(atcmd_output, msg_txt(171), i); // %d - void
clif->message(sd->fd, atcmd_output);
- }
+ }
return true;
- }
-
+ }
+
if( position < 0 || position >= MAX_MEMOPOINTS )
{
sprintf(atcmd_output, msg_txt(1008), 0, MAX_MEMOPOINTS-1); // Please enter a valid position (usage: @memo <memo_position:%d-%d>).
clif->message(fd, atcmd_output);
return false;
}
-
+
pc->memo(sd, position);
return true;
}
@@ -2166,9 +2164,9 @@ ACMD(memo)
*------------------------------------------*/
ACMD(gat) {
int y;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
for (y = 2; y >= -2; y--) {
sprintf(atcmd_output, "%s (x= %d, y= %d) %02X %02X %02X %02X %02X",
map->list[sd->bl.m].name, sd->bl.x - 2, sd->bl.y + y,
@@ -2177,10 +2175,10 @@ ACMD(gat) {
map->getcell(sd->bl.m, sd->bl.x, sd->bl.y + y, CELL_GETTYPE),
map->getcell(sd->bl.m, sd->bl.x + 1, sd->bl.y + y, CELL_GETTYPE),
map->getcell(sd->bl.m, sd->bl.x + 2, sd->bl.y + y, CELL_GETTYPE));
-
+
clif->message(fd, atcmd_output);
}
-
+
return true;
}
@@ -2190,19 +2188,19 @@ ACMD(gat) {
ACMD(displaystatus)
{
int i, type, flag, tick, val1 = 0, val2 = 0, val3 = 0;
-
+
if (!message || !*message || (i = sscanf(message, "%d %d %d %d %d %d", &type, &flag, &tick, &val1, &val2, &val3)) < 1) {
clif->message(fd, msg_txt(1009)); // Please enter a status type/flag (usage: @displaystatus <status type> <flag> <tick> {<val1> {<val2> {<val3>}}}).
return false;
}
if (i < 2) flag = 1;
if (i < 3) tick = 0;
-
+
if( flag == 0 )
clif->sc_end(&sd->bl,sd->bl.id,AREA,type);
else
clif->status_change(&sd->bl, type, flag, tick, val1, val2, val3);
-
+
return true;
}
@@ -2213,12 +2211,12 @@ ACMD(statuspoint)
{
int point;
unsigned int new_status_point;
-
+
if (!message || !*message || (point = atoi(message)) == 0) {
clif->message(fd, msg_txt(1010)); // Please enter a number (usage: @stpoint <number of points>).
return false;
}
-
+
if(point < 0)
{
if(sd->status.status_point < (unsigned int)(-point))
@@ -2238,7 +2236,7 @@ ACMD(statuspoint)
{
new_status_point = sd->status.status_point + point;
}
-
+
if (new_status_point != sd->status.status_point) {
sd->status.status_point = new_status_point;
clif->updatestatus(sd, SP_STATUSPOINT);
@@ -2250,7 +2248,7 @@ ACMD(statuspoint)
clif->message(fd, msg_txt(149)); // Unable to increase the number/value.
return false;
}
-
+
return true;
}
@@ -2261,12 +2259,12 @@ ACMD(skillpoint)
{
int point;
unsigned int new_skill_point;
-
+
if (!message || !*message || (point = atoi(message)) == 0) {
clif->message(fd, msg_txt(1011)); // Please enter a number (usage: @skpoint <number of points>).
return false;
}
-
+
if(point < 0)
{
if(sd->status.skill_point < (unsigned int)(-point))
@@ -2286,7 +2284,7 @@ ACMD(skillpoint)
{
new_skill_point = sd->status.skill_point + point;
}
-
+
if (new_skill_point != sd->status.skill_point) {
sd->status.skill_point = new_skill_point;
clif->updatestatus(sd, SP_SKILLPOINT);
@@ -2298,7 +2296,7 @@ ACMD(skillpoint)
clif->message(fd, msg_txt(149)); // Unable to increase the number/value.
return false;
}
-
+
return true;
}
@@ -2308,12 +2306,12 @@ ACMD(skillpoint)
ACMD(zeny)
{
int zeny=0, ret=-1;
-
+
if (!message || !*message || (zeny = atoi(message)) == 0) {
clif->message(fd, msg_txt(1012)); // Please enter an amount (usage: @zeny <amount>).
return false;
}
-
+
if(zeny > 0){
if((ret=pc->getzeny(sd,zeny,LOG_TYPE_COMMAND,NULL)) == 1)
clif->message(fd, msg_txt(149)); // Unable to increase the number/value.
@@ -2338,34 +2336,34 @@ ACMD(param) {
int i, value = 0, new_value, max;
const char* param[] = { "str", "agi", "vit", "int", "dex", "luk" };
short* stats[6];
- //we don't use direct initialization because it isn't part of the c standard.
-
+ //we don't use direct initialization because it isn't part of the c standard.
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) {
clif->message(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>).
return false;
}
-
+
ARR_FIND( 0, ARRAYLENGTH(param), i, strcmpi(info->command, param[i]) == 0 );
-
+
if( i == ARRAYLENGTH(param) || i > MAX_STATUS_TYPE) { // normally impossible...
clif->message(fd, msg_txt(1013)); // Please enter a valid value (usage: @str/@agi/@vit/@int/@dex/@luk <+/-adjustment>).
return false;
}
-
+
stats[0] = &sd->status.str;
stats[1] = &sd->status.agi;
stats[2] = &sd->status.vit;
stats[3] = &sd->status.int_;
stats[4] = &sd->status.dex;
stats[5] = &sd->status.luk;
-
+
if( battle_config.atcommand_max_stat_bypass )
max = SHRT_MAX;
else
max = pc_maxparameter(sd);
-
+
if(value < 0 && *stats[i] <= -value) {
new_value = 1;
} else if(max - *stats[i] < value) {
@@ -2373,7 +2371,7 @@ ACMD(param) {
} else {
new_value = *stats[i] + value;
}
-
+
if (new_value != *stats[i]) {
*stats[i] = new_value;
clif->updatestatus(sd, SP_STR + i);
@@ -2387,7 +2385,7 @@ ACMD(param) {
clif->message(fd, msg_txt(149)); // Unable to increase the number/value.
return false;
}
-
+
return true;
}
@@ -2397,15 +2395,15 @@ ACMD(param) {
ACMD(stat_all) {
int index, count, value, max, new_value;
short* stats[6];
- //we don't use direct initialization because it isn't part of the c standard.
-
+ //we don't use direct initialization because it isn't part of the c standard.
+
stats[0] = &sd->status.str;
stats[1] = &sd->status.agi;
stats[2] = &sd->status.vit;
stats[3] = &sd->status.int_;
stats[4] = &sd->status.dex;
stats[5] = &sd->status.luk;
-
+
if (!message || !*message || sscanf(message, "%d", &value) < 1 || value == 0) {
value = pc_maxparameter(sd);
max = pc_maxparameter(sd);
@@ -2415,17 +2413,16 @@ ACMD(stat_all) {
else
max = pc_maxparameter(sd);
}
-
+
count = 0;
for (index = 0; index < ARRAYLENGTH(stats); index++) {
-
if (value > 0 && *stats[index] > max - value)
new_value = max;
else if (value < 0 && *stats[index] <= -value)
new_value = 1;
else
new_value = *stats[index] +value;
-
+
if (new_value != (int)*stats[index]) {
*stats[index] = new_value;
clif->updatestatus(sd, SP_STR + index);
@@ -2433,7 +2430,7 @@ ACMD(stat_all) {
count++;
}
}
-
+
if (count > 0) { // if at least 1 stat modified
status_calc_pc(sd, SCO_FORCE);
clif->message(fd, msg_txt(84)); // All stats changed!
@@ -2444,7 +2441,7 @@ ACMD(stat_all) {
clif->message(fd, msg_txt(178)); // You cannot increase that stat anymore.
return false;
}
-
+
return true;
}
@@ -2455,12 +2452,12 @@ ACMD(guildlevelup) {
int level = 0;
int16 added_level;
struct guild *guild_info;
-
+
if (!message || !*message || sscanf(message, "%d", &level) < 1 || level == 0) {
clif->message(fd, msg_txt(1014)); // Please enter a valid level (usage: @guildlvup/@guildlvlup <# of levels>).
return false;
}
-
+
if (sd->status.guild_id <= 0 || (guild_info = sd->guild) == NULL) {
clif->message(fd, msg_txt(43)); // You're not in a guild.
return false;
@@ -2471,13 +2468,13 @@ ACMD(guildlevelup) {
return false;
}
#endif // 0
-
+
if (level > INT16_MAX || (level > 0 && level > MAX_GUILDLEVEL - guild_info->guild_lv)) // fix positive overflow
level = MAX_GUILDLEVEL - guild_info->guild_lv;
else if (level < INT16_MIN || (level < 0 && level < 1 - guild_info->guild_lv)) // fix negative overflow
level = 1 - guild_info->guild_lv;
added_level = (int16)level;
-
+
if (added_level != 0) {
intif->guild_change_basicinfo(guild_info->guild_id, GBI_GUILDLV, &added_level, sizeof(added_level));
clif->message(fd, msg_txt(179)); // Guild level changed.
@@ -2485,7 +2482,7 @@ ACMD(guildlevelup) {
clif->message(fd, msg_txt(45)); // Guild level change failed.
return false;
}
-
+
return true;
}
@@ -2496,12 +2493,12 @@ ACMD(makeegg)
{
struct item_data *item_data;
int id, pet_id;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1015)); // Please enter a monster/egg name/ID (usage: @makeegg <pet>).
return false;
}
-
+
if ((item_data = itemdb->search_name(message)) != NULL) // for egg name
id = item_data->nameid;
else
@@ -2509,7 +2506,7 @@ ACMD(makeegg)
;
else
id = atoi(message);
-
+
pet_id = pet->search_petDB_index(id, PET_CLASS);
if (pet_id < 0)
pet_id = pet->search_petDB_index(id, PET_EGG);
@@ -2524,7 +2521,7 @@ ACMD(makeegg)
clif->message(fd, msg_txt(180)); // The monster/egg name/id doesn't exist.
return false;
}
-
+
return true;
}
@@ -2539,7 +2536,7 @@ ACMD(hatch)
clif->message(fd, msg_txt(181)); // You already have a pet.
return false;
}
-
+
return true;
}
@@ -2550,29 +2547,29 @@ ACMD(petfriendly)
{
int friendly;
struct pet_data *pd;
-
+
if (!message || !*message || (friendly = atoi(message)) < 0) {
clif->message(fd, msg_txt(1016)); // Please enter a valid value (usage: @petfriendly <0-1000>).
return false;
}
-
+
pd = sd->pd;
if (!pd) {
clif->message(fd, msg_txt(184)); // Sorry, but you have no pet.
return false;
}
-
+
if (friendly < 0 || friendly > 1000)
{
clif->message(fd, msg_txt(37)); // An invalid number was specified.
return false;
}
-
+
if (friendly == pd->pet.intimate) {
clif->message(fd, msg_txt(183)); // Pet intimacy is already at maximum.
return false;
}
-
+
pet->set_intimate(pd, friendly);
clif->send_petstatus(sd);
clif->message(fd, msg_txt(182)); // Pet intimacy changed.
@@ -2586,12 +2583,12 @@ ACMD(pethungry)
{
int hungry;
struct pet_data *pd;
-
+
if (!message || !*message || (hungry = atoi(message)) < 0) {
clif->message(fd, msg_txt(1017)); // Please enter a valid number (usage: @pethungry <0-100>).
return false;
}
-
+
pd = sd->pd;
if (!sd->status.pet_id || !pd) {
clif->message(fd, msg_txt(184)); // Sorry, but you have no pet.
@@ -2605,11 +2602,11 @@ ACMD(pethungry)
clif->message(fd, msg_txt(186)); // Pet hunger is already at maximum.
return false;
}
-
+
pd->pet.hungry = hungry;
clif->send_petstatus(sd);
clif->message(fd, msg_txt(185)); // Pet hunger changed.
-
+
return true;
}
@@ -2628,12 +2625,12 @@ ACMD(petrename)
clif->message(fd, msg_txt(188)); // You can already rename your pet.
return false;
}
-
+
pd->pet.rename_flag = 0;
intif->save_petdata(sd->status.account_id, &pd->pet);
clif->send_petstatus(sd);
clif->message(fd, msg_txt(187)); // You can now rename your pet.
-
+
return true;
}
@@ -2642,24 +2639,23 @@ ACMD(petrename)
*------------------------------------------*/
ACMD(recall) {
struct map_session_data *pl_sd = NULL;
-
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1018)); // Please enter a player name (usage: @recall <char name/ID>).
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;
}
-
+
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level doesn't authorize you to preform this action on the specified player.
return false;
}
-
+
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(1019)); // You are not authorized to warp someone to this map.
return false;
@@ -2674,7 +2670,7 @@ ACMD(recall) {
pc->setpos(pl_sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_RESPAWN);
sprintf(atcmd_output, msg_txt(46), pl_sd->status.name); // %s recalled!
clif->message(fd, atcmd_output);
-
+
return true;
}
@@ -2684,17 +2680,17 @@ ACMD(recall) {
*------------------------------------------*/
ACMD(char_block)
{
-
+
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1021)); // Please enter a player name (usage: @block <char name>).
return false;
}
-
+
chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 1, 0, 0, 0, 0, 0, 0); // type: 1 - block
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
-
+
return true;
}
@@ -2719,17 +2715,17 @@ ACMD(char_ban)
int year, month, day, hour, minute, second, value;
time_t timestamp;
struct tm *tmtime;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message || sscanf(message, "%255s %23[^\n]", atcmd_output, atcmd_player_name) < 2) {
clif->message(fd, msg_txt(1022)); // Please enter ban time and a player name (usage: @ban <time> <char name>).
return false;
}
-
+
atcmd_output[sizeof(atcmd_output)-1] = '\0';
-
+
modif_p = atcmd_output;
year = month = day = hour = minute = second = 0;
while (modif_p[0] != '\0') {
@@ -2787,10 +2783,10 @@ ACMD(char_ban)
clif->message(fd,msg_txt(1023)); // You are not allowed to reduce the length of a ban.
return false;
}
-
+
chrif->char_ask_name(sd->status.account_id, atcmd_player_name, !strcmpi(info->command,"charban") ? 6 : 2, year, month, day, hour, minute, second); // type: 2 - ban; 6 - charban
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
-
+
return true;
}
@@ -2799,18 +2795,17 @@ ACMD(char_ban)
*------------------------------------------*/
ACMD(char_unblock)
{
-
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1024)); // Please enter a player name (usage: @unblock <char name>).
return false;
}
-
+
// send answer to login server via char-server
chrif->char_ask_name(sd->status.account_id, atcmd_player_name, 3, 0, 0, 0, 0, 0, 0); // type: 3 - unblock
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
-
+
return true;
}
@@ -2819,48 +2814,47 @@ ACMD(char_unblock)
*------------------------------------------*/
ACMD(char_unban)
{
-
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1025)); // Please enter a player name (usage: @unban <char name>).
return false;
}
-
+
// send answer to login server via char-server
chrif->char_ask_name(sd->status.account_id, atcmd_player_name, !strcmpi(info->command,"charunban") ? 7 : 4, 0, 0, 0, 0, 0, 0); // type: 4 - unban account; type 7 - unban character
clif->message(fd, msg_txt(88)); // Character name sent to char-server to ask it.
-
+
return true;
}
/*==========================================
*
*------------------------------------------*/
-ACMD(night) {
-
+ACMD(night)
+{
if (map->night_flag != 1) {
pc->map_night_timer(pc->night_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(89)); // Night mode is already enabled.
return false;
}
-
+
return true;
}
/*==========================================
*
*------------------------------------------*/
-ACMD(day) {
-
+ACMD(day)
+{
if (map->night_flag != 0) {
pc->map_day_timer(pc->day_timer_tid, 0, 0, 1);
} else {
clif->message(fd, msg_txt(90)); // Day mode is already enabled.
return false;
}
-
+
return true;
}
@@ -2871,7 +2865,7 @@ ACMD(doom)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
@@ -2883,9 +2877,9 @@ ACMD(doom)
}
}
mapit->free(iter);
-
+
clif->message(fd, msg_txt(62)); // Judgment was made.
-
+
return true;
}
@@ -2896,7 +2890,7 @@ ACMD(doommap)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
@@ -2908,19 +2902,19 @@ ACMD(doommap)
}
}
mapit->free(iter);
-
+
clif->message(fd, msg_txt(62)); // Judgment was made.
-
+
return true;
}
/*==========================================
*
*------------------------------------------*/
-void atcommand_raise_sub(struct map_session_data* sd) {
-
+void atcommand_raise_sub(struct map_session_data* sd)
+{
status->revive(&sd->bl, 100, 100);
-
+
clif->skill_nodamage(&sd->bl,&sd->bl,ALL_RESURRECTION,4,1);
clif->message(sd->fd, msg_txt(63)); // Mercy has been shown.
}
@@ -2932,15 +2926,15 @@ ACMD(raise)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
if( pc_isdead(pl_sd) )
atcommand->raise_sub(pl_sd);
mapit->free(iter);
-
+
clif->message(fd, msg_txt(64)); // Mercy has been granted.
-
+
return true;
}
@@ -2951,15 +2945,15 @@ ACMD(raisemap)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
if (sd->bl.m == pl_sd->bl.m && pc_isdead(pl_sd) )
atcommand->raise_sub(pl_sd);
mapit->free(iter);
-
+
clif->message(fd, msg_txt(64)); // Mercy has been granted.
-
+
return true;
}
@@ -2969,27 +2963,27 @@ ACMD(raisemap)
ACMD(kick)
{
struct map_session_data *pl_sd;
-
+
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1026)); // Please enter a player name (usage: @kick <char name/ID>).
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;
}
-
+
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
-
+
clif->GM_kick(sd, pl_sd);
-
+
return true;
}
@@ -3000,7 +2994,7 @@ ACMD(kickall)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
@@ -3010,9 +3004,9 @@ ACMD(kickall)
}
}
mapit->free(iter);
-
+
clif->message(fd, msg_txt(195)); // All players have been kicked!
-
+
return true;
}
@@ -3025,7 +3019,7 @@ ACMD(allskill)
sd->status.skill_point = 0; // 0 skill points
clif->updatestatus(sd, SP_SKILLPOINT); // update
clif->message(fd, msg_txt(76)); // All skills have been added to your skill tree.
-
+
return true;
}
@@ -3035,21 +3029,21 @@ ACMD(allskill)
ACMD(questskill)
{
uint16 skill_id, index;
-
+
if (!message || !*message || (skill_id = atoi(message)) <= 0)
{// also send a list of skills applicable to this command
const char* text;
-
+
// attempt to find the text corresponding to this command
text = atcommand_help_string( info );
-
+
// send the error message as always
clif->message(fd, msg_txt(1027)); // Please enter a quest skill number.
-
+
if( text ) {// send the skill ID list associated with this command
clif->messageln( fd, text );
}
-
+
return false;
}
if( !(index = skill->get_index(skill_id)) ) {
@@ -3064,10 +3058,10 @@ ACMD(questskill)
clif->message(fd, msg_txt(196)); // You already have this quest skill.
return false;
}
-
+
pc->skill(sd, skill_id, 1, 0);
clif->message(fd, msg_txt(70)); // You have learned the skill.
-
+
return true;
}
@@ -3077,21 +3071,21 @@ ACMD(questskill)
ACMD(lostskill)
{
uint16 skill_id, index;
-
+
if (!message || !*message || (skill_id = atoi(message)) <= 0)
{// also send a list of skills applicable to this command
const char* text;
-
+
// attempt to find the text corresponding to this command
text = atcommand_help_string( info );
-
+
// send the error message as always
clif->message(fd, msg_txt(1027)); // Please enter a quest skill number.
-
+
if( text ) {// send the skill ID list associated with this command
clif->messageln( fd, text );
}
-
+
return false;
}
if ( !( index = skill->get_index(skill_id) ) ) {
@@ -3106,12 +3100,12 @@ ACMD(lostskill)
clif->message(fd, msg_txt(201)); // You don't have this quest skill.
return false;
}
-
+
sd->status.skill[index].lv = 0;
sd->status.skill[index].flag = 0;
clif->deleteskill(sd,skill_id);
clif->message(fd, msg_txt(71)); // You have forgotten the skill.
-
+
return true;
}
@@ -3122,9 +3116,9 @@ ACMD(spiritball)
{
int max_spiritballs;
int number;
-
+
max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);
-
+
if( !message || !*message || (number = atoi(message)) < 0 || number > max_spiritballs )
{
char msg[CHAT_SIZE_MAX];
@@ -3132,13 +3126,13 @@ ACMD(spiritball)
clif->message(fd, msg);
return false;
}
-
+
if( sd->spiritball > 0 )
pc->delspiritball(sd, sd->spiritball, 1);
sd->spiritball = number;
clif->spiritball(&sd->bl);
// no message, player can look the difference
-
+
return true;
}
@@ -3148,16 +3142,16 @@ ACMD(spiritball)
ACMD(party)
{
char party_name[NAME_LENGTH];
-
+
memset(party_name, '\0', sizeof(party_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) {
clif->message(fd, msg_txt(1029)); // Please enter a party name (usage: @party <party_name>).
return false;
}
-
+
party->create(sd, party_name, 0, 0);
-
+
return true;
}
@@ -3168,25 +3162,24 @@ ACMD(guild)
{
char guild_name[NAME_LENGTH];
int prev;
-
+
memset(guild_name, '\0', sizeof(guild_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) {
clif->message(fd, msg_txt(1030)); // Please enter a guild name (usage: @guild <guild_name>).
return false;
}
-
+
prev = battle_config.guild_emperium_check;
battle_config.guild_emperium_check = 0;
guild->create(sd, guild_name);
battle_config.guild_emperium_check = prev;
-
+
return true;
}
ACMD(breakguild)
{
-
if (sd->status.guild_id) { // Check if the player has a guild
struct guild *g;
g = sd->guild; // Search the guild
@@ -3222,11 +3215,11 @@ ACMD(agitstart) {
clif->message(fd, msg_txt(73)); // War of Emperium is currently in progress.
return false;
}
-
+
map->agit_flag = 1;
guild->agit_start();
clif->message(fd, msg_txt(72)); // War of Emperium has been initiated.
-
+
return true;
}
@@ -3238,11 +3231,11 @@ ACMD(agitstart2) {
clif->message(fd, msg_txt(404)); // "War of Emperium SE is currently in progress."
return false;
}
-
+
map->agit2_flag = 1;
guild->agit2_start();
clif->message(fd, msg_txt(403)); // "War of Emperium SE has been initiated."
-
+
return true;
}
@@ -3254,11 +3247,11 @@ ACMD(agitend) {
clif->message(fd, msg_txt(75)); // War of Emperium is currently not in progress.
return false;
}
-
+
map->agit_flag = 0;
guild->agit_end();
clif->message(fd, msg_txt(74)); // War of Emperium has been ended.
-
+
return true;
}
@@ -3270,11 +3263,11 @@ ACMD(agitend2) {
clif->message(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress."
return false;
}
-
+
map->agit2_flag = 0;
guild->agit2_end();
clif->message(fd, msg_txt(405)); // "War of Emperium SE has been ended."
-
+
return true;
}
@@ -3294,15 +3287,15 @@ ACMD(idsearch)
char item_name[100];
unsigned int i, match;
struct item_data *item_array[MAX_SEARCH];
-
+
memset(item_name, '\0', sizeof(item_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%99s", item_name) < 0) {
clif->message(fd, msg_txt(1031)); // Please enter part of an item name (usage: @idsearch <part_of_item_name>).
return false;
}
-
+
sprintf(atcmd_output, msg_txt(77), item_name); // Search results for '%s' (name: id):
clif->message(fd, atcmd_output);
match = itemdb->search_name_array(item_array, MAX_SEARCH, item_name, 0);
@@ -3317,7 +3310,7 @@ ACMD(idsearch)
}
sprintf(atcmd_output, msg_txt(79), match); // %d results found.
clif->message(fd, atcmd_output);
-
+
return true;
}
@@ -3329,14 +3322,14 @@ ACMD(recallall)
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
int count;
-
+
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 someone to your current map.
return false;
}
-
+
count = 0;
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {
@@ -3355,13 +3348,13 @@ ACMD(recallall)
}
}
mapit->free(iter);
-
+
clif->message(fd, msg_txt(92)); // All characters recalled!
if (count) {
sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled.
clif->message(fd, atcmd_output);
}
-
+
return true;
}
@@ -3375,29 +3368,29 @@ ACMD(guildrecall)
int count;
char guild_name[NAME_LENGTH];
struct guild *g;
-
+
memset(guild_name, '\0', sizeof(guild_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) {
clif->message(fd, msg_txt(1034)); // Please enter a guild name/ID (usage: @guildrecall <guild_name/ID>).
return false;
}
-
+
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 someone to your current map.
return false;
}
-
+
if ((g = guild->searchname(guild_name)) == NULL && // name first to avoid error when name begin with a number
(g = guild->search(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
}
-
+
count = 0;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
@@ -3411,14 +3404,14 @@ ACMD(guildrecall)
}
}
mapit->free(iter);
-
+
sprintf(atcmd_output, msg_txt(93), g->name); // All online characters of the %s guild have been recalled to your position.
clif->message(fd, atcmd_output);
if (count) {
sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled.
clif->message(fd, atcmd_output);
}
-
+
return true;
}
@@ -3432,29 +3425,29 @@ ACMD(partyrecall)
char party_name[NAME_LENGTH];
struct party_data *p;
int count;
-
+
memset(party_name, '\0', sizeof(party_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) {
clif->message(fd, msg_txt(1035)); // Please enter a party name/ID (usage: @partyrecall <party_name/ID>).
return false;
}
-
+
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 someone to your current map.
return false;
}
-
+
if ((p = party->searchname(party_name)) == NULL && // name first to avoid error when name begin with a number
(p = party->search(atoi(message))) == NULL)
{
clif->message(fd, msg_txt(96)); // Incorrect name or ID, or no one from the party is online.
return false;
}
-
+
count = 0;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {
if (sd->status.account_id != pl_sd->status.account_id && pl_sd->status.party_id == p->party.party_id) {
@@ -3467,14 +3460,14 @@ ACMD(partyrecall)
}
}
mapit->free(iter);
-
+
sprintf(atcmd_output, msg_txt(95), p->party.name); // All online characters of the %s party have been recalled to your position.
clif->message(fd, atcmd_output);
if (count) {
sprintf(atcmd_output, msg_txt(1033), count); // Because you are not authorized to warp from some maps, %d player(s) have not been recalled.
clif->message(fd, atcmd_output);
}
-
+
return true;
}
@@ -3485,7 +3478,7 @@ ACMD(reloaditemdb)
{
itemdb->reload();
clif->message(fd, msg_txt(97)); // Item database has been reloaded.
-
+
return true;
}
@@ -3500,7 +3493,7 @@ ACMD(reloadmobdb) {
mercenary->read_skilldb();
elemental->reload_db();
clif->message(fd, msg_txt(98)); // Monster database has been reloaded.
-
+
return true;
}
@@ -3514,7 +3507,7 @@ ACMD(reloadskilldb)
elemental->reload_skilldb();
mercenary->read_skilldb();
clif->message(fd, msg_txt(99)); // Skill database has been reloaded.
-
+
return true;
}
@@ -3523,21 +3516,21 @@ ACMD(reloadskilldb)
*------------------------------------------*/
ACMD(reloadatcommand) {
config_t run_test;
-
+
if (libconfig->read_file(&run_test, "conf/groups.conf")) {
clif->message(fd, msg_txt(1036)); // Error reading groups.conf, reload failed.
return false;
}
-
+
libconfig->destroy(&run_test);
-
+
if (libconfig->read_file(&run_test, map->ATCOMMAND_CONF_FILENAME)) {
clif->message(fd, msg_txt(1037)); // Error reading atcommand.conf, reload failed.
return false;
}
-
+
libconfig->destroy(&run_test);
-
+
atcommand->doload();
pcg->reload();
clif->message(fd, msg_txt(254));
@@ -3550,9 +3543,9 @@ ACMD(reloadbattleconf)
{
struct Battle_Config prev_config;
memcpy(&prev_config, &battle_config, sizeof(prev_config));
-
+
battle->config_read(map->BATTLE_CONF_FILENAME);
-
+
if( prev_config.item_rate_mvp != battle_config.item_rate_mvp
|| prev_config.item_rate_common != battle_config.item_rate_common
|| prev_config.item_rate_common_boss != battle_config.item_rate_common_boss
@@ -3583,8 +3576,7 @@ ACMD(reloadbattleconf)
|| prev_config.item_drop_treasure_max != battle_config.item_drop_treasure_max
|| prev_config.base_exp_rate != battle_config.base_exp_rate
|| prev_config.job_exp_rate != battle_config.job_exp_rate
- )
- { // Exp or Drop rates changed.
+ ) { // Exp or Drop rates changed.
mob->reload(); //Needed as well so rate changes take effect.
chrif->ragsrvinfo(battle_config.base_exp_rate, battle_config.job_exp_rate, battle_config.item_rate_common);
}
@@ -3618,7 +3610,7 @@ ACMD(reloadscript) {
//atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {
if (pl_sd->npc_id || pl_sd->npc_shopid) {
@@ -3638,14 +3630,14 @@ ACMD(reloadscript) {
}
}
mapit->free(iter);
-
+
flush_fifos();
map->reloadnpc(true, NULL, 0); // reload config files seeking for npcs
script->reload();
npc->reload();
-
+
clif->message(fd, msg_txt(100)); // Scripts have been reloaded.
-
+
return true;
}
@@ -3667,33 +3659,33 @@ ACMD(mapinfo) {
int i, m_id, chat_num = 0, list = 0, vend_num = 0;
unsigned short m_index;
char mapname[24];
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(mapname, '\0', sizeof(mapname));
memset(direction, '\0', sizeof(direction));
-
+
sscanf(message, "%d %23[^\n]", &list, mapname);
-
+
if (list < 0 || list > 3) {
clif->message(fd, msg_txt(1038)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>).
return false;
}
-
+
if (mapname[0] == '\0') {
safestrncpy(mapname, mapindex_id2name(sd->mapindex), MAP_NAME_LENGTH);
m_id = map->mapindex2mapid(sd->mapindex);
} else {
m_id = map->mapname2mapid(mapname);
}
-
+
if (m_id < 0) {
clif->message(fd, msg_txt(1)); // Map not found.
return false;
}
m_index = mapindex->name2id(mapname); //This one shouldn't fail since the previous seek did not.
-
+
clif->message(fd, msg_txt(1039)); // ------ Map Info ------
-
+
// count chats (for initial message)
chat_num = 0;
iter = mapit_getallusers();
@@ -3706,21 +3698,21 @@ ACMD(mapinfo) {
}
}
mapit->free(iter);
-
+
sprintf(atcmd_output, msg_txt(1040), mapname, map->list[m_id].zone->name, map->list[m_id].users, map->list[m_id].npc_num, chat_num, vend_num); // Map: %s (Zone:%s) | Players: %d | NPCs: %d | Chats: %d | Vendings: %d
clif->message(fd, atcmd_output);
clif->message(fd, msg_txt(1041)); // ------ Map Flags ------
if (map->list[m_id].flag.town)
clif->message(fd, msg_txt(1042)); // Town Map
-
+
if (battle_config.autotrade_mapflag == map->list[m_id].flag.autotrade)
clif->message(fd, msg_txt(1043)); // Autotrade Enabled
else
clif->message(fd, msg_txt(1044)); // Autotrade Disabled
-
+
if (map->list[m_id].flag.battleground)
clif->message(fd, msg_txt(1045)); // Battlegrounds ON
-
+
strcpy(atcmd_output,msg_txt(1046)); // PvP Flags:
if (map->list[m_id].flag.pvp)
strcat(atcmd_output, msg_txt(1047)); // Pvp ON |
@@ -3733,7 +3725,7 @@ ACMD(mapinfo) {
if (map->list[m_id].flag.pvp_nocalcrank)
strcat(atcmd_output, msg_txt(1051)); // NoCalcRank |
clif->message(fd, atcmd_output);
-
+
strcpy(atcmd_output,msg_txt(1052)); // GvG Flags:
if (map->list[m_id].flag.gvg)
strcat(atcmd_output, msg_txt(1053)); // GvG ON |
@@ -3744,7 +3736,7 @@ ACMD(mapinfo) {
if (map->list[m_id].flag.gvg_noparty)
strcat(atcmd_output, msg_txt(1056)); // NoParty |
clif->message(fd, atcmd_output);
-
+
strcpy(atcmd_output,msg_txt(1057)); // Teleport Flags:
if (map->list[m_id].flag.noteleport)
strcat(atcmd_output, msg_txt(1058)); // NoTeleport |
@@ -3759,12 +3751,12 @@ ACMD(mapinfo) {
if (map->list[m_id].flag.nomemo)
strcat(atcmd_output, msg_txt(1064)); // NoMemo |
clif->message(fd, atcmd_output);
-
+
sprintf(atcmd_output, msg_txt(1065), // No Exp Penalty: %s | No Zeny Penalty: %s
(map->list[m_id].flag.noexppenalty) ? msg_txt(1066) : msg_txt(1067),
(map->list[m_id].flag.nozenypenalty) ? msg_txt(1066) : msg_txt(1067)); // On / Off
clif->message(fd, atcmd_output);
-
+
if (map->list[m_id].flag.nosave) {
if (!map->list[m_id].save.map)
clif->message(fd, msg_txt(1068)); // No Save (Return to last Save Point)
@@ -3777,7 +3769,7 @@ ACMD(mapinfo) {
clif->message(fd, atcmd_output);
}
}
-
+
strcpy(atcmd_output,msg_txt(1071)); // Weather Flags:
if (map->list[m_id].flag.snow)
strcat(atcmd_output, msg_txt(1072)); // Snow |
@@ -3796,7 +3788,7 @@ ACMD(mapinfo) {
if (map->list[m_id].flag.nightenabled)
strcat(atcmd_output, msg_txt(1080)); // Displays Night |
clif->message(fd, atcmd_output);
-
+
strcpy(atcmd_output,msg_txt(1081)); // Other Flags:
if (map->list[m_id].flag.nobranch)
strcat(atcmd_output, msg_txt(1082)); // NoBranch |
@@ -3815,7 +3807,7 @@ ACMD(mapinfo) {
if (map->list[m_id].flag.reset)
strcat(atcmd_output, msg_txt(1089)); // Reset |
clif->message(fd, atcmd_output);
-
+
strcpy(atcmd_output,msg_txt(1090)); // Other Flags:
if (map->list[m_id].nocommand)
strcat(atcmd_output, msg_txt(1091)); // NoCommand |
@@ -3832,7 +3824,7 @@ ACMD(mapinfo) {
if (map->list[m_id].flag.guildlock)
strcat(atcmd_output, msg_txt(1097)); // GuildLock |
clif->message(fd, atcmd_output);
-
+
switch (list) {
case 0:
// Do nothing. It's list 0, no additional display.
@@ -3881,8 +3873,8 @@ ACMD(mapinfo) {
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
if ((cd = (struct chat_data*)map->id2bl(pl_sd->chatID)) != NULL &&
- pl_sd->mapindex == m_index &&
- cd->usersd[0] == pl_sd)
+ pl_sd->mapindex == m_index &&
+ cd->usersd[0] == pl_sd)
{
sprintf(atcmd_output, msg_txt(1114), // Chat: %s | Player: %s | Location: %d %d
cd->title, pl_sd->status.name, cd->bl.x, cd->bl.y);
@@ -3898,7 +3890,7 @@ ACMD(mapinfo) {
clif->message(fd, msg_txt(1118)); // Please enter at least one valid list number (usage: @mapinfo <0-3> <map>).
return false;
}
-
+
return true;
}
@@ -3911,12 +3903,12 @@ ACMD(mount_peco)
clif->message(fd, msg_txt(212)); // Cannot mount while in disguise.
return false;
}
-
+
if( sd->sc.data[SC_ALL_RIDING] ) {
clif->message(fd, msg_txt(1476)); // You are already mounting something else
return false;
}
-
+
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!
@@ -3982,10 +3974,10 @@ ACMD(mount_peco)
ACMD(guildspy) {
char guild_name[NAME_LENGTH];
struct guild *g;
-
+
memset(guild_name, '\0', sizeof(guild_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!map->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
@@ -3995,7 +3987,7 @@ ACMD(guildspy) {
clif->message(fd, msg_txt(1126)); // Please enter a guild name/ID (usage: @guildspy <guild_name/ID>).
return false;
}
-
+
if ((g = guild->searchname(guild_name)) != NULL || // name first to avoid error when name begin with a number
(g = guild->search(atoi(message))) != NULL) {
if (sd->guildspy == g->guild_id) {
@@ -4011,7 +4003,7 @@ ACMD(guildspy) {
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the specified guild is online.
return false;
}
-
+
return true;
}
@@ -4021,21 +4013,21 @@ ACMD(guildspy) {
ACMD(partyspy) {
char party_name[NAME_LENGTH];
struct party_data *p;
-
+
memset(party_name, '\0', sizeof(party_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!map->enable_spy)
{
clif->message(fd, msg_txt(1125)); // The mapserver has spy command support disabled.
return false;
}
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", party_name) < 1) {
clif->message(fd, msg_txt(1127)); // Please enter a party name/ID (usage: @partyspy <party_name/ID>).
return false;
}
-
+
if ((p = party->searchname(party_name)) != NULL || // name first to avoid error when name begin with a number
(p = party->search(atoi(message))) != NULL) {
if (sd->partyspy == p->party.party_id) {
@@ -4051,7 +4043,7 @@ ACMD(partyspy) {
clif->message(fd, msg_txt(96)); // Incorrect name/ID, or no one from the specified party is online.
return false;
}
-
+
return true;
}
@@ -4061,7 +4053,7 @@ ACMD(partyspy) {
ACMD(repairall)
{
int count, i;
-
+
count = 0;
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].nameid && sd->status.inventory[i].attribute == 1) {
@@ -4070,7 +4062,7 @@ ACMD(repairall)
count++;
}
}
-
+
if (count > 0) {
clif->misceffect(&sd->bl, 3);
clif->equiplist(sd);
@@ -4079,7 +4071,7 @@ ACMD(repairall)
clif->message(fd, msg_txt(108)); // No item need to be repaired.
return false;
}
-
+
return true;
}
@@ -4088,14 +4080,14 @@ ACMD(repairall)
*------------------------------------------*/
ACMD(nuke) {
struct map_session_data *pl_sd;
-
+
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1128)); // Please enter a player name (usage: @nuke <char name>).
return false;
}
-
+
if ((pl_sd = map->nick2sd(atcmd_player_name)) != NULL) {
if (pc_get_group_level(sd) >= pc_get_group_level(pl_sd)) { // you can kill only lower or same GM level
skill->castend_nodamage_id(&pl_sd->bl, &pl_sd->bl, NPC_SELFDESTRUCTION, 99, timer->gettick(), 0);
@@ -4108,7 +4100,7 @@ ACMD(nuke) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
return true;
}
@@ -4118,14 +4110,14 @@ ACMD(nuke) {
ACMD(tonpc) {
char npcname[NAME_LENGTH+1];
struct npc_data *nd;
-
+
memset(npcname, 0, sizeof(npcname));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", npcname) < 1) {
clif->message(fd, msg_txt(1129)); // Please enter a NPC name (usage: @tonpc <NPC_name>).
return false;
}
-
+
if ((nd = npc->name2id(npcname)) != NULL) {
if (nd->bl.m != -1 && pc->setpos(sd, map_id2index(nd->bl.m), nd->bl.x, nd->bl.y, CLR_TELEPORT) == 0)
clif->message(fd, msg_txt(0)); // Warped.
@@ -4135,7 +4127,7 @@ ACMD(tonpc) {
clif->message(fd, msg_txt(111)); // This NPC doesn't exist.
return false;
}
-
+
return true;
}
@@ -4145,14 +4137,14 @@ ACMD(tonpc) {
ACMD(shownpc)
{
char NPCname[NAME_LENGTH+1];
-
+
memset(NPCname, '\0', sizeof(NPCname));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) {
clif->message(fd, msg_txt(1130)); // Please enter a NPC name (usage: @enablenpc <NPC_name>).
return false;
}
-
+
if (npc->name2id(NPCname) != NULL) {
npc->enable(NPCname, 1);
clif->message(fd, msg_txt(110)); // Npc Enabled.
@@ -4160,7 +4152,7 @@ ACMD(shownpc)
clif->message(fd, msg_txt(111)); // This NPC doesn't exist.
return false;
}
-
+
return true;
}
@@ -4170,19 +4162,19 @@ ACMD(shownpc)
ACMD(hidenpc)
{
char NPCname[NAME_LENGTH+1];
-
+
memset(NPCname, '\0', sizeof(NPCname));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", NPCname) < 1) {
clif->message(fd, msg_txt(1131)); // Please enter a NPC name (usage: @hidenpc <NPC_name>).
return false;
}
-
+
if (npc->name2id(NPCname) == NULL) {
clif->message(fd, msg_txt(111)); // This NPC doesn't exist.
return false;
}
-
+
npc->enable(NPCname, 0);
clif->message(fd, msg_txt(112)); // Npc Disabled.
return true;
@@ -4191,26 +4183,26 @@ ACMD(hidenpc)
ACMD(loadnpc)
{
FILE *fp;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1132)); // Please enter a script file name (usage: @loadnpc <file name>).
return false;
}
-
+
// check if script file exists
if ((fp = fopen(message, "r")) == NULL) {
clif->message(fd, msg_txt(261));
return false;
}
fclose(fp);
-
+
// add to list of script sources and run it
npc->addsrcfile(message);
npc->parsesrcfile(message,true);
npc->read_event_script();
-
+
clif->message(fd, msg_txt(262));
-
+
return true;
}
@@ -4218,19 +4210,19 @@ ACMD(unloadnpc)
{
struct npc_data *nd;
char NPCname[NAME_LENGTH+1];
-
+
memset(NPCname, '\0', sizeof(NPCname));
-
+
if (!message || !*message || sscanf(message, "%24[^\n]", NPCname) < 1) {
clif->message(fd, msg_txt(1133)); // Please enter a NPC name (usage: @npcoff <NPC_name>).
return false;
}
-
+
if ((nd = npc->name2id(NPCname)) == NULL) {
clif->message(fd, msg_txt(111)); // This NPC doesn't exist.
return false;
}
-
+
npc->unload_duplicates(nd);
npc->unload(nd,true);
npc->read_event_script();
@@ -4246,16 +4238,16 @@ char* txt_time(unsigned int duration)
int days, hours, minutes, seconds;
static char temp1[CHAT_SIZE_MAX];
int tlen = 0;
-
+
memset(temp1, '\0', sizeof(temp1));
-
+
days = duration / (60 * 60 * 24);
duration = duration - (60 * 60 * 24 * days);
hours = duration / (60 * 60);
duration = duration - (60 * 60 * hours);
minutes = duration / 60;
seconds = duration - (60 * minutes);
-
+
if (days == 1)
tlen += sprintf(tlen + temp1, msg_txt(219), days); // %d day
else if (days > 1)
@@ -4272,7 +4264,7 @@ char* txt_time(unsigned int duration)
sprintf(tlen + temp1, msg_txt(225), seconds); // and %d second
else if (seconds > 1)
sprintf(tlen + temp1, msg_txt(226), seconds); // and %d seconds
-
+
return temp1;
}
@@ -4284,19 +4276,19 @@ ACMD(servertime) {
time_t time_server; // variable for number of seconds (used with time() function)
struct tm *datetime; // variable for time in structure ->tm_mday, ->tm_sec, ...
char temp[CHAT_SIZE_MAX];
-
+
memset(temp, '\0', sizeof(temp));
-
+
time(&time_server); // get time in seconds since 1/1/1970
datetime = localtime(&time_server); // convert seconds in structure
// like sprintf, but only for date/time (Sunday, November 02 2003 15:12:52)
strftime(temp, sizeof(temp)-1, msg_txt(230), datetime); // Server time (normal time): %A, %B %d %Y %X.
clif->message(fd, temp);
-
+
if (pc->day_timer_tid != INVALID_TIMER && pc->night_timer_tid != INVALID_TIMER) {
const struct TimerData * timer_data = timer->get(pc->night_timer_tid);
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 actually in daylight for %s.
txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
@@ -4328,7 +4320,7 @@ ACMD(servertime) {
else
clif->message(fd, msg_txt(232)); // Game time: The game is in permanent night.
}
-
+
return true;
}
@@ -4341,7 +4333,7 @@ void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int
const int factor_month = 43200; //30*24*60 = 43200
const int factor_day = 1440; //24*60 = 1440
const int factor_hour = 60;
-
+
*year = jailtime/factor_year;
jailtime -= *year*factor_year;
*month = jailtime/factor_month;
@@ -4351,7 +4343,7 @@ void get_jail_time(int jailtime, int* year, int* month, int* day, int* hour, int
*hour = jailtime/factor_hour;
jailtime -= *hour*factor_hour;
*minute = jailtime;
-
+
*year = *year > 0? *year : 0;
*month = *month > 0? *month : 0;
*day = *day > 0? *day : 0;
@@ -4368,31 +4360,31 @@ ACMD(jail) {
struct map_session_data *pl_sd;
int x, y;
unsigned short m_index;
-
+
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1134)); // Please enter a player name (usage: @jail <char_name>).
return false;
}
-
+
if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
- if (pc_get_group_level(sd) < pc_get_group_level(pl_sd))
- { // you can jail only lower or same GM
+
+ 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 authorize you to do this action on this player.
return false;
}
-
+
if (pl_sd->sc.data[SC_JAILED])
{
clif->message(fd, msg_txt(118)); // Player warped in jails.
return false;
}
-
+
switch(rnd() % 2) { //Jail Locations
case 0:
m_index = mapindex->name2id(MAP_JAIL);
@@ -4405,7 +4397,7 @@ ACMD(jail) {
y = 75;
break;
}
-
+
//Duration of INT_MAX to specify infinity.
sc_start4(NULL,&pl_sd->bl,SC_JAILED,100,INT_MAX,m_index,x,y,1000);
clif->message(pl_sd->fd, msg_txt(117)); // You have been jailed by a GM.
@@ -4419,31 +4411,31 @@ ACMD(jail) {
*------------------------------------------*/
ACMD(unjail) {
struct map_session_data *pl_sd;
-
+
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
-
+
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1135)); // Please enter a player name (usage: @unjail/@discharge <char_name>).
return false;
}
-
+
if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
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 authorize you to do this action on this player.
return false;
}
-
+
if (!pl_sd->sc.data[SC_JAILED])
{
clif->message(fd, msg_txt(119)); // This player is not in jails.
return false;
}
-
+
//Reset jail time to 1 sec.
sc_start(NULL,&pl_sd->bl,SC_JAILED,100,1,1000);
clif->message(pl_sd->fd, msg_txt(120)); // A GM has discharged you from jail.
@@ -4457,14 +4449,14 @@ ACMD(jailfor) {
char * modif_p;
int jailtime = 0,x,y;
short m_index = 0;
-
+
if (!message || !*message || sscanf(message, "%255s %23[^\n]",atcmd_output,atcmd_player_name) < 2) {
- clif->message(fd, msg_txt(400)); //Usage: @jailfor <time> <character name>
+ clif->message(fd, msg_txt(400)); //Usage: @jailfor <time> <character name>
return false;
}
-
+
atcmd_output[sizeof(atcmd_output)-1] = '\0';
-
+
modif_p = atcmd_output;
year = month = day = hour = minute = 0;
while (modif_p[0] != '\0') {
@@ -4499,33 +4491,32 @@ ACMD(jailfor) {
}
}
}
-
+
if (year == 0 && month == 0 && day == 0 && hour == 0 && minute == 0) {
clif->message(fd, msg_txt(1136)); // Invalid time for jail command.
return false;
}
-
+
if ((pl_sd = map->nick2sd(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
if (pc_get_group_level(pl_sd) > pc_get_group_level(sd)) {
clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
-
- jailtime = year*12*30*24*60 + month*30*24*60 + day*24*60 + hour*60 + minute; //In minutes
-
+
+ jailtime = year*12*30*24*60 + month*30*24*60 + day*24*60 + hour*60 + minute; //In minutes
+
if(jailtime==0) {
clif->message(fd, msg_txt(1136)); // Invalid time for jail command.
return false;
}
-
+
//Added by Coltaro
- if(pl_sd->sc.data[SC_JAILED] &&
- pl_sd->sc.data[SC_JAILED]->val1 != INT_MAX)
- { //Update the player's jail time
+ if (pl_sd->sc.data[SC_JAILED] && pl_sd->sc.data[SC_JAILED]->val1 != INT_MAX) {
+ //Update the player's jail time
jailtime += pl_sd->sc.data[SC_JAILED]->val1;
if (jailtime <= 0) {
jailtime = 0;
@@ -4534,15 +4525,15 @@ ACMD(jailfor) {
} else {
atcommand->get_jail_time(jailtime,&year,&month,&day,&hour,&minute);
sprintf(atcmd_output,msg_txt(402),msg_txt(1137),year,month,day,hour,minute); //%s in jail for %d years, %d months, %d days, %d hours and %d minutes
- clif->message(pl_sd->fd, atcmd_output);
+ clif->message(pl_sd->fd, atcmd_output);
sprintf(atcmd_output,msg_txt(402),msg_txt(1138),year,month,day,hour,minute); //This player is now in jail for %d years, %d months, %d days, %d hours and %d minutes
- clif->message(fd, atcmd_output);
+ clif->message(fd, atcmd_output);
}
} else if (jailtime < 0) {
clif->message(fd, msg_txt(1136));
return false;
}
-
+
//Jail locations, add more as you wish.
switch(rnd()%2)
{
@@ -4555,7 +4546,7 @@ ACMD(jailfor) {
x = 24; y = 75;
break;
}
-
+
sc_start4(NULL,&pl_sd->bl,SC_JAILED,100,jailtime,m_index,x,y,jailtime?60000:1000); //jailtime = 0: Time was reset to 0. Wait 1 second to warp player out (since it's done in status->change_timer).
return true;
}
@@ -4565,28 +4556,28 @@ ACMD(jailfor) {
ACMD(jailtime)
{
int year, month, day, hour, minute;
-
+
if (!sd->sc.data[SC_JAILED]) {
clif->message(fd, msg_txt(1139)); // You are not in jail.
return false;
}
-
+
if (sd->sc.data[SC_JAILED]->val1 == INT_MAX) {
clif->message(fd, msg_txt(1140)); // You have been jailed indefinitely.
return true;
}
-
+
if (sd->sc.data[SC_JAILED]->val1 <= 0) { // Was not jailed with @jailfor (maybe @jail? or warped there? or got recalled?)
clif->message(fd, msg_txt(1141)); // You have been jailed for an unknown amount of time.
return false;
}
-
+
//Get remaining jail time
atcommand->get_jail_time(sd->sc.data[SC_JAILED]->val1,&year,&month,&day,&hour,&minute);
sprintf(atcmd_output,msg_txt(402),msg_txt(1142),year,month,day,hour,minute); // You will remain in jail for %d years, %d months, %d days, %d hours and %d minutes
-
+
clif->message(fd, atcmd_output);
-
+
return true;
}
@@ -4596,17 +4587,18 @@ ACMD(jailtime)
ACMD(disguise)
{
int id = 0;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1143)); // Please enter a Monster/NPC name/ID (usage: @disguise <name/ID>).
return false;
}
-
- if ((id = atoi(message)) > 0)
- { //Acquired an ID
+
+ if ((id = atoi(message)) > 0) {
+ //Acquired an ID
if (!mob->db_checkid(id) && !npcdb_checkid(id))
id = 0; //Invalid id for either mobs or npcs.
- } else { //Acquired a Name
+ } else {
+ //Acquired a Name
if ((id = mob->db_searchname(message)) == 0)
{
struct npc_data* nd = npc->name2id(message);
@@ -4614,18 +4606,18 @@ ACMD(disguise)
id = nd->class_;
}
}
-
+
if (id == 0)
{
- clif->message(fd, msg_txt(123)); // Invalid Monster/NPC name/ID specified.
+ clif->message(fd, msg_txt(123)); // Invalid Monster/NPC name/ID specified.
return false;
}
-
+
if (pc_hasmount(sd)) {
clif->message(fd, msg_txt(1144)); // Character cannot be disguised while mounted.
return false;
}
-
+
if(sd->sc.data[SC_MONSTER_TRANSFORM])
{
clif->message(fd, msg_txt(1487)); // Character cannot be disguised while in monster form.
@@ -4634,7 +4626,7 @@ ACMD(disguise)
pc->disguise(sd, id);
clif->message(fd, msg_txt(122)); // Disguise applied.
-
+
return true;
}
@@ -4646,25 +4638,25 @@ ACMD(disguiseall)
int mob_id=0;
struct map_session_data *pl_sd;
struct s_mapiterator* iter;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1145)); // Please enter a Monster/NPC name/ID (usage: @disguiseall <name/ID>).
return false;
}
-
+
if ((mob_id = mob->db_searchname(message)) == 0) // check name first (to avoid possible name begining by a number)
mob_id = atoi(message);
-
+
if (!mob->db_checkid(mob_id) && !npcdb_checkid(mob_id)) { //if mob or npc...
clif->message(fd, msg_txt(123)); // Monster/NPC name/id not found.
return false;
}
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
pc->disguise(pl_sd, mob_id);
mapit->free(iter);
-
+
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
}
@@ -4678,15 +4670,15 @@ ACMD(disguiseguild)
char monster[NAME_LENGTH], guild_name[NAME_LENGTH];
struct map_session_data *pl_sd;
struct guild *g;
-
+
memset(monster, '\0', sizeof(monster));
memset(guild_name, '\0', sizeof(guild_name));
-
+
if( !message || !*message || sscanf(message, "%23[^,], %23[^\r\n]", monster, guild_name) < 2 ) {
clif->message(fd, msg_txt(1146)); // Please enter a mob name/ID and guild name/ID (usage: @disguiseguild <mob name/ID>, <guild name/ID>).
return false;
}
-
+
if( (id = atoi(monster)) > 0 ) {
if( !mob->db_checkid(id) && !npcdb_checkid(id) )
id = 0;
@@ -4697,21 +4689,21 @@ ACMD(disguiseguild)
id = nd->class_;
}
}
-
+
if( id == 0 ) {
- clif->message(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found.
+ clif->message(fd, msg_txt(123)); // Monster/NPC name/id hasn't been found.
return false;
}
-
+
if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(guild_name))) == NULL ) {
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
}
-
+
for (i = 0; i < g->max_member; i++)
if ((pl_sd = g->member[i].sd) && !pc_hasmount(pl_sd))
pc->disguise(pl_sd, id);
-
+
clif->message(fd, msg_txt(122)); // Disguise applied.
return true;
}
@@ -4729,7 +4721,7 @@ ACMD(undisguise)
clif->message(fd, msg_txt(125)); // You're not disguised.
return false;
}
-
+
return true;
}
@@ -4739,15 +4731,15 @@ ACMD(undisguise)
ACMD(undisguiseall) {
struct map_session_data *pl_sd;
struct s_mapiterator* iter;
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
if( pl_sd->disguise != -1 )
pc->disguise(pl_sd, -1);
mapit->free(iter);
-
+
clif->message(fd, msg_txt(124)); // Disguise removed.
-
+
return true;
}
@@ -4760,25 +4752,25 @@ ACMD(undisguiseguild)
struct map_session_data *pl_sd;
struct guild *g;
int i;
-
+
memset(guild_name, '\0', sizeof(guild_name));
-
+
if(!message || !*message || sscanf(message, "%23[^\n]", guild_name) < 1) {
clif->message(fd, msg_txt(1147)); // Please enter guild name/ID (usage: @undisguiseguild <guild name/ID>).
return false;
}
-
+
if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(message))) == NULL ) {
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
}
-
+
for(i = 0; i < g->max_member; i++)
if( (pl_sd = g->member[i].sd) && pl_sd->disguise != -1 )
pc->disguise(pl_sd, -1);
-
+
clif->message(fd, msg_txt(124)); // Disguise removed.
-
+
return true;
}
@@ -4791,15 +4783,15 @@ ACMD(exp)
double nextb, nextj;
memset(output, '\0', sizeof(output));
-
+
nextb = pc->nextbaseexp(sd);
if (nextb)
nextb = sd->status.base_exp*100.0/nextb;
-
+
nextj = pc->nextjobexp(sd);
if (nextj)
nextj = sd->status.job_exp*100.0/nextj;
-
+
sprintf(output, msg_txt(1148), sd->status.base_level, nextb, sd->status.job_level, nextj); // Base Level: %d (%.3f%%) | Job Level: %d (%.3f%%)
clif->message(fd, output);
return true;
@@ -4811,17 +4803,16 @@ ACMD(exp)
*------------------------------------------*/
ACMD(broadcast)
{
-
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1149)); // Please enter a message (usage: @broadcast <message>).
return false;
}
-
+
sprintf(atcmd_output, "%s: %s", sd->status.name, message);
intif->broadcast(atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT);
-
+
return true;
}
@@ -4831,16 +4822,16 @@ ACMD(broadcast)
ACMD(localbroadcast)
{
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1150)); // Please enter a message (usage: @localbroadcast <message>).
return false;
}
-
+
sprintf(atcmd_output, "%s: %s", sd->status.name, message);
-
+
clif->broadcast(&sd->bl, atcmd_output, strlen(atcmd_output) + 1, BC_DEFAULT, ALL_SAMEMAP);
-
+
return true;
}
@@ -4851,15 +4842,15 @@ ACMD(email)
{
char actual_email[100];
char new_email[100];
-
+
memset(actual_email, '\0', sizeof(actual_email));
memset(new_email, '\0', sizeof(new_email));
-
+
if (!message || !*message || sscanf(message, "%99s %99s", actual_email, new_email) < 2) {
clif->message(fd, msg_txt(1151)); // Please enter two e-mail addresses (usage: @email <current@email> <new@email>).
return false;
}
-
+
if (e_mail_check(actual_email) == 0) {
clif->message(fd, msg_txt(144)); // Invalid e-mail. If your email hasn't been set, use a@a.com.
return false;
@@ -4873,7 +4864,7 @@ ACMD(email)
clif->message(fd, msg_txt(147)); // New e-mail must be different from the current e-mail address.
return false;
}
-
+
chrif->changeemail(sd->status.account_id, actual_email, new_email);
clif->message(fd, msg_txt(148)); // Information sended to login-server via char-server.
return true;
@@ -4885,12 +4876,12 @@ ACMD(email)
ACMD(effect)
{
int type = 0, flag = 0;
-
+
if (!message || !*message || sscanf(message, "%d", &type) < 1) {
clif->message(fd, msg_txt(1152)); // Please enter an effect number (usage: @effect <effect number>).
return false;
}
-
+
clif->specialeffect(&sd->bl, type, (send_target)flag);
clif->message(fd, msg_txt(229)); // Your effect has changed.
return true;
@@ -4903,7 +4894,7 @@ ACMD(effect)
ACMD(killer)
{
sd->state.killer = !sd->state.killer;
-
+
if(sd->state.killer)
clif->message(fd, msg_txt(241));
else {
@@ -4919,7 +4910,7 @@ ACMD(killer)
*------------------------------------------*/
ACMD(killable) {
sd->state.killable = !sd->state.killable;
-
+
if(sd->state.killable)
clif->message(fd, msg_txt(242));
else {
@@ -4958,29 +4949,29 @@ ACMD(npcmove) {
struct npc_data *nd = 0;
memset(atcmd_player_name, '\0', sizeof atcmd_player_name);
-
+
if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &x, &y, atcmd_player_name) < 3) {
clif->message(fd, msg_txt(1153)); // Usage: @npcmove <X> <Y> <npc_name>
return false;
}
-
+
if ((nd = npc->name2id(atcmd_player_name)) == NULL) {
clif->message(fd, msg_txt(111)); // This NPC doesn't exist.
return false;
}
-
+
if ((m=nd->bl.m) < 0 || nd->bl.prev == NULL) {
clif->message(fd, msg_txt(1154)); // NPC is not in this map.
- return false; //Not on a map.
+ return false; //Not on a map.
}
-
+
x = cap_value(x, 0, map->list[m].xs-1);
y = cap_value(y, 0, map->list[m].ys-1);
map->foreachinrange(clif->outsight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
map->moveblock(&nd->bl, x, y, timer->gettick());
map->foreachinrange(clif->insight, &nd->bl, AREA_SIZE, BL_PC, &nd->bl);
clif->message(fd, msg_txt(1155)); // NPC moved.
-
+
return true;
}
@@ -4994,14 +4985,14 @@ ACMD(addwarp)
int x,y;
unsigned short m;
struct npc_data* nd;
-
+
memset(warpname, '\0', sizeof(warpname));
-
+
if (!message || !*message || sscanf(message, "%31s %d %d %23[^\n]", mapname, &x, &y, warpname) < 4) {
clif->message(fd, msg_txt(1156)); // Usage: @addwarp <mapname> <X> <Y> <npc name>
return false;
}
-
+
m = mapindex->name2id(mapname);
if( m == 0 )
{
@@ -5009,11 +5000,11 @@ ACMD(addwarp)
clif->message(fd, atcmd_output);
return false;
}
-
+
nd = npc->add_warp(warpname, sd->bl.m, sd->bl.x, sd->bl.y, 2, 2, m, x, y);
if( nd == NULL )
return false;
-
+
sprintf(atcmd_output, msg_txt(1158), nd->exname); // New warp NPC '%s' created.
clif->message(fd, atcmd_output);
return true;
@@ -5025,22 +5016,21 @@ ACMD(addwarp)
*------------------------------------------*/
ACMD(follow) {
struct map_session_data *pl_sd = NULL;
-
+
if (!message || !*message) {
if (sd->followtarget == -1)
return false;
-
pc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
return true;
}
-
+
if ( (pl_sd = map->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
if (sd->followtarget == pl_sd->bl.id) {
pc->stop_following (sd);
clif->message(fd, msg_txt(1159)); // Follow mode OFF.
@@ -5048,7 +5038,7 @@ ACMD(follow) {
pc->follow(sd, pl_sd->bl.id);
clif->message(fd, msg_txt(1160)); // Follow mode ON.
}
-
+
return true;
}
@@ -5078,15 +5068,15 @@ ACMD(dropall)
ACMD(storeall)
{
int i;
-
- if (sd->state.storage_flag != 1)
- { //Open storage.
+
+ if (sd->state.storage_flag != 1) {
+ //Open storage.
if( storage->open(sd) == 1 ) {
clif->message(fd, msg_txt(1161)); // You currently cannot open your storage.
return false;
}
}
-
+
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
@@ -5095,7 +5085,7 @@ ACMD(storeall)
}
}
storage->close(sd);
-
+
clif->message(fd, msg_txt(1162)); // All items stored.
return true;
}
@@ -5103,18 +5093,18 @@ ACMD(storeall)
ACMD(clearstorage)
{
int i, j;
-
+
if (sd->state.storage_flag == 1) {
clif->message(fd, msg_txt(250));
return false;
}
-
+
j = sd->status.storage.storage_amount;
for (i = 0; i < j; ++i) {
storage->delitem(sd, i, sd->status.storage.items[i].amount);
}
storage->close(sd);
-
+
clif->message(fd, msg_txt(1394)); // Your storage was cleaned.
return true;
}
@@ -5124,29 +5114,29 @@ ACMD(cleargstorage)
int i, j;
struct guild *g;
struct guild_storage *guild_storage;
-
+
g = sd->guild;
-
+
if (g == NULL) {
clif->message(fd, msg_txt(43));
return false;
}
-
+
if (sd->state.storage_flag == 1) {
clif->message(fd, msg_txt(250));
return false;
}
-
+
if (sd->state.storage_flag == 2) {
clif->message(fd, msg_txt(251));
return false;
}
-
+
guild_storage = idb_get(gstorage->db,sd->status.guild_id);
if (guild_storage == NULL) {// Doesn't have opened @gstorage yet, so we skip the deletion since *shouldn't* have any item there.
return false;
}
-
+
j = guild_storage->storage_amount;
guild_storage->lock = 1; // Lock @gstorage: do not allow any item to be retrieved or stored from any guild member
for (i = 0; i < j; ++i) {
@@ -5154,7 +5144,7 @@ ACMD(cleargstorage)
}
gstorage->close(sd);
guild_storage->lock = 0; // Cleaning done, release lock
-
+
clif->message(fd, msg_txt(1395)); // Your guild storage was cleaned.
return true;
}
@@ -5162,24 +5152,24 @@ ACMD(cleargstorage)
ACMD(clearcart)
{
int i;
-
+
if (pc_iscarton(sd) == 0) {
clif->message(fd, msg_txt(1396)); // You do not have a cart to be cleaned.
return false;
}
-
+
if( sd->state.vending == 1 ) {
clif->message(fd, msg_txt(548)); // You can't clean a cart while vending!
- return false;
- }
-
+ return false;
+ }
+
for( i = 0; i < MAX_CART; i++ )
if(sd->status.cart[i].nameid > 0)
pc->cart_delitem(sd, i, sd->status.cart[i].amount, 1, LOG_TYPE_OTHER);
-
+
clif->clearcart(fd);
clif->updatestatus(sd,SP_CARTINFO);
-
+
clif->message(fd, msg_txt(1397)); // Your cart was cleaned.
return true;
}
@@ -5197,16 +5187,16 @@ ACMD(skillid) {
DBKey key;
DBData *data;
char partials[MAX_SKILLID_PARTIAL_RESULTS][MAX_SKILLID_PARTIAL_RESULTS_LEN];
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1163)); // Please enter a skill name to look up (usage: @skillid <skill name>).
return false;
}
-
+
skillen = strlen(message);
-
+
iter = db_iterator(skill->name2id_db);
-
+
for( data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key) ) {
idx = skill->get_index(DB->data2i(data));
if (strnicmp(key.str, message, skillen) == 0 || strnicmp(skill->db[idx].desc, message, skillen) == 0) {
@@ -5216,18 +5206,18 @@ ACMD(skillid) {
snprintf(partials[found++], MAX_SKILLID_PARTIAL_RESULTS_LEN, msg_txt(1164), DB->data2i(data), skill->db[idx].desc, key.str);
}
}
-
+
dbi_destroy(iter);
-
+
if( found ) {
sprintf(atcmd_output, msg_txt(1398), found); // -- Displaying first %d partial matches
clif->message(fd, atcmd_output);
}
-
+
for(i = 0; i < found; i++) { /* partials */
clif->message(fd, partials[i]);
}
-
+
return true;
}
@@ -5241,38 +5231,38 @@ ACMD(useskill) {
uint16 skill_id;
uint16 skill_lv;
char target[100];
-
+
if(!message || !*message || sscanf(message, "%hu %hu %23[^\n]", &skill_id, &skill_lv, target) != 3) {
clif->message(fd, msg_txt(1165)); // Usage: @useskill <skill ID> <skill level> <target>
return false;
}
-
+
if(!strcmp(target,"self"))
pl_sd = sd; //quick keyword
else if ( (pl_sd = map->nick2sd(target)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorized you to do this action on this player.
return false;
}
-
+
if (skill_id >= HM_SKILLBASE && skill_id < HM_SKILLBASE+MAX_HOMUNSKILL
&& sd->hd && homun_alive(sd->hd)) // (If used with @useskill, put the homunc as dest)
bl = &sd->hd->bl;
else
bl = &sd->bl;
-
+
pc->delinvincibletimer(sd);
-
+
if (skill->get_inf(skill_id)&INF_GROUND_SKILL)
unit->skilluse_pos(bl, pl_sd->bl.x, pl_sd->bl.y, skill_id, skill_lv);
else
unit->skilluse_id(bl, pl_sd->bl.id, skill_id, skill_lv);
-
+
return true;
}
@@ -5286,7 +5276,7 @@ ACMD(displayskill) {
int64 tick;
uint16 skill_id;
uint16 skill_lv = 1;
-
+
if (!message || !*message || sscanf(message, "%hu %hu", &skill_id, &skill_lv) < 1) {
clif->message(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>}
return false;
@@ -5309,32 +5299,32 @@ ACMD(skilltree) {
int meets, j, c=0;
char target[NAME_LENGTH];
struct skill_tree_entry *ent;
-
+
if(!message || !*message || sscanf(message, "%hu %23[^\r\n]", &skill_id, target) != 2) {
clif->message(fd, msg_txt(1167)); // Usage: @skilltree <skill ID> <target>
return false;
}
-
+
if ( (pl_sd = map->nick2sd(target)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
c = pc->calc_skilltree_normalize_job(pl_sd);
c = pc->mapid2jobid(c, pl_sd->status.sex);
-
+
sprintf(atcmd_output, msg_txt(1168), pc->job_name(c), pc->checkskill(pl_sd, NV_BASIC)); // Player is using %s skill tree (%d basic points).
clif->message(fd, atcmd_output);
-
+
ARR_FIND( 0, MAX_SKILL_TREE, j, pc->skill_tree[c][j].id == 0 || pc->skill_tree[c][j].id == skill_id );
if( j == MAX_SKILL_TREE || pc->skill_tree[c][j].id == 0 )
{
clif->message(fd, msg_txt(1169)); // The player cannot use that skill.
return false;
}
-
+
ent = &pc->skill_tree[c][j];
-
+
meets = 1;
for(j=0;j<MAX_PC_SKILL_REQUIRE;j++)
{
@@ -5348,7 +5338,7 @@ ACMD(skilltree) {
if (meets == 1) {
clif->message(fd, msg_txt(1171)); // The player meets all the requirements for that skill.
}
-
+
return true;
}
@@ -5357,14 +5347,14 @@ void getring(struct map_session_data* sd) {
int flag, item_id;
struct item item_tmp;
item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F;
-
+
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = 1;
item_tmp.card[0] = 255;
item_tmp.card[2] = sd->status.partner_id;
item_tmp.card[3] = sd->status.partner_id >> 16;
-
+
if((flag = pc->additem(sd,&item_tmp,1,LOG_TYPE_COMMAND))) {
clif->additem(sd,0,0,flag);
map->addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
@@ -5378,17 +5368,17 @@ void getring(struct map_session_data* sd) {
ACMD(marry) {
struct map_session_data *pl_sd = NULL;
char player_name[NAME_LENGTH] = "";
-
+
if (!message || !*message || sscanf(message, "%23s", player_name) != 1) {
clif->message(fd, msg_txt(1172)); // Usage: @marry <char name>
return false;
}
-
+
if ((pl_sd = map->nick2sd(player_name)) == NULL) {
clif->message(fd, msg_txt(3));
return false;
}
-
+
if (pc->marriage(sd, pl_sd) == 0) {
clif->message(fd, msg_txt(1173)); // They are married... wish them well.
clif->wedding_effect(&pl_sd->bl); //wedding effect and music [Lupus]
@@ -5396,7 +5386,7 @@ ACMD(marry) {
getring(pl_sd);
return true;
}
-
+
clif->message(fd, msg_txt(1174)); // The two cannot wed because one is either a baby or already married.
return false;
}
@@ -5412,7 +5402,7 @@ ACMD(divorce)
clif->message(fd, atcmd_output);
return false;
}
-
+
sprintf(atcmd_output, msg_txt(1176), sd->status.name); // '%s' and his/her partner are now divorced.
clif->message(fd, atcmd_output);
return true;
@@ -5425,7 +5415,7 @@ ACMD(changelook)
{
int i, j = 0, k = 0;
int pos[7] = { LOOK_HEAD_TOP,LOOK_HEAD_MID,LOOK_HEAD_BOTTOM,LOOK_WEAPON,LOOK_SHIELD,LOOK_SHOES,LOOK_ROBE };
-
+
if((i = sscanf(message, "%d %d", &j, &k)) < 1) {
clif->message(fd, msg_txt(1177)); // Usage: @changelook {<position>} <view id>
clif->message(fd, msg_txt(1178)); // Position: 1-Top 2-Middle 3-Bottom 4-Weapon 5-Shield 6-Shoes 7-Robe
@@ -5434,13 +5424,13 @@ ACMD(changelook)
if (j < 1 || j > 7)
j = 1;
j = pos[j - 1];
- } else if( i == 1 ) { // position not defined, use HEAD_TOP as default
- k = j; // swap
+ } else if( i == 1 ) { // position not defined, use HEAD_TOP as default
+ k = j; // swap
j = LOOK_HEAD_TOP;
}
-
+
clif->changelook(&sd->bl,j,k);
-
+
return true;
}
@@ -5448,23 +5438,23 @@ ACMD(changelook)
* @autotrade by durf [Lupus] [Paradox924X]
* Turns on/off Autotrade for a specific player
*------------------------------------------*/
-ACMD(autotrade) {
-
+ACMD(autotrade)
+{
if( map->list[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) {
clif->message(fd, msg_txt(1179)); // Autotrade is not allowed in this map.
return false;
}
-
+
if( pc_isdead(sd) ) {
clif->message(fd, msg_txt(1180)); // You cannot autotrade when dead.
return false;
}
-
+
if( !sd->state.vending && !sd->state.buyingstore ) { //check if player is vending or buying
clif->message(fd, msg_txt(549)); // "You should have a shop open in order to use @autotrade."
return false;
}
-
+
sd->state.autotrade = 1;
if( battle_config.at_timeout ) {
int timeout = atoi(message);
@@ -5473,17 +5463,17 @@ ACMD(autotrade) {
}
clif->chsys_quit(sd);
-
+
clif->authfail_fd(sd->fd, 15);
/* currently standalone is not supporting buyingstores, so we rely on the previous method */
if( sd->state.buyingstore )
return true;
-
+
#ifdef AUTOTRADE_PERSISTENCY
sd->state.autotrade = 2;/** state will enter pre-save, we use it to rule out some criterias **/
pc->autotrade_prepare(sd);
-
+
return false;/* we fail to not cause it to proceed on is_atcommand */
#else
return true;
@@ -5497,27 +5487,27 @@ ACMD(autotrade) {
ACMD(changegm) {
struct guild *g;
struct map_session_data *pl_sd;
-
+
if (sd->status.guild_id == 0 || (g = sd->guild) == NULL || strcmp(g->master,sd->status.name)) {
clif->message(fd, msg_txt(1181)); // You need to be a Guild Master to use this command.
return false;
}
-
+
if( map->list[sd->bl.m].flag.guildlock || map->list[sd->bl.m].flag.gvg_castle ) {
clif->message(fd, msg_txt(1182)); // You cannot change guild leaders in this map.
return false;
}
-
+
if( !message[0] ) {
clif->message(fd, msg_txt(1183)); // Usage: @changegm <guild_member_name>
return false;
}
-
+
if((pl_sd=map->nick2sd((char *) message)) == NULL || pl_sd->status.guild_id != sd->status.guild_id) {
clif->message(fd, msg_txt(1184)); // Target character must be online and be a guild member.
return false;
}
-
+
guild->gm_change(sd->status.guild_id, pl_sd);
return true;
}
@@ -5527,12 +5517,12 @@ ACMD(changegm) {
* Changes the leader of a party.
*------------------------------------------*/
ACMD(changeleader) {
-
+
if( !message[0] ) {
clif->message(fd, msg_txt(1185)); // Usage: @changeleader <party_member_name>
return false;
}
-
+
if (party->changeleader(sd, map->nick2sd((char *) message)))
return true;
return false;
@@ -5547,37 +5537,37 @@ ACMD(partyoption)
struct party_data *p;
int mi, option;
char w1[16], w2[16];
-
+
if (sd->status.party_id == 0 || (p = party->search(sd->status.party_id)) == NULL)
{
clif->message(fd, msg_txt(282));
return false;
}
-
+
ARR_FIND( 0, MAX_PARTY, mi, p->data[mi].sd == sd );
if (mi == MAX_PARTY)
return false; //Shouldn't happen
-
+
if (!p->party.member[mi].leader)
{
clif->message(fd, msg_txt(282));
return false;
}
-
+
if(!message || !*message || sscanf(message, "%15s %15s", w1, w2) < 2)
{
clif->message(fd, msg_txt(1186)); // Usage: @partyoption <pickup share: yes/no> <item distribution: yes/no>
return false;
}
-
+
option = (config_switch(w1)?1:0)|(config_switch(w2)?2:0);
-
+
//Change item share type.
if (option != p->party.item)
party->changeoption(sd, p->party.exp, option);
else
clif->message(fd, msg_txt(286));
-
+
return true;
}
@@ -5603,14 +5593,14 @@ ACMD(autoloot)
}
if (rate < 0) rate = 0;
if (rate > 10000) rate = 10000;
-
+
sd->state.autoloot = rate;
if (sd->state.autoloot) {
snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1187),((double)sd->state.autoloot)/100.); // Autolooting items with drop rates of %0.02f%% and below.
clif->message(fd, atcmd_output);
}else
clif->message(fd, msg_txt(1188)); // Autoloot is now off.
-
+
return true;
}
@@ -5622,7 +5612,7 @@ ACMD(autolootitem)
struct item_data *item_data = NULL;
int i;
int action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset
-
+
if (message && *message) {
if (message[0] == '+') {
message++;
@@ -5646,7 +5636,7 @@ ACMD(autolootitem)
}
}
}
-
+
switch(action) {
case 1:
ARR_FIND(0, AUTOLOOTITEM_SIZE, i, sd->state.autolootid[i] == item_data->nameid);
@@ -5810,8 +5800,8 @@ ACMD(autoloottype) {
/*==========================================
* It is made to snow.
*------------------------------------------*/
-ACMD(snow) {
-
+ACMD(snow)
+{
if (map->list[sd->bl.m].flag.snow) {
map->list[sd->bl.m].flag.snow=0;
clif->weather(sd->bl.m);
@@ -5821,7 +5811,7 @@ ACMD(snow) {
clif->weather(sd->bl.m);
clif->message(fd, msg_txt(1204)); // It has started to snow.
}
-
+
return true;
}
@@ -5856,7 +5846,7 @@ ACMD(clouds) {
clif->weather(sd->bl.m);
clif->message(fd, msg_txt(1208)); // Clouds appear.
}
-
+
return true;
}
@@ -5874,7 +5864,7 @@ ACMD(clouds2) {
clif->weather(sd->bl.m);
clif->message(fd, msg_txt(1210)); // Alternative clouds appear.
}
-
+
return true;
}
@@ -5909,7 +5899,7 @@ ACMD(leaves) {
clif->weather(sd->bl.m);
clif->message(fd, msg_txt(1214)); // Fallen leaves fall.
}
-
+
return true;
}
@@ -5927,15 +5917,15 @@ ACMD(fireworks) {
clif->weather(sd->bl.m);
clif->message(fd, msg_txt(1216)); // Fireworks have launched.
}
-
+
return true;
}
/*==========================================
* Clearing Weather Effects by Dexity
*------------------------------------------*/
-ACMD(clearweather) {
-
+ACMD(clearweather)
+{
map->list[sd->bl.m].flag.snow=0;
map->list[sd->bl.m].flag.sakura=0;
map->list[sd->bl.m].flag.clouds=0;
@@ -5945,7 +5935,7 @@ ACMD(clearweather) {
map->list[sd->bl.m].flag.leaves=0;
clif->weather(sd->bl.m);
clif->message(fd, msg_txt(291)); // "Weather effects will disappear after teleporting or refreshing."
-
+
return true;
}
@@ -5955,24 +5945,24 @@ ACMD(clearweather) {
ACMD(sound)
{
char sound_file[100];
-
+
memset(sound_file, '\0', sizeof(sound_file));
-
+
if(!message || !*message || sscanf(message, "%99[^\n]", sound_file) < 1) {
clif->message(fd, msg_txt(1217)); // Please enter a sound filename (usage: @sound <filename>).
return false;
}
-
+
if(strstr(sound_file, ".wav") == NULL)
strcat(sound_file, ".wav");
-
+
clif->soundeffectall(&sd->bl, sound_file, 0, AREA);
-
+
return true;
}
/*==========================================
- * MOB Search
+ * MOB Search
*------------------------------------------*/
ACMD(mobsearch)
{
@@ -5980,12 +5970,12 @@ ACMD(mobsearch)
int mob_id;
int number = 0;
struct s_mapiterator* it;
-
+
if (!message || !*message || sscanf(message, "%99[^\n]", mob_name) < 1) {
clif->message(fd, msg_txt(1218)); // Please enter a monster name (usage: @mobsearch <monster name>).
return false;
}
-
+
if ((mob_id = atoi(mob_name)) == 0)
mob_id = mob->db_searchname(mob_name);
if(mob_id > 0 && mob->db_checkid(mob_id) == 0){
@@ -5994,24 +5984,24 @@ ACMD(mobsearch)
return false;
}
if(mob_id == atoi(mob_name) && mob->db(mob_id)->jname)
- strcpy(mob_name,mob->db(mob_id)->jname); // --ja--
- // strcpy(mob_name,mob_db(mob_id)->name); // --en--
-
+ strcpy(mob_name,mob->db(mob_id)->jname); // --ja--
+ //strcpy(mob_name,mob_db(mob_id)->name); // --en--
+
snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1220), mob_name, mapindex_id2name(sd->mapindex)); // Mob Search... %s %s
clif->message(fd, atcmd_output);
-
+
it = mapit_geteachmob();
for(;;)
{
TBL_MOB* md = (TBL_MOB*)mapit->next(it);
if( md == NULL )
break;// no more mobs
-
+
if( md->bl.m != sd->bl.m )
continue;
if( mob_id != -1 && md->class_ != mob_id )
continue;
-
+
++number;
if( md->spawn_timer == INVALID_TIMER )
snprintf(atcmd_output, sizeof(atcmd_output), "%2d[%3d:%3d] %s", number, md->bl.x, md->bl.y, md->name);
@@ -6020,7 +6010,7 @@ ACMD(mobsearch)
clif->message(fd, atcmd_output);
}
mapit->free(it);
-
+
return true;
}
@@ -6031,7 +6021,7 @@ ACMD(mobsearch)
int atcommand_cleanfloor_sub(struct block_list *bl, va_list ap) {
nullpo_ret(bl);
map->clearflooritem(bl);
-
+
return 0;
}
@@ -6043,7 +6033,7 @@ ACMD(cleanmap) {
ACMD(cleanarea) {
int x0 = 0, y0 = 0, x1 = 0, y1 = 0;
-
+
if (!message || !*message || sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) < 1) {
map->foreachinrange(atcommand->cleanfloor_sub, &sd->bl, AREA_SIZE * 2, BL_ITEM);
} else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 1) {
@@ -6051,7 +6041,7 @@ ACMD(cleanarea) {
} else if (sscanf(message, "%d %d %d %d", &x0, &y0, &x1, &y1) == 4) {
map->foreachinarea(atcommand->cleanfloor_sub, sd->bl.m, x0, y0, x1, y1, BL_ITEM);
}
-
+
clif->message(fd, msg_txt(1221)); // All dropped items have been cleaned up.
return true;
}
@@ -6066,12 +6056,12 @@ ACMD(npctalk)
struct npc_data *nd;
bool ifcolor=(*(info->command + 7) != 'c' && *(info->command + 7) != 'C')?0:1;
unsigned int color = 0;
-
+
if (sd->sc.count && //no "chatting" while muted.
(sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
-
+
if(!ifcolor) {
if (!message || !*message || sscanf(message, "%23[^,], %99[^\n]", name, mes) < 2) {
clif->message(fd, msg_txt(1222)); // Please enter the correct parameters (usage: @npctalk <npc name>, <message>).
@@ -6084,18 +6074,18 @@ ACMD(npctalk)
return false;
}
}
-
+
if (!(nd = npc->name2id(name))) {
clif->message(fd, msg_txt(111)); // This NPC doesn't exist
return false;
}
-
+
strtok(name, "#"); // discard extra name identifier if present
snprintf(temp, sizeof(temp), "%s : %s", name, mes);
-
+
if(ifcolor) clif->messagecolor(&nd->bl,color,temp);
else clif->disp_overhead(&nd->bl, temp);
-
+
return true;
}
@@ -6103,29 +6093,29 @@ ACMD(pettalk)
{
char mes[100],temp[100];
struct pet_data *pd;
-
+
if ( battle_config.min_chat_delay ) {
if( DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0 )
return true;
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
-
+
if(!sd->status.pet_id || !(pd=sd->pd))
{
clif->message(fd, msg_txt(184));
return false;
}
-
+
if (sd->sc.count && //no "chatting" while muted.
(sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
-
+
if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) {
clif->message(fd, msg_txt(1224)); // Please enter a message (usage: @pettalk <message>).
return false;
}
-
+
if (message[0] == '/')
{// pet emotion processing
const char* emo[] = {
@@ -6149,15 +6139,15 @@ ACMD(pettalk)
return true;
}
sd->emotionlasttime = time(NULL);
-
+
clif->emotion(&pd->bl, i);
return true;
}
}
-
+
snprintf(temp, sizeof temp ,"%s : %s", pd->pet.name, mes);
clif->disp_overhead(&pd->bl, temp);
-
+
return true;
}
@@ -6170,10 +6160,10 @@ ACMD(users)
int users[MAX_MAPINDEX];
int users_all;
struct s_mapiterator* iter;
-
+
memset(users, 0, sizeof(users));
users_all = 0;
-
+
// count users on each map
iter = mapit_getallusers();
for(;;)
@@ -6181,29 +6171,29 @@ ACMD(users)
struct map_session_data* sd2 = (struct map_session_data*)mapit->next(iter);
if( sd2 == NULL )
break;// no more users
-
+
if( sd2->mapindex >= MAX_MAPINDEX )
continue;// invalid mapindex
-
+
if( users[sd2->mapindex] < INT_MAX ) ++users[sd2->mapindex];
if( users_all < INT_MAX ) ++users_all;
}
mapit->free(iter);
-
+
// display results for each map
for( i = 0; i < MAX_MAPINDEX; ++i )
{
if( users[i] == 0 )
continue;// empty
-
+
safesnprintf(buf, sizeof(buf), "%s: %d (%.2f%%)", mapindex_id2name(i), users[i], (float)(100.0f*users[i]/users_all));
clif->message(sd->fd, buf);
}
-
+
// display overall count
safesnprintf(buf, sizeof(buf), "all: %d", users_all);
clif->message(sd->fd, buf);
-
+
return true;
}
@@ -6229,31 +6219,31 @@ ACMD(summon)
int duration = 0;
struct mob_data *md;
int64 tick=timer->gettick();
-
+
if (!message || !*message || sscanf(message, "%23s %d", name, &duration) < 1)
{
clif->message(fd, msg_txt(1225)); // Please enter a monster name (usage: @summon <monster name> {duration}).
return false;
}
-
+
if (duration < 1)
duration =1;
else if (duration > 60)
duration =60;
-
+
if ((mob_id = atoi(name)) == 0)
mob_id = mob->db_searchname(name);
if(mob_id == 0 || mob->db_checkid(mob_id) == 0)
{
- clif->message(fd, msg_txt(40)); // Invalid monster ID or name.
+ clif->message(fd, msg_txt(40)); // Invalid monster ID or name.
return false;
}
-
+
md = mob->once_spawn_sub(&sd->bl, sd->bl.m, -1, -1, "--ja--", mob_id, "", SZ_SMALL, AI_NONE);
-
+
if(!md)
return false;
-
+
md->master_id=sd->bl.id;
md->special_state.ai=1;
md->deletetimer=timer->add(tick+(duration*60000),mob->timer_delete,md->bl.id,0);
@@ -6261,8 +6251,8 @@ ACMD(summon)
mob->spawn(md);
sc_start4(NULL,&md->bl, SC_MODECHANGE, 100, 1, 0, MD_AGGRESSIVE, 0, 60000);
clif->skill_poseffect(&sd->bl,AM_CALLHOMUN,1,md->bl.x,md->bl.y,tick);
- clif->message(fd, msg_txt(39)); // All monster summoned!
-
+ clif->message(fd, msg_txt(39)); // All monster summoned!
+
return true;
}
@@ -6274,12 +6264,12 @@ ACMD(summon)
ACMD(adjgroup)
{
int new_group = 0;
-
+
if (!message || !*message || sscanf(message, "%d", &new_group) != 1) {
clif->message(fd, msg_txt(1226)); // Usage: @adjgroup <group_id>
return false;
}
-
+
if (pc->set_group(sd, new_group) != 0) {
clif->message(fd, msg_txt(1227)); // Specified group does not exist.
return false;
@@ -6295,18 +6285,18 @@ ACMD(adjgroup)
* Open a trade window with a remote player
*------------------------------------------*/
ACMD(trade) {
- struct map_session_data *pl_sd = NULL;
-
+ struct map_session_data *pl_sd = NULL;
+
if (!message || !*message) {
clif->message(fd, msg_txt(1230)); // Please enter a player name (usage: @trade <char name>).
return false;
}
-
+
if ( (pl_sd = map->nick2sd((char *)message)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
trade->request(sd, pl_sd);
return true;
}
@@ -6318,19 +6308,19 @@ ACMD(trade) {
ACMD(setbattleflag)
{
char flag[128], value[128];
-
+
if (!message || !*message || sscanf(message, "%127s %127s", flag, value) != 2) {
clif->message(fd, msg_txt(1231)); // Usage: @setbattleflag <flag> <value>
return false;
}
-
+
if (battle->config_set_value(flag, value) == 0) {
clif->message(fd, msg_txt(1232)); // Unknown battle_config flag.
return false;
}
-
+
clif->message(fd, msg_txt(1233)); // Set battle_config as requested.
-
+
return true;
}
@@ -6339,27 +6329,27 @@ ACMD(setbattleflag)
*------------------------------------------*/
ACMD(unmute) {
struct map_session_data *pl_sd = NULL;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1234)); // Please enter a player name (usage: @unmute <char name>).
return false;
}
-
+
if ( (pl_sd = map->nick2sd((char *)message)) == NULL )
{
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
if(!pl_sd->sc.data[SC_NOCHAT]) {
clif->message(sd->fd,msg_txt(1235)); // Player is not muted.
return false;
}
-
+
pl_sd->status.manner = 0;
status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);
clif->message(sd->fd,msg_txt(1236)); // Player unmuted.
-
+
return true;
}
@@ -6370,7 +6360,7 @@ ACMD(uptime)
{
unsigned long seconds = 0, day = 24*60*60, hour = 60*60,
minute = 60, days = 0, hours = 0, minutes = 0;
-
+
seconds = timer->get_uptime();
days = seconds/day;
seconds -= (seconds/day>0)?(seconds/day)*day:0;
@@ -6378,10 +6368,10 @@ ACMD(uptime)
seconds -= (seconds/hour>0)?(seconds/hour)*hour:0;
minutes = seconds/minute;
seconds -= (seconds/minute>0)?(seconds/minute)*minute:0;
-
+
snprintf(atcmd_output, sizeof(atcmd_output), msg_txt(245), days, hours, minutes, seconds);
clif->message(fd, atcmd_output);
-
+
return true;
}
@@ -6407,26 +6397,26 @@ ACMD(changesex)
ACMD(mute) {
struct map_session_data *pl_sd = NULL;
int manner;
-
+
if (!message || !*message || sscanf(message, "%d %23[^\n]", &manner, atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1237)); // Usage: @mute <time> <char name>
return false;
}
-
+
if ( (pl_sd = map->nick2sd(atcmd_player_name)) == NULL ) {
clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
if ( pc_get_group_level(sd) < pc_get_group_level(pl_sd) )
{
clif->message(fd, msg_txt(81)); // Your GM level don't authorize you to do this action on this player.
return false;
}
-
+
clif->manner_message(sd, 0);
clif->manner_message(pl_sd, 5);
-
+
if( pl_sd->status.manner < manner ) {
pl_sd->status.manner -= manner;
sc_start(NULL,&pl_sd->bl,SC_NOCHAT,100,0,0);
@@ -6434,9 +6424,9 @@ ACMD(mute) {
pl_sd->status.manner = 0;
status_change_end(&pl_sd->bl, SC_NOCHAT, INVALID_TIMER);
}
-
+
clif->GM_silence(sd, pl_sd, (manner > 0 ? 1 : 0));
-
+
return true;
}
@@ -6453,7 +6443,7 @@ ACMD(refreshall)
{
struct map_session_data* iter_sd;
struct s_mapiterator* iter;
-
+
iter = mapit_getallusers();
for (iter_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); iter_sd = (TBL_PC*)mapit->next(iter))
clif->refresh(iter_sd);
@@ -6468,7 +6458,7 @@ ACMD(refreshall)
ACMD(identify)
{
int i,num;
-
+
for(i=num=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){
num++;
@@ -6490,7 +6480,7 @@ ACMD(misceffect) {
if (sscanf(message, "%d", &effect) < 1)
return false;
clif->misceffect(&sd->bl,effect);
-
+
return true;
}
@@ -6517,103 +6507,103 @@ ACMD(mobinfo)
struct mob_db *monster, *mob_array[MAX_SEARCH];
int count;
int i, j, k;
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(atcmd_output2, '\0', sizeof(atcmd_output2));
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1239)); // Please enter a monster name/ID (usage: @mobinfo <monster_name_or_monster_ID>).
return false;
}
-
+
// If monster identifier/name argument is a name
if ((i = mob->db_checkid(atoi(message)))) {
mob_array[0] = mob->db(i);
count = 1;
} else
count = mob->db_searchname_array(mob_array, MAX_SEARCH, message, 0);
-
+
if (!count) {
clif->message(fd, msg_txt(40)); // Invalid monster ID or name.
return false;
}
-
+
if (count > MAX_SEARCH) {
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count);
clif->message(fd, atcmd_output);
count = MAX_SEARCH;
}
-
+
for (k = 0; k < count; k++) {
unsigned int job_exp, base_exp;
-
+
monster = mob_array[k];
-
+
job_exp = monster->job_exp;
base_exp = monster->base_exp;
-
+
#ifdef RENEWAL_EXP
if( battle_config.atcommand_mobinfo_type ) {
base_exp = base_exp * pc->level_penalty_mod(monster->lv - sd->status.base_level, monster->status.race, monster->status.mode, 1) / 100;
job_exp = job_exp * pc->level_penalty_mod(monster->lv - sd->status.base_level, monster->status.race, monster->status.mode, 1) / 100;
}
#endif
-
+
// stats
if (monster->mexp)
sprintf(atcmd_output, msg_txt(1240), monster->name, monster->jname, monster->sprite, monster->vd.class_); // MVP Monster: '%s'/'%s'/'%s' (%d)
else
sprintf(atcmd_output, msg_txt(1241), monster->name, monster->jname, monster->sprite, monster->vd.class_); // Monster: '%s'/'%s'/'%s' (%d)
clif->message(fd, atcmd_output);
-
+
sprintf(atcmd_output, msg_txt(1242), monster->lv, monster->status.max_hp, base_exp, job_exp, MOB_HIT(monster), MOB_FLEE(monster)); // Lv:%d HP:%d Base EXP:%u Job EXP:%u HIT:%d FLEE:%d
clif->message(fd, atcmd_output);
-
+
sprintf(atcmd_output, msg_txt(1243), // DEF:%d MDEF:%d STR:%d AGI:%d VIT:%d INT:%d DEX:%d LUK:%d
monster->status.def, monster->status.mdef, monster->status.str, monster->status.agi,
monster->status.vit, monster->status.int_, monster->status.dex, monster->status.luk);
clif->message(fd, atcmd_output);
-
+
sprintf(atcmd_output, msg_txt(1244), // ATK:%d~%d Range:%d~%d~%d Size:%s Race: %s Element: %s (Lv:%d)
monster->status.rhw.atk, monster->status.rhw.atk2, monster->status.rhw.range,
monster->range2 , monster->range3, msize[monster->status.size],
mrace[monster->status.race], melement[monster->status.def_ele], monster->status.ele_lv);
clif->message(fd, atcmd_output);
-
+
// drops
clif->message(fd, msg_txt(1245)); // Drops:
strcpy(atcmd_output, " ");
j = 0;
for (i = 0; i < MAX_MOB_DROP; i++) {
int droprate;
-
+
if (monster->dropitem[i].nameid <= 0 || monster->dropitem[i].p < 1 || (item_data = itemdb->exists(monster->dropitem[i].nameid)) == NULL)
continue;
-
+
droprate = monster->dropitem[i].p;
#ifdef RENEWAL_DROP
if( battle_config.atcommand_mobinfo_type ) {
droprate = droprate * pc->level_penalty_mod(monster->lv - sd->status.base_level, monster->status.race, monster->status.mode, 2) / 100;
-
+
if (droprate <= 0 && !battle_config.drop_rate0item)
droprate = 1;
}
#endif
-
+
if (item_data->slot)
sprintf(atcmd_output2, " - %s[%d] %02.02f%%", item_data->jname, item_data->slot, (float)droprate / 100);
else
sprintf(atcmd_output2, " - %s %02.02f%%", item_data->jname, (float)droprate / 100);
-
+
strcat(atcmd_output, atcmd_output2);
-
+
if (++j % 3 == 0) {
clif->message(fd, atcmd_output);
strcpy(atcmd_output, " ");
}
}
-
+
if (j == 0)
clif->message(fd, msg_txt(1246)); // This monster has no drops.
else if (j % 3 != 0)
@@ -6622,7 +6612,7 @@ ACMD(mobinfo)
if (monster->mexp) {
sprintf(atcmd_output, msg_txt(1247), monster->mexp); // MVP Bonus EXP:%u
clif->message(fd, atcmd_output);
-
+
strcpy(atcmd_output, msg_txt(1248)); // MVP Items:
j = 0;
for (i = 0; i < MAX_MVP_DROP; i++) {
@@ -6656,7 +6646,7 @@ ACMD(showmobs)
int mob_id;
int number = 0;
struct s_mapiterator* it;
-
+
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;
@@ -6676,27 +6666,28 @@ ACMD(showmobs)
clif->message(fd, atcmd_output);
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.
+
+ 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 false;
}
-
+
if(mob_id == atoi(mob_name) && mob->db(mob_id)->jname)
strcpy(mob_name,mob->db(mob_id)->jname); // --ja--
//strcpy(mob_name,mob_db(mob_id)->name); // --en--
-
+
snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1252), // Mob Search... %s %s
mob_name, mapindex_id2name(sd->mapindex));
clif->message(fd, atcmd_output);
-
+
it = mapit_geteachmob();
for(;;)
{
TBL_MOB* md = (TBL_MOB*)mapit->next(it);
if( md == NULL )
break;// no more mobs
-
+
if( md->bl.m != sd->bl.m )
continue;
if( mob_id != -1 && md->class_ != mob_id )
@@ -6705,12 +6696,12 @@ ACMD(showmobs)
continue; // hide slaves and player summoned mobs
if( md->spawn_timer != INVALID_TIMER )
continue; // hide mobs waiting for respawn
-
+
++number;
clif->viewpoint(sd, 1, 0, md->bl.x, md->bl.y, number, 0xFFFFFF);
}
mapit->free(it);
-
+
return true;
}
@@ -6721,19 +6712,19 @@ ACMD(homlevel) {
TBL_HOM * hd;
int level = 0;
enum homun_type htype;
-
+
if( !message || !*message || ( level = atoi(message) ) < 1 ) {
clif->message(fd, msg_txt(1253)); // Please enter a level adjustment (usage: @homlevel <number of levels>).
return false;
}
-
+
if( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
hd = sd->hd;
-
+
if( (htype = homun->class2type(hd->homunculus.class_)) == HT_INVALID ) {
ShowError("atcommand_homlevel: invalid homun class %d (player %s)\n", hd->homunculus.class_,sd->status.name);
return false;
@@ -6759,12 +6750,11 @@ ACMD(homlevel) {
ShowError("atcommand_homlevel: unknown htype '%d'\n",htype);
return false;
}
-
-
+
do {
hd->homunculus.exp += hd->exp_next;
} while( hd->homunculus.level < level && homun->levelup(hd) );
-
+
status_calc_homunculus(hd,SCO_NONE);
status_percent_heal(&hd->bl, 100, 100);
clif->specialeffect(&hd->bl,568,AREA);
@@ -6780,7 +6770,7 @@ ACMD(homevolution)
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
if ( !homun->evolve(sd->hd) ) {
clif->message(fd, msg_txt(1255)); // Your homunculus doesn't evolve.
return false;
@@ -6792,21 +6782,21 @@ ACMD(homevolution)
ACMD(hommutate) {
int homun_id;
enum homun_type m_class, m_id;
-
+
if( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
if( !message || !*message ) {
homun_id = 6048 + (rnd() % 4);
} else {
homun_id = atoi(message);
}
-
+
m_class = homun->class2type(sd->hd->homunculus.class_);
- m_id = homun->class2type(homun_id);
-
+ m_id = homun->class2type(homun_id);
+
if( m_class != HT_INVALID && m_id != HT_INVALID && m_class == HT_EVO && m_id == HT_S && sd->hd->homunculus.level >= 99 ) {
homun->mutate(sd->hd, homun_id);
} else {
@@ -6820,14 +6810,14 @@ ACMD(hommutate) {
*------------------------------------------*/
ACMD(makehomun) {
int homunid;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1256)); // Please enter a homunculus ID (usage: @makehomun <homunculus id>).
return false;
}
-
+
homunid = atoi(message);
-
+
if( homunid == -1 && sd->status.hom_id && !(sd->hd && homun_alive(sd->hd)) ) {
if( !sd->hd )
homun->call(sd);
@@ -6837,18 +6827,18 @@ ACMD(makehomun) {
homun->call(sd);
return true;
}
-
+
if ( sd->status.hom_id ) {
clif->message(fd, msg_txt(450));
return false;
}
-
+
if( homunid < HM_CLASS_BASE || homunid > HM_CLASS_BASE + MAX_HOMUNCULUS_CLASS - 1 )
{
clif->message(fd, msg_txt(1257)); // Invalid Homunculus ID.
return false;
}
-
+
homun->creation_request(sd,homunid);
return true;
}
@@ -6859,20 +6849,20 @@ ACMD(makehomun) {
ACMD(homfriendly)
{
int friendly = 0;
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1258)); // Please enter a friendly value (usage: @homfriendly <friendly value [0-1000]>).
return false;
}
-
+
friendly = atoi(message);
friendly = cap_value(friendly, 0, 1000);
-
+
sd->hd->homunculus.intimacy = friendly * 100 ;
clif->send_homdata(sd,SP_INTIMATE,friendly);
return true;
@@ -6884,20 +6874,20 @@ ACMD(homfriendly)
ACMD(homhungry)
{
int hungry = 0;
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1259)); // Please enter a hunger value (usage: @homhungry <hunger value [0-100]>).
return false;
}
-
+
hungry = atoi(message);
hungry = cap_value(hungry, 0, 100);
-
+
sd->hd->homunculus.hunger = hungry;
clif->send_homdata(sd,SP_HUNGRY,hungry);
return true;
@@ -6909,31 +6899,31 @@ ACMD(homhungry)
ACMD(homtalk)
{
char mes[100],temp[100];
-
+
if ( battle_config.min_chat_delay ) {
if( DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0 )
return true;
sd->cantalk_tick = timer->gettick() + battle_config.min_chat_delay;
}
-
+
if (sd->sc.count && //no "chatting" while muted.
(sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
if (!message || !*message || sscanf(message, "%99[^\n]", mes) < 1) {
clif->message(fd, msg_txt(1260)); // Please enter a message (usage: @homtalk <message>).
return false;
}
-
+
snprintf(temp, sizeof temp ,"%s : %s", sd->hd->homunculus.name, mes);
clif->disp_overhead(&sd->hd->bl, temp);
-
+
return true;
}
@@ -6943,34 +6933,34 @@ ACMD(homtalk)
ACMD(hominfo) {
struct homun_data *hd;
struct status_data *st;
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
hd = sd->hd;
st = status->get_status_data(&hd->bl);
clif->message(fd, msg_txt(1261)); // Homunculus stats:
-
+
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1262), // HP: %d/%d - SP: %d/%d
st->hp, st->max_hp, st->sp, st->max_sp);
clif->message(fd, atcmd_output);
-
+
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1263), // ATK: %d - MATK: %d~%d
st->rhw.atk2 +st->batk, st->matk_min, st->matk_max);
clif->message(fd, atcmd_output);
-
+
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1264), // Hungry: %d - Intimacy: %u
hd->homunculus.hunger, hd->homunculus.intimacy/100);
clif->message(fd, atcmd_output);
-
+
snprintf(atcmd_output, sizeof(atcmd_output) ,
msg_txt(1265), // Stats: Str %d / Agi %d / Vit %d / Int %d / Dex %d / Luk %d
st->str, st->agi, st->vit,
st->int_, st->dex, st->luk);
clif->message(fd, atcmd_output);
-
+
return true;
}
@@ -6980,75 +6970,75 @@ ACMD(homstats)
struct s_homunculus_db *db;
struct s_homunculus *hom;
int lv, min, max, evo;
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
}
-
+
hd = sd->hd;
-
+
hom = &hd->homunculus;
db = hd->homunculusDB;
lv = hom->level;
-
+
snprintf(atcmd_output, sizeof(atcmd_output) ,
msg_txt(1266), lv, db->name); // Homunculus growth stats (Lv %d %s):
clif->message(fd, atcmd_output);
lv--; //Since the first increase is at level 2.
-
+
evo = (hom->class_ == db->evo_class);
min = db->base.HP +lv*db->gmin.HP +(evo?db->emin.HP:0);
max = db->base.HP +lv*db->gmax.HP +(evo?db->emax.HP:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1267), hom->max_hp, min, max); // Max HP: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
min = db->base.SP +lv*db->gmin.SP +(evo?db->emin.SP:0);
max = db->base.SP +lv*db->gmax.SP +(evo?db->emax.SP:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1268), hom->max_sp, min, max); // Max SP: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
min = db->base.str +lv*(db->gmin.str/10) +(evo?db->emin.str:0);
max = db->base.str +lv*(db->gmax.str/10) +(evo?db->emax.str:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1269), hom->str/10, min, max); // Str: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
min = db->base.agi +lv*(db->gmin.agi/10) +(evo?db->emin.agi:0);
max = db->base.agi +lv*(db->gmax.agi/10) +(evo?db->emax.agi:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1270), hom->agi/10, min, max); // Agi: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
min = db->base.vit +lv*(db->gmin.vit/10) +(evo?db->emin.vit:0);
max = db->base.vit +lv*(db->gmax.vit/10) +(evo?db->emax.vit:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1271), hom->vit/10, min, max); // Vit: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
min = db->base.int_ +lv*(db->gmin.int_/10) +(evo?db->emin.int_:0);
max = db->base.int_ +lv*(db->gmax.int_/10) +(evo?db->emax.int_:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1272), hom->int_/10, min, max); // Int: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
min = db->base.dex +lv*(db->gmin.dex/10) +(evo?db->emin.dex:0);
max = db->base.dex +lv*(db->gmax.dex/10) +(evo?db->emax.dex:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1273), hom->dex/10, min, max); // Dex: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
min = db->base.luk +lv*(db->gmin.luk/10) +(evo?db->emin.luk:0);
max = db->base.luk +lv*(db->gmax.luk/10) +(evo?db->emax.luk:0);;
snprintf(atcmd_output, sizeof(atcmd_output) ,msg_txt(1274), hom->luk/10, min, max); // Luk: %d (%d~%d)
clif->message(fd, atcmd_output);
-
+
return true;
}
-ACMD(homshuffle) {
-
+ACMD(homshuffle)
+{
if(!sd->hd)
return false; // nothing to do
-
+
if(!homun->shuffle(sd->hd))
return false;
-
+
clif->message(sd->fd, msg_txt(1275)); // Homunculus stats altered.
atcommand_homstats(fd, sd, command, message, info); //Print out the new stats
return true;
@@ -7062,19 +7052,19 @@ ACMD(iteminfo)
{
struct item_data *item_data, *item_array[MAX_SEARCH];
int i, count = 1;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1276)); // Please enter an item name/ID (usage: @ii/@iteminfo <item name/ID>).
return false;
}
if ((item_array[0] = itemdb->exists(atoi(message))) == NULL)
count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0);
-
+
if (!count) {
- clif->message(fd, msg_txt(19)); // Invalid item ID or name.
+ clif->message(fd, msg_txt(19)); // Invalid item ID or name.
return false;
}
-
+
if (count > MAX_SEARCH) {
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches
clif->message(fd, atcmd_output);
@@ -7088,10 +7078,10 @@ ACMD(iteminfo)
(item_data->script==NULL)? msg_txt(1278) : msg_txt(1279) // None / With script
);
clif->message(fd, atcmd_output);
-
+
sprintf(atcmd_output, msg_txt(1280), item_data->value_buy, item_data->value_sell, item_data->weight/10. ); // NPC Buy:%dz, Sell:%dz | Weight: %.1f
clif->message(fd, atcmd_output);
-
+
if (item_data->maxchance == -1)
strcpy(atcmd_output, msg_txt(1281)); // - Available in the shops only.
else if ( !battle_config.atcommand_mobinfo_type ) {
@@ -7101,7 +7091,7 @@ ACMD(iteminfo)
strcpy(atcmd_output, msg_txt(1283)); // - Monsters don't drop this item.
}
clif->message(fd, atcmd_output);
-
+
}
return true;
}
@@ -7113,19 +7103,19 @@ ACMD(whodrops)
{
struct item_data *item_data, *item_array[MAX_SEARCH];
int i,j, count = 1;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1284)); // Please enter item name/ID (usage: @whodrops <item name/ID>).
return false;
}
if ((item_array[0] = itemdb->exists(atoi(message))) == NULL)
count = itemdb->search_name_array(item_array, MAX_SEARCH, message, 0);
-
+
if (!count) {
- clif->message(fd, msg_txt(19)); // Invalid item ID or name.
+ clif->message(fd, msg_txt(19)); // Invalid item ID or name.
return false;
}
-
+
if (count > MAX_SEARCH) {
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count); // Displaying first %d out of %d matches
clif->message(fd, atcmd_output);
@@ -7135,14 +7125,14 @@ ACMD(whodrops)
item_data = item_array[i];
sprintf(atcmd_output, msg_txt(1285), item_data->jname,item_data->slot); // Item: '%s'[%d]
clif->message(fd, atcmd_output);
-
+
if (item_data->mob[0].chance == 0) {
strcpy(atcmd_output, msg_txt(1286)); // - Item is not dropped by mobs.
clif->message(fd, atcmd_output);
} else {
sprintf(atcmd_output, msg_txt(1287), MAX_SEARCH); // - Common mobs with highest drop chance (only max %d are listed):
clif->message(fd, atcmd_output);
-
+
for (j=0; j < MAX_SEARCH && item_data->mob[j].chance > 0; j++)
{
sprintf(atcmd_output, "- %s (%02.02f%%)", mob->db(item_data->mob[j].id)->jname, item_data->mob[j].chance/100.);
@@ -7158,12 +7148,12 @@ ACMD(whereis)
struct mob_db *monster, *mob_array[MAX_SEARCH];
int count;
int i, j, k;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1288)); // Please enter a monster name/ID (usage: @whereis <monster_name_or_monster_ID>).
return false;
}
-
+
// If monster identifier/name argument is a name
if ((i = mob->db_checkid(atoi(message))))
{
@@ -7171,12 +7161,12 @@ ACMD(whereis)
count = 1;
} else
count = mob->db_searchname_array(mob_array, MAX_SEARCH, message, 0);
-
+
if (!count) {
clif->message(fd, msg_txt(40)); // Invalid monster ID or name.
return false;
}
-
+
if (count > MAX_SEARCH) {
sprintf(atcmd_output, msg_txt(269), MAX_SEARCH, count);
clif->message(fd, atcmd_output);
@@ -7186,7 +7176,7 @@ ACMD(whereis)
monster = mob_array[k];
snprintf(atcmd_output, sizeof atcmd_output, msg_txt(1289), monster->jname); // %s spawns in:
clif->message(fd, atcmd_output);
-
+
for (i = 0; i < ARRAYLENGTH(monster->spawn) && monster->spawn[i].qty; i++) {
j = map->mapindex2mapid(monster->spawn[i].mapindex);
if (j < 0) continue;
@@ -7196,7 +7186,7 @@ ACMD(whereis)
if (i == 0)
clif->message(fd, msg_txt(1290)); // This monster does not spawn normally.
}
-
+
return true;
}
@@ -7214,15 +7204,15 @@ ACMD(version) {
*------------------------------------------*/
int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
{ // As it is being used [ACMD(mutearea)] there's no need to be a bool, but if there's need to reuse it, it's better to be this way
-
+
int time, id;
struct map_session_data *pl_sd = (struct map_session_data *)bl;
if (pl_sd == NULL)
return 0;
-
+
id = va_arg(ap, int);
time = va_arg(ap, int);
-
+
if (id != bl->id && !pc_get_group_level(pl_sd)) {
pl_sd->status.manner -= time;
if (pl_sd->status.manner < 0)
@@ -7235,18 +7225,18 @@ int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
ACMD(mutearea) {
int time;
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1297)); // Please enter a time in minutes (usage: @mutearea/@stfu <time in minutes>).
return false;
}
-
+
time = atoi(message);
-
+
map->foreachinarea(atcommand->mutearea_sub,sd->bl.m,
sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE,
sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_PC, sd->bl.id, time);
-
+
return true;
}
@@ -7254,9 +7244,9 @@ ACMD(mutearea) {
ACMD(rates)
{
char buf[CHAT_SIZE_MAX];
-
+
memset(buf, '\0', sizeof(buf));
-
+
snprintf(buf, CHAT_SIZE_MAX, msg_txt(1298), // Experience rates: Base %.2fx / Job %.2fx
battle_config.base_exp_rate/100., battle_config.job_exp_rate/100.);
clif->message(fd, buf);
@@ -7269,7 +7259,7 @@ ACMD(rates)
snprintf(buf, CHAT_SIZE_MAX, msg_txt(1301), // Other Drop Rates: MvP %.2fx / Card-Based %.2fx / Treasure %.2fx
battle_config.item_rate_mvp/100., battle_config.item_rate_adddrop/100., battle_config.item_rate_treasure/100.);
clif->message(fd, buf);
-
+
return true;
}
@@ -7280,25 +7270,24 @@ ACMD(rates)
ACMD(me)
{
char tempmes[CHAT_SIZE_MAX];
-
+
memset(tempmes, '\0', sizeof(tempmes));
memset(atcmd_output, '\0', sizeof(atcmd_output));
-
+
if (sd->sc.count && //no "chatting" while muted.
(sd->sc.data[SC_BERSERK] || (sd->sc.data[SC_DEEP_SLEEP] && sd->sc.data[SC_DEEP_SLEEP]->val2) ||
(sd->sc.data[SC_NOCHAT] && sd->sc.data[SC_NOCHAT]->val1&MANNER_NOCHAT)))
return false;
-
+
if (!message || !*message || sscanf(message, "%199[^\n]", tempmes) < 0) {
clif->message(fd, msg_txt(1302)); // Please enter a message (usage: @me <message>).
return false;
}
-
- sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); // *%s %s*
+
+ sprintf(atcmd_output, msg_txt(270), sd->status.name, tempmes); // *%s %s*
clif->disp_overhead(&sd->bl, atcmd_output);
-
+
return true;
-
}
/*==========================================
@@ -7308,20 +7297,20 @@ ACMD(me)
ACMD(size)
{
int size = 0;
-
+
size = cap_value(atoi(message),SZ_SMALL,SZ_BIG);
-
+
if(sd->state.size) {
sd->state.size = SZ_SMALL;
pc->setpos(sd, sd->mapindex, sd->bl.x, sd->bl.y, CLR_TELEPORT);
}
-
+
sd->state.size = size;
if( size == SZ_MEDIUM )
clif->specialeffect(&sd->bl,420,AREA);
else if( size == SZ_BIG )
clif->specialeffect(&sd->bl,422,AREA);
-
+
clif->message(fd, msg_txt(1303)); // Size change applied.
return true;
}
@@ -7331,10 +7320,10 @@ ACMD(sizeall)
int size;
struct map_session_data *pl_sd;
struct s_mapiterator* iter;
-
+
size = atoi(message);
size = cap_value(size,0,2);
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) ) {
if( pl_sd->state.size != size ) {
@@ -7342,7 +7331,7 @@ ACMD(sizeall)
pl_sd->state.size = SZ_SMALL;
pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
-
+
pl_sd->state.size = size;
if( size == SZ_MEDIUM )
clif->specialeffect(&pl_sd->bl,420,AREA);
@@ -7351,7 +7340,7 @@ ACMD(sizeall)
}
}
mapit->free(iter);
-
+
clif->message(fd, msg_txt(1303)); // Size change applied.
return true;
}
@@ -7362,28 +7351,28 @@ ACMD(sizeguild)
char guild_name[NAME_LENGTH];
struct map_session_data *pl_sd;
struct guild *g;
-
+
memset(guild_name, '\0', sizeof(guild_name));
-
+
if( !message || !*message || sscanf(message, "%d %23[^\n]", &size, guild_name) < 2 ) {
clif->message(fd, msg_txt(1304)); // Please enter guild name/ID (usage: @sizeguild <size> <guild name/ID>).
return false;
}
-
+
if( (g = guild->searchname(guild_name)) == NULL && (g = guild->search(atoi(guild_name))) == NULL ) {
clif->message(fd, msg_txt(94)); // Incorrect name/ID, or no one from the guild is online.
return false;
}
-
+
size = cap_value(size,SZ_SMALL,SZ_BIG);
-
+
for( i = 0; i < g->max_member; i++ ) {
if( (pl_sd = g->member[i].sd) && pl_sd->state.size != size ) {
if( pl_sd->state.size ) {
pl_sd->state.size = SZ_SMALL;
pc->setpos(pl_sd, pl_sd->mapindex, pl_sd->bl.x, pl_sd->bl.y, CLR_TELEPORT);
}
-
+
pl_sd->state.size = size;
if( size == SZ_MEDIUM )
clif->specialeffect(&pl_sd->bl,420,AREA);
@@ -7391,7 +7380,7 @@ ACMD(sizeguild)
clif->specialeffect(&pl_sd->bl,422,AREA);
}
}
-
+
clif->message(fd, msg_txt(1303)); // Size change applied.
return true;
}
@@ -7400,8 +7389,8 @@ ACMD(sizeguild)
* @monsterignore
* => Makes monsters ignore you. [Valaris]
*------------------------------------------*/
-ACMD(monsterignore) {
-
+ACMD(monsterignore)
+{
if (!sd->state.monster_ignore) {
sd->state.monster_ignore = 1;
clif->message(sd->fd, msg_txt(1305)); // You are now immune to attacks.
@@ -7409,15 +7398,15 @@ ACMD(monsterignore) {
sd->state.monster_ignore = 0;
clif->message(sd->fd, msg_txt(1306)); // Returned to normal state.
}
-
+
return true;
}
/*==========================================
* @fakename
* => Gives your character a fake name. [Valaris]
*------------------------------------------*/
-ACMD(fakename){
-
+ACMD(fakename)
+{
if( !message || !*message )
{
if( sd->fakename[0] )
@@ -7429,23 +7418,23 @@ ACMD(fakename){
clif->message(sd->fd, msg_txt(1307)); // Returned to real name.
return true;
}
-
+
clif->message(sd->fd, msg_txt(1308)); // You must enter a name.
return false;
}
-
+
if( strlen(message) < 2 )
{
clif->message(sd->fd, msg_txt(1309)); // Fake name must be at least two characters.
return false;
}
-
+
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;
}
@@ -7467,7 +7456,7 @@ ACMD(mapflag) {
short flag=0,i;
memset(flag_name, '\0', sizeof(flag_name));
-
+
if (!message || !*message || (sscanf(message, "%99s %hd", flag_name, &flag) < 1)) {
clif->message(sd->fd,msg_txt(1311)); // Enabled Mapflags in this map:
clif->message(sd->fd,"----------------------------------");
@@ -7490,7 +7479,7 @@ ACMD(mapflag) {
return true;
}
for (i = 0; flag_name[i]; i++) flag_name[i] = TOLOWER(flag_name[i]); //lowercase
-
+
if ( strcmp( flag_name , "gvg" ) == 0 ) {
if( flag && !map->list[sd->bl.m].flag.gvg )
map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_GVG_NAME));
@@ -7507,7 +7496,7 @@ ACMD(mapflag) {
else if ( !flag && map->list[sd->bl.m].flag.battleground )
map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone);
}
-
+
SETFLAG(autotrade); SETFLAG(allowks); SETFLAG(nomemo); SETFLAG(noteleport);
SETFLAG(noreturn); SETFLAG(monster_noteleport); SETFLAG(nosave); SETFLAG(nobranch);
SETFLAG(noexppenalty); SETFLAG(pvp); SETFLAG(pvp_noparty); SETFLAG(pvp_noguild);
@@ -7521,7 +7510,7 @@ ACMD(mapflag) {
SETFLAG(nodrop); SETFLAG(novending); SETFLAG(loadevent);
SETFLAG(nochat); SETFLAG(partylock); SETFLAG(guildlock); SETFLAG(src4instance);
SETFLAG(notomb); SETFLAG(nocashshop);
-
+
clif->message(sd->fd,msg_txt(1314)); // Invalid flag name or flag.
clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
clif->message(sd->fd,msg_txt(1315)); // Available Flags:
@@ -7533,10 +7522,9 @@ ACMD(mapflag) {
clif->message(sd->fd,"fog, fireworks, sakura, leaves, nobaseexp, nojobexp, nomobloot,");
clif->message(sd->fd,"nomvploot, nightenabled, nodrop, novending, loadevent, nochat, partylock,");
clif->message(sd->fd,"guildlock, src4instance, notomb, nocashshop");
-
#undef CHECKFLAG
#undef SETFLAG
-
+
return true;
}
@@ -7550,7 +7538,7 @@ ACMD(showexp)
clif->message(fd, msg_txt(1316)); // Gained exp will not be shown.
return true;
}
-
+
sd->state.showexp = 1;
clif->message(fd, msg_txt(1317)); // Gained exp is now shown.
return true;
@@ -7563,7 +7551,7 @@ ACMD(showzeny)
clif->message(fd, msg_txt(1318)); // Gained zeny will not be shown.
return true;
}
-
+
sd->state.showzeny = 1;
clif->message(fd, msg_txt(1319)); // Gained zeny is now shown.
return true;
@@ -7576,7 +7564,7 @@ ACMD(showdelay)
clif->message(fd, msg_txt(1320)); // Skill delay failures will not be shown.
return true;
}
-
+
sd->state.showdelay = 1;
clif->message(fd, msg_txt(1321)); // Skill delay failures are now shown.
return true;
@@ -7594,34 +7582,33 @@ ACMD(showdelay)
ACMD(invite) {
unsigned int did = sd->duel_group;
struct map_session_data *target_sd = map->nick2sd((char *)message);
-
+
if(did == 0)
{
// "Duel: @invite without @duel."
clif->message(fd, msg_txt(350));
return false;
}
-
+
if(duel->list[did].max_players_limit > 0 &&
duel->list[did].members_count >= duel->list[did].max_players_limit) {
-
// "Duel: Limit of players is reached."
clif->message(fd, msg_txt(351));
return false;
}
-
+
if(target_sd == NULL) {
// "Duel: Player not found."
clif->message(fd, msg_txt(352));
return false;
}
-
+
if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
// "Duel: Player already in duel."
clif->message(fd, msg_txt(353));
return false;
}
-
+
if(battle_config.duel_only_on_same_map && target_sd->bl.m != sd->bl.m)
{
// "Duel: You can't invite %s because he/she isn't in the same map."
@@ -7629,7 +7616,7 @@ ACMD(invite) {
clif->message(fd, atcmd_output);
return false;
}
-
+
duel->invite(did, sd, target_sd);
// "Duel: Invitation has been sent."
clif->message(fd, msg_txt(354));
@@ -7638,18 +7625,18 @@ ACMD(invite) {
ACMD(duel) {
unsigned int maxpl = 0;
-
+
if(sd->duel_group > 0) {
duel->showinfo(sd->duel_group, sd);
return true;
}
-
+
if(sd->duel_invite > 0) {
// "Duel: @duel without @reject."
clif->message(fd, msg_txt(355));
return false;
}
-
+
if(!duel->checktime(sd)) {
char output[CHAT_SIZE_MAX];
// "Duel: You can take part in duel only one time per %d minutes."
@@ -7657,7 +7644,7 @@ ACMD(duel) {
clif->message(fd, output);
return false;
}
-
+
if( message[0] ) {
if(sscanf(message, "%d", &maxpl) >= 1) {
if(maxpl < 2 || maxpl > 65535) {
@@ -7671,7 +7658,7 @@ ACMD(duel) {
if(target_sd != NULL) {
unsigned int newduel;
if((newduel = duel->create(sd, 2)) != -1) {
- if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
+ if(target_sd->duel_group > 0 || target_sd->duel_invite > 0) {
clif->message(fd, msg_txt(353)); // "Duel: Player already in duel."
return false;
}
@@ -7686,7 +7673,7 @@ ACMD(duel) {
}
} else
duel->create(sd, 0);
-
+
return true;
}
@@ -7697,7 +7684,6 @@ ACMD(leave) {
clif->message(fd, msg_txt(358));
return false;
}
-
duel->leave(sd->duel_group, sd);
clif->message(fd, msg_txt(359)); // "Duel: You left the duel."
return true;
@@ -7711,20 +7697,20 @@ ACMD(accept) {
clif->message(fd, output);
return false;
}
-
+
if(sd->duel_invite <= 0) {
// "Duel: @accept without invitation."
clif->message(fd, msg_txt(360));
return false;
}
-
+
if( duel->list[sd->duel_invite].max_players_limit > 0
&& duel->list[sd->duel_invite].members_count >= duel->list[sd->duel_invite].max_players_limit ) {
// "Duel: Limit of players is reached."
clif->message(fd, msg_txt(351));
return false;
}
-
+
duel->accept(sd->duel_invite, sd);
// "Duel: Invitation has been accepted."
clif->message(fd, msg_txt(361));
@@ -7737,7 +7723,7 @@ ACMD(reject) {
clif->message(fd, msg_txt(362));
return false;
}
-
+
duel->reject(sd->duel_invite, sd);
// "Duel: Invitation has been rejected."
clif->message(fd, msg_txt(363));
@@ -7752,12 +7738,12 @@ ACMD(cash)
char output[128];
int value;
int ret=0;
-
+
if( !message || !*message || (value = atoi(message)) == 0 ) {
clif->message(fd, msg_txt(1322)); // Please enter an amount.
return false;
}
-
+
if( !strcmpi(info->command,"cash") ) {
if( value > 0 ) {
if( (ret=pc->getcash(sd, value, 0)) >= 0){
@@ -7793,7 +7779,7 @@ ACMD(cash)
clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
}
-
+
return true;
}
@@ -7801,22 +7787,22 @@ ACMD(cash)
ACMD(clone) {
int x=0,y=0,flag=0,master=0,i=0;
struct map_session_data *pl_sd=NULL;
-
+
if (!message || !*message) {
clif->message(sd->fd,msg_txt(1323)); // You must enter a player name or ID.
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.
+ clif->message(fd, msg_txt(3)); // Character not found.
return false;
}
-
+
if(pc_get_group_level(pl_sd) > pc_get_group_level(sd)) {
- clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself.
+ clif->message(fd, msg_txt(126)); // Cannot clone a player of higher GM level than yourself.
return false;
}
-
+
if (strcmpi(info->command, "clone") == 0)
flag = 1;
else if (strcmpi(info->command, "slaveclone") == 0) {
@@ -7829,26 +7815,26 @@ ACMD(clone) {
master = sd->bl.id;
if (battle_config.atc_slave_clone_limit
&& mob->countslave(&sd->bl) >= battle_config.atc_slave_clone_limit) {
- clif->message(fd, msg_txt(127)); // You've reached your slave clones limit.
+ clif->message(fd, msg_txt(127)); // You've reached your slave clones limit.
return false;
}
}
-
+
do {
x = sd->bl.x + (rnd() % 10 - 5);
y = sd->bl.y + (rnd() % 10 - 5);
} while (map->getcell(sd->bl.m,x,y,CELL_CHKNOPASS) && i++ < 10);
-
+
if (i >= 10) {
x = sd->bl.x;
y = sd->bl.y;
}
-
+
if((x = mob->clone_spawn(pl_sd, sd->bl.m, x, y, "", master, 0, flag?1:0, 0)) > 0) {
- clif->message(fd, msg_txt(128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned.
+ clif->message(fd, msg_txt(128+flag*2)); // Evil Clone spawned. Clone spawned. Slave clone spawned.
return true;
}
- clif->message(fd, msg_txt(129+flag*2)); // Unable to spawn evil clone. Unable to spawn clone. Unable to spawn slave clone.
+ clif->message(fd, msg_txt(129+flag*2)); // Unable to spawn evil clone. Unable to spawn clone. Unable to spawn slave clone.
return false;
}
@@ -7865,7 +7851,7 @@ ACMD(noask)
clif->message(fd, msg_txt(390)); // Autorejecting is activated.
sd->state.noask = 1;
}
-
+
return true;
}
@@ -7876,14 +7862,14 @@ ACMD(noask)
ACMD(request)
{
if (!message || !*message) {
- clif->message(sd->fd,msg_txt(277)); // Usage: @request <petition/message to online GMs>.
+ clif->message(sd->fd,msg_txt(277)); // Usage: @request <petition/message to online GMs>.
return false;
}
-
- sprintf(atcmd_output, msg_txt(278), message); // (@request): %s
+
+ sprintf(atcmd_output, msg_txt(278), message); // (@request): %s
intif->wis_message_to_gm(sd->status.name, PC_PERM_RECEIVE_REQUESTS, atcmd_output);
clif_disp_onlyself(sd, atcmd_output, strlen(atcmd_output));
- clif->message(sd->fd,msg_txt(279)); // @request sent.
+ clif->message(sd->fd,msg_txt(279)); // @request sent.
return true;
}
@@ -7894,7 +7880,7 @@ ACMD(feelreset)
{
pc->resetfeel(sd);
clif->message(fd, msg_txt(1324)); // Reset 'Feeling' maps.
-
+
return true;
}
@@ -7902,14 +7888,14 @@ ACMD(feelreset)
* AUCTION SYSTEM
*------------------------------------------*/
ACMD(auction) {
-
+
if( !battle_config.feature_auction ) {
clif->colormes(sd->fd,COLOR_RED,msg_txt(1484));
return false;
}
-
+
clif->auction_openwindow(sd);
-
+
return true;
}
@@ -7947,8 +7933,8 @@ ACMD(ksprotection)
/*==========================================
* Map Kill Steal Protection Setting
*------------------------------------------*/
-ACMD(allowks) {
-
+ACMD(allowks)
+{
if( map->list[sd->bl.m].flag.allowks ) {
map->list[sd->bl.m].flag.allowks = 0;
clif->message(fd, msg_txt(1330)); // [ Map K.S Protection Active ]
@@ -7959,16 +7945,16 @@ ACMD(allowks) {
return true;
}
-ACMD(resetstat) {
-
+ACMD(resetstat)
+{
pc->resetstate(sd);
sprintf(atcmd_output, msg_txt(207), sd->status.name);
clif->message(fd, atcmd_output);
return true;
}
-ACMD(resetskill) {
-
+ACMD(resetskill)
+{
pc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(206), sd->status.name);
clif->message(fd, atcmd_output);
@@ -7987,7 +7973,7 @@ ACMD(itemlist)
const struct item* items;
int size;
StringBuf buf;
-
+
if( strcmpi(info->command, "storagelist") == 0 ) {
location = "storage";
items = sd->status.storage.items;
@@ -8002,34 +7988,34 @@ ACMD(itemlist)
size = MAX_INVENTORY;
} else
return false;
-
+
StrBuf->Init(&buf);
-
+
count = 0; // total slots occupied
counter = 0; // total items found
for( i = 0; i < size; ++i )
{
const struct item* it = &items[i];
struct item_data* itd;
-
+
if( it->nameid == 0 || (itd = itemdb->exists(it->nameid)) == NULL )
continue;
-
+
counter += it->amount;
count++;
-
+
if( count == 1 )
{
StrBuf->Printf(&buf, msg_txt(1332), location, sd->status.name); // ------ %s items list of '%s' ------
clif->message(fd, StrBuf->Value(&buf));
StrBuf->Clear(&buf);
}
-
+
if( it->refine )
StrBuf->Printf(&buf, "%d %s %+d (%s, id: %d)", it->amount, itd->jname, it->refine, itd->name, it->nameid);
else
StrBuf->Printf(&buf, "%d %s (%s, id: %d)", it->amount, itd->jname, itd->name, it->nameid);
-
+
if( it->equip ) {
char equipstr[CHAT_SIZE_MAX];
strcpy(equipstr, msg_txt(1333)); // | equipped:
@@ -8065,10 +8051,10 @@ ACMD(itemlist)
equipstr[strlen(equipstr) - 2] = '\0';
StrBuf->AppendStr(&buf, equipstr);
}
-
+
clif->message(fd, StrBuf->Value(&buf));
StrBuf->Clear(&buf);
-
+
if( it->card[0] == CARD0_PET ) {
// pet egg
if (it->card[3])
@@ -8105,22 +8091,21 @@ ACMD(itemlist)
if( counter2 > 0 )
StrBuf->AppendStr(&buf, ")");
}
-
+
if( StrBuf->Length(&buf) > 0 )
clif->message(fd, StrBuf->Value(&buf));
StrBuf->Clear(&buf);
}
-
+
if( count == 0 )
StrBuf->Printf(&buf, msg_txt(1353), location); // No item found in this player's %s.
else
StrBuf->Printf(&buf, msg_txt(1354), counter, count, location); // %d item(s) found in %d %s slots.
-
+
clif->message(fd, StrBuf->Value(&buf));
-
+
StrBuf->Destroy(&buf);
-
return true;
}
@@ -8151,10 +8136,10 @@ ACMD(stats)
{ "JobChangeLvl (3rd) - %d", 0 },
{ NULL, 0 }
};
-
+
memset(job_jobname, '\0', sizeof(job_jobname));
memset(output, '\0', sizeof(output));
-
+
//direct array initialization with variables is not standard C compliant.
output_table[0].value = sd->status.base_level;
output_table[1].format = job_jobname;
@@ -8173,17 +8158,16 @@ ACMD(stats)
output_table[13].value = sd->status.skill_point;
output_table[14].value = sd->change_level_2nd;
output_table[15].value = sd->change_level_3rd;
-
+
sprintf(job_jobname, "Job - %s %s", pc->job_name(sd->status.class_), "(level %d)");
sprintf(output, msg_txt(53), sd->status.name); // '%s' stats:
-
+
clif->message(fd, output);
-
+
for (i = 0; output_table[i].format != NULL; i++) {
sprintf(output, output_table[i].format, output_table[i].value);
clif->message(fd, output);
}
-
return true;
}
@@ -8191,13 +8175,13 @@ ACMD(delitem) {
char item_name[100];
int nameid, amount = 0, total, idx;
struct item_data* id;
-
+
if( !message || !*message || ( sscanf(message, "\"%99[^\"]\" %d", item_name, &amount) < 2 && sscanf(message, "%99s %d", item_name, &amount) < 2 ) || amount < 1 )
{
clif->message(fd, msg_txt(1355)); // Please enter an item name/ID, a quantity, and a player name (usage: #delitem <player> <item_name_or_ID> <quantity>).
return false;
}
-
+
if( ( id = itemdb->search_name(item_name) ) != NULL || ( id = itemdb->exists(atoi(item_name)) ) != NULL )
{
nameid = id->nameid;
@@ -8207,26 +8191,26 @@ ACMD(delitem) {
clif->message(fd, msg_txt(19)); // Invalid item ID or name.
return false;
}
-
+
total = amount;
-
+
// delete items
while (amount && (idx = pc->search_inventory(sd, nameid)) != INDEX_NOT_FOUND) {
int delamount = ( amount < sd->status.inventory[idx].amount ) ? amount : sd->status.inventory[idx].amount;
-
+
if( sd->inventory_data[idx]->type == IT_PETEGG && sd->status.inventory[idx].card[0] == CARD0_PET )
{// delete pet
intif->delete_petdata(MakeDWord(sd->status.inventory[idx].card[1], sd->status.inventory[idx].card[2]));
}
pc->delitem(sd, idx, delamount, 0, 0, LOG_TYPE_COMMAND);
-
+
amount-= delamount;
}
-
+
// notify target
sprintf(atcmd_output, msg_txt(113), total-amount); // %d item(s) removed by a GM.
clif->message(sd->fd, atcmd_output);
-
+
// notify source
if( amount == total )
{
@@ -8242,7 +8226,6 @@ ACMD(delitem) {
sprintf(atcmd_output, msg_txt(114), total); // %d item(s) removed from the player.
clif->message(fd, atcmd_output);
}
-
return true;
}
@@ -8251,7 +8234,7 @@ ACMD(delitem) {
*------------------------------------------*/
ACMD(font) {
int font_id;
-
+
font_id = atoi(message);
if( font_id == 0 )
{
@@ -8277,7 +8260,7 @@ ACMD(font) {
}
else
clif->message(fd, msg_txt(1361)); // Already using this font.
-
+
return true;
}
@@ -8291,15 +8274,15 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand
AtCommandInfo* cmd;
DBIterator *iter = db_iterator(atcommand->db);
int count = 0;
-
+
memset(line_buff,' ',CHATBOX_SIZE);
line_buff[CHATBOX_SIZE-1] = 0;
-
+
clif->message(fd, msg_txt(273)); // "Available commands:"
-
+
for (cmd = dbi_first(iter); dbi_exists(iter); cmd = dbi_next(iter)) {
size_t slen;
-
+
switch( type ) {
case COMMAND_CHARCOMMAND:
if( cmd->char_groups[pcg->get_idx(sd->group)] == 0 )
@@ -8312,10 +8295,9 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand
default:
continue;
}
-
-
+
slen = strlen(cmd->command);
-
+
// flush the text buffer if this command won't fit into it
if ( slen + cur - line_buff >= CHATBOX_SIZE )
{
@@ -8324,18 +8306,18 @@ void atcommand_commands_sub(struct map_session_data* sd, const int fd, AtCommand
memset(line_buff,' ',CHATBOX_SIZE);
line_buff[CHATBOX_SIZE-1] = 0;
}
-
+
memcpy(cur,cmd->command,slen);
cur += slen+(10-slen%10);
-
+
count++;
}
dbi_destroy(iter);
clif->message(fd,line_buff);
-
+
sprintf(atcmd_output, msg_txt(274), count); // "%d commands found."
clif->message(fd, atcmd_output);
-
+
return;
}
@@ -8359,12 +8341,11 @@ ACMD(charcommands)
/* for new mounts */
ACMD(cashmount)
{
-
if (pc_hasmount(sd)) {
clif->message(fd, msg_txt(1476)); // You are already mounting something else
return false;
}
-
+
clif->message(sd->fd,msg_txt(1362)); // NOTICE: If you crash with mount your LUA is outdated.
if (!sd->sc.data[SC_ALL_RIDING]) {
clif->message(sd->fd,msg_txt(1363)); // You have mounted.
@@ -8378,18 +8359,17 @@ ACMD(cashmount)
ACMD(accinfo) {
char query[NAME_LENGTH];
-
+
if (!message || !*message || strlen(message) > NAME_LENGTH ) {
clif->message(fd, msg_txt(1365)); // Usage: @accinfo/@accountinfo <account_id/char name>
clif->message(fd, msg_txt(1366)); // You may search partial name by making use of '%' in the search, ex. "@accinfo %Mario%" lists all characters whose name contains "Mario".
return false;
}
-
+
//remove const type
safestrncpy(query, message, NAME_LENGTH);
-
intif->request_accinfo( sd->fd, sd->bl.id, pc_get_group_level(sd), query );
-
+
return true;
}
@@ -8400,7 +8380,7 @@ ACMD(set) {
int toset = 0;
bool is_str = false;
size_t len;
-
+
if( !message || !*message || (toset = sscanf(message, "%31s %128[^\n]s", reg, val)) < 1 ) {
clif->message(fd, msg_txt(1367)); // Usage: @set <variable name> <value>
clif->message(fd, msg_txt(1368)); // Usage: ex. "@set PoringCharVar 50"
@@ -8408,7 +8388,7 @@ ACMD(set) {
clif->message(fd, msg_txt(1370)); // Usage: ex. "@set PoringCharVarSTR$" outputs its value, Super Duper String.
return false;
}
-
+
/* disabled variable types (they require a proper script state to function, so allowing them would crash the server) */
if( reg[0] == '.' ) {
clif->message(fd, msg_txt(1371)); // NPC variables may not be used with @set.
@@ -8417,29 +8397,26 @@ ACMD(set) {
clif->message(fd, msg_txt(1372)); // Instance variables may not be used with @set.
return false;
}
-
+
is_str = ( reg[strlen(reg) - 1] == '$' ) ? true : false;
-
+
if( ( len = strlen(val) ) > 1 ) {
if( val[0] == '"' && val[len-1] == '"') {
val[len-1] = '\0'; //Strip quotes.
memmove(val, val+1, len-1);
}
}
-
+
if( toset >= 2 ) {/* we only set the var if there is an val, otherwise we only output the value */
if( is_str )
script->set_var(sd, reg, (void*) val);
else
script->set_var(sd, reg, (void*)h64BPTRSIZE((atoi(val))));
-
}
-
+
CREATE(data, struct script_data,1);
-
-
+
if( is_str ) {// string variable
-
switch( reg[0] ) {
case '@':
data->u.str = pc->readregstr(sd, script->add_str(reg));
@@ -8457,7 +8434,6 @@ ACMD(set) {
data->u.str = pc_readglobalreg_str(sd, script->add_str(reg));
break;
}
-
if( data->u.str == NULL || data->u.str[0] == '\0' ) {// empty string
data->type = C_CONSTSTR;
data->u.str = "";
@@ -8465,9 +8441,7 @@ ACMD(set) {
data->type = C_STR;
data->u.str = aStrdup(data->u.str);
}
-
} else {// integer variable
-
data->type = C_INT;
switch( reg[0] ) {
case '@':
@@ -8486,10 +8460,8 @@ ACMD(set) {
data->u.num = pc_readglobalreg(sd, script->add_str(reg));
break;
}
-
}
-
-
+
switch( data->type ) {
case C_INT:
sprintf(atcmd_output,msg_txt(1373),reg,data->u.num); // %s value is now :%d
@@ -8504,11 +8476,9 @@ ACMD(set) {
sprintf(atcmd_output,msg_txt(1376),reg,data->type); // %s data type is not supported :%u
break;
}
-
clif->message(fd, atcmd_output);
-
+
aFree(data);
-
return true;
}
ACMD(reloadquestdb) {
@@ -8520,7 +8490,7 @@ ACMD(addperm) {
int perm_size = pcg->permission_count;
bool add = (strcmpi(info->command, "addperm") == 0) ? true : false;
int i;
-
+
if( !message || !*message ) {
sprintf(atcmd_output, msg_txt(1378),command); // Usage: %s <permission_name>
clif->message(fd, atcmd_output);
@@ -8531,9 +8501,8 @@ ACMD(addperm) {
}
return false;
}
-
+
ARR_FIND(0, perm_size, i, strcmpi(pcg->permissions[i].name, message) == 0);
-
if( i == perm_size ) {
sprintf(atcmd_output,msg_txt(1380),message); // '%s' is not a known permission.
clif->message(fd, atcmd_output);
@@ -8544,7 +8513,7 @@ ACMD(addperm) {
}
return false;
}
-
+
if( add && (sd->extra_temp_permissions&pcg->permissions[i].permission) ) {
sprintf(atcmd_output, msg_txt(1381),sd->status.name,pcg->permissions[i].name); // User '%s' already possesses the '%s' permission.
clif->message(fd, atcmd_output);
@@ -8560,28 +8529,26 @@ ACMD(addperm) {
clif->message(fd, atcmd_output);
}
}
-
return false;
}
-
+
if( add )
sd->extra_temp_permissions |= pcg->permissions[i].permission;
else
sd->extra_temp_permissions &=~ pcg->permissions[i].permission;
-
-
+
sprintf(atcmd_output, msg_txt(1384),sd->status.name); // User '%s' permissions updated successfully. The changes are temporary.
clif->message(fd, atcmd_output);
-
+
return true;
}
-ACMD(unloadnpcfile) {
-
+ACMD(unloadnpcfile)
+{
if( !message || !*message ) {
clif->message(fd, msg_txt(1385)); // Usage: @unloadnpcfile <file name>
return false;
}
-
+
if( npc->unloadfile(message) )
clif->message(fd, msg_txt(1386)); // File unloaded. Be aware that mapflags and monsters spawned directly are not removed.
else {
@@ -8596,39 +8563,39 @@ ACMD(cart) {
sd->status.skill[idx].lv = (x)?1:0; \
sd->status.skill[idx].flag = (x)?1:0; \
} while(0)
-
+
int val = atoi(message);
bool need_skill = pc->checkskill(sd, MC_PUSHCART) ? false : true;
unsigned int index = skill->get_index(MC_PUSHCART);
-
+
if( !message || !*message || val < 0 || val > MAX_CARTS ) {
sprintf(atcmd_output, msg_txt(1390),command,MAX_CARTS); // Unknown Cart (usage: %s <0-%d>).
clif->message(fd, atcmd_output);
return false;
}
-
+
if( val == 0 && !pc_iscarton(sd) ) {
clif->message(fd, msg_txt(1391)); // You do not possess a cart to be removed
return false;
}
-
+
if( need_skill ) {
MC_CART_MDFY(1,index);
}
-
+
if( pc->setcart(sd, val) ) {
if( need_skill ) {
MC_CART_MDFY(0,index);
}
return false;/* @cart failed */
}
-
+
if( need_skill ) {
MC_CART_MDFY(0,index);
}
-
+
clif->message(fd, msg_txt(1392)); // Cart Added
-
+
return true;
#undef MC_CART_MDFY
}
@@ -8636,7 +8603,7 @@ ACMD(cart) {
ACMD(join) {
struct hChSysCh *channel = NULL;
char name[HCHSYS_NAME_LENGTH], pass[HCHSYS_NAME_LENGTH];
-
+
if (!message || !*message || sscanf(message, "%19s %19s", name, pass) < 1) {
sprintf(atcmd_output, msg_txt(1399),command); // Unknown Channel (usage: %s <#channel_name>)
clif->message(fd, atcmd_output);
@@ -8658,14 +8625,13 @@ ACMD(join) {
clif->message(fd, atcmd_output);
return false;
}
-
+
if( !channel ) {
sprintf(atcmd_output, msg_txt(1400),name,command); // Unknown Channel '%s' (usage: %s <#channel_name>)
clif->message(fd, atcmd_output);
return false;
}
-
-
+
if( idb_exists(channel->users, sd->status.char_id) ) {
sprintf(atcmd_output, msg_txt(1436),name); // You're already in the '%s' channel
clif->message(fd, atcmd_output);
@@ -8680,13 +8646,13 @@ ACMD(join) {
return false;
}
}
-
+
if( channel->banned && idb_exists(channel->banned, sd->status.account_id) ) {
sprintf(atcmd_output, msg_txt(1438),name); // You cannot join the '%s' channel because you've been banned from it
clif->message(fd, atcmd_output);
return false;
}
-
+
if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) {
sprintf(atcmd_output, msg_txt(1403),name); // You're now in the '%s' channel
clif->message(fd, atcmd_output);
@@ -8703,7 +8669,7 @@ ACMD(join) {
}
}
clif->chsys_join(channel,sd);
-
+
return true;
}
/* [Ind/Hercules] */
@@ -8755,7 +8721,6 @@ static inline void atcmd_channel_help(int fd, const char *command, bool can_crea
clif->message(fd, atcmd_output);
clif->message(fd, msg_txt(1463));// - adds or removes <option name> with <option value> to <channel name> channel
}
-
}
/* [Ind/Hercules] */
ACMD(channel) {
@@ -8763,12 +8728,12 @@ ACMD(channel) {
char subcmd[HCHSYS_NAME_LENGTH], sub1[HCHSYS_NAME_LENGTH], sub2[HCHSYS_NAME_LENGTH], sub3[HCHSYS_NAME_LENGTH];
unsigned char k = 0;
sub1[0] = sub2[0] = sub3[0] = '\0';
-
+
if (!message || !*message || sscanf(message, "%19s %19s %19s %19s", subcmd, sub1, sub2, sub3) < 1) {
atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ));
return true;
}
-
+
if (strcmpi(subcmd,"create") == 0 && (hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN))) {
// sub1 = channel name; sub2 = password; sub3 = unused
if (sub1[0] != '#') {
@@ -8787,19 +8752,18 @@ ACMD(channel) {
clif->message(fd, atcmd_output);
return false;
}
-
+
CREATE( channel, struct hChSysCh, 1 );
-
clif->chsys_create(channel,sub1 + 1,sub2,0);
-
+
channel->owner = sd->status.char_id;
channel->type = hChSys_PRIVATE;
-
+
if( !( channel->opt & hChSys_OPT_ANNOUNCE_JOIN ) ) {
sprintf(atcmd_output, msg_txt(1403),sub1); // You're now in the '%s' channel
clif->message(fd, atcmd_output);
}
-
+
clif->chsys_join(channel,sd);
} else if (strcmpi(subcmd,"list") == 0) {
// sub1 = list type; sub2 = unused; sub3 = unused
@@ -8808,7 +8772,7 @@ ACMD(channel) {
for (k = 0; k < hChSys.colors_count; k++) {
unsigned short msg_len = 1;
msg_len += sprintf(mout, "[ %s list colors ] : %s",command,hChSys.colors_name[k]);
-
+
WFIFOHEAD(fd,msg_len + 12);
WFIFOW(fd,0) = 0x2C1;
WFIFOW(fd,2) = msg_len + 12;
@@ -8845,19 +8809,19 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
-
+
if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
}
-
+
if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) {
sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
clif->message(fd, atcmd_output);
return false;
}
-
+
for (k = 0; k < hChSys.colors_count; k++) {
if (strcmpi(sub2, hChSys.colors_name[k]) == 0)
break;
@@ -8905,7 +8869,7 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
-
+
for (k = 0; k < sd->channel_count; k++) {
if (strcmpi(sub1+1,sd->channels[k]->name) == 0)
break;
@@ -8915,7 +8879,7 @@ ACMD(channel) {
clif->message(fd, atcmd_output);
return false;
}
-
+
sd->gcbind = sd->channels[k];
sprintf(atcmd_output, msg_txt(1431),sub1); // Your global chat is now bound to the '%s' channel
clif->message(fd, atcmd_output);
@@ -8925,34 +8889,34 @@ ACMD(channel) {
clif->message(fd, msg_txt(1432));// Your global chat is not bound to any channel
return false;
}
-
+
sprintf(atcmd_output, msg_txt(1433),sd->gcbind->name); // Your global chat is no longer bound to the '#%s' channel
clif->message(fd, atcmd_output);
-
+
sd->gcbind = NULL;
} else if (strcmpi(subcmd,"ban") == 0) {
// sub1 = channel name; sub2 = unused; sub3 = unused
struct map_session_data *pl_sd = NULL;
struct hChSysBanEntry *entry = NULL;
char sub4[NAME_LENGTH]; ///< player name
-
+
if (sub1[0] != '#') {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
-
+
if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
}
-
+
if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) {
sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
clif->message(fd, atcmd_output);
return false;
}
-
+
if (!message || !*message || sscanf(message, "%19s %19s %23[^\n]", subcmd, sub1, sub4) < 3) {
sprintf(atcmd_output, msg_txt(1434), sub4);// Player '%s' was not found
clif->message(fd, atcmd_output);
@@ -8964,59 +8928,53 @@ ACMD(channel) {
clif->message(fd, atcmd_output);
return false;
}
-
+
if (pc_has_permission(pl_sd, PC_PERM_HCHSYS_ADMIN)) {
clif->message(fd, msg_txt(1464)); // Ban failed, not possible to ban this user.
return false;
}
-
+
if (channel->banned && idb_exists(channel->banned,pl_sd->status.account_id)) {
sprintf(atcmd_output, msg_txt(1465), pl_sd->status.name);// Player '%s' is already banned from this channel
clif->message(fd, atcmd_output);
return false;
}
-
+
if (!channel->banned)
channel->banned = idb_alloc(DB_OPT_BASE|DB_OPT_ALLOW_NULL_DATA|DB_OPT_RELEASE_DATA);
-
+
CREATE(entry, struct hChSysBanEntry, 1);
-
safestrncpy(entry->name, pl_sd->status.name, NAME_LENGTH);
-
idb_put(channel->banned, pl_sd->status.account_id, entry);
-
+
clif->chsys_left(channel,pl_sd);
-
+
sprintf(atcmd_output, msg_txt(1437),pl_sd->status.name,sub1); // Player '%s' has now been banned from '%s' channel
clif->message(fd, atcmd_output);
} else if (strcmpi(subcmd,"unban") == 0) {
// sub1 = channel name; sub2 = unused; sub3 = unused
struct map_session_data *pl_sd = NULL;
char sub4[NAME_LENGTH]; ///< player name
-
+
if (sub1[0] != '#') {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
-
if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
}
-
if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) {
sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
clif->message(fd, atcmd_output);
return false;
}
-
if (!channel->banned) {
sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players
clif->message(fd, atcmd_output);
return false;
}
-
if (!message || !*message || sscanf(message, "%19s %19s %23[^\n]", subcmd, sub1, sub4) < 3) {
sprintf(atcmd_output, msg_txt(1434), sub4);// Player '%s' was not found
clif->message(fd, atcmd_output);
@@ -9028,20 +8986,18 @@ ACMD(channel) {
clif->message(fd, atcmd_output);
return false;
}
-
if (!idb_exists(channel->banned,pl_sd->status.account_id)) {
sprintf(atcmd_output, msg_txt(1440), pl_sd->status.name);// Player '%s' is not banned from this channel
clif->message(fd, atcmd_output);
return false;
}
-
+
idb_remove(channel->banned, pl_sd->status.account_id);
-
if (!db_size(channel->banned)) {
db_destroy(channel->banned);
channel->banned = NULL;
}
-
+
sprintf(atcmd_output, msg_txt(1441),pl_sd->status.name,sub1); // Player '%s' has now been unbanned from the '%s' channel
clif->message(fd, atcmd_output);
} else if (strcmpi(subcmd,"unbanall") == 0) {
@@ -9050,28 +9006,24 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
-
if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
}
-
if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) {
sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
clif->message(fd, atcmd_output);
return false;
}
-
if (!channel->banned) {
sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players
clif->message(fd, atcmd_output);
return false;
}
-
db_destroy(channel->banned);
channel->banned = NULL;
-
+
sprintf(atcmd_output, msg_txt(1442),sub1); // Removed all bans from '%s' channel
clif->message(fd, atcmd_output);
} else if (strcmpi(subcmd,"banlist") == 0) {
@@ -9084,19 +9036,16 @@ ACMD(channel) {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
-
if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
}
-
if (channel->owner != sd->status.char_id && !isA) {
sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
clif->message(fd, atcmd_output);
return false;
}
-
if (!channel->banned) {
sprintf(atcmd_output, msg_txt(1439), sub1);// Channel '%s' has no banned players
clif->message(fd, atcmd_output);
@@ -9104,22 +9053,19 @@ ACMD(channel) {
}
sprintf(atcmd_output, msg_txt(1443), channel->name);// -- '%s' ban list
clif->message(fd, atcmd_output);
-
+
iter = db_iterator(channel->banned);
-
for (data = iter->first(iter,&key); iter->exists(iter); data = iter->next(iter,&key)) {
struct hChSysBanEntry * entry = DB->data2ptr(data);
-
+
if (!isA)
sprintf(atcmd_output, msg_txt(1444), entry->name);// - %s %s
else
sprintf(atcmd_output, msg_txt(1445), entry->name, key.i);// - %s (%d)
-
+
clif->message(fd, atcmd_output);
}
-
dbi_destroy(iter);
-
} else if (strcmpi(subcmd,"setopt") == 0) {
// sub1 = channel name; sub2 = option name; sub3 = value
const char* opt_str[3] = {
@@ -9127,34 +9073,28 @@ ACMD(channel) {
"JoinAnnounce",
"MessageDelay",
};
-
if (sub1[0] != '#') {
clif->message(fd, msg_txt(1405));// Channel name must start with a '#'
return false;
}
-
if (!(channel = strdb_get(clif->channel_db, sub1 + 1))) {
sprintf(atcmd_output, msg_txt(1407), sub1);// Channel '%s' is not available
clif->message(fd, atcmd_output);
return false;
}
-
if (channel->owner != sd->status.char_id && !pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN)) {
sprintf(atcmd_output, msg_txt(1412), sub1);// You're not the owner of channel '%s'
clif->message(fd, atcmd_output);
return false;
}
-
if (sub2[0] == '\0') {
clif->message(fd, msg_txt(1446));// You need to input a option
return false;
}
-
for (k = 1; k < 3; k++) {
if (strcmpi(sub2,opt_str[k]) == 0)
break;
}
-
if (k == 3) {
sprintf(atcmd_output, msg_txt(1447), sub2);// '%s' is not a known channel option
clif->message(fd, atcmd_output);
@@ -9165,7 +9105,6 @@ ACMD(channel) {
}
return false;
}
-
if (sub3[0] == '\0') {
if (k == hChSys_OPT_MSG_DELAY) {
sprintf(atcmd_output, msg_txt(1466), opt_str[k]);// For '%s' you need the amount of seconds (from 0 to 10)
@@ -9226,12 +9165,10 @@ ACMD(channel) {
}
}
}
-
}
} else {
atcmd_channel_help(fd,command,( hChSys.allow_user_channel_creation || pc_has_permission(sd, PC_PERM_HCHSYS_ADMIN) ));
}
-
return true;
}
/* debug only, delete after */
@@ -9243,7 +9180,7 @@ ACMD(fontcolor) {
if( !message || !*message ) {
for( k = 0; k < hChSys.colors_count; k++ ) {
msg_len += sprintf(mout, "[ %s ] : %s",command,hChSys.colors_name[k]);
-
+
WFIFOHEAD(fd,msg_len + 12);
WFIFOW(fd,0) = 0x2C1;
WFIFOW(fd,2) = msg_len + 12;
@@ -9254,12 +9191,12 @@ ACMD(fontcolor) {
}
return false;
}
-
+
if( message[0] == '0' ) {
sd->fontcolor = 0;
return true;
}
-
+
for( k = 0; k < hChSys.colors_count; k++ ) {
if( strcmpi(message,hChSys.colors_name[k]) == 0 )
break;
@@ -9269,10 +9206,10 @@ ACMD(fontcolor) {
clif->message(fd, atcmd_output);
return false;
}
-
+
sd->fontcolor = k + 1;
msg_len += sprintf(mout, "Color changed to '%s'",hChSys.colors_name[k]);
-
+
WFIFOHEAD(fd,msg_len + 12);
WFIFOW(fd,0) = 0x2C1;
WFIFOW(fd,2) = msg_len + 12;
@@ -9284,7 +9221,7 @@ ACMD(fontcolor) {
}
ACMD(searchstore){
int val = atoi(message);
-
+
switch( val ) {
case 0://EFFECTTYPE_NORMAL
case 1://EFFECTTYPE_CASH
@@ -9295,7 +9232,6 @@ ACMD(searchstore){
}
searchstore->open(sd, 99, val);
-
return true;
}
ACMD(costume){
@@ -9318,7 +9254,7 @@ ACMD(costume){
#endif
};
unsigned short k = 0, len = ARRAYLENGTH(names);
-
+
if( !message || !*message ) {
for( k = 0; k < len; k++ ) {
if( sd->sc.data[name2id[k]] ) {
@@ -9328,7 +9264,6 @@ ACMD(costume){
return true;
}
}
-
clif->message(sd->fd,msg_txt(1472));
for( k = 0; k < len; k++ ) {
sprintf(atcmd_output,msg_txt(1471),names[k]);//-- %s
@@ -9336,7 +9271,7 @@ ACMD(costume){
}
return false;
}
-
+
for( k = 0; k < len; k++ ) {
if( sd->sc.data[name2id[k]] ) {
sprintf(atcmd_output,msg_txt(1470),names[k]);// You're already with a '%s' costume, type '@costume' to remove it.
@@ -9344,7 +9279,7 @@ ACMD(costume){
return false;
}
}
-
+
for( k = 0; k < len; k++ ) {
if( strcmpi(message,names[k]) == 0 )
break;
@@ -9354,9 +9289,9 @@ ACMD(costume){
clif->message(sd->fd,atcmd_output);
return false;
}
-
+
sc_start(NULL,&sd->bl, name2id[k], 100, 0, -1);
-
+
return true;
}
/* for debugging purposes (so users can easily provide us with debug info) */
@@ -9643,17 +9578,17 @@ void atcommand_basecommands(void) {
ACMD_DEF(skdebug),
};
int i;
-
+
for( i = 0; i < ARRAYLENGTH(atcommand_base); i++ ) {
if(!atcommand->add(atcommand_base[i].command,atcommand_base[i].func,false)) { // Should not happen if atcommand_base[] array is OK
ShowDebug("atcommand_basecommands: duplicate ACMD_DEF for '%s'.\n", atcommand_base[i].command);
continue;
}
}
-
+
/* @commands from plugins */
HPM_map_atcommands();
-
+
return;
}
#undef ACMD_DEF
@@ -9669,12 +9604,12 @@ bool atcommand_add(char *name,AtCommandFunc func, bool replace) {
CREATE(cmd, AtCommandInfo, 1);
strdb_put(atcommand->db, name, cmd);
}
-
+
safestrncpy(cmd->command, name, sizeof(cmd->command));
cmd->func = func;
cmd->help = NULL;
cmd->log = true;
-
+
return true;
}
@@ -9868,7 +9803,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
if( battle_config.idletime_criteria & BCIDLE_ATCOMMAND )
sd->idletime = sockt->last_tick;
-
+
//Clearing these to be used once more.
memset(command, '\0', sizeof(command));
memset(params, '\0', sizeof(params));
@@ -9894,7 +9829,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
) {
// Check if self or character invoking; if self == character invoked, then self invoke.
bool invokeFlag = ((*atcmd_msg == atcommand->at_symbol) ? 1 : 0);
-
+
// Check if the command initiated is a character command
if (*message == atcommand->char_symbol
&& (ssd = map->nick2sd(charname)) == NULL
@@ -9904,10 +9839,10 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
clif->message(fd, output);
return true;
}
-
+
if( binding->log ) /* log only if this command should be logged [Ind/Hercules] */
logs->atcommand(sd, atcmd_msg);
-
+
npc->do_atcmd_event((invokeFlag ? sd : ssd), command, params, binding->npc_event);
return true;
}
@@ -9945,7 +9880,7 @@ bool atcommand_exec(const int fd, struct map_session_data *sd, const char *messa
}
}
}
-
+
// Check if target is valid only if confirmed that player can use command.
if (*message == atcommand->char_symbol
&& (ssd = map->nick2sd(charname)) == NULL
@@ -10047,12 +9982,12 @@ void atcommand_config_read(const char* config_filename) {
if (nolog != NULL) {
int i = 0;
int count = libconfig->setting_length(nolog);
-
+
for (i = 0; i < count; ++i) {
config_setting_t *command;
const char *commandname = NULL;
AtCommandInfo *commandinfo = NULL;
-
+
command = libconfig->setting_get_elem(nolog, i);
commandname = config_setting_name(command);
if ( !( commandinfo = atcommand->exists(commandname) ) ) {
@@ -10062,7 +9997,7 @@ void atcommand_config_read(const char* config_filename) {
commandinfo->log = false;
}
}
-
+
// Commands help
// We only check if all commands exist
help = libconfig->lookup(&atcommand_config, "help");
@@ -10091,7 +10026,7 @@ void atcommand_config_read(const char* config_filename) {
}
ShowStatus("Done reading '"CL_WHITE"%d"CL_RESET"' command aliases in '"CL_WHITE"%s"CL_RESET"'.\n", num_aliases, config_filename);
-
+
libconfig->destroy(&atcommand_config);
return;
}
@@ -10124,7 +10059,7 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command
config_setting_t *commands = commands_[i];
int result = 0;
int idx = -1;
-
+
if (group == NULL) {
ShowError("atcommand_db_load_groups: group is NULL\n");
continue;
@@ -10135,12 +10070,12 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command
ShowError("atcommand_db_load_groups: index (%d) out of bounds [0,%"PRIuS"]\n", idx, sz - 1);
continue;
}
-
+
if (pcg->has_permission(group, PC_PERM_USE_ALL_COMMANDS)) {
atcmd->at_groups[idx] = atcmd->char_groups[idx] = 1;
continue;
}
-
+
if (commands != NULL) {
config_setting_t *cmd = NULL;
@@ -10170,28 +10105,28 @@ void atcommand_db_load_groups(GroupSettings **groups, config_setting_t **command
bool atcommand_can_use(struct map_session_data *sd, const char *command) {
AtCommandInfo *info = atcommand->get_info_byname(atcommand->check_alias(command + 1));
-
+
if (info == NULL)
return false;
-
+
if ((*command == atcommand->at_symbol && info->at_groups[pcg->get_idx(sd->group)] != 0) ||
(*command == atcommand->char_symbol && info->char_groups[pcg->get_idx(sd->group)] != 0) ) {
return true;
}
-
+
return false;
}
bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtCommandType type) {
AtCommandInfo *info = atcommand->get_info_byname(atcommand->check_alias(command));
-
+
if (info == NULL)
return false;
-
+
if ((type == COMMAND_ATCOMMAND && info->at_groups[pcg->get_idx(sd->group)] != 0) ||
(type == COMMAND_CHARCOMMAND && info->char_groups[pcg->get_idx(sd->group)] != 0) ) {
return true;
}
-
+
return false;
}
bool atcommand_hp_add(char *name, AtCommandFunc func) {
@@ -10201,7 +10136,7 @@ bool atcommand_hp_add(char *name, AtCommandFunc func) {
ShowDebug("atcommand_hp_add: Commands can't be added after server is ready, skipping '%s'...\n",name);
return false;
}
-
+
return HPM_map_add_atcommand(name,func);
}
@@ -10246,7 +10181,7 @@ void do_init_atcommand(bool minimal) {
atcommand->at_symbol = '@';
atcommand->char_symbol = '#';
atcommand->binding_count = 0;
-
+
atcommand->doload();
}
@@ -10256,15 +10191,15 @@ void do_final_atcommand(void) {
void atcommand_defaults(void) {
atcommand = &atcommand_s;
-
+
atcommand->db = NULL;
atcommand->alias_db = NULL;
-
+
memset(atcommand->msg_table, 0, sizeof(atcommand->msg_table));
-
+
atcommand->init = do_init_atcommand;
atcommand->final = do_final_atcommand;
-
+
atcommand->exec = atcommand_exec;
atcommand->create = atcommand_hp_add;
atcommand->can_use = atcommand_can_use;