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 --- Changelog-Trunk.txt | 5 +++++ src/map/clif.c | 45 +++++++++++++++++++++++++++------------------ 2 files changed, 32 insertions(+), 18 deletions(-) diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 12cb9918d..c1780d6e8 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -1,6 +1,11 @@ Date Added 2010/12/02 + * Random clif.c fixes and cleanups. [Ai4rei] + - 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. * Added defines for guild notice sizes (MAX_GUILDMES1 and MAX_GUILDMES2). [Ai4rei] * Added clif_starskill (packet 0x20e, ZC_STARSKILL) to host the packet previously implemented by clif_feel_info, clif_hate_info, clif_mission_info and clif_feel_hate_reset (related r4352, r4375 and r9162). [Ai4rei] - This also fixes sd->bl.id being sometimes supplied for monster_id in this packet. 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-60-g2f50