|
@@ -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);
|
|
|
- return;
|
|
|
- }
|
|
|
+ int16 entries = ( p->packetLength - sizeof( *p ) ) / sizeof( p->list[0] );
|
|
|
|
|
|
- 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;
|
|
|
- }
|
|
|
+ for( int16 i = 0; i < entries; i++ ){
|
|
|
+ struct PACKET_CZ_REQ_CHANGE_MEMBERPOS_sub& entry = p->list[i];
|
|
|
|
|
|
- guild_gm_change(sd->status.guild_id, RFIFOL(fd, 8));
|
|
|
- return;
|
|
|
- }
|
|
|
+ // Guild leadership change
|
|
|
+ if( entry.position == 0 ){
|
|
|
+ if( !battle_config.guild_leaderchange_woe && is_agit_start() ){
|
|
|
+ clif_msg( sd, GUILD_MASTER_WOE );
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
- for(i=idxgpos;i<len;i+=12){
|
|
|
- int position = RFIFOL(fd,i+8);
|
|
|
+ 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;
|
|
|
+ }
|
|
|
|
|
|
- if( position > 0 ){
|
|
|
- guild_change_memberposition(sd->status.guild_id,RFIFOL(fd,i),RFIFOL(fd,i+4),position);
|
|
|
+ guild_gm_change( sd->status.guild_id, entry.CID );
|
|
|
+
|
|
|
+ // No further entries will be processed - the requesting player lost his guild master status
|
|
|
+ return;
|
|
|
+ }else if( entry.position > 0 ){
|
|
|
+ guild_change_memberposition( sd->status.guild_id, entry.AID, entry.CID, entry.position );
|
|
|
}
|
|
|
}
|
|
|
}
|