raid-toolkit / raid-toolkit-sdk

MIT License
40 stars 13 forks source link

working with client in .net #126

Open pavlexander opened 8 months ago

pavlexander commented 8 months ago

Hello,

Is it possible to read some real-time data from the running Raid instance? For example :

In my attempts - I have tried reading the live data through the provided API in .net:

    internal class Program
    {
        static async Task Main(string[] args)
        {
            RaidToolkitClient client = new();
            try
            {
                client.Connect();

                var accounts = await client.AccountApi.GetAccounts();
                var acc = accounts[0].Id;

                client.RealtimeApi.AccountListUpdated += AccountListUpdated;
                client.RealtimeApi.ViewChanged += ViewChanged;
                client.RealtimeApi.ReceiveBattleResponse += ReceiveBattleResponse;

                client.AccountApi.Updated += Updated;

                Console.ReadKey();
            }
            catch (Exception ex)
            {
                Console.WriteLine($"An error occurred: {ex.Message}");
            }
            finally
            {
                client.Disconnect();
            }
        }

        public static void AccountListUpdated(object? sender, SerializableEventArgs args)
        {
            Console.WriteLine(args.EventName);
        }

        public static void ViewChanged(object? sender, SerializableEventArgs args)
        {
            Console.WriteLine(args.EventName);
        }

        public static void ReceiveBattleResponse(object? sender, SerializableEventArgs args)
        {
            Console.WriteLine(args.EventName);
        }

        public static void Updated(object? sender, SerializableEventArgs args)
        {
            Console.WriteLine(args.EventName);
        }
    }

but events are never triggered. Does not matter if you change the view in-game, or battling etc, no events are shown in console.. what am I doing wrong? Other methods such as "get account info"/etc are working fine..

Basically I am just interested in the live data and want to know if it's possible to read it through the tool or not.