summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-23 23:31:55 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-23 23:31:55 +0000
commit81c7ec2433762f5473ee05ea1620954b24d9789b (patch)
tree3348f92b604ae4f0ddd2f34375607ec0804a6059 /src/map/pc.c
parentaf86b0e57fdfa0064770513b868834bf27cb5b56 (diff)
downloadhercules-81c7ec2433762f5473ee05ea1620954b24d9789b.tar.gz
hercules-81c7ec2433762f5473ee05ea1620954b24d9789b.tar.bz2
hercules-81c7ec2433762f5473ee05ea1620954b24d9789b.tar.xz
hercules-81c7ec2433762f5473ee05ea1620954b24d9789b.zip
- 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
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c46
1 files changed, 17 insertions, 29 deletions
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;
}