Skip to content

Commit

Permalink
Growbrew Proxy V2.3 release
Browse files Browse the repository at this point in the history
new features & fixes :3
  • Loading branch information
playingoDEERUX committed Jan 27, 2021
1 parent 9aa63d1 commit a3fb239
Show file tree
Hide file tree
Showing 8 changed files with 867 additions and 114 deletions.
4 changes: 3 additions & 1 deletion GrowbrewProxy/HTTPServer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
// thanks to iProgramInCpp#0489, most things are made by him in the GrowtopiaCustomClient,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
46 changes: 32 additions & 14 deletions GrowbrewProxy/HandleMessages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ private int OperateVariant(VariantList.VarList vList, object botPeer)
variantPacket2.AppendString("OnReconnect");
packetSender.SendData(variantPacket2.GetBytes(), MainForm.proxyPeer);
}


break;
}
case "OnRequestWorldSelectMenu":
Expand All @@ -84,6 +86,7 @@ private int OperateVariant(VariantList.VarList vList, object botPeer)
}
case "OnSuperMainStartAcceptLogonHrdxs47254722215a":
{

if (MainForm.skipCache && botPeer == null)
{
MainForm.LogText += ("[" + DateTime.UtcNow + "] (CLIENT): Skipping potential caching (will make world list disappear)...");
Expand Down Expand Up @@ -174,8 +177,6 @@ private int OperateVariant(VariantList.VarList vList, object botPeer)
int port = (int)vList.functionArgs[1];
int userID = (int)vList.functionArgs[3];
int token = (int)vList.functionArgs[2];
int lmode = (int)vList.functionArgs[5];


MainForm.LogText += ("[" + DateTime.UtcNow + "] (SERVER): OnSendToServer (func call used for server switching/sub-servers) " +
"IP: " +
Expand All @@ -192,11 +193,11 @@ private int OperateVariant(VariantList.VarList vList, object botPeer)
MainForm.globalUserData.Growtopia_Port = token < 0 ? MainForm.globalUserData.Growtopia_Master_Port : port;
MainForm.globalUserData.isSwitchingServer = true;
MainForm.globalUserData.token = token;
MainForm.globalUserData.lmode = lmode;
MainForm.globalUserData.lmode = 1;
MainForm.globalUserData.userID = userID;
MainForm.globalUserData.doorid = doorid;
packetSender.SendPacket(3, "action|quit", MainForm.realPeer);

packetSender.SendPacket(3, "action|quit", MainForm.realPeer);
MainForm.realPeer.Disconnect(0);

return -1;
Expand Down Expand Up @@ -239,6 +240,13 @@ private int OperateVariant(VariantList.VarList vList, object botPeer)
case "smstate":
p.mstate = Convert.ToInt32(lineToken[1]);
break;
case "posXY":
if (lineToken.Length == 3) // exactly 3 not more not less
{
p.X = Convert.ToInt32(lineToken[1]);
p.Y = Convert.ToInt32(lineToken[2]);
}
break;
case "type":
if (lineToken[1] == "local") localplayer = true;
break;
Expand Down Expand Up @@ -277,7 +285,7 @@ private int OperateVariant(VariantList.VarList vList, object botPeer)

switch (key)
{
case "mstate": // unlimited punch/place range edit smstate, but is dangerous/detectable and can autoban!
case "mstate": // unlimited punch/place range edit smstate
value = "1";
break;
}
Expand Down Expand Up @@ -371,6 +379,9 @@ bool IsBitSet(int b, int pos)
{
return (b & (1 << pos)) != 0;
}



public string HandlePacketFromClient(ref ENetPeer peer, ENetPacket packet) // Why string? Oh yeah, it's the best thing to also return a string response for anything you want!
{

Expand Down Expand Up @@ -523,6 +534,11 @@ bool IsBitSet(int b, int pos)
worldMap.player.X = (int)p.X;
worldMap.player.Y = (int)p.Y;
break;
case NetTypes.PacketTypes.PING_REPLY:
{
SpoofedPingReply(p);
return "Spoofed ping reply!";
}
case NetTypes.PacketTypes.TILE_CHANGE_REQ:
respondToBotPeers = true;

Expand Down Expand Up @@ -603,11 +619,13 @@ private void SpoofedPingReply(TankPacket tPacket)
{
if (worldMap == null) return;
TankPacket p = new TankPacket();
p.PacketType = (int)NetTypes.PacketTypes.PING_REPLY;
p.PunchX = (int)1000.0f;
p.PunchY = (int)250.0f;
p.X = 64.0f;
p.Y = 64.0f;
p.SecondaryNetID = (int)MainForm.HashBytes(BitConverter.GetBytes(tPacket.MainValue));
p.MainValue = tPacket.MainValue; // GetTickCount()
p.SecondaryNetID = (int)MainForm.HashBytes(BitConverter.GetBytes(tPacket.MainValue)); // HashString of it

// rest is 0 by default to not get detected by ac.
packetSender.SendPacketRaw((int)NetTypes.NetMessages.GAME_PACKET, p.PackForSendingRaw(), MainForm.realPeer);
Expand All @@ -623,12 +641,6 @@ public string HandlePacketFromServer(ref ENetPeer peer, ENetPacket packet)

byte[] data = packet.Data.ToArray();

//else
//{
//return "_none_";
//}



NetTypes.NetMessages msgType = (NetTypes.NetMessages)data[0]; // more performance.
switch (msgType)
Expand Down Expand Up @@ -693,12 +705,16 @@ public string HandlePacketFromServer(ref ENetPeer peer, ENetPacket packet)
}
break;
}

case NetTypes.PacketTypes.INVENTORY_STATE:
{
if (!MainForm.globalUserData.dontSerializeInventory)
worldMap.player.SerializePlayerInventory(VariantList.get_extended_data(tankPacket));
break;
}
case NetTypes.PacketTypes.TILE_CHANGE_REQ:
{
TankPacket p = TankPacket.UnpackFromPacket(data);

// world tile map in proxy, by playingo :)
if (worldMap == null)
{
MainForm.LogText += ("[" + DateTime.UtcNow + "] (PROXY): (ERROR) World map was null." + "\n");
Expand Down Expand Up @@ -748,12 +764,14 @@ public string HandlePacketFromServer(ref ENetPeer peer, ENetPacket packet)
if (VarListFetched.FunctionName == "OnSendToServer") return "Server switching forced, not continuing as Proxy Client has to deal with this.";
if (VarListFetched.FunctionName == "onShowCaptcha") return "Received captcha solving request, instantly bypassed it so it doesnt show up on client side.";
if (VarListFetched.FunctionName == "OnDialogRequest" && ((string)VarListFetched.functionArgs[1]).ToLower().Contains("captcha")) return "Received captcha solving request, instantly bypassed it so it doesnt show up on client side.";
if (VarListFetched.FunctionName == "OnDialogRequest" && ((string)VarListFetched.functionArgs[1]).ToLower().Contains("gazette")) return "Received gazette, skipping it...";
if (VarListFetched.FunctionName == "OnSetPos" && MainForm.globalUserData.ignoreonsetpos && netID == worldMap.netID) return "Ignored position set by server, may corrupt doors but is used so it wont set back. (CAN BE BUGGY WITH SLOW CONNECTIONS)";
if (VarListFetched.FunctionName == "OnSpawn" && netID == -2)
{
if (MainForm.globalUserData.unlimitedZoom)
return "Modified OnSpawn for unlimited zoom (mstate|1)"; // only doing unlimited zoom and not unlimited punch/place to be sure that no bans occur due to this. If you wish to use unlimited punching/placing as well, change the smstate in OperateVariant function instead.
}


break;
case NetTypes.PacketTypes.SET_CHARACTER_STATE:
Expand Down
Loading

0 comments on commit a3fb239

Please sign in to comment.