Skip to content

Commit bdfaeea

Browse files
committed
ver 1.1.0
Added project files
1 parent 157f8f3 commit bdfaeea

File tree

15 files changed

+912
-0
lines changed

15 files changed

+912
-0
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/.idea/
2+
/cmake-build-debug/
3+
/cmake-build-release/
4+
/build/

CMakeLists.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
cmake_minimum_required(VERSION 3.23)
2+
project(MCSandbox)
3+
4+
set(CMAKE_CXX_STANDARD 17)
5+
6+
set(CMAKE_AUTOUIC_SEARCH_PATHS ui)
7+
8+
set(CMAKE_AUTOMOC ON)
9+
set(CMAKE_AUTORCC ON)
10+
set(CMAKE_AUTOUIC ON)
11+
12+
set(CMAKE_PREFIX_PATH D:/Programming/libs/CPP/Qt/Qt5.14.2/5.14.2/mingw73_64/lib/cmake/Qt5) # path/to/Qt5
13+
14+
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ../build) # path/to/build_directory
15+
16+
find_library(WSOCK32_LIBRARY wsock32)
17+
find_library(WS2_32_LIBRARY ws2_32)
18+
19+
find_package(Qt5 COMPONENTS
20+
Core
21+
Gui
22+
Widgets
23+
Sql
24+
PrintSupport
25+
REQUIRED
26+
)
27+
28+
add_executable(
29+
${PROJECT_NAME}
30+
WIN32
31+
source/main.cpp
32+
headers/mainwindow.h
33+
source/mainwindow.cpp
34+
ui/mainwindow.ui
35+
headers/dialog.h
36+
source/dialog.cpp
37+
ui/dialog.ui
38+
headers/bot.h
39+
headers/fplib.h
40+
source/fplib.cpp
41+
headers/realonline.h
42+
source/realonline.cpp
43+
)
44+
45+
target_link_libraries(${PROJECT_NAME} wsock32 ws2_32)
46+
47+
target_link_libraries(${PROJECT_NAME}
48+
Qt5::Core
49+
Qt5::Gui
50+
Qt5::Widgets
51+
)

headers/bot.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#ifndef FAKEPLAYER_H
2+
#define FAKEPLAYER_H
3+
4+
#include "fplib.h"
5+
#include <string>
6+
7+
struct bot
8+
{
9+
std::string nick;
10+
FakePlayer attributes;
11+
bool onlineStatus = false;
12+
bool isBusy = false;
13+
};
14+
15+
#endif // FAKEPLAYER_H

headers/dialog.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#ifndef DIALOG_H
2+
#define DIALOG_H
3+
4+
#include <QDialog>
5+
6+
namespace Ui {
7+
class Dialog;
8+
}
9+
10+
class Dialog : public QDialog
11+
{
12+
Q_OBJECT
13+
14+
public:
15+
explicit Dialog(QWidget *parent = nullptr);
16+
bool getBungeecord();
17+
bool getCompression();
18+
QString getIP();
19+
int getPort();
20+
~Dialog();
21+
22+
private slots:
23+
void on_Ok_clicked();
24+
25+
private:
26+
Ui::Dialog *ui;
27+
};
28+
29+
#endif // DIALOG_H

headers/fplib.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#include <winsock2.h>
2+
#include <ws2tcpip.h>
3+
#include <windows.h>
4+
#pragma comment(lib, "ws2_32")
5+
6+
typedef struct _FakePlayer
7+
{
8+
HANDLE t;
9+
SOCKET s;
10+
bool compression;
11+
bool bungeecord;
12+
} FakePlayer;
13+
14+
bool CreateFP(const char* nick, FakePlayer* fp, const char* ip, u_short port);
15+
bool SendCommandFP(const char* cmd, FakePlayer* fp);
16+
bool DestroyFP(FakePlayer* fp);

headers/mainwindow.h

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#ifndef MAINWINDOW_H
2+
#define MAINWINDOW_H
3+
4+
#include <QMainWindow>
5+
#include <QVector>
6+
#include <QEvent>
7+
8+
#include <thread>
9+
#include <fstream>
10+
11+
#include "realonline.h"
12+
#include "dialog.h"
13+
14+
QT_BEGIN_NAMESPACE
15+
namespace Ui { class MainWindow; }
16+
QT_END_NAMESPACE
17+
18+
class MainWindow : public QMainWindow
19+
{
20+
Q_OBJECT
21+
22+
public:
23+
MainWindow(QWidget *parent = nullptr);
24+
~MainWindow();
25+
26+
public slots:
27+
28+
void on_send_clicked();
29+
30+
private slots:
31+
void on_listOfPlayers_doubleClicked(const QModelIndex &index);
32+
33+
void on_logout_clicked();
34+
35+
void on_login_clicked();
36+
37+
void on_CALL_clicked();
38+
39+
void on_DALL_clicked();
40+
41+
void on_RO_stateChanged(int arg1);
42+
43+
private:
44+
45+
void checkOnline();
46+
47+
Dialog serverInfo;
48+
49+
void nickList();
50+
51+
Ui::MainWindow *ui;
52+
53+
QVector<bot> Bot;
54+
55+
realOnline RO;
56+
57+
int lastRow = -1;
58+
};
59+
#endif // MAINWINDOW_H

headers/realonline.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#ifndef REALONLINE_H
2+
#define REALONLINE_H
3+
4+
#include <QThread>
5+
#include <QVector>
6+
#include <QTime>
7+
#include <QDebug>
8+
9+
#include <time.h>
10+
11+
#include "bot.h"
12+
13+
using namespace std;
14+
15+
class realOnline : public QThread
16+
{
17+
public:
18+
float graph[24] = {0.2153, 0.1127, 0.1371, 0.0783, 0.0923, 0.1234, 0.1662, 0.2912, 0.4198, 0.4523, 0.8456, 0.5487, 0.7521, 0.9145, 1.0000, 0.8478, 0.8932, 0.9812, 0.8668, 0.8384, 0.8052, 0.6726, 0.5021, 0.3126 };
19+
void run();
20+
void changeOnline(float persent);
21+
QVector<bot>* BotThread;
22+
bool status = false;
23+
QString ip;
24+
int port;
25+
int userAmount;
26+
int userPersent;
27+
QTime realTime;
28+
};
29+
30+
#endif // REALONLINE_H

source/dialog.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include "../headers/dialog.h"
2+
#include "ui_dialog.h"
3+
4+
Dialog::Dialog(QWidget *parent) :
5+
QDialog(parent),
6+
ui(new Ui::Dialog)
7+
{
8+
ui->setupUi(this);
9+
}
10+
11+
Dialog::~Dialog()
12+
{
13+
delete ui;
14+
}
15+
16+
bool Dialog::getBungeecord(){
17+
return ui->bungeecord->checkState();
18+
}
19+
20+
bool Dialog::getCompression(){
21+
return ui->compression->checkState();
22+
}
23+
24+
QString Dialog::getIP(){
25+
return ui->IP->toPlainText();
26+
}
27+
28+
int Dialog::getPort(){
29+
return ui->Port->toPlainText().toInt();
30+
}
31+
32+
void Dialog::on_Ok_clicked()
33+
{
34+
close();
35+
}

0 commit comments

Comments
 (0)