diff options
Diffstat (limited to 'src/map/clif.c')
-rw-r--r-- | src/map/clif.c | 123 |
1 files changed, 84 insertions, 39 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 236297dba..f1400a5d4 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -677,7 +677,8 @@ void clif_authok(struct map_session_data *sd) #if PACKETVER >= 20080102 p.font = sd->status.font; #endif -#if PACKETVER >= 20141016 +// Some clients smaller than 20160330 cant be tested [4144] +#if PACKETVER >= 20141016 && PACKETVER < 20160330 p.sex = sd->status.sex; #endif clif->send(&p,sizeof(p),&sd->bl,SELF); @@ -1077,15 +1078,21 @@ void clif_set_unit_idle(struct block_list* bl, struct map_session_data *tsd, enu #endif #if PACKETVER >= 20150513 p.body = vd->body_style; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 safestrncpy(p.name, clif->get_bl_name(bl), NAME_LENGTH); #endif - clif->send(&p,sizeof(p),tsd?&tsd->bl:bl,target); if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE +#if PACKETVER >= 20131223 + p.AID = -bl->id; +#else p.GID = -bl->id; +#endif #else p.GID = -bl->id; #endif @@ -1220,6 +1227,9 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { #endif #if PACKETVER >= 20150513 p.body = vd->body_style; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 safestrncpy(p.name, clif->get_bl_name(bl), NAME_LENGTH); #endif if (clif->isdisguised(bl)) { @@ -1228,7 +1238,11 @@ void clif_spawn_unit(struct block_list* bl, enum send_target target) { clif->send(&p,sizeof(p),bl,target); #if PACKETVER >= 20091103 p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE +#if PACKETVER >= 20131223 + p.AID = -bl->id; +#else p.GID = -bl->id; +#endif #else p.GID = -bl->id; #endif @@ -1262,7 +1276,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, #endif #if PACKETVER >= 20131223 p.AID = bl->id; - p.GID = (tsd) ? tsd->status.char_id : 0; // CCODE + p.GID = (sd) ? sd->status.char_id : 0; // CCODE #else p.GID = bl->id; #endif @@ -1312,6 +1326,9 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, #endif #if PACKETVER >= 20150513 p.body = vd->body_style; +#endif +/* Might be earlier, this is when the named item bug began */ +#if PACKETVER >= 20131223 safestrncpy(p.name, clif->get_bl_name(bl), NAME_LENGTH); #endif @@ -1320,7 +1337,11 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, if (clif->isdisguised(bl)) { #if PACKETVER >= 20091103 p.objecttype = pc->db_checkid(status->get_viewdata(bl)->class) ? 0x0 : 0x5; //PC_TYPE : NPC_MOB_TYPE +#if PACKETVER >= 20131223 + p.AID = -bl->id; +#else p.GID = -bl->id; +#endif #else p.GID = -bl->id; #endif @@ -1332,7 +1353,7 @@ void clif_set_unit_walking(struct block_list* bl, struct map_session_data *tsd, /// 01b0 <id>.L <type>.B <value>.L /// type: /// unused -void clif_class_change(struct block_list *bl, int class_, int type) +void clif_class_change(struct block_list *bl, int class_, int type, struct map_session_data *sd) { nullpo_retv(bl); @@ -1343,7 +1364,11 @@ void clif_class_change(struct block_list *bl, int class_, int type) WBUFL(buf,2)=bl->id; WBUFB(buf,6)=type; WBUFL(buf,7)=class_; - clif->send(buf,packet_len(0x1b0),bl,AREA); + + if (sd == NULL) + clif->send(buf, packet_len(0x1b0), bl, AREA); + else + clif->send(buf, packet_len(0x1b0), &sd->bl, SELF); } } @@ -2544,13 +2569,13 @@ void clif_item_equip(short idx, struct EQUIPITEM_INFO *p, struct item *it, struc p->type = itemtype(id->type); #if PACKETVER < 20120925 - p->IsIdentified = i->identify ? 1 : 0; + p->IsIdentified = it->identify ? 1 : 0; #endif p->location = eqp_pos; p->WearState = it->equip; #if PACKETVER < 20120925 - p->IsDamaged = (i->attribute & ATTR_BROKEN) != 0 ? 1 : 0; + p->IsDamaged = (it->attribute & ATTR_BROKEN) != 0 ? 1 : 0; #endif p->RefiningLevel = it->refine; @@ -7232,6 +7257,13 @@ void clif_mvp_item(struct map_session_data *sd,int nameid) /// 010b <exp>.L void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) { +#if PACKETVER >= 20131223 // Kro removed this packet [Napster] + if (battle_config.mvp_exp_reward_message) { + char e_msg[CHAT_SIZE_MAX]; + sprintf(e_msg, msg_txt(855), exp); + clif->messagecolor_self(sd->fd, COLOR_CYAN, e_msg); // Congratulations! You are the MVP! Your reward EXP Points are %u !! + } +#else int fd; nullpo_retv(sd); @@ -7241,6 +7273,7 @@ void clif_mvp_exp(struct map_session_data *sd, unsigned int exp) WFIFOW(fd,0)=0x10b; WFIFOL(fd,2)=cap_value(exp,0,INT32_MAX); WFIFOSET(fd,packet_len(0x10b)); +#endif } /// Dropped MVP item reward message (ZC_THROW_MVPITEM). @@ -10599,9 +10632,11 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) clif->clearunit_area(&sd->bl,CLR_DEAD); return; } - if( sd->npc_id || sd->state.workinprogress&2 ){ -#ifdef RENEWAL - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); // TODO look for the client date that has this message. + if (sd->npc_id || sd->state.workinprogress & 2) { +#if PACKETVER >= 20110309 + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#else + clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif return; } @@ -10614,9 +10649,11 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) clif->pActionRequest_sub(sd, 0x07, bl->id, timer->gettick()); break; case BL_NPC: - if( sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != INVALID_TIMER ) {// TODO: should only work with none 3rd job skills -#ifdef RENEWAL + if (sd->ud.skill_id < RK_ENCHANTBLADE && sd->ud.skilltimer != INVALID_TIMER) { // TODO: should only work with none 3rd job skills +#if PACKETVER >= 20110309 clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#else + clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif break; } @@ -10992,39 +11029,38 @@ void clif_parse_RemoveOption(int fd,struct map_session_data *sd) void clif_parse_ChangeCart(int fd,struct map_session_data *sd) __attribute__((nonnull (2))); /// Request to change cart's visual look (CZ_REQ_CHANGECART). /// 01af <num>.W -void clif_parse_ChangeCart(int fd,struct map_session_data *sd) +void clif_parse_ChangeCart(int fd, struct map_session_data *sd) {// TODO: State tracking? int type; - if( pc->checkskill(sd, MC_CHANGECART) < 1 ) + if (pc->checkskill(sd, MC_CHANGECART) == 0) return; -#ifdef RENEWAL - if( sd->npc_id || sd->state.workinprogress&1 ){ + if (sd->npc_id || sd->state.workinprogress & 1) { +#if PACKETVER >= 20110309 clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#else + clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); +#endif return; } -#endif - type = RFIFOW(fd,2); + type = RFIFOW(fd, 2); + + if ( #ifdef NEW_CARTS - if( (type == 9 && sd->status.base_level > 131) || - (type == 8 && sd->status.base_level > 121) || - (type == 7 && sd->status.base_level > 111) || - (type == 6 && sd->status.base_level > 101) || + (type == 9 && sd->status.base_level > 130) || + (type == 8 && sd->status.base_level > 120) || + (type == 7 && sd->status.base_level > 110) || + (type == 6 && sd->status.base_level > 100) || +#endif (type == 5 && sd->status.base_level > 90) || (type == 4 && sd->status.base_level > 80) || (type == 3 && sd->status.base_level > 65) || (type == 2 && sd->status.base_level > 40) || (type == 1)) -#else - if( (type == 5 && sd->status.base_level > 90) || - (type == 4 && sd->status.base_level > 80) || - (type == 3 && sd->status.base_level > 65) || - (type == 2 && sd->status.base_level > 40) || - (type == 1)) -#endif - pc->setcart(sd,type); + + pc->setcart(sd, type); } /// Request to select cart's visual look for new cart design (CZ_SELECTCART). @@ -11211,9 +11247,11 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) // Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex] pc->update_idle_time(sd, BCIDLE_USESKILLTOID); - if( sd->npc_id || sd->state.workinprogress&1 ){ -#ifdef RENEWAL - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); // TODO look for the client date that has this message. + if (sd->npc_id || sd->state.workinprogress & 1) { +#if PACKETVER >= 20110309 + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#else + clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); #endif return; } @@ -11308,12 +11346,14 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, uint16 ski return; } -#ifdef RENEWAL - if( sd->state.workinprogress&1 ){ - clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); // TODO look for the client date that has this message. + if (sd->state.workinprogress & 1) { +#if PACKETVER >= 20110309 + clif->msgtable(sd, MSG_NPC_WORK_IN_PROGRESS); +#else + clif->messagecolor_self(fd, COLOR_WHITE, msg_fd(fd, 48)); +#endif return; } -#endif //Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex] pc->update_idle_time(sd, BCIDLE_USESKILLTOPOS); @@ -11594,7 +11634,12 @@ void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) __attribute_ /// 01d5 <packet len>.W <npc id>.L <string>.?B void clif_parse_NpcStringInput(int fd, struct map_session_data* sd) { - int message_len = RFIFOW(fd,2)-8; +// [4144] can't confirm exact client version. At least >= correct for 20150513 +#if PACKETVER >= 20151029 + int message_len = RFIFOW(fd, 2) - 7; +#else + int message_len = RFIFOW(fd, 2) - 8; +#endif int npcid = RFIFOL(fd,4); const char *message = RFIFOP(fd,8); @@ -16201,7 +16246,7 @@ void clif_bg_hp(struct map_session_data *sd) { unsigned char buf[34]; -// packet version can be wrong, because inconsistend data in other servers. +// packet version can be wrong, because inconsistend data in other servers. From packets table it start from 20140312 [4144] #if PACKETVER < 20140613 const int cmd = 0x2e0; nullpo_retv(sd); |