summaryrefslogtreecommitdiff
path: root/src/map/atcommand.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-11 16:32:37 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-07-11 16:32:37 +0000
commit6749d6567aa972b5cc46e1ed85986be21e2ec799 (patch)
tree4d28fd94577ad9183c9341f71fd961931faba416 /src/map/atcommand.c
parent1e844abc3fa269a504ba6610ac83224d9660ce22 (diff)
downloadhercules-6749d6567aa972b5cc46e1ed85986be21e2ec799.tar.gz
hercules-6749d6567aa972b5cc46e1ed85986be21e2ec799.tar.bz2
hercules-6749d6567aa972b5cc46e1ed85986be21e2ec799.tar.xz
hercules-6749d6567aa972b5cc46e1ed85986be21e2ec799.zip
- Coded @reset.
- Reenabled @changesex - Added function pet_create_egg which handles creating pet eggs correctly (when passed item id is indeed a valid petegg). Applied this on @createitem and getitem. - Cleaned up code of @item - Added define UNKNOWN_ITEM_ID (512 = apple) - Added IT_* enumation item_Types to identify said data from items. - Cleaned up the itemdb_isequip functions. itemdb_isequip will now return if the item is equipable by players, itemdb_isstackable returns if the item can be stacked, and itemdb_isidentified returns if the item should drop identified. - Added defines CARD0_PET/CARD0_FORGE/CARD0_CREATED to identify if a given item has "invalid" cards, added define function itemdb_isspecial to simplify this check. - Removed itemdb.c considering item ids above 20000 as invalid. - Cleaned up script commands getitem and card-counting related ones. - Cleaned up a bit more pc_isequip git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7613 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r--src/map/atcommand.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index 3d8f260b9..e31d62845 100644
--- a/src/map/atcommand.c
+++ b/src/map/atcommand.c
@@ -215,6 +215,7 @@ ACMD_FUNC(cleanmap);
ACMD_FUNC(npctalk);
ACMD_FUNC(pettalk);
ACMD_FUNC(users);
+ACMD_FUNC(reset);
ACMD_FUNC(autoloot); // Improved version imported from Freya.
#ifndef TXT_ONLY
@@ -510,7 +511,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_UnMute, "@unmute", 60, atcommand_unmute }, // [Valaris]
{ AtCommand_Clearweather, "@clearweather", 99, atcommand_clearweather }, // Dexity
{ AtCommand_UpTime, "@uptime", 1, atcommand_uptime }, // by MC Cameri
-// { AtCommand_ChangeSex, "@changesex", 1, atcommand_changesex }, // by MC Cameri <- do we still need this? [Foruken]
+ { AtCommand_ChangeSex, "@changesex", 60, atcommand_changesex }, // by MC Cameri <- do we still need this? [Foruken] <- why not? [Skotlex]
{ AtCommand_Mute, "@mute", 99, atcommand_mute }, // [celest]
{ AtCommand_Mute, "@red", 99, atcommand_mute }, // [celest]
{ AtCommand_WhoZeny, "@whozeny", 20, atcommand_whozeny }, // [Valaris]
@@ -525,7 +526,7 @@ static AtCommandInfo atcommand_info[] = {
{ AtCommand_NpcTalk, "@npctalk", 20, atcommand_npctalk },
{ AtCommand_PetTalk, "@pettalk", 10, atcommand_pettalk },
{ AtCommand_Users, "@users", 40, atcommand_users },
- { AtCommand_ResetState, "/reset", 40, NULL },
+ { AtCommand_ResetState, "@reset", 40, atcommand_reset },
#ifndef TXT_ONLY // sql-only commands
{ AtCommand_CheckMail, "@checkmail", 1, atcommand_listmail }, // [Valaris]
@@ -2543,7 +2544,7 @@ int atcommand_item(
int number = 0, item_id, flag;
struct item item_tmp;
struct item_data *item_data;
- int get_count, i, pet_id;
+ int get_count, i;
nullpo_retr(-1, sd);
memset(item_name, '\0', sizeof(item_name));
@@ -2565,24 +2566,14 @@ int atcommand_item(
item_id = item_data->nameid;
get_count = number;
- // check pet egg
- pet_id = search_petDB_index(item_id, PET_EGG);
+ //Check if it's stackable.
if (item_data->type == 4 || item_data->type == 5 ||
item_data->type == 7 || item_data->type == 8) {
get_count = 1;
}
for (i = 0; i < number; i += get_count) {
- // if pet egg
- if (pet_id >= 0) {
- sd->catch_target_class = pet_db[pet_id].class_;
- intif_create_pet(sd->status.account_id, sd->status.char_id,
- (short)pet_db[pet_id].class_,
- (short)mob_db(pet_db[pet_id].class_)->lv,
- (short)pet_db[pet_id].EggID, 0,
- (short)pet_db[pet_id].intimate,
- 100, 0, 1, pet_db[pet_id].jname);
// if not pet egg
- } else {
+ if (!pet_create_egg(sd, item_id)) {
memset(&item_tmp, 0, sizeof(item_tmp));
item_tmp.nameid = item_id;
item_tmp.identify = 1;
@@ -3831,15 +3822,15 @@ int atcommand_produce(
}
item_id = 0;
- if ((item_data = itemdb_searchname(item_name)) != NULL ||
- (item_data = itemdb_exists(atoi(item_name))) != NULL)
- item_id = item_data->nameid;
-
- if (itemdb_exists(item_id) &&
- (item_id <= 500 || item_id > 1099) &&
- (item_id < 4001 || item_id > 4148) &&
- (item_id < 7001 || item_id > 10019) &&
- itemdb_isequip(item_id)) {
+ if ((item_data = itemdb_searchname(item_name)) == NULL &&
+ (item_data = itemdb_exists(atoi(item_name))) == NULL)
+ {
+ sprintf(atcmd_output, msg_table[170]); // This item is not an equipment.
+ clif_displaymessage(fd, atcmd_output);
+ return -1;
+ }
+ item_id = item_data->nameid;
+ if (itemdb_isequip2(item_data) && item_data->type == IT_WEAPON) {
if (attribute < MIN_ATTRIBUTE || attribute > MAX_ATTRIBUTE)
attribute = ATTRIBUTE_NORMAL;
if (star < MIN_STAR || star > MAX_STAR)
@@ -3848,12 +3839,12 @@ int atcommand_produce(
tmp_item.nameid = item_id;
tmp_item.amount = 1;
tmp_item.identify = 1;
- tmp_item.card[0] = 0x00ff;
+ tmp_item.card[0] = CARD0_FORGE;
tmp_item.card[1] = ((star * 5) << 8) + attribute;
tmp_item.card[2] = GetWord(sd->char_id, 0);
tmp_item.card[3] = GetWord(sd->char_id, 1);
- clif_produceeffect(sd, 0, item_id); // 製造エフェクトパケット
- clif_misceffect(&sd->bl, 3); // 他人にも成功を通知
+ clif_produceeffect(sd, 0, item_id);
+ clif_misceffect(&sd->bl, 3);
//Logs (A)dmins items [Lupus]
if(log_config.pick > 0 ) {
@@ -3864,12 +3855,7 @@ int atcommand_produce(
if ((flag = pc_additem(sd, &tmp_item, 1)))
clif_additem(sd, 0, 0, flag);
} else {
- if (battle_config.error_log)
- ShowError("@produce NOT WEAPON [%d]\n", item_id);
- if (item_id != 0 && itemdb_exists(item_id))
- sprintf(atcmd_output, msg_table[169], item_id, item_data->name); // This item (%d: '%s') is not an equipment.
- else
- sprintf(atcmd_output, msg_table[170]); // This item is not an equipment.
+ sprintf(atcmd_output, msg_table[169], item_id, item_data->name); // This item (%d: '%s') is not an equipment.
clif_displaymessage(fd, atcmd_output);
return -1;
}
@@ -8187,6 +8173,18 @@ atcommand_users(
return 0;
}
+int
+atcommand_reset(
+ const int fd, struct map_session_data* sd,
+ const char* command, const char* message)
+{
+ pc_resetstate(sd);
+ pc_resetskill(sd,1);
+ sprintf(atcmd_output, msg_table[208], sd->status.name); // '%s' skill and stats points reseted!
+ clif_displaymessage(fd, atcmd_output);
+ return 0;
+}
+
/*==========================================
*
*------------------------------------------