From 81c7ec2433762f5473ee05ea1620954b24d9789b Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 23 Jun 2006 23:31:55 +0000 Subject: - Modified pc_setoption so that it will correctly update sprite AND clothes color when mounting/unmounting changing into/from xmas/wedding sprites. - Allowed itemdb_exists to return the dummy item. Enables "invalid" items to be sold, traded, dropped, etc. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7321 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/itemdb.c | 2 +- src/map/pc.c | 46 +++++++++++++++++----------------------------- 2 files changed, 18 insertions(+), 30 deletions(-) (limited to 'src') diff --git a/src/map/itemdb.c b/src/map/itemdb.c index a577b1baa..7651535f1 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -135,7 +135,7 @@ int itemdb_group (int nameid) struct item_data* itemdb_exists(int nameid) { struct item_data* id = idb_get(item_db,nameid); - if (id == &dummy_item) return NULL; +// if (id == &dummy_item) return NULL; //Let dummy items go through... technically they "exist" because someone already has them... return id; } diff --git a/src/map/pc.c b/src/map/pc.c index 86c94e73a..ee163433f 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5476,7 +5476,7 @@ int pc_changelook(struct map_session_data *sd,int type,int val) */ int pc_setoption(struct map_session_data *sd,int type) { - int p_type; + int p_type, new_look=0; nullpo_retr(0, sd); p_type = sd->sc.option; @@ -5486,20 +5486,13 @@ int pc_setoption(struct map_session_data *sd,int type) if (type&OPTION_RIDING && !(p_type&OPTION_RIDING) && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN) { //We are going to mount. [Skotlex] - status_set_viewdata(&sd->bl, sd->status.class_); //Adjust view class. - clif_changelook(&sd->bl,LOOK_BASE,sd->vd.class_); - if (sd->vd.cloth_color) - clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); + new_look = -1; clif_status_load(&sd->bl,SI_RIDING,1); status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds. } else if (!(type&OPTION_RIDING) && p_type&OPTION_RIDING && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN) { //We are going to dismount. - if (sd->vd.class_ != sd->status.class_) { - status_set_viewdata(&sd->bl, sd->status.class_); - clif_changelook(&sd->bl,LOOK_BASE,sd->vd.class_); - clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); - } + new_look = -1; clif_status_load(&sd->bl,SI_RIDING,0); status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds. } @@ -5520,33 +5513,28 @@ int pc_setoption(struct map_session_data *sd,int type) clif_status_load(&sd->bl,SI_FALCON,0); if (type&OPTION_FLYING && !(p_type&OPTION_FLYING)) - clif_changelook(&sd->bl,LOOK_BASE,JOB_STAR_GLADIATOR2); + new_look = JOB_STAR_GLADIATOR2; else if (!(type&OPTION_FLYING) && p_type&OPTION_FLYING) - { - status_set_viewdata(&sd->bl, sd->status.class_); - clif_changelook(&sd->bl,LOOK_BASE,sd->vd.class_); - if(sd->status.clothes_color) - clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->status.clothes_color); - } + new_look = -1; if (type&OPTION_WEDDING && !(p_type&OPTION_WEDDING)) - clif_changelook(&sd->bl,LOOK_BASE,JOB_WEDDING); + new_look = JOB_WEDDING; else if (!(type&OPTION_WEDDING) && p_type&OPTION_WEDDING) - { - status_set_viewdata(&sd->bl, sd->status.class_); - clif_changelook(&sd->bl,LOOK_BASE,sd->vd.class_); - if(sd->status.clothes_color) - clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->status.clothes_color); - } + new_look = -1; if (type&OPTION_XMAS && !(p_type&OPTION_XMAS)) - clif_changelook(&sd->bl,LOOK_BASE,JOB_XMAS); + new_look = JOB_XMAS; else if (!(type&OPTION_XMAS) && p_type&OPTION_XMAS) - { + new_look = -1; + + if (new_look < 0) { //Restore normal look. status_set_viewdata(&sd->bl, sd->status.class_); - clif_changelook(&sd->bl,LOOK_BASE,sd->vd.class_); - if(sd->status.clothes_color) - clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->status.clothes_color); + new_look = sd->vd.class_; + } + if (new_look) { + clif_changelook(&sd->bl,LOOK_BASE,new_look); + if (sd->vd.cloth_color) + clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color); } return 0; } -- cgit v1.2.3-70-g09d2