Cleanup for guild position change (#7405)
Fixes #7387 This not really fully fixes it, but it makes it more clear. Additionally changed to structs. Thanks to @MrAntares
This commit is contained in:
parent
bf2b62bc9c
commit
a76e7b8818
@ -14175,38 +14175,35 @@ void clif_parse_GuildChangePositionInfo(int fd, struct map_session_data *sd)
|
||||
|
||||
/// Request to update the position of guild members (CZ_REQ_CHANGE_MEMBERPOS).
|
||||
/// 0155 <packet len>.W { <account id>.L <char id>.L <position id>.L }*
|
||||
void clif_parse_GuildChangeMemberPosition(int fd, struct map_session_data *sd)
|
||||
{
|
||||
int i;
|
||||
struct s_packet_db* info = &packet_db[RFIFOW(fd,0)];
|
||||
int len = RFIFOW(fd,info->pos[0]);
|
||||
int idxgpos = info->pos[1];
|
||||
|
||||
void clif_parse_GuildChangeMemberPosition( int fd, struct map_session_data *sd ){
|
||||
if(!sd->state.gmaster_flag)
|
||||
return;
|
||||
|
||||
struct PACKET_CZ_REQ_CHANGE_MEMBERPOS* p = (struct PACKET_CZ_REQ_CHANGE_MEMBERPOS*)RFIFOP( fd, 0 );
|
||||
|
||||
// Guild leadership change
|
||||
if( len == 16 && RFIFOL(fd,12) == 0 ){
|
||||
if( !battle_config.guild_leaderchange_woe && is_agit_start() ){
|
||||
clif_msg(sd, GUILD_MASTER_WOE);
|
||||
int16 entries = ( p->packetLength - sizeof( *p ) ) / sizeof( p->list[0] );
|
||||
|
||||
for( int16 i = 0; i < entries; i++ ){
|
||||
struct PACKET_CZ_REQ_CHANGE_MEMBERPOS_sub& entry = p->list[i];
|
||||
|
||||
// Guild leadership change
|
||||
if( entry.position == 0 ){
|
||||
if( !battle_config.guild_leaderchange_woe && is_agit_start() ){
|
||||
clif_msg( sd, GUILD_MASTER_WOE );
|
||||
return;
|
||||
}
|
||||
|
||||
if( battle_config.guild_leaderchange_delay && DIFF_TICK( time( nullptr ),sd->guild->last_leader_change ) < battle_config.guild_leaderchange_delay ){
|
||||
clif_msg( sd, GUILD_MASTER_DELAY );
|
||||
return;
|
||||
}
|
||||
|
||||
guild_gm_change( sd->status.guild_id, entry.CID );
|
||||
|
||||
// No further entries will be processed - the requesting player lost his guild master status
|
||||
return;
|
||||
}
|
||||
|
||||
if( battle_config.guild_leaderchange_delay && DIFF_TICK(time(NULL),sd->guild->last_leader_change) < battle_config.guild_leaderchange_delay ){
|
||||
clif_msg(sd, GUILD_MASTER_DELAY);
|
||||
return;
|
||||
}
|
||||
|
||||
guild_gm_change(sd->status.guild_id, RFIFOL(fd, 8));
|
||||
return;
|
||||
}
|
||||
|
||||
for(i=idxgpos;i<len;i+=12){
|
||||
int position = RFIFOL(fd,i+8);
|
||||
|
||||
if( position > 0 ){
|
||||
guild_change_memberposition(sd->status.guild_id,RFIFOL(fd,i),RFIFOL(fd,i+4),position);
|
||||
}else if( entry.position > 0 ){
|
||||
guild_change_memberposition( sd->status.guild_id, entry.AID, entry.CID, entry.position );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,7 +236,7 @@
|
||||
packet(0x0152,-1);
|
||||
parseable_packet(0x0153,-1,clif_parse_GuildChangeEmblem,2,4);
|
||||
packet(0x0154,-1);
|
||||
parseable_packet(0x0155,-1,clif_parse_GuildChangeMemberPosition,2,4);
|
||||
parseable_packet( HEADER_CZ_REQ_CHANGE_MEMBERPOS, -1, clif_parse_GuildChangeMemberPosition, 0 );
|
||||
packet(0x0156,-1);
|
||||
packet(0x0157,6);
|
||||
packet(0x0158,-1);
|
||||
|
@ -355,6 +355,18 @@ struct PACKET_CZ_PC_SELL_ITEMLIST {
|
||||
PACKET_CZ_PC_SELL_ITEMLIST_sub sellList[];
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PACKET_CZ_REQ_CHANGE_MEMBERPOS_sub{
|
||||
uint32 AID;
|
||||
uint32 CID;
|
||||
int32 position;
|
||||
} __attribute__((packed));
|
||||
|
||||
struct PACKET_CZ_REQ_CHANGE_MEMBERPOS{
|
||||
int16 packetType;
|
||||
int16 packetLength;
|
||||
struct PACKET_CZ_REQ_CHANGE_MEMBERPOS_sub list[];
|
||||
} __attribute__((packed));
|
||||
|
||||
// NetBSD 5 and Solaris don't like pragma pack but accept the packed attribute
|
||||
#if !defined( sun ) && ( !defined( __NETBSD__ ) || __NetBSD_Version__ >= 600000000 )
|
||||
#pragma pack( pop )
|
||||
@ -365,6 +377,7 @@ DEFINE_PACKET_HEADER(ZC_BROADCAST, 0x9a)
|
||||
DEFINE_PACKET_HEADER(ZC_ITEM_ENTRY, 0x9d)
|
||||
DEFINE_PACKET_HEADER(ZC_PC_PURCHASE_RESULT, 0xca)
|
||||
DEFINE_PACKET_HEADER(ZC_MVP_GETTING_ITEM, 0x10a)
|
||||
DEFINE_PACKET_HEADER(CZ_REQ_CHANGE_MEMBERPOS, 0x155)
|
||||
DEFINE_PACKET_HEADER(CZ_REQMAKINGITEM, 0x18e)
|
||||
DEFINE_PACKET_HEADER(ZC_ACK_REQMAKINGITEM, 0x18f)
|
||||
DEFINE_PACKET_HEADER(CZ_REQ_MAKINGARROW, 0x1ae)
|
||||
|
Loading…
x
Reference in New Issue
Block a user