Jump to content
ziellos2k

BattleNET - C# library and client for the BattlEye protocol

Recommended Posts

BattleNET is a C# (.NET) library and client for the BattlEye protocol written by me and Vipeax.

Webpage

http://ziellos2k.net/battlenet/

GitHub project page

https://github.com/z...os2k/BattleNET/

Licence

LGPL

Changelog

v1.3

* Client now has DNS support

* BattlEyeLoginCredentials.Host changed from string to IPAddress

* Increased timeout check sleep a bit (1 second)

* Increased time before a packet gets resend (2 seconds)

* Proper UTF8 support

* The usual bugfixes and cleanups

v1.2.1

* Increased max socket receive buffer (fixes long ban lists)

v1.2

* Removed system messages (Connected, Disconnected, etc) from library

* Changed ReconnectOnPacketLoss and IsConnected to properties

* New connect event (success, invalid login, host unreachable)

* SendCommandPacket() now returns an identifier which can be used in message filtering

* Renamed SendCommandPacket() to SendCommand(), kinda...

* Bugfixes and cleanups

v1.1

* Different method to construct packets

* Some fixes and cleanups

* Did licensing the right way

v1.0.2

* Fixed predefined commands, they now work actually. :)

v1.0.1

* Fixed a bug where the lib would send the 'say' command twice

v1.0

* Started using proper version numbers... :)

20121217.1

* Library didn't reconnect on connection loss

20121217

* Updated predifined commands

* Timeout values decreased for faster connection drop detection

* UTF8 support

* Better handling of dropped packets (client -> server)

* Packet receiving is now asynchronous

* Some other fixes and cleanups

* Client now accepts command line arguments

20120821

* Hackish fix for not handling very long ban files

20120717

* Decreased keep alive packet interval and timeout timer

* Changed Encoding.Default to Encoding.GetEncoding(1252) as Default is variable across systems (also makes it compatible with Linux/mono)

20120706

* Fixed autoreconnect not working

20120704

* License added

20120628

* Complete BattlEye protocol implementation

Edited by ziellos2k
  • Like 12

Share this post


Link to post
Share on other sites

Hello,

I have written rcon in Perl, it works well on Linux and other systems.

It can be used in batch scripts easily.

If someone is interested please PM me.

Share this post


Link to post
Share on other sites

Hello' date='

I have written rcon in Perl, it works well on Linux and other systems.

It can be used in batch scripts easily.

If someone is interested please PM me.

