├── Branding
├── Logo.ico
├── Logo.png
├── logo.psd
└── ForumLogo.png
├── Core
├── MiscUtil.dll
├── Interop.ShockwaveFlashObjects.dll
├── AxInterop.ShockwaveFlashObjects.dll
├── RemoteClient.cs
├── Darkorbit
│ ├── Gate.cs
│ ├── Commands
│ │ ├── PostHandshake
│ │ │ ├── DestroyShip.cs
│ │ │ ├── Ping.cs
│ │ │ ├── Jump.cs
│ │ │ ├── Ready.cs
│ │ │ ├── MapChangeConfirmation.cs
│ │ │ ├── DestroyItem.cs
│ │ │ ├── MapChanged.cs
│ │ │ ├── ShipDestroyed.cs
│ │ │ ├── DestroyBuilding.cs
│ │ │ ├── ShieldUpdated.cs
│ │ │ ├── DroneFormationUpdated.cs
│ │ │ ├── RemoteInitStageOne.cs
│ │ │ ├── BoxInit.cs
│ │ │ ├── OldStylePacket.cs
│ │ │ ├── InitPacket.cs
│ │ │ ├── ShipMove.cs
│ │ │ ├── OreInit.cs
│ │ │ ├── HitpointsUpdated.cs
│ │ │ ├── ActionRequest.cs
│ │ │ ├── ShipAttacked.cs
│ │ │ ├── Class326.cs
│ │ │ ├── CargoUpdated.cs
│ │ │ ├── Move.cs
│ │ │ ├── Class370.cs
│ │ │ ├── Login.cs
│ │ │ ├── CollectBox.cs
│ │ │ ├── ShipUpdated.cs
│ │ │ ├── GateInit.cs
│ │ │ ├── ReviveShip.cs
│ │ │ ├── Notify.cs
│ │ │ ├── BuildingInit.cs
│ │ │ ├── ShipInit.cs
│ │ │ └── HeroInit.cs
│ │ ├── Command.cs
│ │ ├── ServerRequestCallback.cs
│ │ ├── ClientRequestCode.cs
│ │ ├── ServerRequestCode.cs
│ │ ├── ServerVersionCheck.cs
│ │ ├── RemoteInitStageOne.cs
│ │ ├── ClientRequestCallback.cs
│ │ ├── DroneFormationUpdated.cs
│ │ └── ClientVersionCheck.cs
│ ├── Box.cs
│ ├── Config.cs
│ ├── Building.cs
│ ├── Ore.cs
│ ├── Ship.cs
│ ├── OldPackets.cs
│ └── Account.cs
├── Flash
│ └── External
│ │ ├── ExternalInterfaceCallEventArgs.cs
│ │ ├── ExternalInterfaceCall.cs
│ │ ├── ExternalInterfaceProxy.cs
│ │ └── ExternalInterfaceSerializer.cs
├── Properties
│ └── AssemblyInfo.cs
├── Fade
│ ├── FadeProxy.cs
│ └── FadeProxyClient.cs
├── HttpManager.cs
├── Client.cs
├── API.cs
└── Core.csproj
├── PolskaBot
├── Fade.swf
├── Logo.ico
├── Resources
│ └── Logo.png
├── packages.config
├── Properties
│ ├── Settings.settings
│ ├── AssemblyInfo.cs
│ ├── Settings.Designer.cs
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Tween
│ ├── Lerper.cs
│ ├── GlideInfo.cs
│ ├── Ease.cs
│ └── Tween.cs
├── BotSettings.cs
├── App.config
├── Program.cs
├── ColorProgressBar.cs
├── Config.cs
├── SettingsForm.cs
├── Bot.cs
├── BotPage.resx
├── PolskaBot.csproj
├── Bot.Designer.cs
└── SettingsForm.Designer.cs
├── LICENSE
├── README.md
├── Core.sln
└── .gitignore
/Branding/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/Branding/Logo.ico
--------------------------------------------------------------------------------
/Branding/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/Branding/Logo.png
--------------------------------------------------------------------------------
/Branding/logo.psd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/Branding/logo.psd
--------------------------------------------------------------------------------
/Core/MiscUtil.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/Core/MiscUtil.dll
--------------------------------------------------------------------------------
/PolskaBot/Fade.swf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/PolskaBot/Fade.swf
--------------------------------------------------------------------------------
/PolskaBot/Logo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/PolskaBot/Logo.ico
--------------------------------------------------------------------------------
/Branding/ForumLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/Branding/ForumLogo.png
--------------------------------------------------------------------------------
/PolskaBot/Resources/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/PolskaBot/Resources/Logo.png
--------------------------------------------------------------------------------
/Core/Interop.ShockwaveFlashObjects.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/Core/Interop.ShockwaveFlashObjects.dll
--------------------------------------------------------------------------------
/Core/AxInterop.ShockwaveFlashObjects.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PolskaBot/PolskaBotCore/HEAD/Core/AxInterop.ShockwaveFlashObjects.dll
--------------------------------------------------------------------------------
/PolskaBot/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Core/RemoteClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core
9 | {
10 | class RemoteClient : Client
11 | {
12 | public RemoteClient(API api) : base(api)
13 | {
14 |
15 | }
16 |
17 | public override void Parse(EndianBinaryReader reader)
18 | {
19 |
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2 | Version 2, December 2004
3 |
4 | Copyright (C) 2004 Sam Hocevar
5 |
6 | Everyone is permitted to copy and distribute verbatim or modified
7 | copies of this license document, and changing it is allowed as long
8 | as the name is changed.
9 |
10 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
11 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
12 |
13 | 0. You just DO WHAT THE FUCK YOU WANT TO.
14 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Gate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 |
8 | namespace PolskaBot.Core.Darkorbit
9 | {
10 | public class Gate
11 | {
12 | public int ID { get; set; }
13 | public Point Position { get; set; }
14 |
15 | public Gate(int ID, int x, int y)
16 | {
17 | this.ID = ID;
18 | Position = new Point(x, y);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/PolskaBot/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | False
7 |
8 |
9 | True
10 |
11 |
12 |
--------------------------------------------------------------------------------
/PolskaBot/Tween/Lerper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Glide
4 | {
5 | public abstract class Lerper
6 | {
7 | [Flags]
8 | public enum Behavior
9 | {
10 | None = 0,
11 | Reflect = 1,
12 | Rotation = 2,
13 | RotationRadians = 4,
14 | RotationDegrees = 8,
15 | Round = 16
16 | }
17 |
18 | protected const float DEG = 180f / (float) Math.PI;
19 | protected const float RAD = (float) Math.PI / 180f;
20 |
21 | public abstract void Initialize(Object fromValue, Object toValue, Behavior behavior);
22 | public abstract object Interpolate(float t, object currentValue, Behavior behavior);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/DestroyShip.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class DestroyShip : Command
11 | {
12 | public const ushort ID = 10792;
13 |
14 | public uint UserID { get; private set; }
15 |
16 | public DestroyShip(EndianBinaryReader reader)
17 | {
18 | UserID = reader.ReadUInt32();
19 | UserID = UserID >> 1 | UserID << 31;
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Box.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 |
8 | namespace PolskaBot.Core.Darkorbit
9 | {
10 | public class Box
11 | {
12 | public string Hash { get; private set; }
13 | public Point Position { get; private set; }
14 | public string Type { get; private set; }
15 |
16 | public Box(string hash, int x, int y, string type)
17 | {
18 | Hash = hash;
19 | Position = new Point(x, y);
20 | Type = type;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Ping.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | class Ping : Command
10 | {
11 | public const ushort ID = 15776;
12 |
13 | public Ping()
14 | {
15 | Write();
16 | }
17 |
18 | public void Write()
19 | {
20 | packetWriter.Write((short)4);
21 | packetWriter.Write(ID);
22 | packetWriter.Write((short)-8609);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Jump.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | public class Jump : Command
10 | {
11 | public const short ID = 5050;
12 |
13 | public Jump()
14 | {
15 | Write();
16 | }
17 |
18 | public void Write()
19 | {
20 | packetWriter.Write((short)4);
21 | packetWriter.Write(ID);
22 | packetWriter.Write((short)16290);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/Command.cs:
--------------------------------------------------------------------------------
1 | using System.IO;
2 | using MiscUtil.IO;
3 | using MiscUtil.Conversion;
4 |
5 | namespace PolskaBot.Core.Darkorbit.Commands
6 | {
7 | public abstract class Command
8 | {
9 | protected MemoryStream memoryStream;
10 | protected EndianBinaryWriter packetWriter;
11 |
12 | public Command()
13 | {
14 | memoryStream = new MemoryStream();
15 | packetWriter = new EndianBinaryWriter(EndianBitConverter.Big, memoryStream);
16 | }
17 |
18 | public byte[] ToArray()
19 | {
20 | return memoryStream.ToArray();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Config.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit
8 | {
9 | class Config
10 | {
11 | public static int MAJOR { get; set; } = 0;
12 | public static int MINOR { get; set; } = 79;
13 | public static int BUILD { get; set; } = 5;
14 |
15 | public const string VERSION = "8.3.2";
16 |
17 | public const string USERNAME_ENV = "PB_USERNAME";
18 | public const string PASSWORD_ENV = "PB_PASSWORD";
19 | public const string SERVER_IP_ENV = "PB_SERVER_IP";
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Ready.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | class Ready : Command
10 | {
11 | public const ushort ID = 25614;
12 | public Ready()
13 | {
14 | Write();
15 | }
16 |
17 | public void Write()
18 | {
19 | packetWriter.Write((short)6);
20 | packetWriter.Write(ID);
21 | packetWriter.Write((short)17356);
22 | packetWriter.Write((short)-12161);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/ServerRequestCallback.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands
9 | {
10 | class ServerRequestCallback : Command
11 | {
12 | public const ushort ID = 26446;
13 |
14 | public int length { get; private set; }
15 | public byte[] secretKey { get; private set; }
16 |
17 | public ServerRequestCallback(EndianBinaryReader reader)
18 | {
19 | length = reader.ReadInt32();
20 | secretKey = reader.ReadBytes(length);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/ClientRequestCode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands
8 | {
9 | class ClientRequestCode : Command
10 | {
11 | public const ushort ID = 15135;
12 | public short length { get; private set; } = 4;
13 |
14 | public ClientRequestCode()
15 | {
16 | Write();
17 | }
18 |
19 | public void Write()
20 | {
21 | packetWriter.Write(length);
22 | packetWriter.Write(ID);
23 | packetWriter.Write((short)-32516);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Flash/External/ExternalInterfaceCallEventArgs.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Flash.External
4 | {
5 | public delegate object ExternalInterfaceCallEventHandler(object sender, ExternalInterfaceCallEventArgs e);
6 |
7 | ///
8 | /// Event arguments for the ExternalInterfaceCallEventHandler.
9 | ///
10 | public class ExternalInterfaceCallEventArgs : System.EventArgs
11 | {
12 | private ExternalInterfaceCall _functionCall;
13 |
14 | public ExternalInterfaceCallEventArgs(ExternalInterfaceCall functionCall)
15 | : base()
16 | {
17 | _functionCall = functionCall;
18 | }
19 |
20 | public ExternalInterfaceCall FunctionCall
21 | {
22 | get { return _functionCall; }
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Core/Darkorbit/Building.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 |
8 | namespace PolskaBot.Core.Darkorbit
9 | {
10 | public class Building
11 | {
12 | public int BuildingID { get; set; }
13 | public string Name { get; set; }
14 | public Point Position { get; set; }
15 | public int AssetType { get; set; }
16 |
17 | public Building(int buildingID, string name, int x, int y, int assetType)
18 | {
19 | BuildingID = buildingID;
20 | Name = name;
21 | Position = new Point(x, y);
22 | AssetType = assetType;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/MapChangeConfirmation.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | class MapChangeConfirmation : Command
10 | {
11 | public const ushort ID = 20064;
12 |
13 | public bool Close { get; private set; }
14 |
15 | public MapChangeConfirmation(bool close = false)
16 | {
17 | Close = close;
18 | Write();
19 | }
20 |
21 | public void Write()
22 | {
23 | packetWriter.Write((short)3);
24 | packetWriter.Write(ID);
25 | packetWriter.Write(Close);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/DestroyItem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class DestroyItem : Command
11 | {
12 | public const ushort ID = 11901;
13 |
14 | public bool CollectedByPlayer { get; private set; } // name_46
15 | public string Hash { get; private set; }
16 |
17 | public DestroyItem(EndianBinaryReader reader)
18 | {
19 | Hash = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
20 | CollectedByPlayer = reader.ReadBoolean();
21 | reader.ReadInt16();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/ServerRequestCode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands
9 | {
10 | class ServerRequestCode : Command
11 | {
12 | public const ushort ID = 17869;
13 |
14 | public int codeLength { get; private set; }
15 | public byte[] code { get; private set; }
16 | public int fakeSize { get; private set; }
17 |
18 | public ServerRequestCode(EndianBinaryReader reader)
19 | {
20 | reader.ReadInt16();
21 | codeLength = reader.ReadInt32();
22 | code = reader.ReadBytes(codeLength);
23 | fakeSize = reader.ReadInt32();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Ore.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 |
8 | namespace PolskaBot.Core.Darkorbit
9 | {
10 | public class Ore
11 | {
12 | public string Hash { get; private set; }
13 | public Point Position { get; private set; }
14 | public OreType Type { get; private set; }
15 |
16 | public enum OreType
17 | {
18 | PROMETIUM, ENDURIUM, TERBIUM, XENOMIT, PROMETID, DURANIUM, PROMERIUM, SEPROM, PALLADIUM
19 | }
20 |
21 | public Ore(string hash, int x, int y, int type)
22 | {
23 | Hash = hash;
24 | Position = new Point(x, y);
25 | Type = (OreType)type;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Ship.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit
8 | {
9 | public class Ship
10 | {
11 |
12 | public int UserID { get; set; }
13 | public string Username { get; set; }
14 | public bool NPC { get; set; }
15 |
16 | // Movement
17 | public int X { get; set; }
18 | public int Y { get; set; }
19 |
20 | // Ship
21 | public string Shipname { get; set; }
22 |
23 | //Statistics
24 | public bool Cloaked { get; set; }
25 |
26 | // Social
27 | public int ClanID { get; set; }
28 | public string ClanTag { get; set; }
29 | public int FactionID { get; set; }
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/ServerVersionCheck.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands
9 | {
10 | class ServerVersionCheck : Command
11 | {
12 | public const ushort ID = 667;
13 |
14 | public int major { get; set; }
15 | public int minor { get; set; }
16 | public int build { get; set; }
17 | public bool compatible { get; set; }
18 |
19 | public ServerVersionCheck(EndianBinaryReader reader)
20 | {
21 | major = reader.ReadInt32();
22 | minor = reader.ReadInt32();
23 | build = reader.ReadInt32();
24 | compatible = reader.ReadBoolean();
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/MapChanged.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class MapChanged : Command
11 | {
12 | public const ushort ID = 22027;
13 |
14 | public int MapID { get; private set; }
15 | public int var_294 { get; private set; }
16 |
17 | public MapChanged(EndianBinaryReader reader)
18 | {
19 | MapID = reader.ReadInt32();
20 | MapID = (int)((uint)MapID << 16 | (uint)MapID >> 16);
21 | reader.ReadUInt16();
22 | var_294 = reader.ReadInt32();
23 | var_294 = (int)((uint)var_294 << 11 | (uint)var_294 >> 21);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ShipDestroyed.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class ShipDestroyed : Command
11 | {
12 | public const ushort ID = 28834;
13 |
14 | public int UserID { get; private set; } //var_2750
15 | public int var_1092 { get; private set; } //var_1092
16 |
17 | public ShipDestroyed(EndianBinaryReader reader)
18 | {
19 | UserID = reader.ReadInt32();
20 | UserID = (int)((uint)UserID << 8 | (uint)UserID >> 24);
21 | var_1092 = reader.ReadInt32();
22 | var_1092 = (int)((uint)var_1092 << 9 | (uint)var_1092 >> 23);
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/DestroyBuilding.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class DestroyBuilding : Command
11 | {
12 | public const ushort ID = 19339;
13 |
14 | public int BuildingID { get; private set; }
15 | public short AssetType { get; private set; }
16 |
17 | public DestroyBuilding(EndianBinaryReader reader)
18 | {
19 | reader.ReadInt16();
20 | reader.ReadInt16(); //entering class_455
21 | AssetType = reader.ReadInt16();
22 | BuildingID = reader.ReadInt32();
23 | BuildingID = (int)((uint)BuildingID >> 9 | (uint)BuildingID << 23);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ShieldUpdated.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class ShieldUpdated : Command
11 | {
12 | public const ushort ID = 21535;
13 |
14 | public int MaxShield { get; private set; } //name_101
15 | public int Shield { get; private set; } //var_752
16 |
17 | public ShieldUpdated(EndianBinaryReader reader)
18 | {
19 | Shield = reader.ReadInt32();
20 | Shield = (int)((uint)Shield >> 14 | (uint)Shield << 18);
21 | MaxShield = reader.ReadInt32();
22 | MaxShield = (int)((uint)MaxShield >> 2 | (uint)MaxShield << 30);
23 | reader.ReadInt16();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/RemoteInitStageOne.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands
8 | {
9 | class RemoteInitStageOne : Command
10 | {
11 | public const ushort ID = 101;
12 |
13 | private int _userID;
14 | private byte[] _code;
15 |
16 | public RemoteInitStageOne(byte[] code, int userID)
17 | {
18 | _code = code;
19 | _userID = userID;
20 | Write();
21 | }
22 |
23 | public void Write()
24 | {
25 | short totalLength = (short)(_code.Length + 6);
26 | packetWriter.Write(totalLength);
27 | packetWriter.Write(ID);
28 | packetWriter.Write(_userID);
29 | packetWriter.Write(_code);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/DroneFormationUpdated.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class DroneFormationUpdated : Command
11 | {
12 | public const ushort ID = 20561;
13 |
14 | public int DroneFormation { get; private set; } //class_411 | var_3644
15 | public int UID { get; private set; }
16 |
17 | public DroneFormationUpdated(EndianBinaryReader reader)
18 | {
19 | UID = reader.ReadInt32();
20 | UID = (int)((uint)UID << 8 | (uint)UID >> 24);
21 | reader.ReadUInt16();
22 | DroneFormation = reader.ReadInt32();
23 | DroneFormation = (int)((uint)DroneFormation << 14 | (uint)DroneFormation >> 18);
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/ClientRequestCallback.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands
8 | {
9 | class ClientRequestCallback : Command
10 | {
11 | public const ushort ID = 21314;
12 |
13 | public byte[] callback { get; private set; }
14 |
15 | public ClientRequestCallback(byte[] callback)
16 | {
17 | this.callback = callback;
18 | Write();
19 | }
20 |
21 | public void Write()
22 | {
23 | short totalLength = (short)(8 + callback.Length);
24 | packetWriter.Write(totalLength);
25 | packetWriter.Write(ID);
26 | packetWriter.Write(callback.Length);
27 | packetWriter.Write(callback, 0, callback.Length);
28 | packetWriter.Write((short)2596);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/RemoteInitStageOne.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | class RemoteInitStageOne : Command
10 | {
11 | public const ushort ID = 101;
12 |
13 | public byte[] code { get; private set; }
14 | public int UserID { get; set; }
15 |
16 | public RemoteInitStageOne(byte[] code, int userID)
17 | {
18 | this.code = code;
19 | UserID = userID;
20 | Write();
21 | }
22 |
23 | public void Write()
24 | {
25 | short totalLength = (short)(code.Length + 6);
26 | packetWriter.Write(totalLength);
27 | packetWriter.Write(ID);
28 | packetWriter.Write(UserID);
29 | packetWriter.Write(code);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/PolskaBot/BotSettings.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot
8 | {
9 | public class BotSettings
10 | {
11 | public List CollectableBoxes { get; set; } = new List();
12 | public bool CollectorEnabled { get; set; }
13 | public bool CollectBonusBoxes { get; set; }
14 | public bool CollectEventBoxes { get; set; }
15 |
16 | // General settings
17 | public int HPLimit { get; set; } = 70;
18 | public int RepairAt { get; set; } = 1;
19 |
20 | public void Reload()
21 | {
22 | if (CollectBonusBoxes)
23 | CollectableBoxes.Add("BONUS_BOX");
24 | if (CollectEventBoxes)
25 | {
26 | CollectableBoxes.Add("EVENT_BOX");
27 | CollectableBoxes.Add("GIFT_BOXES");
28 | }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/BoxInit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class BoxInit : Command
11 | {
12 | public const ushort ID = 3775;
13 |
14 | public string Hash { get; private set; }
15 | public int X { get; private set; }
16 | public int Y { get; private set; }
17 | public string Type { get; private set; }
18 |
19 | public BoxInit(EndianBinaryReader reader)
20 | {
21 | X = reader.ReadInt32();
22 | X = (int)((uint)X << 3 | (uint)X >> 29);
23 | Y = reader.ReadInt32();
24 | Y = (int)((uint)Y >> 16 | (uint)Y >> 16);
25 | Hash = Encoding.Default.GetString(reader.ReadBytes(reader.ReadUInt16()));
26 | Type = Encoding.Default.GetString(reader.ReadBytes(reader.ReadUInt16()));
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/DroneFormationUpdated.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class DroneFormationUpdated : Command
11 | {
12 | public const ushort ID = 32691;
13 |
14 | public int DroneFormation { get; private set; } //class_411 | var_3642
15 | public int UID { get; private set; }
16 |
17 | public DroneFormationUpdated(EndianBinaryReader reader)
18 | {
19 | reader.ReadUInt16();
20 | DroneFormation = reader.ReadInt32();
21 | DroneFormation = (int)((uint)DroneFormation >> 12 | (uint)DroneFormation << 20);
22 | UID = reader.ReadInt32();
23 | UID = (int)((uint)UID >> 13 | (uint)UID << 19);
24 | }
25 |
26 | public override void Write()
27 | {
28 | throw new NotImplementedException();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/ClientVersionCheck.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands
8 | {
9 | class ClientVersionCheck : Command
10 | {
11 | public static ushort ID = 666;
12 | public short length { get; private set; } = 14;
13 |
14 | public int major { get; set; }
15 | public int minor { get; set; }
16 | public int build { get; set; }
17 |
18 | public ClientVersionCheck(int major, int minor, int build)
19 | {
20 | this.major = major;
21 | this.minor = minor;
22 | this.build = build;
23 | Write();
24 | }
25 |
26 | public void Write()
27 | {
28 | packetWriter.Write(length);
29 | packetWriter.Write(ID);
30 | packetWriter.Write(major);
31 | packetWriter.Write(minor);
32 | packetWriter.Write(build);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PolskaBotCore
2 |
3 | ### PolskaBot - Post mortem
4 | We did it. No system is 100% secure. Nor was DO. We are sharing all of our work to the public. Our job is done. Many said it's impossible, we proved them wrong. We completed our challenge. Anti-bot system is not our target to beat.
5 |
6 | **You should threat this code more as PoC than real bot. I was rewritting it, but we decided to give it to the public.**
7 |
8 | ### Creators:
9 | - [Quake](https://github.com/CuteQuake)
10 | - [Sekhmet](https://github.com/Sekhmet)
11 |
12 | ### Thanks:
13 | - BigPoint - it was pleasure to be able to try our skills against your system. It was real challenge and fun to play with.
14 |
15 | C# codebase of PolskaBot
16 |
17 | - This repo - C# code
18 | - [Fade](https://github.com/Sekhmet/PolskaBotFade) - Flash code used in ACX control to decrypt packets.
19 | - [Remote](https://github.com/Sekhmet/PolskaBotRemote) - Basic license server used in beta.
20 |
21 | ### License
22 | Licensed under WTFPL license (applies to Fade and Remote too). Do what the fuck you want.
23 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/OldStylePacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | public class OldStylePacket : Command
11 | {
12 | public const ushort ID = 28511;
13 |
14 | public string Message { get; set; }
15 |
16 | public OldStylePacket(EndianBinaryReader reader)
17 | {
18 | Message = Encoding.Default.GetString(reader.ReadBytes(reader.ReadUInt16()));
19 | }
20 |
21 | public OldStylePacket(string message)
22 | {
23 | Message = message;
24 | Write();
25 | }
26 |
27 | public void Write()
28 | {
29 | packetWriter.Write((short)(4 + Message.Length));
30 | packetWriter.Write(ID);
31 | packetWriter.Write((ushort)Message.Length);
32 | packetWriter.Write(Encoding.UTF8.GetBytes(Message));
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/InitPacket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | class InitPacket : Command
10 | {
11 | public const ushort ID = 31519;
12 |
13 | public short Index { get; private set; }
14 |
15 | public string Message { get; private set; } = "3D 1366x659 .root1.instance226.MainClientApplication0.ApplicationSkin2.Group3.Group4._-m5_5.instance24734 root1 false -1";
16 |
17 | public InitPacket(short num)
18 | {
19 | this.Index = num;
20 | Write();
21 | }
22 |
23 | public void Write()
24 | {
25 | short totalLength = (short)(Message.Length + 6);
26 | packetWriter.Write(totalLength);
27 | packetWriter.Write(ID);
28 | packetWriter.Write((byte)0);
29 | packetWriter.Write(Message);
30 | packetWriter.Write(Index);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ShipMove.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | public class ShipMove : Command
11 | {
12 | public const ushort ID = 17441;
13 |
14 | public uint UserID { get; private set; } //name_125
15 | public int X { get; private set; }
16 | public int Y { get; private set; }
17 | public uint Duration { get; private set; } //var_3506
18 |
19 | public ShipMove(EndianBinaryReader reader)
20 | {
21 | Duration = reader.ReadUInt32();
22 | Duration = Duration >> 13 | Duration << 19;
23 | Y = reader.ReadInt32();
24 | Y = (int)((uint)Y >> 3 | (uint)Y << 29);
25 | UserID = reader.ReadUInt32();
26 | UserID = UserID >> 8 | UserID << 24;
27 | X = reader.ReadInt32();
28 | X = (int)((uint)X << 2 | (uint)X >> 30);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/PolskaBot/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | False
15 |
16 |
17 | True
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/OreInit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class OreInit : Command
11 | {
12 | public const ushort ID = 27985;
13 |
14 | public string Hash { get; private set; }
15 | public int X { get; private set; }
16 | public int Y { get; private set; }
17 | public ushort Type { get; private set; }
18 |
19 | public OreInit(EndianBinaryReader reader)
20 | {
21 | X = reader.ReadInt32();
22 | X = (int)((uint)X << 3 | (uint)X >> 29);
23 | Y = reader.ReadInt32();
24 | Y = (int)((uint)Y >> 16 | (uint)Y >> 16);
25 | Hash = Encoding.Default.GetString(reader.ReadBytes(reader.ReadUInt16()));
26 | reader.ReadUInt16();
27 | reader.ReadUInt16(); // id to reader class, skipped just because
28 | Type = reader.ReadUInt16();
29 | reader.ReadUInt16();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Core/Darkorbit/OldPackets.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit
8 | {
9 | public static class OldPackets
10 | {
11 | public const string SELECT = "S";
12 | public const string CONFIG = "CFG";
13 |
14 | // Log message
15 | public const string LOG_MESSAGE = "LM";
16 | public const string BOX_CONTENT_CREDITS = "CRE";
17 | public const string BOX_CONTENT_URIDIUM = "URI";
18 | public const string BOX_CONTENT_XP = "EP";
19 | public const string BOX_CONTENT_HON = "HON";
20 | public const string BOX_CONTENT_BAT = "BAT";
21 | public const string BOX_CONTENT_LEVEL_UP = "NL";
22 | public const string BOX_CONTENT_ROCKETS = "ROK";
23 | public const string BOX_CONTENT_HP = "HTP";
24 | public const string BOX_CONTENT_DEDUCTION_HP = "DHP";
25 | public const string BOX_CONTENT_EE = "XEN";
26 | public const string BOX_CONTENT_ORE = "CAR";
27 |
28 | // Map
29 | public const string PORTAL_JUMP = "i";
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/HitpointsUpdated.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class HitpointsUpdated : Command
11 | {
12 | public const ushort ID = 10586;
13 |
14 | public int HP { get; private set; } //name_90
15 | public int MaxHP { get; private set; } //name_39
16 | public int NanoHP { get; private set; } //var_2224
17 | public int MaxNanoHP { get; private set; } //var_3763
18 |
19 | public HitpointsUpdated(EndianBinaryReader reader)
20 | {
21 | NanoHP = reader.ReadInt32();
22 | NanoHP = (int)((uint)NanoHP >> 16 | (uint)NanoHP << 16);
23 | HP = reader.ReadInt32();
24 | HP = (int)((uint)HP << 6 | (uint)HP >> 26);
25 | MaxHP = reader.ReadInt32();
26 | MaxHP = (int)((uint)MaxHP << 16 | (uint)MaxHP >> 16);
27 | MaxNanoHP = reader.ReadInt32();
28 | MaxNanoHP = (int)((uint)MaxNanoHP >> 13 | (uint)MaxNanoHP << 19);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ActionRequest.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | public class ActionRequest : Command
10 | {
11 | public const ushort ID = 31360;
12 |
13 | public int BarID { get; private set; } //var_2186
14 | public int Type { get; private set; } //var_2204
15 | public string Action { get; private set; } //var_2111
16 |
17 | public ActionRequest(string action, int type, int barID)
18 | {
19 | Action = action;
20 | Type = type;
21 | BarID = barID;
22 | Write();
23 | }
24 |
25 | public void Write()
26 | {
27 | packetWriter.Write((short)(10 + Action.Length));
28 | packetWriter.Write(ID);
29 | packetWriter.Write((short)Action.Length);
30 | packetWriter.Write(Encoding.UTF8.GetBytes(Action));
31 | packetWriter.Write((short)BarID);
32 | packetWriter.Write((short)Type);
33 | packetWriter.Write((short)19475);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ShipAttacked.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | public class ShipAttacked : Command
11 | {
12 | public const ushort ID = 26309;
13 |
14 | public int UserID { get; private set; } // name_143
15 | public int Var_250 { get; private set; }
16 | public bool Var_2969 { get; private set; }
17 | public int AttackerID { get; private set; } // name_128
18 | public bool Var_2560 { get; private set; }
19 |
20 | public ShipAttacked(EndianBinaryReader reader)
21 | {
22 | UserID = reader.ReadInt32();
23 | UserID = (int)((uint)UserID >> 5 | (uint)UserID << 27);
24 | AttackerID = reader.ReadInt32();
25 | AttackerID = (int)((uint)AttackerID >> 16 | (uint)AttackerID << 16);
26 | Var_2560 = reader.ReadBoolean();
27 | Var_2969 = reader.ReadBoolean();
28 | Var_250 = reader.ReadInt32();
29 | Var_250 = (int)((uint)Var_250 >> 10 | (uint)Var_250 << 22);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Class326.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class Class326 : Command
11 | {
12 | public const ushort ID = 18881;
13 |
14 | public bool Activated { get; private set; }
15 | public ushort var_2744 { get; private set; }
16 | public string var_2555 { get; private set; }
17 | public int Attribute { get; private set; }
18 | public int name_125 { get; private set; }
19 | public int Count { get; private set; }
20 |
21 | public Class326(EndianBinaryReader reader)
22 | {
23 | var_2555 = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
24 | Attribute = reader.ReadInt32();
25 | Attribute = Attribute >> 13 | Attribute << 19;
26 | var_2744 = reader.ReadUInt16();
27 | Activated = reader.ReadBoolean();
28 | name_125 = reader.ReadInt32();
29 | name_125 = name_125 << 13 | name_125 >> 19;
30 | Count = reader.ReadInt32();
31 | Count = Count << 13 | Count >> 19;
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/PolskaBot/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using System.Windows.Forms;
6 | using System.Threading;
7 |
8 | namespace PolskaBot
9 | {
10 | static class Program
11 | {
12 | ///
13 | /// The main entry point for the application.
14 | ///
15 | [STAThread]
16 | static void Main()
17 | {
18 | Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-us");
19 |
20 | Application.ThreadException += (s, e) =>
21 | {
22 | MessageBox.Show(e.Exception.ToString(), "Exception at UI Thread");
23 | Environment.Exit(1);
24 | };
25 | Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
26 | AppDomain.CurrentDomain.UnhandledException += (s, e) =>
27 | {
28 | DialogResult result = MessageBox.Show(e.ExceptionObject.ToString(), "Exception");
29 | Environment.Exit(1);
30 | };
31 |
32 | Application.EnableVisualStyles();
33 | Application.SetCompatibleTextRenderingDefault(false);
34 | Application.Run(new Bot());
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/CargoUpdated.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class CargoUpdated : Command
11 | {
12 | public const ushort ID = 25488;
13 |
14 | public double CargoCount { get; private set; }
15 |
16 | public CargoUpdated(EndianBinaryReader reader)
17 | {
18 | int length = reader.ReadInt32();
19 | if (length > 0)
20 | {
21 | for (int i = 0; i < length; i++)
22 | {
23 | reader.ReadInt16(); //class_364
24 | reader.ReadInt16();
25 | reader.ReadInt16();
26 | double Amount = reader.ReadDouble();
27 | reader.ReadInt16(); //class_171
28 | int OreID = reader.ReadUInt16();
29 | reader.ReadUInt16();
30 | if ((Ore.OreType)OreID != Ore.OreType.XENOMIT)
31 | CargoCount += Amount;
32 | }
33 | }
34 | reader.ReadUInt16();
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Move.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | public class Move : Command
10 | {
11 | public const ushort ID = 18296;
12 |
13 | public uint TargetX { get; private set; } // name_135
14 | public uint TargetY { get; private set; } // name_20
15 | public uint CurrentX { get; private set; } // var_3310
16 | public uint CurrentY { get; private set; } // var_14
17 |
18 | public Move(uint targetX, uint targetY, uint currentX, uint currentY)
19 | {
20 | TargetX = targetX;
21 | TargetY = targetY;
22 | CurrentX = currentX;
23 | CurrentY = currentY;
24 | Write();
25 | }
26 |
27 | public void Write()
28 | {
29 | packetWriter.Write((short)22);
30 | packetWriter.Write(ID); //2
31 | packetWriter.Write((short)-13024); //2
32 | packetWriter.Write((short)21768); //2
33 | packetWriter.Write(TargetX >> 12 | TargetX << 20);
34 | packetWriter.Write(CurrentX << 6 | CurrentX >> 26);
35 | packetWriter.Write(CurrentY >> 12 | CurrentY << 20);
36 | packetWriter.Write(TargetY >> 6 | TargetY << 26);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Core/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Core")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Core")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("ff3eaa4c-12ba-4938-b07c-face3f14cc43")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/PolskaBot/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("PolskaBot")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("PolskaBot")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("036392a5-aa92-4878-bef1-3d0c17bb8747")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Class370.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class Class370 : Command
11 | {
12 | public const ushort ID = 18881;
13 |
14 | public string MessageType { get; private set; }
15 |
16 | public Class370(EndianBinaryReader reader)
17 | {
18 | int length = reader.ReadInt32();
19 | if (length > 0)
20 | {
21 | for (int i = 0; i < length; i++)
22 | {
23 | reader.ReadInt16(); //23340 | class_371
24 | Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadInt16()));
25 | reader.ReadInt16(); //3660 | class_124
26 | reader.ReadInt16();
27 | reader.ReadInt16();
28 | Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
29 | }
30 | }
31 | reader.ReadInt16();
32 | reader.ReadInt16();
33 | reader.ReadInt16(); //3660 | class_124
34 | reader.ReadInt16();
35 | reader.ReadInt16();
36 | MessageType = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Login.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
8 | {
9 | class Login : Command
10 | {
11 | public const ushort ID = 28887;
12 |
13 | public int UserID { get; private set; }
14 | public string SID { get; private set; }
15 | public short FactionID { get; private set; }
16 | public int InstanceID { get; private set; }
17 | public string Version { get; private set; }
18 |
19 | public Login(int userID, string sessionID, short factionID, int instanceID, string version = Config.VERSION)
20 | {
21 | UserID = userID;
22 | SID = sessionID;
23 | FactionID = factionID;
24 | InstanceID = instanceID;
25 | Version = version;
26 | Write();
27 | }
28 |
29 | public void Write()
30 | {
31 | short totalLength = (short)(SID.Length + Version.Length + 16);
32 | packetWriter.Write(totalLength);
33 | packetWriter.Write(ID);
34 | packetWriter.Write(UserID >> 6 | UserID << 26);
35 | packetWriter.Write((byte)0);
36 | packetWriter.Write(Version);
37 | packetWriter.Write(InstanceID << 7 | InstanceID >> 25);
38 | packetWriter.Write((byte)0);
39 | packetWriter.Write(SID);
40 | packetWriter.Write(FactionID);
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Core.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Core", "Core\Core.csproj", "{FF3EAA4C-12BA-4938-B07C-FACE3F14CC43}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PolskaBot", "PolskaBot\PolskaBot.csproj", "{036392A5-AA92-4878-BEF1-3D0C17BB8747}"
9 | EndProject
10 | Global
11 | GlobalSection(Performance) = preSolution
12 | HasPerformanceSessions = true
13 | EndGlobalSection
14 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
15 | Debug|Any CPU = Debug|Any CPU
16 | Release|Any CPU = Release|Any CPU
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {FF3EAA4C-12BA-4938-B07C-FACE3F14CC43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {FF3EAA4C-12BA-4938-B07C-FACE3F14CC43}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {FF3EAA4C-12BA-4938-B07C-FACE3F14CC43}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {FF3EAA4C-12BA-4938-B07C-FACE3F14CC43}.Release|Any CPU.Build.0 = Release|Any CPU
23 | {036392A5-AA92-4878-BEF1-3D0C17BB8747}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {036392A5-AA92-4878-BEF1-3D0C17BB8747}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {036392A5-AA92-4878-BEF1-3D0C17BB8747}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {036392A5-AA92-4878-BEF1-3D0C17BB8747}.Release|Any CPU.Build.0 = Release|Any CPU
27 | EndGlobalSection
28 | GlobalSection(SolutionProperties) = preSolution
29 | HideSolutionNode = FALSE
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/CollectBox.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | public class CollectBox : Command
11 | {
12 | public const ushort ID = 12841;
13 |
14 | public int BoxPosX { get; private set; } //var_3696
15 | public string Hash { get; private set; } //var_3886
16 | public int ShipPosX { get; private set; } //var_4802
17 | public int BoxPosY { get; private set; } //var_715
18 | public int ShipPosY { get; private set; } //var_2321
19 |
20 | public CollectBox(string Hash, int BoxPosX, int BoxPosY, int ShipPosX, int ShipPosY)
21 | {
22 | this.Hash = Hash;
23 | this.BoxPosX = BoxPosX;
24 | this.BoxPosY = BoxPosY;
25 | this.ShipPosX = ShipPosX;
26 | this.ShipPosY = ShipPosY;
27 | Write();
28 | }
29 |
30 | public void Write()
31 | {
32 | packetWriter.Write((short)(22 + Hash.Length));
33 | packetWriter.Write(ID);
34 | packetWriter.Write((short)Hash.Length);
35 | packetWriter.Write(Encoding.UTF8.GetBytes(Hash));
36 | packetWriter.Write((int)((uint)ShipPosY << 13 | (uint)ShipPosY >> 19));
37 | packetWriter.Write((int)((uint)BoxPosX << 8 | (uint)BoxPosX >> 24));
38 | packetWriter.Write((int)((uint)ShipPosX << 12 | (uint)ShipPosX >> 20));
39 | packetWriter.Write((short)9444);
40 | packetWriter.Write((int)((uint)BoxPosY >> 12 | (uint)BoxPosY << 20));
41 |
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/PolskaBot/ColorProgressBar.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Forms;
7 | using System.Drawing;
8 |
9 | namespace PolskaBot
10 | {
11 | class ColorProgressBar : PictureBox
12 | {
13 | public int Value { get; set; } = 0;
14 | public int Maximum { get; set; } = 100;
15 |
16 | public Color PaintColor { get; set; } = Color.DarkGray;
17 | public Color FontPrimary { get; set; } = Color.White;
18 | public Color FontSecondary { get; set; } = Color.FromArgb(95, 95, 95);
19 |
20 | private Font font = new Font("Arial", 9, FontStyle.Bold);
21 |
22 | protected override void OnPaint(PaintEventArgs pe)
23 | {
24 | base.OnPaint(pe);
25 | string text = Value.ToString();
26 | SizeF size = pe.Graphics.MeasureString(text, font);
27 |
28 | float fill = (Value / (float)Maximum) * Size.Width;
29 |
30 | pe.Graphics.FillRectangle(new SolidBrush(PaintColor), 0, 0, fill, Size.Height);
31 |
32 | if(float.IsNaN(fill) || fill < Size.Width/2 + size.Width/2)
33 | {
34 | pe.Graphics.DrawString(text, font, new SolidBrush(FontSecondary), Size.Width / 2 - size.Width / 2,
35 | Size.Height / 2 - size.Height / 2);
36 | } else
37 | {
38 | pe.Graphics.DrawString(text, font, new SolidBrush(FontPrimary), Size.Width / 2 - size.Width / 2,
39 | Size.Height / 2 - size.Height / 2);
40 | }
41 | }
42 |
43 | public void UpdateStats(int value, int maximum)
44 | {
45 | Maximum = maximum;
46 | Value = value;
47 | Refresh();
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ShipUpdated.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class ShipUpdated : Command
11 | {
12 | public const ushort ID = 17263;
13 |
14 | public int Damage { get; private set; }
15 | public int DamageType { get; private set; } // var_456 | check class_640
16 | public int NanoHP { get; private set; } // var_1654
17 | public int Shield { get; private set; } // var_1574
18 | public int HP { get; private set; } // var_2158
19 | public int UserID { get; private set; } // var_4879
20 | public int Name_128 { get; private set; }
21 | public bool Var_4939 { get; private set; }
22 |
23 | public ShipUpdated(EndianBinaryReader reader)
24 | {
25 | NanoHP = reader.ReadInt32();
26 | NanoHP = (int)((uint)NanoHP >> 3 | (uint)NanoHP << 29);
27 | reader.ReadUInt16(); //get into class_640
28 | DamageType = reader.ReadUInt16(); //
29 | Damage = reader.ReadInt32();
30 | Damage = (int)((uint)Damage >> 6 | (uint)Damage << 26);
31 | Name_128 = reader.ReadInt32();
32 | Name_128 = (int)((uint)Name_128 >> 7 | (uint)Name_128 << 25);
33 | UserID = reader.ReadInt32();
34 | UserID = (int)((uint)UserID >> 9 | (uint)UserID << 23);
35 | Shield = reader.ReadInt32();
36 | Shield = (int)((uint)Shield >> 9 | (uint)Shield << 23);
37 | HP = reader.ReadInt32();
38 | HP = (int)((uint)HP >> 14 | (uint)HP << 18);
39 | Var_4939 = reader.ReadBoolean();
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/PolskaBot/Config.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Drawing;
7 |
8 | namespace PolskaBot
9 | {
10 | class Config
11 | {
12 | public const int FPS = 10;
13 | public const float k = 0.015f;
14 | public const int poizoneSize = 10;
15 | const byte alpha = 216;
16 |
17 | public static Color neutral = Color.FromArgb(alpha, 102, 102, 102);
18 |
19 | public static Color mapBG = Color.FromArgb(20, 102, 102, 102);
20 | public static Color hero = Color.FromArgb(alpha, 102, 102, 102);
21 | public static Color box = Color.FromArgb(alpha, 255, 255, 0);
22 | public static Color boxPirate = Color.Green;
23 | public static Color cargo = Color.FromArgb(alpha, 255, 200, 0);
24 | public static Color boxMemorised = Color.FromArgb(150, 255, 255, 0);
25 |
26 | public static Color prometium = Color.FromArgb(179, 47, 47);
27 | public static Color endurium = Color.FromArgb(89, 170, 227);
28 | public static Color terbium = Color.FromArgb(224, 229, 63);
29 | public static Color palladium = Color.FromArgb(158, 28, 195);
30 |
31 | public static Color hitpoints = Color.FromArgb(0, 204, 51);
32 | public static Color shield = Color.FromArgb(51, 143, 204);
33 |
34 | // Ships
35 | public static Color friend = Color.FromArgb(0, 153, 255);
36 | public static Color npc = Color.Red;
37 | public static Color enemy = Color.FromArgb(alpha, 255, 152, 0);
38 |
39 | // Buildings
40 | public static Color gate = Color.FromArgb(alpha, 255, 255, 255);
41 | public static Color building = Color.FromArgb(alpha, 203, 46, 255);
42 |
43 | public static Font font = new Font("Arial", 8, FontStyle.Regular);
44 |
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/PolskaBot/Tween/GlideInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 |
5 | namespace Glide
6 | {
7 | internal class GlideInfo
8 | {
9 | private static BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Static;
10 |
11 | public string PropertyName { get; private set; }
12 | public Type PropertyType { get; private set; }
13 |
14 | private FieldInfo field;
15 | private PropertyInfo prop;
16 | private object Target;
17 |
18 | public object Value
19 | {
20 | get
21 | {
22 | return field != null ?
23 | field.GetValue(Target) :
24 | prop.GetValue(Target, null);
25 | }
26 |
27 | set
28 | {
29 | if (field != null) field.SetValue(Target, value);
30 | else prop.SetValue(Target, value, null);
31 | }
32 | }
33 |
34 | public GlideInfo(object target, PropertyInfo info)
35 | {
36 | Target = target;
37 | prop = info;
38 | PropertyName = info.Name;
39 | PropertyType = prop.PropertyType;
40 | }
41 |
42 | public GlideInfo(object target, FieldInfo info)
43 | {
44 | Target = target;
45 | field = info;
46 | PropertyName = info.Name;
47 | PropertyType = info.FieldType;
48 | }
49 |
50 | public GlideInfo(object target, string property, bool writeRequired = true)
51 | {
52 | Target = target;
53 | PropertyName = property;
54 |
55 | var targetType = target as Type ?? target.GetType();
56 |
57 | if ((field = targetType.GetField(property, flags)) != null)
58 | {
59 | PropertyType = field.FieldType;
60 | }
61 | else if ((prop = targetType.GetProperty(property, flags)) != null)
62 | {
63 | PropertyType = prop.PropertyType;
64 | }
65 | else
66 | {
67 | // Couldn't find either
68 | throw new Exception(string.Format("Field or {0} property '{1}' not found on object of type {2}.",
69 | writeRequired ? "read/write" : "readable",
70 | property, targetType.FullName));
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/GateInit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class GateInit : Command
11 | {
12 | public const ushort ID = 8519;
13 |
14 | public int FactionID { get; private set; }
15 | public List var_2358 { get; private set; } = new List();
16 | public int X { get; private set; }
17 | public int GateType { get; private set; } //name_158
18 | public bool var_139 { get; private set; }
19 | public bool var_4990 { get; private set; }
20 | public int Y { get; private set; }
21 | public int AssetID { get; private set; } //var_5014 (?)
22 |
23 | public GateInit(EndianBinaryReader reader)
24 | {
25 | var_4990 = reader.ReadBoolean();
26 | reader.ReadUInt16();
27 | int length = reader.ReadInt32();
28 | if (length > 0)
29 | {
30 | for (int i = 0; i < length; i++)
31 | {
32 | int value = reader.ReadInt32();
33 | value = (int)((uint)value >> 15 | (uint)value << 17);
34 | var_2358.Add(value);
35 | }
36 | }
37 | var_139 = reader.ReadBoolean();
38 | Y = reader.ReadInt32();
39 | Y = (int)((uint)Y << 8 | (uint)Y >> 24);
40 | X = reader.ReadInt32();
41 | X = (int)((uint)X << 10 | (uint)X >> 22);
42 | AssetID = reader.ReadInt32();
43 | AssetID = (int)((uint)AssetID << 5 | (uint)AssetID >> 27);
44 | FactionID = reader.ReadInt32();
45 | FactionID = (int)((uint)FactionID >> 15 | (uint)FactionID << 17);
46 | reader.ReadUInt16();
47 | GateType = reader.ReadInt32();
48 | GateType = (int)((uint)GateType << 10 | (uint)GateType >> 22);
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ReviveShip.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | public class ReviveShip : Command
11 | {
12 | public const ushort ID = 23242;
13 |
14 | public short Selected { get; private set; }
15 | public int UserID { get; private set; }
16 | public string SID { get; private set; }
17 | public short FactionID { get; private set; }
18 | public int InstanceID { get; private set; }
19 | public string Version { get; private set; }
20 |
21 | public ReviveShip(int userID, string sessionID, short factionID, int instanceID, short selected)
22 | {
23 | UserID = userID;
24 | SID = sessionID;
25 | FactionID = factionID;
26 | InstanceID = instanceID;
27 | Version = "";
28 | Selected = selected;
29 | Write();
30 | }
31 |
32 | public void Write()
33 | {
34 | packetWriter.Write((short)(30 + Version.Length + SID.Length));
35 | packetWriter.Write(ID);
36 | packetWriter.Write((short)-22573);
37 | packetWriter.Write((short)2455); //class_356.ID
38 | packetWriter.Write(Selected);
39 | packetWriter.Write((short)2306);
40 | packetWriter.Write((short)24292);
41 | packetWriter.Write((short)13280);
42 | packetWriter.Write(Login.ID);
43 | packetWriter.Write((int)((uint)UserID >> 6 | (uint)UserID << 26));
44 | packetWriter.Write((short)Version.Length);
45 | packetWriter.Write(Encoding.UTF8.GetBytes(Version));
46 | packetWriter.Write((int)((uint)InstanceID << 7 | (uint)InstanceID >> 25));
47 | packetWriter.Write((short)SID.Length);
48 | packetWriter.Write(Encoding.UTF8.GetBytes(SID));
49 | packetWriter.Write(FactionID);
50 |
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/PolskaBot/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PolskaBot.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
29 | public bool DrawMap {
30 | get {
31 | return ((bool)(this["DrawMap"]));
32 | }
33 | set {
34 | this["DrawMap"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
41 | public bool DrawOres {
42 | get {
43 | return ((bool)(this["DrawOres"]));
44 | }
45 | set {
46 | this["DrawOres"] = value;
47 | }
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Core/Flash/External/ExternalInterfaceCall.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Text;
4 |
5 | namespace Flash.External
6 | {
7 | ///
8 | /// Value object containing information about an ExternalInterface call
9 | /// sent between a .NET application and a Shockwave Flash object.
10 | ///
11 | public class ExternalInterfaceCall
12 | {
13 | #region Private Fields
14 |
15 | private string _functionName;
16 | private ArrayList _arguments;
17 |
18 | #endregion
19 |
20 | #region Constructor
21 |
22 | ///
23 | /// Creates a new ExternalInterfaceCall instance with the specified
24 | /// function name.
25 | ///
26 | /// The name of the function as provided
27 | /// by Flash Player
28 | public ExternalInterfaceCall(string functionName)
29 | {
30 | _functionName = functionName;
31 | }
32 |
33 | #endregion
34 |
35 | #region Public Properties
36 |
37 | ///
38 | /// The name of the function call provided by Flash Player
39 | ///
40 | public string FunctionName
41 | {
42 | get { return _functionName; }
43 | }
44 |
45 | ///
46 | /// The function parameters associated with this function call.
47 | ///
48 | public object[] Arguments
49 | {
50 | get { return (object[])_arguments.ToArray(typeof(object)); }
51 | }
52 |
53 | #endregion
54 |
55 | #region Public Methods
56 |
57 | public override string ToString()
58 | {
59 | StringBuilder result = new StringBuilder();
60 | result.AppendFormat("Function Name: {0}{1}", _functionName, Environment.NewLine);
61 | if (_arguments != null && _arguments.Count > 0)
62 | {
63 | result.AppendFormat("Arguments:{0}", Environment.NewLine);
64 | foreach (object arg in _arguments)
65 | {
66 | result.AppendFormat("\t{0}{1}", arg, Environment.NewLine);
67 | }
68 | }
69 | return result.ToString();
70 | }
71 |
72 | #endregion
73 |
74 | #region Internal Methods
75 |
76 | internal void AddArgument(object argument)
77 | {
78 | if (_arguments == null)
79 | {
80 | _arguments = new ArrayList();
81 | }
82 | _arguments.Add(argument);
83 | }
84 |
85 | #endregion
86 | }
87 | }
--------------------------------------------------------------------------------
/PolskaBot/SettingsForm.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Data;
5 | using System.Drawing;
6 | using System.Linq;
7 | using System.Text;
8 | using System.Threading.Tasks;
9 | using System.Windows.Forms;
10 |
11 | namespace PolskaBot
12 | {
13 | public partial class SettingsForm : Form
14 | {
15 | private BotPage botPage;
16 |
17 | public SettingsForm(BotPage botPage)
18 | {
19 | this.botPage = botPage;
20 | InitializeComponent();
21 |
22 | LoadSettings();
23 |
24 | saveButton.Click += (s, e) =>
25 | {
26 | botPage.Settings.CollectorEnabled = enableCollectorBox.Checked;
27 | botPage.Settings.CollectBonusBoxes = bbBox.Checked;
28 | botPage.Settings.CollectEventBoxes = ebBox.Checked;
29 | botPage.Settings.HPLimit = hpSlider.Value;
30 |
31 | if (repairBase.Checked)
32 | botPage.Settings.RepairAt = 1;
33 | else if (repairPortal.Checked)
34 | botPage.Settings.RepairAt = 2;
35 | else if (repairBattle.Checked)
36 | botPage.Settings.RepairAt = 3;
37 |
38 | botPage.Settings.Reload();
39 | Close();
40 | };
41 |
42 | hpSlider.ValueChanged += (s, e) => repairLabel.Text = $"Repair when HP less than {hpSlider.Value}%";
43 | }
44 |
45 | private void LoadSettings()
46 | {
47 | enableCollectorBox.Checked = botPage.Settings.CollectorEnabled;
48 | bbBox.Checked = botPage.Settings.CollectBonusBoxes;
49 | ebBox.Checked = botPage.Settings.CollectEventBoxes;
50 | hpSlider.Value = botPage.Settings.HPLimit;
51 | repairLabel.Text = $"Repair when HP less than {hpSlider.Value}%";
52 |
53 | switch(botPage.Settings.RepairAt)
54 | {
55 | case 1:
56 | repairBase.Checked = true;
57 | break;
58 | case 2:
59 | repairPortal.Checked = true;
60 | break;
61 | case 3:
62 | repairBattle.Checked = true;
63 | break;
64 | }
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/Core/Fade/FadeProxy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using Flash.External;
4 |
5 | namespace PolskaBot.Fade
6 | {
7 | ///
8 | /// Creates proxy that handles Fade Protocol on top of AxShockwaveFlash control.
9 | ///
10 | public class FadeProxy
11 | {
12 | public ExternalInterfaceProxy proxy { get; private set; }
13 |
14 | #region Private fields
15 |
16 | private Dictionary _clients = new Dictionary();
17 |
18 | #endregion
19 |
20 | #region Events
21 |
22 | ///
23 | /// Reports that both parties reported to be ready for communication.
24 | ///
25 | public event EventHandler Ready;
26 |
27 | #endregion
28 |
29 | #region Constructor
30 |
31 | ///
32 | /// Initializes FadeProxy on top of specified AxShockwaveFlash control.
33 | ///
34 | /// AxShockwaveFlash control that contains Fade compatible SWF file.
35 | public FadeProxy(AxShockwaveFlashObjects.AxShockwaveFlash flashControl)
36 | {
37 | proxy = new ExternalInterfaceProxy(flashControl);
38 |
39 | proxy.ExternalInterfaceCall += (s, e) =>
40 | {
41 | switch(e.FunctionCall.FunctionName)
42 | {
43 | case "checkStatus":
44 | return true;
45 | case "callbacksReady":
46 | Ready?.Invoke(this, EventArgs.Empty);
47 | return null;
48 | case "stageOneInitialized":
49 | _clients[(string)e.FunctionCall.Arguments[0]]?.HandleCall(e);
50 | return null;
51 | default:
52 | Console.WriteLine(e.FunctionCall.FunctionName);
53 | return null;
54 | }
55 | };
56 | }
57 |
58 | #endregion
59 |
60 | #region Client helpers
61 |
62 | ///
63 | /// Creates new Client for specified Proxy and control.
64 | ///
65 | /// Ready to use FadeProxyClient.
66 | public FadeProxyClient CreateClient()
67 | {
68 | FadeProxyClient client = new FadeProxyClient(this);
69 | _clients.Add(client.ID, client);
70 | proxy.Call("connect", client.ID);
71 | return client;
72 | }
73 |
74 | #endregion
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/Core/HttpManager.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Net;
3 | using System.IO;
4 |
5 |
6 | namespace PolskaBot.Core
7 | {
8 | public class HttpManager
9 | {
10 | private CookieContainer cookies = new CookieContainer();
11 |
12 | private WebHeaderCollection headers = new WebHeaderCollection();
13 |
14 | private string lastURL = "https://www.google.pl/?gfe_rd=cr&ei=p9JpVuDNAeOv8wfZ85XgCA";
15 |
16 | public string userAgent { get; set; }
17 |
18 | public string Post(string url, string data)
19 | {
20 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
21 | request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip | DecompressionMethods.None;
22 | request.CookieContainer = cookies;
23 | request.UserAgent = userAgent;
24 | request.Headers = headers;
25 | request.Method = "POST";
26 | request.ContentType = "application/x-www-form-urlencoded";
27 | request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8";
28 | request.Referer = lastURL;
29 |
30 | using (var writer = new StreamWriter(request.GetRequestStream()))
31 | {
32 | writer.Write(data);
33 | }
34 |
35 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
36 | lastURL = response.ResponseUri.ToString();
37 | using(StreamReader reader = new StreamReader(response.GetResponseStream()))
38 | {
39 | return reader.ReadToEnd();
40 | }
41 | }
42 |
43 | public string Get(string url)
44 | {
45 | HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
46 | request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip | DecompressionMethods.None;
47 | request.CookieContainer = cookies;
48 | request.UserAgent = userAgent;
49 | request.Headers = headers;
50 | request.Method = "GET";
51 |
52 | HttpWebResponse response = (HttpWebResponse)request.GetResponse();
53 | lastURL = response.ResponseUri.ToString();
54 | using (StreamReader reader = new StreamReader(response.GetResponseStream()))
55 | {
56 | return reader.ReadToEnd();
57 | }
58 | }
59 |
60 | public void AddHeader(string header, string value)
61 | {
62 | if(header == "User-Agent")
63 | {
64 | userAgent = value;
65 | return;
66 | }
67 | headers.Add(header, value);
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/Notify.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class Notify : Command
11 | {
12 | public const ushort ID = 6339;
13 |
14 | public string var_2770 { get; private set; } //var_2770
15 | public string var_3114 { get; private set; } //var_3114
16 | public string var_2034 { get; private set; } //var_2034
17 |
18 | public string MessageType { get; private set; }
19 | //ttip_killscreen_basic_repair
20 |
21 | public Notify(EndianBinaryReader reader)
22 | {
23 | var_3114 = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
24 | var_2034 = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
25 | int length = reader.ReadInt32();
26 | if (length > 0)
27 | {
28 | for (int i = 0; i < length; i++)
29 | {
30 | reader.ReadInt16(); //class_907
31 | reader.ReadInt16();
32 | reader.ReadInt16(); //class_370
33 | Class370 var_1480 = new Class370(reader);
34 | reader.ReadInt16(); //class_356
35 | reader.ReadInt16();
36 | reader.ReadInt16();
37 | reader.ReadInt16();
38 | reader.ReadBoolean();
39 | reader.ReadInt16(); //class_357
40 | reader.ReadInt32();
41 | reader.ReadInt16();
42 | reader.ReadInt16(); //class_370
43 | Class370 toolTipKey = new Class370(reader);
44 | MessageType = toolTipKey.MessageType;
45 | reader.ReadInt16(); //class_370
46 | Class370 name_29 = new Class370(reader);
47 | reader.ReadInt32();
48 | reader.ReadUInt16();
49 | reader.ReadInt16(); //class_370
50 | Class370 var_2698 = new Class370(reader);
51 | }
52 | }
53 | reader.ReadInt16();
54 | var_2770 = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
55 | reader.ReadInt16(); //class_524
56 | reader.ReadInt16();
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/PolskaBot/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace PolskaBot.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PolskaBot.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 |
63 | ///
64 | /// Looks up a localized resource of type System.Drawing.Bitmap.
65 | ///
66 | internal static System.Drawing.Bitmap Logo {
67 | get {
68 | object obj = ResourceManager.GetObject("Logo", resourceCulture);
69 | return ((System.Drawing.Bitmap)(obj));
70 | }
71 | }
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/BuildingInit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class BuildingInit : Command
11 | {
12 | public const ushort ID = 7761;
13 |
14 | public string name_138 { get; private set; } // name_138
15 | public int var_3377 { get; private set; } // var_3377
16 | public int BuildingID { get; private set; } // assetId
17 | public int AssetType { get; private set; }
18 | //public var name_96:package_38.class_940;
19 | public bool var_3562 { get; private set; } // var_3562
20 | //public var type:package_38.class_455;
21 | public int X { get; private set; } // var_4802
22 | public int name_158 { get; private set; } // name_158
23 | public int name_48 { get; private set; } // name_48
24 | public int Y { get; private set; } // var_2324
25 | public bool var_4991 { get; private set; } // var_4991
26 | public bool var_984 { get; private set; } // var_984
27 | //public var var_2742:Vector.;
28 | public int FactionID { get; private set; }
29 | public bool var_1531 { get; private set; } // var_1531
30 | public string Name { get; private set; } //var_3497
31 |
32 | public BuildingInit(EndianBinaryReader reader)
33 | {
34 | BuildingID = reader.ReadInt32();
35 | BuildingID = (int)((uint)BuildingID >> 2 | (uint)BuildingID << 30);
36 | X = reader.ReadInt32();
37 | X = (int)((uint)X << 8 | (uint)X >> 24);
38 | name_138 = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
39 | reader.ReadUInt16();
40 | var_1531 = reader.ReadBoolean();
41 | var_984 = reader.ReadBoolean();
42 | name_48 = reader.ReadInt32();
43 | name_48 = (int)((uint)name_48 << 2 | (uint)name_48 >> 30);
44 | FactionID = reader.ReadInt32();
45 | FactionID = (int)((uint)FactionID >> 13 | (uint)FactionID << 19);
46 | int length = reader.ReadInt32();
47 | if (length > 0)
48 | {
49 | for (int i = 0; i < length; i++)
50 | {
51 | reader.ReadInt16();
52 | Class326 class326 = new Class326(reader);
53 | }
54 | }
55 | name_158 = reader.ReadInt32();
56 | name_158 = (int)((uint)name_158 >> 11 | (uint)name_158 << 21);
57 | var_3377 = reader.ReadInt32();
58 | var_3377 = (int)((uint)var_3377 >> 6 | (uint)var_3377 << 26);
59 | //class_455 begin read
60 | reader.ReadUInt16();
61 | AssetType = reader.ReadUInt16();
62 | //class_455 end read
63 | Y = reader.ReadInt32();
64 | Y = (int)((uint)Y >> 10 | (uint)Y << 22);
65 | //class_940 begin read
66 | reader.ReadUInt16();
67 | reader.ReadUInt16();
68 | int type = reader.ReadUInt16();
69 | //class_940 end read
70 | Name = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
71 | var_4991 = reader.ReadBoolean();
72 | var_3562 = reader.ReadBoolean();
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/ShipInit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class ShipInit : Command
11 | {
12 | public const ushort ID = 31178;
13 |
14 | public bool var_4552 { get; private set; }
15 | public uint var_3834 { get; private set; }
16 | public uint var_3378 { get; private set; }
17 | public int X { get; private set; }
18 | public int Y { get; private set; }
19 | public uint ClanID { get; private set; } //name_46
20 | public bool Cloaked { get; private set; }
21 | //public var name_148:package_38.class_940;
22 | //public var var_2742:Vector.;
23 | public int var_3914 { get; private set; }
24 | public string ClanTag { get; private set; } //name_138
25 | public int FactionID { get; private set; }
26 | public uint Rank { get; private set; } //name_134
27 | //public var var_4235:package_38.class_396;
28 | public bool var_3674 { get; private set; }
29 | public string Shipname { get; private set; } //name_122
30 | public bool NPC { get; private set; }
31 | public uint var_2597 { get; private set; }
32 | public string Username { get; private set; } //var_3497
33 | public uint UserID { get; private set; } //name_125
34 |
35 | public ShipInit(EndianBinaryReader reader)
36 | {
37 | X = reader.ReadInt32();
38 | X = (int)((uint)X << 14 | (uint)X >> 18);
39 | var_3914 = reader.ReadInt32();
40 | var_3914 = var_3914 >> 7 | var_3914 << 25;
41 | reader.ReadUInt16(); //class_940
42 | reader.ReadUInt16();
43 | reader.ReadUInt16();
44 | var_4552 = reader.ReadBoolean();
45 | NPC = reader.ReadBoolean();
46 | reader.ReadUInt16(); //class_396
47 | reader.ReadUInt16();
48 | Cloaked = reader.ReadBoolean();
49 | FactionID = reader.ReadInt32();
50 | FactionID = (int)((uint)FactionID << 12 | (uint)FactionID >> 20);
51 | Username = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
52 | reader.ReadUInt16();
53 | var_3674 = reader.ReadBoolean();
54 | reader.ReadUInt16();
55 | var_3378 = reader.ReadUInt32();
56 | var_3378 = var_3378 >> 13 | var_3378 << 19;
57 | UserID = reader.ReadUInt32();
58 | UserID = UserID << 4 | UserID >> 28;
59 | Rank = reader.ReadUInt32();
60 | Rank = Rank << 15 | Rank >> 17;
61 | var_3834 = reader.ReadUInt32();
62 | var_3834 = var_3834 >> 3 | var_3834 << 29;
63 | ClanID = reader.ReadUInt32();
64 | ClanID = ClanID >> 12 | ClanID << 20;
65 | var_2597 = reader.ReadUInt32();
66 | var_2597 = var_2597 >> 13 | var_2597 << 19;
67 | int length = reader.ReadInt32();
68 | if (length > 0)
69 | {
70 | for (int i = 0; i < length; i++)
71 | {
72 | reader.ReadInt16();
73 | Class326 class326 = new Class326(reader);
74 | }
75 | }
76 | Shipname = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
77 | Y = reader.ReadInt32();
78 | Y = (int)((uint)Y >> 10 | (uint)Y << 22);
79 | ClanTag = Encoding.UTF8.GetString(reader.ReadBytes(reader.ReadUInt16()));
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/Core/Client.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.IO;
7 | using System.Net.Sockets;
8 | using System.Threading;
9 | using MiscUtil.IO;
10 | using MiscUtil.Conversion;
11 | using PolskaBot.Core.Darkorbit.Commands;
12 |
13 | namespace PolskaBot.Core
14 | {
15 | abstract class Client
16 | {
17 | public object locker = new object();
18 |
19 | public API api { get; private set; }
20 |
21 | public bool Running { get; set; } = true;
22 |
23 | public Thread thread { get; private set; }
24 | public TcpClient tcpClient { get; private set; }
25 | public NetworkStream stream { get; private set; }
26 |
27 | public string IP { get; set; }
28 | public int port { get; set; }
29 |
30 | public event EventHandler OnConnected;
31 | public event EventHandler Disconnected;
32 |
33 | public Client(API api)
34 | {
35 | this.api = api;
36 | tcpClient = new TcpClient();
37 | }
38 |
39 | public void Connect(string IP, int port)
40 | {
41 | this.IP = IP;
42 | this.port = port;
43 |
44 | thread = new Thread(new ThreadStart(Run));
45 |
46 | try
47 | {
48 | tcpClient.Connect(this.IP, this.port);
49 | }
50 | catch (SocketException ex)
51 | {
52 | Thread.Sleep(5000);
53 | Disconnected?.Invoke(this, EventArgs.Empty);
54 | return;
55 | }
56 |
57 | if(tcpClient.Connected)
58 | {
59 | stream = tcpClient.GetStream();
60 | if (!thread.IsAlive)
61 | thread.Start();
62 | OnConnected?.Invoke(this, EventArgs.Empty);
63 | }
64 | }
65 |
66 | public virtual void Stop()
67 | {
68 | Running = false;
69 | thread?.Abort();
70 | tcpClient?.Close();
71 | stream?.Close();
72 | }
73 |
74 | public void Disconnect()
75 | {
76 | tcpClient?.Client?.Disconnect(false);
77 | tcpClient?.Close();
78 | stream?.Close();
79 | thread = new Thread(new ThreadStart(Run));
80 | tcpClient = new TcpClient();
81 | }
82 |
83 | public void Send(Command command)
84 | {
85 | Send(command.ToArray());
86 | }
87 |
88 | public void Send(byte[] buffer)
89 | {
90 | if (!Running)
91 | return;
92 |
93 | if (!IsConnected())
94 | {
95 | Disconnected?.Invoke(this, EventArgs.Empty);
96 | return;
97 | }
98 | stream.Write(buffer, 0, buffer.Length);
99 | stream.Flush();
100 | }
101 |
102 | protected void Run()
103 | {
104 | while(true)
105 | {
106 | if (!IsConnected())
107 | {
108 | Disconnected?.Invoke(this, EventArgs.Empty);
109 | return;
110 | }
111 | Parse(new EndianBinaryReader(EndianBitConverter.Big, stream));
112 | }
113 | }
114 |
115 | protected bool IsConnected()
116 | {
117 | if (tcpClient == null || tcpClient.Client == null || !stream.CanWrite || !stream.CanRead)
118 | return false;
119 | try
120 | {
121 | return !(tcpClient.Client.Poll(1, SelectMode.SelectRead) && tcpClient.Client.Available == 0);
122 | }
123 | catch (SocketException) { return false; }
124 | }
125 |
126 | public abstract void Parse(EndianBinaryReader reader);
127 | }
128 | }
129 |
--------------------------------------------------------------------------------
/Core/Flash/External/ExternalInterfaceProxy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using AxShockwaveFlashObjects;
4 |
5 | namespace Flash.External
6 | {
7 | ///
8 | /// Facilitates External Interface communication between a .NET application and a Shockwave
9 | /// Flash ActiveX control by providing an abstraction layer over the XML-serialized data format
10 | /// used by Flash Player for ExternalInterface communication.
11 | /// This class provides the Call method for calling ActionScript functions and raises
12 | /// the ExternalInterfaceCall event when calls come from ActionScript.
13 | ///
14 | public class ExternalInterfaceProxy
15 | {
16 | #region Private Fields
17 |
18 | private AxShockwaveFlash _flashControl;
19 |
20 | #endregion
21 |
22 | #region Constructor
23 |
24 | ///
25 | /// Creates a new ExternalInterfaceProxy for the specified Shockwave Flash ActiveX control.
26 | ///
27 | /// The Shockwave Flash ActiveX control with whom communication
28 | /// is managed by this proxy.
29 | public ExternalInterfaceProxy(AxShockwaveFlash flashControl)
30 | {
31 | _flashControl = flashControl;
32 | _flashControl.FlashCall += new _IShockwaveFlashEvents_FlashCallEventHandler(_flashControl_FlashCall);
33 | }
34 |
35 | #endregion
36 |
37 | #region Public Methods
38 |
39 | ///
40 | /// Calls the ActionScript function which is registered as a callback method with the
41 | /// ActionScript ExternalInterface class.
42 | ///
43 | /// The function name registered with the ExternalInterface class
44 | /// corresponding to the ActionScript function that is to be called
45 | /// Additional arguments, if any, to pass to the ActionScript function.
46 | /// The result returned by the ActionScript function, or null if no result is returned.
47 | /// Thrown when there is an error
48 | /// calling the method on Flash Player. For instance, this exception is raised if the
49 | /// specified function name is not registered as a callable function with the ExternalInterface
50 | /// class; it is also raised if the ActionScript method throws an Error.
51 | public object Call(string functionName, params object[] arguments)
52 | {
53 | try
54 | {
55 | string request = ExternalInterfaceSerializer.EncodeInvoke(functionName, arguments);
56 | string response = _flashControl.CallFunction(request);
57 | object result = ExternalInterfaceSerializer.DecodeResult(response);
58 | return result;
59 | }
60 | catch (COMException)
61 | {
62 | throw;
63 | }
64 | }
65 |
66 | #endregion
67 |
68 | #region Events
69 |
70 | ///
71 | /// Raised when an External Interface call is made from Flash Player.
72 | ///
73 | public event ExternalInterfaceCallEventHandler ExternalInterfaceCall;
74 |
75 | ///
76 | /// Raises the ExternalInterfaceCall event, indicating that a call has come from Flash Player.
77 | ///
78 | /// The event arguments related to the event being raised.
79 | protected virtual object OnExternalInterfaceCall(ExternalInterfaceCallEventArgs e)
80 | {
81 | if (ExternalInterfaceCall != null)
82 | {
83 | return ExternalInterfaceCall(this, e);
84 | }
85 | return null;
86 | }
87 |
88 | #endregion
89 |
90 | #region Event Handling
91 |
92 | ///
93 | /// Called when Flash Player raises the FlashCallEvent (when an External Interface call
94 | /// is made by ActionScript)
95 | ///
96 | /// The object raising the event
97 | /// The arguments for the event
98 | private void _flashControl_FlashCall(object sender, _IShockwaveFlashEvents_FlashCallEvent e)
99 | {
100 | ExternalInterfaceCall functionCall = ExternalInterfaceSerializer.DecodeInvoke(e.request);
101 | ExternalInterfaceCallEventArgs eventArgs = new ExternalInterfaceCallEventArgs(functionCall);
102 | object response = OnExternalInterfaceCall(eventArgs);
103 | _flashControl.SetReturnValue(ExternalInterfaceSerializer.EncodeResult(response));
104 | }
105 |
106 | #endregion
107 | }
108 | }
--------------------------------------------------------------------------------
/PolskaBot/Bot.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using System.Windows.Forms;
4 | using System.IO;
5 | using PolskaBot.Fade;
6 | using System.Net;
7 | using System.Deployment.Application;
8 |
9 | namespace PolskaBot
10 | {
11 |
12 | public partial class Bot : Form
13 | {
14 | private string _ip;
15 |
16 | public int AccountsCount { get; set; }
17 |
18 | private List pages = new List();
19 |
20 | private FadeProxy proxy;
21 |
22 | public Bot()
23 | {
24 | InitializeComponent();
25 | FormBorderStyle = FormBorderStyle.FixedSingle;
26 | Load += (s, e) => Init();
27 | FormClosed += (s, e) => {
28 | foreach (BotPage page in pages)
29 | {
30 | page.Stop();
31 | }
32 | };
33 | }
34 |
35 | private void Init()
36 | {
37 | if (ApplicationDeployment.IsNetworkDeployed)
38 | {
39 | Text = $"PolskaBot {ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4)}";
40 | }
41 |
42 | string swfPath = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "Fade.swf";
43 |
44 | Task serverTask = new Task(() =>
45 | {
46 | using (var client = new WebClient())
47 | {
48 | _ip = client.DownloadString("https://www.muzari.com/pb/server.txt");
49 | flashEmbed.LoadMovie(0, swfPath);
50 | }
51 | });
52 | serverTask.Start();
53 |
54 | proxy = new FadeProxy(flashEmbed);
55 | proxy.Ready += (s, e) => loginButton.Enabled = true;
56 |
57 | AcceptButton = loginButton;
58 | loginButton.Click += (s, e) =>
59 | {
60 | if (!usernameBox.Text.Equals("") || !passwordBox.Text.Equals(""))
61 | {
62 | var botPage = new BotPage(_ip, proxy.CreateClient(), usernameBox.Text, passwordBox.Text);
63 | pages.Add(botPage);
64 | botTabs.Controls.Add(botPage);
65 | botTabs.SelectedIndex = ++AccountsCount;
66 | usernameBox.Text = "";
67 | passwordBox.Text = "";
68 | }
69 | };
70 |
71 | botTabs.SelectedIndexChanged += (s, e) =>
72 | {
73 | if (botTabs.SelectedIndex == 0)
74 | {
75 | startButton.Enabled = false;
76 | stopButton.Enabled = false;
77 | closeButton.Enabled = false;
78 | settingsButton.Enabled = false;
79 | }
80 | else
81 | {
82 | startButton.Enabled = !pages[botTabs.SelectedIndex - 1].Running;
83 | stopButton.Enabled = pages[botTabs.SelectedIndex - 1].Running;
84 | closeButton.Enabled = true;
85 | settingsButton.Enabled = true;
86 | }
87 | };
88 |
89 | startButton.Click += (s, e) =>
90 | {
91 | pages[botTabs.SelectedIndex - 1].Running = true;
92 | startButton.Enabled = !pages[botTabs.SelectedIndex - 1].Running;
93 | stopButton.Enabled = pages[botTabs.SelectedIndex - 1].Running;
94 | };
95 |
96 | stopButton.Click += (s, e) =>
97 | {
98 | pages[botTabs.SelectedIndex - 1].Running = false;
99 | startButton.Enabled = !pages[botTabs.SelectedIndex - 1].Running;
100 | stopButton.Enabled = pages[botTabs.SelectedIndex - 1].Running;
101 | };
102 |
103 | closeButton.Click += (s, e) =>
104 | {
105 | pages[botTabs.SelectedIndex - 1].Stop();
106 | pages.RemoveAt(botTabs.SelectedIndex - 1);
107 | botTabs.Controls.RemoveAt(botTabs.SelectedIndex);
108 | AccountsCount--;
109 | };
110 |
111 | settingsButton.Click += (s, e) =>
112 | {
113 | SettingsForm settingsForm = new SettingsForm(pages[botTabs.SelectedIndex - 1]);
114 | settingsForm.Show();
115 | };
116 | }
117 | }
118 | }
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | artifacts/
46 |
47 | *_i.c
48 | *_p.c
49 | *_i.h
50 | *.ilk
51 | *.meta
52 | *.obj
53 | *.pch
54 | *.pdb
55 | *.pgc
56 | *.pgd
57 | *.rsp
58 | *.sbr
59 | *.tlb
60 | *.tli
61 | *.tlh
62 | *.tmp
63 | *.tmp_proj
64 | *.log
65 | *.vspscc
66 | *.vssscc
67 | .builds
68 | *.pidb
69 | *.svclog
70 | *.scc
71 |
72 | # Chutzpah Test files
73 | _Chutzpah*
74 |
75 | # Visual C++ cache files
76 | ipch/
77 | *.aps
78 | *.ncb
79 | *.opensdf
80 | *.sdf
81 | *.cachefile
82 |
83 | # Visual Studio profiler
84 | *.psess
85 | *.vsp
86 | *.vspx
87 | *.sap
88 |
89 | # TFS 2012 Local Workspace
90 | $tf/
91 |
92 | # Guidance Automation Toolkit
93 | *.gpState
94 |
95 | # ReSharper is a .NET coding add-in
96 | _ReSharper*/
97 | *.[Rr]e[Ss]harper
98 | *.DotSettings.user
99 |
100 | # JustCode is a .NET coding add-in
101 | .JustCode
102 |
103 | # TeamCity is a build add-in
104 | _TeamCity*
105 |
106 | # DotCover is a Code Coverage Tool
107 | *.dotCover
108 |
109 | # NCrunch
110 | _NCrunch_*
111 | .*crunch*.local.xml
112 | nCrunchTemp_*
113 |
114 | # MightyMoose
115 | *.mm.*
116 | AutoTest.Net/
117 |
118 | # Web workbench (sass)
119 | .sass-cache/
120 |
121 | # Installshield output folder
122 | [Ee]xpress/
123 |
124 | # DocProject is a documentation generator add-in
125 | DocProject/buildhelp/
126 | DocProject/Help/*.HxT
127 | DocProject/Help/*.HxC
128 | DocProject/Help/*.hhc
129 | DocProject/Help/*.hhk
130 | DocProject/Help/*.hhp
131 | DocProject/Help/Html2
132 | DocProject/Help/html
133 |
134 | # Click-Once directory
135 | publish/
136 |
137 | # Publish Web Output
138 | *.[Pp]ublish.xml
139 | *.azurePubxml
140 | # TODO: Comment the next line if you want to checkin your web deploy settings
141 | # but database connection strings (with potential passwords) will be unencrypted
142 | *.pubxml
143 | *.publishproj
144 |
145 | # NuGet Packages
146 | *.nupkg
147 | # The packages folder can be ignored because of Package Restore
148 | **/packages/*
149 | # except build/, which is used as an MSBuild target.
150 | !**/packages/build/
151 | # Uncomment if necessary however generally it will be regenerated when needed
152 | #!**/packages/repositories.config
153 |
154 | # Windows Azure Build Output
155 | csx/
156 | *.build.csdef
157 |
158 | # Windows Azure Emulator
159 | efc/
160 | rfc/
161 |
162 | # Windows Store app package directory
163 | AppPackages/
164 |
165 | # Visual Studio cache files
166 | # files ending in .cache can be ignored
167 | *.[Cc]ache
168 | # but keep track of directories ending in .cache
169 | !*.[Cc]ache/
170 |
171 | # Others
172 | ClientBin/
173 | [Ss]tyle[Cc]op.*
174 | ~$*
175 | *~
176 | *.dbmdl
177 | *.dbproj.schemaview
178 | *.pfx
179 | *.publishsettings
180 | node_modules/
181 | orleans.codegen.cs
182 |
183 | # RIA/Silverlight projects
184 | Generated_Code/
185 |
186 | # Backup & report files from converting an old project file
187 | # to a newer Visual Studio version. Backup files are not needed,
188 | # because we have git ;-)
189 | _UpgradeReport_Files/
190 | Backup*/
191 | UpgradeLog*.XML
192 | UpgradeLog*.htm
193 |
194 | # SQL Server files
195 | *.mdf
196 | *.ldf
197 |
198 | # Business Intelligence projects
199 | *.rdl.data
200 | *.bim.layout
201 | *.bim_*.settings
202 |
203 | # Microsoft Fakes
204 | FakesAssemblies/
205 |
206 | # GhostDoc plugin setting file
207 | *.GhostDoc.xml
208 |
209 | # Node.js Tools for Visual Studio
210 | .ntvs_analysis.dat
211 |
212 | # Visual Studio 6 build log
213 | *.plg
214 |
215 | # Visual Studio 6 workspace options file
216 | *.opt
217 |
218 | # Visual Studio LightSwitch build output
219 | **/*.HTMLClient/GeneratedArtifacts
220 | **/*.DesktopClient/GeneratedArtifacts
221 | **/*.DesktopClient/ModelManifest.xml
222 | **/*.Server/GeneratedArtifacts
223 | **/*.Server/ModelManifest.xml
224 | _Pvt_Extensions
225 |
226 | # Paket dependency manager
227 | .paket/paket.exe
228 |
229 | # FAKE - F# Make
230 | .fake/
231 |
--------------------------------------------------------------------------------
/Core/Fade/FadeProxyClient.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Flash.External;
3 |
4 | namespace PolskaBot.Fade
5 | {
6 | ///
7 | /// FadeProxyClient represents single client that uses encryption.
8 | ///
9 | public class FadeProxyClient
10 | {
11 | #region Properties
12 |
13 | ///
14 | /// Unique identifier of client.
15 | ///
16 | public string ID { get; set; } = Guid.NewGuid().ToString();
17 |
18 | #endregion
19 |
20 | #region Private fields
21 |
22 | private FadeProxy _proxy;
23 |
24 | #endregion
25 |
26 | #region Events
27 |
28 | ///
29 | /// Reports that asynchronous stage one has been loaded.
30 | ///
31 | public event EventHandler StageOneLoaded;
32 |
33 | ///
34 | /// Reports that asynchronous stage one has occurred error when loading.
35 | ///
36 | public event EventHandler StageOneFailed;
37 |
38 | #endregion
39 |
40 | #region Constructor
41 |
42 | ///
43 | /// Creates single client for spicified proxy.
44 | ///
45 | /// FadeProxy to which client belongs.
46 | public FadeProxyClient(FadeProxy proxy)
47 | {
48 | _proxy = proxy;
49 | }
50 |
51 | #endregion
52 |
53 | #region Connection
54 |
55 | public void Disconnect()
56 | {
57 | _proxy.proxy.Call("disconnect", ID);
58 | }
59 |
60 | #endregion
61 |
62 | #region Handling calls
63 |
64 | ///
65 | /// Handles calls made from Fade targeted to this client.
66 | ///
67 | /// Event arguments that contain information about call.
68 | ///
69 | public object HandleCall(ExternalInterfaceCallEventArgs eventArgs)
70 | {
71 | if(eventArgs.FunctionCall.FunctionName.Equals("stageOneInitialized"))
72 | {
73 | if ((bool)eventArgs.FunctionCall.Arguments[1] == true)
74 | StageOneLoaded?.Invoke(this, EventArgs.Empty);
75 | else
76 | StageOneFailed?.Invoke(this, EventArgs.Empty);
77 | }
78 | return null;
79 | }
80 |
81 | #endregion
82 |
83 | #region Initialization
84 |
85 | ///
86 | /// Resets both stage one and stage two.
87 | ///
88 | public void Reset()
89 | {
90 | _proxy.proxy.Call("reset", ID);
91 | }
92 |
93 | ///
94 | /// Initializes stage one with specified code.
95 | ///
96 | /// Code which will be used for initialization.
97 | public void InitStageOne(byte[] code)
98 | {
99 | _proxy.proxy.Call("initStageOne", ID, Convert.ToBase64String(code));
100 | }
101 |
102 | ///
103 | /// Generates public key for encryption.
104 | ///
105 | /// Public key for encryption
106 | public byte[] GenerateKey()
107 | {
108 | return Convert.FromBase64String((string)_proxy.proxy.Call("generateKey", ID));
109 | }
110 |
111 | ///
112 | /// Initializes stage two with specified code.
113 | ///
114 | /// Code which will be used for initialization.
115 | public void InitStageTwo(byte[] code)
116 | {
117 | _proxy.proxy.Call("initStageTwo", ID, Convert.ToBase64String(code));
118 | }
119 |
120 | #endregion
121 |
122 | #region Encryption
123 |
124 | ///
125 | /// Encrypts specified input
126 | ///
127 | /// Input to be encrypted
128 | /// Encrypted input
129 | public byte[] Encrypt(byte[] input)
130 | {
131 | return Convert.FromBase64String((string)_proxy.proxy.Call("encode", ID, Convert.ToBase64String(input)));
132 | }
133 |
134 | ///
135 | /// Decrypts specified input
136 | ///
137 | /// Decrypted input
138 | ///
139 | public byte[] Decrypt(byte[] input)
140 | {
141 | return Convert.FromBase64String((string)_proxy.proxy.Call("decode", ID, Convert.ToBase64String(input)));
142 | }
143 |
144 | #endregion
145 | }
146 | }
147 |
--------------------------------------------------------------------------------
/Core/Darkorbit/Commands/PostHandshake/HeroInit.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using MiscUtil.IO;
7 |
8 | namespace PolskaBot.Core.Darkorbit.Commands.PostHandshake
9 | {
10 | class HeroInit : Command
11 | {
12 | public const ushort ID = 23292;
13 |
14 | public float Jackpot { get; private set; }
15 | public uint MaxShield { get; private set; } //name_103
16 | public bool Premium { get; private set; }
17 | public bool var_4823 { get; private set; }
18 | public double Credits { get; private set; }
19 | public double Honor { get; private set; } //var_4055
20 | public uint ClanID { get; private set; } //name_48
21 | public double Uridium { get; private set; }
22 | public bool var_3678 { get; private set; }
23 | public uint Rank { get; private set; } //name_134
24 | public bool Cloaked { get; private set; }
25 | public string Username { get; private set; } //var_3495
26 | public uint Speed { get; private set; }
27 | public uint CargoCapacity { get; private set; } //var_3020
28 | public uint Shield { get; private set; }
29 | public int X { get; private set; }
30 | public int Y { get; private set; }
31 | public uint UserID { get; private set; } //name_125
32 | public uint var_3377 { get; private set; }
33 | public uint var_3914 { get; private set; } //var_3914
34 | public uint FreeCargoSpace { get; private set; } //var_4296
35 | public string Shipname { get; private set; } //name_122
36 | public uint HP { get; private set; } //var_1065
37 | public uint Level { get; private set; }
38 | public uint NanoHP { get; private set; } //var_2224
39 | public double XP { get; private set; } //var_4549
40 | public uint Map { get; private set; }
41 | public uint FactionID { get; private set; }
42 | public string ClanTag { get; private set; } //name_138
43 | public uint MaxHP { get; private set; } //var_1851
44 | public uint MaxNanoHP { get; private set; } //var_1600
45 |
46 | public HeroInit(EndianBinaryReader reader)
47 | {
48 | var_3377 = reader.ReadUInt32();
49 | var_3377 = var_3377 << 11 | var_3377 >> 21;
50 | X = reader.ReadInt32();
51 | X = (int)((uint)X << 12 | (uint)X >> 20);
52 | Rank = reader.ReadUInt32();
53 | Rank = Rank >> 2 | Rank << 30;
54 | XP = reader.ReadDouble();
55 | Credits = reader.ReadDouble();
56 | int length = reader.ReadInt32();
57 | if (length > 0)
58 | {
59 | for (int i = 0; i < length; i++)
60 | {
61 | reader.ReadInt16();
62 | Class326 class326 = new Class326(reader);
63 | }
64 | }
65 | FreeCargoSpace = reader.ReadUInt32();
66 | FreeCargoSpace = FreeCargoSpace >> 4 | FreeCargoSpace << 28;
67 | CargoCapacity = reader.ReadUInt32();
68 | CargoCapacity = CargoCapacity >> 11 | CargoCapacity << 21;
69 | var_3914 = reader.ReadUInt32();
70 | var_3914 = var_3914 >> 2 | var_3914 << 30;
71 | var_4823 = reader.ReadBoolean();
72 | Honor = reader.ReadDouble();
73 | NanoHP = reader.ReadUInt32();
74 | NanoHP = NanoHP << 16 | NanoHP >> 16;
75 | Uridium = reader.ReadDouble();
76 | Speed = reader.ReadUInt32();
77 | Speed = Speed << 4 | Speed >> 28;
78 | Cloaked = reader.ReadBoolean();
79 | Level = reader.ReadUInt32();
80 | Level = Level << 2 | Level >> 30;
81 | Shield = reader.ReadUInt32();
82 | Shield = Shield >> 16 | Shield << 16;
83 | Shipname = Encoding.Default.GetString(reader.ReadBytes(reader.ReadUInt16()));
84 | FactionID = reader.ReadUInt32();
85 | FactionID = FactionID << 10 | FactionID >> 22;
86 | ClanTag = Encoding.Default.GetString(reader.ReadBytes(reader.ReadUInt16()));
87 | Premium = reader.ReadBoolean();
88 | reader.ReadUInt32();
89 | UserID = reader.ReadUInt32();
90 | UserID = UserID >> 16 | UserID << 16;
91 | var_3678 = reader.ReadBoolean();
92 | Map = reader.ReadUInt32();
93 | Map = Map >> 10 | Map << 22;
94 | Y = reader.ReadInt32();
95 | Y = (int)((uint)Y << 8 | (uint)Y >> 24);
96 | MaxHP = reader.ReadUInt32();
97 | MaxHP = MaxHP >> 8 | MaxHP << 24;
98 | Username = Encoding.Default.GetString(reader.ReadBytes(reader.ReadUInt16()));
99 | MaxShield = reader.ReadUInt32();
100 | MaxShield = MaxShield >> 2 | MaxShield << 30;
101 | ClanID = reader.ReadUInt32();
102 | ClanID = ClanID << 2 | ClanID >> 30;
103 | HP = reader.ReadUInt32();
104 | HP = HP << 16 | HP >> 16;
105 | Jackpot = reader.ReadSingle();
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/Core/Darkorbit/Account.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Text.RegularExpressions;
7 | using System.Net;
8 |
9 | namespace PolskaBot.Core.Darkorbit
10 | {
11 | public class Account
12 | {
13 | public API api;
14 |
15 | // Website credentials
16 | public string Username { get; private set; }
17 | public string Password { get; private set; }
18 |
19 | // Server credentials
20 | public int UserID { get; private set; }
21 | public int InstanceID { get; private set; }
22 | public string SID { get; private set; }
23 | public string Server { get; private set; }
24 | public int Map { get; private set; }
25 |
26 | // Movement
27 | public int X { get; set; }
28 | public int Y { get; set; }
29 | public int TargetX { get; set; }
30 | public int TargetY { get; set; }
31 | public bool Flying { get; set; }
32 |
33 | // Map statistics
34 | public int HP { get; set; }
35 | public int MaxHP { get; set; }
36 | public int Shield { get; set; }
37 | public int MaxShield { get; set; }
38 | public int NanoHP { get; set; }
39 | public int MaxNanoHP { get; set; }
40 | public int FreeCargoSpace { get; set; }
41 | public int CargoCapacity { get; set; }
42 |
43 | // Ship
44 | public string Shipname { get; set; }
45 | public int Speed { get; set; }
46 | public int Config { get; set; }
47 |
48 | // Statistics
49 | public bool Cloaked { get; set; }
50 | public float Jackpot { get; set; }
51 | public bool Premium { get; set; }
52 | public double Credits { get; set; }
53 | public double Honor { get; set; }
54 | public double Uridium { get; set; }
55 | public double XP { get; set; }
56 | public int Level { get; set; }
57 | public int Rank { get; set; }
58 |
59 | // Social
60 | public int ClanID { get; set; }
61 | public string ClanTag { get; set; }
62 | public uint FactionID { get; set; }
63 |
64 | // Collected
65 | public double CollectedUridium { get; set; }
66 | public double CollectedCredits { get; set; }
67 | public double CollectedXP { get; set; }
68 | public double CollectedHonor { get; set; }
69 | public int CollectedEE { get; set; }
70 |
71 | public bool Ready { get; set; } = false;
72 |
73 | public bool JumpAllowed { get; set; }
74 |
75 | HttpManager httpManager;
76 |
77 | public event EventHandler LoginFailed;
78 | public event EventHandler LoginSucceed;
79 |
80 | public Account(API api)
81 | {
82 | this.api = api;
83 | httpManager = new HttpManager();
84 | httpManager.AddHeader("Upgrade-Insecure-Requests", "1");
85 | httpManager.AddHeader("Accept-Encoding", "gzip, deflate");
86 | httpManager.AddHeader("Accept-Language", "en-US;q=0.6,en;q=0.4");
87 | httpManager.userAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.86 Safari/537.36";
88 | }
89 |
90 | public void SetCredentials(string username, string password)
91 | {
92 | Username = username;
93 | Password = password;
94 | }
95 |
96 | public void UpdateHitpoints(int hp, int maxHP, int nanoHP, int maxNanoHP)
97 | {
98 | HP = hp;
99 | MaxHP = maxHP;
100 | NanoHP = nanoHP;
101 | MaxNanoHP = maxNanoHP;
102 | }
103 |
104 | public void UpdateShield(int shield, int maxShield)
105 | {
106 | Shield = shield;
107 | MaxShield = maxShield;
108 | }
109 |
110 | public void UpdateHitpointsAndShield(int hp, int shield, int nanoHP)
111 | {
112 | HP = hp;
113 | Shield = shield;
114 | NanoHP = nanoHP;
115 | }
116 |
117 | public void Login()
118 | {
119 | string homepageResponse = httpManager.Get("http://www.darkorbit.com/");
120 | Match match = Regex.Match(homepageResponse, "class=\"bgcdw_login_form\" action=\"(.*)\">");
121 |
122 | if(!match.Success)
123 | {
124 | LoginFailed?.Invoke(this, EventArgs.Empty);
125 | return;
126 | }
127 |
128 | string loginResponse = httpManager.Post(WebUtility.HtmlDecode(match.Groups[1].ToString()), $"username={Username}&password={Password}");
129 | match = Regex.Match(loginResponse, "http://(.*).darkorbit.bigpoint.com");
130 |
131 | if (!match.Success)
132 | match = Regex.Match(loginResponse, "http://(.*).darkorbit.com");
133 | if (!match.Success)
134 | {
135 | LoginFailed?.Invoke(this, EventArgs.Empty);
136 | return;
137 | }
138 |
139 | Server = match.Groups[1].ToString();
140 |
141 | string mapResponse = httpManager.Get($"{match.Value}/indexInternal.es?action=internalMapRevolution");
142 | match = Regex.Match(mapResponse, "{\"pid\":([0-9]+),\"uid\":([0-9]+)[\\w,\":]+sid\":\"([0-9a-z]+)\"");
143 |
144 | if (!match.Success)
145 | {
146 | LoginFailed?.Invoke(this, EventArgs.Empty);
147 | return;
148 | }
149 |
150 | InstanceID = int.Parse(match.Groups[1].ToString());
151 | UserID = int.Parse(match.Groups[2].ToString());
152 | SID = match.Groups[3].ToString();
153 | match = Regex.Match(mapResponse, "mapID\": \"([0-9]*)\"");
154 | Map = int.Parse(match.Groups[1].ToString());
155 |
156 | LoginSucceed?.Invoke(this, EventArgs.Empty);
157 | }
158 | }
159 | }
160 |
--------------------------------------------------------------------------------
/Core/API.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Net;
7 | using System.Text.RegularExpressions;
8 | using PolskaBot.Core.Darkorbit;
9 | using PolskaBot.Core.Darkorbit.Commands;
10 | using PolskaBot.Core.Darkorbit.Commands.PostHandshake;
11 | using PolskaBot.Fade;
12 |
13 | namespace PolskaBot.Core
14 | {
15 | public class API
16 | {
17 | public enum Mode
18 | {
19 | BOT
20 | };
21 |
22 | public Mode mode;
23 |
24 | private VanillaClient _vanillaClient;
25 | private FadeProxyClient _proxy;
26 | private RemoteClient _remoteClient;
27 |
28 | private string _ip;
29 | public DateTime LoginTime { get; protected set; } = DateTime.MinValue;
30 |
31 | // Logic
32 | public Account Account { get; set; }
33 | public List Boxes { get; set; } = new List();
34 | public List MemorizedBoxes { get; set; } = new List();
35 | public List Ores { get; set; } = new List();
36 | public List Ships { get; set; } = new List();
37 | public List Gates { get; set; } = new List();
38 | public List Buildings { get; set; } = new List();
39 |
40 | public object boxesLocker = new object();
41 | public object memorizedBoxesLocker = new object();
42 | public object oresLocker = new object();
43 | public object shipsLocker = new object();
44 | public object buildingsLocker = new object();
45 |
46 | public event EventHandler Connecting;
47 | public event EventHandler Disconnected;
48 | public event EventHandler HeroInited;
49 | public event EventHandler Attacked;
50 | public event EventHandler ShipMoving;
51 | public event EventHandler AuthFailed;
52 | public event EventHandler Destroyed;
53 |
54 | public API(string ip, FadeProxyClient proxy, Mode mode = Mode.BOT)
55 | {
56 | _ip = ip;
57 |
58 | this.mode = mode;
59 |
60 | // Depedency injection
61 | Account = new Account(this);
62 | _proxy = proxy;
63 | _remoteClient = new RemoteClient(this);
64 | _vanillaClient = new VanillaClient(this, proxy, _remoteClient);
65 |
66 | Account.LoginSucceed += (s, e) => Connect();
67 |
68 | _vanillaClient.AuthFailed += (s, e) => AuthFailed?.Invoke(s, e);
69 | _vanillaClient.Disconnected += (s, e) => Disconnected?.Invoke(s, e);
70 | _vanillaClient.HeroInited += (s, e) =>
71 | {
72 | HeroInited?.Invoke(s, e);
73 | if (LoginTime == DateTime.MinValue)
74 | LoginTime = DateTime.Now;
75 | };
76 | _vanillaClient.Attacked += (s, e) => Attacked?.Invoke(s, e);
77 | _vanillaClient.ShipMoving += (s, e) => ShipMoving?.Invoke(s, e);
78 | _vanillaClient.Destroyed += (s, e) => Destroyed?.Invoke(s, e);
79 | }
80 |
81 | public void Stop()
82 | {
83 | _vanillaClient.Stop();
84 | _vanillaClient.pingThread?.Abort();
85 | _remoteClient.Stop();
86 | }
87 |
88 | public void Login(string username = null, string password = null)
89 | {
90 | if (username == null || password == null)
91 | {
92 | username = Environment.GetEnvironmentVariable(Config.USERNAME_ENV);
93 | password = Environment.GetEnvironmentVariable(Config.PASSWORD_ENV);
94 | }
95 | Account.SetCredentials(username, password);
96 | Account.Login();
97 | }
98 |
99 | public void Connect()
100 | {
101 | _remoteClient.OnConnected += (s, e) =>
102 | {
103 | Console.WriteLine("Connected to remoteServer");
104 | ((Client)s).thread.Abort();
105 | var serverIP = GetIP();
106 | if (serverIP != null)
107 | _vanillaClient.Connect(serverIP, 8080);
108 | else
109 | Reconnect();
110 | };
111 |
112 | _vanillaClient.OnConnected += (o, e) => _vanillaClient.Send(new ClientVersionCheck(Config.MAJOR, Config.MINOR, Config.BUILD));
113 | _vanillaClient.Disconnected += (o, e) => Reconnect();
114 | _remoteClient.Disconnected += (o, e) => Reconnect();
115 |
116 | Connecting?.Invoke(this, EventArgs.Empty);
117 | _remoteClient.Connect(_ip, 8082);
118 | }
119 |
120 | public void SendEncoded(Command command)
121 | {
122 | _vanillaClient.SendEncoded(command);
123 | }
124 |
125 | public void Reconnect()
126 | {
127 | Console.WriteLine("Connection lost. Reconnecting.");
128 | _vanillaClient.pingThread?.Abort();
129 | Boxes.Clear();
130 | MemorizedBoxes.Clear();
131 | Ores.Clear();
132 | Ships.Clear();
133 | Gates.Clear();
134 | Buildings.Clear();
135 | _proxy.Reset();
136 | if(_remoteClient.tcpClient.Connected)
137 | _remoteClient.Disconnect();
138 | if(_vanillaClient.tcpClient.Connected)
139 | _vanillaClient.Disconnect();
140 | _vanillaClient.thread?.Abort();
141 | _remoteClient.Connect(_ip, 8082);
142 | }
143 |
144 | public string GetIP()
145 | {
146 | using (var webClient = new WebClient())
147 | {
148 | try
149 | {
150 | var response = webClient.DownloadString($"http://{Account.Server}.darkorbit.bigpoint.com/spacemap/xml/maps.php");
151 | var match = Regex.Match(response, $"");
152 | return match.Groups[1].ToString();
153 | }
154 | catch
155 | {
156 | return null;
157 | }
158 | }
159 | }
160 | }
161 | }
--------------------------------------------------------------------------------
/PolskaBot/Properties/Resources.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 |
122 | ..\Resources\Logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
123 |
124 |
--------------------------------------------------------------------------------
/PolskaBot/BotPage.resx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 | text/microsoft-resx
110 |
111 |
112 | 2.0
113 |
114 |
115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
116 |
117 |
118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
119 |
120 |
121 | 17, 134
122 |
123 |
124 | 17, 95
125 |
126 |
127 | 19, 58
128 |
129 |
130 | 19, 20
131 |
132 |
133 | False
134 |
135 |
--------------------------------------------------------------------------------
/Core/Core.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {FF3EAA4C-12BA-4938-B07C-FACE3F14CC43}
8 | Library
9 | Properties
10 | PolskaBot.Core
11 | Core
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | False
36 | .\AxInterop.ShockwaveFlashObjects.dll
37 |
38 |
39 | .\Interop.ShockwaveFlashObjects.dll
40 | True
41 |
42 |
43 | .\MiscUtil.dll
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 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
126 |
--------------------------------------------------------------------------------
/Core/Flash/External/ExternalInterfaceSerializer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Xml;
4 | using System.IO;
5 | using System.Text;
6 |
7 | namespace Flash.External
8 | {
9 | ///
10 | /// Provides methods to convert the XML communication format to .NET classes. Typically
11 | /// this class will not be used directly; it supports the operations of the
12 | /// ExternalInterfaceProxy class.
13 | ///
14 | public class ExternalInterfaceSerializer
15 | {
16 | #region Constructor
17 |
18 | private ExternalInterfaceSerializer()
19 | {
20 | }
21 |
22 | #endregion
23 |
24 | #region Public Methods
25 |
26 | ///
27 | /// Encodes a function call to be sent to Flash.
28 | ///
29 | /// The name of the function to call.
30 | /// Zero or more parameters to pass in to the ActonScript function.
31 | /// The XML string representation of the function call to pass to Flash
32 | public static string EncodeInvoke(string functionName, object[] arguments)
33 | {
34 | StringBuilder sb = new StringBuilder();
35 |
36 | XmlTextWriter writer = new XmlTextWriter(new StringWriter(sb));
37 |
38 | //
39 | writer.WriteStartElement("invoke");
40 | writer.WriteAttributeString("name", functionName);
41 | writer.WriteAttributeString("returntype", "xml");
42 |
43 | if (arguments != null && arguments.Length > 0)
44 | {
45 | //
46 | writer.WriteStartElement("arguments");
47 |
48 | // individual arguments
49 | foreach (object value in arguments)
50 | {
51 | WriteElement(writer, value);
52 | }
53 |
54 | //
55 | writer.WriteEndElement();
56 | }
57 |
58 | //
59 | writer.WriteEndElement();
60 |
61 | writer.Flush();
62 | writer.Close();
63 |
64 | return sb.ToString();
65 | }
66 |
67 | ///
68 | /// Encodes a value to send to Flash as the result of a function call from Flash.
69 | ///
70 | /// The value to encode.
71 | /// The XML string representation of the value.
72 | public static string EncodeResult(object value)
73 | {
74 | StringBuilder sb = new StringBuilder();
75 |
76 | XmlTextWriter writer = new XmlTextWriter(new StringWriter(sb));
77 |
78 | WriteElement(writer, value);
79 |
80 | writer.Flush();
81 | writer.Close();
82 |
83 | return sb.ToString();
84 | }
85 |
86 |
87 | ///
88 | /// Decodes a function call from Flash.
89 | ///
90 | /// The XML string representing the function call.
91 | /// An ExternalInterfaceCall object representing the function call.
92 | public static ExternalInterfaceCall DecodeInvoke(string xml)
93 | {
94 | XmlTextReader reader = new XmlTextReader(xml, XmlNodeType.Document, null);
95 |
96 | reader.Read();
97 |
98 | string functionName = reader.GetAttribute("name");
99 | ExternalInterfaceCall result = new ExternalInterfaceCall(functionName);
100 |
101 | reader.ReadStartElement("invoke");
102 | reader.ReadStartElement("arguments");
103 |
104 | while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "arguments")
105 | {
106 | result.AddArgument(ReadElement(reader));
107 | }
108 |
109 | reader.ReadEndElement();
110 | reader.ReadEndElement();
111 |
112 | return result;
113 | }
114 |
115 |
116 | ///
117 | /// Decodes the result of a function call to Flash
118 | ///
119 | /// The XML string representing the result.
120 | /// A containing the result
121 | public static object DecodeResult(string xml)
122 | {
123 | XmlTextReader reader = new XmlTextReader(xml, XmlNodeType.Document, null);
124 | reader.Read();
125 | return ReadElement(reader);
126 | }
127 |
128 | #endregion
129 |
130 | #region Writers
131 |
132 | private static void WriteElement(XmlTextWriter writer, object value)
133 | {
134 | if (value == null)
135 | {
136 | writer.WriteStartElement("null");
137 | writer.WriteEndElement();
138 | }
139 | else if (value is string)
140 | {
141 | writer.WriteStartElement("string");
142 | writer.WriteString(value.ToString());
143 | writer.WriteEndElement();
144 | }
145 | else if (value is bool)
146 | {
147 | writer.WriteStartElement((bool)value ? "true" : "false");
148 | writer.WriteEndElement();
149 | }
150 | else if (value is Single || value is Double || value is int || value is uint)
151 | {
152 | writer.WriteStartElement("number");
153 | writer.WriteString(value.ToString());
154 | writer.WriteEndElement();
155 | }
156 | else if (value is ArrayList)
157 | {
158 | WriteArray(writer, (ArrayList)value);
159 | }
160 | else if (value is Hashtable)
161 | {
162 | WriteObject(writer, (Hashtable)value);
163 | }
164 | else
165 | {
166 | // null is the default when ActionScript can't serialize an object
167 | writer.WriteStartElement("null");
168 | writer.WriteEndElement();
169 | }
170 | }
171 |
172 |
173 | private static void WriteArray(XmlTextWriter writer, ArrayList array)
174 | {
175 | writer.WriteStartElement("array");
176 |
177 | int len = array.Count;
178 |
179 | for (int i = 0; i < len; i++)
180 | {
181 | writer.WriteStartElement("property");
182 | writer.WriteAttributeString("id", i.ToString());
183 | WriteElement(writer, array[i]);
184 | writer.WriteEndElement();
185 | }
186 |
187 | writer.WriteEndElement();
188 | }
189 |
190 |
191 | private static void WriteObject(XmlTextWriter writer, Hashtable table)
192 | {
193 | writer.WriteStartElement("object");
194 |
195 | foreach (DictionaryEntry entry in table)
196 | {
197 | writer.WriteStartElement("property");
198 | writer.WriteAttributeString("id", entry.Key.ToString());
199 | WriteElement(writer, entry.Value);
200 | writer.WriteEndElement();
201 | }
202 |
203 | writer.WriteEndElement();
204 | }
205 |
206 | #endregion
207 |
208 | #region Readers
209 |
210 | private static object ReadElement(XmlTextReader reader)
211 | {
212 | if (reader.NodeType != XmlNodeType.Element)
213 | {
214 | throw new XmlException();
215 | }
216 |
217 | if (reader.Name == "true")
218 | {
219 | reader.Read();
220 | return true;
221 | }
222 |
223 | if (reader.Name == "false")
224 | {
225 | reader.Read();
226 | return false;
227 | }
228 |
229 | if (reader.Name == "null" || reader.Name == "undefined")
230 | {
231 | reader.Read();
232 | return null;
233 | }
234 |
235 | if (reader.IsStartElement("number"))
236 | {
237 | reader.ReadStartElement("number");
238 | double value = Double.Parse(reader.Value);
239 | reader.Read();
240 | reader.ReadEndElement();
241 | return value;
242 | }
243 |
244 | if (reader.IsStartElement("string"))
245 | {
246 | reader.ReadStartElement("string");
247 | string value = reader.Value;
248 | reader.Read();
249 | reader.ReadEndElement();
250 | return value;
251 | }
252 |
253 | if (reader.IsStartElement("array"))
254 | {
255 | reader.ReadStartElement("array");
256 | ArrayList value = ReadArray(reader);
257 | reader.ReadEndElement();
258 | return value;
259 | }
260 |
261 | if (reader.IsStartElement("object"))
262 | {
263 | reader.ReadStartElement("object");
264 | Hashtable value = ReadObject(reader);
265 | reader.ReadEndElement();
266 | return value;
267 | }
268 | throw new XmlException();
269 | }
270 |
271 |
272 | private static ArrayList ReadArray(XmlTextReader reader)
273 | {
274 | ArrayList result = new ArrayList();
275 |
276 | while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "array")
277 | {
278 | int id = int.Parse(reader.GetAttribute("id"));
279 | reader.ReadStartElement("property");
280 | result.Add(ReadElement(reader));
281 | reader.ReadEndElement();
282 | }
283 |
284 | return result;
285 | }
286 |
287 |
288 | private static Hashtable ReadObject(XmlTextReader reader)
289 | {
290 | Hashtable result = new Hashtable();
291 |
292 | while (reader.NodeType != XmlNodeType.EndElement && reader.Name != "object")
293 | {
294 | string id = reader.GetAttribute("id");
295 | reader.ReadStartElement("property");
296 | result.Add(id, ReadElement(reader));
297 | reader.ReadEndElement();
298 | }
299 |
300 | return result;
301 | }
302 |
303 | #endregion
304 | }
305 | }
--------------------------------------------------------------------------------
/PolskaBot/PolskaBot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {036392A5-AA92-4878-BEF1-3D0C17BB8747}
8 | WinExe
9 | Properties
10 | PolskaBot
11 | PolskaBot
12 | v4.5.2
13 | 512
14 | true
15 | true
16 | ftp://185.38.249.172/domains/muzari.com/public_html/pb/downloads/
17 | true
18 | Web
19 | true
20 | Foreground
21 | 7
22 | Days
23 | false
24 | false
25 | true
26 | https://www.muzari.com/pb/downloads/
27 | https://www.muzari.com
28 | https://www.muzari.com
29 | PolskaBot
30 | Muzari
31 | true
32 | publish.htm
33 | 1
34 | 1.0.1.%2a
35 | false
36 | true
37 | true
38 |
39 |
40 | x86
41 | true
42 | full
43 | false
44 | bin\Debug\
45 | DEBUG;TRACE
46 | prompt
47 | 4
48 |
49 |
50 | AnyCPU
51 | pdbonly
52 | true
53 | bin\Release\
54 | TRACE
55 | prompt
56 | 4
57 |
58 |
59 |
60 |
61 |
62 | Logo.ico
63 |
64 |
65 | true
66 |
67 |
68 | DF8ADC21E1029992C31C40F925708CF547BBA1D2
69 |
70 |
71 | muzari.pfx
72 |
73 |
74 | true
75 |
76 |
77 |
78 | False
79 | ..\Core\MiscUtil.dll
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 | Form
96 |
97 |
98 | Bot.cs
99 |
100 |
101 | Component
102 |
103 |
104 |
105 | Component
106 |
107 |
108 |
109 |
110 |
111 | Form
112 |
113 |
114 | SettingsForm.cs
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 | Bot.cs
123 |
124 |
125 | BotPage.cs
126 |
127 |
128 | ResXFileCodeGenerator
129 | Resources.Designer.cs
130 | Designer
131 |
132 |
133 | True
134 | Resources.resx
135 | True
136 |
137 |
138 | SettingsForm.cs
139 |
140 |
141 |
142 | SettingsSingleFileGenerator
143 | Settings.Designer.cs
144 |
145 |
146 | True
147 | Settings.settings
148 | True
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 | {ff3eaa4c-12ba-4938-b07c-face3f14cc43}
157 | Core
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 | False
168 | Microsoft .NET Framework 4.5.2 %28x86 and x64%29
169 | true
170 |
171 |
172 | False
173 | .NET Framework 3.5 SP1
174 | false
175 |
176 |
177 |
178 |
179 | {D27CDB6B-AE6D-11CF-96B8-444553540000}
180 | 1
181 | 0
182 | 0
183 | aximp
184 | False
185 |
186 |
187 | {D27CDB6B-AE6D-11CF-96B8-444553540000}
188 | 1
189 | 0
190 | 0
191 | tlbimp
192 | False
193 | True
194 |
195 |
196 |
197 |
204 |
--------------------------------------------------------------------------------
/PolskaBot/Bot.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PolskaBot
2 | {
3 | partial class Bot
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Bot));
32 | this.startButton = new System.Windows.Forms.Button();
33 | this.stopButton = new System.Windows.Forms.Button();
34 | this.botTabs = new System.Windows.Forms.TabControl();
35 | this.loginPage = new System.Windows.Forms.TabPage();
36 | this.loginButton = new System.Windows.Forms.Button();
37 | this.passwordBox = new System.Windows.Forms.TextBox();
38 | this.label2 = new System.Windows.Forms.Label();
39 | this.usernameBox = new System.Windows.Forms.TextBox();
40 | this.label1 = new System.Windows.Forms.Label();
41 | this.flashEmbed = new AxShockwaveFlashObjects.AxShockwaveFlash();
42 | this.settingsButton = new System.Windows.Forms.Button();
43 | this.closeButton = new System.Windows.Forms.Button();
44 | this.botTabs.SuspendLayout();
45 | this.loginPage.SuspendLayout();
46 | ((System.ComponentModel.ISupportInitialize)(this.flashEmbed)).BeginInit();
47 | this.SuspendLayout();
48 | //
49 | // startButton
50 | //
51 | this.startButton.Enabled = false;
52 | this.startButton.Location = new System.Drawing.Point(12, 12);
53 | this.startButton.Name = "startButton";
54 | this.startButton.Size = new System.Drawing.Size(85, 23);
55 | this.startButton.TabIndex = 1;
56 | this.startButton.Text = "Start";
57 | this.startButton.UseVisualStyleBackColor = true;
58 | //
59 | // stopButton
60 | //
61 | this.stopButton.Enabled = false;
62 | this.stopButton.Location = new System.Drawing.Point(103, 12);
63 | this.stopButton.Name = "stopButton";
64 | this.stopButton.Size = new System.Drawing.Size(85, 23);
65 | this.stopButton.TabIndex = 2;
66 | this.stopButton.Text = "Stop";
67 | this.stopButton.UseVisualStyleBackColor = true;
68 | //
69 | // botTabs
70 | //
71 | this.botTabs.Controls.Add(this.loginPage);
72 | this.botTabs.Location = new System.Drawing.Point(12, 41);
73 | this.botTabs.Name = "botTabs";
74 | this.botTabs.SelectedIndex = 0;
75 | this.botTabs.Size = new System.Drawing.Size(359, 359);
76 | this.botTabs.TabIndex = 10;
77 | //
78 | // loginPage
79 | //
80 | this.loginPage.Controls.Add(this.loginButton);
81 | this.loginPage.Controls.Add(this.passwordBox);
82 | this.loginPage.Controls.Add(this.label2);
83 | this.loginPage.Controls.Add(this.usernameBox);
84 | this.loginPage.Controls.Add(this.label1);
85 | this.loginPage.Location = new System.Drawing.Point(4, 22);
86 | this.loginPage.Name = "loginPage";
87 | this.loginPage.Size = new System.Drawing.Size(351, 333);
88 | this.loginPage.TabIndex = 1;
89 | this.loginPage.Text = "Login";
90 | this.loginPage.UseVisualStyleBackColor = true;
91 | //
92 | // loginButton
93 | //
94 | this.loginButton.Enabled = false;
95 | this.loginButton.Location = new System.Drawing.Point(3, 218);
96 | this.loginButton.Name = "loginButton";
97 | this.loginButton.Size = new System.Drawing.Size(343, 23);
98 | this.loginButton.TabIndex = 4;
99 | this.loginButton.Text = "Login";
100 | this.loginButton.UseVisualStyleBackColor = true;
101 | //
102 | // passwordBox
103 | //
104 | this.passwordBox.Location = new System.Drawing.Point(2, 168);
105 | this.passwordBox.Name = "passwordBox";
106 | this.passwordBox.Size = new System.Drawing.Size(344, 20);
107 | this.passwordBox.TabIndex = 3;
108 | this.passwordBox.UseSystemPasswordChar = true;
109 | //
110 | // label2
111 | //
112 | this.label2.AutoSize = true;
113 | this.label2.Location = new System.Drawing.Point(2, 151);
114 | this.label2.Name = "label2";
115 | this.label2.Size = new System.Drawing.Size(53, 13);
116 | this.label2.TabIndex = 2;
117 | this.label2.Text = "Password";
118 | //
119 | // usernameBox
120 | //
121 | this.usernameBox.Location = new System.Drawing.Point(3, 112);
122 | this.usernameBox.Name = "usernameBox";
123 | this.usernameBox.Size = new System.Drawing.Size(344, 20);
124 | this.usernameBox.TabIndex = 1;
125 | //
126 | // label1
127 | //
128 | this.label1.AutoSize = true;
129 | this.label1.Location = new System.Drawing.Point(3, 95);
130 | this.label1.Name = "label1";
131 | this.label1.Size = new System.Drawing.Size(55, 13);
132 | this.label1.TabIndex = 0;
133 | this.label1.Text = "Username";
134 | //
135 | // flashEmbed
136 | //
137 | this.flashEmbed.Enabled = true;
138 | this.flashEmbed.Location = new System.Drawing.Point(377, 12);
139 | this.flashEmbed.Name = "flashEmbed";
140 | this.flashEmbed.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("flashEmbed.OcxState")));
141 | this.flashEmbed.Size = new System.Drawing.Size(566, 387);
142 | this.flashEmbed.TabIndex = 5;
143 | //
144 | // settingsButton
145 | //
146 | this.settingsButton.Enabled = false;
147 | this.settingsButton.Location = new System.Drawing.Point(286, 12);
148 | this.settingsButton.Name = "settingsButton";
149 | this.settingsButton.Size = new System.Drawing.Size(85, 23);
150 | this.settingsButton.TabIndex = 11;
151 | this.settingsButton.Text = "Settings";
152 | this.settingsButton.UseVisualStyleBackColor = true;
153 | //
154 | // closeButton
155 | //
156 | this.closeButton.Enabled = false;
157 | this.closeButton.Location = new System.Drawing.Point(194, 12);
158 | this.closeButton.Name = "closeButton";
159 | this.closeButton.Size = new System.Drawing.Size(85, 23);
160 | this.closeButton.TabIndex = 12;
161 | this.closeButton.Text = "Close";
162 | this.closeButton.UseVisualStyleBackColor = true;
163 | //
164 | // Bot
165 | //
166 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
167 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
168 | this.ClientSize = new System.Drawing.Size(378, 411);
169 | this.Controls.Add(this.flashEmbed);
170 | this.Controls.Add(this.settingsButton);
171 | this.Controls.Add(this.closeButton);
172 | this.Controls.Add(this.botTabs);
173 | this.Controls.Add(this.startButton);
174 | this.Controls.Add(this.stopButton);
175 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
176 | this.Name = "Bot";
177 | this.Text = "PolskaBot";
178 | this.botTabs.ResumeLayout(false);
179 | this.loginPage.ResumeLayout(false);
180 | this.loginPage.PerformLayout();
181 | ((System.ComponentModel.ISupportInitialize)(this.flashEmbed)).EndInit();
182 | this.ResumeLayout(false);
183 |
184 | }
185 |
186 | #endregion
187 | private System.Windows.Forms.Button startButton;
188 | private System.Windows.Forms.Button stopButton;
189 | private System.Windows.Forms.TabControl botTabs;
190 | private System.Windows.Forms.TabPage loginPage;
191 | private System.Windows.Forms.TextBox usernameBox;
192 | private System.Windows.Forms.Label label1;
193 | private System.Windows.Forms.TextBox passwordBox;
194 | private System.Windows.Forms.Label label2;
195 | private System.Windows.Forms.Button loginButton;
196 | private System.Windows.Forms.Button settingsButton;
197 | private System.Windows.Forms.Button closeButton;
198 | private AxShockwaveFlashObjects.AxShockwaveFlash flashEmbed;
199 | }
200 | }
201 |
202 |
--------------------------------------------------------------------------------
/PolskaBot/SettingsForm.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace PolskaBot
2 | {
3 | partial class SettingsForm
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SettingsForm));
32 | this.groupBox1 = new System.Windows.Forms.GroupBox();
33 | this.enableCollectorBox = new System.Windows.Forms.CheckBox();
34 | this.ebBox = new System.Windows.Forms.CheckBox();
35 | this.bbBox = new System.Windows.Forms.CheckBox();
36 | this.saveButton = new System.Windows.Forms.Button();
37 | this.groupBox2 = new System.Windows.Forms.GroupBox();
38 | this.hpSlider = new System.Windows.Forms.TrackBar();
39 | this.repairLabel = new System.Windows.Forms.Label();
40 | this.label1 = new System.Windows.Forms.Label();
41 | this.repairBase = new System.Windows.Forms.RadioButton();
42 | this.repairPortal = new System.Windows.Forms.RadioButton();
43 | this.repairBattle = new System.Windows.Forms.RadioButton();
44 | this.groupBox1.SuspendLayout();
45 | this.groupBox2.SuspendLayout();
46 | ((System.ComponentModel.ISupportInitialize)(this.hpSlider)).BeginInit();
47 | this.SuspendLayout();
48 | //
49 | // groupBox1
50 | //
51 | this.groupBox1.Controls.Add(this.enableCollectorBox);
52 | this.groupBox1.Controls.Add(this.ebBox);
53 | this.groupBox1.Controls.Add(this.bbBox);
54 | this.groupBox1.Location = new System.Drawing.Point(13, 13);
55 | this.groupBox1.Name = "groupBox1";
56 | this.groupBox1.Size = new System.Drawing.Size(200, 252);
57 | this.groupBox1.TabIndex = 0;
58 | this.groupBox1.TabStop = false;
59 | this.groupBox1.Text = "Collector";
60 | //
61 | // enableCollectorBox
62 | //
63 | this.enableCollectorBox.AutoSize = true;
64 | this.enableCollectorBox.Location = new System.Drawing.Point(6, 19);
65 | this.enableCollectorBox.Name = "enableCollectorBox";
66 | this.enableCollectorBox.Size = new System.Drawing.Size(102, 17);
67 | this.enableCollectorBox.TabIndex = 2;
68 | this.enableCollectorBox.Text = "Enable collector";
69 | this.enableCollectorBox.UseVisualStyleBackColor = true;
70 | //
71 | // ebBox
72 | //
73 | this.ebBox.AutoSize = true;
74 | this.ebBox.Location = new System.Drawing.Point(6, 65);
75 | this.ebBox.Name = "ebBox";
76 | this.ebBox.Size = new System.Drawing.Size(119, 17);
77 | this.ebBox.TabIndex = 1;
78 | this.ebBox.Text = "Collect event boxes";
79 | this.ebBox.UseVisualStyleBackColor = true;
80 | //
81 | // bbBox
82 | //
83 | this.bbBox.AutoSize = true;
84 | this.bbBox.Location = new System.Drawing.Point(6, 42);
85 | this.bbBox.Name = "bbBox";
86 | this.bbBox.Size = new System.Drawing.Size(121, 17);
87 | this.bbBox.TabIndex = 0;
88 | this.bbBox.Text = "Collect bonus boxes";
89 | this.bbBox.UseVisualStyleBackColor = true;
90 | //
91 | // saveButton
92 | //
93 | this.saveButton.Location = new System.Drawing.Point(13, 271);
94 | this.saveButton.Name = "saveButton";
95 | this.saveButton.Size = new System.Drawing.Size(494, 23);
96 | this.saveButton.TabIndex = 1;
97 | this.saveButton.Text = "Save";
98 | this.saveButton.UseVisualStyleBackColor = true;
99 | //
100 | // groupBox2
101 | //
102 | this.groupBox2.Controls.Add(this.repairBattle);
103 | this.groupBox2.Controls.Add(this.repairPortal);
104 | this.groupBox2.Controls.Add(this.repairBase);
105 | this.groupBox2.Controls.Add(this.label1);
106 | this.groupBox2.Controls.Add(this.hpSlider);
107 | this.groupBox2.Controls.Add(this.repairLabel);
108 | this.groupBox2.Location = new System.Drawing.Point(220, 13);
109 | this.groupBox2.Name = "groupBox2";
110 | this.groupBox2.Size = new System.Drawing.Size(287, 252);
111 | this.groupBox2.TabIndex = 2;
112 | this.groupBox2.TabStop = false;
113 | this.groupBox2.Text = "General";
114 | //
115 | // hpSlider
116 | //
117 | this.hpSlider.LargeChange = 10;
118 | this.hpSlider.Location = new System.Drawing.Point(10, 42);
119 | this.hpSlider.Maximum = 100;
120 | this.hpSlider.Name = "hpSlider";
121 | this.hpSlider.Size = new System.Drawing.Size(271, 45);
122 | this.hpSlider.TabIndex = 1;
123 | this.hpSlider.TickStyle = System.Windows.Forms.TickStyle.None;
124 | this.hpSlider.Value = 60;
125 | //
126 | // repairLabel
127 | //
128 | this.repairLabel.AutoSize = true;
129 | this.repairLabel.Location = new System.Drawing.Point(7, 20);
130 | this.repairLabel.Name = "repairLabel";
131 | this.repairLabel.Size = new System.Drawing.Size(130, 13);
132 | this.repairLabel.TabIndex = 0;
133 | this.repairLabel.Text = "Repair when HP less than";
134 | //
135 | // label1
136 | //
137 | this.label1.AutoSize = true;
138 | this.label1.Location = new System.Drawing.Point(10, 65);
139 | this.label1.Name = "label1";
140 | this.label1.Size = new System.Drawing.Size(50, 13);
141 | this.label1.TabIndex = 2;
142 | this.label1.Text = "Repair at";
143 | //
144 | // repairBase
145 | //
146 | this.repairBase.AutoSize = true;
147 | this.repairBase.Location = new System.Drawing.Point(10, 82);
148 | this.repairBase.Name = "repairBase";
149 | this.repairBase.Size = new System.Drawing.Size(95, 17);
150 | this.repairBase.TabIndex = 3;
151 | this.repairBase.TabStop = true;
152 | this.repairBase.Text = "Company base";
153 | this.repairBase.UseVisualStyleBackColor = true;
154 | //
155 | // repairPortal
156 | //
157 | this.repairPortal.AutoSize = true;
158 | this.repairPortal.Location = new System.Drawing.Point(10, 105);
159 | this.repairPortal.Name = "repairPortal";
160 | this.repairPortal.Size = new System.Drawing.Size(52, 17);
161 | this.repairPortal.TabIndex = 4;
162 | this.repairPortal.TabStop = true;
163 | this.repairPortal.Text = "Portal";
164 | this.repairPortal.UseVisualStyleBackColor = true;
165 | //
166 | // repairBattle
167 | //
168 | this.repairBattle.AutoSize = true;
169 | this.repairBattle.Location = new System.Drawing.Point(10, 128);
170 | this.repairBattle.Name = "repairBattle";
171 | this.repairBattle.Size = new System.Drawing.Size(63, 17);
172 | this.repairBattle.TabIndex = 5;
173 | this.repairBattle.TabStop = true;
174 | this.repairBattle.Text = "In battle";
175 | this.repairBattle.UseVisualStyleBackColor = true;
176 | //
177 | // SettingsForm
178 | //
179 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
180 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
181 | this.ClientSize = new System.Drawing.Size(519, 301);
182 | this.Controls.Add(this.groupBox2);
183 | this.Controls.Add(this.saveButton);
184 | this.Controls.Add(this.groupBox1);
185 | this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
186 | this.Name = "SettingsForm";
187 | this.Text = "Settings";
188 | this.groupBox1.ResumeLayout(false);
189 | this.groupBox1.PerformLayout();
190 | this.groupBox2.ResumeLayout(false);
191 | this.groupBox2.PerformLayout();
192 | ((System.ComponentModel.ISupportInitialize)(this.hpSlider)).EndInit();
193 | this.ResumeLayout(false);
194 |
195 | }
196 |
197 | #endregion
198 |
199 | private System.Windows.Forms.GroupBox groupBox1;
200 | private System.Windows.Forms.Button saveButton;
201 | private System.Windows.Forms.CheckBox bbBox;
202 | private System.Windows.Forms.CheckBox ebBox;
203 | private System.Windows.Forms.CheckBox enableCollectorBox;
204 | private System.Windows.Forms.GroupBox groupBox2;
205 | private System.Windows.Forms.Label repairLabel;
206 | private System.Windows.Forms.TrackBar hpSlider;
207 | private System.Windows.Forms.RadioButton repairBattle;
208 | private System.Windows.Forms.RadioButton repairPortal;
209 | private System.Windows.Forms.RadioButton repairBase;
210 | private System.Windows.Forms.Label label1;
211 | }
212 | }
--------------------------------------------------------------------------------
/PolskaBot/Tween/Ease.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Glide
4 | {
5 | ///
6 | /// Static class with useful easer functions that can be used by Tweens.
7 | ///
8 | public static class Ease
9 | {
10 | const float PI = 3.14159f;
11 | const float PI2 = PI / 2;
12 | const float B1 = 1 / 2.75f;
13 | const float B2 = 2 / 2.75f;
14 | const float B3 = 1.5f / 2.75f;
15 | const float B4 = 2.5f / 2.75f;
16 | const float B5 = 2.25f / 2.75f;
17 | const float B6 = 2.625f / 2.75f;
18 |
19 | ///
20 | /// Ease a value to its target and then back. Use this to wrap another easing function.
21 | ///
22 | public static Func ToAndFro(Func easer)
23 | {
24 | return t => ToAndFro(easer(t));
25 | }
26 |
27 | ///
28 | /// Ease a value to its target and then back.
29 | ///
30 | public static float ToAndFro(float t)
31 | {
32 | return t < 0.5f ? t * 2 : 1 + ((t - 0.5f) / 0.5f) * -1;
33 | }
34 |
35 | ///
36 | /// Elastic in.
37 | ///
38 | /// Time elapsed.
39 | /// Eased timescale.
40 | public static float ElasticIn(float t)
41 | {
42 | return (float) ( Math.Sin(13 * PI2 * t) * Math.Pow(2, 10 * (t - 1)));
43 | }
44 |
45 | ///
46 | /// Elastic out.
47 | ///
48 | /// Time elapsed.
49 | /// Eased timescale.
50 | public static float ElasticOut(float t)
51 | {
52 | if (t == 1) return 1;
53 | return (float) ( Math.Sin(-13 * PI2 * (t + 1)) * Math.Pow(2, -10 * t) + 1);
54 | }
55 |
56 | ///
57 | /// Elastic in and out.
58 | ///
59 | /// Time elapsed.
60 | /// Eased timescale.
61 | public static float ElasticInOut(float t)
62 | {
63 | if(t < 0.5)
64 | {
65 | return (float) ( 0.5 * Math.Sin(13 * PI2 * (2 * t)) * Math.Pow(2, 10 * ((2 * t) - 1)));
66 | }
67 |
68 | return (float) ( 0.5 * (Math.Sin(-13 * PI2 * ((2 * t - 1) + 1)) * Math.Pow(2, -10 * (2 * t - 1)) + 2));
69 | }
70 |
71 | ///
72 | /// Quadratic in.
73 | ///
74 | /// Time elapsed.
75 | /// Eased timescale.
76 | public static float QuadIn(float t)
77 | {
78 | return (float) ( t * t);
79 | }
80 |
81 | ///
82 | /// Quadratic out.
83 | ///
84 | /// Time elapsed.
85 | /// Eased timescale.
86 | public static float QuadOut(float t)
87 | {
88 | return (float) ( -t * (t - 2));
89 | }
90 |
91 | ///
92 | /// Quadratic in and out.
93 | ///
94 | /// Time elapsed.
95 | /// Eased timescale.
96 | public static float QuadInOut(float t)
97 | {
98 | return (float) ( t <= .5 ? t * t * 2 : 1 - (--t) * t * 2);
99 | }
100 |
101 | ///
102 | /// Cubic in.
103 | ///
104 | /// Time elapsed.
105 | /// Eased timescale.
106 | public static float CubeIn(float t)
107 | {
108 | return (float) ( t * t * t);
109 | }
110 |
111 | ///
112 | /// Cubic out.
113 | ///
114 | /// Time elapsed.
115 | /// Eased timescale.
116 | public static float CubeOut(float t)
117 | {
118 | return (float) ( 1 + (--t) * t * t);
119 | }
120 |
121 | ///
122 | /// Cubic in and out.
123 | ///
124 | /// Time elapsed.
125 | /// Eased timescale.
126 | public static float CubeInOut(float t)
127 | {
128 | return (float) ( t <= .5 ? t * t * t * 4 : 1 + (--t) * t * t * 4);
129 | }
130 |
131 | ///
132 | /// Quart in.
133 | ///
134 | /// Time elapsed.
135 | /// Eased timescale.
136 | public static float QuartIn(float t)
137 | {
138 | return (float) ( t * t * t * t);
139 | }
140 |
141 | ///
142 | /// Quart out.
143 | ///
144 | /// Time elapsed.
145 | /// Eased timescale.
146 | public static float QuartOut(float t)
147 | {
148 | return (float) ( 1 - (t-=1) * t * t * t);
149 | }
150 |
151 | ///
152 | /// Quart in and out.
153 | ///
154 | /// Time elapsed.
155 | /// Eased timescale.
156 | public static float QuartInOut(float t)
157 | {
158 | return (float) ( t <= .5 ? t * t * t * t * 8 : (1 - (t = t * 2 - 2) * t * t * t) / 2 + .5);
159 | }
160 |
161 | ///
162 | /// Quint in.
163 | ///
164 | /// Time elapsed.
165 | /// Eased timescale.
166 | public static float QuintIn(float t)
167 | {
168 | return (float) ( t * t * t * t * t);
169 | }
170 |
171 | ///
172 | /// Quint out.
173 | ///
174 | /// Time elapsed.
175 | /// Eased timescale.
176 | public static float QuintOut(float t)
177 | {
178 | return (float) ( (t = t - 1) * t * t * t * t + 1);
179 | }
180 |
181 | ///
182 | /// Quint in and out.
183 | ///
184 | /// Time elapsed.
185 | /// Eased timescale.
186 | public static float QuintInOut(float t)
187 | {
188 | return (float) ( ((t *= 2) < 1) ? (t * t * t * t * t) / 2 : ((t -= 2) * t * t * t * t + 2) / 2);
189 | }
190 |
191 | ///
192 | /// Sine in.
193 | ///
194 | /// Time elapsed.
195 | /// Eased timescale.
196 | public static float SineIn(float t)
197 | {
198 | if (t == 1) return 1;
199 | return (float) ( -Math.Cos(PI2 * t) + 1);
200 | }
201 |
202 | ///
203 | /// Sine out.
204 | ///
205 | /// Time elapsed.
206 | /// Eased timescale.
207 | public static float SineOut(float t)
208 | {
209 | return (float) ( Math.Sin(PI2 * t));
210 | }
211 |
212 | ///
213 | /// Sine in and out
214 | ///
215 | /// Time elapsed.
216 | /// Eased timescale.
217 | public static float SineInOut(float t)
218 | {
219 | return (float) ( -Math.Cos(PI * t) / 2 + .5);
220 | }
221 |
222 | ///
223 | /// Bounce in.
224 | ///
225 | /// Time elapsed.
226 | /// Eased timescale.
227 | public static float BounceIn(float t)
228 | {
229 | t = 1 - t;
230 | if (t < B1) return (float) ( 1 - 7.5625 * t * t);
231 | if (t < B2) return (float) ( 1 - (7.5625 * (t - B3) * (t - B3) + .75));
232 | if (t < B4) return (float) ( 1 - (7.5625 * (t - B5) * (t - B5) + .9375));
233 | return (float) ( 1 - (7.5625 * (t - B6) * (t - B6) + .984375));
234 | }
235 |
236 | ///
237 | /// Bounce out.
238 | ///
239 | /// Time elapsed.
240 | /// Eased timescale.
241 | public static float BounceOut(float t)
242 | {
243 | if (t < B1) return (float) ( 7.5625 * t * t);
244 | if (t < B2) return (float) ( 7.5625 * (t - B3) * (t - B3) + .75);
245 | if (t < B4) return (float) ( 7.5625 * (t - B5) * (t - B5) + .9375);
246 | return (float) ( 7.5625 * (t - B6) * (t - B6) + .984375);
247 | }
248 |
249 | ///
250 | /// Bounce in and out.
251 | ///
252 | /// Time elapsed.
253 | /// Eased timescale.
254 | public static float BounceInOut(float t)
255 | {
256 | if (t < .5)
257 | {
258 | t = 1 - t * 2;
259 | if (t < B1) return (float) ( (1 - 7.5625 * t * t) / 2);
260 | if (t < B2) return (float) ( (1 - (7.5625 * (t - B3) * (t - B3) + .75)) / 2);
261 | if (t < B4) return (float) ( (1 - (7.5625 * (t - B5) * (t - B5) + .9375)) / 2);
262 | return (float) ( (1 - (7.5625 * (t - B6) * (t - B6) + .984375)) / 2);
263 | }
264 | t = t * 2 - 1;
265 | if (t < B1) return (float) ( (7.5625 * t * t) / 2 + .5);
266 | if (t < B2) return (float) ( (7.5625 * (t - B3) * (t - B3) + .75) / 2 + .5);
267 | if (t < B4) return (float) ( (7.5625 * (t - B5) * (t - B5) + .9375) / 2 + .5);
268 | return (float) ( (7.5625 * (t - B6) * (t - B6) + .984375) / 2 + .5);
269 | }
270 |
271 | ///
272 | /// Circle in.
273 | ///
274 | /// Time elapsed.
275 | /// Eased timescale.
276 | public static float CircIn(float t)
277 | {
278 | return (float) ( -(Math.Sqrt(1 - t * t) - 1));
279 | }
280 |
281 | ///
282 | /// Circle out
283 | ///
284 | /// Time elapsed.
285 | /// Eased timescale.
286 | public static float CircOut(float t)
287 | {
288 | return (float) ( Math.Sqrt(1 - (t - 1) * (t - 1)));
289 | }
290 |
291 | ///
292 | /// Circle in and out.
293 | ///
294 | /// Time elapsed.
295 | /// Eased timescale.
296 | public static float CircInOut(float t)
297 | {
298 | return (float) ( t <= .5 ? (Math.Sqrt(1 - t * t * 4) - 1) / -2 : (Math.Sqrt(1 - (t * 2 - 2) * (t * 2 - 2)) + 1) / 2);
299 | }
300 |
301 | ///
302 | /// Exponential in.
303 | ///
304 | /// Time elapsed.
305 | /// Eased timescale.
306 | public static float ExpoIn(float t)
307 | {
308 | return (float) ( Math.Pow(2, 10 * (t - 1)));
309 | }
310 |
311 | ///
312 | /// Exponential out.
313 | ///
314 | /// Time elapsed.
315 | /// Eased timescale.
316 | public static float ExpoOut(float t)
317 | {
318 | if (t == 1) return 1;
319 | return (float) ( -Math.Pow(2, -10 * t) + 1);
320 | }
321 |
322 | ///
323 | /// Exponential in and out.
324 | ///
325 | /// Time elapsed.
326 | /// Eased timescale.
327 | public static float ExpoInOut(float t)
328 | {
329 | if (t == 1) return 1;
330 | return (float) ( t < .5 ? Math.Pow(2, 10 * (t * 2 - 1)) / 2 : (-Math.Pow(2, -10 * (t * 2 - 1)) + 2) / 2);
331 | }
332 |
333 | ///
334 | /// Back in.
335 | ///
336 | /// Time elapsed.
337 | /// Eased timescale.
338 | public static float BackIn(float t)
339 | {
340 | return (float) ( t * t * (2.70158 * t - 1.70158));
341 | }
342 |
343 | ///
344 | /// Back out.
345 | ///
346 | /// Time elapsed.
347 | /// Eased timescale.
348 | public static float BackOut(float t)
349 | {
350 | return (float) ( 1 - (--t) * (t) * (-2.70158 * t - 1.70158));
351 | }
352 |
353 | ///
354 | /// Back in and out.
355 | ///
356 | /// Time elapsed.
357 | /// Eased timescale.
358 | public static float BackInOut(float t)
359 | {
360 | t *= 2;
361 | if (t < 1) return (float) ( t * t * (2.70158 * t - 1.70158) / 2);
362 | t --;
363 | return (float) ( (1 - (--t) * (t) * (-2.70158 * t - 1.70158)) / 2 + .5);
364 | }
365 | }
366 | }
367 |
--------------------------------------------------------------------------------
/PolskaBot/Tween/Tween.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Reflection;
4 | using Glide;
5 |
6 | namespace Glide
7 | {
8 | public partial class Tween
9 | {
10 | [Flags]
11 | public enum RotationUnit
12 | {
13 | Degrees,
14 | Radians
15 | }
16 |
17 | #region Callbacks
18 | private Func ease;
19 | private Action begin, update, complete;
20 | #endregion
21 |
22 | #region Timing
23 | public bool Paused { get; private set; }
24 | private float Delay, repeatDelay;
25 | private float Duration;
26 |
27 | private float time;
28 | #endregion
29 |
30 | private bool firstUpdate;
31 | private int repeatCount, timesRepeated;
32 | private Lerper.Behavior behavior;
33 |
34 | private List vars;
35 | private List lerpers;
36 | private List