Added new guild UI features (#6285)
Co-authored-by: Aleos <aleos89@users.noreply.github.com> Co-authored-by: Lemongrass3110 <lemongrass@kstp.at> Co-authored-by: Null Ragnarok Relation <59070443+iberryRO@users.noreply.github.com>
This commit is contained in:
143
src/map/clif.cpp
143
src/map/clif.cpp
@@ -3290,6 +3290,148 @@ void clif_guild_xy_remove(map_session_data *sd)
|
||||
clif_send(buf,packet_len(0x1eb),&sd->bl,GUILD_SAMEMAP_WOS);
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Load castle list for guild UI. [Asheraf] / [Balfear]
|
||||
*------------------------------------------*/
|
||||
void clif_guild_castle_list(map_session_data& sd){
|
||||
#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
|
||||
struct guild* g = sd.guild;
|
||||
|
||||
if (g == nullptr)
|
||||
return;
|
||||
|
||||
int castle_count = guild_checkcastles(g);
|
||||
|
||||
if (castle_count > 0) {
|
||||
struct PACKET_ZC_GUILD_AGIT_INFO* p = (struct PACKET_ZC_GUILD_AGIT_INFO*)packet_buffer;
|
||||
|
||||
p->packetType = HEADER_ZC_GUILD_AGIT_INFO;
|
||||
p->packetLength = static_cast<int16>( sizeof( struct PACKET_ZC_GUILD_AGIT_INFO ) );
|
||||
|
||||
int i = 0;
|
||||
for (const auto& gc : castle_db) {
|
||||
if (gc.second->guild_id == g->guild_id && gc.second->client_id) {
|
||||
p->castle_list[i] = static_cast<int8>( gc.second->client_id );
|
||||
p->packetLength += static_cast<int16>( sizeof( p->castle_list[0] ) );
|
||||
++i;
|
||||
}
|
||||
}
|
||||
|
||||
clif_send(p, p->packetLength, &sd.bl, SELF);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Send castle info Economy/Defence. [Asheraf] / [Balfear]
|
||||
*------------------------------------------*/
|
||||
void clif_guild_castleinfo(map_session_data& sd, std::shared_ptr<guild_castle> castle ){
|
||||
#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
|
||||
if( castle->client_id == 0 ){
|
||||
return;
|
||||
}
|
||||
|
||||
struct PACKET_ZC_REQ_ACK_AGIT_INVESTMENT p = {};
|
||||
|
||||
p.packetType = HEADER_ZC_REQ_ACK_AGIT_INVESTMENT;
|
||||
p.castle_id = static_cast<int8>( castle->client_id );
|
||||
p.economy = castle->economy;
|
||||
p.defense = castle->defense;
|
||||
|
||||
clif_send(&p, sizeof(p), &sd.bl, SELF);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Show teleport request result. [Asheraf] / [Balfear]
|
||||
*------------------------------------------*/
|
||||
void clif_guild_castle_teleport_res(map_session_data& sd, enum e_siege_teleport_result result){
|
||||
#if PACKETVER_MAIN_NUM >= 20190731 || PACKETVER_RE_NUM >= 20190717 || PACKETVER_ZERO_NUM >= 20190814
|
||||
struct PACKET_ZC_REQ_ACK_MOVE_GUILD_AGIT p = {};
|
||||
|
||||
p.packetType = HEADER_ZC_REQ_ACK_MOVE_GUILD_AGIT;
|
||||
p.result = static_cast<int16>( result );
|
||||
|
||||
clif_send(&p, sizeof(p), &sd.bl, SELF);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Request castle info. [Asheraf] / [Balfear]
|
||||
*------------------------------------------*/
|
||||
void clif_parse_guild_castle_info_request(int fd, map_session_data* sd){
|
||||
#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515
|
||||
const struct PACKET_CZ_REQ_AGIT_INVESTMENT* p = (struct PACKET_CZ_REQ_AGIT_INVESTMENT*)RFIFOP(fd, 0);
|
||||
struct guild* g = sd->guild;
|
||||
|
||||
if (g == nullptr)
|
||||
return;
|
||||
|
||||
std::shared_ptr<guild_castle> gc = castle_db.find_by_clientid( p->castle_id );
|
||||
|
||||
if (gc == nullptr)
|
||||
return;
|
||||
if (gc->guild_id != g->guild_id)
|
||||
return;
|
||||
|
||||
clif_guild_castleinfo(*sd, gc);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
* Teleport to castle. [Asheraf] / [Balfear]
|
||||
*------------------------------------------*/
|
||||
void clif_parse_guild_castle_teleport_request(int fd, map_session_data* sd){
|
||||
#if PACKETVER_MAIN_NUM >= 20190522 || PACKETVER_RE_NUM >= 20190522 || PACKETVER_ZERO_NUM >= 20190515
|
||||
const struct PACKET_CZ_REQ_MOVE_GUILD_AGIT* p = (struct PACKET_CZ_REQ_MOVE_GUILD_AGIT*)RFIFOP(fd, 0);
|
||||
struct guild* g = sd->guild;
|
||||
|
||||
if (g == nullptr)
|
||||
return;
|
||||
|
||||
std::shared_ptr<guild_castle> gc = castle_db.find_by_clientid( p->castle_id );
|
||||
|
||||
if (gc == nullptr)
|
||||
return;
|
||||
if (!gc->warp_enabled)
|
||||
return;
|
||||
if (gc->guild_id != g->guild_id)
|
||||
return;
|
||||
|
||||
if (map_getmapflag(sd->bl.m, MF_GVG_CASTLE)
|
||||
|| map_getmapflag(sd->bl.m, MF_NOTELEPORT)
|
||||
|| map_getmapflag(sd->bl.m, MF_NOWARP))
|
||||
return;
|
||||
|
||||
uint32 zeny = gc->zeny;
|
||||
|
||||
switch( gc->type ){
|
||||
case WOE_FIRST_EDITION:
|
||||
if( agit_flag ){
|
||||
zeny = gc->zeny_siege;
|
||||
}
|
||||
break;
|
||||
case WOE_SECOND_EDITION:
|
||||
if( agit2_flag ){
|
||||
zeny = gc->zeny_siege;
|
||||
}
|
||||
break;
|
||||
case WOE_THIRD_EDITION:
|
||||
if( agit3_flag ){
|
||||
zeny = gc->zeny_siege;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (zeny && pc_payzeny(sd, zeny, LOG_TYPE_OTHER, nullptr)) {
|
||||
clif_guild_castle_teleport_res(*sd, SIEGE_TP_NOT_ENOUGH_ZENY);
|
||||
return;
|
||||
}
|
||||
|
||||
pc_setpos(sd, gc->mapindex, gc->warp_x, gc->warp_y, CLR_OUTSIGHT);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*==========================================
|
||||
*
|
||||
*------------------------------------------*/
|
||||
@@ -14063,6 +14205,7 @@ void clif_parse_GuildRequestInfo(int fd, map_session_data *sd)
|
||||
case 0: // Basic Information Guild, hostile alliance information
|
||||
clif_guild_basicinfo( *sd );
|
||||
clif_guild_allianceinfo(sd);
|
||||
clif_guild_castle_list(*sd);
|
||||
break;
|
||||
case 1: // Members list, list job title
|
||||
clif_guild_positionnamelist(sd);
|
||||
|
||||
Reference in New Issue
Block a user