rathena/src/map/itemdb.h
skotlex a6c3f3a1fc - 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://svn.code.sf.net/p/rathena/svn/trunk@7613 54d463be-8e91-2dee-dedb-b68131a5f0ec
2006-07-11 16:32:37 +00:00

150 lines
5.7 KiB
C
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Copyright (c) Athena Dev Teams - Licensed under GNU GPL
// For more information, see LICENCE in the main folder
#ifndef _ITEMDB_H_
#define _ITEMDB_H_
#include "map.h"
#define MAX_RANDITEM 10000
enum {
IT_HEALING = 0,
IT_UNKNOWN, //1
IT_USABLE, //2
IT_ETC, //3
IT_WEAPON, //4
IT_ARMOR, //5
IT_CARD, //6
IT_PETEGG, //7
IT_PETARMOR,//8
IT_UNKNOWN2,//9
IT_AMMO, //10
IT_DELAYCONSUME,//11
IT_MAX
} item_types;
#define CARD0_FORGE 0x00FF
#define CARD0_CREATE 0x00FE
#define CARD0_PET ((short)0xFF00)
//Marks if the card0 given is "special" (non-item id used to mark pets/created items. [Skotlex]
#define itemdb_isspecial(i) (i == CARD0_FORGE || i == CARD0_CREATE || i == CARD0_PET)
//Use apple for unknown items.
#define UNKNOWN_ITEM_ID 512
struct item_data {
int nameid;
char name[ITEM_NAME_LENGTH],jname[ITEM_NAME_LENGTH];
char prefix[NAME_LENGTH],suffix[NAME_LENGTH];
char cardillustname[64];
//Do not add stuff between value_buy and wlv (see how getiteminfo works)
int value_buy;
int value_sell;
int type;
int maxchance; //For logs, for external game info, for scripts: Max drop chance of this item (e.g. 0.01% , etc.. if it = 0, then monsters don't drop it) [Lupus]
int sex;
int equip;
int weight;
int atk;
int def;
int range;
int slot;
int look;
int elv;
int wlv;
//Lupus: I rearranged order of these fields due to compatibility with ITEMINFO script command
// some script commands should be revised as well...
unsigned int class_base[3]; //Specifies if the base can wear this item (split in 3 indexes per type: 1-1, 2-1, 2-2)
unsigned class_upper : 3; //Specifies if the upper-type can equip it (1: normal, 2: upper, 3: baby)
struct {
unsigned short chance;
int id;
} mob[MAX_SEARCH]; //Holds the mobs that have the highest drop rate for this item. [Skotlex]
struct script_code *script; //Default script for everything.
struct script_code *equip_script; //Script executed once when equipping.
struct script_code *unequip_script;//Script executed once when unequipping.
struct {
unsigned available : 1;
unsigned value_notdc : 1;
unsigned value_notoc : 1;
short no_equip;
unsigned no_use : 1;
unsigned no_refine : 1; // [celest]
unsigned delay_consume : 1; // Signifies items that are not consumed inmediately upon double-click [Skotlex]
unsigned trade_restriction : 7; //Item restrictions mask [Skotlex]
unsigned autoequip: 1;
} flag;
short gm_lv_trade_override; //GM-level to override trade_restriction
int view_id;
};
struct item_group {
int nameid[MAX_RANDITEM];
int qty; //Counts amount of items in the group.
int id[30]; // 120 bytes
};
struct item_data* itemdb_searchname(const char *name);
int itemdb_searchname_array(struct item_data** data, int size, const char *str);
struct item_data* itemdb_load(int nameid);
struct item_data* itemdb_search(int nameid);
struct item_data* itemdb_exists(int nameid);
#define itemdb_type(n) itemdb_search(n)->type
#define itemdb_atk(n) itemdb_search(n)->atk
#define itemdb_def(n) itemdb_search(n)->def
#define itemdb_look(n) itemdb_search(n)->look
#define itemdb_weight(n) itemdb_search(n)->weight
#define itemdb_equip(n) itemdb_search(n)->equip
#define itemdb_usescript(n) itemdb_search(n)->script
#define itemdb_equipscript(n) itemdb_search(n)->script
#define itemdb_wlv(n) itemdb_search(n)->wlv
#define itemdb_range(n) itemdb_search(n)->range
#define itemdb_slot(n) itemdb_search(n)->slot
#define itemdb_available(n) (itemdb_exists(n) && itemdb_search(n)->flag.available)
#define itemdb_viewid(n) (itemdb_search(n)->view_id)
#define itemdb_autoequip(n) (itemdb_search(n)->flag.autoequip)
int itemdb_group(int nameid);
int itemdb_searchrandomid(int flags);
#define itemdb_value_buy(n) itemdb_search(n)->value_buy
#define itemdb_value_sell(n) itemdb_search(n)->value_sell
#define itemdb_value_notdc(n) itemdb_search(n)->flag.value_notdc
#define itemdb_value_notoc(n) itemdb_search(n)->flag.value_notoc
#define itemdb_canrefine(n) itemdb_search(n)->flag.no_refine
//Item trade restrictions [Skotlex]
int itemdb_isdropable_sub(struct item_data *, int, int);
int itemdb_cantrade_sub(struct item_data*, int, int);
int itemdb_canpartnertrade_sub(struct item_data*, int, int);
int itemdb_cansell_sub(struct item_data*,int, int);
int itemdb_cancartstore_sub(struct item_data*, int, int);
int itemdb_canstore_sub(struct item_data*, int, int);
int itemdb_canguildstore_sub(struct item_data*, int, int);
int itemdb_isrestricted(struct item* item, int gmlv, int gmlv2, int (*func)(struct item_data*, int, int));
#define itemdb_isdropable(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_isdropable_sub)
#define itemdb_cantrade(item, gmlv, gmlv2) itemdb_isrestricted(item, gmlv, gmlv2, itemdb_cantrade_sub)
#define itemdb_canpartnertrade(item, gmlv, gmlv2) itemdb_isrestricted(item, gmlv, gmlv2, itemdb_canpartnertrade_sub)
#define itemdb_cansell(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_cansell_sub)
#define itemdb_cancartstore(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_cancartstore_sub)
#define itemdb_canstore(item, gmlv) itemdb_isrestricted(item, gmlv, 0, itemdb_canstore_sub)
#define itemdb_canguildstore(item, gmlv) itemdb_isrestricted(item , gmlv, 0, itemdb_canguildstore_sub)
int itemdb_isequip(int);
int itemdb_isequip2(struct item_data *);
int itemdb_isidentified(int);
int itemdb_isstackable(int);
int itemdb_isstackable2(struct item_data *);
// itemdb_equip<69>}<7D>N<EFBFBD><4E><EFBFBD><EFBFBD>itemdb_equippoint<6E>Ƃ̈Ⴂ<CC88><E182A2>
// <20>O<EFBFBD>҂<EFBFBD><D282>I<EFBFBD><49>db<64>Œ<EFBFBD><C592>`<60><><EFBFBD><EFBFBD>l<EFBFBD><6C><EFBFBD>̂<EFBFBD><CC82>̂<EFBFBD><CC82>Ԃ<EFBFBD><D482>̂ɑ΂<C991>
// <20><><EFBFBD>҂<EFBFBD>sessiondata<74><61><EFBFBD>l<EFBFBD><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƒ<EFBFBD><C691>ł̑<C582><CC91><EFBFBD><EFBFBD>”\<5C>
// <20><><EFBFBD>ׂĂ̑g<CC91>ݍ<EFBFBD><DD8D><EFBFBD><ED82B9><EFBFBD>Ԃ<EFBFBD>
void itemdb_reload(void);
void do_final_itemdb(void);
int do_init_itemdb(void);
#endif