コード例 #1
0
        public void hasPlayerFinishedQuest_KillAnimal(BasePlayer player, string entityName)
        {
            QuestInfo    qI           = QuestINFO(player);
            List <Quest> ActiveQuests = qI.ActiveQuests();

            if (ActiveQuests.Count < 1)
            {
                return;
            }
            foreach (var q in ActiveQuests)
            {
                if (entityName == q.qObjective)
                {
                    UpdateKilled(q, GetKilledAmount(q, player) + 1, player);
                    int amountTmp = GetKilledAmount(q, player);
                    Notification(player, String.Format("You have killed {0}/{1} <color=aqua>{2}</color>", amountTmp, q.qAmount, char.ToUpper(q.qObjective[0]) + q.qObjective.Substring(1)));
                    if (amountTmp >= q.qAmount)
                    {
                        CompletedQuest(q, player);
                        PlayerRewardItem(player, q.qReward, q.qRewardAmount);
                        return;
                    }
                    else
                    {
                        return;
                    }
                }
            }
            return;
        }
コード例 #2
0
        public void AbandonQuest(BasePlayer player, string[] args, ref string t)
        {
            Quest RequestQuest, myQuest;

            if (args.Length != 2)
            {
                t += "Usage: <color=lightblue>/quests abandon \"questname\"</color>. Please try again.";
                return;
            }

            RequestQuest = FindQuest(args[1].ToLower());
            if (RequestQuest != null)
            {
                QuestInfo    qI           = QuestINFO(player);
                List <Quest> ActiveQuests = qI.ActiveQuests();
                //t += String.Format("Requested Quest: {0}\n", ConvertToUpper(RequestQuest.qName));
                //List<KeyValuePair<string, Quest>> aQuests = ActiveQuests(player.userID.ToString());
                if (!ActiveQuests.Contains(RequestQuest))
                {
                    t += "You are not on this quest!";
                    return;
                }
                else
                {
                    RemovePlayerFromQuest(RequestQuest, player);
                    return;
                }
            }
            else
            {
                t += "There is no quest by the name of \"<color=lightblue>" + args[1].ToLower() + "</color>\". Please try again!";
                return;
            }
        }
コード例 #3
0
        public void AcceptQuest(BasePlayer player, string[] args, ref string t)
        {
            Quest RequestQuest, myQuest;

            if (args.Length != 2)
            {
                t += "Usage: <color=lightblue>/quests accept \"questname\"</color>. Please try again.";
                return;
            }

            RequestQuest = FindQuest(args[1].ToLower());
            if (RequestQuest != null)
            {
                //t += String.Format("Requested Quest: {0}\n", ConvertToUpper(RequestQuest.qName));
                QuestInfo    qI           = QuestINFO(player);
                List <Quest> ActiveQuests = qI.ActiveQuests();

                /*               List<KeyValuePair<string, Quest>> aQuests = ActiveQuests(player.userID.ToString());
                 *             if (aQuests.Count >= 1) { t += "You are not able to be on more than one quest at a time..."; return; }*/
                if (!ActiveQuests.Contains(RequestQuest))
                {
                    AddPlayerToQuest(RequestQuest, player);
                }
                else
                {
                    t += "You are already on this quest!";
                }
            }
            else
            {
                t += "There is no quest by the name of \"<color=lightblue>" + args[1].ToLower() + "</color>\". Please try again!";
                return;
            }
        }
コード例 #4
0
        public void UserActiveQuests(BasePlayer player, string[] args, ref string t)
        {
            int pageIndex = 1;

            if (args.Length > 1)
            {
                try
                {
                    pageIndex = Convert.ToInt32(args[1]);
                } catch (Exception)
                {
                    t += "Error, you must use numbers, no letters... i.e. /quests active 1";
                    return;
                }
            }
            t += "<color=lightblue>Active quest | Page " + pageIndex + "</color>\n";
            QuestInfo    qI           = QuestINFO(player);
            List <Quest> ActiveQuests = qI.ActiveQuests();

            if (ActiveQuests.Count < 1)
            {
                t += String.Format("You are currently not on a quest!"); return;
            }
            var pages = ConvertQuests(ActiveQuests).Skip(pageIndex * 5 - 5).Take(5);

            if (pages.Count() < 1)
            {
                t += "There are no active quests beyond this point."; return;
            }
            foreach (var q in pages)
            {
                t += String.Format("<color=red>{0}</color>\n\t\t {1}\n\t\t <color=lightblue>Reward: </color><color=aqua>{2}</color>\n", ConvertToUpper(q.Value.qName), q.Value.qDescription, q.Value.qReward);
            }
        }
コード例 #5
0
        public void ShowQuestProgress(BasePlayer player, string[] args, ref string t)
        {
            int pageIndex = 1;

            if (args.Length > 1)
            {
                try
                {
                    pageIndex = Convert.ToInt32(args[1]);
                }
                catch (Exception)
                {
                    t += "Error, you must use numbers, no letters... i.e. /quests progress 1";
                    return;
                }
            }
            t += "<color=lightblue>Quest Progress | Page " + pageIndex + "</color>\n";
            QuestInfo    qI           = QuestINFO(player);
            List <Quest> ActiveQuests = qI.ActiveQuests();

            if (ActiveQuests.Count < 1)
            {
                t += String.Format("You are currently not on a quest!"); return;
            }
            var pages = ConvertQuests(ActiveQuests).Skip(pageIndex * 5 - 5).Take(5);

            if (pages.Count() < 1)
            {
                t += "There are no active quests beyond this point."; return;
            }
            foreach (var q in pages)
            {
                int amount = 0;
                if (q.Value.qType == "gather")
                {
                    amount = GetGatheredAmount(q.Value, player);
                }
                if (q.Value.qType == "kill")
                {
                    amount = GetKilledAmount(q.Value, player);
                }
                t += String.Format("<color=red>{0}</color>\n\t\tCompleted Amount: {1} / {2}\t\t\tReward: {3} [x{4}]\n", ConvertToUpper(q.Value.qName), amount, q.Value.qAmount, q.Value.qReward, q.Value.qRewardAmount);
            }
        }
コード例 #6
0
        public void hasPlayerFinishedQuest_Gather(BasePlayer player, BaseEntity entity, Item item)
        {
            QuestInfo    qI           = QuestINFO(player);
            List <Quest> ActiveQuests = qI.ActiveQuests();

            if (ActiveQuests.Count < 1)
            {
                return;
            }
            foreach (var q in ActiveQuests)
            {
                //Notification(player, q.Value.qObjective + " | " + item.info.shortname);
                if (q.qObjective == item.info.shortname)
                {
                    UpdateGathered(q, GetGatheredAmount(q, player) + item.amount, player);
                    item.amount = 0;

                    int aGathered = GetGatheredAmount(q, player);

                    var cP = (double)aGathered / q.qAmount;
                    if (LastPercentChange == 0.00)
                    {
                        LastPercentChange = cP;
                    }
                    var    lP  = LastPercentChange;
                    var    rPC = rateOfChange;
                    double pC  = (double)cP - lP;
                    if (pC >= rPC)
                    {
                        Notification(player, String.Format("Amount Gathered for <color=lightblue>{0}</color>: <color=aqua>{1} / {2}</color>", ConvertToUpper(q.qName), aGathered, q.qAmount));
                        LastPercentChange = cP;
                        SaveQuests();
                    }
                    hasCompletedQuest(player, item, q);
                    return;
                }
            }
            return;
        }