Guild emblem implementation for late 2019 clients or later (#5144)

Co-authored-by: valhein <35770095+attackjom@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
Co-authored-by: Aleos <aleos89@users.noreply.github.com>
This commit is contained in:
Jittapan Pluemsumran
2020-06-30 15:57:03 +07:00
committed by GitHub
parent 5112f8e2d8
commit d38d2b6b71
9 changed files with 156 additions and 17 deletions

View File

@@ -8765,19 +8765,24 @@ void clif_guild_emblem(struct map_session_data *sd,struct guild *g)
/// Sends update of the guild id/emblem id to everyone in the area (ZC_CHANGE_GUILD).
/// 01b4 <id>.L <guild id>.L <emblem id>.W
/// 0b47 <guild id>.L <version>.L <unknown>.L
void clif_guild_emblem_area(struct block_list* bl)
{
uint8 buf[12];
nullpo_retv(bl);
// TODO this packet doesn't force the update of ui components that have the emblem visible
// (emblem in the flag npcs and emblem over the head in agit maps) [FlavioJS]
WBUFW(buf,0) = 0x1b4;
WBUFL(buf,2) = bl->id;
WBUFL(buf,6) = status_get_guild_id(bl);
WBUFW(buf,10) = status_get_emblem_id(bl);
clif_send(buf, 12, bl, AREA_WOS);
PACKET_ZC_CHANGE_GUILD p{};
p.packetType = changeGuildEmblem;
p.guild_id = status_get_guild_id(bl);
p.emblem_id = status_get_emblem_id(bl);
#if PACKETVER < 20190724
p.aid = bl->id;
#else
p.unknown = 0;
#endif
clif_send(&p, sizeof(p), bl, AREA_WOS);
}
@@ -13843,6 +13848,29 @@ void clif_parse_GuildChangeEmblem(int fd,struct map_session_data *sd){
guild_change_emblem(sd, emblem_len, (const char*)emblem);
}
/// Request to update the guild emblem id (version, according to Gravity)
/// 0b46 <guild id>.L <version>.L
void clif_parse_GuildChangeEmblem2(int fd, struct map_session_data* sd) {
nullpo_retv(sd);
#if PACKETVER >= 20190724
const PACKET_CZ_GUILD_EMBLEM_CHANGE2* p = (PACKET_CZ_GUILD_EMBLEM_CHANGE2*)RFIFOP(fd, 0);
guild* g = sd->guild;
if (g == nullptr || g->guild_id != p->guild_id)
return;
if (!sd->state.gmaster_flag)
return;
if (!battle_config.emblem_woe_change && is_agit_start()) {
clif_messagecolor(&sd->bl, color_table[COLOR_RED], msg_txt(sd, 385), false, SELF); //"You not allowed to change emblem during woe"
return;
}
guild_change_emblem_version(sd, p->version);
#endif
}
/// Guild notice update request (CZ_GUILD_NOTICE).
/// 016e <guild id>.L <msg1>.60B <msg2>.120B
@@ -21618,4 +21646,3 @@ void do_init_clif(void) {
void do_final_clif(void) {
ers_destroy(delay_clearunit_ers);
}