Add offline farming, closes #41

This commit is contained in:
JustArchi
2015-12-20 19:01:05 +01:00
parent de3f3cd93b
commit 32e68f2be3
3 changed files with 31 additions and 1 deletions

View File

@@ -132,6 +132,9 @@ namespace ArchiSteamFarm {
}
switch (packetMsg.MsgType) {
case EMsg.ClientFSOfflineMessageNotification:
HandleFSOfflineMessageNotification(packetMsg);
break;
case EMsg.ClientPurchaseResponse:
HandlePurchaseResponse(packetMsg);
break;
@@ -141,12 +144,28 @@ namespace ArchiSteamFarm {
}
}
private void HandleFSOfflineMessageNotification(IPacketMsg packetMsg) {
if (packetMsg == null) {
return;
}
// TODO: Handle offline messages?
}
private void HandlePurchaseResponse(IPacketMsg packetMsg) {
if (packetMsg == null) {
return;
}
var response = new ClientMsgProtobuf<CMsgClientPurchaseResponse>(packetMsg);
Client.PostCallback(new PurchaseResponseCallback(response.Body));
}
private void HandleUserNotifications(IPacketMsg packetMsg) {
if (packetMsg == null) {
return;
}
var response = new ClientMsgProtobuf<CMsgClientUserNotifications>(packetMsg);
foreach (var notification in response.Body.notifications) {
Client.PostCallback(new NotificationCallback(notification));

View File

@@ -67,6 +67,7 @@ namespace ArchiSteamFarm {
internal ulong SteamMasterID { get; private set; } = 0;
internal ulong SteamMasterClanID { get; private set; } = 0;
internal bool CardDropsRestricted { get; private set; } = false;
internal bool FarmOnline { get; private set; } = true;
internal bool UseAsfAsMobileAuthenticator { get; private set; } = false;
internal bool ShutdownOnFarmingFinished { get; private set; } = false;
internal HashSet<uint> Blacklist { get; private set; } = new HashSet<uint> { 303700, 335590, 368020, 425280 };
@@ -301,6 +302,9 @@ namespace ArchiSteamFarm {
case "CardDropsRestricted":
CardDropsRestricted = bool.Parse(value);
break;
case "FarmOnline":
FarmOnline = bool.Parse(value);
break;
case "ShutdownOnFarmingFinished":
ShutdownOnFarmingFinished = bool.Parse(value);
break;
@@ -688,7 +692,9 @@ namespace ArchiSteamFarm {
return;
}
SteamFriends.SetPersonaState(EPersonaState.Online);
if (FarmOnline) {
SteamFriends.SetPersonaState(EPersonaState.Online);
}
}
private void OnLoggedOff(SteamUser.LoggedOffCallback callback) {

View File

@@ -63,6 +63,11 @@
<!-- TIP: Based on this parameter, ASF will try to choose the most optimal cards farming algorithm for this account -->
<CardDropsRestricted type="bool" value="false"/>
<!-- This switch defines if the account should show as "Online" after logging in to Steam -->
<!-- Please note that bot won't be able to respond to any commands when this property is "false" -->
<!-- TIP: Setting this to "false" may be useful for primary accounts, to not show as online when you're not here -->
<FarmOnline type="bool" value="true"/>
<!-- This switch defines if bot should disconnect once farming is finished -->
<!-- When no bots are active, ASF will shutdown as well -->
<!-- Some people may want to keep their bots 24/7, other disconnect them after job is done -->