예제 #1
0
파일: Misc.cs 프로젝트: Yoshitsune1998/PWBG
        public async Task UsingItem(int index, IGuildUser taggedUser = null, int optional = 0)
        {
            if (!GlobalVar.CanUseItem)
            {
                return;
            }
            if (UserAccounts.CheckHaveThisDebuff(UserAccounts.GetUserAccount(Context.User), "Panic"))
            {
                await Context.Channel.SendMessageAsync($"Cant use item in panic {Context.User.Mention}");

                return;
            }
            if (UserAccounts.IsDead(Context.User))
            {
                return;
            }
            if (!IsHavingThisRole((SocketGuildUser)Context.User, "Survivor"))
            {
                return;
            }
            GlobalVar.GuildSelect   = Context.Guild;
            GlobalVar.ChannelSelect = (SocketTextChannel)Context.Channel;
            if (taggedUser != null)
            {
                var target = UserAccounts.GetUserAccount((SocketUser)taggedUser);
                await Inventories.UseActiveItem(Context.User, index, target, optional);
            }
            else
            {
                await Inventories.UseActiveItem(Context.User, index, null, optional);
            }
        }
예제 #2
0
파일: Misc.cs 프로젝트: Yoshitsune1998/PWBG
        public async Task Answering([Remainder] string answer)
        {
            if (!GlobalVar.QuizHasBeenStarted)
            {
                return;
            }
            if (!IsHavingThisRole((SocketGuildUser)Context.User, "Survivor"))
            {
                return;
            }
            if (UserAccounts.IsDead(Context.User))
            {
                return;
            }
            UserAccount user  = UserAccounts.GetUserAccount(Context.User);
            ulong       id    = GlobalVar.Selected.ID;
            int         point = Quizzes.CheckAnswer(answer, id);

            if (point == 0)
            {
                return;
            }
            await Context.Channel.SendMessageAsync($"{Context.User.Mention} {point} point(s)");

            UserAccounts.TempPoints(user, point);
        }