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 load_groups(): groups = RealmDatabaseManager.group_get_all() length = len(groups) count = 0 for group in groups: GroupManager.load_group(group) count += 1 Logger.progress('Loading groups...', count, length) return length
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
def handle(world_session, socket, reader): if len(reader.data) < 8: # Avoid handling wrong player login packet. return -1 guid = unpack('<Q', reader.data[:8])[0] world_session.player_mgr = PlayerManager( RealmDatabaseManager.character_get_by_guid(guid), world_session) world_session.player_mgr.session = world_session if not world_session.player_mgr.player: Logger.anticheat( f'Character with wrong guid ({guid}) tried to login.') return -1 else: WorldSessionStateHandler.push_active_player_session(world_session) # Disabled race & class checks (only if not a GM) if not world_session.player_mgr.is_gm: disabled_race_mask = config.Server.General.disabled_race_mask disabled = disabled_race_mask & world_session.player_mgr.race_mask == world_session.player_mgr.race_mask if not disabled: disabled_class_mask = config.Server.General.disabled_class_mask disabled = disabled_class_mask & world_session.player_mgr.class_mask == world_session.player_mgr.class_mask if disabled: # Not 100% sure if CHAR_LOGIN_DISABLED matters here, but I don't know where else to send it data = pack('<B', CharLogin.CHAR_LOGIN_DISABLED) world_session.enqueue_packet( PacketWriter.get_packet(OpCode.SMSG_CHARACTER_LOGIN_FAILED, data)) return 0 # Class & race allowed, continue with the login process world_session.enqueue_packet( PacketWriter.get_packet(OpCode.SMSG_LOGIN_SETTIMESPEED, PlayerLoginHandler._get_login_timespeed())) world_session.player_mgr.skill_manager.load_proficiencies() world_session.player_mgr.spell_manager.load_spells() world_session.player_mgr.deathbind = RealmDatabaseManager.character_get_deathbind( world_session.player_mgr.guid) world_session.player_mgr.friends_manager.load_from_db( RealmDatabaseManager.character_get_social( world_session.player_mgr.guid)) world_session.enqueue_packet( world_session.player_mgr.get_deathbind_packet()) # Tutorials aren't implemented in 0.5.3 # world_session.enqueue_packet(world_session.player_mgr.get_tutorial_packet()) world_session.player_mgr.skill_manager.init_proficiencies() world_session.enqueue_packet( world_session.player_mgr.spell_manager.get_initial_spells()) world_session.enqueue_packet( world_session.player_mgr.get_action_buttons()) # MotD ChatManager.send_system_message(world_session, config.Server.General.motd) world_session.player_mgr.inventory.load_items() world_session.player_mgr.stat_manager.init_stats() world_session.player_mgr.stat_manager.apply_bonuses() world_session.player_mgr.skill_manager.load_skills() world_session.player_mgr.quest_manager.load_quests() world_session.player_mgr.reputation_manager.load_reputations() GuildManager.set_character_guild(world_session.player_mgr) GroupManager.set_character_group(world_session.player_mgr) PetitionManager.load_petition(world_session.player_mgr) # First login if world_session.player_mgr.player.totaltime == 0: # Replenish health, and mana if needed. world_session.player_mgr.set_health( world_session.player_mgr.max_health) if world_session.player_mgr.power_type == PowerTypes.TYPE_MANA: world_session.player_mgr.set_mana( world_session.player_mgr.max_power_1) # Load self before sending cinematic PlayerLoginHandler._load_self(world_session.player_mgr) # Send cinematic PlayerLoginHandler._send_cinematic(world_session, world_session.player_mgr.player, socket) else: PlayerLoginHandler._load_self(world_session.player_mgr) world_session.player_mgr.complete_login() return 0