Exemplo n.º 1
0
        public override void RunImplement()
        {
            Account player = client.SessionPlayer;
            Room    room   = player != null ? player.room : null;

            try
            {
                if (slotId < 0 || slotId > 15 || room == null || room.leaderSlot == slotId || room.slots[slotId].playerId == 0)
                {
                    client.SendCompletePacket(PackageDataManager.ROOM_CHANGE_HOST_ERROR_PAK);
                }
                else if (room.state == RoomStateEnum.Ready && room.leaderSlot == player.slotId)
                {
                    room.SetNewLeader(slotId, 0, room.leaderSlot, true);
                    using (ROOM_CHANGE_HOST_PAK packet = new ROOM_CHANGE_HOST_PAK(slotId))
                    {
                        room.SendPacketToPlayers(packet);
                    }
                    room.UpdateSlotsInfo();
                    room.UpdateRoomInfo();
                }
            }
            catch (Exception ex)
            {
                PacketLog(ex);
            }
        }
Exemplo n.º 2
0
 private void ChangeLeader(Room room, List<Account> players, int slotId)
 {
     room.SetNewLeader(slotId, 0, -1, false);
     using (ROOM_CHANGE_HOST_PAK packet = new ROOM_CHANGE_HOST_PAK(slotId))
     {
         SendPacketToRoom(packet, players);
     }
     room.UpdateSlotsInfo();
     room.RequestHost.Clear();
 }