summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-11 18:04:54 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-08-11 18:04:54 +0000
commit960472a38a2d354c0828527b3684bd7d49bd421c (patch)
tree8f09c2075877bc297b2d4e3c08a1ad719f149551 /src/map
parent2b3819b533ee287e694795d45695a17cb7bf2f10 (diff)
downloadhercules-960472a38a2d354c0828527b3684bd7d49bd421c.tar.gz
hercules-960472a38a2d354c0828527b3684bd7d49bd421c.tar.bz2
hercules-960472a38a2d354c0828527b3684bd7d49bd421c.tar.xz
hercules-960472a38a2d354c0828527b3684bd7d49bd421c.zip
Fixed bugreport:6456 repair scroll (#14587) is now fully functional, bug was due to the range being checked on pc_checkskill and it'd return 0 when the caster isn't a blacksmith class (or doesn't have repair weapon mastered), the skill level cast is now stored in (struct map_session_data)->menuskill_val2. special thanks to kyeme for his persistence
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16624 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c3
-rw-r--r--src/map/clif.h2
-rw-r--r--src/map/skill.c34
3 files changed, 23 insertions, 16 deletions
diff --git a/src/map/clif.c b/src/map/clif.c
index 882f91975..6b18dc917 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -5817,7 +5817,7 @@ void clif_item_identified(struct map_session_data *sd,int idx,int flag)
/// Presents a list of items that can be repaired (ZC_REPAIRITEMLIST).
/// 01fc <packet len>.W { <index>.W <name id>.W <refine>.B <card1>.W <card2>.W <card3>.W <card4>.W }*
-void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd)
+void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *dstsd, int lv)
{
int i,c;
int fd;
@@ -5844,6 +5844,7 @@ void clif_item_repair_list(struct map_session_data *sd,struct map_session_data *
WFIFOSET(fd,WFIFOW(fd,2));
sd->menuskill_id = BS_REPAIRWEAPON;
sd->menuskill_val = dstsd->bl.id;
+ sd->menuskill_val2 = lv;
}else
clif_skill_fail(sd,sd->ud.skillid,USESKILL_FAIL_LEVEL,0);
}
diff --git a/src/map/clif.h b/src/map/clif.h
index 1c768138a..385c1d4aa 100644
--- a/src/map/clif.h
+++ b/src/map/clif.h
@@ -468,7 +468,7 @@ void clif_clearcart(int fd);
void clif_item_identify_list(struct map_session_data *sd);
void clif_item_identified(struct map_session_data *sd,int idx,int flag);
-void clif_item_repair_list(struct map_session_data *sd, struct map_session_data *dstsd);
+void clif_item_repair_list(struct map_session_data *sd, struct map_session_data *dstsd, int lv);
void clif_item_repaireffect(struct map_session_data *sd, int idx, int flag);
void clif_item_damaged(struct map_session_data* sd, unsigned short position);
void clif_item_refine_list(struct map_session_data *sd);
diff --git a/src/map/skill.c b/src/map/skill.c
index 3865b55a0..fff7902d9 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -5906,7 +5906,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
case BS_REPAIRWEAPON:
if(sd && dstsd)
- clif_item_repair_list(sd,dstsd);
+ clif_item_repair_list(sd,dstsd,skilllv);
break;
case MC_IDENTIFY:
@@ -13725,45 +13725,51 @@ void skill_brandishspear(struct block_list* src, struct block_list* bl, int skil
/*==========================================
* Weapon Repair [Celest/DracoRPG]
*------------------------------------------*/
-void skill_repairweapon (struct map_session_data *sd, int idx)
-{
+void skill_repairweapon (struct map_session_data *sd, int idx) {
int material;
int materials[4] = { 1002, 998, 999, 756 };
struct item *item;
struct map_session_data *target_sd;
nullpo_retv(sd);
- target_sd = map_id2sd(sd->menuskill_val);
- if (!target_sd) //Failed....
+
+ if ( !( target_sd = map_id2sd(sd->menuskill_val) ) ) //Failed....
return;
- if(idx==0xFFFF) // No item selected ('Cancel' clicked)
+
+ if( idx == 0xFFFF ) // No item selected ('Cancel' clicked)
return;
- if(idx < 0 || idx >= MAX_INVENTORY)
+ if( idx < 0 || idx >= MAX_INVENTORY )
return; //Invalid index??
item = &target_sd->status.inventory[idx];
- if(item->nameid <= 0 || item->attribute == 0)
+ if( item->nameid <= 0 || item->attribute == 0 )
return; //Again invalid item....
- if(sd!=target_sd && !battle_check_range(&sd->bl,&target_sd->bl,skill_get_range2(&sd->bl, sd->menuskill_id,pc_checkskill(sd, sd->menuskill_id)))){
+ if( sd != target_sd && !battle_check_range(&sd->bl,&target_sd->bl, skill_get_range2(&sd->bl, sd->menuskill_id,sd->menuskill_val2) ) ){
clif_item_repaireffect(sd,idx,1);
return;
}
- if ( target_sd->inventory_data[idx]->type == IT_WEAPON)
- material = materials [itemdb_wlv(item->nameid)-1]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon
+ if ( target_sd->inventory_data[idx]->type == IT_WEAPON )
+ material = materials [ target_sd->inventory_data[idx]->wlv - 1 ]; // Lv1/2/3/4 weapons consume 1 Iron Ore/Iron/Steel/Rough Oridecon
else
material = materials [2]; // Armors consume 1 Steel
- if (pc_search_inventory(sd,material) < 0 ) {
+ if ( pc_search_inventory(sd,material) < 0 ) {
clif_skill_fail(sd,sd->menuskill_id,USESKILL_FAIL_LEVEL,0);
return;
}
+
clif_skill_nodamage(&sd->bl,&target_sd->bl,sd->menuskill_id,1,1);
- item->attribute=0;
+
+ item->attribute = 0;/* clear broken state */
+
clif_equiplist(target_sd);
+
pc_delitem(sd,pc_search_inventory(sd,material),1,0,0,LOG_TYPE_CONSUME);
+
clif_item_repaireffect(sd,idx,0);
- if(sd!=target_sd)
+
+ if( sd != target_sd )
clif_item_repaireffect(target_sd,idx,0);
}