diff options
author | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-28 13:08:53 +0000 |
---|---|---|
committer | Lance <Lance@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2006-02-28 13:08:53 +0000 |
commit | 20fe02757e2dbc5c9ff8787faf2fbb97e3d5280e (patch) | |
tree | 18e0ab985131e01fbbc9b6b30f23e7707088082b /src/map | |
parent | e865d9496fe8b896082d5f62e73300b1262ddf02 (diff) | |
download | hercules-20fe02757e2dbc5c9ff8787faf2fbb97e3d5280e.tar.gz hercules-20fe02757e2dbc5c9ff8787faf2fbb97e3d5280e.tar.bz2 hercules-20fe02757e2dbc5c9ff8787faf2fbb97e3d5280e.tar.xz hercules-20fe02757e2dbc5c9ff8787faf2fbb97e3d5280e.zip |
* Added autoequip flag check (added script command 'autoequip' to manipulate in script.c) for pc_takeitem in pc.c If it impacts on perfomance, please remove it.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5401 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/itemdb.h | 2 | ||||
-rw-r--r-- | src/map/pc.c | 3 | ||||
-rw-r--r-- | src/map/script.c | 13 |
3 files changed, 18 insertions, 0 deletions
diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 2c2422128..dd1e08c80 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -39,6 +39,7 @@ struct item_data { 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;
@@ -71,6 +72,7 @@ struct item_data* itemdb_exists(int nameid); #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);
diff --git a/src/map/pc.c b/src/map/pc.c index 5d7d2ffbd..c0d8d0aa1 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2654,6 +2654,9 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) clif_takeitem(&sd->bl,&fitem->bl);
map_clearflooritem(fitem->bl.id);
+ if(itemdb_autoequip(fitem->item_data.nameid) != 0){
+ pc_equipitem(sd, fitem->item_data.nameid, fitem->item_data.equip);
+ }
return 0;
}
diff --git a/src/map/script.c b/src/map/script.c index 4f99870d4..c0c3b9040 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -402,6 +402,7 @@ int buildin_setd(struct script_state *st); int buildin_petstat(struct script_state *st); // [Lance] Pet Stat Rq: Dubby
int buildin_callshop(struct script_state *st); // [Skotlex]
int buildin_equip(struct script_state *st);
+int buildin_autoequip(struct script_state *st);
void push_val(struct script_stack *stack,int type,int val);
int run_func(struct script_state *st);
@@ -704,6 +705,7 @@ struct { {buildin_petstat,"petstat","i"},
{buildin_callshop,"callshop","si"}, // [Skotlex]
{buildin_equip,"equip","i"},
+ {buildin_autoequip,"autoequip","ii"},
{buildin_setitemscript,"setitemscript","is"}, //Set NEW item bonus script. Lupus
{buildin_disguise,"disguise","i"}, //disguise player. Lupus
{buildin_undisguise,"undisguise","i"}, //undisguise player. Lupus
@@ -9408,6 +9410,17 @@ int buildin_equip(struct script_state *st) return 0;
}
+int buildin_autoequip(struct script_state *st){
+ int nameid, flag;
+ struct item_data *item_data;
+ nameid=conv_num(st,& (st->stack->stack_data[st->start+2]));
+ flag=conv_num(st,& (st->stack->stack_data[st->start+3]));
+ if(nameid>=500 && (item_data = itemdb_search(nameid)) != NULL){
+ item_data->flag.autoequip = flag>0?1:0;
+ }
+ return 0;
+}
+
//=======================================================
// strlen [Valaris]
//-------------------------------------------------------
|