diff options
author | shennetsind <ind@henn.et> | 2013-05-07 19:02:38 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-05-07 19:02:38 -0300 |
commit | 36383ebd1423d2c8f6e0495046de27708160109c (patch) | |
tree | 677058ef25197255ccf131e531382b697cc15f2f /src | |
parent | d95d6891713747e058b2cedf7e5811a6918f71d4 (diff) | |
download | hercules-36383ebd1423d2c8f6e0495046de27708160109c.tar.gz hercules-36383ebd1423d2c8f6e0495046de27708160109c.tar.bz2 hercules-36383ebd1423d2c8f6e0495046de27708160109c.tar.xz hercules-36383ebd1423d2c8f6e0495046de27708160109c.zip |
Cart Fix
cart 'items' button no longer remains visible after the cart has been removed. -- Special Thanks to Wolfed.
Improved status change end, now only sends the termination packet to those that matter, as opposed to always sending to those nearby, and made it smaller.
Made possible thanks to super awesome Yommy :3
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r-- | src/map/atcommand.c | 5 | ||||
-rw-r--r-- | src/map/clif.c | 23 | ||||
-rw-r--r-- | src/map/clif.h | 1 | ||||
-rw-r--r-- | src/map/packets.h | 5 | ||||
-rw-r--r-- | src/map/packets_struct.h | 8 | ||||
-rw-r--r-- | src/map/pc.c | 30 | ||||
-rw-r--r-- | src/map/skill.c | 16 | ||||
-rw-r--r-- | src/map/status.c | 34 | ||||
-rw-r--r-- | src/map/unit.c | 8 |
9 files changed, 62 insertions, 68 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 5b82666fb..33e0d03cb 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2244,7 +2244,10 @@ ACMD(displaystatus) if (i < 2) flag = 1; if (i < 3) tick = 0; - clif->status_change(&sd->bl, type, flag, tick, val1, val2, val3); + if( flag == 0 ) + clif->sc_end(&sd->bl,sd->bl.id,AREA,type); + else + clif->status_change(&sd->bl, type, flag, tick, val1, val2, val3); return true; } diff --git a/src/map/clif.c b/src/map/clif.c index 5626122cb..8837dc274 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -4353,8 +4353,6 @@ void clif_getareachar_unit(struct map_session_data* sd,struct block_list *bl) { clif->specialeffect_single(bl,421,sd->fd); if( tsd->bg_id && map[tsd->bl.m].flag.battleground ) clif->sendbgemblem_single(sd->fd,tsd); - if( tsd->sc.data[SC_CAMOUFLAGE] ) - clif->status_change(bl, SI_CAMOUFLAGE, 1, 0, 0, 0, 0); if ( tsd->status.robe ) clif->refreshlook(&sd->bl,bl->id,LOOK_ROBE,tsd->status.robe,SELF); } @@ -9432,7 +9430,6 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if (sd->sc.option&OPTION_FALCON) clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); - if (sd->sc.option&OPTION_RIDING) clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); else if (sd->sc.option&OPTION_WUGRIDER) @@ -9495,11 +9492,11 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if( night_flag && map[sd->bl.m].flag.nightenabled ) { //Display night. if( !sd->state.night ) { sd->state.night = 1; - clif->status_change(&sd->bl, SI_NIGHT, 1, 0, 0, 0, 0); + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_NIGHT); } } else if( sd->state.night ) { //Clear night display. sd->state.night = 0; - clif->status_change(&sd->bl, SI_NIGHT, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_NIGHT); } if( map[sd->bl.m].flag.battleground ) { @@ -9543,8 +9540,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) if(map[sd->bl.m].flag.loadevent) // Lance npc_script_event(sd, NPCE_LOADMAP); - if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd)) - clif->status_change(&sd->bl, SI_DEVIL, 0, 0, 0, 0, 0); //blindness [Komurka] + if (pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd)) //blindness [Komurka] + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL); if (sd->sc.opt2) //Client loses these on warp. clif->changeoption(&sd->bl); @@ -16797,6 +16794,17 @@ void clif_partytickack(struct map_session_data* sd, bool flag) { WFIFOSET(sd->fd, packet_len(0x2c9)); } +void clif_status_change_end(struct block_list *bl, int tid, enum send_target target, int type) { + struct packet_status_change_end p; + + p.PacketType = status_change_endType; + p.index = type; + p.AID = tid; + p.state = 0; + + clif->send(&p,sizeof(p), bl, target); +} + /*========================================== * Main client packet processing function *------------------------------------------*/ @@ -17199,6 +17207,7 @@ void clif_defaults(void) { clif->autoshadowspell_list = clif_autoshadowspell_list; clif->skill_itemlistwindow = clif_skill_itemlistwindow; clif->sc_load = clif_status_change2; + clif->sc_end = clif_status_change_end; clif->initialstatus = clif_initialstatus; /* player-unit-specific-related */ clif->updatestatus = clif_updatestatus; diff --git a/src/map/clif.h b/src/map/clif.h index e8882d4f9..d8b4876de 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -597,6 +597,7 @@ struct clif_interface { int (*autoshadowspell_list) (struct map_session_data *sd); int (*skill_itemlistwindow) ( struct map_session_data *sd, uint16 skill_id, uint16 skill_lv ); void (*sc_load) (struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3); + void (*sc_end) (struct block_list *bl, int tid, enum send_target target, int type); void (*initialstatus) (struct map_session_data *sd); /* player-unit-specific-related */ void (*updatestatus) (struct map_session_data *sd,int type); diff --git a/src/map/packets.h b/src/map/packets.h index e801acd5e..997729b8c 100644 --- a/src/map/packets.h +++ b/src/map/packets.h @@ -2040,11 +2040,6 @@ packet(0x020d,-1); packet(0x0364,8,clif->pMoveFromKafra,2,4); #endif -//2013-03-13 (special thanks to Yommy!) -#if PACKETVER >= 20130313 - packet(0x0360,6,clif->pReqClickBuyingStore,2); -#endif - //2013-03-20Ragexe (Judas + Yommy) #if PACKETVER >= 20130320 // Shuffle Start diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 1ab296d40..c873d3ad3 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -51,6 +51,7 @@ enum packet_headers { status_changeType = sc_notickType,/* 0x196 */ #endif status_change2Type = 0x43f, + status_change_endType = 0x196, #if PACKETVER < 4 spawn_unitType = 0x79, #elif PACKETVER < 7 @@ -353,6 +354,13 @@ struct packet_status_change { #endif } __attribute__((packed)); +struct packet_status_change_end { + short PacketType; + short index; + unsigned int AID; + unsigned char state; +} __attribute__((packed)); + struct packet_status_change2 { short PacketType; short index; diff --git a/src/map/pc.c b/src/map/pc.c index d5d5efb3b..543132d53 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6320,8 +6320,8 @@ int pc_resetskill(struct map_session_data* sd, int flag) if( (sd->class_&MAPID_UPPERMASK) == MAPID_TAEKWON && sd->status.base_level >= 90 && pc_famerank(sd->status.char_id, MAPID_TAEKWON) ) return 0; - if( pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd) ) - clif->status_change(&sd->bl, SI_DEVIL, 0, 0, 0, 0, 0); //Remove perma blindness due to skill-reset. [Skotlex] + if( pc_checkskill(sd, SG_DEVIL) && !pc_nextjobexp(sd) ) //Remove perma blindness due to skill-reset. [Skotlex] + clif->sc_end(&sd->bl, sd->bl.id, SELF, SI_DEVIL); i = sd->sc.option; if( i&OPTION_RIDING && (!pc_checkskill(sd, KN_RIDING) || (sd->class_&MAPID_THIRDMASK) == MAPID_RUNE_KNIGHT) ) i &= ~OPTION_RIDING; @@ -6619,7 +6619,7 @@ int pc_dead(struct map_session_data *sd,struct block_list *src) /* e.g. not killed thru pc_damage */ if( pc_issit(sd) ) { - clif->status_change(&sd->bl, SI_SIT, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_SIT); } pc_setdead(sd); @@ -7604,14 +7604,13 @@ int pc_setoption(struct map_session_data *sd,int type) sd->sc.option=type; clif->changeoption(&sd->bl); - if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && pc_checkskill(sd,RK_DRAGONTRAINING) > 0) ) - { // Mounting - clif->status_change(&sd->bl, SI_RIDING, 1, 0, 0, 0, 0); + if( (type&OPTION_RIDING && !(p_type&OPTION_RIDING)) || (type&OPTION_DRAGON && !(p_type&OPTION_DRAGON) && pc_checkskill(sd,RK_DRAGONTRAINING) > 0) ) { + // Mounting + clif->sc_load(&sd->bl,sd->bl.id,AREA,SI_RIDING, 0, 0, 0); status_calc_pc(sd,0); - } - else if( (!(type&OPTION_RIDING) && p_type&OPTION_RIDING) || (!(type&OPTION_DRAGON) && p_type&OPTION_DRAGON) ) - { // Dismount - clif->status_change(&sd->bl, SI_RIDING, 0, 0, 0, 0, 0); + } else if( (!(type&OPTION_RIDING) && p_type&OPTION_RIDING) || (!(type&OPTION_DRAGON) && p_type&OPTION_DRAGON) ) { + // Dismount + clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_RIDING); status_calc_pc(sd,0); } @@ -7629,16 +7628,16 @@ int pc_setoption(struct map_session_data *sd,int type) #endif if (type&OPTION_FALCON && !(p_type&OPTION_FALCON)) //Falcon ON - clif->status_change(&sd->bl, SI_FALCON, 1, 0, 0, 0, 0); + clif->sc_load(&sd->bl,sd->bl.id,AREA,SI_FALCON, 0, 0, 0); else if (!(type&OPTION_FALCON) && p_type&OPTION_FALCON) //Falcon OFF - clif->status_change(&sd->bl, SI_FALCON, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_FALCON); if( (sd->class_&MAPID_THIRDMASK) == MAPID_RANGER ) { if( type&OPTION_WUGRIDER && !(p_type&OPTION_WUGRIDER) ) { // Mounting - clif->status_change(&sd->bl, SI_WUGRIDER, 1, 0, 0, 0, 0); + clif->sc_load(&sd->bl,sd->bl.id,AREA,SI_WUGRIDER, 0, 0, 0); status_calc_pc(sd,0); } else if( !(type&OPTION_WUGRIDER) && p_type&OPTION_WUGRIDER ) { // Dismount - clif->status_change(&sd->bl, SI_WUGRIDER, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_WUGRIDER); status_calc_pc(sd,0); } } @@ -7711,6 +7710,7 @@ int pc_setcart(struct map_session_data *sd,int type) { return 0; status_change_end(&sd->bl,SC_PUSH_CART,INVALID_TIMER); clif->clearcart(sd->fd); + clif->updatestatus(sd, SP_CARTINFO); break; default:/* everything else is an allowed ID so we can move on */ if( !sd->sc.data[SC_PUSH_CART] ) /* first time, so fill cart data */ @@ -9188,7 +9188,7 @@ void pc_setstand(struct map_session_data *sd){ nullpo_retv(sd); status_change_end(&sd->bl, SC_TENSIONRELAX, INVALID_TIMER); - clif->status_change(&sd->bl, SI_SIT, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_SIT); //Reset sitting tick. sd->ssregen.tick.hp = sd->ssregen.tick.sp = 0; sd->state.dead_sit = sd->vd.dead_sit = 0; diff --git a/src/map/skill.c b/src/map/skill.c index d29861f4c..c17004793 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -158,12 +158,12 @@ int skill_get_index( uint16 skill_id ) { else if( skill_id > 1019 && skill_id < 8001 ) { if( skill_id < 2058 ) // 1020 - 2000 are empty skill_id = 1020 + skill_id - 2001; - else if( skill_id < 2549 ) // 2058 - 2200 are empty - skill_id = (1020+56) + skill_id - 2201; - else if ( skill_id < 3036 ) // 2549 - 3000 are empty - skill_id = (1020+56+348) + skill_id - 3001; - else if ( skill_id < 5019 ) // 3036 - 5000 are empty - skill_id = (1020+56+348+35) + skill_id - 5001; + else if( skill_id < 2549 ) // 2058 - 2200 are empty - 1020+57 + skill_id = (1077) + skill_id - 2201; + else if ( skill_id < 3036 ) // 2549 - 3000 are empty - 1020+57+348 + skill_id = (1425) + skill_id - 3001; + else if ( skill_id < 5019 ) // 3036 - 5000 are empty - 1020+57+348+35 + skill_id = (1460) + skill_id - 5001; else ShowWarning("skill_get_index: skill id '%d' is not being handled!\n",skill_id); } @@ -14382,9 +14382,9 @@ int skill_sit (struct map_session_data *sd, int type) } if( type ) { - clif->status_change(&sd->bl, SI_SIT, 1, 0, 0, 0, 0); + clif->sc_load(&sd->bl,sd->bl.id,SELF,SI_SIT,0,0,0); } else { - clif->status_change(&sd->bl, SI_SIT, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_SIT); } if (!flag) return 0; diff --git a/src/map/status.c b/src/map/status.c index 3524430e5..aab2d3b18 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -2353,7 +2353,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first) memset (&sd->left_weapon.overrefine, 0, sizeof(sd->left_weapon) - sizeof(sd->left_weapon.atkmods)); if (sd->special_state.intravision && !sd->sc.data[SC_INTRAVISION]) //Clear intravision as long as nothing else is using it - clif->status_change(&sd->bl, SI_INTRAVISION, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl,sd->bl.id,SELF,SI_INTRAVISION); memset(&sd->special_state,0,sizeof(sd->special_state)); memset(&status->max_hp, 0, sizeof(struct status_data)-(sizeof(status->hp)+sizeof(status->sp))); @@ -8629,31 +8629,9 @@ int status_change_start(struct block_list* bl,enum sc_type type,int rate,int val case SC_ALL_RIDING: dval1 = 1; break; - case SC_SPHERE_1: - case SC_SPHERE_2: - case SC_SPHERE_3: - case SC_SPHERE_4: - case SC_SPHERE_5: - case SC_PUSH_CART: - case SC_CAMOUFLAGE: - case SC_DUPLELIGHT: - case SC_ORATIO: - case SC_FREEZING: - case SC_VENOMIMPRESS: - case SC_HALLUCINATIONWALK: - case SC_ROLLINGCUTTER: - case SC_BANDING: - case SC_CRYSTALIZE: - case SC_DEEPSLEEP: - case SC_CURSEDCIRCLE_ATKER: - case SC_CURSEDCIRCLE_TARGET: - case SC_BLOODSUCKER: - case SC__SHADOWFORM: - case SC__MANHOLE: + default: /* all others: just copy val1 */ dval1 = val1; break; - /* handle */ - default: break; } status_display_add(sd,type,dval1,dval2,dval3); } @@ -9325,7 +9303,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const } if((sce->val1&0xFFFF) == CG_MOONLIT) - clif->status_change(bl,SI_MOONLIT,0,0,0,0,0); + clif->sc_end(bl,bl->id,AREA,SI_MOONLIT); status_change_end(bl, SC_LONGING, INVALID_TIMER); } @@ -9580,8 +9558,8 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const } break; case SC_KYOUGAKU: - clif->status_change(bl, SI_KYOUGAKU, 0, 0, 0, 0, 0); // Avoid client crash - clif->status_change(bl, SI_ACTIVE_MONSTER_TRANSFORM, 0, 0, 0, 0, 0); + clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_KYOUGAKU); + clif->sc_end(&sd->bl,sd->bl.id,AREA,SI_ACTIVE_MONSTER_TRANSFORM); break; case SC_INTRAVISION: calc_flag = SCB_ALL;/* required for overlapping */ @@ -9761,7 +9739,7 @@ int status_change_end_(struct block_list* bl, enum sc_type type, int tid, const } //On Aegis, when turning off a status change, first goes the sc packet, then the option packet. - clif->status_change(bl,StatusIconChangeTable[type],0,0,0,0,0); + clif->sc_end(bl,bl->id,AREA,StatusIconChangeTable[type]); if( opt_flag&8 ) //bugreport:681 clif->changeoption2(bl); diff --git a/src/map/unit.c b/src/map/unit.c index f614d2fa0..7a08d1b81 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -491,7 +491,7 @@ int unit_run(struct block_list *bl) if( (to_x == bl->x && to_y == bl->y ) || (to_x == (bl->x+1) || to_y == (bl->y+1)) || (to_x == (bl->x-1) || to_y == (bl->y-1))) { //If you can't run forward, you must be next to a wall, so bounce back. [Skotlex] - clif->status_change(bl, SI_BUMP, 1, 0, 0, 0, 0); + clif->sc_load(bl,bl->id,AREA,SI_BUMP,0,0,0); //Set running to 0 beforehand so status_change_end knows not to enable spurt [Kevin] unit_bl2ud(bl)->state.running = 0; @@ -499,7 +499,7 @@ int unit_run(struct block_list *bl) skill->blown(bl,bl,skill->get_blewcount(TK_RUN,lv),unit_getdir(bl),0); clif->fixpos(bl); //Why is a clif->slide (skill->blown) AND a fixpos needed? Ask Aegis. - clif->status_change(bl, SI_BUMP, 0, 0, 0, 0, 0); + clif->sc_end(bl,bl->id,AREA,SI_BUMP); return 0; } if (unit_walktoxy(bl, to_x, to_y, 1)) @@ -511,7 +511,7 @@ int unit_run(struct block_list *bl) } while (--i > 0 && !unit_walktoxy(bl, to_x, to_y, 1)); if ( i == 0 ) { // copy-paste from above - clif->status_change(bl, SI_BUMP, 1, 0, 0, 0, 0); + clif->sc_load(bl,bl->id,AREA,SI_BUMP,0,0,0); //Set running to 0 beforehand so status_change_end knows not to enable spurt [Kevin] unit_bl2ud(bl)->state.running = 0; @@ -519,7 +519,7 @@ int unit_run(struct block_list *bl) skill->blown(bl,bl,skill->get_blewcount(TK_RUN,lv),unit_getdir(bl),0); clif->fixpos(bl); - clif->status_change(bl, SI_BUMP, 0, 0, 0, 0, 0); + clif->sc_end(bl,bl->id,AREA,SI_BUMP); return 0; } return 1; |