📄 atcommand.c
字号:
atcommand_load(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
pc_setpos(sd, sd->status.save_point.map,
sd->status.save_point.x, sd->status.save_point.y, 0);
clif_displaymessage(fd, msg_table[7]);
return 0;
}
int
atcommand_speed(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
int speed = DEFAULT_WALK_SPEED;
if (!message || !*message)
return -1;
speed = atoi(message);
if (speed > MIN_WALK_SPEED && speed < MAX_WALK_SPEED) {
sd->speed = speed;
//sd->walktimer = x;
//偙偺暥傪捛壛 by 傟偁
clif_updatestatus(sd, SP_SPEED);
clif_displaymessage(fd, msg_table[8]);
}
return 0;
}
int
atcommand_storage(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
storage_storageopen(sd);
return 0;
}
int
atcommand_guildstorage(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
if (sd->status.guild_id > 0)
storage_guild_storageopen(sd);
return 0;
}
int
atcommand_option(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
int param1 = 0, param2 = 0, param3 = 0;
if (!message || !*message)
return -1;
if (sscanf(message, "%d %d %d", ¶m1, ¶m2, ¶m3) < 1)
return -1;
sd->opt1 = param1;
sd->opt2 = param2;
if (!(sd->status.option & CART_MASK) && param3 & CART_MASK) {
clif_cart_itemlist(sd);
clif_cart_equiplist(sd);
clif_updatestatus(sd, SP_CARTINFO);
}
sd->status.option = param3;
clif_changeoption(&sd->bl);
clif_displaymessage(fd,msg_table[9]);
return 0;
}
int
atcommand_hide(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
if (sd->status.option & OPTION_HIDE) {
sd->status.option &= ~OPTION_HIDE;
clif_displaymessage(fd, msg_table[10]);
} else {
sd->status.option |= OPTION_HIDE;
clif_displaymessage(fd, msg_table[11]);
}
clif_changeoption(&sd->bl);
return 0;
}
int
atcommand_jobchange(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
int job = 0;
if (!message || !*message)
return -1;
job = atoi(message);
if ((job >= 0 && job < MAX_PC_CLASS)) {
pc_jobchange(sd, job);
clif_displaymessage(fd, msg_table[12]);
}
return 0;
}
int
atcommand_die(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
pc_damage(NULL, sd, sd->status.hp + 1);
clif_displaymessage(fd, msg_table[13]);
return 0;
}
int
atcommand_kill(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
char character[100];
struct map_session_data *pl_sd = NULL;
if (!message || !*message)
return -1;
memset(character, '\0', sizeof character);
sscanf(message, "%99[^\n]", character);
if ((pl_sd = map_nick2sd(character)) != NULL) {
if (pc_isGM(sd) > pc_isGM(pl_sd)) {
pc_damage(NULL, pl_sd, pl_sd->status.hp + 1);
clif_displaymessage(fd, msg_table[14]);
}
} else {
clif_displaymessage(fd, msg_table[15]);
}
return 0;
}
int
atcommand_alive(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
sd->status.hp = sd->status.max_hp;
sd->status.sp = sd->status.max_sp;
pc_setstand(sd);
if (battle_config.pc_invincible_time > 0)
pc_setinvincibletimer(sd, battle_config.pc_invincible_time);
clif_updatestatus(sd, SP_HP);
clif_resurrection(&sd->bl, 1);
clif_displaymessage(fd, msg_table[16]);
return 0;
}
int
atcommand_kami(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
char output[200];
if (!message || !*message)
return -1;
sscanf(message, "%199[^\n]", output);
intif_GMmessage(output,
strlen(output) + 1,
(*(command + 5) == 'b') ? 0x10 : 0);
return 0;
}
int
atcommand_heal(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
int hp = 0, sp = 0;
if (!message || !*message)
return -1;
if (sscanf(message, "%d %d", &hp, &sp) < 1)
return -1;
if (hp <= 0 && sp <= 0) {
hp = sd->status.max_hp-sd->status.hp;
sp = sd->status.max_sp-sd->status.sp;
} else {
if (sd->status.hp + hp > sd->status.max_hp) {
hp = sd->status.max_hp - sd->status.hp;
}
if (sd->status.sp + sp > sd->status.max_sp) {
sp = sd->status.max_sp - sd->status.sp;
}
}
clif_heal(fd, SP_HP, (hp > 0x7fff) ? 0x7fff : hp);
clif_heal(fd, SP_SP, (sp > 0x7fff) ? 0x7fff : sp);
pc_heal(sd, hp, sp);
clif_displaymessage(fd, msg_table[17]);
return 0;
}
int
atcommand_item(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
char item_name[100];
int number = 0, item_id = 0, flag = 0;
struct item item_tmp;
struct item_data *item_data;
if (!message || !*message)
return -1;
if (sscanf(message, "%99s %d", item_name, &number) < 1)
return -1;
if (number <= 0)
number = 1;
if ((item_id = atoi(item_name)) > 0) {
if (battle_config.item_check) {
item_id =
(((item_data = itemdb_exists(item_id)) &&
itemdb_available(item_id)) ? item_id : 0);
} else {
item_data = itemdb_search(item_id);
}
} else if ((item_data = itemdb_searchname(item_name)) != NULL) {
item_id = (!battle_config.item_check ||
itemdb_available(item_data->nameid)) ? item_data->nameid : 0;
}
if (item_id > 0) {
int loop = 1, get_count = number,i;
if (item_data->type == 4 || item_data->type == 5 ||
item_data->type == 7 || item_data->type == 8) {
loop = number;
get_count = 1;
}
for (i = 0; i < loop; i++) {
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = 1;
if ((flag = pc_additem((struct map_session_data*)sd,
&item_tmp, get_count)))
clif_additem((struct map_session_data*)sd, 0, 0, flag);
}
clif_displaymessage(fd, msg_table[18]);
} else {
clif_displaymessage(fd, msg_table[19]);
}
return 0;
}
int
atcommand_item2(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
struct item item_tmp;
struct item_data *item_data;
char item_name[100];
int item_id = 0, number = 0;
int identify = 0, refine = 0, attr = 0;
int c1 = 0, c2 = 0, c3 = 0, c4 = 0;
int flag = 0;
if (sscanf(message, "%99s %d %d %d %d %d %d %d %d", item_name, &number,
&identify, &refine, &attr, &c1, &c2, &c3, &c4) >= 9) {
if (number <= 0)
number = 1;
if ((item_id = atoi(item_name)) > 0) {
if (battle_config.item_check) {
item_id =
(((item_data = itemdb_exists(item_id)) &&
itemdb_available(item_id)) ? item_id : 0);
} else {
item_data = itemdb_search(item_id);
}
} else if ((item_data = itemdb_searchname(item_name)) != NULL) {
item_id =
(!battle_config.item_check ||
itemdb_available(item_data->nameid)) ? item_data->nameid : 0;
}
if (item_id > 0) {
int loop = 1, get_count = number, i = 0;
if (item_data->type == 4 || item_data->type == 5 ||
item_data->type == 7 || item_data->type == 8) {
loop = number;
get_count = 1;
if (item_data->type == 7) {
identify = 1;
refine = 0;
}
if (item_data->type == 8)
refine = 0;
if (refine > 10)
refine = 10;
} else {
identify = 1;
refine = attr = 0;
}
for (i = 0; i < loop; i++) {
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = identify;
item_tmp.refine = refine;
item_tmp.attribute = attr;
item_tmp.card[0] = c1;
item_tmp.card[1] = c2;
item_tmp.card[2] = c3;
item_tmp.card[3] = c4;
if ((flag = pc_additem(sd, &item_tmp, get_count)))
clif_additem(sd, 0, 0, flag);
}
clif_displaymessage(fd, msg_table[18]);
} else {
clif_displaymessage(fd, msg_table[19]);
}
} else {
return -1;
}
return 0;
}
int
atcommand_itemreset(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
int i = 0;
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);
}
clif_displaymessage(fd, msg_table[20]);
return 0;
}
int
atcommand_itemcheck(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
pc_checkitem(sd);
return 0;
}
int
atcommand_baselevelup(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
int level = 0, i = 0;
if (!message || !*message)
return -1;
level = atoi(message);
if (level >= 1) {
for (i = 1; i <= level; i++)
sd->status.status_point += (sd->status.base_level + i + 14) / 5 ;
sd->status.base_level += level;
clif_updatestatus(sd, SP_BASELEVEL);
clif_updatestatus(sd, SP_NEXTBASEEXP);
clif_updatestatus(sd, SP_STATUSPOINT);
pc_calcstatus(sd, 0);
pc_heal(sd, sd->status.max_hp, sd->status.max_sp);
clif_misceffect(&sd->bl, 0);
clif_displaymessage(fd, msg_table[21]);
} else if (level < 0 && sd->status.base_level + level > 0) {
sd->status.base_level += level;
clif_updatestatus(sd, SP_BASELEVEL);
clif_updatestatus(sd, SP_NEXTBASEEXP);
pc_calcstatus(sd, 0);
clif_displaymessage(fd, msg_table[22]);
}
return 0;
}
int
atcommand_joblevelup(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
int up_level = 50, level = 0;
if (!message || !*message)
return -1;
level = atoi(message);
if (sd->status.class == 0)
up_level -= 40;
if (sd->status.job_level == up_level) {
clif_displaymessage(fd, msg_table[23]);
} else if (level >= 1) {
if (sd->status.job_level + level > up_level)
level = up_level - sd->status.job_level;
sd->status.job_level += level;
clif_updatestatus(sd, SP_JOBLEVEL);
clif_updatestatus(sd, SP_NEXTJOBEXP);
sd->status.skill_point += level;
clif_updatestatus(sd, SP_SKILLPOINT);
pc_calcstatus(sd, 0);
clif_misceffect(&sd->bl, 1);
clif_displaymessage(fd, msg_table[24]);
} else if (level < 0 && sd->status.job_level + level > 0) {
sd->status.job_level += level;
clif_updatestatus(sd, SP_JOBLEVEL);
clif_updatestatus(sd, SP_NEXTJOBEXP);
pc_calcstatus(sd, 0);
clif_displaymessage(fd, msg_table[25]);
}
return 0;
}
int
atcommand_help(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
char buf[BUFSIZ];
FILE* fp = fopen(help_txt, "r");
if (fp != NULL) {
int i = 0;
clif_displaymessage(fd, msg_table[26]);
while (fgets(buf, sizeof buf - 20, fp) != NULL) {
for (i = 0; buf[i] != '\0'; i++) {
if (buf[i] == '\r' || buf[i] == '\n') {
buf[i] = '\0';
}
}
clif_displaymessage(fd, buf);
}
fclose(fp);
} else
clif_displaymessage(fd, msg_table[27]);
return 0;
}
int
atcommand_gm(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
char password[100];
if (!message || !*message)
return -1;
sscanf(message, "%99[^\n]", password);
if (sd->status.party_id)
clif_displaymessage(fd, msg_table[28]);
else if (sd->status.guild_id)
clif_displaymessage(fd, msg_table[29]);
else {
if (sd->status.pet_id > 0 && sd->pd)
intif_save_petdata(sd->status.account_id, &sd->pet);
pc_makesavestatus(sd);
chrif_save(sd);
storage_storage_save(sd);
clif_displaymessage(fd, msg_table[30]);
chrif_changegm(sd->status.account_id, password, strlen(password) + 1);
}
return 0;
}
int
atcommand_pvpoff(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
struct map_session_data *pl_sd = NULL;
int i = 0;
if (map[sd->bl.m].flag.pvp) {
map[sd->bl.m].flag.pvp = 0;
clif_send0199(sd->bl.m, 0);
for (i = 0; i < fd_max; i++) { //恖悢暘儖乕僾
if (session[i] && (pl_sd = session[i]->session_data) &&
pl_sd->state.auth) {
if (sd->bl.m == pl_sd->bl.m) {
clif_pvpset(pl_sd, 0, 0, 2);
if (pl_sd->pvp_timer != -1) {
delete_timer(pl_sd->pvp_timer, pc_calc_pvprank_timer);
pl_sd->pvp_timer = -1;
}
}
}
}
clif_displaymessage(fd, msg_table[31]);
}
return 0;
}
int
atcommand_pvpon(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
struct map_session_data *pl_sd = NULL;
int i = 0;
if (!map[sd->bl.m].flag.pvp) {
map[sd->bl.m].flag.pvp = 1;
clif_send0199(sd->bl.m, 1);
for (i = 0; i < fd_max; i++) {
if (session[i] && (pl_sd = session[i]->session_data) &&
pl_sd->state.auth) {
if (sd->bl.m == pl_sd->bl.m && pl_sd->pvp_timer == -1) {
pl_sd->pvp_timer = add_timer(gettick() + 200,
pc_calc_pvprank_timer, pl_sd->bl.id, 0);
pl_sd->pvp_rank = 0;
pl_sd->pvp_lastusers = 0;
pl_sd->pvp_point = 5;
}
}
}
clif_displaymessage(fd, msg_table[32]);
}
return 0;
}
int
atcommand_gvgoff(
const int fd, struct map_session_data* sd,
const char* command, const char* message)
{
if (map[sd->bl.m].flag.gvg) {
map[sd->bl.m].flag.gvg = 0;
clif_send0199(sd->bl.m, 0);
clif_displaymessage(fd, msg_table[33]);
}
return 0;
}
int
atcommand_gvgon(
const int fd, struct map_session_data* sd,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -