示例#1
0
        /// <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[cpkt.QuestID] = 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);
                    }
                }
            }
        }