git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@856 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
c4a8f15e0d
commit
e333217bc3
@ -1,5 +1,7 @@
|
|||||||
Date Added
|
Date Added
|
||||||
12/29
|
12/29
|
||||||
|
* Removed @giveitem since #item it's the one that does this and added some of it's support to #item [MC Cameri]
|
||||||
|
-#item <item_name> <item_count> <charname|all|everyone>
|
||||||
* Uncommented out import in charcommand_athena.conf, there is
|
* Uncommented out import in charcommand_athena.conf, there is
|
||||||
need to have it commented (all the others ones are
|
need to have it commented (all the others ones are
|
||||||
uncommented) [Ajarn]
|
uncommented) [Ajarn]
|
||||||
|
@ -22,6 +22,6 @@ spiritball: 60
|
|||||||
item: 60
|
item: 60
|
||||||
job: 60
|
job: 60
|
||||||
jobchange: 60
|
jobchange: 60
|
||||||
charzeny: 60
|
zeny: 60
|
||||||
|
|
||||||
import: conf/import/charcommand_conf.txt
|
import: conf/import/charcommand_conf.txt
|
||||||
|
@ -208,7 +208,6 @@ ACMD_FUNC(gmotd); // Added by MC Cameri, created by davidsiaw
|
|||||||
ACMD_FUNC(misceffect); // by MC Cameri
|
ACMD_FUNC(misceffect); // by MC Cameri
|
||||||
ACMD_FUNC(mobsearch);
|
ACMD_FUNC(mobsearch);
|
||||||
ACMD_FUNC(cleanmap);
|
ACMD_FUNC(cleanmap);
|
||||||
ACMD_FUNC(giveitem);
|
|
||||||
|
|
||||||
#ifndef TXT_ONLY
|
#ifndef TXT_ONLY
|
||||||
ACMD_FUNC(checkmail); // [Valaris]
|
ACMD_FUNC(checkmail); // [Valaris]
|
||||||
@ -472,7 +471,6 @@ static AtCommandInfo atcommand_info[] = {
|
|||||||
{ AtCommand_MiscEffect, "@misceffect", 50, atcommand_misceffect }, // by MC Cameri
|
{ AtCommand_MiscEffect, "@misceffect", 50, atcommand_misceffect }, // by MC Cameri
|
||||||
{ AtCommand_MobSearch, "@mobsearch", 0, atcommand_mobsearch },
|
{ AtCommand_MobSearch, "@mobsearch", 0, atcommand_mobsearch },
|
||||||
{ AtCommand_CleanMap, "@cleanmap", 0, atcommand_cleanmap },
|
{ AtCommand_CleanMap, "@cleanmap", 0, atcommand_cleanmap },
|
||||||
{ AtCommand_GiveItem, "@giveitem", 0, atcommand_giveitem },
|
|
||||||
|
|
||||||
#ifndef TXT_ONLY // sql-only commands
|
#ifndef TXT_ONLY // sql-only commands
|
||||||
{ AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris]
|
{ AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris]
|
||||||
@ -7585,90 +7583,6 @@ atcommand_cleanmap(
|
|||||||
clif_displaymessage(fd, "All dropped items have been cleaned up.");
|
clif_displaymessage(fd, "All dropped items have been cleaned up.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/*==========================================
|
|
||||||
* Give Item
|
|
||||||
* @giveitem (item_id or item_name) amount charname
|
|
||||||
*------------------------------------------
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
atcommand_giveitem_sub(struct map_session_data *sd,struct item_data *item_data,int number)
|
|
||||||
{
|
|
||||||
int flag = 0;
|
|
||||||
int loop = 1, get_count = number,i;
|
|
||||||
struct item item_tmp;
|
|
||||||
|
|
||||||
if(sd && item_data){
|
|
||||||
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_data->nameid;
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
int
|
|
||||||
atcommand_giveitem(
|
|
||||||
const int fd, struct map_session_data* sd,
|
|
||||||
const char* command, const char* message)
|
|
||||||
{
|
|
||||||
struct map_session_data *pl_sd = NULL;
|
|
||||||
struct item_data *item_data;
|
|
||||||
char item_name[100];
|
|
||||||
char character[100];
|
|
||||||
char output[100];
|
|
||||||
int number,i,item_id;
|
|
||||||
|
|
||||||
if (!message || !*message)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (sscanf(message, "%99s %d %99[^\n]", item_name, &number, character) < 3)
|
|
||||||
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)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if ((pl_sd = map_nick2sd(character)) != NULL) { //該当名のキャラが存在する
|
|
||||||
atcommand_giveitem_sub(pl_sd,item_data,number);
|
|
||||||
snprintf(output, sizeof output, "You got %s %d.",item_name,number);
|
|
||||||
clif_displaymessage(pl_sd->fd, output);
|
|
||||||
snprintf(output, sizeof output, "%s received %s %d.",pl_sd->status.name,item_name,number);
|
|
||||||
clif_displaymessage(fd, output);
|
|
||||||
}
|
|
||||||
else if(strcmp(character,"ALL")==0){ // 名前がALLなら、接続者全員へ
|
|
||||||
for (i = 0; i < fd_max; i++) {
|
|
||||||
if (session[i] && (pl_sd = session[i]->session_data)){
|
|
||||||
atcommand_giveitem_sub(pl_sd,item_data,number);
|
|
||||||
snprintf(output, sizeof output, "You got %s %d.", item_name,number);
|
|
||||||
clif_displaymessage(pl_sd->fd, output);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
snprintf(output, sizeof output, "%s received %s %d.","Everyone",item_name,number);
|
|
||||||
clif_displaymessage(fd, output);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*==========================================
|
/*==========================================
|
||||||
*
|
*
|
||||||
|
@ -196,7 +196,6 @@ enum AtCommandType {
|
|||||||
AtCommand_MiscEffect, // by MC Cameri
|
AtCommand_MiscEffect, // by MC Cameri
|
||||||
AtCommand_MobSearch,
|
AtCommand_MobSearch,
|
||||||
AtCommand_CleanMap,
|
AtCommand_CleanMap,
|
||||||
AtCommand_GiveItem,
|
|
||||||
|
|
||||||
// SQL-only commands start
|
// SQL-only commands start
|
||||||
#ifndef TXT_ONLY
|
#ifndef TXT_ONLY
|
||||||
|
@ -991,6 +991,29 @@ charcommand_storagelist(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
charcommand_giveitem_sub(struct map_session_data *sd,struct item_data *item_data,int number)
|
||||||
|
{
|
||||||
|
int flag = 0;
|
||||||
|
int loop = 1, get_count = number,i;
|
||||||
|
struct item item_tmp;
|
||||||
|
|
||||||
|
if(sd && item_data){
|
||||||
|
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_data->nameid;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
/*==========================================
|
/*==========================================
|
||||||
* #item command (usage: #item <name/id_of_item> <quantity> <player>)
|
* #item command (usage: #item <name/id_of_item> <quantity> <player>)
|
||||||
* by MC Cameri
|
* by MC Cameri
|
||||||
@ -1056,6 +1079,16 @@ int charcommand_item(
|
|||||||
clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
|
clif_displaymessage(fd, msg_table[81]); // Your GM level don't authorise you to do this action on this player.
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
} else if(strncasecmp(character,"all")==0 || strncasecmp(character,"everyone")==0){ // 名前がALLなら、接続者全員へ
|
||||||
|
for (i = 0; i < fd_max; i++) {
|
||||||
|
if (session[i] && (pl_sd = session[i]->session_data)){
|
||||||
|
atcommand_giveitem_sub(pl_sd,item_data,number);
|
||||||
|
snprintf(output, sizeof output, "You got %s %d.", item_name,number);
|
||||||
|
clif_displaymessage(pl_sd->fd, output);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
snprintf(output, sizeof output, "%s received %s %d.","Everyone",item_name,number);
|
||||||
|
clif_displaymessage(fd, output);
|
||||||
} else {
|
} else {
|
||||||
clif_displaymessage(fd, msg_table[3]); // Character not found.
|
clif_displaymessage(fd, msg_table[3]); // Character not found.
|
||||||
return -1;
|
return -1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user