public static void ListQuest(CommandArgs args)
        {
            QPlayer Player = QTools.GetPlayerByID(args.Player.Index);
            if (Player.IsLoggedIn)
            {
                Rectangle ply = new Rectangle((int)args.Player.X / 16, (int)args.Player.Y / 16, 1, 1);
                string availquests = "Available Quests: ";
                foreach (QuestRegion qr in QMain.QuestRegions)
                {
                    if (ply.Intersects(qr.Area))
                    {
                        foreach (Quest q in qr.Quests)
                        {
                            QuestPlayerData data = QTools.GetPlayerQuestData(q.Name, Player);

                            if (QTools.AbleToRunQuest(q) && (q.MinQuestsNeeded == 0 || q.MinQuestsNeeded <= QTools.GetQuestsCompleted(Player.MyDBPlayer.QuestPlayerData)) && (q.MaxAttemps == 0 || data == null || QTools.GetPlayerQuestData(q.Name, Player).Attempts < q.MaxAttemps))
                            {
                                availquests = availquests + q.Name + ", ";
                            }
                        }
                    }
                }

                if (availquests != "Available Quests: ")
                {
                    availquests = availquests.Substring(0, availquests.Length - 2);
                    Player.TSPlayer.SendMessage(availquests, Color.Magenta);
                    Player.TSPlayer.SendMessage("Use /startquest [Quest Name], to begin that quest", Color.Magenta);
                }
                else
                    Player.TSPlayer.SendMessage("No Available Quests", Color.Red);
            }
            else
                Player.TSPlayer.SendMessage("You are not Logged in", Color.Red);
        }
 public static bool AtXY(int x, int y, QPlayer Player, int radius = 1)
 {
     Rectangle rec, playerrec;
     rec = new Rectangle(x - radius, y - radius, radius * 2, radius * 2);
     playerrec = new Rectangle((int)Player.TSPlayer.X / 16, (int)Player.TSPlayer.Y / 16, 1, 1);
     return rec.Intersects(playerrec);
 }
        public static void StartQuest(CommandArgs args)
        {
            QPlayer Player = QTools.GetPlayerByID(args.Player.Index);
            if (Player.IsLoggedIn)
            {
                Rectangle ply = new Rectangle((int)args.Player.X / 16, (int)args.Player.Y / 16, 1, 1);
                bool questfound = false;

                foreach (QuestRegion qr in QMain.QuestRegions)
                {
                    if (ply.Intersects(qr.Area))
                    {
                        foreach (Quest q in qr.Quests)
                        {
                            QuestPlayerData data = QTools.GetPlayerQuestData(q.Name, Player);

                            if (QTools.AbleToRunQuest(q) && (q.MinQuestsNeeded == 0 || q.MinQuestsNeeded <= QTools.GetQuestsCompleted(Player.MyDBPlayer.QuestPlayerData)) && q.Name.ToLower() == args.Parameters[0].ToLower() && (q.MaxAttemps == 0 || data == null || QTools.GetPlayerQuestData(q.Name, Player).Attempts < q.MaxAttemps))
                            {
                                questfound = true;
                                break;
                            }
                        }
                    }
                    if (questfound)
                        break;
                }

                if (questfound)
                {
                    if (!Player.NewQuest(QTools.GetQuestByName(args.Parameters[0])))
                        Player.TSPlayer.SendMessage("Quest already running.", Color.Red);
                }
                else
                    Player.TSPlayer.SendMessage("Quest not found.", Color.Red);
            }
            else
                Player.TSPlayer.SendMessage("You are not Logged in", Color.Red);
        }