Skip to content
Permalink
Browse files
Bug fixes:
-- Pin code issue after char_refac (bugreport:9027)
-- Delete date issue after char_refac (bugreport:9029)
-- Stuck when drag item from/to inventory/cart/storage if the item cannot be moved. (bugreport:8935)
Command:
-- Added @cloneequip to clone other's equipments.
-- Added @clonestat to clone other's statuses.
-- Thank Antares for the suggestion, http://rathena.org/board/topic/95076-new-atcommands-suggestion/
Permission:
-- Added 'bypass_stat_onclone' to make user who use @clonestat can bypass stat limit.
-- Change 'atcommand_enable_npc' to 'command_enable' permission to enable use command while talking with NPC. Suggested by @aleos long time ago.
Misc:
-- Correcting some checks for bAddEff bonuses.
-- Moved status point calculaiton formula to PC_STATUS_POINT_COST, removing redundancy in pc_need_status_point and pc_maxparameterincrease.
-- Added pc_is_same_equip_index function to move all item index checks, removing redundancy in some cases.
-- Some random in-source documentations.
-- Updated map_msg_idn.conf.

Signed-off-by: Cydh Ramdh <house.bad@gmail.com>
  • Loading branch information
cydh committed Jun 15, 2014
1 parent 82467e1 commit 267d521c00e63e4554a14be2b8d3f579a6ebf07e
@@ -60,6 +60,8 @@ aliases: {
itemreset: ["clearinventory"]
channel: ["main"]
autoloottype: ["aloottype"]
cloneequip: ["eqclone"]
clonestat: ["stclone"]
}

/* Commands help file */
@@ -31,6 +31,3 @@ ban_hack_trade: 5
// modifies @iteminfo to not display the minimum item drop rate (since it can't tell the mob level)
// modifies @whodrops to display the users' real drop rate as per renewal_drop formula
atcommand_mobinfo_type: 1

// Only group with level more than or equal this value can use atcommand while talking with NPC.
atcommand_enable_npc: 0
@@ -93,6 +93,7 @@ groups: (
trade or party */
can_trade: true
can_party: true
command_enable: true
}
},
{
@@ -290,6 +291,7 @@ groups: (
channel_admin: true
can_trade_bounded: true
item_unconditional: false
bypass_stat_onclone: true
/* all_permission: true */
}
}
@@ -771,7 +771,14 @@

733: Item '%s' has not yet saved to your cart. Please re-log in order to correctly save your Vending information.

//734-899 free
// @cloneequip/@clonestat
734: Cannot clone your own %s.
735: Please enter char_id or \"char name\".
736: Cannot clone %s from this player.
737: '%s' (%d) cannot be cloned, limit (%d).
738: Clone '%s' is done.

//739-899 free

//------------------------------------
// More atcommands message
@@ -392,8 +392,8 @@
377: -- Pemain %s telah menolak permintaan duel --
//lain-lain
378: Eleanor sekarang dalam mode %s.
379: Penggunaan item gagal. [%s] sedang cooling down. Tunggu %.1f menit.
380: Penggunaan item gagal. [%s] sedang cooling down. Tunggu %d detik.
379: Dapat digunakan setelah %.1f menit.
380: Dapat digunakan setelah %d detik.
381: Penggunaan skill gagal. [%s] membutuhkan %dx %s.
382: Kamu terlalu dekat dengan batu atau emperium untuk menggunakan skill ini.
383: Kamu tidak dapat membuat save point di instance
@@ -516,7 +516,10 @@
515: Intance kamu sudha dimuat ulang.
516: Database Instance sudah dimuat ulang.

//517~534: kosong
// @auction
517: Sistem Auction tidak tersedia.

//518~534: kosong

// Pesan yang berhubungan dengan deteksi Bot (Saat ini belum diimplementasikan)
535: Kemungkinan BOT (99%%) atau client yang digunakan sudah dimodifikasi '%s' (akun: %d, char_id: %d). Pemain ini bisa melihat nama kamu saat kamu sedang tidak terlihat.
@@ -748,7 +751,16 @@

