Example #1
0
        public void SendQuestUpdate(Character_quest Quest, Character_Objectives Obj)
        {
            if (GetPlayer() == null)
                return;

            PacketOut Out = new PacketOut((byte)Opcodes.F_QUEST_UPDATE);
            Out.WriteUInt16(Quest.QuestID);
            Out.WriteByte(Convert.ToByte(Quest.IsDone()));
            Out.WriteByte(Obj.Objective.num);
            Out.WriteByte((byte)Obj.Count);
            Out.WriteUInt16(0);
            GetPlayer().SendPacket(Out);
        }
Example #2
0
        public bool AcceptQuest(Quest Quest)
        {
            if (Quest == null)
                return false;

            if (!CanStartQuest(Quest))
                return false;

            Character_quest CQuest = new Character_quest();
            CQuest.QuestID = Quest.Entry;
            CQuest.Done = false;
            CQuest.CharacterId = GetPlayer().CharacterId;
            CQuest.Quest = Quest;

            foreach(Quest_Objectives QObj in Quest.Objectives)
            {
                Character_Objectives CObj = new Character_Objectives();
                CObj.Quest = CQuest;
                CObj._Count = 0;
                CObj.Objective = QObj;
                CObj.ObjectiveID = QObj.Guid;
                CQuest._Objectives.Add(CObj);
            }

            CharMgr.Database.AddObject(CQuest);
            _Quests.Add(Quest.Entry, CQuest);

            SendQuestState(Quest, QuestCompletion.QUESTCOMPLETION_OFFER);

            // This will make objects lootable if they contain a quest object.
            updateObjects();

            _Owner.EvtInterface.Notify(EventName.ON_ACCEPT_QUEST, _Owner, CQuest);
            return true;
        }
Example #3
0
        public bool AcceptQuest(Quest Quest)
        {
            if (Quest == null)
                return false;

            if (!CanStartQuest(Quest))
                return false;

            Character_quest CQuest = new Character_quest();
            CQuest.QuestID = Quest.Entry;
            CQuest.Done = false;
            CQuest.CharacterID = GetPlayer().CharacterId;
            CQuest.Quest = Quest;

            // F_QUEST_LIST Quests not done
            Character_quest_inprogress IQuest = new Character_quest_inprogress();
            IQuest.QuestID = Quest.Entry;
            IQuest.CharacterID = GetPlayer().CharacterId;
            IQuest.Quest = Quest;

            foreach(Quest_Objectives QObj in Quest.Objectives)
            {
                Character_Objectives CObj = new Character_Objectives();
                CObj.Count = 0;
                CObj.Objective = QObj;
                CObj.ObjectiveID = QObj.Guid;
                CQuest._Objectives.Add(CObj);

                // F_QUEST_LIST Quests not done.
                Character_InProgressObjectives IObj = new Character_InProgressObjectives();
                IObj.Count = 0;
                IObj.Objective = QObj;
                IObj.ObjectiveID = QObj.Guid;
                IQuest._InProgressObjectives.Add(IObj);
            }

            _Quests.Add(Quest.Entry, CQuest);
            CharMgr.Database.AddObject(CQuest);

            // Add Quests into character_quest_inprogress Table.
            _InProgressQuests.Add(Quest.Entry, IQuest);
            CharMgr.Database.AddObject(IQuest);

            SendQuestState(Quest, QuestCompletion.QUESTCOMPLETION_OFFER);
            return true;
        }