From 2f2066f741111325b2510c6526b41b22dea93370 Mon Sep 17 00:00:00 2001 From: skotlex Date: Thu, 15 Jun 2006 18:56:54 +0000 Subject: - Altered a bit how status_set_viewdata behaves in regards to Wedding/Xmas options. - Added back OPTION_XMAS, but the actual value is missing! - Corrected chrif_save so that the player is not set offline on map-change. - Added change-look support in pc_setoption when specifying OPTION_XMAS - Fixed clif_parse_RemoveOption removing all options instead of just Falcon/Cart/Peco git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@7183 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/chrif.c | 8 +++++--- src/map/clif.c | 7 ++++--- src/map/pc.c | 22 ++++++++++++++-------- src/map/status.c | 16 ++++++++++++---- src/map/status.h | 35 ++++++++++++++++++----------------- 5 files changed, 53 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/map/chrif.c b/src/map/chrif.c index ff88945a0..47704002f 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -175,7 +175,9 @@ int chrif_isconnect(void) } /*========================================== - * + * Saves char. + * Flag = 1: Character is quitting. + * Flag = 2: Character is changing map-servers *------------------------------------------ */ int chrif_save(struct map_session_data *sd, int flag) @@ -203,7 +205,7 @@ int chrif_save(struct map_session_data *sd, int flag) #ifndef TXT_ONLY if(charsave_method){ //New 'Local' save charsave_savechar(sd->char_id, &sd->status); - if (flag) chrif_char_offline(sd); //Tell char server that character went offline. + if (flag == 1) chrif_char_offline(sd); //Tell char server that character went offline. }else{ #endif WFIFOHEAD(char_fd, sizeof(sd->status) + 13); @@ -211,7 +213,7 @@ int chrif_save(struct map_session_data *sd, int flag) WFIFOW(char_fd,2) = sizeof(sd->status) + 13; WFIFOL(char_fd,4) = sd->bl.id; WFIFOL(char_fd,8) = sd->char_id; - WFIFOB(char_fd,12) = flag?1:0; //Flag to tell char-server this character is quitting. + WFIFOB(char_fd,12) = (flag==1)?1:0; //Flag to tell char-server this character is quitting. memcpy(WFIFOP(char_fd,13), &sd->status, sizeof(sd->status)); WFIFOSET(char_fd, WFIFOW(char_fd,2)); #ifndef TXT_ONLY diff --git a/src/map/clif.c b/src/map/clif.c index f895a7579..ba24dd3b1 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -2725,10 +2725,10 @@ int clif_changelook(struct block_list *bl,int type,int val) vd->hair_color = val; break; case LOOK_CLOTHES_COLOR: - if ( + if (val && ( (vd->class_ == JOB_WEDDING && battle_config.wedding_ignorepalette) || (vd->class_ == JOB_XMAS && battle_config.xmas_ignorepalette) - ) + )) val = 0; vd->cloth_color = val; break; @@ -9404,7 +9404,8 @@ void clif_parse_GetItemFromCart(int fd,struct map_session_data *sd) */ void clif_parse_RemoveOption(int fd,struct map_session_data *sd) { - pc_setoption(sd,0); + //Can only remove Cart/Riding/Falcon. + pc_setoption(sd,sd->sc.option&~(OPTION_CART|OPTION_RIDING|OPTION_FALCON)); } /*========================================== diff --git a/src/map/pc.c b/src/map/pc.c index 75fd227d1..b76856dcb 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3175,7 +3175,7 @@ int pc_setpos(struct map_session_data *sd,unsigned short mapindex,int x,int y,in unit_remove_map(&sd->pd->bl, clrtype); intif_save_petdata(sd->status.account_id,&sd->pet); } - chrif_save(sd,1); + chrif_save(sd,2); chrif_changemapserver(sd, mapindex, x, y, ip, (short)port); return 0; } @@ -5498,15 +5498,21 @@ int pc_setoption(struct map_session_data *sd,int type) clif_changelook(&sd->bl,LOOK_BASE,JOB_WEDDING); else if (!(type&OPTION_WEDDING) && p_type&OPTION_WEDDING) { - if (sd->vd.class_ != sd->status.class_) { - 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); - } + 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); } - clif_changeoption(&sd->bl); + if (type&OPTION_XMAS && !(p_type&OPTION_XMAS)) + clif_changelook(&sd->bl,LOOK_BASE,JOB_XMAS); + else if (!(type&OPTION_XMAS) && p_type&OPTION_XMAS) + { + 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); + } return 0; } diff --git a/src/map/status.c b/src/map/status.c index 7fc090dd1..7e7cadfb6 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -3712,6 +3712,12 @@ void status_set_viewdata(struct block_list *bl, int class_) { TBL_PC* sd = (TBL_PC*)bl; if (pcdb_checkid(class_)) { + if (sd->sc.option&OPTION_WEDDING) + class_ = JOB_WEDDING; + else + if (sd->sc.option&OPTION_XMAS) + class_ = JOB_XMAS; + else if (sd->sc.option&OPTION_RIDING) switch (class_) { //Adapt class to a Mounted one. @@ -3734,10 +3740,6 @@ void status_set_viewdata(struct block_list *bl, int class_) class_ = JOB_BABY_CRUSADER2; break; } - if (class_ == JOB_WEDDING) - sd->sc.option|=OPTION_WEDDING; - else if (sd->sc.option&OPTION_WEDDING) - sd->sc.option&=~OPTION_WEDDING; //If not going to display it, then remove the option. sd->vd.class_ = class_; clif_get_weapon_view(sd, &sd->vd.weapon, &sd->vd.shield); sd->vd.head_top = sd->status.head_top; @@ -5264,6 +5266,9 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val case SC_WEDDING: sc->option |= OPTION_WEDDING; break; + case SC_XMAS: + sc->option |= OPTION_XMAS; + break; case SC_ORCISH: sc->option |= OPTION_ORCISH; break; @@ -5661,6 +5666,9 @@ int status_change_end( struct block_list* bl , int type,int tid ) case SC_WEDDING: sc->option &= ~OPTION_WEDDING; break; + case SC_XMAS: + sc->option &= ~OPTION_XMAS; + break; case SC_ORCISH: sc->option &= ~OPTION_ORCISH; break; diff --git a/src/map/status.h b/src/map/status.h index 5a454c855..b02aeeec6 100644 --- a/src/map/status.h +++ b/src/map/status.h @@ -455,24 +455,25 @@ enum { #define OPT3_AURASHIELD 0x800 //Assumptio #define OPT3_HEAT 0x1000 //Warmth Skills -#define OPTION_SIGHT 0x0001 -#define OPTION_HIDE 0x0002 -#define OPTION_CLOAK 0x0004 -#define OPTION_CART1 0x0008 -#define OPTION_FALCON 0x0010 -#define OPTION_RIDING 0x0020 -#define OPTION_INVISIBLE 0x0040 -#define OPTION_CART2 0x0080 -#define OPTION_CART3 0x0100 -#define OPTION_CART4 0x0200 -#define OPTION_CART5 0x0400 -#define OPTION_ORCISH 0x0800 -#define OPTION_WEDDING 0x1000 -#define OPTION_RUWACH 0x2000 -#define OPTION_CHASEWALK 0x4000 -#define OPTION_FLYING 0x8000 +#define OPTION_SIGHT 0x00000001 +#define OPTION_HIDE 0x00000002 +#define OPTION_CLOAK 0x00000004 +#define OPTION_CART1 0x00000008 +#define OPTION_FALCON 0x00000010 +#define OPTION_RIDING 0x00000020 +#define OPTION_INVISIBLE 0x00000040 +#define OPTION_CART2 0x00000080 +#define OPTION_CART3 0x00000100 +#define OPTION_CART4 0x00000200 +#define OPTION_CART5 0x00000400 +#define OPTION_ORCISH 0x00000800 +#define OPTION_WEDDING 0x00001000 +#define OPTION_RUWACH 0x00002000 +#define OPTION_CHASEWALK 0x00004000 +#define OPTION_FLYING 0x00008000 //TODO: Get these Missing options... -#define OPTION_SIGHTTRASHER 0x0001 +#define OPTION_SIGHTTRASHER 0x00010000 +#define OPTION_XMAS 0x0020000 #define OPTION_CART (OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5) -- cgit v1.2.3-70-g09d2