732: Item tidak dapat dibuka ketika inventory penuh.

//733-899 kosong
733: Item '%s' belum tersimpan di gerobak. Harap masuk kembali untuk dapat menyimpan informasi vending dengan benar.

// @cloneequip/@clonestat
734: Tidak dapat mengkloning %s diri sendiri.
735: Harap masukkan id_karakter atau \"nama karakter\".
736: Tidak dapat mengkloning %s dari player ini.
737: Status '%s' (%d) tidak dapat ditiru, batas status (%d).
738: Kloning '%s' selesai.

//739-899 kosong

//------------------------------------
// Pesan dalam perintah atcommand
@@ -1089,6 +1089,20 @@ Give or remove a cart to a player and also change the cart skin based on ID:

---------------------------------------

@cloneequip <char_id>
@cloneequip "<char name>"

'Clone' other player's equipments then equip them.

---------------------------------------

@clonestat <char_id>
@clonestat "<char name>"

'Clone' other player's stats.

---------------------------------------

==============================
| 5. Administrative Commands |
==============================
@@ -187,3 +187,15 @@ Allows player to use the client command /check (displays character status).
Allows player to use the client command /changemaptype.

---------------------------------------

*command_enable

Enable to use atcommand while talking with NPC.

---------------------------------------

*bypass_stat_onclone

Bypass max parameter limit while using @clonestat

---------------------------------------
@@ -68,15 +68,15 @@ struct Schema_Config {
};
extern struct Schema_Config schema_config;

