From 201a9b5d634573e92df148deb58793441a3ece1b Mon Sep 17 00:00:00 2001 From: skotlex Date: Sat, 22 Apr 2006 05:21:24 +0000 Subject: - Added SC_KEEPING/SC_BARRIER to calc_flag in status_change_end - Added Option constants for Carts, fixed OPTION_FLYING (it conflicts with OPTION_XMAS?) - Updated clif.c to check for OPTION_WEDDING|OPTION_XMAS instead of view class to block attacks and skill usage. - Removed struct pc_base_job and functions pc_calc_base_job/pc_calc_base_job2 which are no longer used anywhere (were long ago deprecated infavor of the new jobid system) - Cleaned up change-cart code. - Modified SC_XMAS to not change your view anymore and only set the proper option value (OPTION_XMAS) - Cleaned up the code regarding char_gm reading. - Changed the option field to unsigned short to make room for the higher values. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6229 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 8 ++--- src/map/map.h | 13 ++++--- src/map/pc.c | 108 ++++--------------------------------------------------- src/map/pc.h | 8 ----- src/map/status.c | 11 ++++-- 5 files changed, 27 insertions(+), 121 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 6e01d7fed..27fff5618 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8591,7 +8591,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) { switch(action_type) { case 0x00: // once attack case 0x07: // continuous attack - if(sd->vd.class_ ==JOB_WEDDING || sd->vd.class_==JOB_XMAS) + if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS)) return; if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) { if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) { @@ -9363,7 +9363,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { return; } - if (sd->vd.class_ == JOB_WEDDING || sd->vd.class_ == JOB_XMAS) + if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS)) return; if (sd->invincible_timer != -1) @@ -9453,7 +9453,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, int skilll return; } - if (sd->vd.class_ == JOB_WEDDING || sd->vd.class_ == JOB_XMAS) + if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS)) return; if (sd->invincible_timer != -1) @@ -9517,7 +9517,7 @@ void clif_parse_UseSkillMap(int fd,struct map_session_data *sd) if (clif_cant_act(sd)) return; - if (sd->vd.class_==JOB_WEDDING || sd->vd.class_ == JOB_XMAS) + if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS)) return; if(sd->invincible_timer != -1) diff --git a/src/map/map.h b/src/map/map.h index 7e133a516..525b7dc5e 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -241,18 +241,21 @@ enum { #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_XMAS 0x8000 -#define OPTION_FLYING 0x8000 - +#define OPTION_FLYING 0x10000 //TODO: Get these Missing options... #define OPTION_SIGHTTRASHER 0x0001 @@ -409,7 +412,7 @@ struct status_change { struct status_change_entry data[MAX_STATUSCHANGE]; short count; short opt1,opt2,opt3; - short option; + unsigned short option; }; struct vending { diff --git a/src/map/pc.c b/src/map/pc.c index 371816c8b..0c40d1de4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3305,98 +3305,6 @@ int pc_checkequip(struct map_session_data *sd,int pos) return -1; } -/*========================================== - * ?生職や養子職の元の職業を返す - *------------------------------------------ - */ -struct pc_base_job pc_calc_base_job(int b_class) -{ - struct pc_base_job bj; - if(b_class < JOB_NOVICE_HIGH){ - if (b_class == JOB_KNIGHT2) - bj.job = JOB_KNIGHT; - else if (b_class == JOB_CRUSADER2) - bj.job = JOB_CRUSADER; - else - bj.job = b_class; - bj.upper = 0; - }else if(b_class >= JOB_NOVICE_HIGH && b_class <= JOB_PALADIN2){ //High Jobs - if (b_class == JOB_LORD_KNIGHT2) - bj.job = JOB_KNIGHT; - else if (b_class == JOB_PALADIN2) - bj.job = JOB_CRUSADER; - else - bj.job = b_class - JOB_NOVICE_HIGH; - bj.upper = 1; - }else if(b_class >= JOB_TAEKWON && b_class <= JOB_SOUL_LINKER){ - if (b_class == JOB_STAR_GLADIATOR2) - bj.job = 24 + JOB_STAR_GLADIATOR - JOB_TAEKWON; - else - bj.job = 24 + b_class - JOB_TAEKWON; - bj.upper = 0; - }else{ //Baby Classes - if (b_class == JOB_SUPER_BABY) - bj.job = JOB_SUPER_NOVICE; - else if (b_class == JOB_BABY_KNIGHT2) - bj.job = JOB_KNIGHT; - else if (b_class == JOB_BABY_CRUSADER2) - bj.job = JOB_CRUSADER; - else - bj.job = b_class - JOB_BABY; - bj.upper = 2; - } - - if(bj.job == JOB_NOVICE){ - bj.type = 0; - }else if(bj.job <= JOB_THIEF || bj.job == JOB_TAEKWON){ - bj.type = 1; - }else{ - bj.type = 2; - } - - return bj; -} - -/*========================================== - * For quick calculating [Celest] - *------------------------------------------ - */ -int pc_calc_base_job2 (int b_class) -{ - if(b_class < JOB_NOVICE_HIGH) - { - if (b_class == JOB_KNIGHT2) - return JOB_KNIGHT; - if (b_class == JOB_CRUSADER2) - return JOB_CRUSADER; - return b_class; - } - if(b_class >= JOB_NOVICE_HIGH && b_class < JOB_BABY) - { - if (b_class == JOB_LORD_KNIGHT2) - return JOB_KNIGHT; - if (b_class == JOB_PALADIN2) - return JOB_CRUSADER; - return b_class - JOB_NOVICE_HIGH; - } - if(b_class >= JOB_TAEKWON && b_class <= JOB_SOUL_LINKER ) - { - if (b_class == JOB_STAR_GLADIATOR2) - return 24 + JOB_STAR_GLADIATOR - JOB_TAEKWON; - return 24 + b_class - JOB_TAEKWON; - } - //Baby Classes - { - if (b_class == JOB_SUPER_BABY) - return JOB_SUPER_NOVICE; - if (b_class == JOB_BABY_KNIGHT2) - return JOB_KNIGHT; - if (b_class == JOB_BABY_CRUSADER2) - return JOB_CRUSADER; - return b_class - JOB_BABY; - } -} - /*========================================== * Convert's from the client's lame Job ID system * to the map server's 'makes sense' system. [Skotlex] @@ -5622,22 +5530,18 @@ int pc_setoption(struct map_session_data *sd,int type) */ int pc_setcart(struct map_session_data *sd,int type) { - int cart[6]={0x0000,0x0008,0x0080,0x0100,0x0200,0x0400}; - int option, i; + int cart[6]={0x0000,OPTION_CART1,OPTION_CART2,OPTION_CART3,OPTION_CART4,OPTION_CART5}; + int option; nullpo_retr(0, sd); if (type < 0 || type > 5) return 0; //Never trust the values sent by the client! [Skotlex] - option = sd->sc.option; - for (i = 0; i < 6; i++) - { //This should preserve the current option, only modifying the cart bit. - if (i == type) - option |= cart[i]; - else - option &= ~cart[i]; - } if(pc_checkskill(sd,MC_PUSHCART)>0){ // プッシュカ?トスキル所持 + option = sd->sc.option; + //This should preserve the current option, only modifying the cart bit. + option&=~(OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5); + option|=cart[type]; if(!pc_iscarton(sd)){ // カ?トを付けていない pc_setoption(sd,option); clif_cart_itemlist(sd); diff --git a/src/map/pc.h b/src/map/pc.h index 4a96893a6..9513bd176 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -212,14 +212,6 @@ int pc_set_gm_level(int account_id, int level); void pc_setstand(struct map_session_data *sd); int pc_candrop(struct map_session_data *sd,int item_id); -struct pc_base_job{ - int job; //職業、ただし転生職や養子職の場合は元の職業を返す(廃プリ→プリ) - int type; //ノビ 0, 一次職 1, 二次職 2, スパノビ 3 - int upper; //通常 0, 転生 1, 養子 2 -}; - -struct pc_base_job pc_calc_base_job(int b_class);//転生や養子職の元の職業を返す -int pc_calc_base_job2(int b_class); // Celest int pc_jobid2mapid(unsigned short b_class); // Skotlex int pc_mapid2jobid(unsigned short class_, int sex); // Skotlex diff --git a/src/map/status.c b/src/map/status.c index a4e47a97f..bdb12deb9 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4088,7 +4088,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val val2 = 5*(2+type-SC_ASPDPOTION0); break; - case SC_XMAS: // Xmas Suit [Valaris] case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) { struct view_data *vd = status_get_viewdata(bl); @@ -4746,6 +4745,9 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val case SC_SIGHTTRASHER: sc->option |= OPTION_SIGHTTRASHER; break; + case SC_XMAS: // Xmas Suit [Valaris] + sc->option |= OPTION_XMAS; + break; case SC_FUSION: sc->option |= OPTION_FLYING; break; @@ -4957,10 +4959,11 @@ int status_change_end( struct block_list* bl , int type,int tid ) case SC_SWOO: // [marquis007] case SC_SKA: // [marquis007] case SC_KNOWLEDGE: + case SC_KEEPING: + case SC_BARRIER: calc_flag = 1; break; - case SC_XMAS: // Xmas Suit [Valaris] case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか) { struct view_data *vd = status_get_viewdata(bl); @@ -5256,6 +5259,10 @@ int status_change_end( struct block_list* bl , int type,int tid ) sc->option &= ~OPTION_SIGHTTRASHER; opt_flag = 1; break; + case SC_XMAS: // Xmas Suit [Valaris] + sc->option &= ~OPTION_XMAS; + opt_flag = 1; + break; case SC_FUSION: sc->option &= ~OPTION_FLYING; opt_flag = 1; -- cgit v1.2.3-70-g09d2