Skip to content

Commit

Permalink
add dialog gazette skip
Browse files Browse the repository at this point in the history
  • Loading branch information
GuckTubeYT authored May 8, 2023
1 parent ec63046 commit e524768
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 9 deletions.
20 changes: 20 additions & 0 deletions GTProxy.layout
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Debug" />
<File name="events\eventClient.c" open="1" top="0" tabpos="2" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="126" />
</Cursor>
</File>
<File name="events\eventServer.c" open="1" top="1" tabpos="3" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="5345" topLine="90" />
</Cursor>
</File>
<File name="main.c" open="1" top="0" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="0" topLine="93" />
</Cursor>
</File>
</CodeBlocks_layout_file>
6 changes: 3 additions & 3 deletions events/eventClient.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ void clientReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
sendPacket(3, CatchMessage("action|join_request\nname|%s\ninvitedWorld|0", command[1]), serverPeer);
}
else if (isStr(command[0], "/fastroulette", 1)) {
if (userCommands.isFastRoulette) {
userCommands.isFastRoulette = 0;
if (userOpt.isFastRoulette) {
userOpt.isFastRoulette = 0;
sendPacket(3, "action|log\nmsg|`wFast roulette is `4turning off`w, type /fastroulette to `2turning on", clientPeer);
}
else {
userCommands.isFastRoulette = 1;
userOpt.isFastRoulette = 1;
sendPacket(3, "action|log\nmsg|`wFast roulette is `2turning on`w, type /fastroulette to `4turning off", clientPeer);
}
}
Expand Down
22 changes: 20 additions & 2 deletions events/eventServer.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
else if (isStr(value, "OnTalkBubble", 1)) {
OnPacket.OnTalkBubble = 1;
}
else if (isStr(value, "OnDialogRequest", 1)) {
OnPacket.OnDialogRequest = 1;
}
break;
}
case 1: {
Expand All @@ -86,18 +89,23 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
OnPacket.OnSpawn = 0;
}
else if (OnPacket.OnConsoleMessage) {
if (userCommands.isFastRoulette) {
if (userOpt.isFastRoulette) {
if (includeStr(value, "spun the wheel and got ", strLen)) {
memset(event.packet->data + 24, 0, 4);
}
}
OnPacket.OnConsoleMessage = 0;
}
else if (OnPacket.OnDialogRequest) {
printf("Here is the value: %s\n", value + 48);
if (isStr(value + 48, "`wThe Growtopia Gazette``", 0)) userConfig.skipGazette++;
OnPacket.OnDialogRequest = 0;
}
break;
}
case 2: {
if (OnPacket.OnTalkBubble) {
if (userCommands.isFastRoulette) {
if (userOpt.isFastRoulette) {
if (includeStr(value, "spun the wheel and got ", strLen)) {
memset(event.packet->data + 24, 0, 4);
}
Expand Down Expand Up @@ -179,6 +187,16 @@ void serverReceive(ENetEvent event, ENetPeer* clientPeer, ENetPeer* serverPeer)
free(OnSendToServer.rawSplit);
OnPacket.OnSendToServer = 0;
isSendToServer = 1;
}
else if (userConfig.skipGazette == 2) {
// leave it empty if you want skip the gazette
// if you want add your own gazette, you can do

/*enet_peerSend(onPacketCreate("ss",
"OnDialogRequest",
"Your dialog here"), clientPeer);*/

userConfig.skipGazette--;
} else enet_peerSend(event.packet, clientPeer);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion externInit.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct OnConsoleMessage_ OnConsoleMessage;
struct OnSendToServer_ OnSendToServer;
struct OnSpawn_ OnSpawn;
struct userConfig_ userConfig;
struct userCommands_ userCommands;
struct userOpt_ userOpt;

struct HTTPInfo info;
ENetHost* realServer;
Expand Down
7 changes: 6 additions & 1 deletion main.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ void loadConfig() {
asprintf(&userConfig.manualMeta, "localhost");
userConfig.usingNewPacket = 1;
userConfig.httpsPort = 443;
userConfig.skipGazette = 1;

fprintf(fp, "usingServerData=1\nserverDataIP=2.17.198.162\nmanualIP=127.0.0.1\nmanualPort=17091\nmanualMeta=localhost\nusingNewPacket=1\nhttpsPort=443");
fprintf(fp, "usingServerData=1\nserverDataIP=2.17.198.162\nmanualIP=127.0.0.1\nmanualPort=17091\nmanualMeta=localhost\nusingNewPacket=1\nhttpsPort=443\nskipGazette=1");
fclose(fp);
printf("[GTProxy] config.conf has been created!\n");
} else {
Expand Down Expand Up @@ -69,6 +70,10 @@ void loadConfig() {
else userConfig.usingNewPacket = 0;
}
if (isStr(split2[0], "httpsPort", 1)) userConfig.httpsPort = atoi(split2[1]);
if (isStr(split2[0], "skipGazette", 1)) {
if (split2[1][0] == '1') userConfig.skipGazette = 1;
else userConfig.skipGazette = 0;
}

free(split2);
}
Expand Down
6 changes: 4 additions & 2 deletions proxyStruct.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ struct userConfig_ {
int manualPort;
char usingNewPacket;
short httpsPort;
char skipGazette;
};

struct userCommands_ {
struct userOpt_ {
char isFastRoulette;
};

Expand All @@ -31,6 +32,7 @@ struct OnPacket_ {
char OnSendToServer;
char OnSpawn;
char OnTalkBubble;
char OnDialogRequest;
};

struct OnConsoleMessage_ {
Expand All @@ -57,7 +59,7 @@ extern struct OnConsoleMessage_ OnConsoleMessage;
extern struct OnSendToServer_ OnSendToServer;
extern struct OnSpawn_ OnSpawn;
extern struct userConfig_ userConfig;
extern struct userCommands_ userCommands;
extern struct userOpt_ userOpt;

extern char isSendToServer;

Expand Down

0 comments on commit e524768

Please sign in to comment.