def handle(world_session, socket, reader): if len(reader.data ) >= 12: # Avoid handling empty group loot method packet. loot_method, loot_master = unpack('<IQ', reader.data[:12]) target_player_mgr = None if not world_session.player_mgr.group_manager: GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_NOT_IN_GROUP) if world_session.player_mgr.guid != world_session.player_mgr.group_manager.group.leader_guid: GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_INVITE, '', PartyResults.ERR_NOT_LEADER) if loot_master > 0: target_player_mgr = RealmDatabaseManager.character_get_by_guid( loot_master) if target_player_mgr: world_session.player_mgr.group_manager.set_loot_method( loot_method, master_looter_guid=target_player_mgr.guid) else: world_session.player_mgr.group_manager.set_loot_method( loot_method) return 0
def handle(world_session, socket, reader): if not world_session.player_mgr.group_manager: GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_NOT_IN_GROUP) else: world_session.player_mgr.group_manager.leave_party( world_session.player_mgr.guid) return 0
def handle(world_session, socket, reader): target_name = PacketReader.read_string(reader.data, 0).strip() target_player_mgr = WorldSessionStateHandler.find_player_by_name(target_name) if target_player_mgr: GroupManager.invite_player(world_session.player_mgr, target_player_mgr) else: GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_INVITE, target_name, PartyResults.ERR_BAD_PLAYER_NAME_S) return 0
def send_party(sender, message, lang): if sender.group_manager: sender_packet = ChatManager._get_message_packet( sender.guid, sender.chat_flags, message, ChatMsgs.CHAT_MSG_PARTY, lang) sender.group_manager.send_packet_to_members(sender_packet, source=sender, use_ignore=True) else: GroupManager.send_group_operation_result( sender, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_NOT_IN_GROUP)
def handle(world_session, socket, reader): target_name = PacketReader.read_string(reader.data, 0).strip() target_player_mgr = WorldSessionStateHandler.find_player_by_name(target_name) if not target_player_mgr: GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_BAD_PLAYER_NAME_S) elif world_session.player_mgr.group_manager: world_session.player_mgr.group_manager.un_invite_player(world_session.player_mgr, target_player_mgr) else: GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_NOT_IN_GROUP) return 0
def handle(world_session, socket, reader): if len(reader.data) >= 8: # Avoid handling empty group uninvite guid packet guid = unpack('<Q', reader.data[:8])[0] target_player_mgr = WorldSessionStateHandler.find_player_by_guid(guid) if not target_player_mgr: GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_BAD_PLAYER_NAME_S) elif world_session.player_mgr.group_manager: world_session.player_mgr.group_manager.un_invite_player(world_session.player_mgr, target_player_mgr) else: GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_NOT_IN_GROUP) return 0
def handle(world_session, socket, reader): if len(reader.data ) >= 8: # Avoid handling empty group uninvite guid packet guid = unpack('<Q', reader.data[:8])[0] target_player_mgr = RealmDatabaseManager.character_get_by_guid( guid) if not world_session.player_mgr.group_manager: GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_NOT_IN_GROUP) elif not target_player_mgr: GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, 'Player', PartyResults.ERR_BAD_PLAYER_NAME_S) elif not world_session.player_mgr.group_manager.is_party_member( target_player_mgr.guid): GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, target_player_mgr.name, PartyResults.ERR_TARGET_NOT_IN_YOUR_GROUP_S) else: world_session.player_mgr.group_manager.un_invite_player( world_session.player_mgr.guid, target_player_mgr.guid) return 0
def handle(world_session, socket, reader): if len(reader.data ) > 1: # Avoid handling empty Group Set Leader packet. target_name = PacketReader.read_string(reader.data, 0).strip() target_player_mgr = RealmDatabaseManager.character_get_by_name( target_name) if not world_session.player_mgr.group_manager: GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, '', PartyResults.ERR_NOT_IN_GROUP) elif not target_player_mgr: GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, target_name, PartyResults.ERR_BAD_PLAYER_NAME_S) elif not world_session.player_mgr.group_manager.is_party_member( target_player_mgr.guid): GroupManager.send_group_operation_result( world_session.player_mgr, PartyOperations.PARTY_OP_LEAVE, target_name, PartyResults.ERR_TARGET_NOT_IN_YOUR_GROUP_S) else: world_session.player_mgr.group_manager.set_party_leader( world_session.player_mgr.guid, target_player_mgr.guid) return 0
def handle(world_session, socket, reader): if len(reader.data) > 1: # Avoid handling empty Group Invite packet. target_name = PacketReader.read_string(reader.data, 0).strip() target_player_mgr = WorldSessionStateHandler.find_player_by_name(target_name) if world_session.player_mgr.has_pending_group_invite: GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_INVITE, '', PartyResults.ERR_INVITE_RESTRICTED) elif world_session.player_mgr.group_manager and world_session.player_mgr.group_manager.is_full(): GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_INVITE, '', PartyResults.ERR_GROUP_FULL) elif not target_player_mgr: GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_INVITE, target_name, PartyResults.ERR_BAD_PLAYER_NAME_S) elif target_player_mgr.friends_manager.has_ignore(world_session.player_mgr.guid): GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_INVITE, target_name, PartyResults.ERR_IGNORING_YOU_S) elif target_player_mgr and (target_player_mgr.has_pending_group_invite or target_player_mgr.group_manager): GroupManager.send_group_operation_result(world_session.player_mgr, PartyOperations.PARTY_OP_INVITE, target_player_mgr.player.name, PartyResults.ERR_ALREADY_IN_GROUP_S) else: GroupManager.invite_player(world_session.player_mgr, target_player_mgr) return 0