[/quote']

You can send it to me, I'd like to check it out! :)

Share this post


Link to post
Share on other sites

Vipeax and I wrote a BattlEye Protocol Library for C#' date=' you could use this to for example notify your players before a restart via RCon.

To get an idea of how it would look, take a look at this sample code; [url']https://github.com/ziellos2k/BattleNET/blob/master/sample.cs'>https://github.com/ziellos2k/BattleNET/blob/master/sample.cs.

Licence

GPL

Binaries

https://github.com/ziellos2k/BattleNET

Source

https://github.com/ziellos2k/BattleNET-src

Changelog

2012-07-04

* License added

2012-06-28

* Complete BattlEye protocol implementation

i love youuuu... thought something like this would be awesome all the time..

Share this post


Link to post
Share on other sites

Could you explain a bit more how it works please? Since I only understood something like "warn before restart" and rest is like "wtfisthisshit" ^^

Thx in advance!

Share this post


Link to post
Share on other sites

Could you explain a bit more how it works please? Since I only understood something like "warn before restart" and rest is like "wtfisthisshit" ^^

Thx in advance!

It's basically a .dll file that programmers can use to communicate with BattlEye (i.e. warn about restarts automatically, etc). For you, I guess, it's not much of use in this state. :)

I may release a simple auto restart notifier in the coming days though.

Share this post


Link to post
Share on other sites

I will be on vacation for several weeks, I may get a bug up my bum to build a web management tool using this DLL. (Already started) The battleeye Gui tool that is out doesn't seem to work too well for me.

Thanks for all the hard work already done to create this library.

Share this post


Link to post
Share on other sites

Quick question here. I'm attempting to use your library in vb.net and I'm having a few issues... I can successfully use the following code and it does in fact send the commands through:


Dim loginCredentials As BattlEyeLoginCredentials = New BattlEyeLoginCredentials
loginCredentials.Host = "127.0.0.1"
loginCredentials.Port = "2342"
loginCredentials.Password = "123"
Dim b As IBattleNET = New BattlEyeClient(loginCredentials)
b.Connect()
b.SendCommandPacket(EBattlEyeCommand.Say, "-1 This is a global message.")
b.SendCommandPacket(EBattlEyeCommand.MaxPing, "200")
b.SendCommandPacket("say -1 This is another global message.")
b.Disconnect()

However it seems I cannot get the following to work:


b.MessageReceivedEvent += HandleMessage

and in fact there doesn't even seem to be a MessageReceivedEvent for me.

I do have the subclass:


Private Shared Sub HandleMessage(args As BattlEyeMessageEventArgs)
Console.WriteLine(args.Message)
End Sub

and:


Private Shared Sub HandleDisconnect(ByVal args As BattlEyeDisconnectEventArgs)

Console.WriteLine(args.Message)
Select Case (args.DisconnectionType)
Case EBattlEyeDisconnectionType.ConnectionLost

Case EBattlEyeDisconnectionType.LoginFailed

Case EBattlEyeDisconnectionType.Manual

Case EBattlEyeDisconnectionType.SocketException

End Select
End Sub

Edited by peperonikiller

Share this post


Link to post
Share on other sites

Very nice work. Thanks for this. I was looking for a way to write some tools for my server, and this will help immensely.

Share this post


Link to post
Share on other sites

How does one install this and use it? It would be nice for me so I dont have to get in chat to warn players

Share this post


Link to post
Share on other sites

How does one install this and use it? It would be nice for me so I dont have to get in chat to warn players

This is a development tool, not meant for general use. Unless you know C# and want to program your own tool, this probably isn't for you, as this is a .NET Class Library.

Share this post


Link to post
Share on other sites

[...]

No idea, zero experience with vb.net. I'm just guessing here but it could be that events in VB.NET are different from C#.NET? Also make sure you put b.MessageReceivedEvent += HandleMessage after Dim b As IBattleNET = New BattlEyeClient(loginCredentials) and before b.Connect(). No idea if it matters but that's all I can think of. :)

fyi BattleNet is already a thing

Who cares... Besides, I didn't pick the name. :P

Share this post


Link to post
Share on other sites

Ugg, I hate VB.Net...but += is not how you add handlers in VB.Net. You use AddHandler and AddressOf. Example:


AddHandler b.MessageReceivedEvent, AddressOf HandleMessage

+= is a C# syntactic sugar override to allow this to be easier.

Edited by Brainling
  • Like 1

Share this post


Link to post
Share on other sites

Ugg, I hate VB.Net...but += is not how you add handlers in VB.Net. You use AddHandler and AddressOf. Example:


AddHandler b.MessageReceivedEvent, AddressOf HandleMessage

+= is a C# syntactic sugar override to allow this to be easier.

I appreciate your help. Works like a charm. In case you're interested/want to help: http://dayzmod.com/forum/index.php?/topic/39628-server-admin-tool/#entry377033

  • Like 1

Share this post


Link to post
Share on other sites

Really neat, but 2 things:

You wrote "Succes" instead of "Success", just a little typo but still.

Fixed it already in the source you offer but maybe you want to correct it for yourself too.

Also, is there a way to wait for a response?

My program sometimes is too fast when calling SendCommandPacket and doesn't wait for a response.

I fixed it for now by letting the thread sleep but that is not really an elegant solutions.

Thanks anyway, comes in really handy for some stuff.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×