summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c532
1 files changed, 162 insertions, 370 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 980f61ad9..ed5852b76 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -45,6 +45,7 @@
#include "mapreg.h"
#include "quest.h"
#include "searchstore.h"
+#include "HPMmap.h"
#include <stdio.h>
#include <stdlib.h>
@@ -384,9 +385,7 @@ ACMD(mapmove) {
unsigned short mapindex;
short x = 0, y = 0;
int16 m = -1;
-
- nullpo_retr(-1, sd);
-
+
memset(map_name, '\0', sizeof(map_name));
if (!message || !*message ||
@@ -435,7 +434,6 @@ ACMD(mapmove) {
ACMD(where) {
struct map_session_data* pl_sd;
- nullpo_retr(-1, sd);
memset(atcmd_player_name, '\0', sizeof atcmd_player_name);
if (!message || !*message || sscanf(message, "%23[^\n]", atcmd_player_name) < 1) {
@@ -463,9 +461,7 @@ ACMD(where) {
*------------------------------------------*/
ACMD(jumpto) {
struct map_session_data *pl_sd = NULL;
-
- nullpo_retr(-1, sd);
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(911)); // Please enter a player name (usage: @jumpto/@warpto/@goto <char name/ID>).
return false;
@@ -504,9 +500,7 @@ ACMD(jumpto) {
ACMD(jump)
{
short x = 0, y = 0;
-
- nullpo_retr(-1, sd);
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
sscanf(message, "%hd %hd", &x, &y);
@@ -554,9 +548,7 @@ ACMD(who) {
*/
int display_type = 1;
int map_id = -1;
-
- nullpo_retr(-1, sd);
-
+
if (strstr(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;
@@ -650,9 +642,7 @@ ACMD(whogm)
char player_name[NAME_LENGTH];
struct guild *g;
struct party_data *p;
-
- nullpo_retr(-1, sd);
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(match_text, '\0', sizeof(match_text));
memset(player_name, '\0', sizeof(player_name));
@@ -726,9 +716,7 @@ ACMD(whogm)
/*==========================================
*
*------------------------------------------*/
-ACMD(save)
-{
- nullpo_retr(-1, sd);
+ACMD(save) {
pc->setsavepoint(sd, sd->mapindex, sd->bl.x, sd->bl.y);
if (sd->status.pet_id > 0 && sd->pd)
@@ -746,9 +734,7 @@ ACMD(save)
*------------------------------------------*/
ACMD(load) {
int16 m;
-
- nullpo_retr(-1, sd);
-
+
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.
@@ -771,9 +757,7 @@ ACMD(load) {
ACMD(speed)
{
int speed;
-
- nullpo_retr(-1, sd);
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message || sscanf(message, "%d", &speed) < 1) {
@@ -782,15 +766,21 @@ ACMD(speed)
return false;
}
- if (speed < 0) {
+ sd->state.permanent_speed = 0;
+
+ if (speed < 0)
sd->base_status.speed = DEFAULT_WALK_SPEED;
- sd->state.permanent_speed = 0; // Remove lock when set back to default speed.
- } else {
+ else
sd->base_status.speed = cap_value(speed, MIN_WALK_SPEED, MAX_WALK_SPEED);
- sd->state.permanent_speed = 1; // Set lock when set to non-default speed.
- }
+
status_calc_bl(&sd->bl, SCB_SPEED);
- clif->message(fd, msg_txt(8)); // Speed changed.
+
+ 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.
+
return true;
}
@@ -799,8 +789,6 @@ ACMD(speed)
*------------------------------------------*/
ACMD(storage)
{
- nullpo_retr(-1, sd);
-
if (sd->npc_id || sd->state.vending || sd->state.buyingstore || sd->state.trading || sd->state.storage_flag)
return false;
@@ -820,8 +808,6 @@ ACMD(storage)
*------------------------------------------*/
ACMD(guildstorage)
{
- nullpo_retr(-1, sd);
-
if (!sd->status.guild_id) {
clif->message(fd, msg_txt(252));
return false;
@@ -851,7 +837,6 @@ ACMD(guildstorage)
ACMD(option)
{
int param1 = 0, param2 = 0, param3 = 0;
- nullpo_retr(-1, sd);
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
@@ -883,7 +868,6 @@ ACMD(option)
*
*------------------------------------------*/
ACMD(hide) {
- nullpo_retr(-1, sd);
if (sd->sc.option & OPTION_INVISIBLE) {
sd->sc.option &= ~OPTION_INVISIBLE;
if (sd->disguise != -1 )
@@ -927,7 +911,6 @@ ACMD(jobchange)
{
int job = 0, upper = 0;
const char* text;
- nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%d %d", &job, &upper) < 1) {
int i;
@@ -989,7 +972,6 @@ ACMD(jobchange)
*------------------------------------------*/
ACMD(kill)
{
- nullpo_retr(-1, sd);
status_kill(&sd->bl);
clif->message(sd->fd, msg_txt(13)); // A pity! You've died.
if (fd != sd->fd)
@@ -1002,7 +984,6 @@ ACMD(kill)
*------------------------------------------*/
ACMD(alive)
{
- nullpo_retr(-1, sd);
if (!status->revive(&sd->bl, 100, 100)) {
clif->message(fd, msg_txt(667));
return false;
@@ -1018,7 +999,6 @@ ACMD(alive)
ACMD(kami)
{
unsigned long color=0;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -1054,7 +1034,6 @@ ACMD(kami)
ACMD(heal)
{
int hp = 0, sp = 0; // [Valaris] thanks to fov
- nullpo_retr(-1, sd);
sscanf(message, "%d %d", &hp, &sp);
@@ -1116,7 +1095,6 @@ ACMD(item)
struct item item_tmp;
struct item_data *item_data;
int get_count, i;
- nullpo_retr(-1, sd);
memset(item_name, '\0', sizeof(item_name));
@@ -1172,7 +1150,6 @@ ACMD(item2)
int item_id, number = 0;
int identify = 0, refine = 0, attr = 0;
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
- nullpo_retr(-1, sd);
memset(item_name, '\0', sizeof(item_name));
@@ -1244,7 +1221,6 @@ ACMD(item2)
ACMD(itemreset)
{
int i;
- nullpo_retr(-1, sd);
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount && sd->status.inventory[i].equip == 0) {
@@ -1262,7 +1238,7 @@ ACMD(itemreset)
ACMD(baselevelup)
{
int level=0, i=0, status_point=0;
- nullpo_retr(-1, sd);
+
level = atoi(message);
if (!message || !*message || !level) {
@@ -1322,7 +1298,6 @@ ACMD(baselevelup)
ACMD(joblevelup)
{
int level=0;
- nullpo_retr(-1, sd);
level = atoi(message);
@@ -1375,9 +1350,7 @@ ACMD(help) {
const char *command_name = NULL;
char *default_command = "help";
AtCommandInfo *tinfo = NULL;
-
- nullpo_retr(-1, sd);
-
+
if (!message || !*message) {
command_name = default_command; // If no command_name specified, display help for @help.
} else {
@@ -1461,7 +1434,6 @@ int atcommand_pvpoff_sub(struct block_list *bl,va_list ap)
}
ACMD(pvpoff) {
- nullpo_retr(-1, sd);
if (!map->list[sd->bl.m].flag.pvp) {
clif->message(fd, msg_txt(160)); // PvP is already Off.
@@ -1499,7 +1471,6 @@ int atcommand_pvpon_sub(struct block_list *bl,va_list ap)
}
ACMD(pvpon) {
- nullpo_retr(-1, sd);
if (map->list[sd->bl.m].flag.pvp) {
clif->message(fd, msg_txt(161)); // PvP is already On.
@@ -1524,7 +1495,6 @@ ACMD(pvpon) {
*
*------------------------------------------*/
ACMD(gvgoff) {
- nullpo_retr(-1, sd);
if (!map->list[sd->bl.m].flag.gvg) {
clif->message(fd, msg_txt(162)); // GvG is already Off.
@@ -1545,7 +1515,6 @@ ACMD(gvgoff) {
*
*------------------------------------------*/
ACMD(gvgon) {
- nullpo_retr(-1, sd);
if (map->list[sd->bl.m].flag.gvg) {
clif->message(fd, msg_txt(163)); // GvG is already On.
@@ -1567,7 +1536,6 @@ ACMD(gvgon) {
ACMD(model)
{
int hair_style = 0, hair_color = 0, cloth_color = 0;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -1599,7 +1567,6 @@ ACMD(model)
ACMD(dye)
{
int cloth_color = 0;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -1626,7 +1593,6 @@ ACMD(dye)
ACMD(hair_style)
{
int hair_style = 0;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -1653,7 +1619,6 @@ ACMD(hair_style)
ACMD(hair_color)
{
int hair_color = 0;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -1729,9 +1694,7 @@ ACMD(go)
{ MAP_MALAYA, 242, 211 }, // 34=Malaya Port
{ MAP_ECLAGE, 110, 39 }, // 35=Eclage
};
-
- nullpo_retr(-1, sd);
-
+
memset(map_name, '\0', sizeof(map_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -1881,7 +1844,6 @@ ACMD(monster)
int i, k, range;
short mx, my;
unsigned int size;
- nullpo_retr(-1, sd);
memset(name, '\0', sizeof(name));
memset(monster, '\0', sizeof(monster));
@@ -1988,7 +1950,6 @@ int atkillmonster_sub(struct block_list *bl, va_list ap)
ACMD(killmonster) {
int map_id, drop_flag;
char map_name[MAP_NAME_LENGTH_EXT];
- nullpo_retr(-1, sd);
memset(map_name, '\0', sizeof(map_name));
@@ -2015,7 +1976,6 @@ ACMD(refine)
{
int i,j, position = 0, refine = 0, current_position, final_refine;
int count;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -2095,7 +2055,6 @@ ACMD(produce)
int item_id, attribute = 0, star = 0;
struct item_data *item_data;
struct item tmp_item;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(item_name, '\0', sizeof(item_name));
@@ -2151,7 +2110,6 @@ ACMD(produce)
ACMD(memo)
{
int position = 0;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -2186,7 +2144,6 @@ ACMD(memo)
*------------------------------------------*/
ACMD(gat) {
int y;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -2211,7 +2168,6 @@ ACMD(gat) {
ACMD(displaystatus)
{
int i, type, flag, tick, val1 = 0, val2 = 0, val3 = 0;
- nullpo_retr(-1, sd);
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>}}}).
@@ -2283,7 +2239,6 @@ ACMD(skillpoint)
{
int point;
unsigned int new_skill_point;
- nullpo_retr(-1, sd);
if (!message || !*message || (point = atoi(message)) == 0) {
clif->message(fd, msg_txt(1011)); // Please enter a number (usage: @skpoint <number of points>).
@@ -2331,7 +2286,6 @@ ACMD(skillpoint)
ACMD(zeny)
{
int zeny=0, ret=-1;
- nullpo_retr(-1, sd);
if (!message || !*message || (zeny = atoi(message)) == 0) {
clif->message(fd, msg_txt(1012)); // Please enter an amount (usage: @zeny <amount>).
@@ -2359,7 +2313,6 @@ ACMD(param) {
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.
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -2419,7 +2372,6 @@ 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.
- nullpo_retr(-1, sd);
stats[0] = &sd->status.str;
stats[1] = &sd->status.agi;
@@ -2478,7 +2430,6 @@ ACMD(guildlevelup)
int level = 0;
short added_level;
struct guild *guild_info;
- nullpo_retr(-1, sd);
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>).
@@ -2518,7 +2469,6 @@ ACMD(makeegg)
{
struct item_data *item_data;
int id, pet_id;
- nullpo_retr(-1, sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1015)); // Please enter a monster/egg name/ID (usage: @makeegg <pet>).
@@ -2556,7 +2506,6 @@ ACMD(makeegg)
*------------------------------------------*/
ACMD(hatch)
{
- nullpo_retr(-1, sd);
if (sd->status.pet_id <= 0)
clif->sendegg(sd);
else {
@@ -2574,7 +2523,6 @@ ACMD(petfriendly)
{
int friendly;
struct pet_data *pd;
- nullpo_retr(-1, sd);
if (!message || !*message || (friendly = atoi(message)) < 0) {
clif->message(fd, msg_txt(1016)); // Please enter a valid value (usage: @petfriendly <0-1000>).
@@ -2611,7 +2559,6 @@ ACMD(pethungry)
{
int hungry;
struct pet_data *pd;
- nullpo_retr(-1, sd);
if (!message || !*message || (hungry = atoi(message)) < 0) {
clif->message(fd, msg_txt(1017)); // Please enter a valid number (usage: @pethungry <0-100>).
@@ -2645,7 +2592,6 @@ ACMD(pethungry)
ACMD(petrename)
{
struct pet_data *pd;
- nullpo_retr(-1, sd);
if (!sd->status.pet_id || !sd->pd) {
clif->message(fd, msg_txt(184)); // Sorry, but you have no pet.
return false;
@@ -2670,7 +2616,6 @@ ACMD(petrename)
ACMD(recall) {
struct map_session_data *pl_sd = NULL;
- nullpo_retr(-1, sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1018)); // Please enter a player name (usage: @recall <char name/ID>).
@@ -2712,7 +2657,6 @@ ACMD(recall) {
*------------------------------------------*/
ACMD(char_block)
{
- nullpo_retr(-1, sd);
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -2748,7 +2692,6 @@ ACMD(char_ban)
int year, month, day, hour, minute, second, value;
time_t timestamp;
struct tm *tmtime;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -2829,7 +2772,6 @@ ACMD(char_ban)
*------------------------------------------*/
ACMD(char_unblock)
{
- nullpo_retr(-1, sd);
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -2850,7 +2792,6 @@ ACMD(char_unblock)
*------------------------------------------*/
ACMD(char_unban)
{
- nullpo_retr(-1, sd);
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -2870,7 +2811,6 @@ ACMD(char_unban)
*
*------------------------------------------*/
ACMD(night) {
- nullpo_retr(-1, sd);
if (map->night_flag != 1) {
pc->map_night_timer(pc->night_timer_tid, 0, 0, 1);
@@ -2886,7 +2826,6 @@ ACMD(night) {
*
*------------------------------------------*/
ACMD(day) {
- nullpo_retr(-1, sd);
if (map->night_flag != 0) {
pc->map_day_timer(pc->day_timer_tid, 0, 0, 1);
@@ -2905,9 +2844,7 @@ ACMD(doom)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
- nullpo_retr(-1, sd);
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
@@ -2932,9 +2869,7 @@ ACMD(doommap)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
- nullpo_retr(-1, sd);
-
+
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
{
@@ -2970,9 +2905,7 @@ ACMD(raise)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
- nullpo_retr(-1, sd);
-
+
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) )
@@ -2991,9 +2924,7 @@ ACMD(raisemap)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
-
- nullpo_retr(-1, sd);
-
+
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) )
@@ -3011,7 +2942,6 @@ ACMD(raisemap)
ACMD(kick)
{
struct map_session_data *pl_sd;
- nullpo_retr(-1, sd);
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -3043,7 +2973,6 @@ ACMD(kickall)
{
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
- nullpo_retr(-1, sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
@@ -3065,7 +2994,6 @@ ACMD(kickall)
*------------------------------------------*/
ACMD(allskill)
{
- nullpo_retr(-1, sd);
pc->allskillup(sd); // all skills
sd->status.skill_point = 0; // 0 skill points
clif->updatestatus(sd, SP_SKILLPOINT); // update
@@ -3080,7 +3008,6 @@ ACMD(allskill)
ACMD(questskill)
{
uint16 skill_id, index;
- nullpo_retr(-1, sd);
if (!message || !*message || (skill_id = atoi(message)) <= 0)
{// also send a list of skills applicable to this command
@@ -3123,7 +3050,6 @@ ACMD(questskill)
ACMD(lostskill)
{
uint16 skill_id, index;
- nullpo_retr(-1, sd);
if (!message || !*message || (skill_id = atoi(message)) <= 0)
{// also send a list of skills applicable to this command
@@ -3169,7 +3095,6 @@ ACMD(spiritball)
{
int max_spiritballs;
int number;
- nullpo_retr(-1, sd);
max_spiritballs = min(ARRAYLENGTH(sd->spirit_timer), 0x7FFF);
@@ -3196,7 +3121,6 @@ ACMD(spiritball)
ACMD(party)
{
char party_name[NAME_LENGTH];
- nullpo_retr(-1, sd);
memset(party_name, '\0', sizeof(party_name));
@@ -3217,7 +3141,6 @@ ACMD(guild)
{
char guild_name[NAME_LENGTH];
int prev;
- nullpo_retr(-1, sd);
memset(guild_name, '\0', sizeof(guild_name));
@@ -3236,7 +3159,6 @@ ACMD(guild)
ACMD(breakguild)
{
- nullpo_retr(-1, sd);
if (sd->status.guild_id) { // Check if the player has a guild
struct guild *g;
@@ -3269,7 +3191,6 @@ ACMD(breakguild)
*
*------------------------------------------*/
ACMD(agitstart) {
- nullpo_retr(-1, sd);
if (map->agit_flag == 1) {
clif->message(fd, msg_txt(73)); // War of Emperium is currently in progress.
return false;
@@ -3286,7 +3207,6 @@ ACMD(agitstart) {
*
*------------------------------------------*/
ACMD(agitstart2) {
- nullpo_retr(-1, sd);
if (map->agit2_flag == 1) {
clif->message(fd, msg_txt(404)); // "War of Emperium SE is currently in progress."
return false;
@@ -3303,7 +3223,6 @@ ACMD(agitstart2) {
*
*------------------------------------------*/
ACMD(agitend) {
- nullpo_retr(-1, sd);
if (map->agit_flag == 0) {
clif->message(fd, msg_txt(75)); // War of Emperium is currently not in progress.
return false;
@@ -3320,7 +3239,6 @@ ACMD(agitend) {
*
*------------------------------------------*/
ACMD(agitend2) {
- nullpo_retr(-1, sd);
if (map->agit2_flag == 0) {
clif->message(fd, msg_txt(406)); // "War of Emperium SE is currently not in progress."
return false;
@@ -3337,8 +3255,6 @@ ACMD(agitend2) {
* @mapexit - shuts down the map server
*------------------------------------------*/
ACMD(mapexit) {
- nullpo_retr(-1, sd);
-
map->do_shutdown();
return true;
}
@@ -3351,7 +3267,6 @@ ACMD(idsearch)
char item_name[100];
unsigned int i, match;
struct item_data *item_array[MAX_SEARCH];
- nullpo_retr(-1, sd);
memset(item_name, '\0', sizeof(item_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -3387,7 +3302,6 @@ ACMD(recallall)
struct map_session_data* pl_sd;
struct s_mapiterator* iter;
int count;
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -3434,7 +3348,6 @@ ACMD(guildrecall)
int count;
char guild_name[NAME_LENGTH];
struct guild *g;
- nullpo_retr(-1, sd);
memset(guild_name, '\0', sizeof(guild_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -3492,7 +3405,6 @@ ACMD(partyrecall)
char party_name[NAME_LENGTH];
struct party_data *p;
int count;
- nullpo_retr(-1, sd);
memset(party_name, '\0', sizeof(party_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -3544,7 +3456,6 @@ ACMD(partyrecall)
*------------------------------------------*/
ACMD(reloaditemdb)
{
- nullpo_retr(-1, sd);
itemdb->reload();
clif->message(fd, msg_txt(97)); // Item database has been reloaded.
@@ -3555,7 +3466,6 @@ ACMD(reloaditemdb)
*
*------------------------------------------*/
ACMD(reloadmobdb) {
- nullpo_retr(-1, sd);
mob->reload();
pet->read_db();
homun->reload();
@@ -3572,7 +3482,6 @@ ACMD(reloadmobdb) {
*------------------------------------------*/
ACMD(reloadskilldb)
{
- nullpo_retr(-1, sd);
skill->reload();
homun->reload_skill();
elemental->reload_skilldb();
@@ -3680,7 +3589,6 @@ ACMD(reloadscript) {
struct s_mapiterator* iter;
struct map_session_data* pl_sd;
- nullpo_retr(-1, sd);
//atcommand_broadcast( fd, sd, "@broadcast", "Server is reloading scripts..." );
//atcommand_broadcast( fd, sd, "@broadcast", "You will feel a bit of lag at this point !" );
@@ -3732,9 +3640,7 @@ ACMD(mapinfo) {
int i, m_id, chat_num = 0, list = 0, vend_num = 0;
unsigned short m_index;
char mapname[24];
-
- nullpo_retr(-1, sd);
-
+
memset(atcmd_output, '\0', sizeof(atcmd_output));
memset(mapname, '\0', sizeof(mapname));
memset(direction, '\0', sizeof(direction));
@@ -3975,8 +3881,6 @@ ACMD(mapinfo) {
*------------------------------------------*/
ACMD(mount_peco)
{
- nullpo_retr(-1, sd);
-
if (sd->disguise != -1) {
clif->message(fd, msg_txt(212)); // Cannot mount while in disguise.
return false;
@@ -4040,7 +3944,6 @@ ACMD(mount_peco)
ACMD(guildspy) {
char guild_name[NAME_LENGTH];
struct guild *g;
- nullpo_retr(-1, sd);
memset(guild_name, '\0', sizeof(guild_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -4080,7 +3983,6 @@ ACMD(guildspy) {
ACMD(partyspy) {
char party_name[NAME_LENGTH];
struct party_data *p;
- nullpo_retr(-1, sd);
memset(party_name, '\0', sizeof(party_name));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -4121,7 +4023,6 @@ ACMD(partyspy) {
ACMD(repairall)
{
int count, i;
- nullpo_retr(-1, sd);
count = 0;
for (i = 0; i < MAX_INVENTORY; i++) {
@@ -4149,7 +4050,6 @@ ACMD(repairall)
*------------------------------------------*/
ACMD(nuke) {
struct map_session_data *pl_sd;
- nullpo_retr(-1, sd);
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -4180,9 +4080,7 @@ ACMD(nuke) {
ACMD(tonpc) {
char npcname[NAME_LENGTH+1];
struct npc_data *nd;
-
- nullpo_retr(-1, sd);
-
+
memset(npcname, 0, sizeof(npcname));
if (!message || !*message || sscanf(message, "%23[^\n]", npcname) < 1) {
@@ -4209,7 +4107,6 @@ ACMD(tonpc) {
ACMD(shownpc)
{
char NPCname[NAME_LENGTH+1];
- nullpo_retr(-1, sd);
memset(NPCname, '\0', sizeof(NPCname));
@@ -4235,7 +4132,6 @@ ACMD(shownpc)
ACMD(hidenpc)
{
char NPCname[NAME_LENGTH+1];
- nullpo_retr(-1, sd);
memset(NPCname, '\0', sizeof(NPCname));
@@ -4284,7 +4180,6 @@ ACMD(unloadnpc)
{
struct npc_data *nd;
char NPCname[NAME_LENGTH+1];
- nullpo_retr(-1, sd);
memset(NPCname, '\0', sizeof(NPCname));
@@ -4354,7 +4249,6 @@ 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];
- nullpo_retr(-1, sd);
memset(temp, '\0', sizeof(temp));
@@ -4372,7 +4266,8 @@ ACMD(servertime) {
} else if (battle_config.night_duration == 0) {
if (map->night_flag == 1) { // we start with night
timer_data = timer->get(pc->day_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in night for %s.
+ sprintf(temp, msg_txt(233), // Game time: The game is actually in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
clif->message(fd, temp);
clif->message(fd, msg_txt(234)); // Game time: After, the game will be in permanent daylight.
} else
@@ -4380,7 +4275,8 @@ ACMD(servertime) {
} else if (battle_config.day_duration == 0) {
if (map->night_flag == 0) { // we start with day
timer_data = timer->get(pc->night_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ sprintf(temp, msg_txt(235), // Game time: The game is actualy in daylight for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
clif->message(fd, temp);
clif->message(fd, msg_txt(236)); // Game time: After, the game will be in permanent night.
} else
@@ -4389,22 +4285,28 @@ ACMD(servertime) {
if (map->night_flag == 0) {
timer_data = timer->get(pc->night_timer_tid);
timer_data2 = timer->get(pc->day_timer_tid);
- sprintf(temp, msg_txt(235), txt_time(DIFF_TICK(timer_data->tick,timer->gettick())/1000)); // Game time: The game is actualy in daylight for %s.
+ sprintf(temp, msg_txt(235), // Game time: The game is actualy in daylight for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick())/1000)));
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick, timer_data2->tick) > 0)
- sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)); // Game time: After, the game will be in night for %s.
+ sprintf(temp, msg_txt(237), // Game time: After, the game will be in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->interval,DIFF_TICK(timer_data->tick,timer_data2->tick)) / 1000)));
else
- sprintf(temp, msg_txt(237), txt_time(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)); // Game time: After, the game will be in night for %s.
+ sprintf(temp, msg_txt(237), // Game time: After, the game will be in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data2->tick,timer_data->tick)/1000)));
clif->message(fd, temp);
} else {
timer_data = timer->get(pc->day_timer_tid);
timer_data2 = timer->get(pc->night_timer_tid);
- sprintf(temp, msg_txt(233), txt_time(DIFF_TICK(timer_data->tick,timer->gettick()) / 1000)); // Game time: The game is actualy in night for %s.
+ sprintf(temp, msg_txt(233), // Game time: The game is actualy in night for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data->tick,timer->gettick()) / 1000)));
clif->message(fd, temp);
if (DIFF_TICK(timer_data->tick,timer_data2->tick) > 0)
- sprintf(temp, msg_txt(239), txt_time((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)); // Game time: After, the game will be in daylight for %s.
+ sprintf(temp, msg_txt(239), // Game time: After, the game will be in daylight for %s.
+ txt_time((unsigned int)((timer_data->interval - DIFF_TICK(timer_data->tick, timer_data2->tick)) / 1000)));
else
- sprintf(temp, msg_txt(239), txt_time(DIFF_TICK(timer_data2->tick, timer_data->tick) / 1000)); // Game time: After, the game will be in daylight for %s.
+ sprintf(temp, msg_txt(239), // Game time: After, the game will be in daylight for %s.
+ txt_time((unsigned int)(DIFF_TICK(timer_data2->tick, timer_data->tick) / 1000)));
clif->message(fd, temp);
}
sprintf(temp, msg_txt(238), txt_time(timer_data->interval / 1000)); // Game time: A day cycle has a normal duration of %s.
@@ -4450,7 +4352,6 @@ ACMD(jail) {
struct map_session_data *pl_sd;
int x, y;
unsigned short m_index;
- nullpo_retr(-1, sd);
memset(atcmd_player_name, '\0', sizeof(atcmd_player_name));
@@ -4540,7 +4441,6 @@ ACMD(jailfor) {
char * modif_p;
int jailtime = 0,x,y;
short m_index = 0;
- nullpo_retr(-1, sd);
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>
@@ -4650,8 +4550,6 @@ ACMD(jailtime)
{
int year, month, day, hour, minute;
- nullpo_retr(-1, sd);
-
if (!sd->sc.data[SC_JAILED]) {
clif->message(fd, msg_txt(1139)); // You are not in jail.
return false;
@@ -4682,7 +4580,6 @@ ACMD(jailtime)
ACMD(disguise)
{
int id = 0;
- nullpo_retr(-1, sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1143)); // Please enter a Monster/NPC name/ID (usage: @disguise <name/ID>).
@@ -4734,7 +4631,6 @@ ACMD(disguiseall)
int mob_id=0;
struct map_session_data *pl_sd;
struct s_mapiterator* iter;
- nullpo_retr(-1, sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1145)); // Please enter a Monster/NPC name/ID (usage: @disguiseall <name/ID>).
@@ -4811,7 +4707,6 @@ ACMD(disguiseguild)
*------------------------------------------*/
ACMD(undisguise)
{
- nullpo_retr(-1, sd);
if (sd->disguise != -1) {
pc->disguise(sd, -1);
clif->message(fd, msg_txt(124)); // Undisguise applied.
@@ -4829,7 +4724,6 @@ ACMD(undisguise)
ACMD(undisguiseall) {
struct map_session_data *pl_sd;
struct s_mapiterator* iter;
- nullpo_retr(-1, sd);
iter = mapit_getallusers();
for( pl_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); pl_sd = (TBL_PC*)mapit->next(iter) )
@@ -4851,7 +4745,6 @@ ACMD(undisguiseguild)
struct map_session_data *pl_sd;
struct guild *g;
int i;
- nullpo_retr(-1, sd);
memset(guild_name, '\0', sizeof(guild_name));
@@ -4881,7 +4774,7 @@ ACMD(exp)
{
char output[CHAT_SIZE_MAX];
double nextb, nextj;
- nullpo_retr(-1, sd);
+
memset(output, '\0', sizeof(output));
nextb = pc->nextbaseexp(sd);
@@ -4903,7 +4796,6 @@ ACMD(exp)
*------------------------------------------*/
ACMD(broadcast)
{
- nullpo_retr(-1, sd);
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -4923,8 +4815,6 @@ ACMD(broadcast)
*------------------------------------------*/
ACMD(localbroadcast)
{
- nullpo_retr(-1, sd);
-
memset(atcmd_output, '\0', sizeof(atcmd_output));
if (!message || !*message) {
@@ -4946,7 +4836,6 @@ ACMD(email)
{
char actual_email[100];
char new_email[100];
- nullpo_retr(-1, sd);
memset(actual_email, '\0', sizeof(actual_email));
memset(new_email, '\0', sizeof(new_email));
@@ -4981,7 +4870,6 @@ ACMD(email)
ACMD(effect)
{
int type = 0, flag = 0;
- nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%d", &type) < 1) {
clif->message(fd, msg_txt(1152)); // Please enter an effect number (usage: @effect <effect number>).
@@ -4999,7 +4887,6 @@ ACMD(effect)
*------------------------------------------*/
ACMD(killer)
{
- nullpo_retr(-1, sd);
sd->state.killer = !sd->state.killer;
if(sd->state.killer)
@@ -5016,7 +4903,6 @@ ACMD(killer)
* enable other people killing you
*------------------------------------------*/
ACMD(killable) {
- nullpo_retr(-1, sd);
sd->state.killable = !sd->state.killable;
if(sd->state.killable)
@@ -5033,7 +4919,6 @@ ACMD(killable) {
* turn skills on for the map
*------------------------------------------*/
ACMD(skillon) {
- nullpo_retr(-1, sd);
map->list[sd->bl.m].flag.noskill = 0;
clif->message(fd, msg_txt(244));
return true;
@@ -5044,7 +4929,6 @@ ACMD(skillon) {
* Turn skills off on the map
*------------------------------------------*/
ACMD(skilloff) {
- nullpo_retr(-1, sd);
map->list[sd->bl.m].flag.noskill = 1;
clif->message(fd, msg_txt(243));
return true;
@@ -5057,7 +4941,7 @@ ACMD(skilloff) {
ACMD(npcmove) {
int x = 0, y = 0, m;
struct npc_data *nd = 0;
- nullpo_retr(-1, sd);
+
memset(atcmd_player_name, '\0', sizeof atcmd_player_name);
if (!message || !*message || sscanf(message, "%d %d %23[^\n]", &x, &y, atcmd_player_name) < 3) {
@@ -5096,7 +4980,6 @@ ACMD(addwarp)
unsigned short m;
struct npc_data* nd;
- nullpo_retr(-1, sd);
memset(warpname, '\0', sizeof(warpname));
if (!message || !*message || sscanf(message, "%31s %d %d %23[^\n]", mapname, &x, &y, warpname) < 4) {
@@ -5127,7 +5010,6 @@ ACMD(addwarp)
*------------------------------------------*/
ACMD(follow) {
struct map_session_data *pl_sd = NULL;
- nullpo_retr(-1, sd);
if (!message || !*message) {
if (sd->followtarget == -1)
@@ -5163,7 +5045,7 @@ ACMD(follow) {
ACMD(dropall)
{
int i;
- nullpo_retr(-1, sd);
+
for (i = 0; i < MAX_INVENTORY; i++) {
if (sd->status.inventory[i].amount) {
if(sd->status.inventory[i].equip != 0)
@@ -5181,7 +5063,6 @@ ACMD(dropall)
ACMD(storeall)
{
int i;
- nullpo_retr(-1, sd);
if (sd->state.storage_flag != 1)
{ //Open storage.
@@ -5207,7 +5088,6 @@ ACMD(storeall)
ACMD(clearstorage)
{
int i, j;
- nullpo_retr(-1, sd);
if (sd->state.storage_flag == 1) {
clif->message(fd, msg_txt(250));
@@ -5229,7 +5109,6 @@ ACMD(cleargstorage)
int i, j;
struct guild *g;
struct guild_storage *guild_storage;
- nullpo_retr(-1, sd);
g = sd->guild;
@@ -5268,7 +5147,6 @@ ACMD(cleargstorage)
ACMD(clearcart)
{
int i;
- nullpo_retr(-1, sd);
if (pc_iscarton(sd) == 0) {
clif->message(fd, msg_txt(1396)); // You do not have a cart to be cleaned.
@@ -5302,9 +5180,7 @@ ACMD(skillid) {
DBKey key;
DBData *data;
char partials[MAX_SKILLID_PARTIAL_RESULTS][MAX_SKILLID_PARTIAL_RESULTS_LEN];
-
- nullpo_retr(-1, sd);
-
+
if (!message || !*message) {
clif->message(fd, msg_txt(1163)); // Please enter a skill name to look up (usage: @skillid <skill name>).
return false;
@@ -5348,7 +5224,6 @@ ACMD(useskill) {
uint16 skill_id;
uint16 skill_lv;
char target[100];
- nullpo_retr(-1, sd);
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>
@@ -5389,10 +5264,9 @@ ACMD(useskill) {
*------------------------------------------*/
ACMD(displayskill) {
struct status_data *st;
- unsigned int tick;
+ int64 tick;
uint16 skill_id;
uint16 skill_lv = 1;
- nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%hu %hu", &skill_id, &skill_lv) < 1) {
clif->message(fd, msg_txt(1166)); // Usage: @displayskill <skill ID> {<skill level>}
@@ -5416,7 +5290,6 @@ ACMD(skilltree) {
int meets, j, c=0;
char target[NAME_LENGTH];
struct skill_tree_entry *ent;
- nullpo_retr(-1, sd);
if(!message || !*message || sscanf(message, "%hu %23[^\r\n]", &skill_id, target) != 2) {
clif->message(fd, msg_txt(1167)); // Usage: @skilltree <skill ID> <target>
@@ -5486,9 +5359,7 @@ void getring(struct map_session_data* sd) {
ACMD(marry) {
struct map_session_data *pl_sd = NULL;
char player_name[NAME_LENGTH] = "";
-
- nullpo_retr(-1, sd);
-
+
if (!message || !*message || sscanf(message, "%23s", player_name) != 1) {
clif->message(fd, msg_txt(1172)); // Usage: @marry <char name>
return false;
@@ -5517,8 +5388,6 @@ ACMD(marry) {
*------------------------------------------*/
ACMD(divorce)
{
- nullpo_retr(-1, sd);
-
if (pc->divorce(sd) != 0) {
sprintf(atcmd_output, msg_txt(1175), sd->status.name); // '%s' is not married.
clif->message(fd, atcmd_output);
@@ -5561,7 +5430,6 @@ ACMD(changelook)
* Turns on/off Autotrade for a specific player
*------------------------------------------*/
ACMD(autotrade) {
- nullpo_retr(-1, sd);
if( map->list[sd->bl.m].flag.autotrade != battle_config.autotrade_mapflag ) {
clif->message(fd, msg_txt(1179)); // Autotrade is not allowed on this map.
@@ -5598,7 +5466,6 @@ ACMD(autotrade) {
ACMD(changegm) {
struct guild *g;
struct map_session_data *pl_sd;
- nullpo_retr(-1, 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.
@@ -5629,7 +5496,6 @@ ACMD(changegm) {
* Changes the leader of a party.
*------------------------------------------*/
ACMD(changeleader) {
- nullpo_retr(-1, sd);
if( !message[0] ) {
clif->message(fd, msg_txt(1185)); // Usage: @changeleader <party_member_name>
@@ -5650,7 +5516,6 @@ ACMD(partyoption)
struct party_data *p;
int mi, option;
char w1[16], w2[16];
- nullpo_retr(-1, sd);
if (sd->status.party_id == 0 || (p = party->search(sd->status.party_id)) == NULL)
{
@@ -5692,7 +5557,7 @@ ACMD(partyoption)
ACMD(autoloot)
{
int rate;
- nullpo_retr(-1, sd);
+
// autoloot command without value
if(!message || !*message)
{
@@ -5819,25 +5684,25 @@ ACMD(autolootitem)
* Credits:
* chriser,Aleos
*------------------------------------------*/
-ACMD(autoloottype){
+ACMD(autoloottype) {
int i;
uint8 action = 3; // 1=add, 2=remove, 3=help+list (default), 4=reset
enum item_types type = -1;
int ITEM_NONE = 0;
-
+
if (message && *message) {
if (message[0] == '+') {
message++;
action = 1;
- }
- else if (message[0] == '-') {
+ } else if (message[0] == '-') {
message++;
action = 2;
- }
- else if (!strcmp(message,"reset"))
+ } else if (strcmp(message,"reset") == 0) {
action = 4;
+ }
- if (action < 3) { // add or remove
+ if (action < 3) {
+ // add or remove
if (strncmp(message, "healing", 3) == 0)
type = IT_HEALING;
else if (strncmp(message, "usable", 3) == 0)
@@ -5883,16 +5748,21 @@ ACMD(autoloottype){
clif->message(fd, atcmd_output);
break;
case 3:
- clif->message(fd, msg_txt(1495)); // To add an item type to the list, use "@aloottype +<type name>". To remove an item type, use "@aloottype -<type name>".
- clif->message(fd, msg_txt(1496)); // Type List: healing, usable, etc, weapon, armor, card, petegg, petarmor, ammo
- clif->message(fd, msg_txt(1497)); // "@aloottype reset" will clear your autoloottype list.
- if (sd->state.autoloottype == ITEM_NONE)
- clif->message(fd, msg_txt(1498)); // Your autoloottype list is empty.
- else {
- clif->message(fd, msg_txt(1499)); // Item types on your autoloottype list:
- for(i=0; i < IT_MAX; i++){
+ clif->message(fd, msg_txt(38)); // Invalid location number, or name.
+
+ {
+ // attempt to find the text help string
+ const char *text = atcommand_help_string(info);
+ if (text) clif->messageln(fd, text); // send the text to the client
+ }
+
+ if (sd->state.autoloottype == ITEM_NONE) {
+ clif->message(fd, msg_txt(1495)); // Your autoloottype list is empty.
+ } else {
+ clif->message(fd, msg_txt(1496)); // Item types on your autoloottype list:
+ for(i=0; i < IT_MAX; i++) {
if (sd->state.autoloottype&(1<<i)) {
- sprintf(atcmd_output, " '%s'", itemdb->typename(i));
+ sprintf(atcmd_output, " '%s'", itemdb->typename(i));
clif->message(fd, atcmd_output);
}
}
@@ -5900,37 +5770,17 @@ ACMD(autoloottype){
break;
case 4:
sd->state.autoloottype = ITEM_NONE;
- clif->message(fd, msg_txt(1500)); // Your autoloottype list has been reset.
+ clif->message(fd, msg_txt(1497)); // Your autoloottype list has been reset.
break;
}
- return 0;
+ return true;
}
-/**
- * No longer available, keeping here just in case it's back someday. [Ind]
- **/
-/*==========================================
- * It is made to rain.
- *------------------------------------------*/
-//ACMD(rain) {
-// nullpo_retr(-1, sd);
-// if (map->list[sd->bl.m].flag.rain) {
-// map->list[sd->bl.m].flag.rain=0;
-// clif->weather(sd->bl.m);
-// clif->message(fd, msg_txt(1201)); // The rain has stopped.
-// } else {
-// map->list[sd->bl.m].flag.rain=1;
-// clif->weather(sd->bl.m);
-// clif->message(fd, msg_txt(1202)); // It has started to rain.
-// }
-// return true;
-//}
-
/*==========================================
* It is made to snow.
*------------------------------------------*/
ACMD(snow) {
- nullpo_retr(-1, sd);
+
if (map->list[sd->bl.m].flag.snow) {
map->list[sd->bl.m].flag.snow=0;
clif->weather(sd->bl.m);
@@ -5948,7 +5798,7 @@ ACMD(snow) {
* Cherry tree snowstorm is made to fall. (Sakura)
*------------------------------------------*/
ACMD(sakura) {
- nullpo_retr(-1, sd);
+
if (map->list[sd->bl.m].flag.sakura) {
map->list[sd->bl.m].flag.sakura=0;
clif->weather(sd->bl.m);
@@ -5965,7 +5815,7 @@ ACMD(sakura) {
* Clouds appear.
*------------------------------------------*/
ACMD(clouds) {
- nullpo_retr(-1, sd);
+
if (map->list[sd->bl.m].flag.clouds) {
map->list[sd->bl.m].flag.clouds=0;
clif->weather(sd->bl.m);
@@ -5983,7 +5833,7 @@ ACMD(clouds) {
* Different type of clouds using effect 516
*------------------------------------------*/
ACMD(clouds2) {
- nullpo_retr(-1, sd);
+
if (map->list[sd->bl.m].flag.clouds2) {
map->list[sd->bl.m].flag.clouds2=0;
clif->weather(sd->bl.m);
@@ -6001,7 +5851,7 @@ ACMD(clouds2) {
* Fog hangs over.
*------------------------------------------*/
ACMD(fog) {
- nullpo_retr(-1, sd);
+
if (map->list[sd->bl.m].flag.fog) {
map->list[sd->bl.m].flag.fog=0;
clif->weather(sd->bl.m);
@@ -6018,7 +5868,7 @@ ACMD(fog) {
* Fallen leaves fall.
*------------------------------------------*/
ACMD(leaves) {
- nullpo_retr(-1, sd);
+
if (map->list[sd->bl.m].flag.leaves) {
map->list[sd->bl.m].flag.leaves=0;
clif->weather(sd->bl.m);
@@ -6036,7 +5886,7 @@ ACMD(leaves) {
* Fireworks appear.
*------------------------------------------*/
ACMD(fireworks) {
- nullpo_retr(-1, sd);
+
if (map->list[sd->bl.m].flag.fireworks) {
map->list[sd->bl.m].flag.fireworks=0;
clif->weather(sd->bl.m);
@@ -6054,11 +5904,7 @@ ACMD(fireworks) {
* Clearing Weather Effects by Dexity
*------------------------------------------*/
ACMD(clearweather) {
- nullpo_retr(-1, sd);
- /**
- * No longer available, keeping here just in case it's back someday. [Ind]
- **/
- //map->list[sd->bl.m].flag.rain=0;
+
map->list[sd->bl.m].flag.snow=0;
map->list[sd->bl.m].flag.sakura=0;
map->list[sd->bl.m].flag.clouds=0;
@@ -6103,9 +5949,7 @@ ACMD(mobsearch)
int mob_id;
int number = 0;
struct s_mapiterator* it;
-
- nullpo_retr(-1, sd);
-
+
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;
@@ -6228,9 +6072,7 @@ ACMD(pettalk)
{
char mes[100],temp[100];
struct pet_data *pd;
-
- nullpo_retr(-1, sd);
-
+
if ( battle_config.min_chat_delay ) {
if( DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0 )
return true;
@@ -6355,9 +6197,7 @@ ACMD(summon)
int mob_id = 0;
int duration = 0;
struct mob_data *md;
- unsigned int tick=timer->gettick();
-
- nullpo_retr(-1, sd);
+ int64 tick=timer->gettick();
if (!message || !*message || sscanf(message, "%23s %d", name, &duration) < 1)
{
@@ -6403,7 +6243,6 @@ ACMD(summon)
ACMD(adjgroup)
{
int new_group = 0;
- nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%d", &new_group) != 1) {
clif->message(fd, msg_txt(1226)); // Usage: @adjgroup <group_id>
@@ -6426,7 +6265,6 @@ ACMD(adjgroup)
*------------------------------------------*/
ACMD(trade) {
struct map_session_data *pl_sd = NULL;
- nullpo_retr(-1, sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1230)); // Please enter a player name (usage: @trade <char name>).
@@ -6449,7 +6287,6 @@ ACMD(trade) {
ACMD(setbattleflag)
{
char flag[128], value[128];
- nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%127s %127s", flag, value) != 2) {
clif->message(fd, msg_txt(1231)); // Usage: @setbattleflag <flag> <value>
@@ -6471,7 +6308,6 @@ ACMD(setbattleflag)
*------------------------------------------*/
ACMD(unmute) {
struct map_session_data *pl_sd = NULL;
- nullpo_retr(-1, sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1234)); // Please enter a player name (usage: @unmute <char name>).
@@ -6503,7 +6339,6 @@ ACMD(uptime)
{
unsigned long seconds = 0, day = 24*60*60, hour = 60*60,
minute = 60, days = 0, hours = 0, minutes = 0;
- nullpo_retr(-1, sd);
seconds = timer->get_uptime();
days = seconds/day;
@@ -6526,7 +6361,7 @@ ACMD(uptime)
ACMD(changesex)
{
int i;
- nullpo_retr(-1, sd);
+
pc->resetskill(sd,4);
// to avoid any problem with equipment and invalid sex, equipment is unequiped.
for( i=0; i<EQI_MAX; i++ )
@@ -6541,7 +6376,6 @@ ACMD(changesex)
ACMD(mute) {
struct map_session_data *pl_sd = NULL;
int manner;
- nullpo_retr(-1, sd);
if (!message || !*message || sscanf(message, "%d %23[^\n]", &manner, atcmd_player_name) < 1) {
clif->message(fd, msg_txt(1237)); // Usage: @mute <time> <char name>
@@ -6580,7 +6414,6 @@ ACMD(mute) {
*------------------------------------------*/
ACMD(refresh)
{
- nullpo_retr(-1, sd);
clif->refresh(sd);
return true;
}
@@ -6589,7 +6422,6 @@ ACMD(refreshall)
{
struct map_session_data* iter_sd;
struct s_mapiterator* iter;
- nullpo_retr(-1, sd);
iter = mapit_getallusers();
for (iter_sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); iter_sd = (TBL_PC*)mapit->next(iter))
@@ -6605,9 +6437,7 @@ ACMD(refreshall)
ACMD(identify)
{
int i,num;
-
- nullpo_retr(-1, sd);
-
+
for(i=num=0;i<MAX_INVENTORY;i++){
if(sd->status.inventory[i].nameid > 0 && sd->status.inventory[i].identify!=1){
num++;
@@ -6623,7 +6453,7 @@ ACMD(identify)
ACMD(misceffect) {
int effect = 0;
- nullpo_retr(-1, sd);
+
if (!message || !*message)
return false;
if (sscanf(message, "%d", &effect) < 1)
@@ -6638,7 +6468,6 @@ ACMD(misceffect) {
*------------------------------------------*/
ACMD(mail)
{
- nullpo_ret(sd);
mail->openmail(sd);
return true;
}
@@ -6796,9 +6625,7 @@ ACMD(showmobs)
int mob_id;
int number = 0;
struct s_mapiterator* it;
-
- nullpo_retr(-1, sd);
-
+
if(sscanf(message, "%99[^\n]", mob_name) < 0)
return false;
@@ -6854,8 +6681,6 @@ ACMD(homlevel) {
TBL_HOM * hd;
int level = 0;
enum homun_type htype;
-
- nullpo_retr(-1, sd);
if( !message || !*message || ( level = atoi(message) ) < 1 ) {
clif->message(fd, msg_txt(1253)); // Please enter a level adjustment (usage: @homlevel <number of levels>).
@@ -6911,8 +6736,6 @@ ACMD(homlevel) {
*------------------------------------------*/
ACMD(homevolution)
{
- nullpo_retr(-1, sd);
-
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
@@ -6929,7 +6752,6 @@ ACMD(homevolution)
ACMD(hommutate) {
int homun_id;
enum homun_type m_class, m_id;
- nullpo_retr(-1, sd);
if( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
@@ -6958,7 +6780,6 @@ ACMD(hommutate) {
*------------------------------------------*/
ACMD(makehomun) {
int homunid;
- nullpo_retr(-1, sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1256)); // Please enter a homunculus ID (usage: @makehomun <homunculus id>).
@@ -6996,9 +6817,7 @@ ACMD(makehomun) {
ACMD(homfriendly)
{
int friendly = 0;
-
- nullpo_retr(-1, sd);
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
@@ -7023,9 +6842,7 @@ ACMD(homfriendly)
ACMD(homhungry)
{
int hungry = 0;
-
- nullpo_retr(-1, sd);
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
@@ -7050,9 +6867,7 @@ ACMD(homhungry)
ACMD(homtalk)
{
char mes[100],temp[100];
-
- nullpo_retr(-1, sd);
-
+
if ( battle_config.min_chat_delay ) {
if( DIFF_TICK(sd->cantalk_tick, timer->gettick()) > 0 )
return true;
@@ -7086,7 +6901,6 @@ ACMD(homtalk)
ACMD(hominfo) {
struct homun_data *hd;
struct status_data *st;
- nullpo_retr(-1, sd);
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
@@ -7124,9 +6938,7 @@ ACMD(homstats)
struct s_homunculus_db *db;
struct s_homunculus *hom;
int lv, min, max, evo;
-
- nullpo_retr(-1, sd);
-
+
if ( !homun_alive(sd->hd) ) {
clif->message(fd, msg_txt(1254)); // You do not have a homunculus.
return false;
@@ -7188,7 +7000,6 @@ ACMD(homstats)
}
ACMD(homshuffle) {
- nullpo_retr(-1, sd);
if(!sd->hd)
return false; // nothing to do
@@ -7389,7 +7200,6 @@ int atcommand_mutearea_sub(struct block_list *bl,va_list ap)
ACMD(mutearea) {
int time;
- nullpo_ret(sd);
if (!message || !*message) {
clif->message(fd, msg_txt(1297)); // Please enter a time in minutes (usage: @mutearea/@stfu <time in minutes>).
@@ -7410,7 +7220,6 @@ ACMD(rates)
{
char buf[CHAT_SIZE_MAX];
- nullpo_ret(sd);
memset(buf, '\0', sizeof(buf));
snprintf(buf, CHAT_SIZE_MAX, msg_txt(1298), // Experience rates: Base %.2fx / Job %.2fx
@@ -7436,7 +7245,6 @@ ACMD(rates)
ACMD(me)
{
char tempmes[CHAT_SIZE_MAX];
- nullpo_retr(-1, sd);
memset(tempmes, '\0', sizeof(tempmes));
memset(atcmd_output, '\0', sizeof(atcmd_output));
@@ -7465,7 +7273,6 @@ ACMD(me)
ACMD(size)
{
int size = 0;
- nullpo_retr(-1, sd);
size = cap_value(atoi(message),SZ_SMALL,SZ_BIG);
@@ -7520,7 +7327,6 @@ ACMD(sizeguild)
char guild_name[NAME_LENGTH];
struct map_session_data *pl_sd;
struct guild *g;
- nullpo_retr(-1, sd);
memset(guild_name, '\0', sizeof(guild_name));
@@ -7559,9 +7365,7 @@ ACMD(sizeguild)
* @monsterignore
* => Makes monsters ignore you. [Valaris]
*------------------------------------------*/
-ACMD(monsterignore)
-{
- nullpo_retr(-1, sd);
+ACMD(monsterignore) {
if (!sd->state.monster_ignore) {
sd->state.monster_ignore = 1;
@@ -7577,9 +7381,7 @@ ACMD(monsterignore)
* @fakename
* => Gives your character a fake name. [Valaris]
*------------------------------------------*/
-ACMD(fakename)
-{
- nullpo_retr(-1, sd);
+ACMD(fakename){
if( !message || !*message )
{
@@ -7624,7 +7426,7 @@ ACMD(mapflag) {
char flag_name[100];
short flag=0,i;
- nullpo_retr(-1, sd);
+
memset(flag_name, '\0', sizeof(flag_name));
if (!message || !*message || (sscanf(message, "%99s %hd", flag_name, &flag) < 1)) {
@@ -7642,7 +7444,7 @@ ACMD(mapflag) {
CHECKFLAG(nojobexp); CHECKFLAG(nomobloot); CHECKFLAG(nomvploot); CHECKFLAG(nightenabled);
CHECKFLAG(nodrop); CHECKFLAG(novending); CHECKFLAG(loadevent);
CHECKFLAG(nochat); CHECKFLAG(partylock); CHECKFLAG(guildlock); CHECKFLAG(src4instance);
- CHECKFLAG(notomb);
+ CHECKFLAG(notomb); CHECKFLAG(nocashshop);
clif->message(sd->fd," ");
clif->message(sd->fd,msg_txt(1312)); // Usage: "@mapflag monster_noteleport 1" (0=Off | 1=On)
clif->message(sd->fd,msg_txt(1313)); // Type "@mapflag available" to list the available mapflags.
@@ -7679,7 +7481,7 @@ ACMD(mapflag) {
SETFLAG(nojobexp); SETFLAG(nomobloot); SETFLAG(nomvploot); SETFLAG(nightenabled);
SETFLAG(nodrop); SETFLAG(novending); SETFLAG(loadevent);
SETFLAG(nochat); SETFLAG(partylock); SETFLAG(guildlock); SETFLAG(src4instance);
- SETFLAG(notomb);
+ 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)
@@ -7691,7 +7493,7 @@ ACMD(mapflag) {
clif->message(sd->fd,"nozenypenalty, notrade, noskill, nowarp, nowarpto, noicewall, snow, clouds, clouds2,");
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");
+ clif->message(sd->fd,"guildlock, src4instance, notomb, nocashshop");
#undef CHECKFLAG
#undef SETFLAG
@@ -7909,43 +7711,45 @@ ACMD(cash)
char output[128];
int value;
int ret=0;
- nullpo_retr(-1, sd);
if( !message || !*message || (value = atoi(message)) == 0 ) {
clif->message(fd, msg_txt(1322)); // Please enter an amount.
return false;
}
- if( !strcmpi(command+1,"cash") )
- {
+ if( !strcmpi(command+1,"cash") ) {
if( value > 0 ) {
if( (ret=pc->getcash(sd, value, 0)) >= 0){
- sprintf(output, msg_txt(505), ret, sd->cashPoints);
- clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
+ // If this option is set, the message is already sent by pc function
+ if( !battle_config.cashshop_show_points ){
+ sprintf(output, msg_txt(505), ret, sd->cashPoints);
+ clif->disp_onlyself(sd, output, strlen(output));
+ }
+ } else
+ clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
if( (ret=pc->paycash(sd, -value, 0)) >= 0){
sprintf(output, msg_txt(410), ret, sd->cashPoints);
clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
+ } else
+ clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
- }
- else
- { // @points
+ } else { // @points
if( value > 0 ) {
- if( (ret=pc->getcash(sd, 0, value)) >= 0){
- sprintf(output, msg_txt(506), ret, sd->kafraPoints);
- clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
+ if( (ret=pc->getcash(sd, 0, value)) >= 0) {
+ // If this option is set, the message is already sent by pc function
+ if( !battle_config.cashshop_show_points ){
+ sprintf(output, msg_txt(506), ret, sd->kafraPoints);
+ clif->disp_onlyself(sd, output, strlen(output));
+ }
+ } else
+ clif->message(fd, msg_txt(149)); // Unable to decrease the number/value.
} else {
if( (ret=pc->paycash(sd, -value, -value)) >= 0){
sprintf(output, msg_txt(411), ret, sd->kafraPoints);
clif->disp_onlyself(sd, output, strlen(output));
- }
- else clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
+ } else
+ clif->message(fd, msg_txt(41)); // Unable to decrease the number/value.
}
}
@@ -8056,7 +7860,6 @@ ACMD(feelreset)
* AUCTION SYSTEM
*------------------------------------------*/
ACMD(auction) {
- nullpo_ret(sd);
if( !battle_config.feature_auction ) {
clif->colormes(sd->fd,COLOR_RED,msg_txt(1484));
@@ -8073,8 +7876,6 @@ ACMD(auction) {
*------------------------------------------*/
ACMD(ksprotection)
{
- nullpo_retr(-1,sd);
-
if( sd->state.noks ) {
sd->state.noks = 0;
clif->message(fd, msg_txt(1325)); // [ K.S Protection Inactive ]
@@ -8105,7 +7906,6 @@ ACMD(ksprotection)
* Map Kill Steal Protection Setting
*------------------------------------------*/
ACMD(allowks) {
- nullpo_retr(-1,sd);
if( map->list[sd->bl.m].flag.allowks ) {
map->list[sd->bl.m].flag.allowks = 0;
@@ -8117,9 +7917,7 @@ ACMD(allowks) {
return true;
}
-ACMD(resetstat)
-{
- nullpo_retr(-1, sd);
+ACMD(resetstat) {
pc->resetstate(sd);
sprintf(atcmd_output, msg_txt(207), sd->status.name);
@@ -8127,9 +7925,7 @@ ACMD(resetstat)
return true;
}
-ACMD(resetskill)
-{
- nullpo_retr(-1,sd);
+ACMD(resetskill) {
pc->resetskill(sd,1);
sprintf(atcmd_output, msg_txt(206), sd->status.name);
@@ -8149,9 +7945,7 @@ ACMD(itemlist)
const struct item* items;
int size;
StringBuf buf;
-
- nullpo_retr(-1, sd);
-
+
if( strcmp(command+1, "storagelist") == 0 ) {
location = "storage";
items = sd->status.storage.items;
@@ -8351,14 +8145,11 @@ ACMD(stats)
return true;
}
-ACMD(delitem)
-{
+ACMD(delitem) {
char item_name[100];
int nameid, amount = 0, total, idx;
struct item_data* id;
-
- nullpo_retr(-1, sd);
-
+
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>).
@@ -8417,17 +8208,15 @@ ACMD(delitem)
/*==========================================
* Custom Fonts
*------------------------------------------*/
-ACMD(font)
-{
+ACMD(font) {
int font_id;
- nullpo_retr(-1,sd);
font_id = atoi(message);
if( font_id == 0 )
{
- if( sd->user_font )
+ if( sd->status.font )
{
- sd->user_font = 0;
+ sd->status.font = 0;
clif->message(fd, msg_txt(1356)); // Returning to normal font.
clif->font(sd);
}
@@ -8439,9 +8228,9 @@ ACMD(font)
}
else if( font_id < 0 || font_id > 9 )
clif->message(fd, msg_txt(1359)); // Invalid font. Use a value from 0 to 9.
- else if( font_id != sd->user_font )
+ else if( font_id != sd->status.font )
{
- sd->user_font = font_id;
+ sd->status.font = font_id;
clif->font(sd);
clif->message(fd, msg_txt(1360)); // Font changed.
}
@@ -9772,24 +9561,39 @@ void atcommand_basecommands(void) {
ACMD_DEF(costume),
ACMD_DEF(skdebug),
};
- AtCommandInfo* cmd;
int i;
for( i = 0; i < ARRAYLENGTH(atcommand_base); i++ ) {
- if(atcommand->exists(atcommand_base[i].command)) { // Should not happen if atcommand_base[] array is OK
+ if(!atcommand->add(atcommand_base[i].command,atcommand_base[i].func)) { // Should not happen if atcommand_base[] array is OK
ShowDebug("atcommand_basecommands: duplicate ACMD_DEF for '%s'.\n", atcommand_base[i].command);
continue;
}
- CREATE(cmd, AtCommandInfo, 1);
- safestrncpy(cmd->command, atcommand_base[i].command, sizeof(cmd->command));
- cmd->func = atcommand_base[i].func;
- cmd->help = NULL;/* start as null dear */
- cmd->log = true;
- strdb_put(atcommand->db, cmd->command, cmd);
}
+
+ /* @commands from plugins */
+ HPM_map_atcommands();
+
return;
}
+bool atcommand_add(char *name,AtCommandFunc func) {
+ AtCommandInfo* cmd;
+
+ if(atcommand->exists(name)) //caller will handle/display on false
+ return false;
+
+ CREATE(cmd, AtCommandInfo, 1);
+
+ safestrncpy(cmd->command, name, sizeof(cmd->command));
+ cmd->func = func;
+ cmd->help = NULL;
+ cmd->log = true;
+
+ strdb_put(atcommand->db, cmd->command, cmd);
+
+ return true;
+}
+
/*==========================================
* Command lookup functions
*------------------------------------------*/
@@ -9975,6 +9779,9 @@ bool is_atcommand(const int fd, struct map_session_data* sd, const char* message
sprintf(atcmd_msg, "%s", message);
}
+ if( battle_config.idletime_criteria & BCIDLE_ATCOMMAND )
+ sd->idletime = last_tick;
+
//Clearing these to be used once more.
memset(command, '\0', sizeof(command));
memset(params, '\0', sizeof(params));
@@ -10298,30 +10105,14 @@ bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtComm
return false;
}
bool atcommand_hp_add(char *name, AtCommandFunc func) {
- AtCommandInfo* cmd;
-
+ /* if commands are added after group permissions are thrown in, they end up with no permissions */
+ /* so we restrict commands to be linked in during boot */
if( runflag == MAPSERVER_ST_RUNNING ) {
ShowDebug("atcommand_hp_add: Commands can't be added after server is ready, skipping '%s'...\n",name);
return false;
}
- if( atcommand->db == NULL )
- atcommand->db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH);
-
- if( atcommand->exists(name) ) {
- ShowDebug("atcommand_hp_add: duplicate command '%s', skipping...\n", name);
- return false;
- }
-
- CREATE(cmd, AtCommandInfo, 1);
-
- safestrncpy(cmd->command, name, sizeof(cmd->command));
- cmd->func = func;
- cmd->help = NULL;/* start as null dear */
- cmd->log = true;
-
- strdb_put(atcommand->db, cmd->command, cmd);
- return true;
+ return HPM_map_add_atcommand(name,func);
}
/**
@@ -10407,4 +10198,5 @@ void atcommand_defaults(void) {
atcommand->cmd_db_clear_sub = atcommand_db_clear_sub;
atcommand->doload = atcommand_doload;
atcommand->base_commands = atcommand_basecommands;
+ atcommand->add = atcommand_add;
}