diff options
author | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-13 04:25:58 +0000 |
---|---|---|
committer | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-13 04:25:58 +0000 |
commit | 67dc0c7a4ade3c375dd8fc3e721ecea00152904d (patch) | |
tree | a779254454f7e42bba9307feceb3b372357d9c58 /src/map/pc.c | |
parent | 2a016f61728aedb1599b746ccc27a5773e8baf55 (diff) | |
download | hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.tar.gz hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.tar.bz2 hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.tar.xz hercules-67dc0c7a4ade3c375dd8fc3e721ecea00152904d.zip |
Merged jA's equipment breaking system into the current one
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1099 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 77 |
1 files changed, 8 insertions, 69 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 9134b40f6..af2297083 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -583,10 +583,11 @@ int pc_break_equip(struct map_session_data *sd, unsigned short where) int sc; char output[255]; - if(sd == NULL) - return -1; + nullpo_retr(-1, sd); if(sd->unbreakable_equip & where) return 0; + if(sd->unbreakable >= rand()%100) + return 0; switch (where) { case EQP_WEAPON: sc = SC_CP_WEAPON; @@ -603,88 +604,26 @@ int pc_break_equip(struct map_session_data *sd, unsigned short where) default: return 0; } - if( sd->sc_data && sd->sc_data[sc].timer != -1 ) + if(sd->sc_count && sd->sc_data[sc].timer != -1) return 0; for (i=0;i<MAX_INVENTORY;i++) { - if (sd->status.inventory[i].equip & where) { + if (sd->status.inventory[i].equip & where && + !sd->status.inventory[i].attribute == 1) { item=sd->inventory_data[i]; sd->status.inventory[i].attribute = 1; - pc_unequipitem(sd,i,0); - sprintf(output, "%s has broken.",item->jname); - clif_emotion(&sd->bl,23); - clif_displaymessage(sd->fd, output); - clif_equiplist(sd); - break; - } - } - - return 0; -} - -/*========================================== - * Weapon Breaking [Valaris] - *------------------------------------------ - */ -int pc_breakweapon(struct map_session_data *sd) -{ - struct item_data* item; - char output[255]; - int i; - - if(sd==NULL) - return -1; - if(sd->unbreakable>=rand()%100) - return 0; - if(sd->sc_count && sd->sc_data[SC_CP_WEAPON].timer != -1) - return 0; - - for(i=0;i<MAX_INVENTORY;i++){ - if(sd->status.inventory[i].equip && sd->status.inventory[i].equip & 0x0002 && !sd->status.inventory[i].attribute==1){ - item=sd->inventory_data[i]; - sd->status.inventory[i].attribute=1; pc_unequipitem(sd,i,3); sprintf(output, "%s has broken.",item->jname); clif_emotion(&sd->bl,23); clif_displaymessage(sd->fd, output); clif_equiplist(sd); - return 1; + break; } } - return 0; + return 1; } -/*========================================== - * Armor Breaking [Valaris] - *------------------------------------------ - */ -int pc_breakarmor(struct map_session_data *sd) -{ - struct item_data* item; - char output[255]; - int i; - if(sd==NULL) - return -1; - if(sd->unbreakable>=rand()%100) - return 0; - if(sd->sc_count && sd->sc_data[SC_CP_ARMOR].timer != -1) - return 0; - - for(i=0;i<MAX_INVENTORY;i++){ - if(sd->status.inventory[i].equip && sd->status.inventory[i].equip & 0x0010 && !sd->status.inventory[i].attribute==1){ - item=sd->inventory_data[i]; - sd->status.inventory[i].attribute=1; - pc_unequipitem(sd,i,3); - sprintf(output, "%s has broken.",item->jname); - clif_emotion(&sd->bl,23); - clif_displaymessage(sd->fd, output); - clif_equiplist(sd); - } - } - - return 0; -} /*========================================== * session idに問題無し * char鯖から送られてきたステ?タスを設定 |