private static void HandleNameVoucher(GameSession session, PacketReader packet, Item item)
    {
        string newName = packet.ReadUnicodeString();
        string oldName = session.Player.Name;

        session.Player.Name = newName;

        session.Player.Inventory.ConsumeItem(session, item.Uid, 1);

        session.Send(CharacterListPacket.NameChanged(session.Player.CharacterId, newName));

        // Update name on socials
        foreach (Club club in session.Player.Clubs)
        {
            club.BroadcastPacketClub(ClubPacket.UpdateMemberName(oldName, newName, session.Player.CharacterId));
            if (club.LeaderCharacterId == session.Player.CharacterId)
            {
                club.LeaderName = newName;
            }
        }

        if (session.Player.Guild is not null)
        {
            session.Player.Guild?.BroadcastPacketGuild(GuildPacket.UpdateMemberName(oldName, newName));
            if (session.Player.Guild.LeaderCharacterId == session.Player.CharacterId)
            {
                session.Player.Guild.LeaderName = newName;
            }
        }

        session.Player.Party?.BroadcastPacketParty(PartyPacket.UpdatePlayer(session.Player));

        // TODO: Needs to redirect player to character selection screen after pop-up
    }
예제 #2
0
        public static void HandleNameVoucher(GameSession session, PacketReader packet, Item item)
        {
            string characterName = packet.ReadUnicodeString();

            session.Player.Name = characterName;

            InventoryController.Consume(session, item.Uid, 1);

            session.Send(CharacterListPacket.NameChanged(session.Player.CharacterId, characterName));
            // TODO: Needs to redirect player to character selection screen after pop-up
        }