简体   繁体   中英

Simple bot for browser based game

I'm trying to create simple bot for a browser-based game. I was using GecoFX, it's perfect. I can do everything that I want with that library. (posting forms, getting values, clicking buttons etc. everything you want). Also I'm able to use proxy with GeckoFX too. But I'm having big trouble with this library. When you set proxy once, it's global. I mean you set a proxy and created 2 geckoFX controls, both of them using same proxy and same cookies. when geckoFX1 logins to game if you go to same URL with geckoFX2 the pages are same with geckoFX1. Because their profiles are same, using same cookies and proxies... What should I do? Do you know another method to do my job? Also geckoFX is open source project. Can I edit the proxy and profile properties to make them un-global?

This is how you set proxy:

Gecko.GeckoPreferences.User["network.proxy.ssl"] = txtIP.Text;
Gecko.GeckoPreferences.User["network.proxy.ssl_port"] = intPort;
Gecko.GeckoPreferences.User["network.proxy.type"] = 1;
Gecko.ProfileDirectory = ""; // That property stores cookies

And maybe I can edit and make this like:

geckoWebBrowser1.Preferences.User["proxy"] = IP;
geckoWebBrowser1.Preferences.User["proxy"] = Port;
geckoWebBrowser1.Preferences.User["proxy"] = IP;
geckoWebBrowser1.PorfileDir = ""

Please don't reply like "yes, you can". Of course I can, I already know that but how? Where should I edit?

Create a class that does what you want it to do, then make 2 objects based on that class. This way, you can isolate them and they won't affect each other anymore. Then, in your main() method, initialize both of them:

pseudocode:

GeckoContainer gkc1 = new GeckoContainer(127.0.0.1, 1142);
GeckoContainer gkc2 = new GeckoContainer(127.0.0.1, 1123);
gkc1.Start();
gkc2.Start();

or whatever.

You have to implement the class by yourself.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM