diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 5194a637a..d7b10f2f4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1277,11 +1277,15 @@ void clif_spiritball_single(int fd, struct map_session_data *sd) { * Kagerou/Oboro amulet spirit *------------------------------------------*/ void clif_charm_single(int fd, struct map_session_data *sd, short type) { + + if ( type <= SPIRITS_TYPE_NONE || type >= SPIRITS_TYPE_SPHERE ) + return; + WFIFOHEAD(fd, packet_len(0x08cf)); WFIFOW(fd,0)=0x08cf; WFIFOL(fd,2)=sd->bl.id; WFIFOW(fd,6)=type; - WFIFOW(fd,8)=sd->charm[type]; + WFIFOW(fd,8)=sd->spiritcharm[type]; WFIFOSET(fd, packet_len(0x08cf)); } @@ -1367,10 +1371,8 @@ bool clif_spawn(struct block_list *bl) for( i = 0; i < sd->sc_display_count; i++ ) { clif->sc_load(&sd->bl, sd->bl.id,AREA,status->IconChangeTable[sd->sc_display[i]->type],sd->sc_display[i]->val1,sd->sc_display[i]->val2,sd->sc_display[i]->val3); } - for(i = 1; i < 5; i++){ - if( sd->charm[i] > 0 ) - clif->charm(sd, i); - } + ARR_FIND(SPIRITS_TYPE_CHARM_WATER, SPIRITS_TYPE_SPHERE, i, sd->spiritcharm[i] > 0); + clif->spiritcharm(sd, i); if (sd->status.robe) clif->refreshlook(bl,bl->id,LOOK_ROBE,sd->status.robe,AREA); } @@ -4269,10 +4271,9 @@ void clif_getareachar_pc(struct map_session_data* sd,struct map_session_data* ds if(dstsd->spiritball > 0) clif->spiritball_single(sd->fd, dstsd); - for(i = 1; i < 5; i++){ - if( dstsd->charm[i] > 0 ) - clif->charm_single(sd->fd, dstsd, i); - } + ARR_FIND(SPIRITS_TYPE_CHARM_WATER, SPIRITS_TYPE_SPHERE, i, sd->spiritcharm[i] > 0); + clif->charm_single(sd->fd, dstsd, i); + for( i = 0; i < dstsd->sc_display_count; i++ ) { clif->sc_load(&sd->bl,dstsd->bl.id,SELF,status->IconChangeTable[dstsd->sc_display[i]->type],dstsd->sc_display[i]->val1,dstsd->sc_display[i]->val2,dstsd->sc_display[i]->val3); } @@ -8489,10 +8490,9 @@ void clif_refresh(struct map_session_data *sd) clif->updatestatus(sd,SP_LUK); if (sd->spiritball) clif->spiritball_single(sd->fd, sd); - for(i = 1; i < 5; i++){ - if( sd->charm[i] > 0 ) - clif->charm_single(sd->fd, sd, i); - } + ARR_FIND(SPIRITS_TYPE_CHARM_WATER, SPIRITS_TYPE_SPHERE, i, sd->spiritcharm[i] > 0); + clif->charm_single(sd->fd, sd, i); + if (sd->vd.cloth_color) clif->refreshlook(&sd->bl,sd->bl.id,LOOK_CLOTHES_COLOR,sd->vd.cloth_color,SELF); if(homun_alive(sd->hd)) @@ -9597,7 +9597,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) { if (map->getcell(sd->bl.m,sd->bl.x,sd->bl.y,CELL_CHKNPC)) npc->touch_areanpc(sd,sd->bl.m,sd->bl.x,sd->bl.y); else - sd->areanpc_id = 0; + npc->untouch_areanpc(sd, sd->bl.m, sd->bl.x, sd->bl.y); /* it broke at some point (e.g. during a crash), so we make it visibly dead again. */ if( !sd->status.hp && !pc_isdead(sd) && status->isdead(&sd->bl) ) @@ -11450,7 +11450,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) if( skill_lv != sd->skillitemlv ) skill_lv = sd->skillitemlv; if( !(tmp&INF_SELF_SKILL) ) - pc->delinvincibletimer(sd); // Target skills thru items cancel invincibility. [Inkfish] + pc->delinvincibletimer(sd); // Target skills through items cancel invincibility. [Inkfish] unit->skilluse_id(&sd->bl, target_id, skill_id, skill_lv); return; } @@ -17458,10 +17458,13 @@ void clif_charm(struct map_session_data *sd,short type) nullpo_retv(sd); + if ( type <= SPIRITS_TYPE_NONE || type >= SPIRITS_TYPE_SPHERE ) + return; + WBUFW(buf,0)=0x08cf; WBUFL(buf,2)=sd->bl.id; WBUFW(buf,6)=type; - WBUFW(buf,8)=sd->charm[type]; + WBUFW(buf,8)=sd->spiritcharm[type]; clif->send(buf,packet_len(0x08cf),&sd->bl,AREA); } /// Move Item from or to Personal Tab (CZ_WHATSOEVER) [FE] @@ -17749,7 +17752,10 @@ void clif_parse_CashShopReqTab(int fd, struct map_session_data *sd) { void clif_maptypeproperty2(struct block_list *bl,enum send_target t) { #if PACKETVER >= 20121010 struct packet_maptypeproperty2 p; - struct map_session_data *sd = BL_CAST(BL_PC, bl); + struct map_session_data *sd = NULL; + nullpo_retv(bl); + + sd = BL_CAST(BL_PC, bl); p.PacketType = maptypeproperty2Type; p.type = 0x28; @@ -19152,7 +19158,7 @@ void clif_defaults(void) { clif->specialeffect_single = clif_specialeffect_single; clif->specialeffect_value = clif_specialeffect_value; clif->millenniumshield = clif_millenniumshield; - clif->charm = clif_charm; + clif->spiritcharm = clif_charm; clif->charm_single = clif_charm_single; clif->snap = clif_snap; clif->weather_check = clif_weather_check; |