Ejemplo n.º 1
0
        public async Task <bool> AddFriend(ulong steamID)
        {
            if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount)
            {
                throw new ArgumentOutOfRangeException(nameof(steamID));
            }

            if (Client == null)
            {
                throw new InvalidOperationException(nameof(Client));
            }

            if (!Client.IsConnected)
            {
                return(false);
            }

            CPlayer_AddFriend_Request request = new() { steamid = steamID };

            SteamUnifiedMessages.ServiceMethodResponse response;

            try {
                response = await UnifiedPlayerService.SendMessage(x => x.AddFriend(request)).ToLongRunningTask().ConfigureAwait(false);
            } catch (Exception e) {
                ArchiLogger.LogGenericWarningException(e);

                return(false);
            }

            return(response.Result == EResult.OK);
        }
Ejemplo n.º 2
0
        static void OnLoggedOn()
        {
            // now that we're logged onto Steam, lets query the IPlayer service for our badge levels

            // first, build our request object, these are autogenerated and can normally be found in the SteamKit2.Unified.Internal namespace
            //CPlayer_GetGameBadgeLevels_Request req = new CPlayer_GetGameBadgeLevels_Request {
            //    // we want to know our 440 (TF2) badge level
            //    appid = 440,
            //};

            bool send_chat = true;

            if (send_chat)
            {
                {
                    // ha ezt küldöd, akkor fogsz notificationoket kapni
                    uint chatMode = 2;
                    ClientMsgProtobuf <CMsgClientUIMode> request = new ClientMsgProtobuf <CMsgClientUIMode>(EMsg.ClientCurrentUIMode)
                    {
                        Body = { chat_mode = chatMode }
                    };
                    steamClient.Send(request);
                }



                CChatRoom_SendChatMessage_Request req = new CChatRoom_SendChatMessage_Request {
                    message                = "Bot logged in.",
                    messageSpecified       = true,
                    chat_group_id          = myGroupId,
                    chat_group_idSpecified = true,
                    chat_id                = defualtChatId,
                    chat_idSpecified       = true
                };
                chatRoomService.SendMessage(x => x.SendChatMessage(req));
            }
            else
            {
                CChatRoom_GetMyChatRoomGroups_Request req = new CChatRoom_GetMyChatRoomGroups_Request {
                    // empty message
                };


                // now lets send the request, this is done by building an expression tree with the IPlayer interface
                myJobID = chatRoomService.SendMessage(x => x.GetMyChatRoomGroups(req));
            }



            // alternatively, the request can be made using SteamUnifiedMessages directly, but then you must build the service request name manually
            // the name format is in the form of <Service>.<Method>#<Version>
            //steamUnifiedMessages.SendMessage("Player.GetGameBadgeLevels#1", req);
        }