// Pincode system
/// Pincode system
enum pincode_state {
PINCODE_OK = 0,
PINCODE_ASK,
PINCODE_NOTSET,
PINCODE_EXPIRED,
PINCODE_NEW,
PINCODE_PASSED,
PINCODE_WRONG,
PINCODE_OK = 0,
PINCODE_ASK = 1,
PINCODE_NOTSET = 2,
PINCODE_EXPIRED = 3,
PINCODE_NEW = 4,
PINCODE_PASSED = 7,
PINCODE_WRONG = 8,
PINCODE_MAXSTATE
};
struct Pincode_Config {
@@ -323,7 +323,7 @@ void chclif_char_delete2_ack(int fd, int char_id, uint32 result, time_t delete_d
WFIFOW(fd,0) = 0x828;
WFIFOL(fd,2) = char_id;
WFIFOL(fd,6) = result;
WFIFOL(fd,10) = TOL(delete_date);
WFIFOL(fd,10) = TOL(delete_date-time(NULL));
WFIFOSET(fd,14);
}

@@ -1198,7 +1198,8 @@ ACMD_FUNC(heal)
ACMD_FUNC(item)
{
char item_name[100];
int number = 0, flag = 0, bound = BOUND_NONE;
int number = 0, bound = BOUND_NONE;
char flag = 0;
struct item item_tmp;
struct item_data *item_data[10];
int get_count, i, j=0;
@@ -1315,8 +1316,8 @@ ACMD_FUNC(item2)
item_id = item_data->nameid;

if (item_id > 500) {
int flag = 0;
int loop, get_count, i;
char flag = 0;
loop = 1;
get_count = number;
if (item_data->type == IT_WEAPON || item_data->type == IT_ARMOR ||
@@ -2192,12 +2193,9 @@ ACMD_FUNC(refine)
int i;
if ((i = sd->equip_index[j]) < 0)
continue;
if(j == EQI_AMMO) continue;
if(j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == i)
continue;
if(j == EQI_HEAD_MID && sd->equip_index[EQI_HEAD_LOW] == i)
if(j == EQI_AMMO)
continue;
if(j == EQI_HEAD_TOP && (sd->equip_index[EQI_HEAD_MID] == i || sd->equip_index[EQI_HEAD_LOW] == i))
if (pc_is_same_equip_index((enum equip_index)j, sd->equip_index, i))
continue;

if(position && !(sd->status.inventory[i].equip & position))
@@ -2261,7 +2259,7 @@ ACMD_FUNC(produce)
item_id = item_data->nameid;

if (itemdb_isequip2(item_data)) {
int flag = 0;
char flag = 0;
if (attribute < MIN_ATTRIBUTE || attribute > MAX_ATTRIBUTE)
attribute = ATTRIBUTE_NORMAL;
if (star < MIN_STAR || star > MAX_STAR)
@@ -5633,7 +5631,7 @@ ACMD_FUNC(skilltree)
// Hand a ring with partners name on it to this char
void getring (struct map_session_data* sd)
{
int flag;
char flag = 0;
unsigned short item_id;
struct item item_tmp;
item_id = (sd->status.sex) ? WEDDING_RING_M : WEDDING_RING_F;
@@ -9476,6 +9474,172 @@ ACMD_FUNC(costume) {
return 0;
}

/**
* Clone other player's equipments
* Usage: @cloneequip <char_id or "char name">
* http://rathena.org/board/topic/95076-new-atcommands-suggestion/
* @author [Cydh], [Antares]
*/
ACMD_FUNC(cloneequip) {
struct map_session_data *pl_sd;
int char_id = 0;

nullpo_retr(-1, sd);

memset(atcmd_output, '\0', sizeof(atcmd_output));
if( !message || !*message || (sscanf(message, "%d", &char_id) < 1 && sscanf(message, "\"%23[^\"]\"", atcmd_output) < 1) ) {
clif_displaymessage(fd, msg_txt(sd, 735)); // Please enter char_id or \"char name\".
return -1;
}

if (char_id)
pl_sd = map_charid2sd(char_id);
else
pl_sd = map_nick2sd(atcmd_output);

if (!pl_sd) {
clif_displaymessage(fd, msg_txt(sd, 3));
return -1;
}

if (sd == pl_sd) {
memset(atcmd_output, '\0', sizeof(atcmd_output));
sprintf(atcmd_output, msg_txt(sd, 734), "equip"); // Cannot clone your own %.
clif_displaymessage(fd, atcmd_output);
return -1;
}

if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) {
memset(atcmd_output, '\0', sizeof(atcmd_output));
sprintf(atcmd_output, msg_txt(sd, 736), "equip"); // Cannot clone %s from this player.
clif_displaymessage(fd, atcmd_output);
return -1;
}
else {
int8 i;
for (i = 0; i < EQI_MAX; i++) {
int8 idx;
char flag = 0;
struct item tmp_item;
if ((idx = pl_sd->equip_index[i]) < 0)
continue;
if (i == EQI_AMMO)
continue;
if (pc_is_same_equip_index((enum equip_index) i, pl_sd->equip_index, idx))
continue;

tmp_item = pl_sd->status.inventory[idx];
if (itemdb_isspecial(tmp_item.card[0]))
memset(tmp_item.card, 0, sizeof(tmp_item.card));
tmp_item.bound = 0;
tmp_item.expire_time = 0;
tmp_item.unique_id = 0;
tmp_item.favorite = 0;
tmp_item.amount = 1;

if ((flag = pc_additem(sd, &tmp_item, 1, LOG_TYPE_COMMAND)))
clif_additem(sd, 0, 0, flag);
else
pc_equipitem(sd, sd->last_addeditem_index, itemdb_equip(tmp_item.nameid));
}
}
memset(atcmd_output, '\0', sizeof(atcmd_output));
sprintf(atcmd_output, msg_txt(sd, 738), "status");
clif_displaymessage(fd, atcmd_output);

return 0;
}

/**
* Clone other player's statuses/parameters using method same like ACMD_FUNC(param), doesn't use stat point
* Usage: @clonestat <char_id or "char name">
* http://rathena.org/board/topic/95076-new-atcommands-suggestion/
* @author [Cydh], [Antares]
*/
ACMD_FUNC(clonestat) {
struct map_session_data *pl_sd;
int char_id = 0;

nullpo_retr(-1, sd);

memset(atcmd_output, '\0', sizeof(atcmd_output));
if( !message || !*message || (sscanf(message, "%d", &char_id) < 1 && sscanf(message, "\"%23[^\"]\"", atcmd_output) < 1) ) {
clif_displaymessage(fd, msg_txt(sd, 735)); // Please enter char_id or \"char name\".
return -1;
}

if (char_id)
pl_sd = map_charid2sd(char_id);
else
pl_sd = map_nick2sd(atcmd_output);

if (!pl_sd) {
clif_displaymessage(fd, msg_txt(sd, 3));
return -1;
}

if (sd == pl_sd) {
memset(atcmd_output, '\0', sizeof(atcmd_output));
sprintf(atcmd_output, msg_txt(sd, 734), "status"); // Cannot clone your own %.
clif_displaymessage(fd, atcmd_output);
return -1;
}

if (pc_get_group_level(sd) < pc_get_group_level(pl_sd)) {
memset(atcmd_output, '\0', sizeof(atcmd_output));
sprintf(atcmd_output, msg_txt(sd, 736), "status"); // Cannot clone %s from this player.
clif_displaymessage(fd, atcmd_output);
return -1;
}
else {
uint8 i;
short max_status[6];

pc_resetstate(sd);
if (pc_has_permission(sd, PC_PERM_BYPASS_STAT_ONCLONE))
max_status[0] = max_status[1] = max_status[2] = max_status[3] = max_status[4] = max_status[5] = SHRT_MAX;
else {
max_status[0] = pc_maxparameter(sd, PARAM_STR);
max_status[1] = pc_maxparameter(sd, PARAM_AGI);
max_status[2] = pc_maxparameter(sd, PARAM_VIT);
max_status[3] = pc_maxparameter(sd, PARAM_INT);
max_status[4] = pc_maxparameter(sd, PARAM_DEX);
max_status[5] = pc_maxparameter(sd, PARAM_LUK);
}

#define clonestat_check(cmd,stat)\
{\
memset(atcmd_output, '\0', sizeof(atcmd_output));\
if (pl_sd->status.cmd > max_status[(stat)]) {\
sprintf(atcmd_output, msg_txt(sd, 737), #cmd, pl_sd->status.cmd, max_status[(stat)]);\
clif_displaymessage(fd, atcmd_output);\
sd->status.cmd = max_status[(stat)];\
}\
else\
sd->status.cmd = pl_sd->status.cmd;\
}

clonestat_check(str, PARAM_STR);
clonestat_check(agi, PARAM_AGI);
clonestat_check(vit, PARAM_VIT);
clonestat_check(int_, PARAM_INT);
clonestat_check(dex, PARAM_DEX);
clonestat_check(luk, PARAM_LUK);

for (i = 0; i < PARAM_MAX; i++) {
clif_updatestatus(sd, SP_STR + i);
clif_updatestatus(sd, SP_USTR + i);
}
status_calc_pc(sd, SCO_FORCE);
}
memset(atcmd_output, '\0', sizeof(atcmd_output));
sprintf(atcmd_output, msg_txt(sd, 738), "status");
clif_displaymessage(fd, atcmd_output);

#undef clonestat_check
return 0;
}

#include "../custom/atcommand.inc"

/**
@@ -9764,6 +9928,8 @@ void atcommand_basecommands(void) {
#endif
ACMD_DEF(fullstrip),
ACMD_DEF(costume),
ACMD_DEF(cloneequip),
ACMD_DEF(clonestat),
};
AtCommandInfo* atcommand;
int i;

0 comments on commit 267d521

Please sign in to comment.