Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting...");

            Console.WriteLine("Creating new Configuration...");
            User config = new User()
            {
                Username = "******",
                Password = "******",
                DeviceId = DracoUtils.GenerateDeviceId(),
                Login    = "******"
            };

            Config options = new Config()
            {
                CheckProtocol = true,
                EventsCounter = new Dictionary <string, int>(),
                Lang          = "English",
                TimeOut       = 0,
                UtcOffset     = 7200
            };

            var draco = new DracoClient(null, options);

            Console.WriteLine("Ping...");
            var ping = draco.Ping();

            if (!ping)
            {
                throw new Exception();
            }

            Console.WriteLine("Boot...");
            draco.Boot(config);

            Console.WriteLine("Login...");
            var login = draco.Login().Result;

            if (login == null)
            {
                throw new Exception("Unable to login");
            }

            var newLicence = login.info.newLicense;

            if (login.info.sendClientLog)
            {
                Console.WriteLine("Send client log is set to true! Please report.");
            }

            draco.Post("https://us.draconiusgo.com/client-error", new
            {
                appVersion = draco.ClientVersion,
                deviceInfo = $"platform = iOS\"nos ={ draco.ClientInfo.platformVersion }\"ndevice = iPhone 6S",
                userId     = draco.User.Id,
                message    = "Material doesn\"t have a texture property \"_MainTex\"",
                stackTrace = "",
            });

            if (newLicence > 0)
            {
                draco.AcceptLicence(newLicence);
            }

            Console.WriteLine("Init client...");
            draco.Load();

            Console.WriteLine("Get user items...");
            var response = draco.Inventory.GetUserItems() as FBagUpdate;

            foreach (var item in response.items)
            {
                Console.WriteLine($"  item = { English.Load["key.item."+ item.type.ToString()]}, count = { item.count}");
            }

            Console.WriteLine("Get map update");
            FUpdate         map       = draco.GetMapUpdate(45.469896, 9.180439, 20);
            FCreatureUpdate creatures = map.items.Find(o => o.GetType() == typeof(FCreatureUpdate)) as FCreatureUpdate;
            FHatchedEggs    hatched   = map.items.Find(o => o.GetType() == typeof(FHatchedEggs)) as FHatchedEggs;
            FChestUpdate    chests    = map.items.Find(o => o.GetType() == typeof(FChestUpdate)) as FChestUpdate;
            FAvaUpdate      avatar    = map.items.Find(o => o.GetType() == typeof(FAvaUpdate)) as FAvaUpdate;
            FBuildingUpdate buildings = map.items.Find(o => o.GetType() == typeof(FBuildingUpdate)) as FBuildingUpdate;

            Console.WriteLine($"  { creatures.inRadar.Count} creature(s) in radar");
            foreach (var creature in creatures.inRadar)
            {
                var id   = creature.id;
                var name = English.Load["creature." + creature.name.ToString()];
                Console.WriteLine($"    creature { name } ({ creature.coords.latitude }, ${ creature.coords.longitude }) [id: { id }]");
            }

            Console.WriteLine("Done.\r\nPress one key to exit...");
            Console.ReadKey();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting...");

            Console.WriteLine("Creating new Configuration...");
            User config = new User()
            {
                Username = "******",
                Password = "******",
                DeviceId = DracoUtils.GenerateDeviceId(),
                Login    = "******"
            };

            Config options = new Config()
            {
                CheckProtocol = true,
                EventsCounter = new Dictionary <string, int>(),
                Lang          = "English",
                TimeOut       = 0,
                UtcOffset     = 7200
            };

            var draco = new DracoClient(null, options);

            Console.WriteLine("Ping...");
            var ping = draco.Ping();

            if (!ping)
            {
                throw new Exception();
            }

            Console.WriteLine("Boot...");
            draco.Boot(config);

            Console.WriteLine("Login...");
            var login = draco.Login().Result;

            if (login == null)
            {
                throw new Exception("Unable to login");
            }

            var newLicence = login.info.newLicense;

            if (login.info.sendClientLog)
            {
                Console.WriteLine("Send client log is set to true! Please report.");
            }

            draco.Post("https://us.draconiusgo.com/client-error", new
            {
                appVersion = draco.ClientVersion,
                deviceInfo = $"platform = iOS\"nos ={ draco.ClientInfo.platformVersion }\"ndevice = iPhone 6S",
                userId     = draco.User.Id,
                message    = "Material doesn\"t have a texture property \"_MainTex\"",
                stackTrace = "",
            });

            if (newLicence > 0)
            {
                draco.AcceptLicence(newLicence);
            }

            Console.WriteLine("Init client...");
            draco.Load();

            Console.WriteLine("Get creatures...");
            var response = draco.Inventory.GetUserCreatures();

            foreach (var creature in response.userCreatures)
            {
                var name = creature.alias ?? English.Load["creature." + creature.name.ToString()];
                Console.WriteLine($"  { name } lvl { creature.level}, cp= {creature.cp}");
            }

            Console.WriteLine("Done.\r\nPress one key to exit...");
            Console.ReadKey();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting...");

            Console.WriteLine("Creating new Configuration...");
            User config = new User()
            {
                Username = "******",
                Password = "******",
                DeviceId = DracoUtils.GenerateDeviceId(),
                Login    = "******"
            };

            Config options = new Config()
            {
                CheckProtocol = true,
                EventsCounter = new Dictionary <string, int>(),
                Lang          = "English",
                TimeOut       = 0,
                UtcOffset     = 7200
            };

            var draco = new DracoClient(null, options);

            Console.WriteLine("Boot...");
            draco.Boot(config);

            Console.WriteLine("Login...");
            var login = draco.Login().Result;

            if (login == null)
            {
                throw new Exception("Unable to login");
            }

            var newLicence = login.info.newLicense;

            if (login.info.sendClientLog)
            {
                Console.WriteLine("Send client log is set to true! Please report.");
            }

            draco.Post("https://us.draconiusgo.com/client-error", new
            {
                appVersion = draco.ClientVersion,
                deviceInfo = $"platform = iOS\"nos ={ draco.ClientInfo.platformVersion }\"ndevice = iPhone 6S",
                userId     = draco.User.Id,
                message    = "Material doesn\"t have a texture property \"_MainTex\"",
                stackTrace = "",
            });

            if (newLicence > 0)
            {
                draco.AcceptLicence(newLicence);
            }

            Console.WriteLine("Generate nickname...");
            var nickname = GenerateNickname();
            var response = draco.ValidateNickName(nickname);

            while (response != null && response.error == FNicknameValidationError.DUPLICATE)
            {
                nickname = response.suggestedNickname;
                response = draco.ValidateNickName(nickname);
            }
            if (response == null)
            {
                throw new Exception("Unable to register nickname. Error: " + response.error);
            }
            Console.WriteLine("  nickname: " + nickname);

            Console.WriteLine("Accept tos...");
            draco.AcceptToS();

            Console.WriteLine("Register account...");
            draco.Register(nickname);

            Console.WriteLine("Set avatar...");
            draco.SetAvatar(271891);

            Console.WriteLine("Load...");
            draco.Load();

            Console.WriteLine("Done.\r\nPress one key to exit...");
            Console.ReadKey();
        }