diff --git a/src/map/atcommand.c b/src/map/atcommand.c index e02670e90de..ab56b6c4930 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -1605,10 +1605,9 @@ ACMD(pvpoff) map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone); map->list[sd->bl.m].flag.pvp = 0; - if (!battle_config.pk_mode) { + if (!battle_config.pk_mode) clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); - clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); - } + map->foreachinmap(atcommand->pvpoff_sub,sd->bl.m, BL_PC); map->foreachinmap(atcommand->stopattack,sd->bl.m, BL_CHAR, 0); clif->message(fd, msg_fd(fd,31)); // PvP: Off. @@ -1647,9 +1646,8 @@ ACMD(pvpon) map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)); map->list[sd->bl.m].flag.pvp = 1; - if (!battle_config.pk_mode) {// display pvp circle and rank + if (!battle_config.pk_mode) { // display pvp circle and rank clif->map_property_mapall(sd->bl.m, MAPPROPERTY_FREEPVPZONE); - clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); map->foreachinmap(atcommand->pvpon_sub,sd->bl.m, BL_PC); } @@ -1672,7 +1670,6 @@ ACMD(gvgoff) map->zone_change2(sd->bl.m,map->list[sd->bl.m].prev_zone); map->list[sd->bl.m].flag.gvg = 0; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); - clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); map->foreachinmap(atcommand->stopattack,sd->bl.m, BL_CHAR, 0); clif->message(fd, msg_fd(fd,33)); // GvG: Off. @@ -1692,7 +1689,6 @@ ACMD(gvgon) map->zone_change2(sd->bl.m,strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)); map->list[sd->bl.m].flag.gvg = 1; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE); - clif->maptypeproperty2(&sd->bl,ALL_SAMEMAP); clif->message(fd, msg_fd(fd,34)); // GvG: On. return true; @@ -1711,7 +1707,6 @@ ACMD(cvcoff) map->zone_change2(sd->bl.m, map->list[sd->bl.m].prev_zone); map->list[sd->bl.m].flag.cvc = 0; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_NOTHING); - clif->maptypeproperty2(&sd->bl, ALL_SAMEMAP); map->foreachinmap(atcommand->stopattack, sd->bl.m, BL_CHAR, 0); clif->message(fd, msg_fd(fd, 137)); // CvC: Off. @@ -1731,7 +1726,6 @@ ACMD(cvcon) map->zone_change2(sd->bl.m, strdb_get(map->zone_db, MAP_ZONE_CVC_NAME)); map->list[sd->bl.m].flag.cvc = 1; clif->map_property_mapall(sd->bl.m, MAPPROPERTY_AGITZONE); - clif->maptypeproperty2(&sd->bl, ALL_SAMEMAP); clif->message(fd, msg_fd(fd, 138)); // CvC: On. return true; diff --git a/src/map/clif.c b/src/map/clif.c index e2f93a5f98d..d9009e5f135 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -6595,19 +6595,36 @@ static void clif_resurrection(struct block_list *bl, int type) } } -/// Sets the map property (ZC_NOTIFY_MAPPROPERTY). -/// 0199 .W -static void clif_map_property(struct map_session_data *sd, enum map_property property) +/** + * Sets the map property(ZC_NOTIFY_MAPPROPERTY). + * 0199 .W (ZC_NOTIFY_MAPPROPERTY) + * 099b .W + **/ +static void clif_map_property(struct block_list *bl, enum map_property property, enum send_target target) { - int fd; + struct packet_maptypeproperty p; - nullpo_retv(sd); + nullpo_retv(bl); - fd=sd->fd; - WFIFOHEAD(fd,packet_len(0x199)); - WFIFOW(fd,0)=0x199; - WFIFOW(fd,2)=property; - WFIFOSET(fd,packet_len(0x199)); + p.PacketType = maptypeproperty; + p.property = property; + +#if PACKETVER >= 20121010 + p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; //PARTY + p.flag.guild = (map->list[bl->m].flag.battleground || map_flag_gvg(bl->m)) ? 1 : 0; // GUILD + p.flag.siege = (map->list[bl->m].flag.battleground || map_flag_gvg2(bl->m)) ? 1 : 0; // SIEGE + p.flag.mineffect = map_flag_gvg2(bl->m) ? 1 : 0; // USE_SIMPLE_EFFECT - Automatically enable /mineffect in guild arenas and castles. + p.flag.nolockon = 0; // DISABLE_LOCKON - TODO + p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; // COUNT_PK + p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; // NO_PARTY_FORMATION + p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; // BATTLEFIELD + p.flag.nocostume = (map->list[bl->m].flag.noviewid & EQP_COSTUME) ? 1 : 0; // DISABLE_COSTUMEITEM - Disables Costume Sprite + p.flag.usecart = 1; // USECART - TODO + p.flag.summonstarmiracle = 0; // SUNMOONSTAR_MIRACLE - TODO + p.flag.SpareBits = 0; // UNUSED +#endif + + clif->send(&p, sizeof(p), bl, target); } /// Set the map type (ZC_NOTIFY_MAPPROPERTY2). @@ -6664,15 +6681,13 @@ static void clif_pvpset(struct map_session_data *sd, int pvprank, int pvpnum, in static void clif_map_property_mapall(int mapid, enum map_property property) { struct block_list bl; - unsigned char buf[16]; memset(&bl, 0, sizeof(bl)); bl.id = 0; bl.type = BL_NUL; bl.m = mapid; - WBUFW(buf,0)=0x199; - WBUFW(buf,2)=property; - clif->send(buf,packet_len(0x199),&bl,ALL_SAMEMAP); + + clif->map_property(&bl, property, ALL_SAMEMAP); } /// Notifies the client about the result of a refine attempt (ZC_ACK_ITEMREFINING). @@ -11228,18 +11243,17 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) sd->pvp_won = 0; sd->pvp_lost = 0; } - - clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + clif->map_property(&sd->bl, MAPPROPERTY_FREEPVPZONE, SELF); } else if(sd->duel_group != 0) { // Set flag, if it's a duel. [LuzZza] - clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); + clif->map_property(&sd->bl, MAPPROPERTY_FREEPVPZONE, SELF); + } else if (map->list[sd->bl.m].flag.gvg_dungeon != 0) { + clif->map_property(&sd->bl, MAPPROPERTY_FREEPVPZONE, SELF); //TODO: Figure out the real packet to send here. + } else if (map_flag_gvg2(sd->bl.m)) { + clif->map_property(&sd->bl, MAPPROPERTY_AGITZONE, SELF); + } else { + clif->map_property(&sd->bl, MAPPROPERTY_NOTHING, SELF); } - if (map->list[sd->bl.m].flag.gvg_dungeon != 0) - clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); //TODO: Figure out the real packet to send here. - - if (map_flag_gvg2(sd->bl.m)) - clif->map_property(sd, MAPPROPERTY_AGITZONE); - // Info about nearby objects. Must use map->foreachinarea(). (CIRCULAR_AREA interferes with map->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); @@ -11437,7 +11451,6 @@ static void clif_parse_LoadEndAck(int fd, struct map_session_data *sd) } mail->clear(sd); - clif->maptypeproperty2(&sd->bl, SELF); if (sd->guild != NULL) { // Init guild aura. @@ -21166,32 +21179,6 @@ static void clif_parse_cashShopReqTab(int fd, struct map_session_data *sd) #endif } -/* [Ind/Hercules] */ -static void clif_maptypeproperty2(struct block_list *bl, enum send_target t) -{ -#if PACKETVER >= 20121010 - struct packet_maptypeproperty2 p; - nullpo_retv(bl); - - p.PacketType = maptypeproperty2Type; - p.type = 0x28; - p.flag.party = map->list[bl->m].flag.pvp ? 1 : 0; //PARTY - p.flag.guild = (map->list[bl->m].flag.battleground || map_flag_gvg(bl->m)) ? 1 : 0; // GUILD - p.flag.siege = (map->list[bl->m].flag.battleground || map_flag_gvg2(bl->m)) ? 1: 0; // SIEGE - p.flag.mineffect = map_flag_gvg2(bl->m) ? 1 : 0; // USE_SIMPLE_EFFECT - Automatically enable /mineffect in guild arenas and castles. - p.flag.nolockon = 0; // DISABLE_LOCKON - TODO - p.flag.countpk = map->list[bl->m].flag.pvp ? 1 : 0; // COUNT_PK - p.flag.nopartyformation = map->list[bl->m].flag.partylock ? 1 : 0; // NO_PARTY_FORMATION - p.flag.bg = map->list[bl->m].flag.battleground ? 1 : 0; // BATTLEFIELD - p.flag.nocostume = (map->list[bl->m].flag.noviewid & EQP_COSTUME) ? 1 : 0; // DISABLE_COSTUMEITEM - Disables Costume Sprite - p.flag.usecart = 1; // USECART - TODO - p.flag.summonstarmiracle = 0; // SUNMOONSTAR_MIRACLE - TODO - p.flag.SpareBits = 0; // UNUSED - - clif->send(&p,sizeof(p),bl,t); -#endif -} - static void clif_status_change2(struct block_list *bl, int tid, enum send_target target, int type, int val1, int val2, int val3) { struct packet_status_change2 p; @@ -25854,7 +25841,6 @@ void clif_defaults(void) clif->map_property_mapall = clif_map_property_mapall; clif->bossmapinfo = clif_bossmapinfo; clif->map_type = clif_map_type; - clif->maptypeproperty2 = clif_maptypeproperty2; clif->crimson_marker = clif_crimson_marker; /* multi-map-server */ clif->changemapserver = clif_changemapserver; diff --git a/src/map/clif.h b/src/map/clif.h index 68da0678001..533de4000d7 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -1015,12 +1015,11 @@ struct clif_interface { void (*changemap) (struct map_session_data *sd, short m, int x, int y); void (*changemap_airship) (struct map_session_data *sd, short m, int x, int y); void (*changemapcell) (int fd, int16 m, int x, int y, int type, enum send_target target); - void (*map_property) (struct map_session_data* sd, enum map_property property); + void (*map_property) (struct block_list *bl, enum map_property property, enum send_target target); void (*pvpset) (struct map_session_data *sd, int pvprank, int pvpnum,int type); void (*map_property_mapall) (int mapid, enum map_property property); void (*bossmapinfo) (int fd, struct mob_data *md, enum bossmap_info_type flag); void (*map_type) (struct map_session_data* sd, enum map_type type); - void (*maptypeproperty2) (struct block_list *bl,enum send_target t); void (*crimson_marker) (struct map_session_data *sd, struct block_list *bl, bool remove); /* multi-map-server */ void (*changemapserver) (struct map_session_data* sd, unsigned short map_index, int x, int y, uint32 ip, uint16 port, char *dnsHost); diff --git a/src/map/duel.c b/src/map/duel.c index d43cccb85e1..379ef8589df 100644 --- a/src/map/duel.c +++ b/src/map/duel.c @@ -104,8 +104,7 @@ static int duel_create(struct map_session_data *sd, const unsigned int maxpl) safestrncpy(output, msg_sd(sd,372), sizeof(output)); // " -- Duel has been created (@invite/@leave) --" clif_disp_onlyself(sd, output); - clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); - clif->maptypeproperty2(&sd->bl,SELF); + clif->map_property(&sd->bl, MAPPROPERTY_FREEPVPZONE, SELF); return i; } @@ -153,8 +152,8 @@ static void duel_leave(const unsigned int did, struct map_session_data *sd) sd->duel_group = 0; duel_savetime(sd); - clif->map_property(sd, MAPPROPERTY_NOTHING); - clif->maptypeproperty2(&sd->bl,SELF); + clif->map_property(&sd->bl, MAPPROPERTY_NOTHING, SELF); + } static void duel_accept(const unsigned int did, struct map_session_data *sd) @@ -171,8 +170,7 @@ static void duel_accept(const unsigned int did, struct map_session_data *sd) sprintf(output, msg_sd(sd,376), sd->status.name); clif->disp_message(&sd->bl, output, DUEL_WOS); - clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); - clif->maptypeproperty2(&sd->bl,SELF); + clif->map_property(&sd->bl, MAPPROPERTY_FREEPVPZONE, SELF); } static void duel_reject(const unsigned int did, struct map_session_data *sd) diff --git a/src/map/packets_struct.h b/src/map/packets_struct.h index 5098d034ffd..c74a22553e8 100644 --- a/src/map/packets_struct.h +++ b/src/map/packets_struct.h @@ -254,7 +254,11 @@ enum packet_headers { #endif notifybindonequip = 0x2d3, monsterhpType = 0x977, - maptypeproperty2Type = 0x99b, +#if PACKETVER >= 20121010 + maptypeproperty = 0x99b, // ZC_MAPPROPERTY_R2 [KeiKun] +#else + maptypeproperty = 0x199, +#endif #if PACKETVER >= 20131223 // version probably can be 20131030 [4144] wisendType = 0x9df, #else @@ -964,9 +968,10 @@ struct packet_status_change2 { int32 val3; } __attribute__((packed)); -struct packet_maptypeproperty2 { +struct packet_maptypeproperty { int16 PacketType; - int16 type; + int16 property; +#if PACKETVER >= 20121010 struct { uint32 party : 1; // Show attack cursor on non-party members (PvP) uint32 guild : 1; // Show attack cursor on non-guild members (GvG) @@ -981,6 +986,7 @@ struct packet_maptypeproperty2 { uint32 summonstarmiracle : 1; // TODO: What does this do? Related to Taekwon Masters, but I have no idea. uint32 SpareBits : 21; /// Currently ignored, reserved for future updates } flag; +#endif } __attribute__((packed)); struct packet_bgqueue_ack { diff --git a/src/map/script.c b/src/map/script.c index fdabe047b45..6d4100ee16a 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -14558,8 +14558,7 @@ static int script_mapflag_pvp_sub(struct block_list *bl, va_list ap) sd->pvp_won = 0; sd->pvp_lost = 0; } - clif->map_property(sd, MAPPROPERTY_FREEPVPZONE); - clif->maptypeproperty2(&sd->bl,SELF); + clif->map_property(&sd->bl, MAPPROPERTY_FREEPVPZONE, SELF); return 0; } @@ -14605,9 +14604,6 @@ static BUILDIN(setmapflag) memset(&bl, 0, sizeof(bl)); map->list[m].flag.gvg = 1; clif->map_property_mapall(m, MAPPROPERTY_AGITZONE); - bl.type = BL_NUL; - bl.m = m; - clif->maptypeproperty2(&bl, ALL_SAMEMAP); } break; case MF_GVG_NOPARTY: map->list[m].flag.gvg_noparty = 1; break; @@ -14695,11 +14691,8 @@ static BUILDIN(removemapflag) { struct block_list bl; memset(&bl, 0, sizeof(bl)); - bl.type = BL_NUL; - bl.m = m; map->list[m].flag.pvp = 0; clif->map_property_mapall(m, MAPPROPERTY_NOTHING); - clif->maptypeproperty2(&bl, ALL_SAMEMAP); } break; case MF_PVP_NOPARTY: map->list[m].flag.pvp_noparty = 0; break; @@ -14708,11 +14701,8 @@ static BUILDIN(removemapflag) { struct block_list bl; memset(&bl, 0, sizeof(bl)); - bl.type = BL_NUL; - bl.m = m; map->list[m].flag.gvg = 0; clif->map_property_mapall(m, MAPPROPERTY_NOTHING); - clif->maptypeproperty2(&bl, ALL_SAMEMAP); } break; case MF_GVG_NOPARTY: map->list[m].flag.gvg_noparty = 0; break; @@ -14794,9 +14784,6 @@ static BUILDIN(pvpon) map->zone_change2(m, strdb_get(map->zone_db, MAP_ZONE_PVP_NAME)); map->list[m].flag.pvp = 1; clif->map_property_mapall(m, MAPPROPERTY_FREEPVPZONE); - bl.type = BL_NUL; - bl.m = m; - clif->maptypeproperty2(&bl,ALL_SAMEMAP); if(battle_config.pk_mode) // disable ranking functions if pk_mode is on [Valaris] return true; @@ -14850,9 +14837,6 @@ static BUILDIN(pvpoff) map->zone_change2(m, map->list[m].prev_zone); map->list[m].flag.pvp = 0; clif->map_property_mapall(m, MAPPROPERTY_NOTHING); - bl.type = BL_NUL; - bl.m = m; - clif->maptypeproperty2(&bl,ALL_SAMEMAP); if(battle_config.pk_mode) // disable ranking options if pk_mode is on [Valaris] return true; @@ -14880,9 +14864,6 @@ static BUILDIN(gvgon) map->zone_change2(m, strdb_get(map->zone_db, MAP_ZONE_GVG_NAME)); map->list[m].flag.gvg = 1; clif->map_property_mapall(m, MAPPROPERTY_AGITZONE); - bl.type = BL_NUL; - bl.m = m; - clif->maptypeproperty2(&bl,ALL_SAMEMAP); } return true; @@ -14900,9 +14881,6 @@ static BUILDIN(gvgoff) map->zone_change2(m, map->list[m].prev_zone); map->list[m].flag.gvg = 0; clif->map_property_mapall(m, MAPPROPERTY_NOTHING); - bl.type = BL_NUL; - bl.m = m; - clif->maptypeproperty2(&bl,ALL_SAMEMAP); } return true;