From e524768eaa081ee8c724795b8e1f6b6f3a9896af Mon Sep 17 00:00:00 2001 From: Muhammad Kevin <56192597+GuckTubeYT@users.noreply.github.com> Date: Mon, 8 May 2023 22:26:12 +0700 Subject: [PATCH] add dialog gazette skip --- GTProxy.layout | 20 ++++++++++++++++++++ events/eventClient.c | 6 +++--- events/eventServer.c | 22 ++++++++++++++++++++-- externInit.c | 2 +- main.c | 7 ++++++- proxyStruct.h | 6 ++++-- 6 files changed, 54 insertions(+), 9 deletions(-) create mode 100644 GTProxy.layout diff --git a/GTProxy.layout b/GTProxy.layout new file mode 100644 index 0000000..209d62c --- /dev/null +++ b/GTProxy.layout @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/events/eventClient.c b/events/eventClient.c index 25dc573..be52c7e 100644 --- a/events/eventClient.c +++ b/events/eventClient.c @@ -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); } } diff --git a/events/eventServer.c b/events/eventServer.c index 5fbb377..f880427 100644 --- a/events/eventServer.c +++ b/events/eventServer.c @@ -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: { @@ -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); } @@ -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; } diff --git a/externInit.c b/externInit.c index ebc7225..4e75a39 100644 --- a/externInit.c +++ b/externInit.c @@ -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; diff --git a/main.c b/main.c index 8af68bc..e97edaf 100644 --- a/main.c +++ b/main.c @@ -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 { @@ -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); } diff --git a/proxyStruct.h b/proxyStruct.h index 0f3640d..a7fb388 100644 --- a/proxyStruct.h +++ b/proxyStruct.h @@ -9,9 +9,10 @@ struct userConfig_ { int manualPort; char usingNewPacket; short httpsPort; + char skipGazette; }; -struct userCommands_ { +struct userOpt_ { char isFastRoulette; }; @@ -31,6 +32,7 @@ struct OnPacket_ { char OnSendToServer; char OnSpawn; char OnTalkBubble; + char OnDialogRequest; }; struct OnConsoleMessage_ { @@ -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;