Beispiel #1
0
        internal static void EndQuest(int index, int QuestNum)
        {
            int I;

            QuestMessage(index, QuestNum, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Chat[3]), 0);
            var loopTo = Quest[QuestNum].RewardCount;

            for (I = 1; I <= loopTo; I++)
            {
                if (Quest[QuestNum].RewardItem[I] > 0)
                {
                    S_NetworkSend.PlayerMsg(index, "You recieved " + Quest[QuestNum].RewardItemAmount[I] + " " + Microsoft.VisualBasic.Strings.Trim(Types.Item[Quest[QuestNum].RewardItem[I]].Name), (int)Enums.ColorType.BrightGreen);
                }
                S_Players.GiveInvItem(index, Quest[QuestNum].RewardItem[I], Quest[QuestNum].RewardItemAmount[I]);
            }

            if (Quest[QuestNum].RewardExp > 0)
            {
                S_Players.SetPlayerExp(index, S_Players.GetPlayerExp(index) + Quest[QuestNum].RewardExp);
                S_NetworkSend.SendExp(index);
                // Check for level up
                S_Players.CheckPlayerLevelUp(index);
            }

            // Check if quest is repeatable, set it as completed
            if (Quest[QuestNum].Repeat == 1)
            {
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].Status = (byte)Enums.QuestStatusType.Repeatable;
            }
            else
            {
                modTypes.Player[index].Character[modTypes.TempPlayer[index].CurChar].PlayerQuest[QuestNum].Status = (byte)Enums.QuestStatusType.Completed;
            }
            S_NetworkSend.PlayerMsg(index, Microsoft.VisualBasic.Strings.Trim(Quest[QuestNum].Name) + ": quest completed", (int)Enums.ColorType.BrightGreen);

            modDatabase.SavePlayer(index);
            S_NetworkSend.SendPlayerData(index);
            SendPlayerQuest(index, QuestNum);
        }