Пример #1
0
        public static ProfileDB Instance()
        {
            //Singleton
            if (_instance == null)
            {
                _instance = new ProfileDB();
            }

            return(_instance);
        }
Пример #2
0
        public async Task RegisterCommand([Remainder] string nickname)
        {
            bool result = ProfileDB.Instance().Register(nickname, Context.User.Id.ToString(), Context.Guild.Id.ToString());

            if (result)
            {
                await ReplyAsync($"{nickname} adlı profil oluşturuldu");
            }
            else
            {
                await ReplyAsync($"Mevcut bir profiliniz bulunmakta. !profil");
            }
        }
Пример #3
0
        public async Task ProfileCommand()
        {
            Profile p = ProfileDB.Instance().FindProfile(Context.User.Id.ToString(), Context.Guild.Id.ToString());

            if (p == null)
            {
                await ReplyAsync("Hesabınıza ait profil bulunamadı");
            }
            else
            {
                EmbedBuilder builder = new EmbedBuilder();
                builder.WithTitle($"**{p.Nickname}**").
                WithColor(Color.DarkBlue).
                WithDescription($"Zenith: {p.zenith}\n Zafer: {p.win}\n Kayıp: {p.lose}");

                await ReplyAsync("", false, builder.Build());
            }
        }
Пример #4
0
        public string StartGame(string userId, string guildId)
        {
            if (player1 == null)
            {
                player1 = ProfileDB.Instance().FindProfile(userId, guildId);

                if (player1 == null)
                {
                    return("Lütfen oyuna başlamadan önce profil oluşturun");
                }
                else if (player1.zenith < 50)
                {
                    player1 = null;
                    return("Yeterli zenithe sahip değilsin");
                }

                return("İkinci oyuncu bekleniyor");
            }
            else if (player2 == null)
            {
                player2 = ProfileDB.Instance().FindProfile(userId, guildId);

                if (player2 == null)
                {
                    return("Lütfen oyuna başlamadan önce profil oluşturun");
                }
                else if (player2.zenith < 50)
                {
                    player2 = null;
                    return("Yeterli zenithe sahip değilsin");
                }

                isStart = true;

                player1.zenith -= 50;
                player2.zenith -= 50;

                startTime = DateTime.UtcNow;
                return("50'şer zenith alındı, 2 taştan fazlasını ilk toplayan kazanır. Oyun başlıyor.");
            }

            return("");
        }
Пример #5
0
        public async Task DailyCommand()
        {
            Profile p = ProfileDB.Instance().FindProfile(Context.User.Id.ToString(), Context.Guild.Id.ToString());

            if (p == null)
            {
                await ReplyAsync("Hesabınıza ait profil bulunamadı");
            }
            else
            {
                if (p.daily.AddDays(1) <= DateTime.Now)
                {
                    p.zenith += 25;
                    p.daily   = DateTime.Now;
                    p.UpdateProfile();
                    await ReplyAsync("25 zenith kazandın, yarın da gel");
                }
                else
                {
                    await ReplyAsync("Ödül için 1 gün beklemelisin\nSon ödül tarihi: '" + p.daily + "'");
                }
            }
        }
Пример #6
0
 public void UpdateProfile()
 {
     ProfileDB.Instance().UpdateProfile(zenith, win, lose, daily, UserId, GuildId);
 }