Ejemplo n.º 1
0
        private void InitQuest()
        {
            if (NextQuestInChain > 0)
            {
                if (!WorldServiceLocator._WorldServer.ALLQUESTS.IsValidQuest(NextQuestInChain))
                {
                    WS_QuestInfo tmpQuest2 = new WS_QuestInfo(NextQuestInChain);
                    if (!tmpQuest2.PreQuests.Contains(ID))
                    {
                        WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "Added prequest [{0}] to quest [{1}]", ID, NextQuestInChain);
                        tmpQuest2.PreQuests.Add(ID);
                    }
                }
                else if (!WorldServiceLocator._WorldServer.ALLQUESTS.DoesPreQuestExist(NextQuestInChain, ID))
                {
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "Added prequest [{0}] to quest [{1}]", NextQuestInChain, ID);
                    WorldServiceLocator._WorldServer.ALLQUESTS.ReturnQuestInfoById(NextQuestInChain).PreQuests.Add(ID);
                }
            }
            if (NextQuest == 0)
            {
                return;
            }
            int unsignedNextQuest = Math.Abs(NextQuest);
            int signedQuestID     = ((NextQuest < 0) ? checked (-ID) : ID);

            if (!WorldServiceLocator._WorldServer.ALLQUESTS.IsValidQuest(unsignedNextQuest))
            {
                WS_QuestInfo tmpQuest = new WS_QuestInfo(unsignedNextQuest);
                if (!tmpQuest.PreQuests.Contains(signedQuestID))
                {
                    WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "Added prequest [{0}] to quest [{1}]", signedQuestID, unsignedNextQuest);
                    tmpQuest.PreQuests.Add(signedQuestID);
                }
            }
            else if (!WorldServiceLocator._WorldServer.ALLQUESTS.DoesPreQuestExist(unsignedNextQuest, signedQuestID))
            {
                WorldServiceLocator._WorldServer.Log.WriteLine(LogType.DEBUG, "Added prequest [{0}] to quest [{1}]", signedQuestID, unsignedNextQuest);
                WorldServiceLocator._WorldServer.ALLQUESTS.ReturnQuestInfoById(unsignedNextQuest).PreQuests.Add(signedQuestID);
            }
        }
Ejemplo n.º 2
0
        public WS_QuestsBase(WS_QuestInfo Quest)
        {
            ID                  = 0;
            Title               = "";
            SpecialFlags        = 0;
            ObjectiveFlags      = 0;
            Slot                = 0;
            ObjectivesType      = new byte[4];
            ObjectivesItemCount = new byte[4];
            ObjectivesCount     = new byte[4];
            ObjectivesObject    = new int[4];
            ObjectivesExplore   = new int[4];
            ObjectivesSpell     = new int[4];
            ObjectivesItem      = new int[4];
            Explored            = true;
            Progress            = new byte[4];
            ProgressItem        = new byte[4];
            Complete            = false;
            Failed              = false;
            TimeEnd             = 0;
            byte bytLoop5 = 0;

            do
            {
                checked
                {
                    if (Quest.ObjectivesCastSpell[bytLoop5] > 0)
                    {
                        ObjectiveFlags           |= 16;
                        ObjectivesType[bytLoop5]  = 16;
                        ObjectivesSpell[bytLoop5] = Quest.ObjectivesCastSpell[bytLoop5];
                        ObjectivesObject[0]       = Quest.ObjectivesKill[bytLoop5];
                        ObjectivesCount[0]        = (byte)Quest.ObjectivesKill_Count[bytLoop5];
                    }
                    bytLoop5 = (byte)unchecked ((uint)(bytLoop5 + 1));
                }
            }while (bytLoop5 <= 3u);
            byte bytLoop4 = 0;

            do
            {
                checked
                {
                    if (Quest.ObjectivesKill[bytLoop4] > 0)
                    {
                        byte bytLoop6 = 0;
                        do
                        {
                            if (ObjectivesType[bytLoop6] == 0)
                            {
                                ObjectiveFlags            |= 1;
                                ObjectivesType[bytLoop6]   = 1;
                                ObjectivesObject[bytLoop6] = Quest.ObjectivesKill[bytLoop4];
                                ObjectivesCount[bytLoop6]  = (byte)Quest.ObjectivesKill_Count[bytLoop4];
                                break;
                            }
                            bytLoop6 = (byte)unchecked ((uint)(bytLoop6 + 1));
                        }while (bytLoop6 <= 3u);
                    }
                    bytLoop4 = (byte)unchecked ((uint)(bytLoop4 + 1));
                }
            }while (bytLoop4 <= 3u);
            byte bytLoop3 = 0;

            do
            {
                checked
                {
                    if (Quest.ObjectivesItem[bytLoop3] > 0)
                    {
                        ObjectiveFlags               |= 32;
                        ObjectivesType[bytLoop3]      = 32;
                        ObjectivesItem[bytLoop3]      = Quest.ObjectivesItem[bytLoop3];
                        ObjectivesItemCount[bytLoop3] = (byte)Quest.ObjectivesItem_Count[bytLoop3];
                    }
                    bytLoop3 = (byte)unchecked ((uint)(bytLoop3 + 1));
                }
            }while (bytLoop3 <= 3u);
            if (((uint)Quest.SpecialFlags & 2u) != 0)
            {
                ObjectiveFlags |= 2;
                byte bytLoop2 = 0;
                do
                {
                    ObjectivesType[bytLoop2]    = 2;
                    ObjectivesExplore[bytLoop2] = Quest.ObjectivesTrigger[bytLoop2];
                    checked
                    {
                        bytLoop2 = (byte)unchecked ((uint)(bytLoop2 + 1));
                    }
                }while (bytLoop2 <= 3u);
            }
            if (((uint)Quest.SpecialFlags & 8u) != 0)
            {
                ObjectiveFlags |= 8;
                int i = 0;
                do
                {
                    if (ObjectivesType[i] == 0)
                    {
                        ObjectivesType[i]  = 8;
                        ObjectivesCount[i] = 1;
                    }
                    i = checked (i + 1);
                }while (i <= 3);
            }
            checked
            {
                if (ObjectiveFlags == 0)
                {
                    byte bytLoop = 0;
                    do
                    {
                        ObjectivesObject[bytLoop]  = 0;
                        ObjectivesCount[bytLoop]   = 0;
                        ObjectivesExplore[bytLoop] = 0;
                        ObjectivesSpell[bytLoop]   = 0;
                        ObjectivesType[bytLoop]    = 0;
                        bytLoop = (byte)unchecked ((uint)(bytLoop + 1));
                    }while (bytLoop <= 3u);
                }
                Title             = Quest.Title;
                ID                = Quest.ID;
                SpecialFlags      = Quest.SpecialFlags;
                ObjectivesDeliver = Quest.ObjectivesDeliver;
                if (Quest.TimeLimit > 0)
                {
                    TimeEnd = (int)(WorldServiceLocator._Functions.GetTimestamp(DateAndTime.Now) + Quest.TimeLimit);
                }
            }
        }