summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
Diffstat (limited to 'src/map')
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/pc.c4
-rw-r--r--src/map/script.c15
-rw-r--r--src/map/status.c2
-rw-r--r--src/map/status.h2
5 files changed, 19 insertions, 5 deletions
diff --git a/src/map/map.h b/src/map/map.h
index 15075e8dc..a83f810b9 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -297,7 +297,6 @@ struct map_session_data {
short hp_loss_value, hp_loss_type;
int addrace2[6],addrace2_[6];
int subsize[3];
- struct item_data *current_item;
short unequip_damage[11];
int itemid;
int itemhealrate[6];
diff --git a/src/map/pc.c b/src/map/pc.c
index d53a4302f..920784da3 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -1584,10 +1584,10 @@ int pc_bonus(struct map_session_data *sd,int type,int val)
sd->hp_gain_value += val;
break;
case SP_DAMAGE_WHEN_UNEQUIP:
- if(!sd->state.lr_flag && sd->current_item) {
+ if(!sd->state.lr_flag) {
int i;
for (i=0; i<11; i++) {
- if (sd->current_item->equip & equip_pos[i]) {
+ if (sd->inventory_data[current_equip_item_index]->equip & equip_pos[i]) {
sd->unequip_damage[i] += val;
break;
}
diff --git a/src/map/script.c b/src/map/script.c
index c032fe401..fd2068cbd 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -311,6 +311,7 @@ int buildin_isday(struct script_state *st); // [celest]
int buildin_isequipped(struct script_state *st); // [celest]
int buildin_isequippedcnt(struct script_state *st); // [celest]
int buildin_cardscnt(struct script_state *st); // [Lupus]
+int buildin_getrefine(struct script_state *st); // [celest]
int buildin_getusersname(struct script_state *st); //jA commands added [Lupus]
int buildin_dispbottom(struct script_state *st);
int buildin_recovery(struct script_state *st);
@@ -558,6 +559,7 @@ struct {
{buildin_isequipped,"isequipped","i*"}, // check whether another item/card has been equipped [Celest]
{buildin_isequippedcnt,"isequippedcnt","i*"}, // check how many items/cards are being equipped [Celest]
{buildin_cardscnt,"cardscnt","i*"}, // check how many items/cards are being equipped in the same arm [Lupus]
+ {buildin_getrefine,"getrefine",""}, // returns the refined number of the current item, or an item with index specified [celest]
#ifdef PCRE_SUPPORT
{buildin_defpattern, "defpattern", "iss"}, // Define pattern to listen for [MouseJstr]
{buildin_activatepset, "activatepset", "i"}, // Activate a pattern set [MouseJstr]
@@ -7013,6 +7015,19 @@ int buildin_cardscnt(struct script_state *st)
return 0;
}
+/*=======================================================
+ * Returns the refined number of the current item, or an
+ * item with inventory index specified
+ *-------------------------------------------------------
+ */
+int buildin_getrefine(struct script_state *st)
+{
+ struct map_session_data *sd;
+ if ((sd = script_rid2sd(st))!= NULL)
+ push_val(st->stack, C_INT, sd->status.inventory[current_equip_item_index].refine);
+ return 0;
+}
+
//
// 実行部main
//
diff --git a/src/map/status.c b/src/map/status.c
index c5b728b73..b0c90d520 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -552,7 +552,6 @@ int status_calc_pc(struct map_session_data* sd,int first)
continue;
if(sd->inventory_data[index]) {
- sd->current_item = sd->inventory_data[index];
if(sd->inventory_data[index]->type == 4) {
if(sd->status.inventory[index].card[0]!=0x00ff && sd->status.inventory[index].card[0]!=0x00fe && sd->status.inventory[index].card[0]!=(short)0xff00) {
int j;
@@ -577,7 +576,6 @@ int status_calc_pc(struct map_session_data* sd,int first)
}
}
}
- sd->current_item = NULL;
}
}
wele = sd->atk_ele;
diff --git a/src/map/status.h b/src/map/status.h
index c07840993..a23394d6a 100644
--- a/src/map/status.h
+++ b/src/map/status.h
@@ -179,6 +179,8 @@ enum { // struct map_session_data の status_changeの番?テ?ブル
};
extern int SkillStatusChangeTable[];
+extern int current_equip_item_index;
+
// パラメータ所得系 battle.c より移動
int status_get_class(struct block_list *bl);
int status_get_dir(struct block_list *bl);