Browse Source

- Cleaned up (fixed?) a possible overflow in pc_isUseitem, thanks to foobar.
- When you have the wrong ammo-type equipped the skill-failed message is now "skill can't be used with this weapon", which is less misleading than "please equip arrows first".
- Corrected pet-equipment display (I originally assumed they went in the shield view-position, when they actually go in the head-bottom position).


git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@5883 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 years ago
parent
commit
cabad21166
6 changed files with 30 additions and 10 deletions
  1. 9 0
      Changelog-Trunk.txt
  2. 2 2
      src/map/clif.c
  3. 1 1
      src/map/mob.c
  4. 8 2
      src/map/pc.c
  5. 7 2
      src/map/skill.c
  6. 3 3
      src/map/status.c

+ 9 - 0
Changelog-Trunk.txt

@@ -3,6 +3,15 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2006/04/03
+	* Cleaned up (fixed?) a possible overflow in pc_isUseitem, thanks to
+	  foobar. [Skotlex]
+	* When you have the wrong ammo-type equipped the skill-failed message is
+	  now "skill can't be used with this weapon", which is less misleading than
+	  "please equip arrows first". [Skotlex]
+	* Corrected pet-equipment display (I originally assumed they went in the
+	  shield view-position, when they actually go in the head-bottom position).
+	  [Skotlex]
 2006/04/02
 	* Fixed npc_gettimerevent_tick returning the difference since the last
 	  triggered label instead of total elapsed time for the npc-timer. [Skotlex]

+ 2 - 2
src/map/clif.c

@@ -946,7 +946,7 @@ static int clif_set0078(struct block_list *bl, struct view_data *vd, unsigned ch
 	}
 	WBUFW(buf,14)=vd->class_;
 	WBUFW(buf,16)=vd->hair_style;  //Required for pets.
-	WBUFW(buf,22)=vd->shield;	//Pet armor
+	WBUFW(buf,20)=vd->head_bottom;	//Pet armor
 	if (bl->type == BL_NPC && vd->class_ == 722)
 	{	//The hell, why flags work like this?
 		WBUFL(buf,22)=emblem_id;
@@ -1069,8 +1069,8 @@ static int clif_set007b(struct block_list *bl, struct view_data *vd, struct unit
 	}
 	WBUFW(buf,14)=vd->class_;
 	WBUFW(buf,16)=vd->hair_style; //For pets
+	WBUFW(buf,20)=vd->head_bottom;	//Pet armor
 	WBUFL(buf,22)=gettick();
-	WBUFW(buf,26)=vd->shield;	//Pet armor
 	WBUFW(buf,36)=unit_getdir(bl);
 	WBUFL(buf,38)=guild_id;
 	WBUFL(buf,42)=emblem_id;

+ 1 - 1
src/map/mob.c

@@ -3459,7 +3459,7 @@ static int mob_readdb_mobavail(void)
 			mob_db_data[class_]->vd.cloth_color=atoi(str[11]); // Monster player dye option - Valaris
 		}
 		else if(str[2] && atoi(str[2]) > 0)
-			mob_db_data[class_]->vd.shield=atoi(str[2]); // mob equipment [Valaris]
+			mob_db_data[class_]->vd.head_bottom=atoi(str[2]); // mob equipment [Valaris]
 
 		ln++;
 	}

+ 8 - 2
src/map/pc.c

@@ -2622,11 +2622,17 @@ int pc_isUseitem(struct map_session_data *sd,int n)
 		return 0;
 
 	//Not equipable by class. [Skotlex]
-	if (!(1<<(sd->class_&MAPID_BASEMASK)&item->class_base[(sd->class_&JOBL_2_1)?1:((sd->class_&JOBL_2_2)?2:0)]))
+	if (!(
+		(1<<(sd->class_&MAPID_BASEMASK)) &
+		(item->class_base[sd->class_&JOBL_2_1?1:(sd->class_&JOBL_2_2?2:0)])
+	))
 		return 0;
 	
 	//Not usable by upper class. [Skotlex]
-	if(!(1<<((sd->class_&JOBL_UPPER)?1:((sd->class_&JOBL_BABY)?2:0))&item->class_upper))
+	if(!(
+		(1<<(sd->class_&JOBL_UPPER?1:(sd->class_&JOBL_BABY?2:0))) &
+		item->class_upper
+	))
 		return 0;
 
 	//Dead Branch & Bloody Branch & Porings Box

+ 7 - 2
src/map/skill.c

@@ -8070,12 +8070,17 @@ int skill_check_condition(struct map_session_data *sd,int skill, int lv, int typ
 		if(ammo) { //Skill requires stuff equipped in the arrow slot.
 			if((i=sd->equip_index[10]) < 0 ||
 				!sd->inventory_data[i] ||
-				sd->status.inventory[i].amount < ammo_qty ||
-			  	!(ammo&1<<sd->inventory_data[i]->look)
+				sd->status.inventory[i].amount < ammo_qty
 			) {
 				clif_arrow_fail(sd,0);
 				return 0;
 			}
+			if (!(ammo&1<<sd->inventory_data[i]->look))
+			{	//Ammo type check. Send the "wrong weapon type" message
+				//which is the closest we have to wrong ammo type. [Skotlex]
+				clif_skill_fail(sd,skill,6,0);
+				return 0;
+			}
 		}
 		if( spiritball > 0 && sd->spiritball < spiritball) {
 			clif_skill_fail(sd,skill,0,0);		// Ÿ†‹…•s‘«

+ 3 - 3
src/map/status.c

@@ -3345,9 +3345,9 @@ void status_set_viewdata(struct block_list *bl, int class_)
 				if (!pcdb_checkid(vd->class_)) {
 					pd->vd.hair_style = battle_config.pet_hair_style;
 					if(pd->equip) {
-						pd->vd.shield = itemdb_viewid(pd->equip);
-						if (!pd->vd.shield)
-							pd->vd.shield = pd->equip;
+						pd->vd.head_bottom = itemdb_viewid(pd->equip);
+						if (!pd->vd.head_bottom)
+							pd->vd.head_bottom = pd->equip;
 					}
 				}
 			} else if (battle_config.error_log)