浏览代码

* Added getrefine()

git-svn-id: https://svn.code.sf.net/p/rathena/svn/branches/stable@1253 54d463be-8e91-2dee-dedb-b68131a5f0ec
celest 20 年之前
父节点
当前提交
0b31d2f62b
共有 6 个文件被更改,包括 21 次插入5 次删除
  1. 2 0
      Changelog-SVN.txt
  2. 0 1
      src/map/map.h
  3. 2 2
      src/map/pc.c
  4. 15 0
      src/map/script.c
  5. 0 2
      src/map/status.c
  6. 2 0
      src/map/status.h

+ 2 - 0
Changelog-SVN.txt

@@ -1,6 +1,8 @@
 Date	Added
 
 03/19
+        * Added getrefine() for 3/15's card patch -- returns the refined number
+          of the current item [celest]
         * Fixed day and night settings not ignored even if they are set to 0,
           my bad ^^; [celest]
 

+ 0 - 1
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];

+ 2 - 2
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;
 				}

+ 15 - 0
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;
+}
+
 //
 // ŽÀ�s•”main
 //

+ 0 - 2
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;

+ 2 - 0
src/map/status.h

@@ -179,6 +179,8 @@ enum {	// struct map_session_data 
 };
 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);