Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
GuckTubeYT authored Jul 8, 2023
1 parent e4ed9f2 commit 5e34e8a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
18 changes: 9 additions & 9 deletions events/eventClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

void clientConnect() {
if (isSendToServer) {
printf("[Client] Client connected into proxy\n[Client] Connecting to subserver...\n");
printf("[CLIENT -> SERVER] Client connected into proxy\n[CLIENT -> SERVER] Connecting to subserver...\n");
enet_host_destroy(realServer);

realServer = enet_host_create(NULL, 1, 2, 0, 0);
Expand All @@ -28,7 +28,7 @@ void clientConnect() {

isSendToServer = 0;
} else {
printf("[Client] Client connected into proxy\n[Client] Connecting to Growtopia Server...\n");
printf("[CLIENT -> SERVER] Client connected into proxy\n[CLIENT -> SERVER] Connecting to Growtopia Server...\n");

memset(&realAddress, 0, sizeof(ENetAddress));
if (userConfig.usingServerData) {
Expand All @@ -46,7 +46,7 @@ void clientConnect() {
free(arr);
}
else {
printf("[Client] Client connected into proxy\n[Client] Connecting to Custom Growtopia Server...\n");
printf("[CLIENT -> SERVER] Client connected into proxy\n[CLIENT -> SERVER] Connecting to Custom Growtopia Server...\n");
enet_address_set_host(&realAddress, userConfig.manualIP);
realAddress.port = userConfig.manualPort;
realPeer = enet_host_connect(realServer, &realAddress, 2, 0);
Expand Down Expand Up @@ -83,7 +83,7 @@ void clientReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
}

char* resultSpoofed = arrayJoin(loginInfo, "\n", 1);
printf("[Client] Spoofed Login info: %s\n", resultSpoofed);
printf("[CLIENT -> SERVER] Spoofed Login info: %s\n", resultSpoofed);
sendPacket(2, resultSpoofed, serverPeer);

free(resultSpoofed);
Expand All @@ -92,7 +92,7 @@ void clientReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
break;
}

printf("[Client] Packet 2: received packet text: %s\n", packetText);
printf("[CLIENT -> SERVER] Packet 2: received packet text: %s\n", packetText);

if ((packetText + 19)[0] == '/') {
// command here
Expand Down Expand Up @@ -165,7 +165,7 @@ void clientReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
}
case 3: {
char* packetText = GetTextPointerFromPacket(event.packet);
printf("[Client] Packet 3: received packet text: %s\n", packetText);
printf("[CLIENT -> SERVER] Packet 3: received packet text: %s\n", packetText);
if (isStr(packetText, "action|quit", 1)) {
isLoop = 0;
doLoop = 1;
Expand All @@ -182,23 +182,23 @@ void clientReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
break;
}
default: {
printf("[Client] TankUpdatePacket: Unknown packet tank type: %d\n", event.packet->data[4]);
printf("[CLIENT -> SERVER] TankUpdatePacket: Unknown packet tank type: %d\n", event.packet->data[4]);
enet_peerSend(event.packet, serverPeer);
break;
}
}
break;
}
default: {
printf("[Client] Unknown message type: %d\n", GetMessageTypeFromPacket(event.packet));
printf("[CLIENT -> SERVER] Unknown message type: %d\n", GetMessageTypeFromPacket(event.packet));
enet_peerSend(event.packet, serverPeer);
break;
}
}
}

void clientDisconnect() {
printf("[Client] Client just disconnected from Proxy\n");
printf("[CLIENT -> SERVER] Client just disconnected from Proxy\n");
isLoop = 0;
doLoop = 1;
}
26 changes: 13 additions & 13 deletions events/eventServer.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,30 @@
#include "../proxyStruct.h"

void serverConnect() {
printf("[Server] Proxy connected into Server\n");
printf("[SERVER -> CLIENT] Proxy connected into Server\n");
}

