예제 #1
0
        private void OnLootPicked(Dictionary <byte, object> parameters)
        {
            if (parameters.ContainsKey(3))
            {
                return;
            }
            try
            {
                string looter     = parameters[2].ToString();
                string quantity   = parameters[5].ToString();
                int    itemId     = int.Parse(parameters[4].ToString());
                string itemName   = itemDictionary[itemId];
                string deadPlayer = parameters[1].ToString();

                Loot loot = new Loot
                {
                    Id         = itemId,
                    ItemName   = itemName,
                    Quantity   = int.Parse(quantity.ToString()),
                    PickupTime = DateTime.UtcNow,
                    BodyName   = deadPlayer,
                    LooterName = looter
                };

                if (!loot.IsTrash)
                {
                    lootService.AddLootForPlayer(loot, looter, playerDictionary);
                    string path = Path.Combine(Directory.GetCurrentDirectory(), "logs.txt");
                    string line = $"{looter} has looted {quantity}x {itemName} on {deadPlayer}";

                    using (StreamWriter sw = File.AppendText(path))
                    {
                        sw.WriteLine(line);
                    }
                }
            }
            catch (Exception e)
            {
            }
        }
예제 #2
0
        private void OnLootPicked(Dictionary <byte, object> parameters)
        {
            try
            {
                string text  = parameters[2].ToString();
                string text2 = parameters[5].ToString();
                int    num   = int.Parse(parameters[4].ToString());
                string text3 = itemDictionary[num];
                string text4 = parameters[1].ToString();
                string text5 = DateTime.UtcNow.ToString();
                Loot   loot  = new Loot
                {
                    Id         = num,
                    ItemName   = text3,
                    Quantity   = int.Parse(text2.ToString()),
                    PickupTime = DateTime.UtcNow,
                    BodyName   = text4,
                    LooterName = text
                };
                if (!loot.IsTrash)
                {
                    lootService.AddLootForPlayer(loot, text);
                    string path   = Path.Combine(Directory.GetCurrentDirectory(), "log-" + logTimer + ".csv");
                    string value  = " + [" + text5 + "] " + text + " has looted " + text3 + " x " + text2 + " from " + text4;
                    string value2 = text5 + ";" + text + ";" + text3 + ";" + text2 + ";" + text4;

                    Console.WriteLine(value);
                    using (StreamWriter streamWriter = File.AppendText(path))
                    {
                        streamWriter.WriteLine(value2);
                    }
                }
            }
            catch (Exception)
            {
            }
        }