Ejemplo n.º 3
0
        internal async Task <string> checkTime(uint appid, uint itemdefid)
        {
            CInventory_ConsumePlaytime_Request reponse = new CInventory_ConsumePlaytime_Request {
                appid = appid, itemdefid = itemdefid
            };
            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            _inventoryService = steamUnifiedMessages.CreateService <IInventory>();

            var responce = await _inventoryService.SendMessage(x => x.ConsumePlaytime(reponse));

            var result = responce.GetDeserializedResponse <CInventory_Response>();

            if (result.item_json != "[]")
            {
                try
                {
                    Console.WriteLine(result.item_json);
                    var summstring = "";

                    foreach (var item in QuickType.ItemList.FromJson(result.item_json))
                    {
                        summstring += $"Item droped {Client.SteamID} while {item.Origin} game:{appid} => {item.Quantity}x {item.Itemdefid} @ {item.StateChangedTimestamp}\n";
                    }
                    return(summstring);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            return($"No Item dropped for {Client.SteamID}");
        }
Ejemplo n.º 4
0
        public override void OnCommand(CommandArguments command)
        {
            if (command.Message.Length == 0)
            {
                CommandHandler.ReplyToCommand(command, "Usage:{0} servers <filter> - See https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol", Colors.OLIVE);

                return;
            }

            if (command.Message.IndexOf('\\') == -1)
            {
                CommandHandler.ReplyToCommand(command, "That doesn't look like a filter.");

                return;
            }

            var request = new CGameServers_GetServerList_Request
            {
                filter = command.Message,
                limit  = 5000,
            };

            JobManager.AddJob(
                () => GameServers.SendMessage(api => api.GetServerList(request)),
                new JobManager.IRCRequest
            {
                Type    = JobManager.IRCRequestType.TYPE_GAMESERVERS,
                Command = command
            }
                );
        }
Ejemplo n.º 5
0
        public Task <PublishedFileDetails> GetPubfileDetails(PublishedFileID pubFile)
        {
            var tsc = new TaskCompletionSource <PublishedFileDetails>();

            var pubFileRequest = new CPublishedFile_GetDetails_Request();

            pubFileRequest.publishedfileids.Add(pubFile);

            IDisposable subscription = null;
            Action <SteamUnifiedMessages.ServiceMethodResponse> cbMethod = callback =>
            {
                subscription.Dispose();
                if (callback.Result == EResult.OK)
                {
                    var response = callback.GetDeserializedResponse <CPublishedFile_GetDetails_Response>();
                    tsc.SetResult(response.publishedfiledetails[0]);
                }
                else
                {
                    tsc.SetResult(null);
                    throw new Exception($"EResult {(int)callback.Result} ({callback.Result}) while retrieving UGC id for pubfile {pubFile}.");
                }
            };

            subscription = callbacks.Subscribe(steamPublishedFile.SendMessage(api => api.GetDetails(pubFileRequest)), cbMethod);
            return(tsc.Task);
        }
Ejemplo n.º 6
0
        public override async Task OnCommand(CommandArguments command)
        {
            if (command.Message.Length == 0)
            {
                command.Reply($"Usage:{Colors.OLIVE} pubfile <pubfileid>");

                return;
            }

            if (!ulong.TryParse(command.Message, out var pubFileId))
            {
                command.Reply("Invalid Published File ID");

                return;
            }

            var pubFileRequest = new CPublishedFile_GetDetails_Request
            {
                includeadditionalpreviews = true,
                includechildren           = true,
                includetags        = true,
                includekvtags      = true,
                includevotes       = true,
                includeforsaledata = true,
                includemetadata    = true,
            };

            pubFileRequest.publishedfileids.Add(pubFileId);

            var task = PublishedFiles.SendMessage(api => api.GetDetails(pubFileRequest));

            task.Timeout = TimeSpan.FromSeconds(10);
            var callback = await task;
            var response = callback.GetDeserializedResponse <CPublishedFile_GetDetails_Response>();
            var details  = response.publishedfiledetails.FirstOrDefault();

            if (details == null)
            {
                command.Reply("Unable to make service request for published file info: the server returned no info");

                return;
            }

            var result = (EResult)details.result;

            if (result != EResult.OK)
            {
                command.Reply($"Unable to get published file info: {Colors.RED}{result}");

                return;
            }

            var json = JsonConvert.SerializeObject(details, Formatting.Indented);

            await File.WriteAllTextAsync(Path.Combine(Application.Path, "ugc", $"{details.publishedfileid}.json"), json, Encoding.UTF8);

            command.Reply($"{(EWorkshopFileType)details.file_type}, Title: {Colors.BLUE}{(string.IsNullOrWhiteSpace(details.title) ? "[no title]" : details.title)}{Colors.NORMAL}, Creator: {Colors.BLUE}{new SteamID(details.creator).Render()}{Colors.NORMAL}, App: {Colors.BLUE}{details.creator_appid}{(details.creator_appid == details.consumer_appid ? "" : $" (consumer {details.consumer_appid})")}{Colors.NORMAL}, File UGC: {Colors.BLUE}{details.hcontent_file}{Colors.NORMAL}, Preview UGC: {Colors.BLUE}{details.hcontent_preview}{Colors.NORMAL} -{Colors.DARKBLUE} {SteamDB.GetPublishedFileRawUrl(details.publishedfileid)}");
Ejemplo n.º 7
0
        public void OnMessage(CommandArguments command)
        {
            var matches = SharedFileMatch.Matches(command.Message);

            foreach (Match match in matches)
            {
                var pubFileId      = ulong.Parse(match.Groups["pubfileid"].Value);
                var pubFileRequest = new CPublishedFile_GetDetails_Request();

                pubFileRequest.publishedfileids.Add(pubFileId);

                JobManager.AddJob(
                    () => PublishedFiles.SendMessage(api => api.GetDetails(pubFileRequest)),
                    new JobManager.IRCRequest
                {
                    Type    = JobManager.IRCRequestType.TYPE_PUBFILE_SILENT,
                    Command = command
                }
                    );
            }
        }
Ejemplo n.º 8
0
        internal async Task <string> checkTime(uint appid, uint itemdefid, Bot bot)
        {
            CInventory_ConsumePlaytime_Request playtimeResponse = new CInventory_ConsumePlaytime_Request {
                appid = appid, itemdefid = itemdefid
            };
            CPlayer_GetOwnedGames_Request gamesOwnedRequest = new CPlayer_GetOwnedGames_Request {
                steamid = bot.SteamID, include_played_free_games = true
            };

            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            _inventoryService = steamUnifiedMessages.CreateService <IInventory>();
            _PlayerService    = steamUnifiedMessages.CreateService <IPlayer>();

            var consumePlaytimeResponse = await _inventoryService.SendMessage(x => x.ConsumePlaytime(playtimeResponse));

            var consumePlaytime = consumePlaytimeResponse.GetDeserializedResponse <CInventory_Response>();

            var ownedReponse = await _PlayerService.SendMessage(x => x.GetOwnedGames(gamesOwnedRequest));

            var resultGamesPlayed      = consumePlaytimeResponse.GetDeserializedResponse <CPlayer_GetOwnedGames_Response>();
            var resultFilteredGameById = resultGamesPlayed.games.Find(game => game.appid == appid);
            var appidPlaytimeForever   = 0;

            if (resultGamesPlayed != null && resultFilteredGameById != null)
            {
                appidPlaytimeForever = resultFilteredGameById.playtime_forever;
            }


            if (consumePlaytime.item_json != "[]")
            {
                try
                {
                    Console.WriteLine(consumePlaytime.item_json);
                    var summstring = "";

                    foreach (var item in QuickType.ItemList.FromJson(consumePlaytime.item_json))
                    {
                        summstring += $"Item drop @ {item.StateChangedTimestamp} => i.ID: {appid}_{item.Itemid}, i.Def: {item.Itemdefid} (playtime: {appidPlaytimeForever})";
                    }
                    return(summstring);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                }
            }
            return($"No item drop for game {appid} with playtime {appidPlaytimeForever}.");
        }
Ejemplo n.º 9
0
        public override async Task OnCommand(CommandArguments command)
        {
            if (command.Message.Length == 0)
            {
                command.Reply("Usage:{0} servers <filter> - See https://developer.valvesoftware.com/wiki/Master_Server_Query_Protocol", Colors.OLIVE);

                return;
            }

            if (command.Message.IndexOf('\\') == -1)
            {
                command.Reply("That doesn't look like a filter.");

                return;
            }

            var request = new CGameServers_GetServerList_Request
            {
                filter = command.Message,
                limit  = int.MaxValue,
            };

            var task = GameServers.SendMessage(api => api.GetServerList(request));

            task.Timeout = TimeSpan.FromSeconds(10);
            var callback = await task;
            var response = callback.GetDeserializedResponse <CGameServers_GetServerList_Response>();
            var servers  = response.servers;

            if (servers.Count == 0)
            {
                command.Reply("No servers.");

                return;
            }

            if (servers.Count == 1)
            {
                var server = servers[0];

                command.Reply($"{server.addr} - {new SteamID(server.steamid).Render(true)} - {Colors.GREEN}{server.players}/{server.max_players}{Colors.NORMAL} - Map: {Colors.DARKGRAY}{server.map}{Colors.NORMAL} - AppID: {Colors.DARKGRAY}{server.appid}{Colors.NORMAL} - Version: {Colors.DARKGRAY}{server.version}{Colors.NORMAL} - Dir: {Colors.DARKGRAY}{server.gamedir}{Colors.NORMAL} - Tags: {Colors.DARKGRAY}{server.gametype}{Colors.NORMAL} - Name: {Colors.DARKGRAY}{server.name}");

                return;
            }

            command.Reply($"{Colors.GREEN}{servers.Sum(x => x.players)}{Colors.NORMAL} players on {Colors.GREEN}{servers.Count}{Colors.NORMAL} servers. First three: {string.Join(" / ", servers.Take(3).Select(x => x.addr))}");
        }
Ejemplo n.º 10
0
        internal async Task <string> checkPlaytime(uint appid, Bot bot)
        {
            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            if (steamUnifiedMessages == null)
            {
                bot.ArchiLogger.LogNullError(nameof(steamUnifiedMessages));
                return("SteamUnifiedMessages Error");
            }

            CPlayer_GetOwnedGames_Request gamesOwnedRequest = new CPlayer_GetOwnedGames_Request {
                steamid = bot.SteamID, include_appinfo = true, include_free_sub = true, include_played_free_games = true
            };

            _PlayerService = steamUnifiedMessages.CreateService <IPlayer>();
            var ownedReponse = await _PlayerService.SendMessage(x => x.GetOwnedGames(gamesOwnedRequest));

            var consumePlaytime = ownedReponse.GetDeserializedResponse <CPlayer_GetOwnedGames_Response>();

            consumePlaytime.games.ForEach(action => bot.ArchiLogger.LogGenericInfo(message: $"{action.appid} - {action.has_community_visible_stats} - {action.name} - {action.playtime_forever}"));
            var resultFilteredGameById = consumePlaytime.games.Find(game => game.appid == ((int)appid));

            if (consumePlaytime.games == null)
            {
                bot.ArchiLogger.LogNullError(nameof(consumePlaytime.games));
            }
            if (resultFilteredGameById == null)
            {
                bot.ArchiLogger.LogNullError("resultFilteredGameById");
            }

            uint appidPlaytimeForever = 0;

            bot.ArchiLogger.LogGenericDebug(message: $"Playtime for {resultFilteredGameById.name} is: {resultFilteredGameById.playtime_forever}");
            appidPlaytimeForever = Convert.ToUInt32(resultFilteredGameById.playtime_forever);
            uint   appidPlaytimeHours   = appidPlaytimeForever / 60;
            byte   appidPlaytimeMinutes = Convert.ToByte(appidPlaytimeForever % 60);
            string PTMinutes            = appidPlaytimeForever.ToString("N0", CultureInfo.InvariantCulture);
            string PTHours = appidPlaytimeHours.ToString("N0", CultureInfo.InvariantCulture);

            var summstring = "";

            summstring += $"Playtime for game '{resultFilteredGameById.name}' is {PTMinutes}m = {PTHours}h {appidPlaytimeMinutes}m";

            return(summstring);
        }
Ejemplo n.º 11
0
        public bool RequestGames()
        {
            if (steamID == null)
            {
                return(false);
            }

            CPlayer_GetOwnedGames_Request req = new CPlayer_GetOwnedGames_Request()
            {
                steamid          = steamID,
                include_free_sub = false,
                include_appinfo  = true,
            };

            gameRequest = servicePlayer.SendMessage(x => x.GetOwnedGames(req));

            return(true);
        }
Ejemplo n.º 12
0
        public async void OnMessage(CommandArguments command)
        {
            var matches = SharedFileMatch.Matches(command.Message);

            foreach (Match match in matches)
            {
                var pubFileId      = ulong.Parse(match.Groups["pubfileid"].Value);
                var pubFileRequest = new CPublishedFile_GetDetails_Request
                {
                    includevotes = true,
                };

                pubFileRequest.publishedfileids.Add(pubFileId);

                var callback = await PublishedFiles.SendMessage(api => api.GetDetails(pubFileRequest));

                var response = callback.GetDeserializedResponse <CPublishedFile_GetDetails_Response>();
                var details  = response.publishedfiledetails.FirstOrDefault();

                if (details == null || (EResult)details.result != EResult.OK)
                {
                    return; // TODO
                }

                string title;

                if (!string.IsNullOrWhiteSpace(details.title))
                {
                    title = details.title;
                }
                else if (!string.IsNullOrEmpty(details.file_description))
                {
                    title = details.file_description;
                }
                else
                {
                    title = details.filename;
                }

                if (title.Length > 49)
                {
                    title = title.Substring(0, 49) + "…";
                }

                var votesUp   = details.vote_data != null ? details.vote_data.votes_up : 0;
                var votesDown = details.vote_data != null ? details.vote_data.votes_down : 0;

                if (command.CommandType == ECommandType.SteamChatRoom)
                {
                    Steam.Instance.Friends.SendChatRoomMessage(command.ChatRoomID, EChatEntryType.ChatMsg,
                                                               string.Format("» {0}: {1} for {2} ({3:N0} views, {4:N0} \ud83d\udc4d, {5:N0} \ud83d\udc4e){6}",
                                                                             (EWorkshopFileType)details.file_type,
                                                                             title,
                                                                             details.app_name,
                                                                             details.views,
                                                                             votesUp,
                                                                             votesDown,
                                                                             details.spoiler_tag ? " :retreat: SPOILER" : ""
                                                                             )
                                                               );
                }
                else
                {
                    IRC.Instance.SendReply(command.Recipient,
                                           string.Format("{0}» {1}{2} {3}{4}{5} for {6}{7}{8} ({9:N0} views, {10:N0} \ud83d\udc4d, {11:N0} \ud83d\udc4e)",
                                                         Colors.OLIVE,
                                                         Colors.NORMAL,
                                                         (EWorkshopFileType)details.file_type,
                                                         Colors.BLUE,
                                                         title,
                                                         Colors.NORMAL,
                                                         Colors.BLUE,
                                                         details.app_name,
                                                         Colors.LIGHTGRAY,
                                                         details.views,
                                                         votesUp,
                                                         votesDown
                                                         ),
                                           false
                                           );
                }

                break; // TODO: Fix this (can't really await in a foreach)
            }
        }
Ejemplo n.º 13
0
        public override async Task OnCommand(CommandArguments command)
        {
            if (command.Message.Length == 0)
            {
                command.Reply("Usage:{0} pubfile <pubfileid>", Colors.OLIVE);

                return;
            }

            if (!ulong.TryParse(command.Message, out var pubFileId))
            {
                command.Reply("Invalid Published File ID");

                return;
            }

            var pubFileRequest = new CPublishedFile_GetDetails_Request
            {
                includeadditionalpreviews = true,
                includechildren           = true,
                includetags        = true,
                includekvtags      = true,
                includevotes       = true,
                includeforsaledata = true,
                includemetadata    = true,
            };

            pubFileRequest.publishedfileids.Add(pubFileId);

            var task = PublishedFiles.SendMessage(api => api.GetDetails(pubFileRequest));

            task.Timeout = TimeSpan.FromSeconds(10);
            var callback = await task;
            var response = callback.GetDeserializedResponse <CPublishedFile_GetDetails_Response>();
            var details  = response.publishedfiledetails.FirstOrDefault();

            if (details == null)
            {
                command.Reply("Unable to make service request for published file info: the server returned no info");

                return;
            }

            var result = (EResult)details.result;

            if (result != EResult.OK)
            {
                command.Reply("Unable to get published file info: {0}{1}", Colors.RED, result);

                return;
            }

            var json = JsonConvert.SerializeObject(details, Formatting.Indented);

            await File.WriteAllTextAsync(Path.Combine(Application.Path, "ugc", string.Format("{0}.json", details.publishedfileid)), json, Encoding.UTF8);

            command.Reply("{0}, Title: {1}{2}{3}, Creator: {4}{5}{6}, App: {7}{8}{9}{10}, File UGC: {11}{12}{13}, Preview UGC: {14}{15}{16} -{17} {18}",
                          (EWorkshopFileType)details.file_type,
                          Colors.BLUE, string.IsNullOrWhiteSpace(details.title) ? "[no title]" : details.title, Colors.NORMAL,
                          Colors.BLUE, new SteamID(details.creator).Render(), Colors.NORMAL,
                          Colors.BLUE, details.creator_appid,
                          details.creator_appid == details.consumer_appid ? "" : string.Format(" (consumer {0})", details.consumer_appid),
                          Colors.NORMAL,
                          Colors.BLUE, details.hcontent_file, Colors.NORMAL,
                          Colors.BLUE, details.hcontent_preview, Colors.NORMAL,
                          Colors.DARKBLUE, SteamDB.GetPublishedFileRawUrl(details.publishedfileid)
                          );

            command.Notice("{0} - https://steamcommunity.com/sharedfiles/filedetails/?id={1}", details.file_url, details.publishedfileid);
        }
Ejemplo n.º 14
0
        internal async Task <string> checkTime(uint appid, uint itemdefid, Bot bot, bool longoutput)
        {
            var steamUnifiedMessages = Client.GetHandler <SteamUnifiedMessages>();

            if (steamUnifiedMessages == null)
            {
                bot.ArchiLogger.LogNullError(nameof(steamUnifiedMessages));
                return("SteamUnifiedMessages Error");
            }

            CInventory_ConsumePlaytime_Request playtimeRequest = new CInventory_ConsumePlaytime_Request {
                appid = appid, itemdefid = itemdefid
            };

            _inventoryService = steamUnifiedMessages.CreateService <IInventory>();
            var playtimeResponse = await _inventoryService.SendMessage(x => x.ConsumePlaytime(playtimeRequest));

            var resultGamesPlayed = playtimeResponse.GetDeserializedResponse <CInventory_Response>();


            if (resultGamesPlayed.item_json == null)
            {
                bot.ArchiLogger.LogGenericWarning(message: $"{resultGamesPlayed.item_json}");
            }
            if (resultGamesPlayed == null)
            {
                bot.ArchiLogger.LogNullError("resultGamesPlayed");
            }


            CPlayer_GetOwnedGames_Request gamesOwnedRequest = new CPlayer_GetOwnedGames_Request {
                steamid = bot.SteamID, include_appinfo = true, include_free_sub = true, include_played_free_games = true
            };

            _PlayerService = steamUnifiedMessages.CreateService <IPlayer>();
            var ownedReponse = await _PlayerService.SendMessage(x => x.GetOwnedGames(gamesOwnedRequest));

            var consumePlaytime = ownedReponse.GetDeserializedResponse <CPlayer_GetOwnedGames_Response>();

            consumePlaytime.games.ForEach(action => bot.ArchiLogger.LogGenericInfo(message: $"{action.appid} - {action.has_community_visible_stats} - {action.name} - {action.playtime_forever}"));
            var resultFilteredGameById = consumePlaytime.games.Find(game => game.appid == ((int)appid));

            if (consumePlaytime.games == null)
            {
                bot.ArchiLogger.LogNullError(nameof(consumePlaytime.games));
            }
            if (resultFilteredGameById == null)
            {
                bot.ArchiLogger.LogNullError("resultFilteredGameById ");
            }

            var appidPlaytimeForever = 0;

            if (resultGamesPlayed != null && resultFilteredGameById != null)
            {
                bot.ArchiLogger.LogGenericDebug(message: $"Playtime for {resultFilteredGameById.name} is: {resultFilteredGameById.playtime_forever}");
                appidPlaytimeForever = resultFilteredGameById.playtime_forever;
            }


            // proceed only when the player has played the request game id
            if (resultGamesPlayed != null && resultGamesPlayed.item_json != "[]")
            {
                try
                {
                    var summstring = "";

                    foreach (var item in QuickType.ItemList.FromJson(resultGamesPlayed.item_json))
                    {
                        if (longoutput)
                        {
                            summstring += $"Item drop @{item.StateChangedTimestamp} => i.ID: {appid}_{item.Itemid}, i.Def: {item.Itemdefid} (a.PT: {appidPlaytimeForever}m)";
                        }
                        else
                        {
                            summstring += $"Item drop @{item.StateChangedTimestamp}";
                        }

                        // item drop time taken from Steam, to be added to newline
                        string new_v0 = item.StateChangedTimestamp;

                        // Creating iDrop_Logfile if not exists and write a header
                        string iDrop_Logfile = "";
                        if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
                        {
                            // setting filename for Linux OS
                            iDrop_Logfile = $"plugins/ASFItemDropper/droplogs/{bot.BotName}_{appid}.log";
                        }
                        else
                        {
                            // setting filename for Windows OS
                            iDrop_Logfile = $"plugins\\ASFItemDropper\\droplogs\\{bot.BotName}_{appid}.log";
                        }

                        if (!File.Exists(iDrop_Logfile))
                        {
                            using (StreamWriter sw = File.AppendText(iDrop_Logfile))
                            {
                                // writing header information and first dummy data
                                sw.WriteLine($"# Droplog for bot '{bot.BotName}' and AppID {appid} ({resultFilteredGameById.name})");
                                sw.WriteLine($"# Timestamp;TimeDiff;Playtime;PlaytimeDiff");
                                sw.WriteLine($"{new_v0};0.00:00:00;0;0");
                            }
                        }

                        string   newline    = "";
                        string   lastline   = File.ReadLines(iDrop_Logfile).Last();
                        string[] old_values = lastline.Split(';', StringSplitOptions.TrimEntries);

                        // date format of item drop time from Steam, needed for converting
                        string format = "yyyyMMdd'T'HHmmss'Z'";

                        // converting item drop times back to UTC for later calculation
                        DateTime new_v0utc = DateTime.ParseExact(new_v0, format, CultureInfo.InvariantCulture);
                        DateTime old_v0utc = DateTime.ParseExact(old_values[0], format, CultureInfo.InvariantCulture);

                        // calculating difference between last two item drops (newline - lastline)
                        TimeSpan duration = new_v0utc.Subtract(old_v0utc);
                        string   new_v1   = duration.ToString(@"d\.hh\:mm\:ss", CultureInfo.InvariantCulture);

                        // setting and converting appidPlaytimeForever of game for later calculation
                        uint new_v2 = Convert.ToUInt32(appidPlaytimeForever);

                        // calculating the playtime difference from newline to lastline
                        uint new_v3 = new_v2 - Convert.ToUInt32(old_values[2]);

                        // setup and append newline to droplogfile
                        newline = $"{new_v0};{new_v1};{new_v2};{new_v3}";

                        using (StreamWriter sw = File.AppendText(iDrop_Logfile))
                        {
                            sw.WriteLine($"{newline}");
                        }
                    }
                    return(summstring);
                }
                catch (Exception e)
                {
                    bot.ArchiLogger.LogGenericError(message: e.Message);
                    return("Error while parse consumePlaytime");
                }
            }
            else
            {
                if (longoutput)
                {
                    return($"No item drop for game '{resultFilteredGameById.name}' with playtime {appidPlaytimeForever}m.");
                }
                else
                {
                    return($"No item drop.");
                }
            }
        }