From 24b1d19b51c95758f86626443c6144672d37edca Mon Sep 17 00:00:00 2001 From: ai4rei Date: Thu, 2 Dec 2010 14:58:34 +0000 Subject: * Random clif.c fixes and cleanups. - Fixed clif_homskillup using sd before nullpo check (since r9297 and r9307). - Merged code responsible for disabling pets in GvG and spawning them as per TODO (related r12002). - Fixed base and job exp not being sent to the client for new connections (follow to r14505). - Fixed Magnifier (item) and Identify (skill) attempting to identify an item, even when cancel is pressed, causing skill failed message. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14545 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index acc8ffa41..910ce19f2 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1270,13 +1270,14 @@ int clif_homskillinfoblock(struct map_session_data *sd) void clif_homskillup(struct map_session_data *sd, int skill_num) { //[orn] struct homun_data *hd; - int fd=sd->fd, skillid; - WFIFOHEAD(fd, packet_len(0x239)); + int fd, skillid; nullpo_retv(sd); skillid = skill_num - HM_SKILLBASE; + fd=sd->fd; hd=sd->hd; + WFIFOHEAD(fd, packet_len(0x239)); WFIFOW(fd,0) = 0x239; WFIFOW(fd,2) = skill_num; WFIFOW(fd,4) = hd->homunculus.hskill[skillid].lv; @@ -8598,20 +8599,22 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) // must use foreachinarea (CIRCULAR_AREA interferes with foreachinrange) map_foreachinarea(clif_getareachar, sd->bl.m, sd->bl.x-AREA_SIZE, sd->bl.y-AREA_SIZE, sd->bl.x+AREA_SIZE, sd->bl.y+AREA_SIZE, BL_ALL, sd); - //TODO: merge it with the code below - if (battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m) && sd->pd) - { //Return the pet to egg. [Skotlex] - clif_displaymessage(sd->fd, "Pets are not allowed in Guild Wars."); - pet_menu(sd, 3); //Option 3 is return to egg. - } - // pet - if(sd->pd) { - map_addblock(&sd->pd->bl); - clif_spawn(&sd->pd->bl); - clif_send_petdata(sd,sd->pd,0,0); - clif_send_petstatus(sd); -// skill_unit_move(&sd->pd->bl,gettick(),1); + if( sd->pd ) + { + if( battle_config.pet_no_gvg && map_flag_gvg(sd->bl.m) ) + { //Return the pet to egg. [Skotlex] + clif_displaymessage(sd->fd, "Pets are not allowed in Guild Wars."); + pet_menu(sd, 3); //Option 3 is return to egg. + } + else + { + map_addblock(&sd->pd->bl); + clif_spawn(&sd->pd->bl); + clif_send_petdata(sd,sd->pd,0,0); + clif_send_petstatus(sd); +// skill_unit_move(&sd->pd->bl,gettick(),1); + } } //homunculus [blackhole89] @@ -8642,7 +8645,9 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) sd->state.connect_new = 0; clif_skillinfoblock(sd); clif_hotkeys_send(sd); + clif_updatestatus(sd,SP_BASEEXP); clif_updatestatus(sd,SP_NEXTBASEEXP); + clif_updatestatus(sd,SP_JOBEXP); clif_updatestatus(sd,SP_NEXTJOBEXP); clif_updatestatus(sd,SP_SKILLPOINT); clif_initialstatus(sd); @@ -9632,8 +9637,6 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) if (!bl) return; switch (bl->type) { case BL_MOB: - clif_parse_ActionRequest_sub(sd, 0x07, bl->id, gettick()); - break; case BL_PC: clif_parse_ActionRequest_sub(sd, 0x07, bl->id, gettick()); break; @@ -10419,9 +10422,15 @@ void clif_parse_NpcCloseClicked(int fd,struct map_session_data *sd) *------------------------------------------*/ void clif_parse_ItemIdentify(int fd,struct map_session_data *sd) { + short idx = RFIFOW(fd,2); + if (sd->menuskill_id != MC_IDENTIFY) return; - skill_identify(sd,RFIFOW(fd,2)-2); + if( idx == -1 ) + {// cancel pressed + return; + } + skill_identify(sd,idx-2); sd->menuskill_val = sd->menuskill_id = 0; } /*========================================== -- cgit v1.2.3-70-g09d2