From 33c862fabb849bbd93ef0bbba4688c149aefeccf Mon Sep 17 00:00:00 2001 From: skotlex Date: Mon, 3 Apr 2006 14:13:13 +0000 Subject: - 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://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5883 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 4 ++-- src/map/mob.c | 2 +- src/map/pc.c | 10 ++++++++-- src/map/skill.c | 9 +++++++-- src/map/status.c | 6 +++--- 5 files changed, 21 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/map/clif.c b/src/map/clif.c index 28a9e230f..7aa584d9c 100644 --- a/src/map/clif.c +++ b/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; diff --git a/src/map/mob.c b/src/map/mob.c index 077fe7fa8..c5d9c44e5 100644 --- a/src/map/mob.c +++ b/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++; } diff --git a/src/map/pc.c b/src/map/pc.c index b52b48a1f..227b4a9ed 100644 --- a/src/map/pc.c +++ b/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 diff --git a/src/map/skill.c b/src/map/skill.c index 5540a4790..fcb0547af 100644 --- a/src/map/skill.c +++ b/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<inventory_data[i]->look) + sd->status.inventory[i].amount < ammo_qty ) { clif_arrow_fail(sd,0); return 0; } + if (!(ammo&1<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‘« diff --git a/src/map/status.c b/src/map/status.c index cb97017b1..312b6a6f1 100644 --- a/src/map/status.c +++ b/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) -- cgit v1.2.3-70-g09d2