mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2025-12-16 14:30:31 +00:00
Add very basic statistics
This commit is contained in:
@@ -223,6 +223,45 @@ namespace ArchiSteamFarm {
|
||||
return result;
|
||||
}
|
||||
|
||||
internal async Task JoinClan(ulong clanID) {
|
||||
if (clanID == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
string sessionID;
|
||||
if (!SteamCookieDictionary.TryGetValue("sessionid", out sessionID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
string request = "http://steamcommunity.com/gid/" + clanID;
|
||||
|
||||
Dictionary<string, string> postData = new Dictionary<string, string>() {
|
||||
{"sessionID", sessionID},
|
||||
{"action", "join"}
|
||||
};
|
||||
|
||||
await Utilities.UrlPostRequest(request, postData, SteamCookieDictionary).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal async Task LeaveClan(ulong clanID) {
|
||||
if (clanID == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
string sessionID;
|
||||
if (!SteamCookieDictionary.TryGetValue("sessionid", out sessionID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
string request = GetHomeProcess();
|
||||
Dictionary<string, string> postData = new Dictionary<string, string>() {
|
||||
{"sessionID", sessionID},
|
||||
{"action", "leaveGroup"},
|
||||
{"groupId", clanID.ToString()}
|
||||
};
|
||||
await Utilities.UrlPostRequest(request, postData, SteamCookieDictionary).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal async Task<bool> AcceptTradeOffer(ulong tradeID) {
|
||||
if (tradeID == 0) {
|
||||
return false;
|
||||
@@ -275,26 +314,6 @@ namespace ArchiSteamFarm {
|
||||
return response != null; // Steam API doesn't respond with any error code, assume any response is a success
|
||||
}
|
||||
|
||||
internal async Task LeaveClan(ulong clanID) {
|
||||
if (clanID == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
string sessionID;
|
||||
if (!SteamCookieDictionary.TryGetValue("sessionid", out sessionID)) {
|
||||
return;
|
||||
}
|
||||
|
||||
string request = GetHomeProcess();
|
||||
Dictionary<string, string> postData = new Dictionary<string, string>() {
|
||||
{"sessionID", sessionID},
|
||||
{"action", "leaveGroup"},
|
||||
{"groupId", clanID.ToString()}
|
||||
};
|
||||
|
||||
await Utilities.UrlPostRequest(request, postData, SteamCookieDictionary).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
internal async Task<HtmlDocument> GetBadgePage(int page) {
|
||||
if (SteamID == 0 || page == 0) {
|
||||
return null;
|
||||
|
||||
@@ -64,6 +64,7 @@ namespace ArchiSteamFarm {
|
||||
internal ulong SteamMasterID { get { return ulong.Parse(Config["SteamMasterID"]); } }
|
||||
private ulong SteamMasterClanID { get { return ulong.Parse(Config["SteamMasterClanID"]); } }
|
||||
internal HashSet<uint> Blacklist { get; } = new HashSet<uint>();
|
||||
internal bool Statistics { get { return bool.Parse(Config["Statistics"]); } }
|
||||
|
||||
internal Bot(string botName) {
|
||||
BotName = botName;
|
||||
@@ -129,6 +130,7 @@ namespace ArchiSteamFarm {
|
||||
SteamFriends = SteamClient.GetHandler<SteamFriends>();
|
||||
CallbackManager.Subscribe<SteamFriends.FriendsListCallback>(OnFriendsList);
|
||||
CallbackManager.Subscribe<SteamFriends.FriendMsgCallback>(OnFriendMsg);
|
||||
CallbackManager.Subscribe<SteamFriends.PersonaStateCallback>(OnPersonaState);
|
||||
|
||||
SteamUser = SteamClient.GetHandler<SteamUser>();
|
||||
CallbackManager.Subscribe<SteamUser.AccountInfoCallback>(OnAccountInfo);
|
||||
@@ -270,6 +272,18 @@ namespace ArchiSteamFarm {
|
||||
}
|
||||
}
|
||||
|
||||
private void OnPersonaState(SteamFriends.PersonaStateCallback callback) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
SteamID steamID = callback.FriendID;
|
||||
SteamID sourceSteamID = callback.SourceSteamID;
|
||||
string steamNickname = callback.Name;
|
||||
EPersonaState personaState = callback.State;
|
||||
EClanRank clanRank = (EClanRank) callback.ClanRank;
|
||||
}
|
||||
|
||||
private void OnAccountInfo(SteamUser.AccountInfoCallback callback) {
|
||||
if (callback == null) {
|
||||
return;
|
||||
@@ -324,6 +338,11 @@ namespace ArchiSteamFarm {
|
||||
SteamFriends.JoinChat(clanID);
|
||||
}
|
||||
|
||||
if (Statistics) {
|
||||
SteamFriends.JoinChat(Program.ArchiSCFarmGroup);
|
||||
await ArchiWebHandler.JoinClan(Program.ArchiSCFarmGroup).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
await CardsFarmer.StartFarming().ConfigureAwait(false);
|
||||
break;
|
||||
case EResult.Timeout:
|
||||
|
||||
@@ -37,6 +37,7 @@ namespace ArchiSteamFarm {
|
||||
TwoFactorAuthentication,
|
||||
}
|
||||
|
||||
internal const ulong ArchiSCFarmGroup = 103582791440160998;
|
||||
internal const string ConfigDirectoryPath = "config";
|
||||
private static readonly HashSet<Bot> Bots = new HashSet<Bot>();
|
||||
internal static readonly object ConsoleLock = new object();
|
||||
|
||||
@@ -39,4 +39,9 @@
|
||||
<!-- TIP: Most likely you don't want to change it -->
|
||||
<Blacklist type="HashSet(uint)" value="368020"/>
|
||||
|
||||
<!-- This enables statistics for me - bot will join Archi's SC Farm group and chat -->
|
||||
<!-- Consider leaving it at "true", this way I can check how many running bots are active -->
|
||||
<!-- TIP: Group link is http://steamcommunity.com/groups/ascfarm -->
|
||||
<Statistics type="bool" value="true"/>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user