public static void CompleteQuest(uint cid, uint questid) { Character value; if (LifeCycle.TryGetById(cid, out value)) { QuestBase scenarioQuest = value.QuestObjectives.Quests[3]; if (scenarioQuest != null && scenarioQuest.QuestId == questid) { Predicate <Saga.Quests.Objectives.ObjectiveList.Position> FindPosition = delegate(Saga.Quests.Objectives.ObjectiveList.Position point) { return(point.Quest == questid); }; lock (value.QuestObjectives.ScenarioPosition) { value.QuestObjectives.ScenarioPosition.RemoveAll(FindPosition); } value.QuestObjectives.ScenarioSteps.Remove(questid); value.QuestObjectives.Quests[3] = null; SMSG_SCENARIOCOMPLETE spkt = new SMSG_SCENARIOCOMPLETE(); spkt.Scenario = questid; spkt.SessionId = value.id; value.client.Send((byte[])spkt); Thread.Sleep(3); scenarioQuest.OnFinish(value.id); } } }
/// <summary> /// Quest Complete /// </summary> /// <remarks> /// Completes the current QuestBase. This should invoke our lua file, just as origional /// kRO2 does. This information is distracted from a leaked QuestBase file posted on some /// forum a while ago. /// </remarks> /// <param name="cpkt"></param> private void CM_QUESTCOMPLETE(CMSG_QUESTCOMPLETE cpkt) { QuestBase myQuestBase = this.character.QuestObjectives[cpkt.QuestID]; if (myQuestBase != null) { SMSG_QUESTREMOVE spkt = new SMSG_QUESTREMOVE(); spkt.QuestID = cpkt.QuestID; spkt.SessionId = this.character.id; this.character.Tag = spkt; if (myQuestBase.OnFinish(this.character.id) > -1) { //Removes the quest this.character.QuestObjectives[QuestBaseID] = null; //Invalidates all stepinfo QuestBase.InvalidateQuest(myQuestBase, this.character); //Logs into the quest history Singleton.Database.QuestComplete(this.character.ModelId, cpkt.QuestID); //Refresh personal reqeusts table CommonFunctions.RefreshPersonalRequests(this.character); //Refresh all our npc icons CommonFunctions.UpdateNpcIcons(this.character); if (this.character.Tag is SMSG_QUESTREMOVE) { this.character.Tag = null; this.Send((byte[])spkt); } } } }