void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer) {
switch(GetMessageTypeFromPacket(event.packet)) {
case 1: {
printf("[Server] Server just send Hello Packet\n[Client] Sending login info\n");
printf("[SERVER -> CLIENT] Server just send Hello Packet\n[CLIENT -> SERVER] Sending login info\n");
SendPacketPacket(event.packet, clientPeer);
break;
}
case 2: {
char* packetText = GetTextPointerFromPacket(event.packet);
printf("[Server] Packet 2: received packet text: %s\n", packetText);
printf("[SERVER -> CLIENT] Packet 2: received packet text: %s\n", packetText);
enet_peerSend(event.packet, clientPeer);
break;
}
case 3: {
char* packetText = GetTextPointerFromPacket(event.packet);
printf("[Server] Packet 3: received packet text: %s\n", packetText);
printf("[SERVER -> CLIENT] Packet 3: received packet text: %s\n", packetText);
enet_peerSend(event.packet, clientPeer);
break;
}
case 4: {
printf("[Server] Packet 4: Received packet tank: %d\n", event.packet->data[4]);
printf("[SERVER -> CLIENT] Packet 4: Received packet tank: %d\n", event.packet->data[4]);
switch(event.packet->data[4]) {
case 1: {
unsigned char* packetTank = GetExtendedDataPointerFromTankPacket(event.packet->data + 4);
Expand All @@ -45,7 +45,7 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
case 1: {
float value;
memcpy(&value, packetTank, 4); packetTank += 4;
printf("[Server] TankUpdatePacket Variable: float found at %d: %f\n", index, value);
printf("[SERVER -> CLIENT] TankUpdatePacket Variable: float found at %d: %f\n", index, value);
break;
}
case 2: {
Expand Down Expand Up @@ -126,7 +126,7 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
}
}

printf("[Server] TankUpdatePacket Variable: string found at %d: %s\n", index, value);
printf("[SERVER -> CLIENT] TankUpdatePacket Variable: string found at %d: %s\n", index, value);
free(value);
break;
}
Expand All @@ -137,14 +137,14 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
memcpy(&value1, packetTank, 4); packetTank += 4;
memcpy(&value2, packetTank, 4); packetTank += 4;

printf("[Server] TankUpdatePacket Variable: vector found at %d: %f, %f\n", index, value1, value2);
printf("[SERVER -> CLIENT] TankUpdatePacket Variable: vector found at %d: %f, %f\n", index, value1, value2);
break;
}
case 5: {
int value;
memcpy(&value, packetTank, 4); packetTank += 4;

printf("[Server] TankUpdatePacket Variable: integer X found at %d: %d\n", index, value);
printf("[SERVER -> CLIENT] TankUpdatePacket Variable: integer X found at %d: %d\n", index, value);
break;
}
case 9: {
Expand All @@ -170,11 +170,11 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
}
}

printf("[Server] TankUpdatePacket Variable: integer found at %d: %d\n", index, value);
printf("[SERVER -> CLIENT] TankUpdatePacket Variable: integer found at %d: %d\n", index, value);
break;
}
default: {
printf("[Server] TankUpdatePacket Variable: unknown variable type: %d\n", type);
printf("[SERVER -> CLIENT] TankUpdatePacket Variable: unknown variable type: %d\n", type);
break;
}
}
Expand Down Expand Up @@ -208,13 +208,13 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
break;
}
default: {
printf("[Server] Unknown message type: %d\n", GetMessageTypeFromPacket(event.packet));
printf("[SERVER -> CLIENT] Unknown message type: %d\n", GetMessageTypeFromPacket(event.packet));
enet_peerSend(event.packet, clientPeer);
break;
}
}
}

void serverDisconnect() {
printf("[Server] Proxy just disconnected from Server\n");
printf("[SERVER -> CLIENT] Proxy just disconnected from Server\n");
}

0 comments on commit 5e34e8a

Please sign in to comment.