Преглед на файлове

- Added a check in pc_equipitem so that when switching weapons and you have the skill_range_by_weapon setting active, the skill info block (which includes range) will be resent when the new weapon to equip has a range different than the previous one.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@7599 54d463be-8e91-2dee-dedb-b68131a5f0ec
skotlex преди 19 години
родител
ревизия
9445ee19ec
променени са 2 файла, в които са добавени 19 реда и са изтрити 3 реда
  1. 4 0
      Changelog-Trunk.txt
  2. 15 3
      src/map/pc.c

+ 4 - 0
Changelog-Trunk.txt

@@ -4,6 +4,10 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2006/07/10
+	* Added a check in pc_equipitem so that when switching weapons and you have
+	  the skill_range_by_weapon setting active, the skill info block (which
+	  includes range) will be resent when the new weapon to equip has a range
+	  different than the previous one. [Skotlex]
 	* One closer inspection, removed that clear in itemdb_reload for a foreach
 	  call again. And modified itemdb_load to scrap the dummy item entry from the
 	  item_db and replace it with proper data for the item. [Skotlex]

+ 15 - 3
src/map/pc.c

@@ -6109,7 +6109,7 @@ int pc_cleareventtimer(struct map_session_data *sd)
  */
 int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
 {
-	int i,pos;
+	int i,pos,flag=0;
 	struct item_data *id;
 
 	nullpo_retr(0, sd);
@@ -6130,7 +6130,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
 		clif_equipitemack(sd,n,0,0);	// fail
 		return 0;
 	}
-
+	
 	if(pos == EQP_ACC) { //Accesories should only go in one of the two,
 		pos = req_pos&EQP_ACC;
 		if (pos == EQP_ACC) //User specified both slots.. 
@@ -6146,8 +6146,17 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
 			pos = sd->equip_index[EQI_HAND_R] >= 0 ? EQP_HAND_L : EQP_HAND_R;
 	}
 	
-	for(i=0;i<EQI_MAX;i++) {
 
+	if (pos&EQP_HAND_R && battle_config.use_weapon_skill_range)
+	{	//Update skill-block range database when weapon range changes. [Skotlex]
+		i = sd->equip_index[EQI_HAND_R];
+		if (i < 0 || !sd->inventory_data[i]) //No data, or no weapon equipped
+			flag = 1;
+		else
+			flag = id->range != sd->inventory_data[i]->range;
+	}
+
+	for(i=0;i<EQI_MAX;i++) {
 		if(pos & equip_pos[i]) {
 			if(sd->equip_index[i] >= 0) //Slot taken, remove item from there.
 				pc_unequipitem(sd,sd->equip_index[i],2);
@@ -6229,6 +6238,9 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
 	}
 */
 	status_calc_pc(sd,0);
+	if (flag) //Update skill data
+		clif_skillinfoblock(sd);
+
 	//OnEquip script [Skotlex]
 	if (sd->inventory_data[n]) {
 		int i;