-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.cpp
More file actions
71 lines (61 loc) · 1.82 KB
/
main.cpp
File metadata and controls
71 lines (61 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <iostream>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <iomanip>
#include <chrono>
#include <ctime>
#include "config.h"
#include "shared/logger.h"
#include "shared/packets.h"
#include "network/login.h"
#include "network/char.h"
#include "network/map.h"
#pragma comment(lib, "ws2_32.lib")
int main() {
log("--------------------------------------------");
log(">> Ragnarok Online Clientless Bot Started");
log(">> Flow: Login -> Character -> Map");
log("--------------------------------------------");
// Initialize Winsock
WSADATA wsaData;
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
log("Failed to initialize Winsock.");
return 1;
}
log("Winsock initialized.\n");
// Step 1: Connect to Login Server
LoginSession loginSession;
log("Connecting to Login Server...");
if (!connect_login_server(loginSession)) {
log("Login server connection failed.");
WSACleanup();
return 1;
}
log("Login successful.\n");
// Step 2: Connect to Character Server
CharSession charSession;
log("Connecting to Character Server...");
if (!connect_char_server(loginSession, charSession)) {
log("Character server connection failed.");
WSACleanup();
return 1;
}
log("Character selected and map server info received.\n");
// Step 3: Connect to Map Server
log("Connecting to Map Server...");
if (!connect_map_server(loginSession, charSession)) {
log("Map server connection failed.");
WSACleanup();
return 1;
}
log("Entered map server successfully.\n");
// Bot is now active
log(">>> Bot initialized. Standing by...");
log(">>> Press Enter to exit.\n");
getchar();
// Cleanup
WSACleanup();
log("Winsock cleaned up. Exiting.");
return 0;
}